Skip to content
bitzorcas
中EN

Reference

Token Architecture and Ownership

Design System 1.2 Reference, System, Component, and shadcn Compatibility layers, naming rules, and engineering ownership.

Last updated

Token Architecture and Ownership

Single authored source

The directory structure is fixed:

frontend/packages/materials/src/tokens/
|-- source/
| |-- reference.tokens.json
| |-- system.tokens.json
| |-- component.tokens.json
| `-- themes/
| |-- enterprise-neutral.tokens.json
| |-- legal-navy.tokens.json
| |-- legal-amber.tokens.json
| |-- legal-burgundy.tokens.json
| |-- legal-jade.tokens.json
| `-- legal-orange.tokens.json
`-- generated/
|-- tokens.css
|-- tokens.ts
`-- tokens.schema.json
  • source/ is the only authored source.
  • Colors are authored in sRGB Hex; one generator deterministically emits OKLCH, CSS, TypeScript, and schema output.
  • generated/ is never edited by hand. The generator has a --check drift detection mode that fails closed in CI.
  • packages/components consumes tokens, packages/widgets composes patterns, and apps/* supplies product content.
  • All source files declare version: "1.2.0"; the generator asserts this value is consistent.

Four dependency layers

--ref-* -> --sys-* -> --cmp-* -> shadcn compatibility aliases
LayerResponsibilityConsumerExample
ReferenceRaw ramps, type, spacing, radius, durationSystem only--ref-space-4
SystemSurface, text, action, link, focus, status, navigationLayout and components--sys-color-text-default
ComponentOne component variant and stateComponent internals--cmp-button-primary-bg-hover
Compatibilityshadcn and Tailwind aliasesExisting components--primary

Component names follow:

--cmp-{component}-{variant}-{property}-{state}

Compatibility mapping

Compatibility aliases point upstream:

/* Keep shadcn aliases as a leaf compatibility layer. */
--background: var(--sys-color-canvas);
--foreground: var(--sys-color-text-default);
--border: var(--sys-color-border-subtle);
--input: var(--sys-color-border-control);
--primary: var(--sys-color-action-primary-bg);
--primary-foreground: var(--sys-color-action-primary-fg);
--ring: var(--sys-color-focus-ring);

Never derive Link, Focus, Selection, or Navigation back from --primary.

Page redlines

  • No raw Hex, RGB, HSL, OKLCH, or brand gradients.
  • No direct --ref-* consumption.
  • No global CSS custom properties owned by a page.
  • No manual edits to generated tokens.
  • No !important used to conceal ownership or cascade defects.
  • No global token created for a single page.

Use Patch for optical corrections, Minor for compatible additions, and Major for deleted names, changed stable IDs, or changed interaction semantics.

Version semantics

VersionAppropriate change
PatchOptical correction that preserves meaning and layout
MinorBackward-compatible Token, Pattern slot, or Recipe addition
MajorRemoved or renamed Token, changed stable ID, Shell region, or interaction semantics

A breaking change requires an impact matrix, migration path, accessibility result, and visual regression evidence. The Design Guardian decision must be recorded before the generated contract is released.

100%

Scroll or use controls to zoom · drag when enlarged · double-click for 100% / 200%