@reforma/tokens
v0.1.0
Published
Design tokens for Reforma design system
Readme
@reforma/tokens
Design tokens for Reforma project. Designed for Tailwind projects and provided as CSS custom properties (CSS variables) and utility classes for applying styles.
Package Structure
src/
├── variables/ # Primitive, motion, and semantic variables (from Figma — do not edit)
├── styles/ # Typography / shadows / colors utilities (from Figma — do not edit)
├── local/ # Explicit hand-authored exceptions only
│ ├── zIndex.css # Stacking scale
│ └── breakpoints.css # Media queries
├── rulesets.css # Hand-authored ruleset entry point
└── index.css # Hand-authored main entry pointEditing Rules
⚠️ Important: Figma is the source of truth for design tokens. The variables/ and styles/ folders must not be edited manually. Any changes to these folders must be made only through synchronization from Figma.
The only hand-authored token-value exceptions are local/zIndex.css and local/breakpoints.css. index.css and rulesets.css are hand-authored entry points, not places for token values.
Do not add patch, override, fallback, or temporary token files to this package. If a shared design token is missing, coordinate with the designer, add it to Figma, and synchronize the package. Component-, model-, or feature-specific semantic variables belong in the owning CSS module next to their consumers, where they should map to Figma-backed tokens. This follows the same ownership model as component semantic variables in @reforma/components.
Synchronize a Figma Snapshot
The package owns the deterministic renderer. It always applies the fixed CSS (Ruleset) configuration: split CSS files, rem with a base of 16, typography in @layer rulesets, .dark for the dark theme, and no generated index files. There is no mode or output-preset selection.
./reforma sync tokens --input /absolute/path/to/figma-token-snapshot.json
./reforma sync tokens --input /absolute/path/to/figma-token-snapshot.json --check --json
./reforma sync tokens --input /absolute/path/to/figma-token-snapshot.json --jsonThe version 1 agent/MCP input contract is documented by scripts/token-snapshot.schema.json. Every snapshot contains the configured Figma file name and stable file key. The current package configuration and source identity live in src/tokens-metadata.json.
Before writing, the command validates the exact MCP file/collection identity, configured modes, all aliases, supported values, rendered paths, and package entry points. Existing group order stays stable; newly discovered groups are appended to tokens-metadata.json in their Figma order. --check reports that metadata change plus added and removed CSS names without writing. A real sync atomically replaces changed managed files and writes src/figma-tokens-manifest.json last. Equivalent snapshots produce no CSS diff even when capture metadata changes.
Figma TIMING values, including transition durations and delays, render as seconds. Linear and cubic EASING values render as CSS timing functions; normalized spring bounce values are sampled through the pinned motion-dom spring implementation into deterministic CSS linear(...). Repository-owned variable-name and typography-weight exceptions live under overrides in tokens-metadata.json. Typography otherwise derives weight from fontName.style, so live capture never scans pages or text-node consumers.
Figma capture is orchestrated by the repository sync-design-system agent skill. The deterministic package command requires --input; it never asks the user to choose modes.
Important
- Manual changes in
variables/andstyles/will be overwritten by the next synchronization scripts/fixtures/current-tokens.snapshot.jsonis the captured Figma MCP regression snapshot; refresh it together with managed output so the byte-for-byte test detects drift- After synchronization, always review the generated diff and run the package tests and linter
