@adobe/design-data-spec 0.7.0 → 0.8.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/package.json +1 -1
- package/rules/rules.yaml +24 -0
- package/schemas/anatomy-part.schema.json +6 -0
- package/schemas/component.schema.json +11 -0
- package/schemas/document-block.schema.json +43 -0
- package/schemas/token.schema.json +12 -0
- package/spec/component-format.md +42 -10
- package/spec/document-blocks.md +182 -0
package/package.json
CHANGED
package/rules/rules.yaml
CHANGED
|
@@ -244,3 +244,27 @@ rules:
|
|
|
244
244
|
message: "Component '{component}' tokenBindings references unknown token '{token}'"
|
|
245
245
|
spec_ref: spec/component-format.md#token-bindings
|
|
246
246
|
introduced_in: "1.0.0-draft"
|
|
247
|
+
|
|
248
|
+
- id: SPEC-028
|
|
249
|
+
name: document-block-agents-equals-content
|
|
250
|
+
severity: warning
|
|
251
|
+
category: completeness
|
|
252
|
+
assert: >
|
|
253
|
+
A document block's agents field, when present, SHOULD contain phrasing that differs from
|
|
254
|
+
content. An identical copy provides no agent-specific value and SHOULD be omitted or refined.
|
|
255
|
+
Applies to tokens, components, and anatomy parts.
|
|
256
|
+
message: "'{entity}' has a document block whose agents text is identical to content — tailor it for agent consumption or omit the agents field"
|
|
257
|
+
spec_ref: spec/document-blocks.md
|
|
258
|
+
introduced_in: "1.0.0-draft"
|
|
259
|
+
|
|
260
|
+
- id: SPEC-029
|
|
261
|
+
name: document-block-missing-purpose
|
|
262
|
+
severity: warning
|
|
263
|
+
category: completeness
|
|
264
|
+
assert: >
|
|
265
|
+
An entity that carries a non-empty documentBlocks array SHOULD include at least one block
|
|
266
|
+
with type 'purpose' to document the entity's intent.
|
|
267
|
+
Applies to tokens, components, and anatomy parts.
|
|
268
|
+
message: "'{entity}' has documentBlocks but no purpose block — add a block with type 'purpose'"
|
|
269
|
+
spec_ref: spec/document-blocks.md
|
|
270
|
+
introduced_in: "1.0.0-draft"
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"uniqueItems": true,
|
|
31
31
|
"description": "Informative list of child anatomy part names nested within this part. Does not carry enforcement semantics."
|
|
32
|
+
},
|
|
33
|
+
"documentBlocks": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": { "$ref": "document-block.schema.json" },
|
|
36
|
+
"minItems": 1,
|
|
37
|
+
"description": "Typed prose blocks for this anatomy part. See spec/document-blocks.md (Phase 9)."
|
|
32
38
|
}
|
|
33
39
|
},
|
|
34
40
|
"additionalProperties": false
|
|
@@ -68,6 +68,12 @@
|
|
|
68
68
|
"type": "array",
|
|
69
69
|
"items": { "$ref": "#/$defs/tokenBinding" },
|
|
70
70
|
"description": "Tokens this component uses, including foundation/structure tokens not scoped to the component in their name-object. See spec/component-format.md#token-bindings (Phase 6.7)."
|
|
71
|
+
},
|
|
72
|
+
"documentBlocks": {
|
|
73
|
+
"type": "array",
|
|
74
|
+
"items": { "$ref": "document-block.schema.json" },
|
|
75
|
+
"minItems": 1,
|
|
76
|
+
"description": "Typed prose blocks for this component. See spec/document-blocks.md (Phase 9)."
|
|
71
77
|
}
|
|
72
78
|
},
|
|
73
79
|
"additionalProperties": false,
|
|
@@ -203,6 +209,11 @@
|
|
|
203
209
|
"type": "array",
|
|
204
210
|
"items": { "type": "string" },
|
|
205
211
|
"description": "Informative: anatomy part names nested within this part."
|
|
212
|
+
},
|
|
213
|
+
"documentBlocks": {
|
|
214
|
+
"type": "array",
|
|
215
|
+
"items": { "$ref": "document-block.schema.json" },
|
|
216
|
+
"description": "Typed prose blocks for this anatomy part. See spec/document-blocks.md (Phase 9)."
|
|
206
217
|
}
|
|
207
218
|
},
|
|
208
219
|
"additionalProperties": false
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/document-block.schema.json",
|
|
4
|
+
"title": "Document block",
|
|
5
|
+
"description": "A typed prose block attachable to tokens, components, or anatomy parts. See spec/document-blocks.md.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["type", "content"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"type": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"enum": ["purpose", "guideline", "accessibility", "do-dont", "examples"],
|
|
12
|
+
"description": "Block type. One of: purpose, guideline, accessibility, do-dont, examples."
|
|
13
|
+
},
|
|
14
|
+
"content": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"description": "Human-readable prose for this block."
|
|
18
|
+
},
|
|
19
|
+
"agents": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"minLength": 1,
|
|
22
|
+
"description": "Optional LLM-tuned rephrasing of content for agent consumption. Should differ from content."
|
|
23
|
+
},
|
|
24
|
+
"do": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"minLength": 1,
|
|
27
|
+
"description": "Recommended practice. Meaningful only on do-dont blocks."
|
|
28
|
+
},
|
|
29
|
+
"dont": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 1,
|
|
32
|
+
"description": "Anti-pattern to avoid. Meaningful only on do-dont blocks."
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"if": {
|
|
37
|
+
"properties": { "type": { "const": "do-dont" } },
|
|
38
|
+
"required": ["type"]
|
|
39
|
+
},
|
|
40
|
+
"then": {
|
|
41
|
+
"anyOf": [{ "required": ["do"] }, { "required": ["dont"] }]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -180,6 +180,12 @@
|
|
|
180
180
|
"type": "array",
|
|
181
181
|
"items": { "$ref": "#/$defs/componentBinding" },
|
|
182
182
|
"description": "Reverse index: components that declare this token in their tokenBindings. Optional and derivable from component files."
|
|
183
|
+
},
|
|
184
|
+
"documentBlocks": {
|
|
185
|
+
"type": "array",
|
|
186
|
+
"items": { "$ref": "document-block.schema.json" },
|
|
187
|
+
"minItems": 1,
|
|
188
|
+
"description": "Typed prose blocks for this token. See spec/document-blocks.md (Phase 9)."
|
|
183
189
|
}
|
|
184
190
|
},
|
|
185
191
|
"additionalProperties": false
|
|
@@ -258,6 +264,12 @@
|
|
|
258
264
|
"type": "array",
|
|
259
265
|
"items": { "$ref": "#/$defs/componentBinding" },
|
|
260
266
|
"description": "Reverse index: components that declare this token in their tokenBindings. Optional and derivable from component files."
|
|
267
|
+
},
|
|
268
|
+
"documentBlocks": {
|
|
269
|
+
"type": "array",
|
|
270
|
+
"items": { "$ref": "document-block.schema.json" },
|
|
271
|
+
"minItems": 1,
|
|
272
|
+
"description": "Typed prose blocks for this token. See spec/document-blocks.md (Phase 9)."
|
|
261
273
|
}
|
|
262
274
|
},
|
|
263
275
|
"additionalProperties": false
|
package/spec/component-format.md
CHANGED
|
@@ -29,16 +29,17 @@ A component declaration **MUST** contain:
|
|
|
29
29
|
|
|
30
30
|
### Optional fields
|
|
31
31
|
|
|
32
|
-
| Field
|
|
33
|
-
|
|
|
34
|
-
| `specVersion`
|
|
35
|
-
| `description`
|
|
36
|
-
| `options`
|
|
37
|
-
| `slots`
|
|
38
|
-
| `anatomy`
|
|
39
|
-
| `states`
|
|
40
|
-
| `lifecycle`
|
|
41
|
-
| `tokenBindings`
|
|
32
|
+
| Field | Type | Description |
|
|
33
|
+
| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
34
|
+
| `specVersion` | string | Declares which spec version this document targets. Currently `"1.0.0-draft"`; future stable releases will accept their own version string. |
|
|
35
|
+
| `description` | string | Plain-text description of the component's purpose. |
|
|
36
|
+
| `options` | object | Component API options — see [Options](#options). |
|
|
37
|
+
| `slots` | array | Named content injection points — see [Slots](#slots). |
|
|
38
|
+
| `anatomy` | array | Named anatomy parts — see [Anatomy (stub)](#anatomy-stub). |
|
|
39
|
+
| `states` | array | Per-component state declarations — see [States (stub)](#states-stub). |
|
|
40
|
+
| `lifecycle` | object | Version lifecycle metadata — see [Lifecycle](#lifecycle). |
|
|
41
|
+
| `tokenBindings` | array | Tokens this component uses — see [Token bindings](#token-bindings) (Phase 6.7). |
|
|
42
|
+
| `documentBlocks` | array | Typed prose blocks for this component — see [Document blocks](#document-blocks) (Phase 9). |
|
|
42
43
|
|
|
43
44
|
**NORMATIVE:** No properties beyond those listed above are permitted at the top level of a component declaration. Additional fields **MUST** cause a Layer 1 schema error.
|
|
44
45
|
|
|
@@ -349,3 +350,34 @@ A complete button component declaration:
|
|
|
349
350
|
}
|
|
350
351
|
}
|
|
351
352
|
```
|
|
353
|
+
|
|
354
|
+
## Document blocks
|
|
355
|
+
|
|
356
|
+
**Phase 9.** Component declarations MAY carry a `documentBlocks` array at the top level, and individual anatomy parts MAY carry their own `documentBlocks` arrays. See [spec/document-blocks.md](document-blocks.md) for the full block schema, type vocabulary, and SPEC rules.
|
|
357
|
+
|
|
358
|
+
```json
|
|
359
|
+
{
|
|
360
|
+
"name": "button",
|
|
361
|
+
"displayName": "Button",
|
|
362
|
+
"meta": { "category": "actions", "documentationUrl": "https://spectrum.adobe.com/page/button/" },
|
|
363
|
+
"documentBlocks": [
|
|
364
|
+
{
|
|
365
|
+
"type": "purpose",
|
|
366
|
+
"content": "Buttons trigger a discrete action or event.",
|
|
367
|
+
"agents": "Use Button when the user must trigger an action. For navigation, use Link."
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
"anatomy": [
|
|
371
|
+
{
|
|
372
|
+
"name": "label",
|
|
373
|
+
"required": true,
|
|
374
|
+
"documentBlocks": [
|
|
375
|
+
{
|
|
376
|
+
"type": "guideline",
|
|
377
|
+
"content": "Button labels should be action verbs (Save, Delete, Submit)."
|
|
378
|
+
}
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
```
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Document blocks
|
|
2
|
+
|
|
3
|
+
**Spec version:** `1.0.0-draft` (see [Overview](index.md))
|
|
4
|
+
|
|
5
|
+
This document defines **document blocks**: typed prose objects attachable to tokens, components, and anatomy parts. Blocks carry design guidance — intent, usage rules, accessibility notes, do/don't pairs, and examples — alongside the structured data they describe, making that guidance machine-readable and queryable by agents.
|
|
6
|
+
|
|
7
|
+
Design guidance like "accent backgrounds are for primary CTAs only" or "don't combine `negative` with `subtle`" previously lived in scattered Markdown documents invisible to the spec's resolver, validator, and agent surface. Document blocks attach that prose directly to the entities it describes so it cascades with the tokens and components it governs.
|
|
8
|
+
|
|
9
|
+
Inspired by the [Design System Documentation Spec (DSDS)](https://designsystemdocspec.org/) document-block model.
|
|
10
|
+
|
|
11
|
+
Scoped under RFC-D / Phase 9. See [rfc-coordination.md](../docs/rfc-coordination.md).
|
|
12
|
+
|
|
13
|
+
## Document block shape
|
|
14
|
+
|
|
15
|
+
A document block is a JSON object conforming to [`document-block.schema.json`](../schemas/document-block.schema.json).
|
|
16
|
+
|
|
17
|
+
### Required fields
|
|
18
|
+
|
|
19
|
+
| Field | Type | Description |
|
|
20
|
+
| --------- | ------ | ---------------------------------------- |
|
|
21
|
+
| `type` | string | Block type — one of the five types below |
|
|
22
|
+
| `content` | string | Human-readable prose for this block |
|
|
23
|
+
|
|
24
|
+
### Optional fields
|
|
25
|
+
|
|
26
|
+
| Field | Type | Description |
|
|
27
|
+
| -------- | ------ | ----------------------------------------------------------- |
|
|
28
|
+
| `agents` | string | LLM-tuned rephrasing of `content` for agent consumption |
|
|
29
|
+
| `do` | string | Recommended practice — meaningful only on `do-dont` blocks |
|
|
30
|
+
| `dont` | string | Anti-pattern to avoid — meaningful only on `do-dont` blocks |
|
|
31
|
+
|
|
32
|
+
**NORMATIVE:** `type` and `content` are required on every document block. A block with an empty string for either field **MUST** fail Layer 1 schema validation.
|
|
33
|
+
|
|
34
|
+
**NORMATIVE:** `do` and `dont` are defined on all block shapes (Layer 1 does not restrict them by type), but implementations SHOULD treat them as meaningful only on `do-dont` blocks. Using them on other block types is valid but has no defined semantics.
|
|
35
|
+
|
|
36
|
+
**RECOMMENDED:** When `agents` is present, its content SHOULD differ meaningfully from `content`. An `agents` value identical to `content` provides no agent-specific value and SHOULD be omitted or refined (see SPEC-028).
|
|
37
|
+
|
|
38
|
+
## Block types
|
|
39
|
+
|
|
40
|
+
### `purpose`
|
|
41
|
+
|
|
42
|
+
Describes the intent and design role of the entity. Answers "what is this for?"
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"type": "purpose",
|
|
47
|
+
"content": "Accent background tokens represent the primary brand call-to-action surface. They establish hierarchy by drawing attention to the most important interactive element on screen.",
|
|
48
|
+
"agents": "Use accent-background tokens on the highest-priority interactive element. They signal 'primary action here' to users."
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `guideline`
|
|
53
|
+
|
|
54
|
+
A usage rule or constraint. Answers "how should this be used?"
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"type": "guideline",
|
|
59
|
+
"content": "Accent backgrounds should appear on no more than one element per focal area. Multiple accent surfaces compete for attention and dilute the hierarchy signal."
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### `accessibility`
|
|
64
|
+
|
|
65
|
+
Accessibility notes specific to this entity — contrast behavior, screen reader considerations, or interaction semantics.
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"type": "accessibility",
|
|
70
|
+
"content": "Accent background tokens must maintain a minimum 3:1 contrast ratio against the surface they sit on in both light and dark schemes. The high-contrast dimension variant provides an alternative that meets 4.5:1."
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `do-dont`
|
|
75
|
+
|
|
76
|
+
A paired recommended practice and anti-pattern. The `do` and `dont` fields carry the pairing; `content` provides context or a summary heading.
|
|
77
|
+
|
|
78
|
+
**NORMATIVE:** A `do-dont` block **MUST** include at least one of `do` or `dont`. A `do-dont` block with neither field **MUST** fail Layer 1 schema validation.
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"type": "do-dont",
|
|
83
|
+
"content": "Combining semantic backgrounds",
|
|
84
|
+
"do": "Use accent-background for the primary CTA and informative-background for supporting UI.",
|
|
85
|
+
"dont": "Combine accent-background with negative-background in the same focal area — both are high-attention surfaces and the pairing creates visual conflict."
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### `examples`
|
|
90
|
+
|
|
91
|
+
Concrete usage examples — code snippets, component references, or scenario descriptions.
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"type": "examples",
|
|
96
|
+
"content": "A primary Button uses accent-background-color-default. A disabled Button uses gray-background-color-default. A destructive Button uses negative-background-color-default."
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Attachment points
|
|
101
|
+
|
|
102
|
+
**NORMATIVE:** Document blocks MAY be attached to the following entities. When `documentBlocks` is present, it **MUST** contain at least one block — an empty array **MUST** fail Layer 1 schema validation.
|
|
103
|
+
|
|
104
|
+
### Tokens
|
|
105
|
+
|
|
106
|
+
Add a `documentBlocks` array at the top level of a token object:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"name": { "property": "background-color", "variant": "accent" },
|
|
111
|
+
"value": "#0265DC",
|
|
112
|
+
"documentBlocks": [
|
|
113
|
+
{
|
|
114
|
+
"type": "purpose",
|
|
115
|
+
"content": "Primary call-to-action background. Use for the most important interactive element in a focal area."
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"type": "guideline",
|
|
119
|
+
"content": "Limit to one accent background per focal area to preserve hierarchy."
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Components
|
|
126
|
+
|
|
127
|
+
Add a `documentBlocks` array at the top level of a component declaration:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"name": "button",
|
|
132
|
+
"displayName": "Button",
|
|
133
|
+
"meta": { "category": "actions", "documentationUrl": "https://spectrum.adobe.com/page/button/" },
|
|
134
|
+
"documentBlocks": [
|
|
135
|
+
{
|
|
136
|
+
"type": "purpose",
|
|
137
|
+
"content": "Buttons trigger an action or event, such as submitting a form, opening a dialog, or performing a destructive operation.",
|
|
138
|
+
"agents": "Use Button when the user needs to trigger a discrete action. For navigation, use a Link instead."
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Anatomy parts
|
|
145
|
+
|
|
146
|
+
Add a `documentBlocks` array within an anatomy part object:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"name": "label",
|
|
151
|
+
"required": true,
|
|
152
|
+
"description": "Button text visible to the user.",
|
|
153
|
+
"documentBlocks": [
|
|
154
|
+
{
|
|
155
|
+
"type": "guideline",
|
|
156
|
+
"content": "Button labels should be action verbs (Save, Delete, Submit). Avoid noun-only labels like 'Confirmation'."
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## SPEC rules
|
|
163
|
+
|
|
164
|
+
| Rule ID | Severity | Name | Assert |
|
|
165
|
+
| -------- | -------- | ------------------------------------ | ------------------------------------------------------------------------ |
|
|
166
|
+
| SPEC-028 | warning | document-block-agents-equals-content | A block's `agents` field SHOULD differ from `content` |
|
|
167
|
+
| SPEC-029 | warning | document-block-missing-purpose | An entity with `documentBlocks` SHOULD have at least one `purpose` block |
|
|
168
|
+
|
|
169
|
+
Both rules are `warning` severity — they do not block validation.
|
|
170
|
+
|
|
171
|
+
## `agents` field guidance
|
|
172
|
+
|
|
173
|
+
The `agents` field exists to let documentation authors provide LLM-optimized phrasing alongside human prose. Human content may use visual formatting cues, assumed visual context, or prose conventions that agents process poorly. The `agents` field carries alternative phrasing tuned for programmatic consumption.
|
|
174
|
+
|
|
175
|
+
**RECOMMENDED:** `agents` text SHOULD:
|
|
176
|
+
|
|
177
|
+
* Omit references to visual appearance that agents cannot act on ("the blue button")
|
|
178
|
+
* Use explicit, unambiguous phrasing ("Use Button when triggering an action, not Link")
|
|
179
|
+
* Include the token or component name explicitly rather than relying on surrounding context
|
|
180
|
+
* Be shorter and more directive than `content` where possible
|
|
181
|
+
|
|
182
|
+
When no agent-specific rephrasing is needed, omit the `agents` field entirely. A duplicate of `content` adds size with no benefit.
|