@adobe/design-data-spec 0.12.0 → 0.14.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-035/dataset.json +20 -0
- package/conformance/invalid/SPEC-035/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-036/dataset.json +26 -0
- package/conformance/invalid/SPEC-036/expected-errors.json +10 -0
- package/conformance/valid/SPEC-035/dataset.json +31 -0
- package/conformance/valid/SPEC-036/dataset.json +43 -0
- package/package.json +1 -1
- package/rules/rules.yaml +23 -0
- package/spec/anatomy-format.md +9 -6
- package/spec/registry.md +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [],
|
|
3
|
+
"components": [
|
|
4
|
+
{
|
|
5
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/widget.json",
|
|
6
|
+
"name": "widget",
|
|
7
|
+
"displayName": "Widget",
|
|
8
|
+
"meta": {
|
|
9
|
+
"category": "feedback",
|
|
10
|
+
"documentationUrl": "https://spectrum.adobe.com/page/widget/"
|
|
11
|
+
},
|
|
12
|
+
"anatomy": [
|
|
13
|
+
{
|
|
14
|
+
"name": "not-a-real-part",
|
|
15
|
+
"description": "A custom part not in the anatomy-terms registry."
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"name": {
|
|
5
|
+
"component": "old-widget",
|
|
6
|
+
"property": "color"
|
|
7
|
+
},
|
|
8
|
+
"value": "#000000"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"components": [
|
|
12
|
+
{
|
|
13
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/old-widget.json",
|
|
14
|
+
"name": "old-widget",
|
|
15
|
+
"displayName": "Old Widget",
|
|
16
|
+
"meta": {
|
|
17
|
+
"category": "actions",
|
|
18
|
+
"documentationUrl": "https://spectrum.adobe.com/page/old-widget/"
|
|
19
|
+
},
|
|
20
|
+
"lifecycle": {
|
|
21
|
+
"deprecated": "1.0.0-draft",
|
|
22
|
+
"deprecatedComment": "Superseded by new-widget."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [],
|
|
3
|
+
"components": [
|
|
4
|
+
{
|
|
5
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/dialog.json",
|
|
6
|
+
"name": "dialog",
|
|
7
|
+
"displayName": "Dialog",
|
|
8
|
+
"meta": {
|
|
9
|
+
"category": "feedback",
|
|
10
|
+
"documentationUrl": "https://spectrum.adobe.com/page/dialog/"
|
|
11
|
+
},
|
|
12
|
+
"anatomy": [
|
|
13
|
+
{
|
|
14
|
+
"name": "header",
|
|
15
|
+
"description": "Top section of the dialog containing the title.",
|
|
16
|
+
"required": true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "body",
|
|
20
|
+
"description": "Main content area of the dialog.",
|
|
21
|
+
"required": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "label",
|
|
25
|
+
"description": "Dialog title text.",
|
|
26
|
+
"required": true
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"name": {
|
|
5
|
+
"component": "new-widget",
|
|
6
|
+
"property": "background-color"
|
|
7
|
+
},
|
|
8
|
+
"value": "#0265dc"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": {
|
|
12
|
+
"component": "old-widget",
|
|
13
|
+
"property": "color"
|
|
14
|
+
},
|
|
15
|
+
"value": "#000000",
|
|
16
|
+
"deprecated": "1.0.0-draft"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"components": [
|
|
20
|
+
{
|
|
21
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/new-widget.json",
|
|
22
|
+
"name": "new-widget",
|
|
23
|
+
"displayName": "New Widget",
|
|
24
|
+
"meta": {
|
|
25
|
+
"category": "actions",
|
|
26
|
+
"documentationUrl": "https://spectrum.adobe.com/page/new-widget/"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/old-widget.json",
|
|
31
|
+
"name": "old-widget",
|
|
32
|
+
"displayName": "Old Widget",
|
|
33
|
+
"meta": {
|
|
34
|
+
"category": "actions",
|
|
35
|
+
"documentationUrl": "https://spectrum.adobe.com/page/old-widget/"
|
|
36
|
+
},
|
|
37
|
+
"lifecycle": {
|
|
38
|
+
"deprecated": "1.0.0-draft",
|
|
39
|
+
"deprecatedComment": "Superseded by new-widget."
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
package/package.json
CHANGED
package/rules/rules.yaml
CHANGED
|
@@ -332,3 +332,26 @@ rules:
|
|
|
332
332
|
message: "Component '{entity}' meta.category value '{value}' is not in the design-system-registry categories vocabulary"
|
|
333
333
|
spec_ref: spec/registry.md#categories
|
|
334
334
|
introduced_in: "1.0.0-draft"
|
|
335
|
+
- id: SPEC-035
|
|
336
|
+
name: anatomy-part-name-registry-sync
|
|
337
|
+
severity: warning
|
|
338
|
+
category: naming-consistency
|
|
339
|
+
assert: >
|
|
340
|
+
A component anatomy part's name SHOULD reference an id from the anatomy-terms registry in
|
|
341
|
+
@adobe/design-system-registry (anatomy-terms.json). Unknown values are reported as
|
|
342
|
+
warnings; custom names remain permitted but the registry is the authoritative vocabulary.
|
|
343
|
+
message: "Component '{entity}' anatomy part name '{value}' is not in the design-system-registry anatomy-terms vocabulary"
|
|
344
|
+
spec_ref: spec/anatomy-format.md#canonical-anatomy-vocabulary
|
|
345
|
+
introduced_in: "1.0.0-draft"
|
|
346
|
+
|
|
347
|
+
- id: SPEC-036
|
|
348
|
+
name: component-deprecation-cascade
|
|
349
|
+
severity: warning
|
|
350
|
+
category: reference-integrity
|
|
351
|
+
assert: >
|
|
352
|
+
Tokens SHOULD NOT reference a deprecated component via `name.component` unless the token
|
|
353
|
+
is itself deprecated. Non-deprecated tokens referencing a deprecated component are surfaced
|
|
354
|
+
as warnings to prompt authors to update the reference or mark the token deprecated.
|
|
355
|
+
message: "Token '{token}' references deprecated component '{component}' (deprecated since {version}); update the reference or mark the token deprecated"
|
|
356
|
+
spec_ref: spec/component-format.md#lifecycle
|
|
357
|
+
introduced_in: "1.0.0-draft"
|
package/spec/anatomy-format.md
CHANGED
|
@@ -86,6 +86,8 @@ The following anatomy part names are defined by the cross-platform design audit
|
|
|
86
86
|
|
|
87
87
|
Custom part names are permitted. When a custom name is used, the anatomy part object **SHOULD** include a `description` field explaining its visual role (rule SPEC-023).
|
|
88
88
|
|
|
89
|
+
The table above is informative; the authoritative vocabulary is `@adobe/design-system-registry/registry/anatomy-terms.json` (119 entries). SPEC-035 fires advisory warnings when a declared anatomy part `name` is not in that registry, pointing authors at the canonical list. Custom names remain valid — SPEC-035 is advisory, not an error.
|
|
90
|
+
|
|
89
91
|
## Cross-reference with token name objects
|
|
90
92
|
|
|
91
93
|
Token name objects use an `anatomy` field to scope a token to a specific visible part of a component. The `anatomy` field value must correspond to a part declared in the component's `anatomy` array.
|
|
@@ -112,12 +114,13 @@ See [Token format — Name object](token-format.md#name-object) for the full nam
|
|
|
112
114
|
|
|
113
115
|
The following rules in the Layer 2 rule catalog (`rules/rules.yaml`) apply to anatomy part declarations. SPEC-020 was introduced in Phase 6.1 (component-format); SPEC-023, SPEC-024, and SPEC-025 are introduced by this chapter.
|
|
114
116
|
|
|
115
|
-
| Rule ID | Name
|
|
116
|
-
| -------- |
|
|
117
|
-
| SPEC-020 | `component-anatomy-valid`
|
|
118
|
-
| SPEC-023 | `anatomy-custom-part-documented`
|
|
119
|
-
| SPEC-024 | `anatomy-part-name-unique`
|
|
120
|
-
| SPEC-025 | `anatomy-requires-component`
|
|
117
|
+
| Rule ID | Name | Severity | Assert |
|
|
118
|
+
| -------- | --------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
119
|
+
| SPEC-020 | `component-anatomy-valid` | error | Token `anatomy` field value **MUST** match the `name` of a declared anatomy part on the referenced component. |
|
|
120
|
+
| SPEC-023 | `anatomy-custom-part-documented` | warning | Anatomy part declarations with a `name` outside the canonical anatomy vocabulary **SHOULD** include a `description` field documenting the part's purpose. |
|
|
121
|
+
| SPEC-024 | `anatomy-part-name-unique` | error | Anatomy part `name` values **MUST** be unique within a single component's `anatomy` array. |
|
|
122
|
+
| SPEC-025 | `anatomy-requires-component` | error | A token name object **MUST NOT** include an `anatomy` field unless a `component` field is also present. |
|
|
123
|
+
| SPEC-035 | `anatomy-part-name-registry-sync` | warning | A component anatomy part's `name` **SHOULD** appear in the canonical anatomy-terms registry (`anatomy-terms.json`). |
|
|
121
124
|
|
|
122
125
|
## Full example
|
|
123
126
|
|
package/spec/registry.md
CHANGED
|
@@ -33,7 +33,7 @@ Anatomy terms fall into three tiers:
|
|
|
33
33
|
| Component-specific | Unique to one component | `loupe`, `gripper`, `hold-icon` |
|
|
34
34
|
|
|
35
35
|
**File:** `packages/design-system-registry/registry/anatomy-terms.json`\
|
|
36
|
-
**Validated by:** SPEC-020, SPEC-023, SPEC-024, SPEC-025\
|
|
36
|
+
**Validated by:** SPEC-020, SPEC-023, SPEC-024, SPEC-025, SPEC-035 (advisory — anatomy part `name` values SHOULD match the anatomy-terms registry)\
|
|
37
37
|
**See also:** [Taxonomy — Component anatomy vs. token objects](taxonomy.md#component-anatomy-vs-token-objects), [Anatomy format](anatomy-format.md)
|
|
38
38
|
|
|
39
39
|
### Token objects (`token-objects.json`)
|