ShtukbaseStandard
包页面→ /norms/rules/design-tokens/DTK-R04.md

pages/norms/rules/design-tokens/DTK-R04.md

34 行, 2.2 KB. 以页面形式查看.

这段内容尚未翻译,下面是英文原文。

  1. ---
  2. type: Rule
  3. ruleId: DTK-R04
  4. title: 'A style reports its health against the token contract'
  5. requirement: 'The health of a style is reported in bands (full, missing, fallbacks, extra); a style that is not full is told, never stopped.'
  6. level: SHOULD
  7. floor: false
  8. status: active
  9. sphere: design
  10. appliesTo: [/design]
  11. enforcers: [.shtukbase/packages/design-tokens/checks/health.ts]
  12. enforcerKind: gate
  13. mode: warn
  14. 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.'
  15. baseline: 0
  16. reviewBy: 2027-05-29
  17. pack: design-tokens
  18. 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.'
  19. ---
  20. 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:
  21. ```
  22. health style/<id>: full
  23. health style/<id>: missing: <names>
  24. health style/<id>: fallbacks: <names>
  25. health style/<id>: extra: <names>
  26. ```
  27. **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`.
  28. **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).
  29. **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.