gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit80ce6ba980ce6ba9report 001 (mission 075)mre80ce6ba9/docs/using-the-theme.md

4.7 KB

  1. # Using the WorldAPI theme in an app
  2. The theme = `theme/` of layouts.worldapi.org (loreana `/media/STORAGE/projects/layouts.worldapi.org/theme/`) + the shared
  3. `shared/tokens.hl`. Components come black/white from components.hybriel.worldapi.org; the theme makes them WorldAPI.
  4. Live: https://layouts.worldapi.org (every element, component and shell with mock content).
  5. ## 1. Vendor (copy, like plugins/)
  6. ```bash
  7. cp -r /media/STORAGE/projects/layouts.worldapi.org/theme <app>/theme
  8. cmp /media/STORAGE/projects/layouts.worldapi.org/shared/tokens.hl <app>/shared/tokens.hl # must be the same file
  9. ```
  10. Never edit `theme/` inside an app — change it here and copy again (no fork). Components you use: copy their folder from
  11. components.hybriel.worldapi.org (`components/<name>/`) verbatim; the theme already holds their WorldAPI look.
  12. ## 2. styles.hl — inherit, set the accent and the type colours
  13. ```hybriel
  14. inherit './theme/theme.hl'
  15. import { var } from 'hl:web/css'
  16. import { greenDark, yellow, orange, purple, blueDark, colorTextMuted } from './shared/tokens.hl'
  17. colorAccent = var(greenDark) // the app's accent — tickets purple, ident orange, tracker green-dark, gitoria blue-dark,
  18. // notes yellow, calendar blue-light, antcolony green-light
  19. colorType1 = var(yellow) // the app's type colours (slots 1–6; tracker: 1 Movie, 2 Series, 3 Show, 4 Genre, 5 Person)
  20. colorType5 = var(orange)
  21. // app rules: ONLY token names, never written colours; no borders unless they mean something
  22. 'show-meta' { color = colorTextMuted }
  23. ```
  24. - Tokens are css variables: `colorText` → `--color-text`, `colorType1` → `--color-type1`, `layoutColumn` → `--layout-column`.
  25. In a component's own `Style` write `'var(--color-text)'` (a component cannot import tokens).
  26. - Layout tokens you may set: `layoutColumn` (72rem, the centred column), `layoutSidebar` (16rem), `layoutList` (24rem),
  27. `layoutGutter` (1rem), `layoutHeader` (3.25rem), `layoutRadius` (.4rem).
  28. - Classes the theme gives: `button.primary` / `button.danger` / `a.button`, `.muted`, `p.empty`, `.pill` (+ `.type-N`,
  29. `.success`, `.warning`, `.danger`, `.quiet`), `.type-1` … `.type-6` (text in the type colour), `.visually-hidden`,
  30. `<drop-zone>` / `.drop-zone` (+ `.over`). Elements: headings, links, fields, `details`/`summary` (the foldable), tables.
  31. ## 3. Choose a shell
  32. | App kind | Shell | Doc |
  33. |---|---|---|
  34. | regular app (tracker, tickets, gitoria) | `ContentFirst` | [layouts/content-first.md](layouts/content-first.md) |
  35. | list → item (notes) | `ListFirst` | [layouts/list-first.md](layouts/list-first.md) |
  36. | folders + list + item (mail) | `ThreePane` | [layouts/three-pane.md](layouts/three-pane.md) |
  37. Header: [AppHeader](layouts/app-header.md) with [MainMenu](layouts/main-menu.md) and [UserMenu](layouts/user-menu.md)
  38. (signed out: the ident selector in its place); the phone's overlay: [Sidebar](layouts/app-sidebar.md).
  39. Typical content-first app (`components/main.hl` holds what every page shares):
  40. ```hybriel
  41. import AppHeader from '../theme/shell/app-header.hl'
  42. import MainMenu from '../theme/shell/main-menu.hl'
  43. import UserMenu from '../theme/shell/user-menu.hl'
  44. import Sidebar from '../theme/shell/app-sidebar.hl'
  45. import ContentFirst from '../theme/shell/content-first.hl'
  46. static menu = [ { label = 'Series' href = '/series' } { label = 'Movies' href = '/movies' } ]
  47. current = '/series' // the page's href, so the menu marks it (pass it from the page)
  48. slot = null
  49. View {
  50. body {
  51. AppHeader { brand = "Tracker" search = "/search"
  52. MainMenu { items = menu current = current }
  53. UserMenu { name = "az5b2" a { href = "/settings" "Settings" } a { href = "/logout" "Logout" } }
  54. }
  55. ContentFirst {
  56. Sidebar { desktop = "false" MainMenu { items = menu current = current } }
  57. main { slot }
  58. }
  59. }
  60. }
  61. ```
  62. (The showcase puts header + shell into every page instead — `components/site-header.hl` — so each page marks its own menu
  63. entry server-side.)
  64. ## 4. The gate helper
  65. ```bash
  66. node theme/check-theme.mjs . # in the app folder; exit 1 + one line per finding
  67. ```
  68. Flags hard-coded colours (#hex, rgb(), hsl(), named colours) and decorative borders in the app's `.hl` / `.css`. A border
  69. that means something: write it on a details/summary/drop-zone/focus/aria-invalid line or add `// functional: <why>`.
  70. Skip vendored component folders with `.check-theme-ignore` (one path prefix per line) or `--ignore <path>`. Add it to the
  71. app's `deploy.sh` GATES: `"node theme/check-theme.mjs ."`.
  72. ## 5. Test it like layouts.worldapi.org does
  73. `tests/browser.mjs` here is the pattern: 390 and 1280 px, every state from its trigger (toggle → overlay open, link →
  74. closed; list item → detail → back), computed styles (`borderTopStyle === 'none'`), no sideways scroll, no console errors,
  75. screenshots you look at.

Branches

Latest commits

  • 80ce6ba9report 001 (mission 075)mre
  • 5c6e338flayouts.worldapi.org in Hybriel: WorldAPI theme (tokens, borderless elements, themed components.hybriel components), shells (header, main/user menu, sidebar overlay, content-first, list-first, three-pane), showcase, check-theme helper; gate 73/0 (mission 075)mre