página del paquete→ /norms/rules/design-tokens/DTK-R04.md
pages/norms/rules/design-tokens/DTK-R04.md
34 líneas, 2.2 KB. Como página.
Este texto aún no está traducido. Debajo está el original en inglés.
- ---
- type: Rule
- ruleId: DTK-R04
- title: 'A style reports its health against the token contract'
- requirement: 'The health of a style is reported in bands (full, missing, fallbacks, extra); a style that is not full is told, never stopped.'
- level: SHOULD
- floor: false
- status: active
- sphere: design
- appliesTo: [/design]
- enforcers: [.shtukbase/packages/design-tokens/checks/health.ts]
- enforcerKind: gate
- mode: warn
- because: 'A style is a swappable part only while it fits the contract, but a work in progress, a plain shadcn theme or an old style must still install and run. So the style convention only informs: it names what is missing, which defaults apply and which names are outside the contract.'
- baseline: 0
- reviewBy: 2027-05-29
- pack: design-tokens
- rail: 'Read the lines "health style/<id>": add the missing names to the style tokens (and to the dark tokens for a colour), build the style again; fallbacks and extras are information.'
- ---
- The convention [A design style](/design/conventions/style.md) has its health in this norm. The check `health` judges the style chosen on [Design](/design/design.md) and prints one line per band:
- ```
- health style/<id>: full
- health style/<id>: missing: <names>
- health style/<id>: fallbacks: <names>
- health style/<id>: extra: <names>
- ```
- **Run.** `shtuk run design-tokens health` (the chosen style); `--style <id>` another style, `--all` every `/design/<id>/tokens.css`, `--css <file>` any CSS file by hand. The exit code is always 0: the check informs and never fails, so `shtuk check` shows the lines under a `PASS`.
- **What the bands mean.** `full`: every required name is set in `:root`, every colour has a dark value. `missing`: a required name, a dark value (`--x (dark)`) or a reference that leads nowhere (`--x (broken in light)`); the style works only partly. `fallbacks`: optional names the style leaves out; the defaults of the contract apply. `extra`: names the style sets that the contract does not know (a hint that the contract may grow; the Tailwind mirror names `--color-*` are not counted).
- **The hard check.** [DTK-R03](/norms/rules/design-tokens/DTK-R03.md) is the same judgement as a gate for a project that wants one. This norm is the report that never blocks.