gitoria

layouts

All repositories: gitoria

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

3.8 KB

  1. // user-menu.hl — THE USER MENU: one icon at the header's right end; a tap opens a dropdown with the signed-in name and the
  2. // links the app puts in (last always Logout, before it Settings — creator, tracker#32) (docs/layouts/user-menu.md).
  3. // Signed out, the app puts its login (the ident selector) in the header INSTEAD of this component.
  4. //
  5. // AppHeader { … UserMenu { name = "az5b2" a { href = "/settings" "Settings" } a { href = "/logout" "Logout" } } }
  6. //
  7. // The dropdown is the browser's popover `#user-menu`: Esc and a tap outside close it, and so does a tap on one of its links.
  8. String name = ''
  9. String label = 'User menu'
  10. slot = null
  11. Style {
  12. userMenu {
  13. display = 'block'
  14. flex = 'none'
  15. // No unquoted child/sibling combinator form; keep exact selector (probe v18).
  16. '> button' {
  17. width = 'var(--layout-tap)'
  18. height = 'var(--layout-tap)'
  19. minHeight = '0'
  20. marginRight = '-.625rem'
  21. padding = '0'
  22. color = 'var(--color-text)'
  23. svg {
  24. width = '1.5rem'
  25. height = '1.5rem'
  26. }
  27. }
  28. // No nested form for this functional/popup pseudo on day44 (v08/v11).
  29. '> nav:popover-open' {
  30. position = 'fixed'
  31. inset = 'var(--layout-header) max(var(--layout-gutter), calc((100% - var(--layout-column)) / 2)) auto auto'
  32. display = 'block'
  33. minWidth = '12rem'
  34. maxWidth = 'calc(100vw - 2 * var(--layout-gutter))'
  35. margin = '.25rem 0 0'
  36. padding = '.4rem'
  37. color = 'var(--color-text)'
  38. background = 'var(--color-surface)'
  39. border = '0'
  40. borderRadius = 'var(--radius-large)'
  41. boxShadow = '0 .75rem 2rem var(--color-background-sunken)'
  42. }
  43. // Class rule would lose its ancestor or has no View reference (probe v03; hybriel#243).
  44. 'p.who' {
  45. margin = '0'
  46. padding = '.4rem .6rem .5rem'
  47. fontSize = '.85rem'
  48. color = 'var(--color-text-muted)'
  49. overflow = 'hidden'
  50. textOverflow = 'ellipsis'
  51. whiteSpace = 'nowrap'
  52. empty { display = 'none' }
  53. }
  54. }
  55. // Keep the whole selector for selector list, :has condition.
  56. // No nested form for this functional/popup pseudo on day44 (v08/v11).
  57. 'body:has(list-first) user-menu > nav:popover-open,
  58. body:has(three-pane) user-menu > nav:popover-open' { right = 'var(--layout-gutter)' }
  59. // Keep the whole selector for pseudo-element.
  60. // No nested pseudo-element form on day44 (probes v09/v10; hybriel#344/#345/#260).
  61. 'user-menu > nav::backdrop' { background = 'transparent' }
  62. // Keep the whole selector for selector list.
  63. // No unquoted child/sibling combinator form; keep exact selector (probe v18).
  64. 'user-menu > nav a,
  65. user-menu > nav button' {
  66. display = 'flex'
  67. width = '100%'
  68. minHeight = 'var(--layout-tap)'
  69. alignItems = 'center'
  70. justifyContent = 'flex-start'
  71. padding = '.5rem .6rem'
  72. fontWeight = '600'
  73. color = 'var(--color-text)'
  74. borderRadius = 'var(--radius-small)'
  75. }
  76. // Keep the whole selector for selector list.
  77. // No unquoted child/sibling combinator form; keep exact selector (probe v18).
  78. 'user-menu > nav a:hover,
  79. user-menu > nav button:hover' {
  80. textDecoration = 'none'
  81. color = 'var(--color-text-strong)'
  82. background = 'var(--color-background)'
  83. }
  84. }
  85. View {
  86. userMenu {
  87. button { type = "button" class = "user-toggle" popovertarget = "user-menu" title = label 'aria-label' = label
  88. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "1.8" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  89. circle { cx = "12" cy = "12" r = "10" }
  90. circle { cx = "12" cy = "10" r = "3.2" }
  91. path { d = "M6.2 18.6c1.4-2.2 3.4-3.3 5.8-3.3s4.4 1.1 5.8 3.3" }
  92. }
  93. }
  94. nav { id = "user-menu" popover = "auto" 'aria-label' = label on click(e) { emit userMenuClick(e) }
  95. p { class = "who" name }
  96. slot
  97. }
  98. }
  99. }
  100. // a tap on one of its links closes the dropdown (a page change in place would leave it open)
  101. on userMenuClick(e) {
  102. if (e.target.closest('a') != null) { e.currentTarget.hidePopover() }
  103. }

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