@adobe/design-data-spec 2.8.0 → 2.9.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-049/dataset.json +13 -0
- package/conformance/invalid/SPEC-049/expected-errors.json +10 -0
- package/conformance/valid/SPEC-025/dataset.json +17 -0
- package/conformance/valid/SPEC-049/dataset.json +43 -0
- package/package.json +1 -1
- package/rules/rules.yaml +20 -2
- package/schemas/registry-value.json +4 -0
|
@@ -7,6 +7,23 @@
|
|
|
7
7
|
"property": "color"
|
|
8
8
|
},
|
|
9
9
|
"value": "#ffffff"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": {
|
|
13
|
+
"structure": "accessory",
|
|
14
|
+
"anatomy": "item",
|
|
15
|
+
"property": "padding",
|
|
16
|
+
"size": "small",
|
|
17
|
+
"legacyKey": "accessory-item-padding-small"
|
|
18
|
+
},
|
|
19
|
+
"value": "4px"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": {
|
|
23
|
+
"anatomy": "focus-ring",
|
|
24
|
+
"property": "gap"
|
|
25
|
+
},
|
|
26
|
+
"value": "2px"
|
|
10
27
|
}
|
|
11
28
|
],
|
|
12
29
|
"components": [
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"name": {
|
|
5
|
+
"structure": "accessory",
|
|
6
|
+
"anatomy": "item",
|
|
7
|
+
"property": "padding",
|
|
8
|
+
"size": "small",
|
|
9
|
+
"legacyKey": "accessory-item-padding-small"
|
|
10
|
+
},
|
|
11
|
+
"value": "4px"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": {
|
|
15
|
+
"anatomy": "focus-ring",
|
|
16
|
+
"property": "gap"
|
|
17
|
+
},
|
|
18
|
+
"value": "2px"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": {
|
|
22
|
+
"component": "button",
|
|
23
|
+
"anatomy": "wibble",
|
|
24
|
+
"property": "color"
|
|
25
|
+
},
|
|
26
|
+
"value": "#ffffff"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"components": [
|
|
30
|
+
{
|
|
31
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
32
|
+
"name": "button",
|
|
33
|
+
"displayName": "Button",
|
|
34
|
+
"meta": {
|
|
35
|
+
"category": "actions",
|
|
36
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
37
|
+
},
|
|
38
|
+
"anatomy": [
|
|
39
|
+
{ "name": "wibble", "description": "Custom documented part." }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
package/package.json
CHANGED
package/rules/rules.yaml
CHANGED
|
@@ -223,8 +223,12 @@ rules:
|
|
|
223
223
|
name: anatomy-requires-component
|
|
224
224
|
severity: error
|
|
225
225
|
category: reference-integrity
|
|
226
|
-
assert:
|
|
227
|
-
|
|
226
|
+
assert: >
|
|
227
|
+
A token name object MUST NOT include an 'anatomy' field unless a 'component' or
|
|
228
|
+
'structure' field is also present, or the 'anatomy' value is a registry term
|
|
229
|
+
flagged 'standaloneScope: true' in anatomy-terms.json (cross-cutting parts with
|
|
230
|
+
no single owning component, e.g. 'focus-ring', 'focus-indicator').
|
|
231
|
+
message: "Token '{token}' has 'anatomy' field without a 'component' or 'structure' field, and '{anatomy}' is not a registry term flagged standaloneScope"
|
|
228
232
|
spec_ref: spec/anatomy-format.md#cross-reference-with-token-name-objects
|
|
229
233
|
introduced_in: "1.0.0-draft"
|
|
230
234
|
|
|
@@ -560,3 +564,17 @@ rules:
|
|
|
560
564
|
message: "Anatomy part '{part}' on component '{component}' contains '{child}', which is not a declared anatomy part on this component"
|
|
561
565
|
spec_ref: spec/anatomy-format.md#contains
|
|
562
566
|
introduced_in: "1.0.0-draft"
|
|
567
|
+
|
|
568
|
+
- id: SPEC-049
|
|
569
|
+
name: anatomy-in-registry
|
|
570
|
+
severity: error
|
|
571
|
+
layer: 2
|
|
572
|
+
category: reference-integrity
|
|
573
|
+
assert: >
|
|
574
|
+
A token name-object 'anatomy' field with no 'component' (SPEC-020 validates that
|
|
575
|
+
case) MUST reference a known id in the anatomy-terms.json registry. Backstops the
|
|
576
|
+
two cases SPEC-025 allows anatomy without a component: 'structure'-scoped anatomy
|
|
577
|
+
and registry terms flagged 'standaloneScope: true'.
|
|
578
|
+
message: "Token '{token}' references anatomy part '{anatomy}' which is not in the spectrum-design-data registry/anatomy-terms vocabulary"
|
|
579
|
+
spec_ref: spec/anatomy-format.md#cross-reference-with-token-name-objects
|
|
580
|
+
introduced_in: "1.0.0-draft"
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
"type": "boolean",
|
|
67
67
|
"description": "Whether this value is deprecated"
|
|
68
68
|
},
|
|
69
|
+
"standaloneScope": {
|
|
70
|
+
"type": "boolean",
|
|
71
|
+
"description": "Anatomy-term only: whether this term may scope a token's name object on its own, without an accompanying component or structure field (e.g. cross-cutting parts like focus-ring/focus-indicator that have no single owner)"
|
|
72
|
+
},
|
|
69
73
|
"usedIn": {
|
|
70
74
|
"type": "array",
|
|
71
75
|
"description": "Where this value is used (tokens, component-schemas, etc.)",
|