@adobe/design-data-spec 2.6.0 → 2.7.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.
@@ -12,18 +12,41 @@ generation/<case>/
12
12
  expected/ — expected legacy output (keyed-object format, one file per input file)
13
13
  ```
14
14
 
15
- ## Running
15
+ ## Automated driver
16
+
17
+ These fixtures are exercised automatically by the `generation_conformance` module in
18
+ `sdk/core/src/lib.rs`. Each test case runs `legacy::convert_dir` twice and asserts:
19
+
20
+ 1. **Byte-identical output** — the generated files match `expected/` exactly.
21
+ 2. **Determinism** — pass 1 and pass 2 output are identical.
16
22
 
17
23
  ```bash
18
- design-data migrate legacy-output --output <out-dir> <input-dir>/
19
- diff <out-dir>/tokens.json expected/tokens.json
24
+ # Run all generation conformance tests:
25
+ moon run sdk:test
26
+ # or directly:
27
+ cd sdk && cargo test generation_conformance
20
28
  ```
21
29
 
22
- Byte-identical output with no diff = conformance. Run twice to verify determinism.
30
+ To regenerate `expected/` after changing conversion logic, run the CLI and commit the result:
31
+
32
+ ```bash
33
+ design-data migrate legacy-output <case>/input --output <case>/expected
34
+ ```
35
+
36
+ ## Cases
37
+
38
+ | Case | What it exercises |
39
+ | ------------------ | ----------------------------------------------------------------------------------------------------------- |
40
+ | `flat-token` | Basic flat token conversion (property key derivation, field passthrough) |
41
+ | `mode-set-token` | Color-set reconstruction from per-mode cascade records (`set_uuid`/`set_schema`) |
42
+ | `deprecated-token` | `deprecated: "version"` string → `true` boolean; `deprecated_comment` passthrough; `plannedRemoval` dropped |
43
+ | `renamed-token` | `replaced_by: "<uuid>"` → `renamed: "<property-name>"` via global UUID→name map |
44
+ | `alias-rewire` | `$ref: "<uuid>"` → `value: "{<property-name>}"` (alias denormalization with UUID resolution) |
45
+ | `mode-set-edit` | `deprecated`/`renamed` hoisted to outer set level when consistent across all mode entries |
23
46
 
24
47
  ## Cascade grouping fields (`set_uuid` / `set_schema`)
25
48
 
26
- The `mode-set-token` fixture input uses two cascade-internal grouping fields:
49
+ The `mode-set-token` and `mode-set-edit` fixtures use two cascade-internal grouping fields:
27
50
 
28
51
  | Field | Type | Role |
29
52
  | ------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,12 @@
1
+ {
2
+ "background": {
3
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
4
+ "value": "{gray-100}",
5
+ "uuid": "ffffffff-0001-4000-8000-000000000001"
6
+ },
7
+ "gray-100": {
8
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
9
+ "value": "rgb(255, 255, 255)",
10
+ "uuid": "ffffffff-0002-4000-8000-000000000002"
11
+ }
12
+ }
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "name": { "property": "color", "colorFamily": "background" },
4
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
5
+ "$ref": "ffffffff-0002-4000-8000-000000000002",
6
+ "uuid": "ffffffff-0001-4000-8000-000000000001"
7
+ },
8
+ {
9
+ "name": { "property": "color", "colorFamily": "gray-100" },
10
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
11
+ "value": "rgb(255, 255, 255)",
12
+ "uuid": "ffffffff-0002-4000-8000-000000000002"
13
+ }
14
+ ]
@@ -0,0 +1,9 @@
1
+ {
2
+ "red": {
3
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
4
+ "value": "rgb(255, 0, 0)",
5
+ "uuid": "dddddddd-0001-4000-8000-000000000001",
6
+ "deprecated": true,
7
+ "deprecated_comment": "Use color-blue-100 instead"
8
+ }
9
+ }
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "name": { "property": "color", "colorFamily": "red" },
4
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
5
+ "value": "rgb(255, 0, 0)",
6
+ "uuid": "dddddddd-0001-4000-8000-000000000001",
7
+ "deprecated": "2.0",
8
+ "deprecated_comment": "Use color-blue-100 instead",
9
+ "plannedRemoval": "3.0"
10
+ }
11
+ ]
@@ -0,0 +1,25 @@
1
+ {
2
+ "accent-400": {
3
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color-set.json",
4
+ "uuid": "11111111-0003-4000-8000-000000000003",
5
+ "deprecated": true,
6
+ "sets": {
7
+ "light": {
8
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
9
+ "value": "rgb(20, 115, 230)",
10
+ "uuid": "11111111-0001-4000-8000-000000000001"
11
+ },
12
+ "dark": {
13
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
14
+ "value": "rgb(56, 145, 254)",
15
+ "uuid": "11111111-0002-4000-8000-000000000002"
16
+ }
17
+ },
18
+ "renamed": "accent-new-400"
19
+ },
20
+ "accent-new-400": {
21
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
22
+ "value": "rgb(20, 115, 230)",
23
+ "uuid": "11111111-0004-4000-8000-000000000004"
24
+ }
25
+ }
@@ -0,0 +1,40 @@
1
+ [
2
+ {
3
+ "name": {
4
+ "property": "color",
5
+ "colorFamily": "accent",
6
+ "scaleIndex": 400,
7
+ "colorScheme": "light"
8
+ },
9
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
10
+ "value": "rgb(20, 115, 230)",
11
+ "uuid": "11111111-0001-4000-8000-000000000001",
12
+ "set_uuid": "11111111-0003-4000-8000-000000000003",
13
+ "set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color-set.json",
14
+ "deprecated": true,
15
+ "replaced_by": "11111111-0004-4000-8000-000000000004"
16
+ },
17
+ {
18
+ "name": {
19
+ "property": "color",
20
+ "colorFamily": "accent",
21
+ "scaleIndex": 400,
22
+ "colorScheme": "dark"
23
+ },
24
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
25
+ "value": "rgb(56, 145, 254)",
26
+ "uuid": "11111111-0002-4000-8000-000000000002",
27
+ "set_uuid": "11111111-0003-4000-8000-000000000003",
28
+ "set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color-set.json",
29
+ "deprecated": true,
30
+ "replaced_by": "11111111-0004-4000-8000-000000000004"
31
+ },
32
+ {
33
+ "name": { "property": "color", "colorFamily": "accent-new-400" },
34
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
35
+ "value": "rgb(20, 115, 230)",
36
+ "uuid": "11111111-0004-4000-8000-000000000004",
37
+ "set_uuid": "11111111-0005-4000-8000-000000000005",
38
+ "set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color-set.json"
39
+ }
40
+ ]
@@ -0,0 +1,14 @@
1
+ {
2
+ "gray": {
3
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
4
+ "value": "rgb(128, 128, 128)",
5
+ "uuid": "eeeeeeee-0001-4000-8000-000000000001",
6
+ "deprecated": true,
7
+ "renamed": "neutral"
8
+ },
9
+ "neutral": {
10
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
11
+ "value": "rgb(128, 128, 128)",
12
+ "uuid": "eeeeeeee-0002-4000-8000-000000000002"
13
+ }
14
+ }
@@ -0,0 +1,16 @@
1
+ [
2
+ {
3
+ "name": { "property": "color", "colorFamily": "gray" },
4
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
5
+ "value": "rgb(128, 128, 128)",
6
+ "uuid": "eeeeeeee-0001-4000-8000-000000000001",
7
+ "deprecated": true,
8
+ "replaced_by": "eeeeeeee-0002-4000-8000-000000000002"
9
+ },
10
+ {
11
+ "name": { "property": "color", "colorFamily": "neutral" },
12
+ "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
13
+ "value": "rgb(128, 128, 128)",
14
+ "uuid": "eeeeeeee-0002-4000-8000-000000000002"
15
+ }
16
+ ]
@@ -0,0 +1,25 @@
1
+ {
2
+ "tokens": [
3
+ {
4
+ "name": {
5
+ "component": "accordion",
6
+ "property": "space-between",
7
+ "from": "top",
8
+ "to": "banana"
9
+ },
10
+ "value": "8px"
11
+ }
12
+ ],
13
+ "components": [
14
+ {
15
+ "$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/accordion.json",
16
+ "name": "accordion",
17
+ "displayName": "Accordion",
18
+ "meta": {
19
+ "category": "containers",
20
+ "documentationUrl": "https://spectrum.adobe.com/page/accordion/"
21
+ },
22
+ "anatomy": [{ "name": "handle", "description": "Drag handle." }]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "layer": 2,
3
+ "errors": [
4
+ {
5
+ "rule_id": "SPEC-047",
6
+ "severity": "error",
7
+ "message_pattern": ".*space-between endpoint.*banana.*"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "tokens": [
3
+ {
4
+ "name": {
5
+ "component": "accordion",
6
+ "property": "space-between",
7
+ "from": "bottom",
8
+ "to": "handle"
9
+ },
10
+ "value": "8px"
11
+ }
12
+ ],
13
+ "components": [
14
+ {
15
+ "$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/accordion.json",
16
+ "name": "accordion",
17
+ "displayName": "Accordion",
18
+ "meta": {
19
+ "category": "containers",
20
+ "documentationUrl": "https://spectrum.adobe.com/page/accordion/"
21
+ },
22
+ "anatomy": [{ "name": "handle", "description": "Drag handle." }]
23
+ }
24
+ ]
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/design-data-spec",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Design Data Specification — prose, JSON Schemas, rule catalog, and conformance fixtures for the design data format",
5
5
  "type": "module",
6
6
  "repository": {
package/rules/rules.yaml CHANGED
@@ -527,3 +527,20 @@ rules:
527
527
  message: "Guideline '{name}' references '{ref}' which is not a known component or guideline"
528
528
  spec_ref: spec/guideline-format.md#related-references
529
529
  introduced_in: "1.0.0-draft"
530
+
531
+ - id: SPEC-047
532
+ name: space-between-endpoint-valid
533
+ severity: error
534
+ layer: 2
535
+ category: reference-integrity
536
+ assert: >
537
+ A token name-object with `property` "space-between" MUST carry both `from` and
538
+ `to` fields, and `from`/`to` MUST NOT appear unless `property` is "space-between".
539
+ Each of `from`/`to` MUST be one of: an edge position (`positions.json`), a generic
540
+ anatomy term (`anatomy-terms.json`), or — when `component` is present and declares
541
+ an `anatomy` array — the `name` of a declared anatomy part on that component.
542
+ Mirrors SPEC-020's component→anatomy resolution, unioned with the position and
543
+ generic-anatomy vocabularies.
544
+ message: "Token '{token}' has space-between endpoint '{endpoint}' that is not a known position, anatomy term, or declared anatomy part on component '{component}'"
545
+ spec_ref: spec/token-format.md#space-between-endpoints
546
+ introduced_in: "1.0.0-draft"
@@ -79,6 +79,11 @@
79
79
  "enum": ["string", "integer"],
80
80
  "description": "Type of the field value. Default: 'string'.",
81
81
  "default": "string"
82
+ },
83
+ "excludeFromLegacyKey": {
84
+ "type": "boolean",
85
+ "description": "When true, this field is omitted from legacy key generation in naming.rs. Opt-in: absence means false. Use for mode-set selectors, color-domain fields, and legacy-annotation fields that must not appear in the serialized token name.",
86
+ "default": false
82
87
  }
83
88
  },
84
89
  "additionalProperties": false
@@ -71,6 +71,14 @@
71
71
  "type": "string",
72
72
  "description": "Semantic: overall component shape (e.g. uniform)."
73
73
  },
74
+ "from": {
75
+ "type": "string",
76
+ "description": "Semantic: starting endpoint of a space-between measurement (e.g. top, edge, text). Paired with `to`; used with property `space-between`."
77
+ },
78
+ "to": {
79
+ "type": "string",
80
+ "description": "Semantic: ending endpoint of a space-between measurement (e.g. text, visual, control). Paired with `from`; used with property `space-between`."
81
+ },
74
82
  "colorScheme": {
75
83
  "type": "string",
76
84
  "description": "Mode set: color scheme mode (e.g. light, dark, wireframe)."
@@ -71,6 +71,25 @@ The table below lists all semantic fields. Fields marked with a scope are domain
71
71
  | `density` | OPTIONAL | Density | Space within or around component parts (e.g. `spacious`, `compact`). |
72
72
  | `shape` | OPTIONAL | Shape | Relative to overall component shape (e.g. `uniform`). |
73
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
+ | `from` | OPTIONAL | — | Starting endpoint of a `space-between` measurement (e.g. `top`, `edge`, `text`). See [Space-between endpoints](#space-between-endpoints). |
75
+ | `to` | OPTIONAL | — | Ending endpoint of a `space-between` measurement (e.g. `text`, `visual`, `control`). See [Space-between endpoints](#space-between-endpoints). |
76
+
77
+ #### Space-between endpoints
78
+
79
+ A token whose `property` is **`space-between`** represents the spacing between two named endpoints (e.g. an edge and an anatomy part, or two anatomy parts) and **MUST** carry both the `from` and `to` fields; conversely, `from`/`to` **MUST NOT** appear unless `property` is `space-between` (rule `SPEC-047`).
80
+
81
+ Each of `from`/`to` **MUST** be one of:
82
+
83
+ * an edge position from `registry/positions.json` (e.g. `top`, `bottom`, `start`, `end`, `affixed`);
84
+ * a generic anatomy term from `registry/anatomy-terms.json` (e.g. `text`, `icon`, `label`);
85
+ * when `component` is present and declares an `anatomy` array, the `name` of a declared anatomy part on that component (e.g. `handle` on `accordion`).
86
+
87
+ ```json
88
+ { "name": { "component": "accordion", "property": "space-between", "from": "bottom", "to": "handle" },
89
+ "value": "8px" }
90
+ ```
91
+
92
+ The `space-between` property term does not itself appear in the serialized legacy key; the key is reconstructed from the endpoints as `{component}-{from}-to-{to}` (e.g. `accordion-bottom-to-handle`).
74
93
 
75
94
  **Domain-scoped semantic fields** (only valid on the indicated token type):
76
95