@adobe/design-data-spec 0.1.1 → 0.3.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/README.md +3 -3
- package/components/button.json +70 -0
- package/conformance/README.md +0 -1
- package/conformance/invalid/SPEC-016/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-016/tokens.tokens.json +8 -0
- package/conformance/invalid/SPEC-017/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-017/tokens.tokens.json +7 -0
- package/conformance/invalid/SPEC-018/dataset.json +9 -0
- package/conformance/invalid/SPEC-018/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-019/dataset.json +29 -0
- package/conformance/invalid/SPEC-019/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-020/dataset.json +27 -0
- package/conformance/invalid/SPEC-020/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-021/dataset.json +18 -0
- package/conformance/invalid/SPEC-021/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-022/dataset.json +33 -0
- package/conformance/invalid/SPEC-022/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-023/dataset.json +18 -0
- package/conformance/invalid/SPEC-023/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-024/dataset.json +18 -0
- package/conformance/invalid/SPEC-024/expected-errors.json +10 -0
- package/conformance/valid/component-refs/dataset.json +63 -0
- package/conformance/valid/composite-drop-shadow.json +14 -0
- package/conformance/valid/composite-typography-scale.json +6 -0
- package/conformance/valid/composite-typography.json +12 -0
- package/conformance/valid/string-name-escape-hatch.json +7 -0
- package/fields/scaleIndex.json +15 -0
- package/package.json +18 -6
- package/rules/rules.yaml +113 -5
- package/schemas/anatomy-part.schema.json +35 -0
- package/schemas/component.schema.json +267 -0
- package/schemas/field.schema.json +2 -2
- package/schemas/state-declaration.schema.json +36 -0
- package/schemas/token.schema.json +26 -10
- package/schemas/value-types/drop-shadow.schema.json +20 -0
- package/schemas/value-types/typography-scale.schema.json +13 -0
- package/schemas/value-types/typography.schema.json +16 -0
- package/spec/agent-surface.md +116 -0
- package/spec/anatomy-format.md +167 -0
- package/spec/component-format.md +326 -0
- package/spec/evolution.md +0 -1
- package/spec/index.md +27 -21
- package/spec/state-model.md +245 -0
- package/spec/token-format.md +80 -15
- package/src/canonical.js +61 -0
- package/src/validate.js +166 -0
package/README.md
CHANGED
|
@@ -16,9 +16,9 @@ Normative **Design Data Specification** artifacts for Spectrum: human-readable s
|
|
|
16
16
|
|
|
17
17
|
## Tasks
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
* `moon run design-data-spec:check` — verify required paths exist (layout guard).
|
|
20
20
|
|
|
21
21
|
## References
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
* [Design Data Specification project](https://github.com/orgs/adobe/projects/89)
|
|
24
|
+
* Discussion [#714](https://github.com/adobe/spectrum-design-data/discussions/714) — umbrella spec
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/component.schema.json",
|
|
3
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
4
|
+
"specVersion": "1.0.0-draft",
|
|
5
|
+
"name": "button",
|
|
6
|
+
"displayName": "Button",
|
|
7
|
+
"description": "Buttons allow users to perform an action or to navigate to another page.",
|
|
8
|
+
"meta": {
|
|
9
|
+
"category": "actions",
|
|
10
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
11
|
+
},
|
|
12
|
+
"options": {
|
|
13
|
+
"variant": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": ["accent", "negative", "primary", "secondary"],
|
|
16
|
+
"default": "accent",
|
|
17
|
+
"description": "Visual emphasis level."
|
|
18
|
+
},
|
|
19
|
+
"style": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"enum": ["fill", "outline"],
|
|
22
|
+
"default": "fill"
|
|
23
|
+
},
|
|
24
|
+
"size": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["s", "m", "l", "xl"],
|
|
27
|
+
"default": "m"
|
|
28
|
+
},
|
|
29
|
+
"isDisabled": { "type": "boolean", "default": false },
|
|
30
|
+
"isPending": { "type": "boolean", "default": false },
|
|
31
|
+
"isLabelHidden": { "type": "boolean", "default": false },
|
|
32
|
+
"icon": {
|
|
33
|
+
"$ref": "https://opensource.adobe.com/spectrum-design-data/schemas/types/workflow-icon.json",
|
|
34
|
+
"description": "Icon placed at the start of the button. Required when isLabelHidden is true."
|
|
35
|
+
},
|
|
36
|
+
"staticColor": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": ["white", "black"],
|
|
39
|
+
"description": "Static color for use on colored backgrounds."
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"slots": [
|
|
43
|
+
{
|
|
44
|
+
"name": "default",
|
|
45
|
+
"description": "Text label of the button.",
|
|
46
|
+
"required": false
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "icon",
|
|
50
|
+
"description": "Icon placed at the start of the button."
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"anatomy": [
|
|
54
|
+
{ "name": "icon", "description": "Leading icon." },
|
|
55
|
+
{ "name": "label", "description": "Button text.", "required": true }
|
|
56
|
+
],
|
|
57
|
+
"states": [
|
|
58
|
+
{ "name": "hover", "trigger": "interaction", "precedence": 50 },
|
|
59
|
+
{
|
|
60
|
+
"name": "focus",
|
|
61
|
+
"trigger": "interaction",
|
|
62
|
+
"precedence": 60,
|
|
63
|
+
"layered": true
|
|
64
|
+
},
|
|
65
|
+
{ "name": "disabled", "trigger": "prop", "precedence": 100 }
|
|
66
|
+
],
|
|
67
|
+
"lifecycle": {
|
|
68
|
+
"introduced": "1.0.0-draft"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/conformance/README.md
CHANGED
|
@@ -16,7 +16,6 @@ Each **invalid** case lives under `invalid/<RULE_ID>/` with:
|
|
|
16
16
|
| `invalid/SPEC-005` | SPEC-005 | Dimension `default` not in `modes`. |
|
|
17
17
|
| `invalid/SPEC-006` | SPEC-006 | Ambiguous resolution / specificity tie (warning). |
|
|
18
18
|
| `invalid/SPEC-008` | SPEC-008 | Non-default mode variants with no base/default variant. |
|
|
19
|
-
| `invalid/SPEC-014` | SPEC-014 | `lastModified` semver precedes `introduced`. |
|
|
20
19
|
|
|
21
20
|
Implementors SHOULD run these fixtures once the Rust validator exposes rule IDs ([#724](https://github.com/adobe/spectrum-design-data/issues/724), [#725](https://github.com/adobe/spectrum-design-data/issues/725)).
|
|
22
21
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"name": {
|
|
5
|
+
"component": "button",
|
|
6
|
+
"variant": "electric",
|
|
7
|
+
"property": "background-color"
|
|
8
|
+
},
|
|
9
|
+
"value": "#0000ff"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"components": [
|
|
13
|
+
{
|
|
14
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
15
|
+
"name": "button",
|
|
16
|
+
"displayName": "Button",
|
|
17
|
+
"meta": {
|
|
18
|
+
"category": "actions",
|
|
19
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
20
|
+
},
|
|
21
|
+
"options": {
|
|
22
|
+
"variant": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"enum": ["accent", "negative", "primary", "secondary"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"name": {
|
|
5
|
+
"component": "button",
|
|
6
|
+
"anatomy": "capsule",
|
|
7
|
+
"property": "background-color"
|
|
8
|
+
},
|
|
9
|
+
"value": "#ff0000"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"components": [
|
|
13
|
+
{
|
|
14
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
15
|
+
"name": "button",
|
|
16
|
+
"displayName": "Button",
|
|
17
|
+
"meta": {
|
|
18
|
+
"category": "actions",
|
|
19
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
20
|
+
},
|
|
21
|
+
"anatomy": [
|
|
22
|
+
{ "name": "icon", "description": "Leading icon." },
|
|
23
|
+
{ "name": "label", "description": "Button text.", "required": true }
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [],
|
|
3
|
+
"components": [
|
|
4
|
+
{
|
|
5
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
6
|
+
"name": "button",
|
|
7
|
+
"displayName": "Button",
|
|
8
|
+
"meta": {
|
|
9
|
+
"category": "actions",
|
|
10
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
11
|
+
},
|
|
12
|
+
"slots": [
|
|
13
|
+
{ "name": "default", "description": "Text label of the button." },
|
|
14
|
+
{ "name": "badge" }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"name": {
|
|
5
|
+
"component": "button",
|
|
6
|
+
"state": "jello",
|
|
7
|
+
"property": "background-color"
|
|
8
|
+
},
|
|
9
|
+
"value": "#ff0000"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"components": [
|
|
13
|
+
{
|
|
14
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
15
|
+
"name": "button",
|
|
16
|
+
"displayName": "Button",
|
|
17
|
+
"meta": {
|
|
18
|
+
"category": "actions",
|
|
19
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
20
|
+
},
|
|
21
|
+
"states": [
|
|
22
|
+
{ "name": "hover", "trigger": "interaction", "precedence": 50 },
|
|
23
|
+
{
|
|
24
|
+
"name": "focus",
|
|
25
|
+
"trigger": "interaction",
|
|
26
|
+
"precedence": 60,
|
|
27
|
+
"layered": true
|
|
28
|
+
},
|
|
29
|
+
{ "name": "disabled", "trigger": "prop", "precedence": 100 }
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [],
|
|
3
|
+
"components": [
|
|
4
|
+
{
|
|
5
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
6
|
+
"name": "button",
|
|
7
|
+
"displayName": "Button",
|
|
8
|
+
"meta": {
|
|
9
|
+
"category": "actions",
|
|
10
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
11
|
+
},
|
|
12
|
+
"anatomy": [
|
|
13
|
+
{ "name": "label", "description": "Button text.", "required": true },
|
|
14
|
+
{ "name": "shimmer" }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [],
|
|
3
|
+
"components": [
|
|
4
|
+
{
|
|
5
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
6
|
+
"name": "button",
|
|
7
|
+
"displayName": "Button",
|
|
8
|
+
"meta": {
|
|
9
|
+
"category": "actions",
|
|
10
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
11
|
+
},
|
|
12
|
+
"states": [
|
|
13
|
+
{ "name": "hover", "trigger": "interaction", "precedence": 50 },
|
|
14
|
+
{ "name": "wobble" }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{
|
|
4
|
+
"name": {
|
|
5
|
+
"component": "button",
|
|
6
|
+
"variant": "accent",
|
|
7
|
+
"property": "background-color"
|
|
8
|
+
},
|
|
9
|
+
"value": "#0265dc"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": {
|
|
13
|
+
"component": "button",
|
|
14
|
+
"anatomy": "label",
|
|
15
|
+
"property": "color"
|
|
16
|
+
},
|
|
17
|
+
"value": "#ffffff"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": {
|
|
21
|
+
"component": "button",
|
|
22
|
+
"state": "hover",
|
|
23
|
+
"property": "background-color"
|
|
24
|
+
},
|
|
25
|
+
"value": "#0255be"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"components": [
|
|
29
|
+
{
|
|
30
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/button.json",
|
|
31
|
+
"name": "button",
|
|
32
|
+
"displayName": "Button",
|
|
33
|
+
"meta": {
|
|
34
|
+
"category": "actions",
|
|
35
|
+
"documentationUrl": "https://spectrum.adobe.com/page/button/"
|
|
36
|
+
},
|
|
37
|
+
"options": {
|
|
38
|
+
"variant": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"enum": ["accent", "negative", "primary", "secondary"]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"slots": [
|
|
44
|
+
{ "name": "default", "description": "Text label of the button." },
|
|
45
|
+
{ "name": "icon", "description": "Leading icon." }
|
|
46
|
+
],
|
|
47
|
+
"anatomy": [
|
|
48
|
+
{ "name": "icon", "description": "Leading icon." },
|
|
49
|
+
{ "name": "label", "description": "Button text.", "required": true }
|
|
50
|
+
],
|
|
51
|
+
"states": [
|
|
52
|
+
{ "name": "hover", "trigger": "interaction", "precedence": 50 },
|
|
53
|
+
{
|
|
54
|
+
"name": "focus",
|
|
55
|
+
"trigger": "interaction",
|
|
56
|
+
"precedence": 60,
|
|
57
|
+
"layered": true
|
|
58
|
+
},
|
|
59
|
+
{ "name": "disabled", "trigger": "prop", "precedence": 100 }
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": { "property": "drop-shadow-default" },
|
|
3
|
+
"$valueType": "value-types/drop-shadow.schema.json",
|
|
4
|
+
"value": [
|
|
5
|
+
{
|
|
6
|
+
"x": "0px",
|
|
7
|
+
"y": "1px",
|
|
8
|
+
"blur": "4px",
|
|
9
|
+
"spread": "0px",
|
|
10
|
+
"color": "rgba(0, 0, 0, 0.16)"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"uuid": "aaaaaaaa-0010-4000-8000-000000000002"
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": { "property": "component-m-regular" },
|
|
3
|
+
"$valueType": "value-types/typography.schema.json",
|
|
4
|
+
"value": {
|
|
5
|
+
"fontFamily": "{sans-serif-font-family}",
|
|
6
|
+
"fontSize": "{font-size-100}",
|
|
7
|
+
"fontWeight": "{regular-font-weight}",
|
|
8
|
+
"letterSpacing": "{letter-spacing}",
|
|
9
|
+
"lineHeight": "{line-height-font-size-100}"
|
|
10
|
+
},
|
|
11
|
+
"uuid": "aaaaaaaa-0010-4000-8000-000000000001"
|
|
12
|
+
}
|
|
@@ -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": "scaleIndex",
|
|
5
|
+
"description": "Numeric scale index appended at the end of the serialized name (e.g., 100, 200, 900). Used by foundational scale tokens for spacing, color palette, font sizes, border widths, corner radii, and drop-shadow values.",
|
|
6
|
+
"kind": "numeric",
|
|
7
|
+
"registry": null,
|
|
8
|
+
"validation": "none",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 16
|
|
11
|
+
},
|
|
12
|
+
"scope": null,
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "integer"
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/design-data-spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Design Data Specification — prose, JSON Schemas, rule catalog, and conformance fixtures for Spectrum design data",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -25,15 +25,27 @@
|
|
|
25
25
|
"./schemas/field.schema.json": "./schemas/field.schema.json",
|
|
26
26
|
"./schemas/manifest.schema.json": "./schemas/manifest.schema.json",
|
|
27
27
|
"./schemas/value-types/color.schema.json": "./schemas/value-types/color.schema.json",
|
|
28
|
-
"./
|
|
28
|
+
"./schemas/component.schema.json": "./schemas/component.schema.json",
|
|
29
|
+
"./schemas/anatomy-part.schema.json": "./schemas/anatomy-part.schema.json",
|
|
30
|
+
"./schemas/state-declaration.schema.json": "./schemas/state-declaration.schema.json",
|
|
31
|
+
"./rules/rules.yaml": "./rules/rules.yaml",
|
|
32
|
+
"./src/validate.js": "./src/validate.js",
|
|
33
|
+
"./src/canonical.js": "./src/canonical.js"
|
|
29
34
|
},
|
|
30
35
|
"files": [
|
|
31
|
-
"
|
|
32
|
-
"
|
|
36
|
+
"components",
|
|
37
|
+
"conformance",
|
|
33
38
|
"fields",
|
|
34
39
|
"rules",
|
|
35
|
-
"
|
|
40
|
+
"schemas",
|
|
41
|
+
"spec",
|
|
42
|
+
"src",
|
|
36
43
|
"README.md"
|
|
37
44
|
],
|
|
38
|
-
"
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"ava": "^6.0.1"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"test": "ava"
|
|
50
|
+
}
|
|
39
51
|
}
|