gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit846a6242846a6242user-menu: format Style with nested rules and bare mediamre846a6242/theme/shell/app-header.hl

5.8 KB

  1. // app-header.hl — THE HEADER of a WorldAPI app: brand, search, main menu, user menu (docs/layouts/app-header.md).
  2. // Phone: [sidebar toggle] brand … [loupe] [user menu]; the main menu lives in the sidebar overlay, the search field opens
  3. // under the bar from the loupe. Desktop (60rem+): brand · search in the middle · main menu · user menu; the toggle and the
  4. // loupe are gone. The bar's background runs full width, its contents start and end flush with the content column
  5. // (--layout-column); in the full-width shells (list-first, three-pane) they span the page.
  6. //
  7. // AppHeader { brand = "Tracker" search = "/search"
  8. // MainMenu { items = menu current = "/series" }
  9. // UserMenu { name = "az5b2" a { href = "/settings" "Settings" } a { href = "/logout" "Logout" } }
  10. // }
  11. //
  12. // The toggle opens `#sidebar` (theme/shell/app-sidebar.hl) with the browser's popover: no script, Esc and a tap outside
  13. // close it. A page without a sidebar shows no toggle. The search field is the popover `#app-search` on the phone.
  14. String brand = 'WorldAPI'
  15. String brandHref = '/'
  16. String search = '' // the search form's action ('' = no search); it sends GET <search>?<searchName>=…
  17. String searchName = 'q'
  18. String searchLabel = 'Search'
  19. String searchPlaceholder = 'Search…'
  20. String menuLabel = 'Menu'
  21. Boolean hasSearch = search != ''
  22. slot = null
  23. Style {
  24. applicationHeader {
  25. position = 'sticky'
  26. top = '0'
  27. zIndex = '20'
  28. display = 'flex'
  29. alignItems = 'center'
  30. gap = '.25rem'
  31. height = 'var(--layout-header)'
  32. paddingInline = 'max(var(--layout-gutter), calc((100% - var(--layout-column)) / 2))'
  33. background = 'var(--color-background-sunken)'
  34. @media {
  35. minWidth = '60rem'
  36. gap = '1rem'
  37. }
  38. }
  39. // No language form for direct-child combinator.
  40. 'application-header > a.brand' {
  41. flex = '0 1 auto'
  42. minWidth = '0'
  43. marginRight = 'auto'
  44. overflow = 'hidden'
  45. lineHeight = 'var(--layout-tap)'
  46. fontSize = '1.1rem'
  47. fontWeight = '800'
  48. color = 'var(--color-text-strong)'
  49. textOverflow = 'ellipsis'
  50. whiteSpace = 'nowrap'
  51. hover {
  52. textDecoration = 'none'
  53. color = 'var(--color-accent)'
  54. }
  55. }
  56. // No language form for direct-child combinator.
  57. 'application-header > button' {
  58. flex = 'none'
  59. width = 'var(--layout-tap)'
  60. height = 'var(--layout-tap)'
  61. minHeight = '0'
  62. padding = '0'
  63. color = 'var(--color-text)'
  64. }
  65. // No language form for direct-child combinator.
  66. 'application-header > button.menu-toggle' { marginLeft = '-.625rem' }
  67. // No language form for direct-child combinator, :not/:has condition, context outside this component View.
  68. 'body:not(:has(#sidebar)) application-header > button.menu-toggle' { display = 'none' }
  69. // No language form for direct-child combinator.
  70. 'application-header > form.search:popover-open' {
  71. position = 'fixed'
  72. inset = 'var(--layout-header) 0 auto 0'
  73. display = 'block'
  74. width = '100%'
  75. height = 'auto'
  76. margin = '0'
  77. padding = '.5rem var(--layout-gutter) .75rem'
  78. color = 'var(--color-text)'
  79. background = 'var(--color-background-sunken)'
  80. border = '0'
  81. }
  82. // No language form for direct-child combinator, :not/:has condition.
  83. 'application-header > form.search:not(:popover-open)' { display = 'none' }
  84. // No language form for direct-child combinator, pseudo-element.
  85. 'application-header > form.search::backdrop' { background = 'transparent' }
  86. // No language form for direct-child combinator.
  87. 'application-header > form.search input' {
  88. width = '100%'
  89. minHeight = 'var(--layout-tap)'
  90. background = 'var(--color-background)'
  91. }
  92. // No language form for selector list, :not/:has condition, context outside this component View.
  93. 'body:has(list-first) application-header,
  94. body:has(three-pane) application-header' { paddingInline = 'var(--layout-gutter)' }
  95. // No language form for selector list, direct-child combinator.
  96. 'application-header > button.menu-toggle,
  97. application-header > button.search-toggle' {
  98. @media {
  99. minWidth = '60rem'
  100. display = 'none'
  101. }
  102. }
  103. @media {
  104. minWidth = '60rem'
  105. // No language form for selector list, direct-child combinator, :not/:has condition.
  106. 'application-header > form.search,
  107. application-header > form.search:not(:popover-open),
  108. application-header > form.search:popover-open' {
  109. position = 'static'
  110. inset = 'auto'
  111. display = 'flex'
  112. flex = '1 1 auto'
  113. width = 'auto'
  114. maxWidth = '28rem'
  115. height = 'auto'
  116. margin = '0 auto'
  117. padding = '0'
  118. overflow = 'visible'
  119. color = 'inherit'
  120. background = 'transparent'
  121. border = '0'
  122. }
  123. // No language form for direct-child combinator.
  124. 'application-header > form.search input' {
  125. minHeight = '2.25rem'
  126. padding = '.4rem .8rem'
  127. }
  128. }
  129. }
  130. View {
  131. applicationHeader {
  132. button { type = "button" class = "menu-toggle" popovertarget = "sidebar" title = menuLabel 'aria-label' = menuLabel
  133. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "2" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  134. path { d = "M4 6h16M4 12h16M4 18h16" }
  135. }
  136. }
  137. a { class = "brand" href = brandHref brand }
  138. if (hasSearch) {
  139. form { id = "app-search" class = "search" role = "search" method = "get" action = search popover = "auto" on toggle(e) { emit headerSearchToggle(e) }
  140. input { type = "search" name = searchName placeholder = searchPlaceholder 'aria-label' = searchLabel autocomplete = "off" }
  141. }
  142. button { type = "button" class = "search-toggle" popovertarget = "app-search" title = searchLabel 'aria-label' = searchLabel
  143. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "2" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  144. circle { cx = "11" cy = "11" r = "6.5" }
  145. path { d = "M16 16l4.5 4.5" }
  146. }
  147. }
  148. }
  149. slot
  150. }
  151. }
  152. // the phone's search opened: the field takes the focus (the popover has none of its own)
  153. on headerSearchToggle(e) {
  154. if (e.newState == 'open') { e.target.querySelector('input').focus() }
  155. }

Branches

Latest commits

  • 846a6242user-menu: format Style with nested rules and bare mediamre
  • 4d58708cthree-pane: format Style with nested rules and bare mediamre
  • 0bbfc553main-menu: format Style with nested rules and bare mediamre
  • 7755199dlist-first: format Style with nested rules and bare mediamre
  • 35199303content-first: format Style with nested rules and bare mediamre
  • 00f6e698app-sidebar: format Style with nested rules and bare mediamre
  • bb2f29c9app-header: format Style with nested rules and bare mediamre
  • 3aca2d7fSync components from 8176eb1 with reviewed nested stylesmre
  • 87e4003dRe-vendor layouts to Hybriel set day35mre
  • d8628cfflayouts: a startup error prints its message before exit 1 (hybriel#247)mre
  • 180fd76elayouts: MdEditor from components 59704ce (text on the clipboard always pastes, a file manager copy still attaches; pipe rows; empty Table-button table; tickets#49, notes#5)mre
  • a3eda8afRe-vendor Hybriel master 7a684920 (binary 74ab3715): plugins whole, startup fault exits 1; files-upload gate 340/0mre
  • 025d5880WIP re-vendor Hybriel set-day27b (a9712e61, master f5ff97bf): plugins whole, startup fault exits 1; NOT deployable: files-upload emit refused (see .scratch/rv27-upload)mre
  • 42183a71Merge sb3-standby: layouts deploys through its standbymre
  • 408de1f2layouts: no jobs switch needed in the standbymre
  • 0b85f57elayouts: a standby container (port 45019, profile standby); deploy hands over through standby-swap.sh without a gapmre
  • 31e40b8bMerge dm3-media: range handling in the layouts media routemre
  • 856dcacbLayouts media route: read suffix ranges and ignore range lists and garbage, like the components route (the layouts copy still answered 416 for the last bytes)mre
  • ad5056eaMerge dm3-sync: components re-sync to c2834ddmre
  • 740e2abeRe-sync the components copy to c2834dd: media player fixes (state after a queue pick, cover-less audio, accessibility labels)mre