@adobe/design-data-spec 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/conformance/invalid/SPEC-042/dataset.json +21 -0
- package/conformance/invalid/SPEC-042/expected-errors.json +15 -0
- package/conformance/invalid/SPEC-043/dataset.json +20 -0
- package/conformance/invalid/SPEC-043/expected-errors.json +15 -0
- package/fields/colorFamily.json +15 -0
- package/fields/easing.json +15 -0
- package/fields/family.json +15 -0
- package/fields/motionRole.json +15 -0
- package/fields/scaleIndex.json +1 -1
- package/fields/style.json +15 -0
- package/fields/weight.json +15 -0
- package/package.json +1 -1
- package/rules/rules.yaml +58 -0
- package/schemas/manifest.schema.json +28 -1
- package/spec/cascade.md +1 -0
- package/spec/manifest.md +7 -6
- package/spec/mode-sets.md +17 -0
- package/spec/taxonomy.md +69 -5
- package/spec/token-format.md +16 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/font-weight.json",
|
|
5
|
+
"name": {
|
|
6
|
+
"property": "font-weight",
|
|
7
|
+
"colorFamily": "blue"
|
|
8
|
+
},
|
|
9
|
+
"value": "bold"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
|
|
13
|
+
"name": {
|
|
14
|
+
"property": "color",
|
|
15
|
+
"weight": "bold"
|
|
16
|
+
},
|
|
17
|
+
"value": "#0265dc"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"components": []
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"layer": 2,
|
|
3
|
+
"errors": [
|
|
4
|
+
{
|
|
5
|
+
"rule_id": "SPEC-042",
|
|
6
|
+
"severity": "warning",
|
|
7
|
+
"message_pattern": ".*colorFamily.*color-scoped.*font-weight.*"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"rule_id": "SPEC-042",
|
|
11
|
+
"severity": "warning",
|
|
12
|
+
"message_pattern": ".*weight.*typography-scoped.*color.*"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
|
|
5
|
+
"name": {
|
|
6
|
+
"property": "color",
|
|
7
|
+
"state": "hover"
|
|
8
|
+
},
|
|
9
|
+
"value": "#0265dc"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/font-weight.json",
|
|
13
|
+
"name": {
|
|
14
|
+
"property": "font-weight"
|
|
15
|
+
},
|
|
16
|
+
"value": "bold"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"components": []
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"layer": 2,
|
|
3
|
+
"errors": [
|
|
4
|
+
{
|
|
5
|
+
"rule_id": "SPEC-043",
|
|
6
|
+
"severity": "warning",
|
|
7
|
+
"message_pattern": ".*color.*no domain-identifying field.*colorFamily.*"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"rule_id": "SPEC-043",
|
|
11
|
+
"severity": "warning",
|
|
12
|
+
"message_pattern": ".*typography.*no domain-identifying field.*family.*"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/field.schema.json",
|
|
3
|
+
"specVersion": "1.0.0-draft",
|
|
4
|
+
"name": "colorFamily",
|
|
5
|
+
"description": "Hue family of a color token (e.g. blue, gray, celery, accent). Used on color palette and semantic color tokens. Paired with scaleIndex for ramp tokens (e.g. colorFamily=blue + scaleIndex=100 → blue-100).",
|
|
6
|
+
"kind": "semantic",
|
|
7
|
+
"registry": "packages/design-system-registry/registry/color-families.json",
|
|
8
|
+
"validation": "advisory",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 17
|
|
11
|
+
},
|
|
12
|
+
"scope": "color",
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "string"
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/field.schema.json",
|
|
3
|
+
"specVersion": "1.0.0-draft",
|
|
4
|
+
"name": "easing",
|
|
5
|
+
"description": "Easing curve identifier for a motion token (e.g. ease-in, ease-out, standard). Registry is provisional until motion tokens are added to the foundation.",
|
|
6
|
+
"kind": "semantic",
|
|
7
|
+
"registry": "packages/design-system-registry/registry/easing-curves.json",
|
|
8
|
+
"validation": "advisory",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 22
|
|
11
|
+
},
|
|
12
|
+
"scope": "motion",
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "string"
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/field.schema.json",
|
|
3
|
+
"specVersion": "1.0.0-draft",
|
|
4
|
+
"name": "family",
|
|
5
|
+
"description": "Type family of a typography token (e.g. sans-serif, serif, cjk, code). Used to distinguish tokens that apply to different script or display contexts.",
|
|
6
|
+
"kind": "semantic",
|
|
7
|
+
"registry": "packages/design-system-registry/registry/typography-families.json",
|
|
8
|
+
"validation": "advisory",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 18
|
|
11
|
+
},
|
|
12
|
+
"scope": "typography",
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "string"
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/field.schema.json",
|
|
3
|
+
"specVersion": "1.0.0-draft",
|
|
4
|
+
"name": "motionRole",
|
|
5
|
+
"description": "Semantic role of a motion token — the interaction pattern it governs (e.g. enter, exit, transition, emphasis). Registry is provisional until motion tokens are added to the foundation.",
|
|
6
|
+
"kind": "semantic",
|
|
7
|
+
"registry": "packages/design-system-registry/registry/motion-roles.json",
|
|
8
|
+
"validation": "advisory",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 21
|
|
11
|
+
},
|
|
12
|
+
"scope": "motion",
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "string"
|
|
15
|
+
}
|
package/fields/scaleIndex.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/field.schema.json",
|
|
3
|
+
"specVersion": "1.0.0-draft",
|
|
4
|
+
"name": "style",
|
|
5
|
+
"description": "Typographic style of a typography token (e.g. italic, oblique). Corresponds to the CSS font-style axis. Normal style is omitted (default).",
|
|
6
|
+
"kind": "semantic",
|
|
7
|
+
"registry": "packages/design-system-registry/registry/typography-styles.json",
|
|
8
|
+
"validation": "advisory",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 20
|
|
11
|
+
},
|
|
12
|
+
"scope": "typography",
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "string"
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/field.schema.json",
|
|
3
|
+
"specVersion": "1.0.0-draft",
|
|
4
|
+
"name": "weight",
|
|
5
|
+
"description": "Typographic weight of a typography token (e.g. regular, bold, light, black). Corresponds to the CSS font-weight axis.",
|
|
6
|
+
"kind": "semantic",
|
|
7
|
+
"registry": "packages/design-system-registry/registry/typography-weights.json",
|
|
8
|
+
"validation": "advisory",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 19
|
|
11
|
+
},
|
|
12
|
+
"scope": "typography",
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "string"
|
|
15
|
+
}
|
package/package.json
CHANGED
package/rules/rules.yaml
CHANGED
|
@@ -415,3 +415,61 @@ rules:
|
|
|
415
415
|
message: "Token '{token}' has {field} '{value}' which is not declared on component '{component}'"
|
|
416
416
|
spec_ref: spec/component-format.md#options
|
|
417
417
|
introduced_in: "1.0.0-draft"
|
|
418
|
+
|
|
419
|
+
- id: SPEC-041
|
|
420
|
+
name: mode-set-restriction-coverage
|
|
421
|
+
severity: error
|
|
422
|
+
layer: 2
|
|
423
|
+
category: completeness
|
|
424
|
+
rfc: "#806"
|
|
425
|
+
assert: >
|
|
426
|
+
When a manifest declares modeSetRestrictions, every token group (tokens sharing the same
|
|
427
|
+
non-mode-set name object fields) MUST have at least one candidate that survives ALL
|
|
428
|
+
restrictions simultaneously — i.e. at least one token whose name object either omits
|
|
429
|
+
each restricted mode set field (wildcard) or sets it to an allowed mode value for every
|
|
430
|
+
restriction. Restrictions are applied as a conjunction (matching cascade step 0), so a
|
|
431
|
+
group that satisfies each restriction individually but has no single token satisfying
|
|
432
|
+
all restrictions at once is also a coverage gap.
|
|
433
|
+
Sub-checks: (a) a modeSetRestrictions key that names an unknown mode set MUST emit a
|
|
434
|
+
Warning; (b) an allowed list that excludes the mode set's declared default MUST emit
|
|
435
|
+
an Error, since the resolver would return None for the default context on that platform.
|
|
436
|
+
message: "Token group '{base_name}' has no resolvable candidate under manifest mode-set restrictions ({restrictions})"
|
|
437
|
+
spec_ref: spec/mode-sets.md#platform-restrictions
|
|
438
|
+
introduced_in: "1.0.0-draft"
|
|
439
|
+
|
|
440
|
+
- id: SPEC-042
|
|
441
|
+
name: field-scope-violation
|
|
442
|
+
severity: warning
|
|
443
|
+
layer: 2
|
|
444
|
+
category: taxonomy
|
|
445
|
+
rfc: "#806"
|
|
446
|
+
assert: >
|
|
447
|
+
When a token's name object contains a domain-scoped field (e.g. `colorFamily`,
|
|
448
|
+
`weight`, `motionRole`), the token's `$schema` MUST reference a compatible token
|
|
449
|
+
type for that domain. Using a color-scoped field on a typography token, or a
|
|
450
|
+
typography-scoped field on a color token, is a taxonomy violation. The set of
|
|
451
|
+
domain-scoped fields and their valid schema URL suffixes is declared in the field
|
|
452
|
+
catalog under `packages/design-data-spec/fields/` via the `scope` property.
|
|
453
|
+
Tokens without a `$schema` are skipped (domain cannot be determined).
|
|
454
|
+
message: "name.{field} is a {scope}-scoped field but token schema '{schema_url}' is not a {scope} token type"
|
|
455
|
+
spec_ref: spec/taxonomy.md#token-type-taxonomies
|
|
456
|
+
introduced_in: "1.0.0-draft"
|
|
457
|
+
|
|
458
|
+
- id: SPEC-043
|
|
459
|
+
name: domain-required-fields
|
|
460
|
+
severity: warning
|
|
461
|
+
layer: 2
|
|
462
|
+
category: taxonomy
|
|
463
|
+
rfc: "#806"
|
|
464
|
+
assert: >
|
|
465
|
+
Tokens in a known domain SHOULD include at least one domain-identifying field in
|
|
466
|
+
their name object so tooling can group, sort, and validate them correctly.
|
|
467
|
+
Color tokens (schema: color.json, color-set.json) SHOULD have `colorFamily` or
|
|
468
|
+
`scaleIndex`. Typography tokens (schema: font-*.json, typography.json) SHOULD have
|
|
469
|
+
`family`, `weight`, or `style`. Motion tokens (schema: duration.json, motion.json)
|
|
470
|
+
SHOULD have `motionRole` or `easing`. String-named tokens and tokens without `$schema`
|
|
471
|
+
are skipped. Advisory severity: the existing corpus has not yet migrated to structured
|
|
472
|
+
name objects; this rule tracks progress rather than blocking.
|
|
473
|
+
message: "{domain} token has a name object but no domain-identifying field — add at least one of: {required_fields}"
|
|
474
|
+
spec_ref: spec/taxonomy.md#token-type-taxonomies
|
|
475
|
+
introduced_in: "1.0.0-draft"
|
|
@@ -62,6 +62,27 @@
|
|
|
62
62
|
]
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
+
"modeSetRestrictions": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"description": "Restricts the valid mode values for each named mode set on this platform. Keys are mode set names; values declare which modes are allowed.",
|
|
68
|
+
"additionalProperties": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"required": ["allowed"],
|
|
71
|
+
"properties": {
|
|
72
|
+
"allowed": {
|
|
73
|
+
"type": "array",
|
|
74
|
+
"items": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"minLength": 1
|
|
77
|
+
},
|
|
78
|
+
"minItems": 1,
|
|
79
|
+
"uniqueItems": true,
|
|
80
|
+
"description": "Allowed mode values for this mode set. Must be a subset of the mode set's declared modes and must include the mode set's default."
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"additionalProperties": false
|
|
84
|
+
}
|
|
85
|
+
},
|
|
65
86
|
"extensions": {
|
|
66
87
|
"type": "object",
|
|
67
88
|
"description": "Platform-local tokens, mode sets, and formatting rules.",
|
|
@@ -87,7 +108,13 @@
|
|
|
87
108
|
"size",
|
|
88
109
|
"density",
|
|
89
110
|
"shape",
|
|
90
|
-
"state"
|
|
111
|
+
"state",
|
|
112
|
+
"colorFamily",
|
|
113
|
+
"family",
|
|
114
|
+
"weight",
|
|
115
|
+
"style",
|
|
116
|
+
"motionRole",
|
|
117
|
+
"easing"
|
|
91
118
|
]
|
|
92
119
|
},
|
|
93
120
|
"uniqueItems": true,
|
package/spec/cascade.md
CHANGED
|
@@ -41,6 +41,7 @@ A **resolution context** is a set of mode set key/value pairs (e.g. `colorScheme
|
|
|
41
41
|
|
|
42
42
|
The following outline is **RECOMMENDED** for conforming resolvers:
|
|
43
43
|
|
|
44
|
+
0. If the manifest declares `modeSetRestrictions`, **drop any candidate** whose name object sets a mode set field to a value not in the manifest’s `allowed` list for that mode set. Candidates that omit a restricted mode set field (wildcard) are **not** dropped. See [Mode Sets — Platform restrictions](mode-sets.md#platform-restrictions).
|
|
44
45
|
1. Collect all token candidates whose name object **matches** the context (every specified mode set in the context equals the name object’s mode set field, or the name object omits that mode set where omission means “matches any” per mode set rules).
|
|
45
46
|
2. Filter to candidates at or below the requested layer.
|
|
46
47
|
3. Select the maximum **layer** precedence.
|
package/spec/manifest.md
CHANGED
|
@@ -17,12 +17,13 @@ A manifest **MUST** conform to [`manifest.schema.json`](../schemas/manifest.sche
|
|
|
17
17
|
|
|
18
18
|
## Optional fields
|
|
19
19
|
|
|
20
|
-
| Field
|
|
21
|
-
|
|
|
22
|
-
| `include`
|
|
23
|
-
| `exclude`
|
|
24
|
-
| `overrides`
|
|
25
|
-
| `extensions`
|
|
20
|
+
| Field | Type | Description |
|
|
21
|
+
| --------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
22
|
+
| `include` | array of string | Semantic **queries** selecting subsets of foundation tokens to materialize. |
|
|
23
|
+
| `exclude` | array of string | Queries removing tokens from the included set. |
|
|
24
|
+
| `overrides` | array of object | Typed overrides; each entry **MUST** preserve the target token’s **value type**. |
|
|
25
|
+
| `extensions` | object | New tokens or mode sets introduced at the platform layer. |
|
|
26
|
+
| `modeSetRestrictions` | object | Mode set restrictions for this platform; see [Mode Sets — Platform restrictions](mode-sets.md#platform-restrictions). |
|
|
26
27
|
|
|
27
28
|
### `include` / `exclude`
|
|
28
29
|
|
package/spec/mode-sets.md
CHANGED
|
@@ -57,8 +57,25 @@ Additional mode sets (e.g. `language`, `motion`) **MAY** be declared in a datase
|
|
|
57
57
|
|
|
58
58
|
**RECOMMENDED:** Explicit **combination** tokens are used for rare cross-mode-set cases instead of inferring Cartesian products.
|
|
59
59
|
|
|
60
|
+
## Platform restrictions
|
|
61
|
+
|
|
62
|
+
A platform manifest **MAY** declare which mode values are valid for a given mode set on that platform. This allows a platform (e.g. iOS) to express that it only supports a subset of modes (e.g. `colorScheme: light`, not `dark`).
|
|
63
|
+
|
|
64
|
+
**NORMATIVE:** A manifest's `modeSetRestrictions` value **MUST** be an object whose keys are mode set names declared in the dataset. Each value **MUST** be an object with a required `allowed` array of mode value strings. Every mode value in `allowed` **MUST** be a member of the named mode set's `modes`. The mode set's `default` **MUST** be included in `allowed`.
|
|
65
|
+
|
|
66
|
+
### Resolution semantics
|
|
67
|
+
|
|
68
|
+
**NORMATIVE:** At resolution time, any token candidate whose name object sets a mode set field to a value **not** in the manifest's `allowed` list for that mode set **MUST** be filtered out before specificity tie-breaking. Tokens whose name object **omits** a restricted mode set field (wildcard) are **not** affected.
|
|
69
|
+
|
|
70
|
+
This is a pre-filter step, inserted at the start of the [resolution algorithm](cascade.md#resolution-algorithm-informative-outline) before step 1 (context matching).
|
|
71
|
+
|
|
72
|
+
### Coverage validation
|
|
73
|
+
|
|
74
|
+
**NORMATIVE:** Validators implementing rule **`SPEC-041`** (`mode-set-restriction-coverage`) **MUST** report an error when a platform manifest's mode set restrictions leave a token group with no resolvable candidate — i.e. every token sharing the same non-mode-set name object fields references a restricted mode value, with no wildcard or allowed-mode alternative available. See `rules/rules.yaml` for the full rule definition.
|
|
75
|
+
|
|
60
76
|
## References
|
|
61
77
|
|
|
62
78
|
* [#646 — Token Schema Structure and Validation System](https://github.com/adobe/spectrum-design-data/discussions/646)
|
|
63
79
|
* [#714 — Design Data Specification](https://github.com/adobe/spectrum-design-data/discussions/714)
|
|
64
80
|
* [#746 — Phase 2: Mode Set declarations (machine-readable)](https://github.com/adobe/spectrum-design-data/issues/746)
|
|
81
|
+
* [#943 — RFC #806: platform mode-set restriction behavior](https://github.com/adobe/spectrum-design-data/issues/943)
|
package/spec/taxonomy.md
CHANGED
|
@@ -46,13 +46,17 @@ The taxonomy is designed with three guiding principles:
|
|
|
46
46
|
2. **Agnostic (with compromises)** — Platform-agnostic terms are used except when platforms have specific terms for the same concept. In those cases, the most common or clear term is used.
|
|
47
47
|
3. **Verified** — Multiple existing components must be rebuildable using the taxonomy system, and consumers must find them reasonably understandable or learnable.
|
|
48
48
|
|
|
49
|
-
##
|
|
49
|
+
## Token-type taxonomies
|
|
50
50
|
|
|
51
|
-
Concept categories for name-object fields are declared in the design system's **field catalog** — a set of field declarations in the `fields/` directory, each conforming to [`field.schema.json`](../schemas/field.schema.json). Each declaration specifies the field name, vocabulary registry, validation severity,
|
|
51
|
+
Concept categories for name-object fields are declared in the design system's **field catalog** — a set of field declarations in the `fields/` directory, each conforming to [`field.schema.json`](../schemas/field.schema.json). Each declaration specifies the field name, vocabulary registry, validation severity, default serialization position, and an optional **scope** that restricts the field to a specific token type.
|
|
52
52
|
|
|
53
53
|
**NORMATIVE:** The field catalog is the authoritative source for what fields exist on the name object. Tools, validators, and serializers **SHOULD** read the catalog rather than hardcoding field knowledge.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
**NORMATIVE:** A field with a non-null `scope` declaration **MUST** only appear on tokens of that type. Using a scoped field on a mismatched token type triggers rule SPEC-042 (`field-scope-violation`, warning).
|
|
56
|
+
|
|
57
|
+
### Semantic / layout token taxonomy
|
|
58
|
+
|
|
59
|
+
The following concept categories are defined in Spectrum's foundation field catalog for semantic and layout tokens (`scope: null` — universal), ordered by default serialization position. This ordering is the **default serialization order** for legacy format output; it is not a conformance requirement for stored name objects.
|
|
56
60
|
|
|
57
61
|
**NORMATIVE:** Each category listed below corresponds to a field on the token [name object](token-format.md). Tokens **MAY** use any subset of these fields. Exception: `property` is REQUIRED on every name object — see [token-format.md](token-format.md#name-object).
|
|
58
62
|
|
|
@@ -77,7 +81,67 @@ Additional categories for variant and state are inherited from the existing name
|
|
|
77
81
|
| Variant | `variant` | Variant within a component (e.g. accent, negative, primary). |
|
|
78
82
|
| State | `state` | Interactive or semantic state (e.g. hover, focus, disabled). |
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
### Color token taxonomy
|
|
85
|
+
|
|
86
|
+
Color tokens describe palette entries and semantic color assignments. Their name objects use `scope: "color"` fields alongside the universal `property` and `state` fields.
|
|
87
|
+
|
|
88
|
+
**NORMATIVE:** Color tokens SHOULD include `colorFamily`, `scaleIndex`, or both to allow tooling to group and sort palette entries. Tokens missing both are flagged by rule SPEC-043 (`domain-required-fields`, warning).
|
|
89
|
+
|
|
90
|
+
| Category | Name object field | Answers | Description |
|
|
91
|
+
| ------------ | ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
92
|
+
| Color Family | `colorFamily` | What? | Hue family of the color (e.g. `blue`, `gray`, `celery`, `transparent-black`). Values come from [`color-families.json`](../../packages/design-system-registry/registry/color-families.json). |
|
|
93
|
+
| Ramp Index | `scaleIndex` | Which? | Numeric perceptual ramp step (e.g. `100`, `400`, `900`, `1600`). Shared with layout tokens; see [scaleIndex field declaration](../fields/scaleIndex.json). Not scope-restricted. |
|
|
94
|
+
|
|
95
|
+
**Default serialization order for color tokens:**
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
{variant}-{colorFamily}-{scaleIndex}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Example: `colorFamily=blue` + `scaleIndex=100` → `blue-100`.
|
|
102
|
+
|
|
103
|
+
### Typography token taxonomy
|
|
104
|
+
|
|
105
|
+
Typography tokens describe typeface attributes: family, weight, style, and numeric scale. Their name objects use `scope: "typography"` fields alongside the universal `property` field.
|
|
106
|
+
|
|
107
|
+
**NORMATIVE:** Typography tokens SHOULD include at least one of `family`, `weight`, or `style`. Tokens missing all three are flagged by rule SPEC-043 (`domain-required-fields`, warning).
|
|
108
|
+
|
|
109
|
+
| Category | Name object field | Answers | Description |
|
|
110
|
+
| -------- | ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| Family | `family` | What? | Type family of the token (e.g. `sans-serif`, `serif`, `cjk`, `code`). Values come from [`typography-families.json`](../../packages/design-system-registry/registry/typography-families.json). |
|
|
112
|
+
| Weight | `weight` | How? | Typographic weight (e.g. `regular`, `bold`, `light`, `black`). Values come from [`typography-weights.json`](../../packages/design-system-registry/registry/typography-weights.json). |
|
|
113
|
+
| Style | `style` | How? | Typographic style when non-default (e.g. `italic`, `oblique`). Omit the field when style is normal. Values come from [`typography-styles.json`](../../packages/design-system-registry/registry/typography-styles.json). |
|
|
114
|
+
| Scale | `scaleIndex` | Which? | Numeric size scale step (e.g. `75`, `100`, `200`). Shared with other token types; not scope-restricted. |
|
|
115
|
+
|
|
116
|
+
**Default serialization order for typography tokens:**
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
{family}-{weight}-{style}-{scaleIndex}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Example: `family=sans-serif` + `weight=bold` → `sans-serif-bold`. `family=sans-serif` + `style=italic` + `scaleIndex=100` → `sans-serif-italic-100`.
|
|
123
|
+
|
|
124
|
+
### Motion token taxonomy
|
|
125
|
+
|
|
126
|
+
Motion tokens describe timing, easing, and animation role for UI animation. Their name objects use `scope: "motion"` fields alongside the universal `property` field.
|
|
127
|
+
|
|
128
|
+
**NOTE:** No motion tokens exist in the foundation dataset at the time of this writing. This taxonomy is normative but the registry values for `motionRole` and `easing` are provisional — they will be refined when motion tokens are added to the foundation. Validators emit SPEC-043 at warning severity so provisional tokens are not blocked.
|
|
129
|
+
|
|
130
|
+
**NORMATIVE:** Motion tokens SHOULD include `motionRole` or `easing`. Tokens missing both are flagged by rule SPEC-043 (`domain-required-fields`, warning).
|
|
131
|
+
|
|
132
|
+
| Category | Name object field | Answers | Description |
|
|
133
|
+
| ----------- | ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
134
|
+
| Motion Role | `motionRole` | What? | Semantic role of the animation (e.g. `enter`, `exit`, `transition`, `emphasis`). Values come from [`motion-roles.json`](../../packages/design-system-registry/registry/motion-roles.json). |
|
|
135
|
+
| Easing | `easing` | How? | Easing curve identifier (e.g. `ease-in`, `ease-out`, `standard`). Values come from [`easing-curves.json`](../../packages/design-system-registry/registry/easing-curves.json). |
|
|
136
|
+
| Duration | `scaleIndex` | Which? | Numeric duration bucket index (e.g. `100` for 100ms, `200` for 200ms). Shared with other token types; not scope-restricted. |
|
|
137
|
+
|
|
138
|
+
**Default serialization order for motion tokens:**
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
{motionRole}-{easing}-{scaleIndex}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Example: `motionRole=enter` + `easing=ease-out` → `enter-ease-out`. `motionRole=transition` + `scaleIndex=100` → `transition-100`.
|
|
81
145
|
|
|
82
146
|
### Structure vs. component — when does the line move?
|
|
83
147
|
|
|
@@ -177,7 +241,7 @@ The taxonomy and terms are built to scale as new concepts and terms are identifi
|
|
|
177
241
|
|
|
178
242
|
* New concept categories **MAY** be added by creating a new field declaration file in the field catalog — no spec version change is required for the mechanism itself.
|
|
179
243
|
* New terms **MAY** be added to the vocabulary registry without spec version changes.
|
|
180
|
-
* New token type taxonomies
|
|
244
|
+
* New token type taxonomies **MAY** be added by creating scoped field declarations (non-null `scope`) and a corresponding registry section in taxonomy.md. Color, typography, and motion taxonomies are defined above.
|
|
181
245
|
* Platform manifests **MAY** extend the vocabulary with platform-specific terms and formatting.
|
|
182
246
|
|
|
183
247
|
## References
|
package/spec/token-format.md
CHANGED
|
@@ -51,6 +51,10 @@ Fields are divided into **semantic fields** (identity, structure, intent) and **
|
|
|
51
51
|
|
|
52
52
|
#### Semantic fields
|
|
53
53
|
|
|
54
|
+
The table below lists all semantic fields. Fields marked with a scope are domain-restricted — see [Taxonomy — Token-type taxonomies](taxonomy.md#token-type-taxonomies) for the normative per-domain field rules and serialization orders. Validators enforce scope restrictions via rule SPEC-042.
|
|
55
|
+
|
|
56
|
+
**Universal semantic fields** (`scope: null` — apply to all token types):
|
|
57
|
+
|
|
54
58
|
| Field | Status | Taxonomy category | Description |
|
|
55
59
|
| -------------- | -------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
56
60
|
| `property` | REQUIRED | Property | The stylistic attribute being defined (e.g. `color`, `width`, `padding`, `gap`). |
|
|
@@ -66,6 +70,18 @@ Fields are divided into **semantic fields** (identity, structure, intent) and **
|
|
|
66
70
|
| `size` | OPTIONAL | Size | Relative t-shirt sizing for relationships across tokens (e.g. `small`, `medium`, `large`). |
|
|
67
71
|
| `density` | OPTIONAL | Density | Space within or around component parts (e.g. `spacious`, `compact`). |
|
|
68
72
|
| `shape` | OPTIONAL | Shape | Relative to overall component shape (e.g. `uniform`). |
|
|
73
|
+
| `scaleIndex` | OPTIONAL | — | Numeric scale index appended at the end of the serialized name (e.g. `100`, `200`, `900`). Used by color palette, spacing, font-size, and motion duration tokens. |
|
|
74
|
+
|
|
75
|
+
**Domain-scoped semantic fields** (only valid on the indicated token type):
|
|
76
|
+
|
|
77
|
+
| Field | Status | Scope | Description |
|
|
78
|
+
| ------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
79
|
+
| `colorFamily` | OPTIONAL | `color` | Hue family of the color (e.g. `blue`, `gray`, `cyan`). See [Taxonomy — Color token taxonomy](taxonomy.md#color-token-taxonomy). |
|
|
80
|
+
| `family` | OPTIONAL | `typography` | Type family (e.g. `sans-serif`, `serif`, `cjk`, `code`). See [Taxonomy — Typography token taxonomy](taxonomy.md#typography-token-taxonomy). |
|
|
81
|
+
| `weight` | OPTIONAL | `typography` | Typographic weight (e.g. `regular`, `bold`, `light`). See [Taxonomy — Typography token taxonomy](taxonomy.md#typography-token-taxonomy). |
|
|
82
|
+
| `style` | OPTIONAL | `typography` | Typographic style when non-default (e.g. `italic`). See [Taxonomy — Typography token taxonomy](taxonomy.md#typography-token-taxonomy). |
|
|
83
|
+
| `motionRole` | OPTIONAL | `motion` | Semantic animation role (e.g. `enter`, `exit`, `transition`). See [Taxonomy — Motion token taxonomy](taxonomy.md#motion-token-taxonomy). |
|
|
84
|
+
| `easing` | OPTIONAL | `motion` | Easing curve identifier (e.g. `ease-out`, `standard`). See [Taxonomy — Motion token taxonomy](taxonomy.md#motion-token-taxonomy). |
|
|
69
85
|
|
|
70
86
|
#### Mode-set fields
|
|
71
87
|
|