ShtukbaseStandard
DTK-R03/norms/rules/design-tokens/DTK-R03.md

Этот текст ещё не переведён. Ниже английский оригинал.

The style meets the token contract

MUSTне пускаетпроверкадействует
The built tokens of the chosen style (/design/<style>/tokens.css) define every required name of the token contract v1 in :root, and every colour name also in the dark scheme.
Зачем: Components and viewers read only the contract names. A style that misses one makes every component that uses it fall back to the browser default, and it shows only on the screen; a missing dark value shows only when the dark scheme is switched on.
Поля страницы (15)
ruleIdDTK-R03
requirementThe built tokens of the chosen style (/design/<style>/tokens.css) define every required name of the token contract v1 in :root, and every colour name also in the dark scheme.
levelMUST
floorfalse
statusactive
spheredesign
appliesTo/design
enforcers.shtukbase/packages/design-tokens/checks/contract.ts
enforcerKindgate
modeenforce
becauseComponents and viewers read only the contract names. A style that misses one makes every component that uses it fall back to the browser default, and it shows only on the screen; a missing dark value shows only when the dark scheme is switched on.
baseline0
reviewBy2027-05-29
packdesign-tokens
railAdd the name named in the finding to the style tokens (and to the dark tokens for a colour), then build the style again.

The built tokens of the chosen style define every required name of the token contract v1 in :root, and every colour name also in the dark scheme.

What counts as a violation. The style chosen on Design has no tokens.css, or its CSS has no required name of the contract in :root, or no dark value of a colour name (.dark or [data-theme="dark"]), or a colour refers to a variable that does not exist. No style chosen: the check stays silent.

Not a violation. The optional extension (--font-display, --sb-*) may be left out; the check names the left-out names in a note: line, and the defaults of the contract apply to them.

Why. Components and viewers read only the contract names, so a style is a swappable part only while it meets the contract.

Run. shtuk run design-tokens contract; for any CSS file by hand shtuk run design-tokens contract --css <file>. A violation is a line, exit code 1.

How to fix. Add the name to the style tokens (tokens.json, and tokens.dark.json for a colour), build the style again.

Пакет Design tokens (W3C DTCG) кладёт эту страницу в /norms/rules/design-tokens/DTK-R03.md.Исходный текст