ShtukbaseStandard
страница пакета→ /design/kit-style.md

pages/design/kit-style.md

61 строка, 5.3 КБ. Как страница.

Этот текст ещё не переведён. Ниже английский оригинал.

  1. ---
  2. type: Page
  3. title: "The lens kit style"
  4. description: "The Shtukbase lens style for any HTML pages of a project: classes lx-… and kx-…, three skins (Kit, Draft and Shtukbase), light and dark themes."
  5. icon: "🖌️"
  6. ---
  7. # The lens kit style
  8. The style in which Shtukbase lenses are drawn, for any HTML page of a project. The classes are in [kit.css](kit-style/kit.css); the values of colors, shadows and fonts are in the skins: [Kit](kit-style/skins/kit.css) and [Draft](kit-style/skins/keer.css) and [Shtukbase](kit-style/skins/shtukbase.css). No build. Examples are in the [showcase](kit-style/showcase.html).
  9. ## How to connect it
  10. ```html
  11. <link rel="stylesheet" href="design/kit-style/skins/kit.css"> <!-- the path from your page; Kit is always needed -->
  12. <link rel="stylesheet" href="design/kit-style/kit.css">
  13. <link rel="stylesheet" href="design/kit-style/skins/keer.css"> <!-- if you need Draft -->
  14. <link rel="stylesheet" href="design/kit-style/skins/shtukbase.css"> <!-- if you need Shtukbase -->
  15. <main class="kx-page"><div class="lx-md">…text…</div></main>
  16. ```
  17. - The Draft style is `data-skin="keer"` on `<html>`, the Shtukbase style `data-skin="shtukbase"`; without the attribute it is Kit.
  18. - The dark theme is `data-theme="dark"` on `<html>`.
  19. Lenses connect everything themselves: the `lenses` package builds `lib/kit.css` from these files, and the choice of style is in the lens header.
  20. ## Choosing the style on a page
  21. A page that is not a lens links `page.js` in `<head>` after the CSS (no `defer`). It sets `data-skin` and `data-theme` on `<html>` from the choice shared with the lenses (`lx-skin`, `lx-theme` in `localStorage`); without a choice it uses the skin named on `<html data-skin="...">`, otherwise `calm`. It draws a small switch in the corner (or into `<div data-kx-switch>`) that offers the skins the page links; a page in a frame has none and follows its host. The rule REPO-PAGES-WEAR-THE-KIT (`shtuks/norms/rules/pages-wear-the-kit.md`) asks every page to connect it this way.
  22. ## Skins
  23. A skin sets variables: surfaces `--bg`, `--bg2`, `--bg3`, `--panel`, `--lx-card`, `--tray`, `--canvas`; text `--ink`, `--lx-muted`, `--faint`; lines `--line`, `--line2`; hover `--wash`, `--wash2`; accent `--lx-accent`, `--accent-soft`; shadows `--shadow`, `--shadow-lift`, `--shadow-peek`; corner radii `--lx-radius`, `--radius-lg`; fonts `--font`, `--mono`; canvas dots and grid `--canvas-dot`, `--canvas-grid`; selection `--selection`; ten option colors `--c-*`, `--cb-*`, `--cf-*`, `--ct-*`.
  24. | Skin | id | Where from |
  25. |---|---|---|
  26. | Calm | `calm` | the look of the package map in the explore kit: warm grey surfaces and lines, colour only as an accent, grey outlined chips, no tinted areas; the default for pages; written by hand |
  27. | Desktop | `desktop` | the Shtukbase desktop app (`engine/gui`): its light and dark grounds, text tones, borders, blue accent and the select option palette (tinted chips, no dot; board columns faintly tinted by their hue); the default of the layouts (`layout-basic`, `layout-studio`) and their lenses; written by hand from the app's theme |
  28. | Kit | `kit` | the quiet Shtukbase style, the Notion palette; written by hand |
  29. | Draft | `keer` | an earlier product's style "Draft, graphite, champagne"; built by a script from the `keer-style` tokens, do not edit by hand |
  30. | Shtukbase | `shtukbase` | the chosen style of the project: every variable reads a name of the token contract (`--background`, `--foreground`, `--border`, `--ring`, `--shadow-sm`, `--font-sans`, `--sb-hue-*` …), so a page that links `/design/<style>/tokens.css` wears that style; without it the names fall back to the Shtukbase look (white document, even soft shadows, compact controls); written by hand |
  31. Four kit names would clash with contract names of another meaning, so since 0.3 they carry the prefix `--lx-`: `--lx-card`, `--lx-accent`, `--lx-muted`, `--lx-radius`. A component library on a lens page reads `--card`, `--accent`, `--muted` and `--radius` of the chosen style unchanged; that is what lets the lens kit draw its frame with the library's shell (see `/design/conventions/lens-shell.md`). A page of a project that read the old names for the kit's values must read the `--lx-` names.
  32. The Draft skin is rebuilt by the package's `scripts/skin-keer.ts` (in a project, the `skin-keer` action). The `keer-style` tokens have no color of their own for the teal option (`teal`), so it is taken from Kit. The Geist font comes first in the style; if it is not in the system, the system font is used.
  33. ## What there is
  34. | What | Classes |
  35. |---|---|
  36. | Page column | `kx-page` (720 px), `kx-page wide` (1120 px), `kx-section`, `kx-row`, `kx-grid` |
  37. | Header | `lx-top`, `lx-crumbs`, `lx-crumb`, `lx-tools`, `lx-btn` (`on`, `icon`) |
  38. | Chips | `lx-chip`, `lx-chip dot`; color is `style="--cb: var(--cb-green); --cf: var(--cf-green)"` or `--cc` for a dot |
  39. | Links to records | `lx-ref` (`missing`), `lx-kbd` |
  40. | Card | `lx-card` (`compact`), inside `hd`, `ttl`, `sub`, `mono`, `chips`, `cnt` |
  41. | Text | `lx-md`: headings, lists, code, quotes, tables, `callout`, `cols` |
  42. | Board and gallery | `lx-board`, `lx-col` (`ch`, `n`, `cd`), `lx-gallery`, `lx-empty` |
  43. ## Where from and where to
  44. The style lives in one place, here. Before version 0.2 it was a copy of part of the `kit.css` of the `lenses` package; now `lenses` takes it from here.