gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitb243fffab243fffalayouts#9: tap density stays at 60rem; palette rule names HyperConductorAtlasb243fffa/theme/shell/app-header.hl

5.4 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 (768px+): 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. '> a.brand' {
  35. flex = '0 1 auto'
  36. minWidth = '0'
  37. marginRight = 'auto'
  38. overflow = 'hidden'
  39. lineHeight = 'var(--layout-tap)'
  40. fontSize = '1.4rem'
  41. fontWeight = '100'
  42. color = 'var(--color-text-strong)'
  43. textOverflow = 'ellipsis'
  44. whiteSpace = 'nowrap'
  45. hover {
  46. textDecoration = 'none'
  47. color = 'var(--color-accent)'
  48. }
  49. }
  50. '> button' {
  51. flex = 'none'
  52. width = 'var(--layout-tap)'
  53. height = 'var(--layout-tap)'
  54. minHeight = '0'
  55. padding = '0'
  56. color = 'var(--color-text)'
  57. background = 'transparent'
  58. hover { background = 'var(--color-surface)' }
  59. }
  60. '> button.menu-toggle' { marginLeft = '-.625rem' }
  61. '> form.search:popover-open' {
  62. position = 'fixed'
  63. inset = 'var(--layout-header) 0 auto 0'
  64. display = 'block'
  65. width = '100%'
  66. height = 'auto'
  67. margin = '0'
  68. padding = '.5rem var(--layout-gutter) .75rem'
  69. color = 'var(--color-text)'
  70. background = 'var(--color-background-sunken)'
  71. border = '0'
  72. }
  73. '> form.search:not(:popover-open)' { display = 'none' }
  74. '> form.search' {
  75. input {
  76. width = '100%'
  77. minWidth = '0'
  78. minHeight = 'var(--layout-tap)'
  79. }
  80. }
  81. @media {
  82. minWidth = '768px'
  83. gap = '1rem'
  84. '> a.brand' { flexShrink = '0' }
  85. }
  86. @media {
  87. // density (tap size) stays at 60rem
  88. minWidth = '60rem'
  89. '> form.search' {
  90. input {
  91. minHeight = '2.25rem'
  92. padding = '.4rem .8rem'
  93. }
  94. }
  95. }
  96. }
  97. // Keep the whole selector for :has condition.
  98. 'body:not(:has(#sidebar)) application-header > button.menu-toggle' { display = 'none' }
  99. // Keep the whole selector for pseudo-element.
  100. 'application-header > form.search::backdrop' { background = 'transparent' }
  101. // Keep the whole selector for selector list, :has condition.
  102. 'body:has(list-first) application-header,
  103. body:has(three-pane) application-header' { paddingInline = 'var(--layout-gutter)' }
  104. // Keep the whole selector for selector list.
  105. 'application-header > button.menu-toggle,
  106. application-header > button.search-toggle' {
  107. @media {
  108. minWidth = '768px'
  109. display = 'none'
  110. }
  111. }
  112. @media {
  113. minWidth = '768px'
  114. // Keep the whole selector for selector list.
  115. 'application-header > form.search,
  116. application-header > form.search:not(:popover-open),
  117. application-header > form.search:popover-open' {
  118. position = 'static'
  119. inset = 'auto'
  120. display = 'flex'
  121. flex = '1 1 auto'
  122. minWidth = '0'
  123. width = 'auto'
  124. maxWidth = '28rem'
  125. height = 'auto'
  126. margin = '0 auto'
  127. padding = '0'
  128. overflow = 'visible'
  129. color = 'inherit'
  130. background = 'transparent'
  131. border = '0'
  132. }
  133. }
  134. }
  135. View {
  136. applicationHeader {
  137. button { type = "button" class = "menu-toggle" popovertarget = "sidebar" title = menuLabel 'aria-label' = menuLabel
  138. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "2" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  139. path { d = "M4 6h16M4 12h16M4 18h16" }
  140. }
  141. }
  142. a { class = "brand" href = brandHref brand }
  143. if (hasSearch) {
  144. form { id = "app-search" class = "search" role = "search" method = "get" action = search popover = "auto" on toggle(e) { emit headerSearchToggle(e) }
  145. input { type = "search" name = searchName placeholder = searchPlaceholder 'aria-label' = searchLabel autocomplete = "off" }
  146. }
  147. button { type = "button" class = "search-toggle" popovertarget = "app-search" title = searchLabel 'aria-label' = searchLabel
  148. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "2" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  149. circle { cx = "11" cy = "11" r = "6.5" }
  150. path { d = "M16 16l4.5 4.5" }
  151. }
  152. }
  153. }
  154. slot
  155. }
  156. }
  157. // the phone's search opened: the field takes the focus (the popover has none of its own)
  158. on headerSearchToggle(e) {
  159. if (e.newState == 'open') { e.target.querySelector('input').focus() }
  160. }

Branches

Latest commits

  • b243fffalayouts#9: tap density stays at 60rem; palette rule names HyperConductorAtlas
  • 2027f696layouts#9: field focus glow back to HyperConductor's .45Atlas
  • 88e1d14d|||PR layouts#9: address Kunibert findings (3-pane 768px, :where invalid focus, placeholder & glow contrast)Atlas
  • 8c875a78|||PR layouts#9: match HyperConductor look (lines 1-21)Atlas
  • 4099e64aMerge branch 'font-segoe-ui' into mainAtlas
  • e14fb795|||PR Theme font: Segoe UI first (his choice 2026-11-19)Atlas
  • 44071d2cMerge branch 'hl-standard-5' into mainAtlas
  • 5ea64202|||PR Gate: count the new-tab check's console errors tooAtlas
  • 2752ceddMerge branch 'hl-standard-4' into mainAtlas
  • ac552b81|||PR Gate: keyboard (Tab/Enter/Space) and Back/Forward/reload/new-tab checks (HL-STANDARD F5, F21)Atlas
  • 8cddcaa9Merge branch 'hl-standard-2' into mainAtlas
  • 2b480a64|||PR Type the route parameter of main-menu build (HL-STANDARD L10)Atlas
  • ab54a39dMerge branch 'hl-standard' into mainAtlas
  • 04d36fcf|||PR Type function parameters and drop unneeded let (HL-STANDARD L2, L10)Atlas
  • 220c8fa4Merge branch 'readme-audit' into mainAtlas
  • b78fb85a|||PR README matches the codemre
  • 9f351699Preserve comments and nest supported selectors without changing rendered outputmre
  • 97110ad9WIP: nest accepted layout selectors; stopped at startup parse failuremre
  • ce4a0baeKeep caller slot styles whole so minimal shell apps startmre
  • 12cd3992Re-vendor complete Hybriel plugins and runtime to day44mre