gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commiteae2be7aeae2be7aapp-sidebar: nest child selectors and document caller-slot gapmreeae2be7a/components/accent-switcher.hl

1.8 KB

  1. // components/accent-switcher.hl — the showcase's accent switcher: one button per palette colour; a tap sets
  2. // --color-accent on the page (what an app does once in its styles.hl) and keeps it for the next page (localStorage;
  3. // components/main.hl puts it back on load). Reset = the theme's default (blue-dark).
  4. import { accents } from '../lib/site.hl'
  5. Hybrid colours = swatches(accents)
  6. // one swatch per colour: its name and its own background (the palette token, never a written colour)
  7. swatches(names) {
  8. out = []
  9. for (n of names) { out.push({ name = n paint = 'background: var(--' + n + ')' }) }
  10. return out
  11. }
  12. Style {
  13. 'accent-switcher' { display = 'block' marginTop = '1.5rem' }
  14. 'accent-switcher h2' { margin = '0 0 .5rem' }
  15. 'accent-switcher p' { display = 'flex' flexWrap = 'wrap' gap = '.35rem' margin = '0' padding = '0 .75rem' }
  16. 'accent-switcher button.swatch' { width = 'var(--layout-tap)' height = 'var(--layout-tap)' minHeight = '0' padding = '0' borderRadius = '50%' }
  17. 'accent-switcher button.swatch:hover' { filter = 'brightness(1.2)' }
  18. 'accent-switcher button.reset' { minHeight = 'var(--layout-tap)' padding = '0 .6rem' fontSize = '.85rem' color = 'var(--color-text-muted)' }
  19. }
  20. View {
  21. accentSwitcher { on click(e) { emit accentPick(e) }
  22. h2 { "Accent" }
  23. p {
  24. for (c of colours) { button { type = "button" class = "swatch" value = c.name title = c.name 'aria-label' = c.name style = c.paint } }
  25. button { type = "button" class = "reset" value = "" "Reset" }
  26. }
  27. }
  28. }
  29. on accentPick(e) {
  30. b = e.target.closest('button')
  31. if (b == null) { return }
  32. root = document.documentElement.style
  33. if (b.value == '') {
  34. root.removeProperty('--color-accent')
  35. window.localStorage.removeItem('layouts-accent')
  36. return
  37. }
  38. root.setProperty('--color-accent', 'var(--' + b.value + ')')
  39. window.localStorage.setItem('layouts-accent', b.value)
  40. }

Branches

Latest commits

  • eae2be7aapp-sidebar: nest child selectors and document caller-slot gapmre
  • 69c9f784Record LY7 slot nesting blocker and minimal repromre
  • b1d4f379app-header: nest child and compound selectors in Stylemre
  • 6385ff8eRecord LY7 style formatting proof and review statusmre
  • 0100f51etracker-demo: format Style with nested rules and bare mediamre
  • 5f82554enotes-demo: format Style with nested rules and bare mediamre
  • 3dc27d78mail-demo: format Style with nested rules and bare mediamre
  • cf9648afhome: format Style with nested rules and bare mediamre
  • 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