gitoria

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchmainf9b8f918Merge branch 'calendar-vendor-day61' into mainAtlasmain/theme/theme.hl

17.4 KB

  1. // theme/theme.hl — THE WORLDAPI THEME: how WorldAPI makes the black/white components of components.hybriel.worldapi.org
  2. // look for itself. A styles file (hl:web): an app inherits it from its own styles.hl and sets its accent and type colours:
  3. //
  4. // inherit './theme/theme.hl'
  5. // import { var } from 'hl:web/css'
  6. // import { purple, yellow } from './shared/tokens.hl'
  7. // colorAccent = var(purple)
  8. // colorType1 = var(yellow)
  9. //
  10. // What is in here, in this order:
  11. // 1. layout tokens and the type-colour slots (the palette and the semantic roles are shared/tokens.hl)
  12. // 2. plain HTML elements: text, links, buttons, fields, foldables, drop zones, tables, pills
  13. // 3. the components of components.hybriel.worldapi.org, themed WITHOUT forking them: every rule repeats the component's
  14. // own selector with `html ` in front, so it wins over the component's Style (which comes later in the one stylesheet)
  15. // and never emits the same selector twice (hl:web refuses that)
  16. // The shells (header, sidebar, content-first, list-first, three-pane) carry their own Style in theme/shell/*.hl.
  17. //
  18. // Design rules (docs/design-rules.md): borderless — a border only where it means something (foldables, drop zones,
  19. // focus); no boxed cards, no grey frames; colours only through the named tokens; titles white; mobile first, wider
  20. // layouts in `@media (min-width: 60rem)` (the one breakpoint of the theme, also used by theme/shell/*.hl).
  21. import { var } from 'hl:web/css'
  22. import { yellow, greenDark, purple, blueDark, orange, blueLight, colorBackground, colorBackgroundSunken, colorSurface, colorBorder, colorText, colorTextStrong, colorTextMuted, colorSuccess, colorWarning, colorDanger, colorAccent, colorAccentText } from '../shared/tokens.hl'
  23. // ---- 1. tokens -------------------------------------------------------------------------------------------------
  24. // the type colours: an app names what each slot means (tracker: 1 Movie, 2 Series, 3 Show, 4 Genre, 5 Person) and may
  25. // point a slot at another palette colour in its styles.hl (`colorType1 = var(yellow)`)
  26. colorType1 = var(yellow)
  27. colorType2 = var(greenDark)
  28. colorType3 = var(purple)
  29. colorType4 = var(blueDark)
  30. colorType5 = var(orange)
  31. colorType6 = var(blueLight)
  32. // the layout: the centred content column (header contents end flush with it), the side gutter, the header height, the
  33. // sidebar and list-pane widths of the shells
  34. layoutColumn = var('72rem')
  35. layoutGutter = var('1rem')
  36. layoutHeader = var('3.25rem')
  37. layoutSidebar = var('16rem')
  38. layoutList = var('24rem')
  39. // the tap size: every button, icon button, link in a menu or list, tab, crumb and field is at least this tall and wide (44 px, the
  40. // minimum touch target); mobile first — only the buttons and menu links of the desktop (min-width 60rem) go denser, on purpose
  41. layoutTap = var('2.75rem')
  42. // the corner radii — exactly two (docs/design-rules.md "Corner radius"): radiusSmall for every small item (buttons, pills,
  43. // fields, tags, menu items, chips, day cells), radiusLarge for everything else that is rounded (panels, modals, popovers,
  44. // dropdowns, foldables, tiles/posters); '50%' only for round things (avatars, the check circle). check-theme flags any other
  45. radiusSmall = var('5px')
  46. radiusLarge = var('10px')
  47. // ---- 2. plain elements -----------------------------------------------------------------------------------------
  48. '*,
  49. *::before,
  50. *::after' { boxSizing = 'border-box' }
  51. html { colorScheme = 'dark' scrollbarColor = colorBorder + ' transparent' }
  52. body { margin = '0' minHeight = '100dvh' font = '16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif' color = colorText background = colorBackground overflowWrap = 'anywhere' }
  53. '::selection' { color = colorAccentText background = colorAccent }
  54. '[hidden]' { display = 'none !important' }
  55. h1 { margin = '0 0 1rem' fontSize = '1.6rem' lineHeight = '1.25' color = colorTextStrong }
  56. h2 { margin = '1.5rem 0 .6rem' fontSize = '1.25rem' lineHeight = '1.3' color = colorTextStrong }
  57. h3 { margin = '1.25rem 0 .5rem' fontSize = '1.05rem' lineHeight = '1.3' color = colorTextStrong }
  58. h4 { margin = '1rem 0 .4rem' fontSize = '1rem' color = colorTextStrong }
  59. p { margin = '0 0 1rem' }
  60. strong { color = colorTextStrong }
  61. small { fontSize = '.85rem' }
  62. '.muted' { color = colorTextMuted }
  63. 'p.empty' { color = colorTextMuted fontStyle = 'italic' }
  64. '.visually-hidden' { position = 'absolute' width = '1px' height = '1px' margin = '-1px' padding = '0' overflow = 'hidden' clip = 'rect(0 0 0 0)' whiteSpace = 'nowrap' border = '0' }
  65. ul { margin = '0 0 1rem' paddingLeft = '1.25rem' }
  66. ol { margin = '0 0 1rem' paddingLeft = '1.5rem' }
  67. li { margin = '.15rem 0' }
  68. hr { height = '1px' margin = '1.5rem 0' border = '0' background = colorSurface }
  69. img { maxWidth = '100%' height = 'auto' }
  70. a { color = colorAccent textDecoration = 'none' textUnderlineOffset = '.2em' }
  71. 'a:hover' { textDecoration = 'underline' }
  72. // a link that IS the item (the first link of a list item, a row of links, a paragraph marked `links`, a crumb) is a tap target; a link
  73. // inside a sentence is not (WCAG 2.5.8 exempts it) and keeps its line
  74. 'li > a:first-child,
  75. .links a,
  76. .row > a,
  77. .crumbs a' { display = 'inline-flex' alignItems = 'center' minHeight = layoutTap }
  78. ':focus-visible' { outline = '2px solid ' + colorAccent outlineOffset = '2px' }
  79. 'code,
  80. kbd,
  81. samp' { padding = '.05rem .3rem' font = '.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace' background = colorSurface borderRadius = radiusSmall }
  82. pre { margin = '0 0 1rem' padding = '.75rem 1rem' overflow = 'auto' font = '.9rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace' background = colorBackgroundSunken borderRadius = radiusLarge }
  83. 'pre code' { padding = '0' background = 'transparent' }
  84. // buttons: quiet by default (text on nothing, a surface on hover); `.primary` (and a form's submit) is the accent;
  85. // `.danger` says it destroys something — never decoration
  86. 'button,
  87. .button' { display = 'inline-flex' alignItems = 'center' justifyContent = 'center' gap = '.4rem' minWidth = layoutTap minHeight = layoutTap padding = '.4rem .9rem' font = 'inherit' fontWeight = '600' lineHeight = '1.2' color = colorText textDecoration = 'none' background = 'transparent' border = '0' borderRadius = radiusSmall cursor = 'pointer' }
  88. 'button:hover,
  89. .button:hover' { textDecoration = 'none' background = colorSurface }
  90. 'button.primary,
  91. .button.primary,
  92. button[type="submit"]' { color = colorAccentText background = colorAccent }
  93. 'button.primary:hover,
  94. .button.primary:hover,
  95. button[type="submit"]:hover' { background = colorAccent filter = 'brightness(1.1)' }
  96. 'button.danger,
  97. .button.danger' { color = colorDanger }
  98. // the desktop (a pointer, the one breakpoint) may go denser: buttons shrink to 2.25rem, on purpose
  99. '@media (min-width: 60rem)' {
  100. 'button,
  101. .button' { minHeight = '2.25rem' }
  102. }
  103. 'button:disabled' { opacity = '.45' cursor = 'default' filter = 'none' }
  104. 'button svg,
  105. .button svg' { flex = 'none' width = '1.25rem' height = '1.25rem' }
  106. // fields: a sunken surface, no frame; the focus ring is the accent; an invalid field gets the danger ring
  107. label { display = 'block' marginBottom = '.25rem' fontWeight = '600' color = colorTextStrong }
  108. 'input,
  109. select,
  110. textarea' { maxWidth = '100%' minHeight = layoutTap padding = '.5rem .7rem' font = 'inherit' fontSize = '1rem' color = colorText background = colorBackgroundSunken border = '0' borderRadius = radiusSmall }
  111. 'input:focus,
  112. select:focus,
  113. textarea:focus' { outline = '2px solid ' + colorAccent outlineOffset = '0' }
  114. 'input[aria-invalid="true"],
  115. textarea[aria-invalid="true"]' { outline = '2px solid ' + colorDanger outlineOffset = '0' }
  116. 'input[type="checkbox"],
  117. input[type="radio"]' { width = '1.25rem' height = '1.25rem' minHeight = '0' padding = '0' accentColor = colorAccent }
  118. // a label around a checkbox / radio is the tap target
  119. 'label:has(> input[type="checkbox"]),
  120. label:has(> input[type="radio"])' { display = 'flex' alignItems = 'center' gap = '.6rem' minHeight = layoutTap }
  121. 'input::placeholder,
  122. textarea::placeholder' { color = colorTextMuted }
  123. textarea { width = '100%' minHeight = '6rem' resize = 'vertical' }
  124. fieldset { margin = '0 0 1rem' padding = '0' border = '0' }
  125. legend { padding = '0' marginBottom = '.5rem' fontWeight = '600' color = colorTextStrong }
  126. 'form p' { margin = '0 0 1rem' }
  127. progress { accentColor = colorAccent }
  128. // FOLDABLES: the border belongs to the foldable (the creator likes it on the tracker's season collapsibles)
  129. details { margin = '0 0 .75rem' border = '1px solid ' + colorBorder borderRadius = radiusLarge }
  130. summary { display = 'block' minHeight = layoutTap padding = '.6rem .9rem' fontWeight = '600' color = colorTextStrong cursor = 'pointer' }
  131. 'summary:hover' { background = colorSurface }
  132. 'details[open] > summary' { borderBottom = '1px solid ' + colorBorder }
  133. 'details > :not(summary)' { marginLeft = '.9rem' marginRight = '.9rem' }
  134. 'details > summary + *' { marginTop = '.75rem' }
  135. 'details > :last-child:not(summary)' { marginBottom = '.75rem' }
  136. // DROP ZONES: a dashed border says "drop here"; `.over` while something is dragged over it
  137. 'drop-zone,
  138. .drop-zone' { display = 'block' padding = '1.25rem' textAlign = 'center' color = colorTextMuted border = '2px dashed ' + colorBorder borderRadius = radiusLarge }
  139. 'drop-zone.over,
  140. .drop-zone.over' { color = colorText borderColor = colorAccent background = colorSurface }
  141. // tables: no grid; the header row is muted, a row lights up under the pointer
  142. table { width = '100%' margin = '0 0 1rem' borderCollapse = 'collapse' }
  143. th { padding = '.4rem .6rem' fontSize = '.85rem' fontWeight = '600' textAlign = 'left' color = colorTextMuted }
  144. td { padding = '.5rem .6rem' verticalAlign = 'top' }
  145. // body breaks words anywhere (a long URL never pushes the page); in a table that also squeezes a column to one letter per line ("watche/d"): cells break a word only when it cannot fit
  146. 'td,
  147. th' { overflowWrap = 'break-word' }
  148. 'tbody tr:nth-child(odd)' { background = colorBackgroundSunken }
  149. 'tbody tr:hover' { background = colorSurface }
  150. // type colours and pills: `class="type-2"` colours a text with its slot; `.pill` turns it into an inverted label (text on
  151. // the colour); a pill without a type is the accent. Status words use the semantic roles: `.success`, `.warning`, `.danger`
  152. '.type-1' { color = colorType1 }
  153. '.type-2' { color = colorType2 }
  154. '.type-3' { color = colorType3 }
  155. '.type-4' { color = colorType4 }
  156. '.type-5' { color = colorType5 }
  157. '.type-6' { color = colorType6 }
  158. '.success' { color = colorSuccess }
  159. '.warning' { color = colorWarning }
  160. '.danger' { color = colorDanger }
  161. '.pill' { display = 'inline-block' padding = '.1rem .55rem' fontSize = '.8rem' fontWeight = '700' lineHeight = '1.5' color = colorAccentText background = colorAccent borderRadius = radiusSmall whiteSpace = 'nowrap' }
  162. '.pill.type-1' { color = colorAccentText background = colorType1 }
  163. '.pill.type-2' { color = colorAccentText background = colorType2 }
  164. '.pill.type-3' { color = colorAccentText background = colorType3 }
  165. '.pill.type-4' { color = colorAccentText background = colorType4 }
  166. '.pill.type-5' { color = colorAccentText background = colorType5 }
  167. '.pill.type-6' { color = colorAccentText background = colorType6 }
  168. '.pill.success' { color = colorAccentText background = colorSuccess }
  169. '.pill.warning' { color = colorAccentText background = colorWarning }
  170. '.pill.danger' { color = colorAccentText background = colorDanger }
  171. '.pill.quiet' { color = colorText background = colorSurface }
  172. // ---- 3. the components of components.hybriel.worldapi.org --------------------------------------------------------
  173. // Their own Style draws frames around buttons, fields, editors and day cells. The theme takes the decorative ones away
  174. // (the drop zone's dashed border and the focus rings stay — they mean something) and lets surfaces separate instead.
  175. // Their corners become the theme's two radii: small items radiusSmall, popups / windows / editors / day tiles radiusLarge.
  176. // pagination
  177. 'html pagination button' { border = '0' borderRadius = radiusSmall minWidth = layoutTap }
  178. 'html pagination li.current button' { border = '0' }
  179. // modal: the dimmed page around the window is the separation
  180. 'html modal-dialog > dialog' { background = colorSurface border = '0' borderRadius = radiusLarge boxShadow = '0 1rem 3rem ' + colorBackgroundSunken }
  181. 'html modal-dialog header' { borderBottom = '0' }
  182. 'html modal-dialog modal-body footer' { background = colorSurface borderTop = '0' }
  183. 'html modal-dialog button' { borderRadius = radiusSmall }
  184. 'html modal-dialog button:hover' { background = colorBackground }
  185. // month view: the day cells are tiles with a gap, no grid lines
  186. 'html month-view ol' { gap = '.25rem' }
  187. 'html month-view button' { border = '0' borderRadius = radiusSmall }
  188. 'html #month-days li' { border = '0' borderRadius = radiusLarge }
  189. // date picker + date range picker: borderless field, the popup is a raised surface
  190. 'html date-picker input' { border = '0' borderRadius = radiusSmall }
  191. 'html range-picker input' { border = '0' borderRadius = radiusSmall }
  192. 'html date-picker input[aria-invalid="true"]' { outline = '2px solid ' + colorDanger outlineOffset = '-2px' }
  193. 'html range-picker input[aria-invalid="true"]' { outline = '2px solid ' + colorDanger outlineOffset = '-2px' }
  194. 'html date-picker month-view' { background = colorSurface border = '0' borderRadius = radiusLarge boxShadow = '0 .75rem 2rem ' + colorBackgroundSunken }
  195. 'html range-picker month-view' { background = colorSurface border = '0' borderRadius = radiusLarge boxShadow = '0 .75rem 2rem ' + colorBackgroundSunken }
  196. 'html date-picker button' { border = '0' borderRadius = radiusSmall }
  197. 'html range-picker button' { border = '0' borderRadius = radiusSmall }
  198. 'html date-picker month-view ol' { gap = '.2rem' }
  199. 'html range-picker month-view ol' { gap = '.2rem' }
  200. 'html date-picker ol.days li' { background = colorBackground border = '0' borderRadius = radiusSmall }
  201. 'html range-picker ol.days li' { background = colorBackground border = '0' borderRadius = radiusSmall }
  202. 'html date-picker ol.days li.outside' { background = 'transparent' }
  203. 'html range-picker ol.days li.outside' { background = 'transparent' }
  204. 'html date-picker ol.days li.selected' { background = colorAccent }
  205. 'html range-picker ol.days li.selected' { background = colorAccent }
  206. 'html range-picker ol.days li.between' { background = colorBackgroundSunken outline = '0' }
  207. 'html range-picker ol.days li.between time' { color = colorAccent }
  208. // file upload: the drop zone keeps its dashed border (it is a drop zone); the choose button is a plain button
  209. 'html file-upload drop-zone' { borderRadius = radiusLarge }
  210. 'html file-upload label.choose' { display = 'inline-flex' alignItems = 'center' minHeight = layoutTap fontWeight = '600' border = '0' borderRadius = radiusSmall }
  211. 'html file-upload label.choose:hover' { color = colorTextStrong filter = 'brightness(1.15)' }
  212. // file upload, several files: the same (the component's own radii are .5rem and .35rem)
  213. 'html files-upload drop-zone' { borderRadius = radiusLarge }
  214. 'html files-upload pick-area' { borderRadius = radiusLarge }
  215. 'html files-upload ul.files img.thumb, html files-upload ul.files .kind, html files-upload button.remove' { borderRadius = radiusSmall }
  216. 'html files-upload label.camera' { borderRadius = radiusSmall }
  217. 'html files-upload label.choose' { display = 'inline-flex' alignItems = 'center' minHeight = layoutTap fontWeight = '600' border = '0' borderRadius = radiusSmall }
  218. 'html files-upload label.choose:hover' { color = colorTextStrong filter = 'brightness(1.15)' }
  219. // Markdown editor: one sunken surface, the toolbar a surface strip; no lines between the parts
  220. 'html md-editor' { border = '0' borderRadius = radiusLarge }
  221. 'html md-editor nav' { borderBottom = '0' borderRadius = radiusLarge + ' ' + radiusLarge + ' 0 0' }
  222. 'html md-editor nav button' { minWidth = layoutTap minHeight = layoutTap borderRadius = radiusSmall }
  223. 'html md-editor ul.files' { borderBottom = '0' }
  224. 'html md-editor link-form' { borderBottom = '0' background = colorSurface }
  225. 'html md-editor link-form input' { border = '0' borderRadius = radiusSmall }
  226. 'html md-editor link-form button' { border = '0' borderRadius = radiusSmall }
  227. 'html md-editor article img' { borderRadius = radiusLarge }
  228. 'html md-editor article code' { borderRadius = radiusSmall }
  229. 'html md-editor article pre' { border = '0' borderRadius = radiusLarge }
  230. // code inside a heading (docs: `ListFirst (theme/shell/list-first.hl) — <list-first …>`) stays text-sized, not title-sized
  231. 'h1 code,
  232. h2 code,
  233. h3 code,
  234. html md-editor article h1 code,
  235. html md-editor article h2 code,
  236. html md-editor article h3 code' { fontSize = '.65em' overflowWrap = 'anywhere' }
  237. 'html md-editor td a,
  238. html md-editor th a' { display = 'inline-flex' alignItems = 'center' minHeight = layoutTap } // a link alone in a table cell is a tap target
  239. 'html md-editor footer' { borderTop = '0' }
  240. 'html md-editor footer button' { border = '0' borderRadius = radiusSmall }
  241. // comments: the quiet 'edited' label keeps its look (no padding, no frame) but on the phone its box is 44 px (desktop stays dense); the negative margin gives the room back, the row does not grow
  242. '@media (max-width: 59.99rem)' {
  243. 'html comments-block details.comment-history summary' { display = 'inline-flex' alignItems = 'center' justifyContent = 'center' minWidth = layoutTap minHeight = layoutTap margin = '-1rem -.2rem' }
  244. }
  245. // code editor: the gutter is a surface beside the sunken text, no line between them
  246. 'html code-editor' { border = '0' borderRadius = radiusLarge }
  247. 'html code-editor code-gutter' { borderRight = '0' }

Branches

Latest commits

  • f9b8f918Merge branch 'calendar-vendor-day61' into mainAtlas
  • 66341793|||PR Vendor Hybriel day61Atlas
  • 36fc596bMerge branch 'vendor-day59' into mainAtlas
  • b37cc1da|||PR Vendor Hybriel day59Atlas
  • 05665102Merge branch 'vendor-day56' into mainAtlas
  • 687296fb|||PR Vendor Hybriel day56Atlas
  • a6166d4eMerge branch 'hl-standard-3' into mainAtlas
  • 6d0eb3b0|||PR Calendar day add buttons only when signed in (Kunibert minor)Atlas
  • add4b499|||PR Make calendar day actions keyboard accessibleAtlas
  • 79e49b4dMerge branch 'hl-standard' into mainAtlas
  • e9fec7bb|||PR HL-STANDARD clean-up: typed parameters, plain locals, by-reference cacheAtlas
  • eff166a4Re-vendor complete Hybriel plugins and runtime to day44mre
  • cef81394Wait for the DST fixture page instead of an unused socketmre
  • 42434f47Check lazy-session cookies after login with a stored anonymous fixturemre
  • 728e84e3Re-vendor complete Hybriel day41 plugin directoriesmre
  • cbd7ff43Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
  • 59d1da0acalendar: plain declarations instead of needless let in 9 files (calendar#17): 49 declarations that are never reassigned; reassigned ones and the timer closure's p stay letmre
  • f5415cf9calendar: the Style blocks in the language's nested form (calendar#16): rules named after the View's own elements with their children nested, pseudo-classes and @media nested, merged duplicate select rule; same CSS, shots identical in Chrome at 4 sizesmre
  • edb7c947calendar: the sign-in callback keeps the session it finds and signs it in (same cookie, nothing signed out; ident#28); security gate 56+4 failing → 60 passedmre
  • bf8cc0fcStyles move into their components: the shell's styles into main.hl, the events and the editors into the month view's Style block; styles.hl keeps only the theme inherit, the accent and the message line; .gitignore ignores a bin symlink too; tests/styles-shots.mjs for the before/after pixel comparemre