gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit97110ad997110ad9WIP: nest accepted layout selectors; stopped at startup parse failuremre97110ad9/theme/shell/app-header.hl

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

Branches

Latest commits

  • 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
  • b05c20feBackup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
  • 8d9ed0b8Re-vendor complete Hybriel plugins and runtime to day39mre
  • ebd00b6cNest caller slot styles in three-panemre
  • 009991efNest caller slot styles in list-firstmre
  • 494d75d4Nest caller slot styles in app-sidebarmre
  • e5571680Align all plugin sources with Hybriel day38bmre
  • 5d204c46Re-vendor layouts to Hybriel set day38bmre
  • 17e0f03eNest html-prefixed theme component overridesmre
  • e54e735eFormat plain theme elements with nested rules and bare mediamre
  • 547f834eRecord LY7 deployment and live verificationmre
  • fa4600b1Link caller-slot style exceptions to hybriel#270mre
  • 413b11e1Record corrected LY7 nesting, exact CSS and Chrome proofmre
  • b810453etracker-demo: nest child and compound selectors in Stylemre
  • 0b5b1d61notes-demo: nest child and compound selectors in Stylemre
  • ab22bdc2mail-demo: nest child and compound selectors in Stylemre
  • fe2d8de9home: nest child and compound selectors in Stylemre
  • e631791buser-menu: nest child and compound selectors in Stylemre