@adobe/design-data-spec 1.4.0 → 1.5.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/fields/alignment.json +15 -0
- package/package.json +1 -1
- package/rules/rules.yaml +6 -3
- package/schemas/manifest.schema.json +2 -1
- package/spec/taxonomy.md +72 -6
|
@@ -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": "alignment",
|
|
5
|
+
"description": "Horizontal alignment of a text-align token. Corresponds to the CSS text-align axis.",
|
|
6
|
+
"kind": "semantic",
|
|
7
|
+
"registry": "packages/design-system-registry/registry/alignments.json",
|
|
8
|
+
"validation": "advisory",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 25
|
|
11
|
+
},
|
|
12
|
+
"scope": "typography",
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "string"
|
|
15
|
+
}
|
package/package.json
CHANGED
package/rules/rules.yaml
CHANGED
|
@@ -445,13 +445,16 @@ rules:
|
|
|
445
445
|
rfc: "#806"
|
|
446
446
|
assert: >
|
|
447
447
|
When a token's name object contains a domain-scoped field (e.g. `colorFamily`,
|
|
448
|
-
`weight`, `motionRole`), the token's
|
|
449
|
-
|
|
448
|
+
`weight`, `motionRole`), the token's effective domain schema MUST be compatible
|
|
449
|
+
with that field's scope. For alias tokens (`alias.json`), the rule follows the
|
|
450
|
+
`alias_target` chain to the terminal non-alias schema before checking domain
|
|
451
|
+
compatibility — a color alias may carry `colorFamily` when its target is a
|
|
452
|
+
color-domain token. Using a color-scoped field on a typography token, or a
|
|
450
453
|
typography-scoped field on a color token, is a taxonomy violation. The set of
|
|
451
454
|
domain-scoped fields and their valid schema URL suffixes is declared in the field
|
|
452
455
|
catalog under `packages/design-data-spec/fields/` via the `scope` property.
|
|
453
456
|
Tokens without a `$schema` are skipped (domain cannot be determined).
|
|
454
|
-
message: "name.{field} is a {scope}-scoped field but token schema '{
|
|
457
|
+
message: "name.{field} is a {scope}-scoped field but token schema '{effective_schema}' is not a {scope} token type"
|
|
455
458
|
spec_ref: spec/taxonomy.md#token-type-taxonomies
|
|
456
459
|
introduced_in: "1.0.0-draft"
|
|
457
460
|
|
package/spec/taxonomy.md
CHANGED
|
@@ -106,12 +106,13 @@ Typography tokens describe typeface attributes: family, weight, style, and numer
|
|
|
106
106
|
|
|
107
107
|
**NORMATIVE:** Typography tokens SHOULD include at least one of `family`, `weight`, or `style`. Tokens missing all three are flagged by rule SPEC-043 (`domain-required-fields`, warning).
|
|
108
108
|
|
|
109
|
-
| Category
|
|
110
|
-
|
|
|
111
|
-
| Family
|
|
112
|
-
| Weight
|
|
113
|
-
| Style
|
|
114
|
-
|
|
|
109
|
+
| Category | Name object field | Answers | Description |
|
|
110
|
+
| --------- | ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| Family | `family` | What? | Type family of the token (e.g. `sans-serif`, `serif`, `cjk`, `code`). Values come from [`typography-families.json`](../../packages/design-system-registry/registry/typography-families.json). |
|
|
112
|
+
| Weight | `weight` | How? | Typographic weight (e.g. `regular`, `bold`, `light`, `black`). Values come from [`typography-weights.json`](../../packages/design-system-registry/registry/typography-weights.json). |
|
|
113
|
+
| Style | `style` | How? | Typographic style (e.g. `italic`, `oblique`, `normal`). Include `normal` when the token explicitly declares a normal style (e.g. a reset). Values come from [`typography-styles.json`](../../packages/design-system-registry/registry/typography-styles.json). |
|
|
114
|
+
| Alignment | `alignment` | How? | Horizontal text-alignment direction (e.g. `start`, `center`, `end`). Corresponds to the CSS `text-align` axis. Values come from [`alignments.json`](../../packages/design-system-registry/registry/alignments.json). |
|
|
115
|
+
| Scale | `scaleIndex` | Which? | Numeric size scale step (e.g. `75`, `100`, `200`). Shared with other token types; not scope-restricted. |
|
|
115
116
|
|
|
116
117
|
**Default serialization order for typography tokens:**
|
|
117
118
|
|
|
@@ -143,6 +144,33 @@ Motion tokens describe timing, easing, and animation role for UI animation. Thei
|
|
|
143
144
|
|
|
144
145
|
Example: `motionRole=enter` + `easing=ease-out` → `enter-ease-out`. `motionRole=transition` + `scaleIndex=100` → `transition-100`.
|
|
145
146
|
|
|
147
|
+
### Alias / semantic token name objects
|
|
148
|
+
|
|
149
|
+
Alias tokens (`$schema: …/alias.json`) MAY carry name objects using the same field vocabulary
|
|
150
|
+
as their target domain. A color alias carrying `colorFamily` is valid when its alias chain
|
|
151
|
+
resolves to a color-domain schema (`color.json`, `color-set.json`).
|
|
152
|
+
|
|
153
|
+
**NORMATIVE:** SPEC-042 (`field-scope-violation`) evaluates alias tokens by following the
|
|
154
|
+
`alias_target` chain to the terminal non-alias schema, then checking that schema against the
|
|
155
|
+
field's domain. This is the **alias-target-domain** rule: the alias *inherits* its domain
|
|
156
|
+
from what it ultimately resolves to.
|
|
157
|
+
|
|
158
|
+
**Examples:**
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
// icon-color-blue-primary-default ($schema=alias.json, $ref → icon-color-blue-100 which is color-set.json)
|
|
162
|
+
// Valid: colorFamily allowed because target resolves to color domain.
|
|
163
|
+
{ "property": "icon-color", "colorFamily": "blue", "variant": "primary" }
|
|
164
|
+
|
|
165
|
+
// icon-color-primary-default ($schema=alias.json, $ref → icon-color-blue-primary-default)
|
|
166
|
+
// Valid: no domain-scoped fields used — variant and state are universal.
|
|
167
|
+
{ "property": "icon-color", "variant": "primary" }
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**What stays deferred:** alias tokens referencing the same target but carrying modifiers that
|
|
171
|
+
have no current field (e.g. `inverse`, `emphasized`, `subtle`, `subdued`) remain unclassified
|
|
172
|
+
until a color-modifier RFC defines those fields.
|
|
173
|
+
|
|
146
174
|
### Structure vs. component — when does the line move?
|
|
147
175
|
|
|
148
176
|
The `structure` and `component` fields both answer "What?" but apply at different scopes. A useful rule of thumb:
|
|
@@ -244,6 +272,44 @@ The taxonomy and terms are built to scale as new concepts and terms are identifi
|
|
|
244
272
|
* New token type taxonomies **MAY** be added by creating scoped field declarations (non-null `scope`) and a corresponding registry section in taxonomy.md. Color, typography, and motion taxonomies are defined above.
|
|
245
273
|
* Platform manifests **MAY** extend the vocabulary with platform-specific terms and formatting.
|
|
246
274
|
|
|
275
|
+
## Where `name` objects live
|
|
276
|
+
|
|
277
|
+
Token taxonomy data is **decoupled** from the published `@adobe/spectrum-tokens`
|
|
278
|
+
package to avoid bumping the tokens version on every taxonomy change.
|
|
279
|
+
|
|
280
|
+
| Artifact | Location | Description |
|
|
281
|
+
| ----------------- | ----------------------------------- | -------------------------------------------------------------------------------- |
|
|
282
|
+
| Token source data | `packages/tokens/src/*.json` | `$schema`, `value`, `uuid`, `sets`, … — no `name` field |
|
|
283
|
+
| Taxonomy sidecar | `packages/token-names/names/*.json` | `{ "<slug>": { property, colorFamily, … }, … }` — one file per token source file |
|
|
284
|
+
| Field definitions | `packages/design-data-spec/fields/` | Authoritative field catalog with scope and type |
|
|
285
|
+
|
|
286
|
+
The sidecar package (`@adobe/token-names`) is **private** (not published to npm).
|
|
287
|
+
Its delivery format for downstream consumers is TBD.
|
|
288
|
+
|
|
289
|
+
### SDK validator integration
|
|
290
|
+
|
|
291
|
+
Pass `--names-dir packages/token-names/names/` to the `design-data validate` CLI
|
|
292
|
+
to merge sidecar names into the token graph at ingest. All relational rules
|
|
293
|
+
(SPEC-042, SPEC-043, SPEC-018…022, cascade, diff, query) continue to read
|
|
294
|
+
`record.raw["name"]` as if the field were inline:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
cargo run --bin design-data -- validate packages/tokens/src/ \
|
|
298
|
+
--names-dir packages/token-names/names/
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Validation without `--names-dir` is a valid fail-open configuration (name-scope
|
|
302
|
+
rules are silent); CI always supplies the flag.
|
|
303
|
+
|
|
304
|
+
### Regenerating name data
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
node tools/token-corpus-migrate/src/cli.js \
|
|
308
|
+
--root packages/tokens/src \
|
|
309
|
+
--names-out packages/token-names/names \
|
|
310
|
+
--write
|
|
311
|
+
```
|
|
312
|
+
|
|
247
313
|
## References
|
|
248
314
|
|
|
249
315
|
* [#806 — Token Taxonomy, Vocabulary, and Formatting](https://github.com/adobe/spectrum-design-data/discussions/806)
|