frontend/src/kit/tokens/README.mdView source ↗
English source · 2 min
kit/tokens
Design tokens for every Veyndo surface: colours (light and dark), spacing, radii,
type, shadows and motion, plus brand themes that replace the light tokens for one
shop. tokens.json is the only source of token values; scripts/tokens.mjs
generates tokens.css and npm run architecture fails when the two differ.
Modules
tokens.json: The token values. Light colours equal the former Studio palette.motion-intensityholds the off, subtle and expressive values of the motion tokens.tokens.css: Generated custom properties (--vy-*) on:root,[data-theme="dark"]and[data-theme="system"]under a dark colour scheme;[data-motion="off|subtle|expressive"]selects a motion intensity; reduced motion sets every duration, distance and press scale to rest, whatever the intensity.motion.css: Motion primitives on the tokens:.vy-enter(entrance, only inside[data-motion]),[data-vy-reveal](scroll reveal),.vy-lift(hover) and.vy-press(press).motion.ts: Motion at run time:observeRevealmarks reveal elements pending only when motion is allowed,playPageEnteranimates the main region after a route change,motionIntensityreads stored values defensively.brand-theme.ts: Brand themes: WCAG contrast and OKLCH colour maths, deterministic palette extraction from pixels, the logo-shape radius suggestion, vetted font stacks and pairings, the radius/density scales,deriveBrandTheme, the typed document schema,parseBrandThemefor untrusted input,brandVariablesandsafeThemeVariables.index.ts: Typed access to the tokens and their custom property names; re-exports the brand and motion modules.
Rules
- Components in
kit/uiandkit/storefrontuse onlyvar(--vy-*)for colours; the architecture check refuses colour literals there. - Change a value in
tokens.json, runnode scripts/tokens.mjs, commit both files. - A brand theme's contrast pairs (
contrastPairs) and pairings (fontPairings) are mirrored by the Rust validator inextensions/apps/site-builder/brand_theme.rs; change both together. - Font stacks name installed families only; no web font is downloaded.
Verification
Run npm run architecture and npm test from frontend/ (brand-theme, motion, brand-surfaces, site-brand).