gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmain4099e64aMerge branch 'font-segoe-ui' into mainAtlasmain/theme/shell/user-menu.hl

3.2 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. '> button' {
  16. width = 'var(--layout-tap)'
  17. height = 'var(--layout-tap)'
  18. minHeight = '0'
  19. marginRight = '-.625rem'
  20. padding = '0'
  21. color = 'var(--color-text)'
  22. svg {
  23. width = '1.5rem'
  24. height = '1.5rem'
  25. }
  26. }
  27. '> nav:popover-open' {
  28. position = 'fixed'
  29. inset = 'var(--layout-header) max(var(--layout-gutter), calc((100% - var(--layout-column)) / 2)) auto auto'
  30. display = 'block'
  31. minWidth = '12rem'
  32. maxWidth = 'calc(100vw - 2 * var(--layout-gutter))'
  33. margin = '.25rem 0 0'
  34. padding = '.4rem'
  35. color = 'var(--color-text)'
  36. background = 'var(--color-surface)'
  37. border = '0'
  38. borderRadius = 'var(--radius-large)'
  39. boxShadow = '0 .75rem 2rem var(--color-background-sunken)'
  40. }
  41. 'p.who' {
  42. margin = '0'
  43. padding = '.4rem .6rem .5rem'
  44. fontSize = '.85rem'
  45. color = 'var(--color-text-muted)'
  46. overflow = 'hidden'
  47. textOverflow = 'ellipsis'
  48. whiteSpace = 'nowrap'
  49. empty { display = 'none' }
  50. }
  51. }
  52. // Keep the whole selector for selector list, :has condition.
  53. 'body:has(list-first) user-menu > nav:popover-open,
  54. body:has(three-pane) user-menu > nav:popover-open' { right = 'var(--layout-gutter)' }
  55. // Keep the whole selector for pseudo-element.
  56. 'user-menu > nav::backdrop' { background = 'transparent' }
  57. // Keep the whole selector for selector list.
  58. 'user-menu > nav a,
  59. user-menu > nav button' {
  60. display = 'flex'
  61. width = '100%'
  62. minHeight = 'var(--layout-tap)'
  63. alignItems = 'center'
  64. justifyContent = 'flex-start'
  65. padding = '.5rem .6rem'
  66. fontWeight = '600'
  67. color = 'var(--color-text)'
  68. borderRadius = 'var(--radius-small)'
  69. }
  70. // Keep the whole selector for selector list.
  71. 'user-menu > nav a:hover,
  72. user-menu > nav button:hover' {
  73. textDecoration = 'none'
  74. color = 'var(--color-text-strong)'
  75. background = 'var(--color-background)'
  76. }
  77. }
  78. View {
  79. userMenu {
  80. button { type = "button" class = "user-toggle" popovertarget = "user-menu" title = label 'aria-label' = label
  81. svg { viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" 'stroke-width' = "1.8" 'stroke-linecap' = "round" 'aria-hidden' = "true"
  82. circle { cx = "12" cy = "12" r = "10" }
  83. circle { cx = "12" cy = "10" r = "3.2" }
  84. path { d = "M6.2 18.6c1.4-2.2 3.4-3.3 5.8-3.3s4.4 1.1 5.8 3.3" }
  85. }
  86. }
  87. nav { id = "user-menu" popover = "auto" 'aria-label' = label on click(e) { emit userMenuClick(e) }
  88. p { class = "who" name }
  89. slot
  90. }
  91. }
  92. }
  93. // a tap on one of its links closes the dropdown (a page change in place would leave it open)
  94. on userMenuClick(e) {
  95. if (e.target.closest('a') != null) { e.currentTarget.hidePopover() }
  96. }

Branches

Latest commits

  • 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
  • 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