Design tokens: ipal-tokens CLI, components on single names, templates, tests

- bin ipal-tokens: src/design/tokens.ts → src/design/tokens.css, --check, WCAG
  contrast report (fails on AA errors; --report, --warn-only)
- CookieBanner / CookieButton read the single --ipal-* roles; the fallback follows
  color-scheme via light-dark() and still honours the legacy -dark variables
- lightbox fade reads --ipal-duration / --ipal-ease-out
- DESIGN.md and tokens.ts templates in ipal-setup/resources

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 13:55:59 +01:00
co-authored by Claude Opus 5.5
parent 9511b12d19
commit ca8e93eaf4
11 changed files with 391 additions and 23 deletions
@@ -0,0 +1,48 @@
# DESIGN.md — <client name>
The human source of the look. Its machine form is `src/design/tokens.ts`; the two must agree
(`ipal-doctor` compares them). Values go into `tokens.ts`, never into components.
Sections are fixed: fill every one, write "default" where the brand keeps the standard.
## 1. Brand in one sentence
<what the site is, for whom, the feeling>. Audience: <…>.
The one memorable element (where the boldness goes): <…>. Everything else stays quiet.
## 2. Colour
| Role (`--ipal-*`) | Light | Dark | Used for |
|---|---|---|---|
| primary | oklch(…) | (carried over) | main buttons, key accents |
| secondary | default | default | second button |
| accent | default (= primary) | | badges, highlights |
| bg / surface / surface-muted | default | default | page, cards, alternate sections |
Contrast (paste `pnpm exec ipal-tokens --report`; every ✗ fixed before launch):
```
<report>
```
## 3. Type
Body: <family> <weights> (`--font-family-body`). Headings: <family> <weight> (`--font-family-heading`).
Max 2 families × 2–3 weights, `subsets: ['latin', 'latin-ext']`. Scale overrides (`fs`): <none | h1 2.25→4rem …>.
Heading style: <case, tracking, weight>.
## 4. Shape and depth
Radius: control <…>, card <…>, media <…>. Depth: <borders | shadow-sm on cards | none>.
## 5. Layout
Scale: fluid-wide (default) | fluid. Container <80rem>, narrow <48rem> (legal, articles), measure 68ch.
Section rhythm: py-section; compact bands py-section-sm. Alignment: <left | centred hero only>.
## 6. Motion
What moves and why (max one orchestrated moment): <…>. Durations: default (fast 150 / base 250 / slow 400 ms).
Reduced motion: every duration token is 0 ms; nothing essential is animated.
## 7. Imagery and icons
Photo style: <…>. Focal points set in Media. Icons: lucide set, <stroke width>.
## 8. Theme
<light only | dark only | both>, default <light | dark | system> (Site settings → Theme), toggle <yes | no>.
## 9. Deviations from the standard
Every override of a default, and every project-only token or breakpoint, with the reason:
- <none>
@@ -0,0 +1,27 @@
// src/design/tokens.ts — the ONLY file you edit to rebrand the site (docs/design-tokens.md).
// After every change: `pnpm exec ipal-tokens` → writes src/design/tokens.css (commit it) and prints
// the WCAG contrast check (`--report` prints every pair for DESIGN.md → Colour).
// Leave out anything the brand does not change: the neutral defaults in @intecion/ipal-kit/tokens.css apply.
import { defineTokens } from '@intecion/ipal-kit/tokens'
export const tokens = defineTokens({
theme: 'both', // 'light' | 'dark' | 'both' — must match Site settings → Theme
fluid: 'wide', // the fluid file styles.css imports: 'wide' = fluid-wide.css (default), 'standard' = fluid.css
color: {
light: {
primary: 'oklch(0.5 0.17 250)', // [TO FILL: brand colour from DESIGN.md]
// secondary: 'oklch(…)', accent: 'oklch(…)', bg: 'oklch(…)', surface-muted: 'oklch(…)'
},
dark: {
// primary carries over from light when left out; set a lighter one if the report fails
},
},
font: {
// next/font in the root layout: variable '--font-family-body' / '--font-family-heading' on <html>
fwHeading: 650,
},
radius: { control: '0.5rem', card: '0.75rem' },
// fs: { h1: ['2.25rem', '4rem'] }, // min → max; the clamp() is computed for the fluid range
// space: { section: ['3rem', '8rem'] },
// container: { default: '80rem' },
})
+2 -1
View File
@@ -153,7 +153,8 @@ Out of the box the viewer is styled inline from CSS variables — override them
| `--ipal-lightbox-inset` | `1rem` |
| `--ipal-lightbox-caption-color` | `inherit` |
| `--ipal-lightbox-caption-size` | `0.95rem` |
| `--ipal-lightbox-duration` | `200ms` (fade; none with reduced motion) |
| `--ipal-lightbox-duration` | `var(--ipal-duration, 200ms)` (fade; none with reduced motion) |
| `--ipal-lightbox-easing` | `var(--ipal-ease-out, ease)` |
```css
:root { --ipal-lightbox-backdrop: rgb(15 23 42 / 0.95); --ipal-lightbox-control-bg: var(--color-brand); }