Files
ipal-kit/docs/dev/design-tokens-proposal.md

356 lines
28 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Design tokens: proposal (draft for approval)
Status: **approved 2026-10-29 (all recommendations in section 11 accepted); not built yet.** Building starts when
the coordinator confirms all five designs are consistent. Branch `claude/design-tokens-95806d`.
Consumers: the shared block library, the project starter, the reference site and `ipal-doctor`.
## 1. Goal and the one rule
Every client site should share the same set of design decisions (the token *names*, scale, structure,
dark mode, motion, breakpoints) and differ only in **values** (the brand). Components (the block library,
plugin UI, project sections) read only tokens. A new brand means a new `DESIGN.md` and one tokens file.
Nobody edits a component.
Main rule check (CLAUDE.md): every file is opt-in, every value can be overridden in the project's
`:root`, the plugin's components keep their hard-coded fallbacks (so a site without tokens looks the same
as today), and building blocks are exported (names, defaults, helpers), not only finished files.
## 2. What already exists (reuse, don't duplicate)
| Already shipped | What it gives | In this standard |
|---|---|---|
| `fluid.css` / `fluid-wide.css` | `--ipal-fs-sm…display`, `--ipal-space-gap/gutter/section`, `--ipal-measure`, `--ipal-container(-wide)`, `--ipal-hero-min-h`, `*-fit` height helpers | **Stays the type and space scale.** Two additive variables (`--ipal-fs-xs`, `--ipal-fs-h4`) and two spaces (`--ipal-space-section-sm`, `--ipal-space-stack`) are added to both files, plus `--ipal-container-narrow`. No rename. |
| CookieBanner / CookieButton colour vars | `--ipal-surface`, `--ipal-border`, `--ipal-text`, `--ipal-text-strong`, `--ipal-text-muted`, `--ipal-primary`, `--ipal-primary-hover`, `--ipal-primary-text`, `--ipal-hover`, `--ipal-radius`, each with a `-dark` twin | **These names become the canonical colour roles.** The `-dark` twins stay as legacy aliases (section 5.3). |
| Lightbox `--ipal-lightbox-*` | component-scoped variables | Unchanged. Defaults change to read the global tokens (`--ipal-lightbox-duration: var(--ipal-duration, 200ms)`). |
| Stats chart `--ipal-series-1` | admin chart colour | Unchanged (admin, not the site). |
| Theme (`<ThemeScript>`, `useTheme`, `<ThemeSwitcher>`, key `theme`, `data-theme` on `<html>`, `data-theme-switching`) | sets the theme before first paint | **Tokens switch on `[data-theme=dark]`.** The Tailwind `dark:` variant and the switching transition move from copy-paste in theme.md into the shipped preset. |
| Accessibility widget (`data-a11y-*` on `<html>`, CSS copied from accessibility.md) | mechanism only | Optional `a11y.css` that works through tokens (section 9). |
| AGENT.md §6.11 / section-code.md "Styles" / ipal-setup stage 5 | ad-hoc `@theme` with `--color-primary` etc. and `--ipal-primary: var(--color-primary)` | Replaced by the standard. The plugin vars become the source, and Tailwind maps to them, not the other way round. |
## 3. The token set
All names are `--ipal-<group>-<role>`. The colour group drops the word "color", to keep the names that
ship today. **Bold** = new.
### 3.1 Colour roles (switch with the theme)
| Token | Role | Neutral default light / dark | Tailwind utility |
|---|---|---|---|
| **`--ipal-bg`** | page background | `#fff` / `#0a0a0a` | `bg-bg` |
| `--ipal-surface` | card, panel, banner | `#fff` / `#171717` | `bg-surface` |
| **`--ipal-surface-muted`** | alternate section (`settings.background = muted`) | `#f5f5f5` / `#141414` | `bg-surface-muted` |
| **`--ipal-surface-raised`** | header, popover, dropdown | `#fff` / `#1f1f1f` | `bg-surface-raised` |
| **`--ipal-surface-inverse`** | inverted section (`settings.background = inverted`) | `#171717` / `#f5f5f5` | `bg-inverse` |
| `--ipal-text` | body text | `#404040` / `#d4d4d4` | `text-fg` |
| `--ipal-text-strong` | headings, labels | `#171717` / `#f5f5f5` | `text-fg-strong` |
| `--ipal-text-muted` | captions, meta | `#737373` / `#a3a3a3` | `text-fg-muted` |
| **`--ipal-text-inverse`** | text on `surface-inverse` | `#f5f5f5` / `#171717` | `text-on-inverse` |
| `--ipal-border` | dividers, inputs, cards | `#e5e5e5` / `#262626` | `border-border` |
| **`--ipal-border-strong`** | input focus-less border, emphasis | `#d4d4d4` / `#404040` | `border-border-strong` |
| `--ipal-primary` | brand: main buttons, key accents | `#2563eb` / `#3b82f6` | `bg-primary`, `text-primary` |
| `--ipal-primary-hover` | hover of the above | derived (5.4) | `hover:bg-primary-hover` |
| `--ipal-primary-text` | text/icon on `primary` | `#fff` / `#fff` | `text-on-primary` |
| **`--ipal-secondary`** (+ `-hover`, `-text`) | optional second brand colour | = neutral `text-strong` | `bg-secondary`, `text-on-secondary` |
| **`--ipal-accent`** (+ `-text`) | highlight, badge, decoration | = `primary` | `bg-accent`, `text-on-accent` |
| **`--ipal-link`** (+ `-hover`) | links in running text | = `primary` | `text-link` |
| `--ipal-hover` | neutral hover (ghost button, row) | `#f5f5f5` / `#262626` | `bg-hover` |
| **`--ipal-focus`** | focus ring | = `primary` | `ring-focus`, `outline-focus` |
| **`--ipal-overlay`** | scrim behind dialogs, hero image overlay | `rgb(0 0 0 / .5)` / `rgb(0 0 0 / .65)` | `bg-overlay` |
| **`--ipal-success`**, **`-warning`**, **`-danger`**, **`-info`** | state text / icon | green-700 / amber-700 / red-700 / blue-700 (light), 400 shades (dark) | `text-danger` … |
| **`--ipal-success-surface`** … | tinted state background | 50 shades (light), 950 shades (dark) | `bg-danger-surface` … |
A project sets at minimum `primary` and maybe `secondary`/`accent`. Everything else has a neutral default,
which is enough for a consistent site.
### 3.2 Typography
| Token | Default | Utility |
|---|---|---|
| **`--ipal-font-body`** | `var(--font-body, ui-sans-serif, system-ui, sans-serif)` | `font-body` (also `font-sans`) |
| **`--ipal-font-heading`** | `var(--font-heading, var(--ipal-font-body))` | `font-heading` |
| **`--ipal-font-mono`** | `ui-monospace, monospace` | `font-mono` |
| `--ipal-fs-xs`**(new)** · `sm` · `base` · `lg` · `h4`**(new)** · `h3` · `h2` · `h1` · `display` | fluid.css / fluid-wide.css | `text-xs` … `text-display`, `text-lead` = `lg` |
| **`--ipal-lh-body`** / **`--ipal-lh-heading`** | `1.6` / `1.15` | `leading-body`, `leading-heading` |
| **`--ipal-fw-body`** / **`--ipal-fw-heading`** | `400` / `650` | `font-heading` sets weight via base layer |
| **`--ipal-tracking-heading`** | `-0.01em` | `tracking-heading` |
Font slots: `next/font` exposes `variable: '--font-body'` and `'--font-heading'` on `<html>` (not `<body>`). These
two names are fixed by the standard, so every layout looks the same. Today sites use `--font-display` (3 sites),
`--font-heading` (2), `--font-sans`; the standard picks `--font-heading` and `--font-body`. Never repeat the family
name as a literal in `@theme` (two sites do; the literal silently wins or loses depending on layers). At most 2 families × 2–3 weights (§6.11b).
### 3.3 Space
The fluid scale (`--ipal-space-section`, `-gap`, `-gutter`) plus **`--ipal-space-section-sm`** (half a section,
1.5→3.75rem) and **`--ipal-space-stack`** (heading → content, 1→1.5rem). Utilities: `py-section`,
`py-section-sm`, `gap-gap`, `px-gutter`, `space-y-stack`, `mt-stack`. Small fixed steps stay Tailwind's
default 0.25rem scale. The standard adds no second numeric scale.
### 3.4 Shape, depth, layout, motion
| Group | Tokens | Defaults | Utilities |
|---|---|---|---|
| Radius | `--ipal-radius` (existing = controls: buttons, inputs), **`--ipal-radius-sm`**, **`--ipal-radius-card`**, **`--ipal-radius-media`**, **`--ipal-radius-full`** | `0.375rem`, `0.25rem`, `0.75rem`, `0.5rem`, `9999px` | `rounded-control`, `rounded-sm`, `rounded-card`, `rounded-media`, `rounded-full` |
| Shadow | **`--ipal-shadow-sm`**, **`-md`**, **`-lg`** | soft neutral; dark theme uses lower-alpha black + a 1px border-tinted ring | `shadow-sm/md/lg` |
| Container | `--ipal-container` (80rem), `--ipal-container-wide` (96rem), **`--ipal-container-narrow`** (48rem), `--ipal-measure` (68ch) | existing | `max-w-container`, `max-w-container-wide`, `max-w-narrow`, `max-w-measure` |
| Breakpoints | standard: `sm 40rem · md 48rem · lg 64rem · xl 80rem · 2xl 96rem` (Tailwind defaults). A project may *add* one (e.g. `xs 24rem`) as a recorded deviation, never move an existing one | CSS vars can't be used in `@media`; exported as TS constants | `sm:` … `2xl:`, container queries `@md:` |
| Motion | **`--ipal-duration-fast`** 150ms, **`--ipal-duration`** 250ms, **`--ipal-duration-slow`** 400ms, **`--ipal-ease-out`** `cubic-bezier(.22,1,.36,1)` (the curve ecogenica and saydiamonds already share), **`--ipal-ease-in-out`** `cubic-bezier(.65,0,.35,1)` | all durations `0ms` under `prefers-reduced-motion: reduce` and `html[data-a11y-motion=off]` | `duration-fast`, `duration-base`, `duration-slow`, `ease-out`, `ease-in-out` |
| Layers | **`--ipal-z-header`** 40, **`--ipal-z-overlay`** 50, **`--ipal-z-toast`** 60 (cookie banner, lightbox keeps its own 1000) | | `z-header` … |
| Focus | **`--ipal-focus-width`** 2px, **`--ipal-focus-offset`** 2px | | used by the base layer's `:focus-visible` |
## 4. Format: what the plugin ships
New package exports. All opt-in, each importable on its own:
| Export | Content |
|---|---|
| `@intecion/ipal-kit/tokens.css` | **neutral defaults** for every token in section 3: `:root` (light), `[data-theme=dark]` (dark), the legacy `-dark` aliases, reduced-motion zeroing. Imports nothing. |
| `@intecion/ipal-kit/tailwind.css` | Tailwind 4 preset: `@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *))`, one `@theme inline { … }` that maps every utility in section 3 to its `--ipal-*` var, the theme-switch transition (`[data-theme-switching]`), and a tiny `@layer base` (`body` bg/text/font, headings font/weight/tracking, `:focus-visible` ring). |
| `@intecion/ipal-kit/fluid.css`, `fluid-wide.css` | unchanged role, + the 5 new variables |
| `@intecion/ipal-kit/a11y.css` (optional) | section 9 |
| `@intecion/ipal-kit` (root): `IPAL_TOKENS`, `ipalVar(name)`, `IPAL_BREAKPOINTS`, type `IpalTokenName`, `defineTokens()`, `tokensToCss()`, `contrastReport()` | TS building blocks: names → `var(--ipal-…)` strings for inline styles/charts, the breakpoint numbers for `sizes=` and `matchMedia`, the brand object (5.1) and its compilers |
| `bin: ipal-tokens` | `src/design/tokens.ts` → `src/design/tokens.css` (+ `--check` for CI / `ipal-doctor`) |
A project that does not use Tailwind (saydiamonds today) imports `tokens.css` alone and writes `var(--ipal-…)`
in its own CSS. No Tailwind 3 preset: every Tailwind site is on v4 (survey, section 10).
Project `styles.css` with the standard:
```css
@import "tailwindcss";
@import "@intecion/ipal-kit/fluid-wide.css"; /* default for new sites (decision 4); or fluid.css */
@import "@intecion/ipal-kit/tokens.css"; /* neutral defaults */
@import "@intecion/ipal-kit/tailwind.css"; /* utilities, dark variant, base */
@import "../../design/tokens.css"; /* the brand: generated, overrides the defaults */
@source "../../../node_modules/@intecion/ipal-kit/dist/**/*.js";
```
Order matters only for the last line: the brand file comes after the defaults.
## 5. How a project sets its brand
### 5.1 One tokens file (recommended: TypeScript source)
```ts
// src/design/tokens.ts: the ONLY file you edit to rebrand
import { defineTokens } from '@intecion/ipal-kit'
export const tokens = defineTokens({
color: {
light: { primary: 'oklch(0.55 0.17 250)', accent: 'oklch(0.78 0.15 85)', bg: 'oklch(0.99 0 0)' },
dark: { primary: 'oklch(0.70 0.15 250)', bg: 'oklch(0.16 0.01 250)' }, // missing keys → derived (5.4)
},
font: { heading: 'var(--font-heading)', fwHeading: 700 },
radius: { control: '999px', card: '1.25rem' },
fluid: 'wide', // fluid.css (1280) or fluid-wide.css (1920): the site imports that file
// optional: rewrite the fluid scale from min → max pairs (replaces intecion's scripts/fluid-tokens.py)
fs: { h1: ['2.25rem', '4rem'], display: ['2.75rem', '5.5rem'] },
theme: 'both', // 'light' | 'dark' | 'both'; 'dark' = dark values in :root (architekt: dark-only site)
})
```
`pnpm exec ipal-tokens` writes `src/design/tokens.css` (committed, header "generated, do not edit") and
prints a **WCAG contrast report** for every text/surface pair (`text` on `bg`, `primary-text` on `primary`,
`text-inverse` on `surface-inverse`, `link` on `bg` …) in both themes. AA failure = non-zero exit.
`ipal-tokens --check` fails when the CSS is stale. `ipal-doctor` runs it.
Why TS and not hand-written CSS: one typed object, validation of names (a typo is a TS error, not a silent
missing colour), the contrast check, and the same values available where CSS variables don't work:
`next/og` images, e-mail templates, `manifest` `theme_color` / `<meta name="theme-color">`.
The CLI turns `fs` / `space` pairs into the same `clamp()` maths as fluid.css for the chosen range, so nobody
writes a clamp by hand and no project keeps its own generator script.
**Alternative (decision 1):** the brand file is plain CSS (`src/design/tokens.css` written by hand,
`:root { … }` + `[data-theme=dark] { … }`). No CLI and no build step, but also no validation, no contrast
check and no values for OG/e-mail. Both forms produce the same variables, so a project may pick either.
The question is which one the starter and the agent guide use by default.
### 5.2 `DESIGN.md` template
The starter ships `DESIGN.md` with fixed sections, so every project describes the same things:
1. **Brand in one sentence**, audience, the one memorable element (where the boldness goes)
2. **Colour**: table of the roles from 3.1 the brand sets (name, value light/dark, where it is used), with contrast results pasted from `ipal-tokens`
3. **Type**: the two families, weights, `fs` overrides (if any), heading style
4. **Shape and depth**: radii, shadow use, borders vs. shadows
5. **Layout**: fluid vs. fluid-wide, container widths, section rhythm, alignment
6. **Motion**: what moves and why (max one orchestrated moment), reduced-motion behaviour
7. **Imagery and icons**: photo style, focal points, lucide set
8. **Theme**: light only / dark only / both + default (`Site settings → Theme`)
9. **Deviations from the standard**: every override of a default, with the reason
Rule: `DESIGN.md` is the human source; `src/design/tokens.ts` is its machine form. They must agree.
`ipal-doctor` warns when a role is in one and not the other.
### 5.3 Dark mode and the legacy `-dark` names
- `<ThemeScript>` sets `data-theme` before paint (unchanged). `tokens.css` flips every colour role under
`[data-theme=dark]`. Components write `bg-surface text-fg`, never `dark:bg-…` for colours.
- `dark:` stays available for non-colour differences (e.g. swap a logo image).
- Without `<ThemeScript>` (no theme in the project) the site is light. An optional
`@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) { … } }` block is emitted only when
`defineTokens({ theme: { followSystemWithoutScript: true } })`.
- Legacy: CookieBanner/CookieButton read `dark:bg-[var(--ipal-surface-dark,#171717)]`. `tokens.css` defines
each `--ipal-<role>-dark` as the dark value, so those components already follow the brand in both themes
with no component change. In a later major version, plugin components switch to the new single names and the `-dark`
aliases are deprecated (kept, documented).
- One storage key, `theme` (theme.md). Nothing token-specific is stored.
### 5.4 Derived values
Unset hover/state tints are derived in CSS with `color-mix(in oklch, …)`:
`--ipal-primary-hover: color-mix(in oklch, var(--ipal-primary), black 12%)` (dark theme: `white 12%`),
`--ipal-link: var(--ipal-primary)`, `--ipal-focus: var(--ipal-primary)`. A project overrides any of them.
`color-mix` is Baseline 2023, which every browser we target supports.
## 6. Components never change for a brand
- Block library, starter primitives (`Button`, `Section`, `SectionHeader`, `Card`) and plugin components use
only the utilities/vars in section 3.
- `Section` maps `settings.background`: `default → bg-bg text-fg`, `muted → bg-surface-muted`,
`inverted → bg-inverse` + `data-surface="inverse"` (agreed with the block library).
- **Inverse scope** (`tailwind.css` / `tokens.css`): `[data-surface=inverse]` re-maps the roles that nested content
reads, so cards, rich text, links and focus rings need no inverse variants:
`--ipal-text` and `--ipal-text-strong` → `--ipal-text-inverse`;
`--ipal-text-muted` → `color-mix(in oklch, var(--ipal-text-inverse) 72%, var(--ipal-surface-inverse))`;
`--ipal-border` / `-strong` → the same mix at 18% / 30%;
`--ipal-surface` and `--ipal-hover` → the mix at 8% / 12% (a card inside stays a step off the background);
`--ipal-link` → **`--ipal-link-inverse`**; `--ipal-focus` → **`--ipal-focus-inverse`**.
Both new tokens default to `--ipal-text-inverse`, and a brand may set them. It also sets `color-scheme` to the
opposite of the theme, so form controls match. `primary` / `accent` are not re-mapped: the `ipal-tokens`
contrast report checks `primary` on `surface-inverse` and warns. `data-surface="muted"` exists as a hook,
but re-maps nothing by default. The contrast report checks every text role on `surface-muted` too, so a
failing brand is caught there instead.
- `Button` variants map to `primary` / `secondary` / ghost (`hover`) / link, `rounded-control`,
`duration-fast ease-out`.
- Brand-specific looks that tokens can't express use a **variant** (§6.0 rule 5), never a fork.
- `ipal-audit` already errors on hex in classes. It gains: `dark:(bg|text|border)-` on colour utilities in
`src/blocks` (warning), `style={{ color: '#…' }}`, and raw `var(--color-…)` from older setups.
## 7. `ext-frontend-design` and `DESIGN.md`
The vendored skill already states "`DESIGN.md` tokens win". With the standard, its role is:
- **Allowed:** proposing the brand direction (its "4–6 named colours, type, layout, principles" plan), but the
output is written into `DESIGN.md` + `src/design/tokens.ts`, mapped onto the fixed roles in 3.1, after the owner
approves it. Its "avoid generic defaults" critique applies to the *values* and to the composition inside
block variants.
- **Not allowed:** new token names, colours or fonts in components, extra motion beyond section 3.4, layout
systems outside the containers/fluid scale.
- The skill's override note gets one line: "Map your palette onto the `--ipal-*` roles; do not invent new ones.
Missing role → plugin gap."
## 8. Changes to docs and skills (when building)
- New `docs/design-tokens.md` (module doc: every token, defaults, utilities, the CLI, TS exports, turn off/override/extend).
- AGENT.md §6.11 / §6.11a / §7 table / §12 map: replace the ad-hoc `@theme` example with the standard.
- `ipal-setup` stage 5, `ipal-block` `section-code.md` "Styles", `ipal-site`, `ipal-reference` (`api.md`: new exports, bin, CSS files), `ipal-audit` checks, `ipal-upgrade` (migration steps).
- theme.md: the `@custom-variant` + transition move into `tailwind.css` (copy-paste remains documented for projects without the preset). consent.md / lightbox.md: point to the global tokens.
- `DESIGN.md` template under `docs/agent/skills/ipal-setup/resources/`.
## 9. Accessibility tie-in (optional `a11y.css`)
The a11y widget's CSS (now copy-paste) ships as `@intecion/ipal-kit/a11y.css` and works through tokens:
readable font → `--ipal-font-body/heading` swap; no animations → durations `0ms`; underlined links on
`--ipal-link`; text size stays `html { font-size }` (the fluid scale is rem-based, so it scales). Still opt-in;
the widget itself remains optional (accessibility.md).
## 10. Migration of existing sites
### 10.1 How the seven sites style things today (survey 2026-10-29, read-only)
| Site | ipal-kit | Stack | Colour names | Dark mode | Fonts | Radius | Container | Fluid scale |
|---|---|---|---|---|---|---|---|---|
| architektimprezpl | 1.14.6 | TW4 `@theme` | `--color-bg/surface/surface-2/text/text-muted/accent-primary` + `--background/--foreground`, hex | dark-only, no toggle | local Excon → `--font-display`, `--font-body` | `0` (`rounded-none` ×52) | `max-w-7xl` | fluid.css imported, unused |
| coastalclimatesupplycomau | 1.14.1 | TW4 `@theme static` + `tokens.css` + many inline `style` | `--color-brand-*`, 13× `--color-surface-*`, 8× `--color-border-*`, hex | none | Inter / Montserrat (`--font-yankee` declared, never loaded) | 6px (banner only) | `--ccs-content-max-width` 1600px | own px `--ccs-*` clamp scale; clamp in ~60 TSX files |
| ecogenicacouk | 1.14.1 | TW4 tokens + 21 plain-CSS partials | `--color-primary/accent/background/foreground/muted/surface/border`, hex + oklch | none | Plex Sans `--font-body`, Archivo `--font-display` | 0 | `.container` 1440px | documented `@theme inline` map, plus many ad-hoc clamps |
| intecioncom | 1.14.6 | TW4 `@theme` + `@utility` | brand `--color-primary/lime/navy` + semantic `--color-surface*/fg/edge/accent`, hex | **yes**: `data-theme`, ipal `ThemeSwitcher`, key `theme`; 119 `dark:` | Outfit / Inter / Roboto Mono → `--font-heading/sans/mono` | `.75rem` + arbitrary 14–20px | `--ipal-container` 91.875rem / wide 118.75rem | fluid-wide.css, overridden by a Figma generator script |
| saydiamondspl | 1.11.0 | **no Tailwind**: plain CSS `@layer`, `.ui-*` | unprefixed `--ink/--paper/--burgundy/--gold/--line`, hex | none | Cormorant / Jakarta / JetBrains → `--font-display/body/utility` | 0–2px scale | 1360px | own Utopia `--step-*` / `--space-*` |
| thecleanteampl | ^1.12.2 | TW4 `@theme` + `@apply` components | `--color-primary/accent/dark/light/gray`, hex | none | Franklin / Signika → `--font-body/heading` (on `<body>`) | 9999px | `.container` = `max-w-7xl` | fluid.css mapped, h1–h3 overridden (display < h1) |
| vanstevpl | 1.12.2 | TW4, fonts only in `@theme` | **none**: `text-[#E5680E]` ×49 etc. | none | Poppins / Roboto → `--font-sans`, `--font-button` | `.5rem` vs `rounded-none` ×51 | `max-w-7xl` / `container` | none |
### 10.2 What differs, and what the standard fixes
- **Five colour vocabularies** (shadcn-like, semantic surface/fg/edge, brand-prefixed, unprefixed, none).
`--color-accent` is a different role on every site. → One role set (3.1). The brand colours keep their own
names only inside `tokens.ts` comments and `DESIGN.md`.
- **Six sites redefine `--ipal-*-dark` = light values** only to stop the cookie banner going dark. →
`tokens.css` sets them from the theme; the workaround disappears.
- **Dark mode on one site only**, and it repeats colours with 119 `dark:` classes. → Roles flip on their own.
- **The fluid scale is imported but ignored on 2 sites, missing on 2, hand-generated on 1.** → `fs` pairs in
`tokens.ts` replace private scales and scripts.
- **Font var names**: `--font-display` vs `--font-heading`, `--font-sans` vs `--font-body`; set on `<body>` on one site. → Fixed slots.
- **Radius lives only in `--ipal-radius`, and markup contradicts it.** → Semantic radii, used by components.
- **Containers**: 80rem ×3, 1360/1440/1600px, intecion's 91.875rem. → `--ipal-container` per brand (a value, not a rule).
- **Motion**: two sites have tokens with different names but the same curve. → `--ipal-duration-*` / `--ipal-ease-*`.
- **ipal-kit versions** range from 1.11.0 to 1.14.6, and one site uses a caret. Any migration starts with `ipal-upgrade` to the release that ships the tokens.
### 10.3 Migration path (per site, opt-in, never forced)
Adoption is **additive**: importing `tokens.css` + `tailwind.css` changes nothing visible until a site maps
its brand. The Tailwind utilities the preset adds (`bg-surface`, `text-fg`, `rounded-card` …) do not collide
with stock Tailwind names, except `shadow-sm/md/lg` and `rounded-sm/full`, which become token-driven but
default to the same Tailwind values.
Per site:
1. `ipal-upgrade` to the token release; add the 4 imports (4) and `src/design/tokens.ts`.
2. **Map**: write the brand into `tokens.ts` from the site's current `@theme` (colours → roles, fonts → slots,
radius, container, fluid pairs). Keep the old `--color-*` names as **aliases** to `--ipal-*` in a marked
`/* legacy, remove after migration */` block, so no component breaks on day one.
3. Delete the `--ipal-*-dark` workaround block.
4. Replace hard-coded values and old utilities file by file (`ipal-audit` lists them); new blocks from the
shared library already use the standard.
5. Remove the legacy alias block when `ipal-audit` shows no old names. Write `DESIGN.md` from the template.
Suggested order and effort (decision 5):
| Site | Effort | Why |
|---|---|---|
| intecioncom | S–M | already semantic + `data-theme` + fluid-wide; mostly renames and dropping `dark:` colour classes; its generator becomes `fs` pairs. **Good pilot**, as it's the team's own site |
| thecleanteampl | S | small palette, fluid mapped; fix font vars on `<html>`, display < h1 |
| ecogenicacouk | M | shadcn-like names map 1:1; the work is the 21 partials' ad-hoc clamps |
| architektimprezpl | M | dark-only → `theme: 'dark'`; spectrum/ember decorative colours stay project-only (deviation) |
| vanstevpl | M | no tokens at all: 49+ hex classes to replace, but a simple brand |
| coastalclimatesupplycomau | L | 13 surfaces / 8 borders to collapse, inline styles, own px scale |
| saydiamondspl | L | no Tailwind; 1.11.0. Adopt `tokens.css` only (map `--ink/--paper/…` onto roles); keep its CSS architecture |
Nothing in these repos is edited by this proposal.
## 11. Decisions (approved 2026-10-29)
The owner accepted every recommendation:
| # | Decision |
|---|---|
| 1 | Brand source: `src/design/tokens.ts` + the `ipal-tokens` CLI generating `src/design/tokens.css` |
| 2 | Utility names: the plugin's own (`bg-bg`, `text-fg`, `text-fg-muted`, `bg-surface-muted`, `text-on-primary` …) |
| 3 | Colour format: oklch in the defaults and the starter (any CSS colour still accepted) |
| 4 | Default scale for new sites: `fluid-wide.css` |
| 5 | Migration: intecioncom pilot, then each site when it is next touched |
| 6 | Plugin components move to the single token names in this release; the `-dark` aliases stay |
| 7 | Ship `@intecion/ipal-kit/a11y.css` |
Also agreed with the block library: the inverse scope (`data-surface="inverse"`, section 6).
### Options as proposed
1. **Brand source:** `src/design/tokens.ts` + `ipal-tokens` CLI generating `tokens.css`, with a contrast check and
values for OG/e-mail (**recommended**), or a hand-written `src/design/tokens.css` only. The var names and paths are the same either way.
2. **Utility names:** the plugin's own (`bg-bg`, `text-fg`, `text-fg-muted`, `bg-surface-muted`, `text-on-primary`)
(**recommended**: they match the vars CookieBanner already ships and intecion's semantic names), or shadcn-style
(`bg-background`, `text-foreground`, `bg-muted`, `text-muted-foreground`, `text-primary-foreground`), which only
ecogenica resembles and no site uses with shadcn/ui.
3. **Colour format in defaults and the starter:** oklch (**recommended**: even steps for the derived hovers) or
hex. Projects may write any CSS colour either way.
4. **Default fluid range for new sites:** `fluid.css` (to 1280) or `fluid-wide.css` (to 1920). Only intecion uses wide;
recommendation: fluid-wide, so 1440/1920 monitors aren't left with empty margins.
5. **Migration:** pilot on intecioncom, then the rest one by one when each site is next touched (**recommended**),
or a scheduled sweep. Includes whether coastal/saydiamonds migrate at all.
6. **Plugin components switch to the single-name tokens** (drop `dark:[var(--ipal-*-dark)]`) in this release with
the `-dark` aliases kept, or wait for a major version. Recommendation: this release. With the aliases, nothing breaks.
7. **`a11y.css`** as a shipped file (section 9): yes / not now.
Agreed with: the block library (`design-tokens-names.md` in the shared notes), the starter and the reference site
(`design-tokens-wiring.md`).