Merge claude/design-tokens-build: design tokens (tokens.css, tailwind.css, ipal-tokens)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 14:14:17 +01:00
co-authored by Claude Opus 5.5
44 changed files with 2277 additions and 101 deletions
+32 -14
View File
@@ -186,6 +186,7 @@ site), **P** = a test in the panel. Full code: PROGRAMISTA.md §2.
| 16 | **Nothing hardcoded** | every text, link, image, file, company data from the panel; domains and keys from `.env` (§2) | — | A, P |
| 17 | **Content** | one h1, the answer at the start of each section, facts, internal links, FAQ from real questions, `aiSummary`, sameAs, consistent company data (§0c) | — | S, P |
| 18 | **Scaling** | `fluid.css` / `fluid-wide.css`, hero on `--ipal-hero-min-h`, the screen list in §6.11a (including 1366×768) | — | A, browser |
| 19 | **Design tokens** | `DESIGN.md` + `src/design/tokens.ts` → `pnpm exec ipal-tokens` → `src/design/tokens.css`; `styles.css` imports `fluid-wide.css`, `tokens.css`, `tailwind.css`, the brand file (§6.11); fonts in `--font-family-body` / `--font-family-heading` | `defineTokens`, `ipal-tokens` | A (`ipal-tokens --check`), browser (both themes) |
**Turnstile works by itself:** both keys in the panel (or env) → the widget shows, and
`submitForm` **requires** a token; no keys → no widget, the form works.
@@ -879,25 +880,37 @@ upload + `<Media>`; **a fixed set of UI icons** → a `select` field with names
a `lucide-react` map in `src/components/icons/` (names in a separate file, so the block
config does not import React). Code: [section-code.md](./skills/ipal-block/resources/section-code.md). **Never** SVG pasted into a section's JSX.
### 6.11 Styles
### 6.11 Styles — the design-token standard ([design-tokens.md](../design-tokens.md))
- Tailwind in components; colors and fonts as **tokens** in `styles.css` (`@theme`)
from the `DESIGN.md` source. In components only tokens (`bg-primary`), **never**
`bg-[#ff6600]` or hex.
- Map the plugin's tokens to the project: `--ipal-primary: var(--color-primary)`.
- Fluid typography and spacing: `@import "@intecion/ipal-kit/fluid.css"` + mapping in
`@theme` (`text-h1`, `py-section`, `px-gutter` — PROGRAMISTA §2.5). Do not write `clamp()`
in components; other values from `DESIGN.md` → override the `--ipal-*` variables in `:root`.
Every site uses the same `--ipal-*` token names and Tailwind utilities; only the values differ per brand.
- **The brand lives in two files:** `DESIGN.md` (human, template `ipal-setup/resources/DESIGN.md`) and
`src/design/tokens.ts` (`defineTokens` from `@intecion/ipal-kit/tokens`, template `ipal-setup/resources/tokens.ts`).
`pnpm exec ipal-tokens` writes `src/design/tokens.css` (commit it) and fails on a WCAG AA contrast error.
Never edit the generated file; never put brand values in `styles.css` or in a component.
- **`styles.css` is the same on every site:** `@import "tailwindcss"`, `@intecion/ipal-kit/fluid-wide.css` (or
`fluid.css`), `@intecion/ipal-kit/tokens.css`, `@intecion/ipal-kit/tailwind.css`, `../../design/tokens.css` (last), `@source` of the plugin's dist.
- **Components use only the utilities from the preset:** `bg-bg`, `bg-surface`, `bg-surface-muted`, `bg-inverse`,
`text-fg`, `text-fg-strong`, `text-fg-muted`, `text-on-primary`, `border-border`, `bg-primary hover:bg-primary-hover`,
`text-link`, `outline-focus`, `text-h1`…`text-display`, `py-section`, `px-gutter`, `gap-gap`, `rounded-control`,
`rounded-card`, `shadow-sm`, `max-w-container`, `duration-fast ease-out`. **Never** hex, `bg-[#…]`, `var(--color-…)`,
or `dark:` for colours (the roles switch with `data-theme` themselves). `dark:` only for non-colour differences.
- **Inverted section:** `<Section>` with `settings.background = inverted` → `bg-inverse` + `data-surface="inverse"`;
content inside keeps `text-fg` / `text-link` (the scope re-maps them).
- Fonts via `next/font` with `variable: '--font-family-body'` / `'--font-family-heading'` on `<html>` (not
`--font-body`: a `var()` cycle with the `font-body` utility). Max 2 families.
- Values a CSS variable can't reach (`next/og`, e-mail, `theme-color`): `resolveColors(tokens)` from `@/design/tokens`.
In inline styles / charts: `IPAL_TOKENS.primary` or `ipalVar('primary')`; breakpoints in JS: `IPAL_BREAKPOINTS`.
- A missing role every site would need → **ipal-plugin-gap**; a project-only decorative colour → `styles.css` below the
imports + `DESIGN.md` → Deviations.
- JSON-LD only via `<JsonLdGraph>` from `/rsc` — never your own `<script dangerouslySetInnerHTML>`.
- Fonts via `next/font`, wired to `@theme` through a CSS variable.
- No CSS Modules and no `style={{…}}` — exception: a dynamic value from data.
- Variants → `Record<Variant, string>`, not ternary chains.
Example `styles.css`: [section-code.md](./skills/ipal-block/resources/section-code.md).
### 6.11a Scaling (fluid / responsive) — from 360 px to 1920 px
- **Scale from the plugin:** `fluid.css` (grows up to 1280 px) or `fluid-wide.css` (grows up to 1920 px —
choose it when the site should look different on a 13″ laptop and a 27″ monitor). No `clamp()` in
components; numbers from `DESIGN.md` → override `--ipal-*` in `:root`.
- **Scale from the plugin:** `fluid-wide.css` (grows up to 1920 px — the default for new sites) or `fluid.css`
(stops at 1280 px). No `clamp()` in components or `styles.css`; different numbers from `DESIGN.md` → min/max
pairs in `src/design/tokens.ts` (`fs: { h1: ['2.25rem', '4rem'] }`, `space: { section: [3, 8] }`) → `ipal-tokens`.
- **Screen height:** instead of `h-screen` / `100vh` → `min-h-[var(--ipal-hero-min-h)]` (svh, with
a limit). Hero heading `--ipal-fs-display-fit`, hero spacing `--ipal-space-section-fit` — on
1366×768 the hero CTA must be visible without scrolling.
@@ -1029,7 +1042,9 @@ project → **plugin gap**, not a copy.
| YouTube without cookies before a click | `<YouTubeEmbed>` (`/client`) | storage.md |
| `next.config` | `buildImagesConfig`, `buildSecurityHeaders` (`csp`), `buildCsp`, `buildCspHeaders`, `buildAdminCsp` / `buildAdminCspHeaders`, `buildUploadSecurityHeaders`, `withSecurityConfig` (hides `X-Powered-By`) | storage.md, security.md |
| CSP reports, nonces | `createCspReportRoute` (`parseCspReports`, type `CspViolation`), `createProxy({ csp })` + `<SiteProviders nonce>` (dynamic pages only), `createCspNonce`, `CSP_NONCE_HEADER`, `buildReportingEndpoints`, `cspHeaderKey`, `DEFAULT_CSP_REPORT_GROUP`; types `BuildAdminCspArgs`, `CspDirective`, `CspSources`, `CreateCspReportRouteArgs`, `WithSecurityConfigOptions` | security.md |
| Fluid typography and spacing | `fluid.css` / `fluid-wide.css` (`--ipal-*` variables) | PROGRAMISTA §2.5 |
| Fluid typography and spacing | `fluid.css` / `fluid-wide.css` (`--ipal-*` variables); your own sizes: `fluidClamp`, `FLUID_SCALE`, `FLUID_RANGES` | design-tokens.md |
| Brand colours, fonts, radii, motion, dark mode | `tokens.css` + `tailwind.css`, `src/design/tokens.ts` (`defineTokens`, types `TokensInput`, `ColorInput`, `ColorRole`), `pnpm exec ipal-tokens` (`--check`, `--report`, `--warn-only`); building blocks `tokensToCss`, `defaultTokensCss`, `contrastReport` (`ContrastRow`), `contrastRatio`, `parseColor`, `resolveColors`, `IPAL_TOKENS`, `ipalVar`, `IpalTokenName`, `IPAL_BREAKPOINTS`, `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, `RemValue`, `FluidRange` | design-tokens.md |
| Accessibility widget CSS | `@intecion/ipal-kit/a11y.css` (works through the tokens) | accessibility.md |
**Consent, analytics, operations**
| Need | Use | Doc |
@@ -1205,6 +1220,8 @@ eliminate most of it.
`PRODUCT.md` + `DESIGN.md` in the project root (`/impeccable init`,
`/impeccable document`). The agent does not "polish" styles ad hoc. Impeccable does not
touch content — design tokens in code are the visual system, not hardcoded content.
Whatever writes the look, it lands in `DESIGN.md` (template sections) and `src/design/tokens.ts`, on the
fixed `--ipal-*` roles (§6.11) — never as new token names or values in components.
- **Editor:** all content in the panel.
Record the key project decisions (stack, decisions, page modes) in the project's `AGENTS.md`
@@ -1274,6 +1291,7 @@ Anything that needs a developer → move it to the panel.
| Under-construction mode | [construction.md](../construction.md) |
| Visit statistics (optional) | [stats.md](../stats.md) |
| Light / dark theme | [theme.md](../theme.md) |
| Design tokens, `ipal-tokens`, DESIGN.md | [design-tokens.md](../design-tokens.md) |
| Payload helpers (getSiteSettings…) | [payload-helpers.md](../payload-helpers.md) |
| Rich text | [richtext.md](../richtext.md) |
| Headers, CSP, 2FA, panel path | [security.md](../security.md) |
@@ -1392,7 +1410,7 @@ pnpm exec ipal-skills --external ext-accessibility,ext-payload # only these
| `ext-react-best-practices` | Vercel · MIT | React/Next performance rules (waterfalls, bundles, RSC, re-renders) | no `swr` / client-fetch libraries — Server Components + Payload / `@/lib/content` |
| `ext-composition-patterns` | Vercel · MIT | compound components instead of boolean props, React 19 APIs | block schema and `RenderBlocks` follow §6 |
| `ext-accessibility` | Addy Osmani · MIT | WCAG 2.2 audit and fixes | Lighthouse / axe only as pinned devDependencies; ipal-kit components fixed via props or a plugin gap |
| `ext-frontend-design` | Anthropic · Apache-2.0 | distinctive visual direction, design quality floor | `DESIGN.md` tokens win; use it to write/extend `DESIGN.md`, never hex/fonts/text in components |
| `ext-frontend-design` | Anthropic · Apache-2.0 | distinctive visual direction, design quality floor | `DESIGN.md` tokens win; use it to write/extend `DESIGN.md` + `src/design/tokens.ts`, mapping its palette onto the `--ipal-*` roles (design-tokens.md) — never new token names, never hex/fonts/text in components |
| `ext-payload` | Payload CMS · MIT | Payload 3 reference (v3.92.1) | reference only, never Payload 4 guidance; ipal-kit features first |
**Our rules win.** Every `ext-*` SKILL.md starts with an override note; when an external skill conflicts with