página del paquete→ /design/kit-style.md
pages/design/kit-style.md
61 líneas, 5.3 KB. Como página.
Este texto aún no está traducido. Debajo está el original en inglés.
- ---
- type: Page
- title: "The lens kit style"
- 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."
- icon: "🖌️"
- ---
- # The lens kit style
- 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).
- ## How to connect it
- ```html
- <link rel="stylesheet" href="design/kit-style/skins/kit.css"> <!-- the path from your page; Kit is always needed -->
- <link rel="stylesheet" href="design/kit-style/kit.css">
- <link rel="stylesheet" href="design/kit-style/skins/keer.css"> <!-- if you need Draft -->
- <link rel="stylesheet" href="design/kit-style/skins/shtukbase.css"> <!-- if you need Shtukbase -->
- <main class="kx-page"><div class="lx-md">…text…</div></main>
- ```
- - The Draft style is `data-skin="keer"` on `<html>`, the Shtukbase style `data-skin="shtukbase"`; without the attribute it is Kit.
- - The dark theme is `data-theme="dark"` on `<html>`.
- Lenses connect everything themselves: the `lenses` package builds `lib/kit.css` from these files, and the choice of style is in the lens header.
- ## Choosing the style on a page
- 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.
- ## Skins
- 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-*`.
- | Skin | id | Where from |
- |---|---|---|
- | 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 |
- | 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 |
- | Kit | `kit` | the quiet Shtukbase style, the Notion palette; written by hand |
- | Draft | `keer` | an earlier product's style "Draft, graphite, champagne"; built by a script from the `keer-style` tokens, do not edit by hand |
- | 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 |
- 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.
- 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.
- ## What there is
- | What | Classes |
- |---|---|
- | Page column | `kx-page` (720 px), `kx-page wide` (1120 px), `kx-section`, `kx-row`, `kx-grid` |
- | Header | `lx-top`, `lx-crumbs`, `lx-crumb`, `lx-tools`, `lx-btn` (`on`, `icon`) |
- | Chips | `lx-chip`, `lx-chip dot`; color is `style="--cb: var(--cb-green); --cf: var(--cf-green)"` or `--cc` for a dot |
- | Links to records | `lx-ref` (`missing`), `lx-kbd` |
- | Card | `lx-card` (`compact`), inside `hd`, `ttl`, `sub`, `mono`, `chips`, `cnt` |
- | Text | `lx-md`: headings, lists, code, quotes, tables, `callout`, `cols` |
- | Board and gallery | `lx-board`, `lx-col` (`ch`, `n`, `cd`), `lx-gallery`, `lx-empty` |
- ## Where from and where to
- 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.