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:
+19
-1
@@ -14,6 +14,15 @@ Database names follow one rule, and seeding a live site touches only the records
|
||||
fifteen ready page sections and ten page templates.
|
||||
|
||||
### New
|
||||
- **Design-token standard** ([design-tokens.md](./design-tokens.md)): one set of `--ipal-*` names for every site,
|
||||
only the values differ per brand. `@intecion/ipal-kit/tokens.css` (neutral defaults, light/dark on `data-theme`,
|
||||
`[data-surface="inverse"]` scope, reduced motion), `@intecion/ipal-kit/tailwind.css` (Tailwind 4 preset: `bg-surface`,
|
||||
`text-fg`, `text-on-primary`, `py-section`, `rounded-card`, `duration-fast`…), `@intecion/ipal-kit/a11y.css` (the
|
||||
accessibility widget's CSS through the tokens). New entry `@intecion/ipal-kit/tokens` (`defineTokens`, `tokensToCss`,
|
||||
`contrastReport`, `fluidClamp`, `IPAL_TOKENS`, `ipalVar`, `IPAL_BREAKPOINTS` …; the first four names also from the root).
|
||||
New bin `ipal-tokens`: `src/design/tokens.ts` → `src/design/tokens.css` + WCAG contrast check (`--check` for CI).
|
||||
Templates `DESIGN.md` and `tokens.ts` in `ipal-setup/resources`. `ipal-audit` checks the standard.
|
||||
- `fluid.css` / `fluid-wide.css`: `--ipal-fs-xs`, `--ipal-fs-h4`, `--ipal-space-stack`, `--ipal-space-section-sm`.
|
||||
- **Block library** ([block-library.md](./block-library.md)): `hero`, `textMedia`, `featureGrid`, `cta`, `richText`, `faq`,
|
||||
`contact`, `gallery`, `testimonials`, `stats`, `steps`, `logos`, `team`, `pricing`, `entryList` — Payload block +
|
||||
server component each, `{ en, pl }` panel, accessibility built in, styled only with design-token utilities.
|
||||
@@ -34,6 +43,12 @@ fifteen ready page sections and ten page templates.
|
||||
`skip (not listed)`. The seed templates (`ipal-site`, `ipal-form`) read it.
|
||||
|
||||
### Changed
|
||||
- **Cookie banner / button colours** read the single token names (`--ipal-surface`, `--ipal-text` …) instead of
|
||||
`dark:` + `--ipal-*-dark`. With `tokens.css` they switch with the theme. Without it, the built-in fallback follows the
|
||||
page's `color-scheme` (`light-dark()`): a site without a dark theme no longer gets a dark banner on a dark-mode
|
||||
device. A `-dark` variable a site still sets is used as the dark fallback. The secondary button's dark fallback text
|
||||
is `#d4d4d4` (was `#e5e5e5`).
|
||||
- Lightbox fade: `--ipal-lightbox-duration` defaults to `var(--ipal-duration, 200ms)`; new `--ipal-lightbox-easing`.
|
||||
- **Admin labels:** the link "Open in new tab" checkbox is now **New tab** (with a description) and the table-of-contents
|
||||
switch **Show contents** — shorter labels per admin-ux; the stored fields are unchanged.
|
||||
- **A full seed of a live database is refused:** a run without `only` / `SEED_ONLY` against `NODE_ENV=production` or
|
||||
@@ -48,7 +63,10 @@ fifteen ready page sections and ten page templates.
|
||||
2. Optional: name the databases `<domain without dots>_prod` / `_dev` and add `ipalEnvRules({ databaseName: true })`
|
||||
to see a warning when `DATABASE_URI` points elsewhere. Existing databases need not be renamed.
|
||||
3. Seed scripts copied from older templates: take the new `SEED_ONLY` handling from `ipal-site` / `ipal-form`.
|
||||
4. Block library — optional, nothing changes until you turn blocks on. New sites: the starter turns on eight blocks.
|
||||
4. Optional: adopt the design-token standard (design-tokens.md → "Migrating an existing site"; **ipal-upgrade**). A
|
||||
site that styles the cookie banner only through `--ipal-*-dark` for its dark theme and does not adopt `tokens.css`:
|
||||
check the banner in the dark theme (the dark fallback now needs `color-scheme: dark`, which `<ThemeScript>` sets).
|
||||
5. Block library — optional, nothing changes until you turn blocks on. New sites: the starter turns on eight blocks.
|
||||
Existing sites move block by block when they get work (an own block with the same slug and fields can be replaced by
|
||||
the library block with `slug`, else a migration with **ipal-migrate-fields**). After turning blocks on:
|
||||
`pnpm generate:types`, `pnpm payload generate:importmap`, Postgres/SQLite `pnpm payload migrate:create`.
|
||||
|
||||
@@ -51,6 +51,7 @@ API details — one file per module:
|
||||
| Stats in the admin panel (no cookies; visitor history with consent) | [stats.md](./stats.md) |
|
||||
| Auto-slug | [slug.md](./slug.md) |
|
||||
| Light / dark theme, switcher | [theme.md](./theme.md) |
|
||||
| Design tokens (`--ipal-*`, `tokens.css`, `tailwind.css`, `ipal-tokens`, DESIGN.md) | [design-tokens.md](./design-tokens.md) |
|
||||
| R2, `buildImagesConfig`, `MediaPreconnect`, `YouTubeEmbed` | [storage.md](./storage.md) |
|
||||
| Turnstile | [turnstile.md](./turnstile.md) |
|
||||
| Admin panel white-label | [white-label.md](./white-label.md) |
|
||||
|
||||
@@ -75,8 +75,14 @@ the plugin only needs `A11yTexts` for the current locale.
|
||||
|
||||
## 2. CSS that reacts to the attributes (MANDATORY — project)
|
||||
|
||||
The widget sets attributes on `<html>`. Without this CSS nothing happens. Copy it
|
||||
into the project's global CSS (adapt it to the design):
|
||||
The widget sets attributes on `<html>`. Without CSS for them nothing happens.
|
||||
|
||||
**Ready file (1.15.0):** `@import "@intecion/ipal-kit/a11y.css";` in `styles.css` — the rules below, working through
|
||||
the design tokens ([design-tokens.md](./design-tokens.md)): the readable font swaps `--ipal-font-body/-heading` (set
|
||||
`--ipal-font-readable` to change it), "no animations" zeroes the `--ipal-duration-*` tokens, contrast + grayscale
|
||||
combine, the big cursor is built in. Check: tick each option in the widget and see the page change.
|
||||
|
||||
Or copy this into the project's global CSS (adapt it to the design):
|
||||
|
||||
```css
|
||||
/* Text size */
|
||||
|
||||
+32
-14
@@ -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
|
||||
|
||||
@@ -30,6 +30,12 @@ following the hint (PROGRAMISTA §2) — do not ask whether it is needed. The on
|
||||
a client decision recorded in `AGENTS.md` as `ipal-audit-skip: <keys> — <reason>` (keys
|
||||
in AGENT.md §0b). Never add that line yourself just to make the audit pass.
|
||||
|
||||
## Design tokens (AGENT.md §6.11)
|
||||
The script checks: hex in classes and inline styles (error), `dark:` on colour utilities and `var(--color-…)` in
|
||||
classes (warnings), `styles.css` without `@intecion/ipal-kit/tokens.css` (warning — a site not yet migrated),
|
||||
next/font in `--font-body` with the preset (warning), and with `src/design/tokens.ts`: no `DESIGN.md` (warning) and
|
||||
`ipal-tokens --check` — a stale `src/design/tokens.css` or a WCAG AA contrast failure is an error.
|
||||
|
||||
## What the script does not check (do it by hand)
|
||||
|
||||
- **Editor test** (AGENT.md §11): every text, image, button, section,
|
||||
|
||||
@@ -152,6 +152,15 @@ if [ -n "$UI" ]; then
|
||||
report ERROR "hex colors in classes" "§6.11 use design tokens (bg-primary…)" \
|
||||
"$(g '(bg|text|border|from|to|via|fill|stroke)-\[#' $UI --include=*.tsx)"
|
||||
|
||||
report WARNING "dark: on colour utilities" "§6.11 the --ipal-* roles switch with the theme — bg-surface/text-fg, no dark:bg-…" \
|
||||
"$(g '\bdark:(hover:|focus:)?(bg|text|border|from|to|via|fill|stroke|ring|outline)-' $UI --include=*.tsx)"
|
||||
|
||||
report WARNING "old colour variables in classes" "§6.11 use the preset utilities (bg-primary, text-fg) — not var(--color-…)" \
|
||||
"$(g '\[var\(--color-' $UI --include=*.tsx)"
|
||||
|
||||
report ERROR "hex colors in inline styles" "§6.11 use design tokens — IPAL_TOKENS / ipalVar() for a dynamic style" \
|
||||
"$(g "style=\{\{[^}]*['\"]#[0-9a-fA-F]{3,8}['\"]" $UI --include=*.tsx)"
|
||||
|
||||
report ERROR "barrel index.ts" "§6.12 import files directly" \
|
||||
"$(find $UI -name 'index.ts' 2>/dev/null)"
|
||||
|
||||
@@ -162,6 +171,26 @@ if [ -n "$UI" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
# --- Design tokens (§6.11, design-tokens.md) ---
|
||||
STYLES=$(find src/app -name 'styles.css' -not -path '*/node_modules/*' 2>/dev/null | head -1)
|
||||
if [ -n "$STYLES" ]; then
|
||||
report WARNING "design-token standard not wired" "§6.11 styles.css imports @intecion/ipal-kit/tokens.css + tailwind.css + ../../design/tokens.css" \
|
||||
"$(grep -q 'ipal-kit/tokens.css' "$STYLES" || echo "$STYLES: no @import \"@intecion/ipal-kit/tokens.css\"")"
|
||||
report WARNING "next/font in the Tailwind font slot" "§6.11 next/font variable '--font-family-body' / '--font-family-heading' (--font-body cycles with the font-body utility)" \
|
||||
"$(grep -q 'ipal-kit/tailwind.css' "$STYLES" && g "variable: ['\"]--font-(body|heading|mono)['\"]" src/app --include=*.ts --include=*.tsx)"
|
||||
fi
|
||||
if [ -f src/design/tokens.ts ]; then
|
||||
[ -f DESIGN.md ] || report WARNING "no DESIGN.md" "§6.11 the brand is described in DESIGN.md (template: ipal-setup/resources/DESIGN.md)" "DESIGN.md missing"
|
||||
TOKENS_BIN=node_modules/@intecion/ipal-kit/bin/ipal-tokens.mjs
|
||||
if [ -f "$TOKENS_BIN" ]; then
|
||||
TOKENS_OUT=$(node "$TOKENS_BIN" --check 2>&1)
|
||||
[ $? -ne 0 ] && report ERROR "ipal-tokens --check" "§6.11 run pnpm exec ipal-tokens: the CSS is stale or a contrast pair fails WCAG AA" \
|
||||
"$(printf '%s\n' "$TOKENS_OUT" | grep -E '✗|out of date|ipal-tokens:' || echo 'ipal-tokens --check failed')"
|
||||
else
|
||||
report WARNING "ipal-tokens not installed" "§6.11 @intecion/ipal-kit 1.15+ ships the ipal-tokens bin" "$TOKENS_BIN missing"
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- Collections (§5.3) ---
|
||||
if [ -d src/collections ]; then
|
||||
report ERROR "forbidden collection" "§5.3 settings/nav/footer are globals; FAQ/hero are blocks" \
|
||||
|
||||
@@ -63,7 +63,9 @@ File patterns (Hero, FeatureGrid + FeatureCard): `resources/section-code.md`.
|
||||
2. `src/blocks/<Name>/Component.tsx` — named export, type from `@/payload-types`
|
||||
(`<Name>Block & { locale: string }`), structure:
|
||||
`<Section settings>` → `<SectionHeader header>` → content with `<Media>`, `<CMSLink>`,
|
||||
`items.map(<Card/>)`. No text, `href`, `<img>`, hex colors or inline SVG.
|
||||
`items.map(<Card/>)`. No text, `href`, `<img>`, hex colors or inline SVG. Styles only through the design-token
|
||||
utilities (`bg-surface`, `text-fg`, `rounded-card`, `py-section` — AGENT.md §6.11, design-tokens.md); no `dark:` for
|
||||
colours; a different look per brand = a value in `src/design/tokens.ts`, never a change here.
|
||||
3. Subcomponents go in the same folder; shared by 2+ sections → `src/components/ui/`.
|
||||
An image the visitor can enlarge (gallery, card, product, certificate) → wrap the `<Media>` in
|
||||
`<LightboxTrigger group={`<name>-${id}`} image={lightboxImage(item.image, { size: 'hero' })}>`
|
||||
|
||||
@@ -81,10 +81,12 @@ export async function CMSLink({ link, locale, className, children }: Props) {
|
||||
```ts
|
||||
import type { LinkAppearance } from '@intecion/ipal-kit'
|
||||
|
||||
// design-token utilities only (design-tokens.md) — a brand changes src/design/tokens.ts, never this file
|
||||
const BASE = 'inline-flex items-center gap-2 rounded-control px-5 py-2.5 font-medium transition-colors duration-fast ease-out'
|
||||
const VARIANTS: Record<LinkAppearance, string> = {
|
||||
primary: 'btn btn-primary',
|
||||
secondary: 'btn btn-secondary',
|
||||
link: 'link-arrow',
|
||||
primary: `${BASE} bg-primary text-on-primary hover:bg-primary-hover`,
|
||||
secondary: `${BASE} bg-secondary text-on-secondary hover:bg-secondary-hover`,
|
||||
link: 'text-link underline-offset-4 hover:text-link-hover hover:underline',
|
||||
}
|
||||
|
||||
export function buttonClass(appearance: LinkAppearance): string {
|
||||
@@ -135,18 +137,21 @@ import type { ReactNode } from 'react'
|
||||
import type { SectionSettings } from '@/payload-types'
|
||||
|
||||
const BACKGROUNDS: Record<NonNullable<SectionSettings['background']>, string> = {
|
||||
default: 'bg-background',
|
||||
muted: 'bg-muted',
|
||||
inverted: 'bg-foreground text-background',
|
||||
default: 'bg-bg text-fg',
|
||||
muted: 'bg-surface-muted text-fg',
|
||||
inverted: 'bg-inverse',
|
||||
}
|
||||
|
||||
export function Section({ settings, children }: { settings?: SectionSettings | null; children: ReactNode }) {
|
||||
const background = settings?.background ?? 'default'
|
||||
return (
|
||||
<section
|
||||
id={settings?.anchor || undefined}
|
||||
className={`py-16 md:py-24 ${BACKGROUNDS[settings?.background ?? 'default']}`}
|
||||
// inverse: the tokens inside are re-mapped, so cards/links keep text-fg, text-link (design-tokens.md)
|
||||
data-surface={background === 'inverted' ? 'inverse' : undefined}
|
||||
className={`py-section ${BACKGROUNDS[background]}`}
|
||||
>
|
||||
<div className="container">{children}</div>
|
||||
<div className="mx-auto max-w-container px-gutter">{children}</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -159,10 +164,10 @@ import type { SectionHeaderData } from '@/payload-types'
|
||||
export function SectionHeader({ header, as: H = 'h2' }: { header?: SectionHeaderData | null; as?: 'h1' | 'h2' }) {
|
||||
if (!header?.heading && !header?.eyebrow && !header?.intro) return null
|
||||
return (
|
||||
<header className="mb-10 max-w-2xl">
|
||||
{header.eyebrow && <p className="eyebrow">{header.eyebrow}</p>}
|
||||
{header.heading && <H className="heading">{header.heading}</H>}
|
||||
{header.intro && <p className="lead">{header.intro}</p>}
|
||||
<header className="mb-stack max-w-measure">
|
||||
{header.eyebrow && <p className="mb-2 text-sm font-medium text-fg-muted">{header.eyebrow}</p>}
|
||||
{header.heading && <H className={H === 'h1' ? 'text-h1' : 'text-h2'}>{header.heading}</H>}
|
||||
{header.intro && <p className="mt-4 text-lead">{header.intro}</p>}
|
||||
</header>
|
||||
)
|
||||
}
|
||||
@@ -251,7 +256,7 @@ buildSectionSettingsField(),
|
||||
// src/blocks/FeatureGrid/FeatureCard.tsx
|
||||
export function FeatureCard({ item, locale }: { item: FeatureItem; locale: string }) {
|
||||
return (
|
||||
<article className="card">
|
||||
<article className="flex flex-col gap-4 rounded-card border border-border bg-surface p-6 shadow-sm">
|
||||
<Media resource={item.media} sizes="(min-width: 1024px) 33vw, 100vw" />
|
||||
<h3>{item.heading}</h3>
|
||||
{item.text && <p>{item.text}</p>}
|
||||
@@ -265,7 +270,7 @@ export function FeatureGrid({ header, items, links, settings, locale }: FeatureG
|
||||
return (
|
||||
<Section settings={settings}>
|
||||
<SectionHeader header={header} />
|
||||
<div className="grid gap-6 md:grid-cols-3">
|
||||
<div className="grid gap-gap md:grid-cols-3">
|
||||
{items?.map((item) => <FeatureCard key={item.id} item={item} locale={locale} />)}
|
||||
</div>
|
||||
{links?.map(({ id, link }) => <CMSLink key={id} link={link} locale={locale} className="mt-10" />)}
|
||||
@@ -315,30 +320,23 @@ components. **Never** SVG pasted into a section's JSX.
|
||||
|
||||
## Style
|
||||
|
||||
- **Tailwind in components**, colors and fonts as **tokens** in `styles.css`
|
||||
(`@theme`) — the source is `DESIGN.md` (Impeccable). Components use only token
|
||||
names (`bg-primary`, `text-foreground`), **never** `bg-[#ff6600]` or hex.
|
||||
- Map the plugin tokens to the project tokens — one brand color in one place.
|
||||
- Fonts via `next/font` in the layout, wired to `@theme` with a CSS variable.
|
||||
The design-token standard (`node_modules/@intecion/ipal-kit/docs/design-tokens.md`, AGENT.md §6.11):
|
||||
- **Components use only the preset's utilities** — `bg-bg`, `bg-surface`, `bg-surface-muted`, `bg-inverse`, `text-fg`,
|
||||
`text-fg-strong`, `text-fg-muted`, `text-on-primary`, `border-border`, `text-link`, `outline-focus`, `text-h1`…,
|
||||
`py-section`, `px-gutter`, `gap-gap`, `rounded-control`, `rounded-card`, `shadow-sm`, `max-w-container`.
|
||||
**Never** hex, `bg-[#ff6600]`, `var(--color-…)`, or `dark:` for colours (the roles switch with the theme).
|
||||
- The brand is `src/design/tokens.ts` → `pnpm exec ipal-tokens` → `src/design/tokens.css`; `DESIGN.md` describes it.
|
||||
- Fonts via `next/font` with `variable: '--font-family-body'` / `'--font-family-heading'` on `<html>`.
|
||||
- No CSS Modules and no `style={{…}}` — exception: a dynamic value from data.
|
||||
- Visual variants → `Record<Variant, string>` (§6.3), not ternary chains.
|
||||
|
||||
```css
|
||||
/* src/app/(frontend)/styles.css */
|
||||
/* src/app/(frontend)/styles.css — the same on every site */
|
||||
@import "tailwindcss";
|
||||
@import "@intecion/ipal-kit/fluid-wide.css";
|
||||
@import "@intecion/ipal-kit/tokens.css";
|
||||
@import "@intecion/ipal-kit/tailwind.css";
|
||||
@import "../../design/tokens.css"; /* generated by ipal-tokens from src/design/tokens.ts */
|
||||
@source "../../../node_modules/@intecion/ipal-kit/dist/**/*.js";
|
||||
|
||||
@theme {
|
||||
--color-primary: oklch(0.62 0.19 45);
|
||||
--color-background: oklch(0.99 0 0);
|
||||
--color-foreground: oklch(0.2 0 0);
|
||||
--color-muted: oklch(0.96 0 0);
|
||||
--font-sans: var(--font-body); /* next/font: variable '--font-body' */
|
||||
}
|
||||
|
||||
:root {
|
||||
--ipal-primary: var(--color-primary); /* cookie banner, Turnstile = brand color */
|
||||
--ipal-radius: 0.75rem;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -189,7 +189,8 @@ Mandatory set: AGENT.md §0b, skill **ipal-setup**; checks: **ipal-audit**, **ip
|
||||
| page templates | `scripts/seed-content.ts` | `pageTemplates.home({ blocks: libraryBlockSlugs(blockOptions) })`, `pageTemplates.contact({ form: { $form: 'Contact form' } })` (`/templates`); after launch only with `SEED_ONLY` | seed summary 0 errors | block-library.md, seeding.md |
|
||||
| FAQ rich results | page route | `getPageJsonLd(locale, slug, { faq: faqItemsFromLayout })` | Rich Results Test → FAQPage | block-library.md, seo.md |
|
||||
| languages in the header | header | `<LanguageSwitcher>` (`/client`), `<AlternateLinksUpdater>` | switches to `/en/<slug-en>` | i18n.md |
|
||||
| Tailwind | `styles.css` | `@import "@intecion/ipal-kit/fluid.css";` + `@source "…/node_modules/@intecion/ipal-kit/dist/**/*.js";` | the cookie banner is styled | PROGRAMISTA §2.5 |
|
||||
| Tailwind + design tokens | `styles.css`, `src/design/tokens.ts`, `DESIGN.md` | `@import` `fluid-wide.css` (or `fluid.css`), `tokens.css`, `tailwind.css`, `../../design/tokens.css` + `@source "…/node_modules/@intecion/ipal-kit/dist/**/*.js";`; `pnpm exec ipal-tokens`; next/font `--font-family-body` / `--font-family-heading` | `ipal-tokens --check` up to date, no ✗ contrast rows; the cookie banner in the brand colour in both themes | design-tokens.md |
|
||||
| a11y widget CSS | `styles.css` | `@import "@intecion/ipal-kit/a11y.css";` (only with `<AccessibilityWidget>`) | widget options change the page | accessibility.md |
|
||||
| `/its` panel | `app/(payload)/its/…` | `adminRoute: '/its'` + `its` in the proxy matcher | `/its` login, `/admin` 404 | security.md |
|
||||
| skills | `package.json` | `"ipal:skills": "ipal-skills"` | `.agents/skills/` up to date | PROGRAMISTA §2.1a |
|
||||
| eject a library block | CLI | `pnpm exec ipal-blocks list` / `pnpm exec ipal-blocks eject faq [--dest src/blocks] [--dry-run]` → `src/blocks/Faq/`; then the ejected builder in `blockOptions`' place and `components: { faq: FaqBlock }` | the block renders from the project file | block-library.md "Own blocks and eject" |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# ipal-kit — export index
|
||||
|
||||
Every public export of `@intecion/ipal-kit` (all entries: root, `/client`, `/rsc`,
|
||||
`/server`, `/seed`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`), grouped by module. Search with grep
|
||||
`/server`, `/seed`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`), grouped by module. Search with grep
|
||||
(`grep -n "name" .agents/skills/ipal-reference/resources/api.md`) before you write anything yourself.
|
||||
"Import from" column — the first entry is preferred. Plugin options, env, routes and what the
|
||||
project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/docs/<page>.md`.
|
||||
@@ -739,6 +739,30 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
|
||||
**Types:** `ThemeOptions` (root, `ipalKit({ theme })`), `Theme`, `ThemeSetting`, `ThemeConfig` (root, `/client`) — theme, setting from the panel and theme options; `ThemeScriptProps` (`/rsc`), `ThemeSwitcherProps`, `ThemeSwitcherClassNames` (`/client`) — component props.
|
||||
|
||||
## Design tokens (`tokens`) — details: `node_modules/@intecion/ipal-kit/docs/design-tokens.md`
|
||||
|
||||
CSS: `@intecion/ipal-kit/tokens.css` (neutral `--ipal-*` defaults, light/dark, `[data-surface="inverse"]`), `@intecion/ipal-kit/tailwind.css`
|
||||
(Tailwind 4 preset: `bg-surface`, `text-fg`, `py-section`…), `@intecion/ipal-kit/a11y.css` (widget CSS). Bin: `ipal-tokens`
|
||||
(`src/design/tokens.ts` → `src/design/tokens.css`, WCAG contrast; `--check`, `--report`, `--warn-only`, `--in`, `--out`).
|
||||
``@intecion/ipal-kit/tokens`` imports nothing from Payload/React — safe in `src/design/tokens.ts`, `next/og`, e-mail templates.
|
||||
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `defineTokens(input)` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | The brand in `src/design/tokens.ts`; checks every role/size name, returns the input. |
|
||||
| `tokensToCss(input, { source? })` | `@intecion/ipal-kit/tokens` | The brand CSS (`ipal-tokens` writes it): only what differs from the defaults. |
|
||||
| `defaultTokensCss()` | `@intecion/ipal-kit/tokens` | The content of `tokens.css`. |
|
||||
| `contrastReport(input?)` | `@intecion/ipal-kit/tokens` | WCAG rows (`ContrastRow`) for every text/surface pair in both themes and the inverse scope. |
|
||||
| `contrastRatio(fg, bg)`, `parseColor(css, lookup?)` | `@intecion/ipal-kit/tokens` | Colour maths for your own checks (hex, rgb, hsl, oklch, `color-mix(in oklch)`, `var()`). |
|
||||
| `resolveColors(input)` | `@intecion/ipal-kit/tokens` | Final colour values per theme — for `next/og`, e-mail, `theme-color`. |
|
||||
| `fluidClamp(min, max, range?)` | `@intecion/ipal-kit/tokens` | The fluid.css `clamp()` for your own sizes; `FLUID_SCALE` (the shipped pairs), `FLUID_RANGES` (`standard` 360→1280, `wide` 360→1920). |
|
||||
| `IPAL_TOKENS` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | Every token as `var(--ipal-…)`, keyed by name: `IPAL_TOKENS.primary`. |
|
||||
| `ipalVar(name, fallback?)` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | `var(--ipal-<name>[, fallback])`. |
|
||||
| `IPAL_BREAKPOINTS` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | `{ sm: 40, md: 48, lg: 64, xl: 80, '2xl': 96 }` (rem) — for `sizes=` / `matchMedia`. |
|
||||
| `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES` | `@intecion/ipal-kit/tokens` | The catalogue: colour defaults per theme, theme-independent defaults, fluid names, inverse re-map, the old `-dark` twins. |
|
||||
| `DARK_SELECTOR`, `INVERSE_SELECTOR` | `@intecion/ipal-kit/tokens` | `:root[data-theme="dark"]`, `[data-surface="inverse"]`. |
|
||||
|
||||
**Types:** `TokensInput`, `IpalTokenName` (root, `/tokens`), `ColorInput`, `ColorRole`, `ContrastRow`, `FluidRange`, `RemValue` (`/tokens`).
|
||||
|
||||
## Turnstile (`turnstile`) — details: `node_modules/@intecion/ipal-kit/docs/turnstile.md`
|
||||
|
||||
| Export | Import from | What it does / when |
|
||||
|
||||
@@ -266,30 +266,35 @@ from the title, noindex in the sidebar, an AI summary field; changing the slug a
|
||||
`buildOptimizeUploadHook({…})`; the bare function instead of the hook (`normalizeFilename`). `buildRevalidateHook`
|
||||
refreshes collections only (globals — stage 3; archive entries — your own hook, hooks.md).
|
||||
|
||||
## 5. Styles
|
||||
## 5. Styles — the design-token standard
|
||||
|
||||
**Code.** `postcss.config.mjs`: `export default { plugins: { '@tailwindcss/postcss': {} } }`.
|
||||
**Code.** `postcss.config.mjs`: `export default { plugins: { '@tailwindcss/postcss': {} } }`. Copy the two templates:
|
||||
`.agents/skills/ipal-setup/resources/DESIGN.md` → `DESIGN.md` (project root; fill it from the stage 0 answers) and
|
||||
`.agents/skills/ipal-setup/resources/tokens.ts` → `src/design/tokens.ts` (brand values from `DESIGN.md`: primary,
|
||||
secondary/accent, theme, radius, fonts). Then `pnpm exec ipal-tokens` → `src/design/tokens.css` (commit both).
|
||||
```css
|
||||
/* src/app/(frontend)/styles.css */
|
||||
/* src/app/(frontend)/styles.css — the same on every site, no brand values here */
|
||||
@import "tailwindcss";
|
||||
@import "@intecion/ipal-kit/fluid.css"; /* or fluid-wide.css (up to 1920 px) — one of the two */
|
||||
@import "@intecion/ipal-kit/fluid-wide.css"; /* default; fluid.css = stops at 1280 px */
|
||||
@import "@intecion/ipal-kit/tokens.css"; /* neutral defaults for every --ipal-* token */
|
||||
@import "@intecion/ipal-kit/tailwind.css"; /* utilities (bg-surface, text-fg, py-section…), dark: on data-theme */
|
||||
@import "../../design/tokens.css"; /* the brand, generated by ipal-tokens — always last */
|
||||
@source "../../../node_modules/@intecion/ipal-kit/dist/**/*.js"; /* without this the banner/Turnstile have no styles */
|
||||
@theme inline {
|
||||
--text-display: var(--ipal-fs-display); --text-h1: var(--ipal-fs-h1); --text-h2: var(--ipal-fs-h2);
|
||||
--text-h3: var(--ipal-fs-h3); --text-lead: var(--ipal-fs-lg);
|
||||
--spacing-section: var(--ipal-space-section); --spacing-gutter: var(--ipal-space-gutter); --spacing-gap: var(--ipal-space-gap);
|
||||
}
|
||||
@theme { /* colors, fonts, radii from DESIGN.md (none → ask about Impeccable or use neutral tokens) */ }
|
||||
:root { --ipal-primary: var(--color-primary); --ipal-radius: 0.5rem; /* numbers from DESIGN.md: --ipal-fs-h1: clamp(…) */ }
|
||||
```
|
||||
Fonts via `next/font` with `subsets: ['latin', 'latin-ext']`, a CSS variable wired in `@theme` and on `<html>`
|
||||
(AGENT.md §6.11, example in section-code.md → "Styles"). Hero on `--ipal-hero-min-h` (§6.11a).
|
||||
Fonts via `next/font` with `subsets: ['latin', 'latin-ext']` and `variable: '--font-family-body'` /
|
||||
`'--font-family-heading'`, both classes on `<html>` (design-tokens.md → Wiring). Hero on `--ipal-hero-min-h` (§6.11a).
|
||||
Optional (only when the site shows the a11y widget): `@import "@intecion/ipal-kit/a11y.css";`.
|
||||
|
||||
**Check.** After stage 6: on `/pl` the `text-h1`/`py-section` classes work, the cookie banner is styled (color
|
||||
`--ipal-primary`), Polish characters render in the font; screens 360, 768, 1366×768, 1920 without horizontal scroll.
|
||||
**Check.** `pnpm exec ipal-tokens` exits 0 (no ✗ contrast rows) and `pnpm exec ipal-tokens --check` says up to date;
|
||||
paste `pnpm exec ipal-tokens --report` into `DESIGN.md` → Colour. After stage 6: on `/pl` the `text-h1`/`py-section`/
|
||||
`bg-surface` classes work, `getComputedStyle(document.documentElement).getPropertyValue('--ipal-primary')` is the brand
|
||||
colour, switching the theme changes `--ipal-bg`, the cookie banner uses the brand colour in both themes, Polish characters
|
||||
render in the font; screens 360, 768, 1366×768, 1920 without horizontal scroll.
|
||||
|
||||
**Turn off / override.** `fluid*.css` is optional (your own scale = overridden variables in `:root`; never write the formulas from
|
||||
scratch); plugin components: `--ipal-*` tokens (each with a `-dark` variant) and `classNames` (consent.md).
|
||||
**Turn off / override.** Every file is optional: no `tokens.ts` = the neutral defaults; plain CSS without Tailwind =
|
||||
`tokens.css` alone and `var(--ipal-…)`; `fluid*.css` optional. Any value: `tokens.ts` (`raw: { … }` for tokens without a
|
||||
field) or CSS after the imports; project-only decorative colours below the imports + `DESIGN.md` → Deviations. Plugin
|
||||
components also take `classNames` (consent.md). Full list of tokens and utilities: design-tokens.md.
|
||||
|
||||
## 6. Routing — proxy, data layer, layout, catch-all, 404
|
||||
|
||||
|
||||
@@ -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' },
|
||||
})
|
||||
@@ -116,9 +116,11 @@ title/description of every page (≤ 60 / ≤ 155 characters, unique); `aiSummar
|
||||
keep the auto-fill or fix it when the summary is weak.
|
||||
|
||||
## Phase 8 — Design
|
||||
`DESIGN.md` exists → tokens in `@theme`. None → neutral tokens + an Impeccable
|
||||
recommendation in the report. Do not polish styles ad hoc in components. Library blocks follow the tokens by
|
||||
themselves (token utilities only); a part that needs another look → `createBlockRegistry({ classNames })`.
|
||||
The design-token standard (AGENT.md §6.11, `design-tokens.md`): `DESIGN.md` exists → its values go into
|
||||
`src/design/tokens.ts` (template `.agents/skills/ipal-setup/resources/tokens.ts`) → `pnpm exec ipal-tokens` (no ✗
|
||||
contrast rows). None → copy the `DESIGN.md` template, keep the neutral defaults + the brand primary, and recommend
|
||||
Impeccable in the report. Components use only the preset's utilities. Do not polish styles ad hoc in components. Library blocks follow the
|
||||
tokens by themselves (token utilities only); a part that needs another look → `createBlockRegistry({ classNames })`.
|
||||
Responsiveness: 360 px, 768 px, 1280 px — no horizontal scroll.
|
||||
|
||||
## Phase 9 — Verification (all by yourself, results go into the report)
|
||||
|
||||
@@ -186,6 +186,13 @@ at start. A project with its own separator options (`globalOverrides`): use valu
|
||||
Check: `curl -s -X POST $URL/api/graphql -H 'content-type: application/json' -d '{"query":"{ SiteSetting { titleSeparator } }"}'` → 200,
|
||||
and the browser tab shows the same separator.
|
||||
Project code that reads `settings.titleSeparator` itself now gets a name: use `titleSeparatorChar()`.
|
||||
**→ 1.15.0 design tokens (opt-in, design-tokens.md → "Migrating an existing site"):** nothing breaks without it. To adopt:
|
||||
add the four `@import`s (§6.11) and `src/design/tokens.ts` (template `.agents/skills/ipal-setup/resources/tokens.ts`),
|
||||
map the current `@theme` colours/fonts/radius onto the roles, keep the old names as aliases in a marked legacy
|
||||
block, delete the `--ipal-*-dark` block kept only for the cookie banner, `pnpm exec ipal-tokens`, then replace old
|
||||
utilities and `dark:` colour classes file by file (`ipal-audit` lists them) and remove the legacy block. next/font
|
||||
variables become `--font-family-body` / `--font-family-heading`. Check: `ipal-tokens --check`, the site in both themes.
|
||||
Only with the owner's decision ("Project decisions": which sites migrate when).
|
||||
7. `pnpm ipal:skills` (new agent rules: architecture questions first, ipal-kit first). Optional with the owner's
|
||||
consent: `pnpm exec ipal-skills --external`.
|
||||
|
||||
|
||||
+7
-4
@@ -159,9 +159,10 @@ load; for running tags rely on Consent Mode.
|
||||
## Look — overriding styles
|
||||
|
||||
The banner and the button have a default, neutral look (light + dark) and work
|
||||
without any configuration. Colours and radii go through CSS custom properties with
|
||||
fallbacks — to restyle for a client, declare the variables in your CSS.
|
||||
No imports, no props, no fighting specificity:
|
||||
without any configuration. Colours and radii are the site's design tokens
|
||||
([design-tokens.md](./design-tokens.md)): with `@intecion/ipal-kit/tokens.css` and the brand's
|
||||
`src/design/tokens.ts` the banner follows the brand in both themes on its own. Without them, declare the
|
||||
variables in your CSS. No imports, no props, no fighting specificity:
|
||||
|
||||
```css
|
||||
/* global.css — everything optional, override only what you want */
|
||||
@@ -172,7 +173,9 @@ No imports, no props, no fighting specificity:
|
||||
}
|
||||
```
|
||||
|
||||
Available tokens (each has a `-dark` counterpart used under `dark:`):
|
||||
Tokens the banner reads (1.15.0: the single names, which switch with the theme in `tokens.css`; without
|
||||
`tokens.css` the fallback below follows the page's `color-scheme` via `light-dark()`, and a `-dark` variable a
|
||||
site still sets — e.g. `--ipal-surface-dark` — is used as the dark fallback):
|
||||
|
||||
| Token | Default | What it colours |
|
||||
|---|---|---|
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
# Design tokens — one standard, every brand (1.15.0)
|
||||
|
||||
Every site built on ipal-kit uses the same token **names** (`--ipal-*`), the same scale, the same dark-mode
|
||||
mechanism and the same Tailwind utilities. Only the **values** differ per brand. Components (the shared blocks,
|
||||
the plugin's own UI, the project's sections) read only tokens, so a new brand is a new `DESIGN.md` plus one
|
||||
tokens file. Nobody edits a component.
|
||||
|
||||
Everything here is opt-in. A site that imports none of it looks exactly as before. Every value can be overridden.
|
||||
|
||||
## What the plugin ships
|
||||
|
||||
| Export | What it is |
|
||||
|---|---|
|
||||
| `@intecion/ipal-kit/tokens.css` | neutral defaults for every token: light on `:root`, dark on `:root[data-theme="dark"]`, the inverse scope, reduced motion |
|
||||
| `@intecion/ipal-kit/tailwind.css` | Tailwind 4 preset: `@theme inline` map (utilities below), `dark:` on `data-theme`, `duration-*` / `z-*` utilities, a small base layer, the theme-switch transition |
|
||||
| `@intecion/ipal-kit/fluid-wide.css` / `fluid.css` | the type and space scale (`--ipal-fs-*`, `--ipal-space-*`, containers, height helpers): grows to 1920 px / 1280 px |
|
||||
| `@intecion/ipal-kit/a11y.css` | optional CSS for the accessibility widget's attributes, working through the tokens (accessibility.md) |
|
||||
| `@intecion/ipal-kit/tokens` | TS entry with no Payload/React import: `defineTokens`, `IPAL_TOKENS`, `ipalVar`, `IPAL_BREAKPOINTS`, `tokensToCss`, `contrastReport`, `fluidClamp` … |
|
||||
| `ipal-tokens` (bin) | `src/design/tokens.ts` → `src/design/tokens.css` + WCAG contrast check |
|
||||
|
||||
`defineTokens`, `IPAL_TOKENS`, `ipalVar`, `IPAL_BREAKPOINTS` and the types `IpalTokenName`, `TokensInput` are also
|
||||
exported from the root entry (`@intecion/ipal-kit`).
|
||||
|
||||
## Wiring (a new site)
|
||||
|
||||
```css
|
||||
/* src/app/(frontend)/styles.css — the same on every site */
|
||||
@import "tailwindcss";
|
||||
@import "@intecion/ipal-kit/fluid-wide.css"; /* default for new sites; or fluid.css */
|
||||
@import "@intecion/ipal-kit/tokens.css"; /* neutral defaults */
|
||||
@import "@intecion/ipal-kit/tailwind.css"; /* utilities, dark variant, base layer */
|
||||
@import "../../design/tokens.css"; /* the brand — generated, always last */
|
||||
@source "../../../node_modules/@intecion/ipal-kit/dist/**/*.js";
|
||||
```
|
||||
|
||||
```ts
|
||||
// src/design/tokens.ts — the ONLY file you edit to rebrand (template: ipal-setup/resources/tokens.ts)
|
||||
import { defineTokens } from '@intecion/ipal-kit/tokens'
|
||||
|
||||
export const tokens = defineTokens({
|
||||
theme: 'both', // 'light' | 'dark' | 'both' — match Site settings → Theme
|
||||
fluid: 'wide', // the fluid file styles.css imports
|
||||
color: {
|
||||
light: { primary: 'oklch(0.5 0.17 250)', accent: 'oklch(0.78 0.15 85)' },
|
||||
dark: { bg: 'oklch(0.16 0.01 250)' }, // brand roles left out carry over from light
|
||||
},
|
||||
font: { fwHeading: 700 },
|
||||
radius: { control: '999px', card: '1.25rem' },
|
||||
fs: { h1: ['2.25rem', '4rem'] }, // min → max; the clamp() is computed for the fluid range
|
||||
})
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm exec ipal-tokens
|
||||
```
|
||||
|
||||
```tsx
|
||||
// src/app/(frontend)/[locale]/layout.tsx — fonts in the two fixed slots
|
||||
const body = Inter({ subsets: ['latin', 'latin-ext'], variable: '--font-family-body', display: 'swap' })
|
||||
const heading = Fraunces({ subsets: ['latin', 'latin-ext'], variable: '--font-family-heading', display: 'swap' })
|
||||
<html lang={locale} className={`${body.variable} ${heading.variable}`} suppressHydrationWarning>
|
||||
```
|
||||
|
||||
The slots are `--font-family-body` / `--font-family-heading` (and `--font-family-mono`), never `--font-body`.
|
||||
`--font-body` is the Tailwind key behind `font-body`, and that key maps back to the token, so the two would form a `var()` cycle.
|
||||
Dark mode: `<SiteProviders theme>` (theme.md). Nothing else is needed: the roles switch on `data-theme`.
|
||||
|
||||
**Check.**
|
||||
- `pnpm exec ipal-tokens --check` → `✓ … up to date`. `pnpm exec ipal-tokens` exits 0, with no ✗ rows.
|
||||
- In the browser, `getComputedStyle(document.documentElement).getPropertyValue('--ipal-primary')` returns the brand value.
|
||||
- Switch the theme: `--ipal-bg` changes.
|
||||
- The cookie banner uses the brand colour in both themes.
|
||||
|
||||
## The tokens
|
||||
|
||||
### Colour roles (switch with the theme)
|
||||
|
||||
| Token `--ipal-…` | Role | Utility |
|
||||
|---|---|---|
|
||||
| `bg` | page background (`settings.background = default`) | `bg-bg` |
|
||||
| `surface` | card, panel, banner | `bg-surface` |
|
||||
| `surface-muted` | alternate section (`muted`) | `bg-surface-muted` |
|
||||
| `surface-raised` | header, popover, dropdown | `bg-surface-raised` |
|
||||
| `surface-inverse` / `text-inverse` | inverted section (`inverted`) | `bg-inverse` / `text-on-inverse` |
|
||||
| `text` · `text-strong` · `text-muted` | body · headings · captions | `text-fg` · `text-fg-strong` · `text-fg-muted` |
|
||||
| `border` · `border-strong` | dividers, inputs, cards | `border-border` · `border-border-strong` |
|
||||
| `primary` · `primary-hover` · `primary-text` | main buttons, key accents | `bg-primary` · `hover:bg-primary-hover` · `text-on-primary` |
|
||||
| `secondary` · `secondary-hover` · `secondary-text` | second button (default: neutral strong) | `bg-secondary` · `text-on-secondary` |
|
||||
| `accent` · `accent-text` | highlight, badge, rating stars (default: primary) | `bg-accent` · `text-accent` · `text-on-accent` |
|
||||
| `link` · `link-hover` | links in running text | `text-link` · `hover:text-link-hover` |
|
||||
| `link-inverse` · `focus-inverse` | link and focus ring inside an inverted section | (read through the inverse scope) |
|
||||
| `hover` | neutral hover (ghost button, row) | `bg-hover` |
|
||||
| `focus` | focus ring | `outline-focus` · `ring-focus` |
|
||||
| `overlay` | scrim, hero image overlay | `bg-overlay` · `from-overlay` |
|
||||
| `success` · `warning` · `danger` · `info` (+ `-surface`) | form and status states | `text-danger` · `bg-danger-surface` … |
|
||||
|
||||
Unset hovers, links and focus derive from `primary` with `color-mix(in oklch, …)`. Write values in oklch (the
|
||||
standard). Any CSS colour works.
|
||||
|
||||
### Type, space, shape, motion
|
||||
|
||||
| Group | Tokens | Utilities |
|
||||
|---|---|---|
|
||||
| Fonts | `font-body`, `font-heading`, `font-mono`; `fw-body`, `fw-heading`, `lh-body`, `lh-heading`, `tracking-heading` | `font-body` (= `font-sans`), `font-heading`, `font-mono`, `leading-body`, `leading-heading`, `tracking-heading` |
|
||||
| Sizes (fluid) | `fs-xs`, `fs-sm`, `fs-base`, `fs-lg`, `fs-h4`, `fs-h3`, `fs-h2`, `fs-h1`, `fs-display` | `text-xs` … `text-display`, `text-lead` (= `fs-lg`) |
|
||||
| Space (fluid) | `space-stack`, `space-gap`, `space-gutter`, `space-section-sm`, `space-section` | `space-y-stack`/`mt-stack`, `gap-gap`, `px-gutter`, `py-section-sm`, `py-section` |
|
||||
| Radius | `radius` (controls), `radius-sm`, `radius-card`, `radius-media`, `radius-full` | `rounded-control`, `rounded-sm`, `rounded-card`, `rounded-media`, `rounded-full` |
|
||||
| Shadow | `shadow-sm`, `shadow-md`, `shadow-lg` (dark theme: deeper + hairline ring) | `shadow-sm/md/lg` |
|
||||
| Layout | `container` (80rem), `container-wide` (96rem), `container-narrow` (48rem), `measure` (68ch), `hero-min-h`, `*-fit` | `max-w-container`, `max-w-container-wide`, `max-w-narrow`, `max-w-measure` |
|
||||
| Motion | `duration-fast` 150ms, `duration` 250ms, `duration-slow` 400ms, `ease-out`, `ease-in-out` (all durations 0 with reduced motion or `data-a11y-motion="reduce"`) | `duration-fast`, `duration-base`, `duration-slow`, `ease-out`, `ease-in-out` |
|
||||
| Layers, focus | `z-header` 40, `z-overlay` 50, `z-toast` 60; `focus-width`, `focus-offset` | `z-header`, `z-overlay`, `z-toast` |
|
||||
| Breakpoints | fixed: `sm 40 · md 48 · lg 64 · xl 80 · 2xl 96` rem (Tailwind defaults); `IPAL_BREAKPOINTS` for `sizes=` / `matchMedia` | `sm:` … `2xl:` |
|
||||
|
||||
A project may *add* a breakpoint (`--breakpoint-xs`) as a deviation recorded in `DESIGN.md`. It never moves an existing one.
|
||||
|
||||
### Inverted sections
|
||||
|
||||
`<Section>` with `settings.background = inverted` renders `bg-inverse` and `data-surface="inverse"`. Inside that
|
||||
scope, `text`, `text-strong`, `text-muted`, `border(-strong)`, `surface`, `hover`, `link` and `focus` are re-mapped
|
||||
for the inverse surface, and `color-scheme` flips. Cards, rich text, links and focus rings need no inverse variants:
|
||||
they keep `text-fg`, `text-link`, `border-border`. `primary` / `accent` are not re-mapped. The contrast report warns
|
||||
when `primary` on `surface-inverse` is below 3:1.
|
||||
|
||||
### Legacy `-dark` names
|
||||
|
||||
`--ipal-surface-dark`, `--ipal-text-dark` … (the cookie banner's old twins) stay as aliases: in the dark theme
|
||||
`tokens.css` sets each to its role. The banner and button now read the single names. Without `tokens.css`, their
|
||||
fallback follows the page's `color-scheme` (`light-dark()`) and still honours a `-dark` variable a site sets.
|
||||
New code never reads `-dark`.
|
||||
|
||||
## `ipal-tokens`
|
||||
|
||||
| Command | Does |
|
||||
|---|---|
|
||||
| `pnpm exec ipal-tokens` | writes `src/design/tokens.css` (only what differs from the defaults), prints the failing contrast pairs, exits 1 on a WCAG AA failure |
|
||||
| `--check` | writes nothing; exits 1 when the CSS is out of date (CI, `ipal-doctor`) |
|
||||
| `--report` | prints every checked pair: paste into `DESIGN.md` → Colour |
|
||||
| `--warn-only` | contrast failures do not fail the command |
|
||||
| `--in <file> --out <file>` | other paths; `--in` also takes `.mjs` / `.js` / `.json` |
|
||||
|
||||
The input must export `tokens` (or a default export). `.ts` needs Node 22.18+ (type stripping). The contrast check
|
||||
covers text on every surface (4.5:1) in both themes, text on primary/secondary/accent, the inverse scope, the states,
|
||||
and focus rings (3:1).
|
||||
|
||||
## Building blocks (`@intecion/ipal-kit/tokens`)
|
||||
|
||||
| Export | Use |
|
||||
|---|---|
|
||||
| `defineTokens(input)` | checks every role and size name, returns the input (type `TokensInput`, colours `ColorInput`) |
|
||||
| `tokensToCss(input, { source })` | the brand CSS the CLI writes |
|
||||
| `defaultTokensCss()` | the content of `tokens.css` |
|
||||
| `contrastReport(input)` → `ContrastRow[]` | the WCAG check; `contrastRatio(fg, bg)`, `parseColor(css, lookup)` for your own pairs |
|
||||
| `resolveColors(input)` | each theme's final colour values (defaults + brand) |
|
||||
| `fluidClamp(min, max, range)` | the fluid.css `clamp()` for your own sizes; `FLUID_SCALE`, `FLUID_RANGES`, type `FluidRange`, `RemValue` |
|
||||
| `IPAL_TOKENS`, `ipalVar(name, fallback?)` | `var(--ipal-…)` strings for inline styles, charts, a styleguide page (type `IpalTokenName`) |
|
||||
| `IPAL_BREAKPOINTS` | breakpoints in rem |
|
||||
| `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, type `ColorRole` | the catalogue itself |
|
||||
|
||||
Values that CSS variables can't reach (`next/og` images, e-mail templates, `<meta name="theme-color">`): import `tokens`
|
||||
from `@/design/tokens` and read `resolveColors(tokens).light.primary`.
|
||||
|
||||
## DESIGN.md
|
||||
|
||||
The template (`ipal-setup/resources/DESIGN.md`) has nine fixed sections: brand, colour (with the contrast report),
|
||||
type, shape, layout, motion, imagery, theme, deviations. `DESIGN.md` is the human source and `tokens.ts` its machine form.
|
||||
They must agree. The vendored `ext-frontend-design` skill may propose a direction, but its palette is mapped onto
|
||||
these roles in `DESIGN.md` / `tokens.ts` after the owner approves. It never adds token names, colours or fonts in components.
|
||||
|
||||
## Turn off, override, extend
|
||||
|
||||
- **Turn off:** don't import a file. `tokens.css` without `tailwind.css` works for plain CSS (`var(--ipal-…)`). No
|
||||
`tokens.ts` means the neutral defaults. A plain-CSS site (no Tailwind) imports `tokens.css` alone.
|
||||
- **Override:** every value in `tokens.ts` (`raw: { 'hero-min-h': '…' }` for anything without a field), or plain CSS
|
||||
after the imports. The cookie banner and button also keep `classNames` / `className`.
|
||||
- **Extend:** project-only tokens (decorative brand colours) go in `styles.css` below the imports and in
|
||||
`DESIGN.md` → Deviations. A missing *role* every site would need → plugin gap (`ipal-plugin-gap`).
|
||||
|
||||
## Migrating an existing site
|
||||
|
||||
1. `ipal-upgrade` to 1.15.0, add the imports above and `src/design/tokens.ts`.
|
||||
2. Map the site's current `@theme` colours to the roles, its fonts to the slots, and its radius, container and fluid
|
||||
pairs into `tokens.ts`. Keep the old names as aliases (`--color-brand: var(--ipal-primary)`) in a
|
||||
`/* legacy, remove after migration */` block, so no component breaks on day one.
|
||||
3. Delete the `--ipal-*-dark` block the site kept only to stop the cookie banner going dark.
|
||||
4. Replace old utilities and hard-coded values file by file (`ipal-audit` lists them). Remove `dark:` colour classes.
|
||||
5. Remove the legacy block. Write `DESIGN.md` from the template.
|
||||
@@ -223,6 +223,11 @@ import one of the two. Both also have height and width variables: `--ipal-hero-m
|
||||
Without `@source` the plugin's components (cookie banner, Turnstile) have no styles.
|
||||
Colors of the plugin's components: `--ipal-primary`, `--ipal-radius` (consent.md).
|
||||
|
||||
**Design-token standard (1.15.0, [design-tokens.md](../design-tokens.md)) — new sites:** `styles.css` imports
|
||||
`fluid-wide.css`, `tokens.css`, `tailwind.css` and `../../design/tokens.css` (instead of the `@theme inline` above);
|
||||
the brand is `src/design/tokens.ts` → `pnpm exec ipal-tokens`; next/font variables `--font-family-body` /
|
||||
`--font-family-heading`. Components use the preset's utilities (`bg-surface`, `text-fg`, `py-section`).
|
||||
|
||||
### 2.6 Proxy (NOT middleware.ts)
|
||||
```ts
|
||||
// src/proxy.ts
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
# 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`).
|
||||
+2
-1
@@ -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); }
|
||||
|
||||
+5
-1
@@ -81,6 +81,10 @@ type `ThemeOptions` (`ipalKit({ theme })`).
|
||||
|
||||
## CSS (Tailwind 4)
|
||||
|
||||
With the design-token standard ([design-tokens.md](./design-tokens.md)) this is already in
|
||||
`@intecion/ipal-kit/tailwind.css`, and the colour roles switch on `data-theme` by themselves (no `dark:` for colours).
|
||||
Without the preset, add it yourself:
|
||||
|
||||
```css
|
||||
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
|
||||
|
||||
@@ -90,7 +94,7 @@ type `ThemeOptions` (`ipalKit({ theme })`).
|
||||
}
|
||||
```
|
||||
|
||||
Dark theme tokens (`surface`, `fg`…) stay in the project's `styles.css`.
|
||||
Dark theme values: `src/design/tokens.ts` → `color.dark` (design-tokens.md); without the standard, in the project's `styles.css`.
|
||||
|
||||
## Turnstile
|
||||
|
||||
|
||||
Reference in New Issue
Block a user