@dset/tokens
v1.0.0
Published
DSET design tokens — primitive → semantic → theme tiers, shipped as CSS custom properties and typed JS exports
Downloads
78
Readme
@dset/tokens
Design tokens for the DSET Frontend Platform — Layer 1. Every other layer builds on this package; it depends on nothing.
Architecture
Three tiers, one JSON source of truth (src/), built to CSS + typed JS:
primitives src/primitives/*.json raw values --dset-color-slate-500: #64748b
↓
semantic src/semantic/light.json intent slots --dset-color-primary: var(--dset-color-indigo-500)
↓
themes src/themes/*.json brand overrides [data-theme='i3ms'] { --dset-color-primary: var(--dset-color-brand-500) }Rules:
- Components consume semantic tokens only (
--dset-color-primary, never--dset-color-indigo-500). - Themes may only override slots that exist in the semantic tier — the build fails otherwise.
- A component tier (
--dset-kpi-*) is supported by the architecture and will be added in Phase 2 the moment a component genuinely needs an override hook — not before. - The
i3mstheme is pixel-parity with today's i3MS UI (harvested 2026-06-13);dsetis the neutral default for future products.
Usage
// 1. Load the stylesheet once (app entry or .storybook/preview):
import '@dset/tokens/css';
// 2. Pick a theme on <html>:
// <html data-theme="i3ms">
// 3. In CSS Modules:
// .card { background: var(--dset-color-surface-raised); border-radius: var(--dset-radius-lg); }
// 4. In JS (e.g. chart.js needs concrete values):
import { cssVar, readToken } from '@dset/tokens';
cssVar('color.chart-1'); // "var(--dset-color-chart-1)"
readToken('--dset-color-chart-1'); // "#0ea5e9" — resolved against the active themeCommands
pnpm --filter @dset/tokens build # JSON → dist/tokens.css + index.js + index.d.ts
pnpm --filter @dset/tokens test # contract tests (refs resolve, themes legal, output shape)