gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit97110ad997110ad9WIP: nest accepted layout selectors; stopped at startup parse failuremre97110ad9/components/accent-switcher.hl

2.0 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. accentSwitcher {
  14. display = 'block'
  15. marginTop = '1.5rem'
  16. h2 { margin = '0 0 .5rem' }
  17. p {
  18. display = 'flex'
  19. flexWrap = 'wrap'
  20. gap = '.35rem'
  21. margin = '0'
  22. padding = '0 .75rem'
  23. }
  24. }
  25. // Class rule would lose its ancestor or has no View reference (probe v03; hybriel#243).
  26. 'accent-switcher button.swatch' {
  27. width = 'var(--layout-tap)'
  28. height = 'var(--layout-tap)'
  29. minHeight = '0'
  30. padding = '0'
  31. borderRadius = '50%'
  32. }
  33. // Class rule would lose its ancestor or has no View reference (probe v03; hybriel#243).
  34. 'accent-switcher button.swatch:hover' { filter = 'brightness(1.2)' }
  35. // Class rule would lose its ancestor or has no View reference (probe v03; hybriel#243).
  36. 'accent-switcher button.reset' {
  37. minHeight = 'var(--layout-tap)'
  38. padding = '0 .6rem'
  39. fontSize = '.85rem'
  40. color = 'var(--color-text-muted)'
  41. }
  42. }
  43. View {
  44. accentSwitcher { on click(e) { emit accentPick(e) }
  45. h2 { "Accent" }
  46. p {
  47. for (c of colours) { button { type = "button" class = "swatch" value = c.name title = c.name 'aria-label' = c.name style = c.paint } }
  48. button { type = "button" class = "reset" value = "" "Reset" }
  49. }
  50. }
  51. }
  52. on accentPick(e) {
  53. b = e.target.closest('button')
  54. if (b == null) { return }
  55. root = document.documentElement.style
  56. if (b.value == '') {
  57. root.removeProperty('--color-accent')
  58. window.localStorage.removeItem('layouts-accent')
  59. return
  60. }
  61. root.setProperty('--color-accent', 'var(--' + b.value + ')')
  62. window.localStorage.setItem('layouts-accent', b.value)
  63. }

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