@adobe/design-data-spec 0.9.0 → 0.10.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/components/accordion.json +18 -1
- package/components/action-bar.json +12 -1
- package/components/action-button.json +19 -1
- package/components/action-group.json +12 -1
- package/components/alert-banner.json +11 -1
- package/components/alert-dialog.json +19 -1
- package/components/avatar-group.json +4 -1
- package/components/avatar.json +4 -1
- package/components/badge.json +4 -1
- package/components/body.json +3 -0
- package/components/bottom-navigation-android.json +17 -0
- package/components/breadcrumbs.json +19 -2
- package/components/button-group.json +12 -1
- package/components/button.json +21 -3
- package/components/calendar.json +22 -0
- package/components/cards.json +18 -1
- package/components/checkbox-group.json +17 -1
- package/components/checkbox.json +24 -1
- package/components/close-button.json +19 -1
- package/components/coach-indicator.json +4 -1
- package/components/coach-mark.json +13 -1
- package/components/code.json +3 -0
- package/components/color-area.json +24 -1
- package/components/color-handle.json +13 -1
- package/components/color-loupe.json +4 -1
- package/components/color-slider.json +24 -1
- package/components/color-wheel.json +24 -1
- package/components/combo-box.json +24 -1
- package/components/contextual-help.json +18 -1
- package/components/date-picker.json +23 -1
- package/components/detail.json +3 -0
- package/components/divider.json +4 -1
- package/components/drop-zone.json +18 -1
- package/components/field-label.json +4 -1
- package/components/heading.json +3 -0
- package/components/help-text.json +5 -2
- package/components/illustrated-message.json +4 -1
- package/components/in-field-progress-button.json +18 -0
- package/components/in-field-progress-circle.json +4 -1
- package/components/in-line-alert.json +11 -1
- package/components/link.json +19 -1
- package/components/list-view.json +18 -1
- package/components/menu.json +19 -1
- package/components/meter.json +4 -1
- package/components/number-field.json +24 -1
- package/components/opacity-checkerboard.json +4 -1
- package/components/picker.json +24 -1
- package/components/popover.json +12 -1
- package/components/progress-bar.json +4 -1
- package/components/progress-circle.json +4 -1
- package/components/radio-button.json +24 -1
- package/components/radio-group.json +17 -1
- package/components/rating.json +24 -1
- package/components/scroll-zoom-bar.json +12 -0
- package/components/search-field.json +28 -1
- package/components/segmented-control.json +18 -1
- package/components/select-box.json +18 -1
- package/components/side-navigation.json +18 -1
- package/components/slider.json +24 -1
- package/components/standard-dialog.json +19 -1
- package/components/standard-panel.json +3 -0
- package/components/status-light.json +4 -1
- package/components/steplist.json +18 -1
- package/components/swatch-group.json +12 -1
- package/components/swatch.json +18 -1
- package/components/switch.json +19 -1
- package/components/tab-bar-ios.json +17 -0
- package/components/table.json +23 -1
- package/components/tabs.json +18 -1
- package/components/tag-field.json +18 -1
- package/components/tag-group.json +18 -1
- package/components/tag.json +18 -1
- package/components/takeover-dialog.json +19 -1
- package/components/text-area.json +28 -1
- package/components/text-field.json +28 -1
- package/components/thumbnail.json +4 -1
- package/components/title.json +40 -10
- package/components/toast.json +13 -1
- package/components/tooltip.json +17 -1
- package/components/tray.json +11 -0
- package/components/tree-view.json +19 -1
- package/conformance/README.md +7 -7
- package/conformance/invalid/SPEC-001/dataset.json +10 -0
- package/conformance/invalid/SPEC-001/expected-errors.json +1 -1
- package/conformance/invalid/SPEC-002/dataset.json +16 -0
- package/conformance/invalid/SPEC-002/expected-errors.json +1 -1
- package/conformance/invalid/SPEC-003/dataset.json +15 -0
- package/conformance/invalid/SPEC-003/expected-errors.json +1 -1
- package/conformance/invalid/SPEC-004/dataset.json +15 -0
- package/conformance/invalid/SPEC-004/expected-errors.json +1 -1
- package/conformance/invalid/SPEC-005/dataset.json +11 -0
- package/conformance/invalid/SPEC-005/expected-errors.json +1 -1
- package/conformance/invalid/SPEC-006/dataset.json +15 -0
- package/conformance/invalid/SPEC-006/expected-errors.json +1 -1
- package/conformance/invalid/SPEC-007/dataset.json +9 -0
- package/conformance/invalid/SPEC-007/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-008/dataset.json +25 -0
- package/conformance/invalid/SPEC-008/expected-errors.json +2 -1
- package/conformance/invalid/SPEC-009/dataset.json +12 -0
- package/conformance/invalid/SPEC-009/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-010/dataset.json +12 -0
- package/conformance/invalid/SPEC-011/dataset.json +25 -0
- package/conformance/invalid/SPEC-012/dataset.json +16 -0
- package/conformance/invalid/SPEC-013/dataset.json +11 -0
- package/conformance/invalid/SPEC-014/dataset.json +12 -0
- package/conformance/invalid/SPEC-014/expected-errors.json +1 -1
- package/conformance/invalid/SPEC-015/dataset.json +22 -0
- package/conformance/invalid/SPEC-015/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-015/tokens.tokens.json +19 -0
- package/conformance/invalid/SPEC-016/dataset.json +11 -0
- package/conformance/invalid/SPEC-016/expected-errors.json +2 -2
- package/conformance/invalid/SPEC-017/dataset.json +10 -0
- package/conformance/invalid/SPEC-024/dataset.json +4 -3
- package/conformance/invalid/SPEC-024/expected-errors.json +2 -2
- package/conformance/invalid/SPEC-025/dataset.json +12 -0
- package/conformance/invalid/SPEC-025/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-026/dataset.json +18 -0
- package/conformance/invalid/SPEC-026/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-028/dataset.json +21 -0
- package/conformance/invalid/SPEC-028/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-029/dataset.json +20 -0
- package/conformance/invalid/SPEC-029/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-030/dataset.json +15 -0
- package/conformance/invalid/SPEC-030/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-031/dataset.json +17 -0
- package/conformance/invalid/SPEC-031/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-032/dataset.json +27 -0
- package/conformance/invalid/SPEC-032/expected-errors.json +15 -0
- package/conformance/resolution/base-fallback/expected.json +1 -1
- package/conformance/resolution/product-layer-wins/expected.json +5 -0
- package/conformance/resolution/product-layer-wins/input/tokens.tokens.json +7 -0
- package/conformance/resolution/product-layer-wins/product-context.json +11 -0
- package/conformance/resolution/product-layer-wins/query.json +4 -0
- package/conformance/resolution/specificity-wins/expected.json +1 -1
- package/conformance/valid/SPEC-014/dataset.json +12 -0
- package/conformance/valid/SPEC-016/dataset.json +16 -0
- package/conformance/valid/SPEC-025/dataset.json +24 -0
- package/conformance/valid/SPEC-026/dataset.json +15 -0
- package/conformance/valid/SPEC-028/dataset.json +21 -0
- package/conformance/valid/SPEC-029/dataset.json +24 -0
- package/conformance/valid/SPEC-030/dataset.json +17 -0
- package/conformance/valid/SPEC-031/dataset.json +24 -0
- package/conformance/valid/SPEC-032/dataset.json +16 -0
- package/conformance/valid/component-refs/README.md +5 -0
- package/conformance/valid/component-with-accessibility.json +32 -0
- package/fields/color-scheme.json +2 -2
- package/fields/contrast.json +2 -2
- package/fields/density.json +1 -1
- package/fields/scale.json +2 -2
- package/fields/size.json +1 -1
- package/package.json +4 -13
- package/rules/rules.yaml +40 -4
- package/schemas/accessibility.schema.json +60 -0
- package/schemas/component.schema.json +19 -0
- package/schemas/field.schema.json +2 -2
- package/schemas/manifest.schema.json +1 -1
- package/schemas/{dimension.schema.json → mode-set.schema.json} +3 -3
- package/schemas/token.schema.json +5 -5
- package/schemas/value-types/README.md +20 -0
- package/schemas/value-types/drop-shadow.schema.json +5 -5
- package/schemas/value-types/typography-scale.schema.json +2 -2
- package/schemas/value-types/typography.schema.json +5 -5
- package/spec/accessibility-adapters.md +219 -0
- package/spec/agent-surface.md +4 -4
- package/spec/cascade.md +7 -7
- package/spec/component-format.md +32 -0
- package/spec/document-blocks.md +1 -1
- package/spec/index.md +22 -20
- package/spec/manifest.md +2 -2
- package/spec/mode-sets.md +64 -0
- package/spec/query.md +18 -18
- package/spec/taxonomy.md +5 -5
- package/spec/token-format.md +12 -12
- package/spec/dimensions.md +0 -64
- package/src/canonical.js +0 -61
- package/src/validate.js +0 -190
- /package/conformance/resolution/alias-resolved-after-cascade/{dimensions → mode-sets}/color-scheme.json +0 -0
- /package/conformance/resolution/base-fallback/{dimensions → mode-sets}/color-scheme.json +0 -0
- /package/conformance/resolution/specificity-wins/{dimensions → mode-sets}/color-scheme.json +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Accessibility adapters
|
|
2
|
+
|
|
3
|
+
**Spec version:** `1.0.0-draft` (see [Overview](index.md))
|
|
4
|
+
|
|
5
|
+
> **This chapter is informative.** It provides guidance for platform adapter repos; it does not add normative constraints to the foundation spec.
|
|
6
|
+
|
|
7
|
+
This chapter shows how the semantic accessibility vocabulary defined in [Accessibility](accessibility.md) maps to real platform APIs across web (ARIA), iOS (UIAccessibility), Android (AccessibilityNodeInfo), and voice/multimodal surfaces. Platform adapter repos use this as a translation contract when implementing accessibility support for Spectrum components. The foundation layer ships intent; adapters ship the platform binding.
|
|
8
|
+
|
|
9
|
+
Scoped under planned RFC-B. See [rfc-coordination.md](../docs/rfc-coordination.md).
|
|
10
|
+
|
|
11
|
+
## Adapter overview
|
|
12
|
+
|
|
13
|
+
A platform adapter repo declares which foundation components it supports and implements a mapping layer that translates each component's `accessibility` declaration to the platform's native accessibility API. When a field is absent from a component's `accessibility` declaration, the adapter falls back to its own defaults or omits the attribute.
|
|
14
|
+
|
|
15
|
+
Adapters are not required to implement every field — a minimal adapter might only handle `role` and `focusable`. The fields documented below describe what each foundation field means at the platform layer when the adapter chooses to implement it.
|
|
16
|
+
|
|
17
|
+
## Web / ARIA
|
|
18
|
+
|
|
19
|
+
ARIA (Accessible Rich Internet Applications) is the primary web accessibility API. Adapters set HTML `role` attributes and `aria-*` state properties on the root element or on relevant sub-elements.
|
|
20
|
+
|
|
21
|
+
### `role`
|
|
22
|
+
|
|
23
|
+
| Foundation `role` | ARIA / HTML equivalent |
|
|
24
|
+
| ----------------- | ---------------------------------------------- |
|
|
25
|
+
| `button` | `<button>` or `role="button"` |
|
|
26
|
+
| `checkbox` | `<input type="checkbox">` or `role="checkbox"` |
|
|
27
|
+
| `combobox` | `role="combobox"` |
|
|
28
|
+
| `dialog` | `role="dialog"` |
|
|
29
|
+
| `link` | `<a href>` or `role="link"` |
|
|
30
|
+
| `listbox` | `role="listbox"` |
|
|
31
|
+
| `menu` | `role="menu"` |
|
|
32
|
+
| `menuitem` | `role="menuitem"` |
|
|
33
|
+
| `radio` | `<input type="radio">` or `role="radio"` |
|
|
34
|
+
| `slider` | `role="slider"` |
|
|
35
|
+
| `spinbutton` | `role="spinbutton"` |
|
|
36
|
+
| `switch` | `role="switch"` |
|
|
37
|
+
| `tab` | `role="tab"` |
|
|
38
|
+
| `textbox` | `<input type="text">` or `role="textbox"` |
|
|
39
|
+
| `tooltip` | `role="tooltip"` |
|
|
40
|
+
| `tree` | `role="tree"` |
|
|
41
|
+
|
|
42
|
+
### `intents`
|
|
43
|
+
|
|
44
|
+
| Foundation intent | Web guidance |
|
|
45
|
+
| ----------------- | ------------------------------------------------------------------------------------------------- |
|
|
46
|
+
| `trigger` | Ensure the element has an accessible name via `aria-label`, `aria-labelledby`, or a visible label |
|
|
47
|
+
| `select` | Set `aria-selected` on child options; the container gets `role="listbox"` or `role="combobox"` |
|
|
48
|
+
| `navigate` | Use `<a href>` or `role="link"`; ensure the destination is announced |
|
|
49
|
+
| `expand` | Set `aria-expanded="true"` / `"false"` on the trigger element |
|
|
50
|
+
| `collapse` | Toggle `aria-expanded` to `"false"` |
|
|
51
|
+
| `input` | Associate a visible `<label>` or `aria-label`; use `aria-describedby` for hints |
|
|
52
|
+
| `choose` | Use `aria-valuenow`, `aria-valuemin`, `aria-valuemax` for range inputs |
|
|
53
|
+
| `dismiss` | Return focus to the trigger element on close; announce the closure if needed |
|
|
54
|
+
|
|
55
|
+
### `focusable`
|
|
56
|
+
|
|
57
|
+
* `true` → set `tabindex="0"` on the root element, or use a natively focusable HTML element.
|
|
58
|
+
* `false` → set `tabindex="-1"` for elements that receive programmatic focus; use `aria-hidden="true"` for purely decorative elements. For roving-tabindex composites (radio groups, toolbars, tree views), the adapter manages which child holds `tabindex="0"`.
|
|
59
|
+
|
|
60
|
+
### `keyboardIntents`
|
|
61
|
+
|
|
62
|
+
| Foundation intent | Conventional key binding |
|
|
63
|
+
| ------------------ | ------------------------------------- |
|
|
64
|
+
| `activate` | Enter, Space |
|
|
65
|
+
| `expand` | ArrowDown, Enter, Space |
|
|
66
|
+
| `collapse` | Escape, ArrowUp |
|
|
67
|
+
| `navigate-options` | ArrowUp, ArrowDown |
|
|
68
|
+
| `navigate-items` | ArrowLeft, ArrowRight |
|
|
69
|
+
| `increment` | ArrowUp, ArrowRight |
|
|
70
|
+
| `decrement` | ArrowDown, ArrowLeft |
|
|
71
|
+
| `dismiss` | Escape |
|
|
72
|
+
| `select-all` | Ctrl+A (Windows/Linux), Cmd+A (macOS) |
|
|
73
|
+
|
|
74
|
+
Key bindings shown are conventional. Web adapters should follow the ARIA Authoring Practices Guide patterns for the component's `role`.
|
|
75
|
+
|
|
76
|
+
### `wcag`
|
|
77
|
+
|
|
78
|
+
The `wcag` array is developer guidance at the web layer, not an automated attribute. Web adapter implementations should:
|
|
79
|
+
|
|
80
|
+
* Include listed criteria in component documentation.
|
|
81
|
+
* Add automated accessibility tests (e.g., axe-core) that target listed criteria.
|
|
82
|
+
* Flag in PR checklists when changes may affect listed criteria.
|
|
83
|
+
|
|
84
|
+
### State fields
|
|
85
|
+
|
|
86
|
+
* `announce` → set `aria-live="polite"` (or `"assertive"` for urgent transitions) on a live region element and inject the `announce` text on state entry.
|
|
87
|
+
* `communicates` → map to the corresponding `aria-*` state attribute (e.g., `"expanded"` → `aria-expanded="true"`). See the `communicates` vocabulary table in [Accessibility](accessibility.md#communicates).
|
|
88
|
+
* `blocksInteraction` → set `aria-disabled="true"` and `tabindex="-1"` on the root element; suppress pointer and keyboard events.
|
|
89
|
+
|
|
90
|
+
## iOS / UIAccessibility
|
|
91
|
+
|
|
92
|
+
iOS exposes accessibility semantics through `UIAccessibility` protocol properties on `UIView` (UIKit) and through accessibility modifiers in SwiftUI.
|
|
93
|
+
|
|
94
|
+
### `role`
|
|
95
|
+
|
|
96
|
+
| Foundation `role` | UIAccessibilityTraits / SwiftUI |
|
|
97
|
+
| ----------------- | -------------------------------------------------------------- |
|
|
98
|
+
| `button` | `.button` |
|
|
99
|
+
| `checkbox` | `.button` with toggled state, or SwiftUI `Toggle` |
|
|
100
|
+
| `combobox` | `.button` (picker-like behavior) |
|
|
101
|
+
| `dialog` | Presented as modal sheet; VoiceOver reads the accessible label |
|
|
102
|
+
| `link` | `.link` |
|
|
103
|
+
| `listbox` | Container view; children use `.button` or `.selected` |
|
|
104
|
+
| `menu` | `.button` on trigger; menu items as `.button` |
|
|
105
|
+
| `menuitem` | `.button` |
|
|
106
|
+
| `radio` | `.button` with `.selected` when active |
|
|
107
|
+
| `slider` | `.adjustable` |
|
|
108
|
+
| `spinbutton` | `.adjustable` |
|
|
109
|
+
| `switch` | `.button` with `.selected` / SwiftUI `Toggle` |
|
|
110
|
+
| `tab` | `.button` with `.selected` |
|
|
111
|
+
| `textbox` | `.keyboard` traits; `UITextField` or `UITextView` |
|
|
112
|
+
| `tooltip` | `.staticText` on an overlay element |
|
|
113
|
+
| `tree` | Hierarchical cells with `accessibilityContainerType` |
|
|
114
|
+
|
|
115
|
+
### `intents`
|
|
116
|
+
|
|
117
|
+
* `trigger` → provide `accessibilityLabel` describing the action the user will invoke.
|
|
118
|
+
* `select` → set `accessibilityTraits` to include `.selected` when the item is in a selected state.
|
|
119
|
+
* `expand` / `collapse` → update `accessibilityHint` or `accessibilityValue` to describe the current expanded/collapsed state.
|
|
120
|
+
* `choose` → implement `accessibilityIncrement()` / `accessibilityDecrement()` with the `.adjustable` trait.
|
|
121
|
+
* `dismiss` → handle `accessibilityPerformEscape()` to close the view and return focus.
|
|
122
|
+
|
|
123
|
+
### `focusable`
|
|
124
|
+
|
|
125
|
+
* `true` → `isAccessibilityElement = true`.
|
|
126
|
+
* `false` → `isAccessibilityElement = false`. For composite views that manage focus internally (e.g., a radio group), set `accessibilityContainerType` and manage the focused child programmatically.
|
|
127
|
+
|
|
128
|
+
### `keyboardIntents`
|
|
129
|
+
|
|
130
|
+
Relevant for external keyboard support (iPad with Magic Keyboard, Bluetooth keyboard):
|
|
131
|
+
|
|
132
|
+
* `activate` → register a `UIKeyCommand` for Return and Space.
|
|
133
|
+
* `navigate-options` / `navigate-items` → register `UIKeyCommand` entries for arrow keys.
|
|
134
|
+
* `dismiss` → register a `UIKeyCommand` for Escape.
|
|
135
|
+
|
|
136
|
+
### `wcag`
|
|
137
|
+
|
|
138
|
+
Include WCAG criteria in component documentation and Accessibility Inspector audits. The `wcag` array has no automatic mapping at the iOS layer.
|
|
139
|
+
|
|
140
|
+
### State fields
|
|
141
|
+
|
|
142
|
+
* `announce` → call `UIAccessibility.post(notification: .announcement, argument: announceText)` on state entry. In SwiftUI, use `AccessibilityNotification.Announcement`.
|
|
143
|
+
* `communicates` → set the corresponding trait or value (e.g., `"expanded"` → set `accessibilityValue = "expanded"` / `"collapsed"`; `"disabled"` → add `.notEnabled`; `"busy"` → add `.causesPageTurn` or a custom announcement).
|
|
144
|
+
* `blocksInteraction` → add `.notEnabled` trait; set `isAccessibilityElement = false` on interactive children.
|
|
145
|
+
|
|
146
|
+
## Android / AccessibilityNodeInfo
|
|
147
|
+
|
|
148
|
+
Android exposes accessibility semantics via `AccessibilityNodeInfo` populated through `ViewCompat.setAccessibilityDelegate()` or Jetpack Compose `Modifier.semantics {}`.
|
|
149
|
+
|
|
150
|
+
### `role`
|
|
151
|
+
|
|
152
|
+
| Foundation `role` | Android mapping |
|
|
153
|
+
| ----------------- | ----------------------------------------------------------- |
|
|
154
|
+
| `button` | `Button` widget or `setRoleDescription("button")` |
|
|
155
|
+
| `checkbox` | `CheckBox` widget or `setCheckable(true)` |
|
|
156
|
+
| `combobox` | `Spinner` widget or `setRoleDescription("combobox")` |
|
|
157
|
+
| `dialog` | Dialog window; `setDismissable(true)` |
|
|
158
|
+
| `link` | `setRoleDescription("link")`; add `ACTION_CLICK` |
|
|
159
|
+
| `listbox` | `RecyclerView` with `setCollectionInfo` |
|
|
160
|
+
| `menu` | `setRoleDescription("menu")` on the container |
|
|
161
|
+
| `menuitem` | `setRoleDescription("menu item")` |
|
|
162
|
+
| `radio` | `RadioButton` widget or `setCheckable(true)` + `setChecked` |
|
|
163
|
+
| `slider` | `SeekBar` widget or `RangeSemantics` in Compose |
|
|
164
|
+
| `spinbutton` | `setRoleDescription("spin button")` |
|
|
165
|
+
| `switch` | `Switch` widget or `setRoleDescription("switch")` |
|
|
166
|
+
| `tab` | `TabLayout` tab item; `setSelected(true)` when active |
|
|
167
|
+
| `textbox` | `EditText` widget or `TextField` in Compose |
|
|
168
|
+
| `tooltip` | `setTooltipText(text)` |
|
|
169
|
+
| `tree` | `setCollectionInfo` with hierarchical structure |
|
|
170
|
+
|
|
171
|
+
### `intents`
|
|
172
|
+
|
|
173
|
+
* `trigger` → set `setContentDescription()` describing the action.
|
|
174
|
+
* `select` → call `setSelected(true)` on selection.
|
|
175
|
+
* `expand` / `collapse` → call `setExpandable(true)` and `setExpanded(true/false)`.
|
|
176
|
+
* `choose` → add `ACTION_SCROLL_FORWARD` / `ACTION_SCROLL_BACKWARD` actions.
|
|
177
|
+
* `dismiss` → call `setDismissable(true)`; handle `ACTION_DISMISS`.
|
|
178
|
+
|
|
179
|
+
### `focusable`
|
|
180
|
+
|
|
181
|
+
* `true` → `setFocusable(true)` and `setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES)`.
|
|
182
|
+
* `false` → `setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS)` for decorative views. For composite views, manage focus via `performAccessibilityAction(ACTION_ACCESSIBILITY_FOCUS, ...)`.
|
|
183
|
+
|
|
184
|
+
### `keyboardIntents`
|
|
185
|
+
|
|
186
|
+
Relevant for physical keyboard input (Chromebook, external keyboard):
|
|
187
|
+
|
|
188
|
+
* `activate` → handle `KeyEvent.KEYCODE_ENTER` / `KEYCODE_SPACE`.
|
|
189
|
+
* `navigate-options` / `navigate-items` → handle arrow key `KeyEvent`s.
|
|
190
|
+
* `dismiss` → handle `KeyEvent.KEYCODE_ESCAPE` or `KEYCODE_BACK`.
|
|
191
|
+
|
|
192
|
+
### `wcag`
|
|
193
|
+
|
|
194
|
+
Include criteria in component documentation and Accessibility Scanner audits. No automatic mapping.
|
|
195
|
+
|
|
196
|
+
### State fields
|
|
197
|
+
|
|
198
|
+
* `announce` → call `ViewCompat.announceForAccessibility(view, announceText)` or send `AccessibilityEvent.TYPE_ANNOUNCEMENT`. In Compose, use `LocalAccessibilityManager.current?.announce(...)`.
|
|
199
|
+
* `communicates` → set the corresponding node property (e.g., `"expanded"` → call `setExpandable(true)` then `setExpanded(true)`; `"checked"` → `setChecked(true)`; `"disabled"` → `setEnabled(false)`).
|
|
200
|
+
* `blocksInteraction` → call `setEnabled(false)` on the root view. Use `IMPORTANT_FOR_ACCESSIBILITY_YES` to keep the element discoverable by AT as disabled; use `IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS` to hide the element and its subtree from AT entirely.
|
|
201
|
+
|
|
202
|
+
## Voice and multimodal
|
|
203
|
+
|
|
204
|
+
> **Informative sketch.** The following mapping is exploratory. Platform-specific voice adapter specs are deferred.
|
|
205
|
+
|
|
206
|
+
For voice interfaces (Alexa, Google Assistant, Siri Shortcuts) and future multimodal surfaces, the foundation vocabulary maps conceptually as follows:
|
|
207
|
+
|
|
208
|
+
| Foundation field | Voice / multimodal mapping |
|
|
209
|
+
| ----------------- | --------------------------------------------------------------------- |
|
|
210
|
+
| `role` | Utterance type in a voice schema (e.g., `button` → invocable command) |
|
|
211
|
+
| `intents` | Action category exposed in a voice intent catalog |
|
|
212
|
+
| `announce` | Spoken response on state transition |
|
|
213
|
+
| `communicates` | State value spoken when the user queries component status |
|
|
214
|
+
| `focusable` | Not applicable for purely voice surfaces |
|
|
215
|
+
| `keyboardIntents` | Not applicable for purely voice surfaces |
|
|
216
|
+
|
|
217
|
+
### `wcag`
|
|
218
|
+
|
|
219
|
+
WCAG 2.x success criteria apply at the web layer. For voice and multimodal surfaces, WCAG is not directly applicable; accessibility requirements for these surfaces are deferred to platform-specific adapter specs.
|
package/spec/agent-surface.md
CHANGED
|
@@ -9,7 +9,7 @@ This document defines the **agent-readable surface**: the contract an external A
|
|
|
9
9
|
|
|
10
10
|
The surface targets three consumer shapes:
|
|
11
11
|
|
|
12
|
-
1. **Authoring an external system.** A non-Spectrum design system being constructed inside an AI tool (e.g. a finance-dashboard prototype tool) wants to produce spec-conformant tokens,
|
|
12
|
+
1. **Authoring an external system.** A non-Spectrum design system being constructed inside an AI tool (e.g. a finance-dashboard prototype tool) wants to produce spec-conformant tokens, mode sets, and components without re-deriving the format from prose.
|
|
13
13
|
2. **Extending Spectrum.** A product or platform team adds tokens, components, or overrides on top of the published Spectrum foundation and needs to validate that the additions cascade and resolve correctly.
|
|
14
14
|
3. **Adhering to Spectrum.** A prototyping tool generates UI that should match Spectrum even where no bound component exists (e.g. CSS for a custom card). The agent needs to look up tokens by intent, validate proposed property values against the foundation, and report drift.
|
|
15
15
|
|
|
@@ -27,7 +27,7 @@ The surface targets three consumer shapes:
|
|
|
27
27
|
|
|
28
28
|
| Operation | Reads | Returns | Backed by |
|
|
29
29
|
| -------------------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
|
|
30
|
-
| `resolve_token` | property +
|
|
30
|
+
| `resolve_token` | property + mode set context | winning token (literal or resolved alias) with file/UUID/specificity | `cascade::resolve` |
|
|
31
31
|
| `query_tokens` | filter expression (see [Query](query.md)) | matching token list | `query::filter` |
|
|
32
32
|
| `validate_usage` | candidate token document or fragment | `ValidationReport` (Layer 1 + Layer 2 diagnostics) | `validate::validate_*` |
|
|
33
33
|
| `describe_component` | component identifier | component contract (anatomy, options, states, tokenBindings); see [#832](https://github.com/adobe/spectrum-design-data/discussions/832) and [Phase 6.7](#describe_component-return-shape) | (Phase 6 contract) |
|
|
@@ -51,7 +51,7 @@ An agent loop benefits from a small, structural overview at session start so tha
|
|
|
51
51
|
| ---------------- | -------------- | ----------------------------------------------------------------- |
|
|
52
52
|
| `specVersion` | string | The spec version the dataset declares (see [Overview](index.md)). |
|
|
53
53
|
| `manifest` | object \| null | Resolved platform manifest, if any (see [Manifest](manifest.md)). |
|
|
54
|
-
| `
|
|
54
|
+
| `modeSets` | array | Declared mode sets with modes and defaults. |
|
|
55
55
|
| `components` | array | Component identifiers exposed by the dataset (post Phase 6). |
|
|
56
56
|
| `taxonomyFields` | array | Active name-object fields and their declared vocabulary. |
|
|
57
57
|
| `tokenCount` | integer | Total tokens in the merged cascade. |
|
|
@@ -130,7 +130,7 @@ The `describe_component` tool returns the component declaration object as stored
|
|
|
130
130
|
|
|
131
131
|
The following sketch shows an agent loop that adheres-to-Spectrum while authoring a non-bound component.
|
|
132
132
|
|
|
133
|
-
1. Agent calls `primer ./spectrum-data` and learns that `colorScheme` and `scale` are the active
|
|
133
|
+
1. Agent calls `primer ./spectrum-data` and learns that `colorScheme` and `scale` are the active mode sets and that `button`, `picker`, and `card` are exposed components.
|
|
134
134
|
2. User asks for a "subtle hover background for a card on dark mode".
|
|
135
135
|
3. Agent calls `suggest_token "subtle hover background for card" --property background-color`.
|
|
136
136
|
4. Surface returns a ranked list including `background-color-hover` from Spectrum foundation and `background-color-card-hover` from a card component group.
|
package/spec/cascade.md
CHANGED
|
@@ -20,9 +20,9 @@ Design data is organized in three layers, ordered from lowest to highest precede
|
|
|
20
20
|
|
|
21
21
|
## Semantic specificity
|
|
22
22
|
|
|
23
|
-
**Specificity** counts how many **non-default**
|
|
23
|
+
**Specificity** counts how many **non-default** mode set fields in the token’s **name object** are set for the mode sets declared in the dataset.
|
|
24
24
|
|
|
25
|
-
**NORMATIVE:** Default
|
|
25
|
+
**NORMATIVE:** Default mode set values (see [Mode Sets](mode-sets.md)) **MUST NOT** contribute to specificity.
|
|
26
26
|
|
|
27
27
|
**NORMATIVE:** When two candidates from the **same layer** match the context, the candidate with **higher** specificity **MUST** win.
|
|
28
28
|
|
|
@@ -35,20 +35,20 @@ Design data is organized in three layers, ordered from lowest to highest precede
|
|
|
35
35
|
|
|
36
36
|
## Context
|
|
37
37
|
|
|
38
|
-
A **resolution context** is a set of
|
|
38
|
+
A **resolution context** is a set of mode set key/value pairs (e.g. `colorScheme: dark`, `scale: medium`, `contrast: regular`) plus the **target layer** being resolved (usually product → platform → foundation).
|
|
39
39
|
|
|
40
40
|
## Resolution algorithm (informative outline)
|
|
41
41
|
|
|
42
42
|
The following outline is **RECOMMENDED** for conforming resolvers:
|
|
43
43
|
|
|
44
|
-
1. Collect all token candidates whose name object **matches** the context (every specified
|
|
44
|
+
1. Collect all token candidates whose name object **matches** the context (every specified mode set in the context equals the name object’s mode set field, or the name object omits that mode set where omission means “matches any” per mode set rules).
|
|
45
45
|
2. Filter to candidates at or below the requested layer.
|
|
46
46
|
3. Select the maximum **layer** precedence.
|
|
47
47
|
4. Within that layer, select the maximum **specificity**.
|
|
48
48
|
5. Break remaining ties by document order (earlier in file wins; lexicographically earlier file path wins across files). Emit SPEC-006 warning.
|
|
49
49
|
6. If the winning candidate is an alias (`$ref`), **resolve the alias chain** to a literal value (see [Alias resolution](#alias-resolution)).
|
|
50
50
|
|
|
51
|
-
Exact matching rules for omitted
|
|
51
|
+
Exact matching rules for omitted mode sets are defined alongside mode set declarations in [Mode Sets](mode-sets.md).
|
|
52
52
|
|
|
53
53
|
## Alias resolution
|
|
54
54
|
|
|
@@ -58,9 +58,9 @@ Exact matching rules for omitted dimensions are defined alongside dimension decl
|
|
|
58
58
|
|
|
59
59
|
**RATIONALE:** Aliases participate in cascade as opaque references — their target values are not examined during specificity calculation or layer comparison. This keeps resolution deterministic and allows aliases to be valid candidates at any specificity level.
|
|
60
60
|
|
|
61
|
-
## Cross-
|
|
61
|
+
## Cross-mode-set overrides
|
|
62
62
|
|
|
63
|
-
**NORMATIVE:** Overrides that combine multiple
|
|
63
|
+
**NORMATIVE:** Overrides that combine multiple mode sets in a way not expressible by a single name object alone **MUST** use **explicit combination tokens** (tokens whose name object sets multiple non-default mode sets) as defined in the dataset; magic merging of unrelated tokens is **NOT** allowed.
|
|
64
64
|
|
|
65
65
|
## References
|
|
66
66
|
|
package/spec/component-format.md
CHANGED
|
@@ -40,6 +40,7 @@ A component declaration **MUST** contain:
|
|
|
40
40
|
| `lifecycle` | object | Version lifecycle metadata — see [Lifecycle](#lifecycle). |
|
|
41
41
|
| `tokenBindings` | array | Tokens this component uses — see [Token bindings](#token-bindings) (Phase 6.7). |
|
|
42
42
|
| `documentBlocks` | array | Typed prose blocks for this component — see [Document blocks](#document-blocks) (Phase 9). |
|
|
43
|
+
| `accessibility` | object | Semantic accessibility vocabulary — see [Accessibility](accessibility.md) (Phase 7). |
|
|
43
44
|
|
|
44
45
|
**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.
|
|
45
46
|
|
|
@@ -351,6 +352,37 @@ A complete button component declaration:
|
|
|
351
352
|
}
|
|
352
353
|
```
|
|
353
354
|
|
|
355
|
+
## Accessibility
|
|
356
|
+
|
|
357
|
+
**Phase 7.** Component declarations MAY carry an `accessibility` object at the top level. State declarations MAY carry `announce`, `communicates`, and `blocksInteraction` fields. See [spec/accessibility.md](accessibility.md) for the full vocabulary, SPEC rules, and examples.
|
|
358
|
+
|
|
359
|
+
```json
|
|
360
|
+
{
|
|
361
|
+
"name": "button",
|
|
362
|
+
"displayName": "Button",
|
|
363
|
+
"meta": { "category": "actions", "documentationUrl": "https://spectrum.adobe.com/page/button/" },
|
|
364
|
+
"accessibility": {
|
|
365
|
+
"role": "button",
|
|
366
|
+
"intents": ["trigger"],
|
|
367
|
+
"focusable": true,
|
|
368
|
+
"keyboardIntents": ["activate"],
|
|
369
|
+
"wcag": [
|
|
370
|
+
{ "criterion": "4.1.2", "level": "A", "title": "Name, Role, Value" }
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
"states": [
|
|
374
|
+
{
|
|
375
|
+
"name": "disabled",
|
|
376
|
+
"trigger": "prop",
|
|
377
|
+
"precedence": 100,
|
|
378
|
+
"announce": "Button disabled",
|
|
379
|
+
"communicates": "disabled",
|
|
380
|
+
"blocksInteraction": true
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
354
386
|
## Document blocks
|
|
355
387
|
|
|
356
388
|
**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.
|
package/spec/document-blocks.md
CHANGED
|
@@ -67,7 +67,7 @@ Accessibility notes specific to this entity — contrast behavior, screen reader
|
|
|
67
67
|
```json
|
|
68
68
|
{
|
|
69
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
|
|
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 mode-set variant provides an alternative that meets 4.5:1."
|
|
71
71
|
}
|
|
72
72
|
```
|
|
73
73
|
|
package/spec/index.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Version:** `1.0.0-draft`\
|
|
4
4
|
**Status:** Draft — normative text and schemas may change before `1.0.0`.
|
|
5
5
|
|
|
6
|
-
This document is the top-level overview for the **Design Data Specification**: a machine-readable model for Spectrum design tokens,
|
|
6
|
+
This document is the top-level overview for the **Design Data Specification**: a machine-readable model for Spectrum design tokens, mode sets, platform manifests, and validation.
|
|
7
7
|
|
|
8
8
|
## Scope
|
|
9
9
|
|
|
@@ -15,11 +15,12 @@ The specification defines:
|
|
|
15
15
|
* **Anatomy format** — anatomy part declaration shape: field constraints, canonical anatomy vocabulary, and cross-reference rules for token `anatomy` field values ([Anatomy format](anatomy-format.md)).
|
|
16
16
|
* **State model** — state declaration shape: trigger semantics, precedence and resolution algorithm, canonical state vocabulary, and cross-reference rules for token `state` field values ([State model](state-model.md)).
|
|
17
17
|
4. **Cascade and resolution** — layered data (foundation, platform, product), specificity, and how a context picks a winning value ([Cascade](cascade.md)).
|
|
18
|
-
5. **
|
|
18
|
+
5. **Mode Sets** — declared modes, defaults, and coverage expectations ([Mode Sets](mode-sets.md)).
|
|
19
19
|
6. **Platform manifest** — how a platform repo pins foundation data, filters tokens, and applies typed overrides ([Manifest](manifest.md)).
|
|
20
20
|
7. **Semantic diff** — change taxonomy, token identity rules, and property-level change tracking for comparing dataset versions ([Diff](diff.md)).
|
|
21
21
|
8. **Query notation** — filter syntax for selecting tokens by structured fields ([Query](query.md)).
|
|
22
22
|
9. **Accessibility** — component accessibility vocabulary: semantic role, interaction and keyboard intents, focus behavior, WCAG criteria, and state-level AT fields ([Accessibility](accessibility.md)).
|
|
23
|
+
* **Accessibility adapters** — informative platform adapter contracts: Web/ARIA, iOS UIAccessibility, Android AccessibilityNodeInfo, and voice/multimodal ([Accessibility adapters](accessibility-adapters.md)).
|
|
23
24
|
10. **Document blocks** — typed prose blocks attachable to tokens, components, and anatomy parts; makes design guidance machine-readable and agent-queryable ([Document blocks](document-blocks.md)).
|
|
24
25
|
11. **Agent-readable surface** — operations and transport contracts (CLI, MCP server, Agent Skill) for AI agents consuming spec-conformant design data; covers session primer, token resolution, validation, query, and component description ([Agent-readable surface](agent-surface.md)).
|
|
25
26
|
12. **Evolution** — deprecation lifecycle, migration windows, change classification, and legacy format contract ([Evolution](evolution.md)).
|
|
@@ -56,30 +57,31 @@ Full governance (compatibility tiers, migration, CLI `--spec-version`) is discus
|
|
|
56
57
|
|
|
57
58
|
## Normative references (sibling documents)
|
|
58
59
|
|
|
59
|
-
| Document
|
|
60
|
-
|
|
|
61
|
-
| [Token format](token-format.md)
|
|
62
|
-
| [Taxonomy](taxonomy.md)
|
|
63
|
-
| [Component format](component-format.md)
|
|
64
|
-
| [Anatomy format](anatomy-format.md)
|
|
65
|
-
| [State model](state-model.md)
|
|
66
|
-
| [Cascade](cascade.md)
|
|
67
|
-
| [
|
|
68
|
-
| [Manifest](manifest.md)
|
|
69
|
-
| [Product context](product-context.md)
|
|
70
|
-
| [Diff](diff.md)
|
|
71
|
-
| [Query](query.md)
|
|
72
|
-
| [Accessibility](accessibility.md)
|
|
73
|
-
| [
|
|
74
|
-
| [
|
|
75
|
-
| [
|
|
60
|
+
| Document | Role |
|
|
61
|
+
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| [Token format](token-format.md) | Token `name`, `value` / `$ref`, value types, lifecycle metadata. |
|
|
63
|
+
| [Taxonomy](taxonomy.md) | Concept categories, vocabulary, formatting, anatomy vs objects. |
|
|
64
|
+
| [Component format](component-format.md) | Component declaration: options, slots, anatomy (→ anatomy-format.md), states (→ state-model.md), lifecycle. |
|
|
65
|
+
| [Anatomy format](anatomy-format.md) | Anatomy part declarations: field constraints, canonical vocabulary, SPEC-020/SPEC-023/SPEC-024/SPEC-025. |
|
|
66
|
+
| [State model](state-model.md) | State declarations: trigger semantics, precedence algorithm, canonical vocabulary, SPEC-022/SPEC-026. |
|
|
67
|
+
| [Cascade](cascade.md) | Layers, specificity, resolution algorithm. |
|
|
68
|
+
| [Mode Sets](mode-sets.md) | Mode set declarations, built-in mode sets, coverage. |
|
|
69
|
+
| [Manifest](manifest.md) | Platform manifest fields and validation expectations. |
|
|
70
|
+
| [Product context](product-context.md) | Product-layer context document: rationale, overrides, and extensions. |
|
|
71
|
+
| [Diff](diff.md) | Semantic diff change taxonomy, token identity, property changes. |
|
|
72
|
+
| [Query](query.md) | Filter notation for selecting tokens by structured fields. |
|
|
73
|
+
| [Accessibility](accessibility.md) | Component accessibility vocabulary: role, intents, focusable, keyboardIntents, wcag, and state-level AT fields (SPEC-030/031). |
|
|
74
|
+
| [Accessibility adapters](accessibility-adapters.md) | Informative platform adapter contracts mapping foundation accessibility vocabulary to Web/ARIA, iOS, Android, and voice surfaces. |
|
|
75
|
+
| [Document blocks](document-blocks.md) | Typed prose blocks (purpose, guideline, accessibility, do-dont, examples) attachable to any entity. |
|
|
76
|
+
| [Agent-readable surface](agent-surface.md) | Transport contracts (CLI, MCP, Agent Skill) and operation catalog for AI agents consuming spec-conformant design data. |
|
|
77
|
+
| [Evolution](evolution.md) | Deprecation lifecycle, migration windows, change classification. |
|
|
76
78
|
|
|
77
79
|
## JSON Schema `$id` and versioning
|
|
78
80
|
|
|
79
81
|
**NORMATIVE:** Canonical schema documents use **versioned path** `$id` URIs so major revisions can coexist on the documentation host:
|
|
80
82
|
|
|
81
83
|
* Base: `https://opensource.adobe.com/spectrum-design-data/schemas/v0/`
|
|
82
|
-
* Examples: `.../v0/token.schema.json`, `.../v0/
|
|
84
|
+
* Examples: `.../v0/token.schema.json`, `.../v0/mode-set.schema.json`, `.../v0/manifest.schema.json`
|
|
83
85
|
|
|
84
86
|
The **`v0`** segment denotes the **draft / pre-1.0** schema family aligned with spec version `1.0.0-draft`. A future **1.0.0** stable release MAY introduce `v1` paths without reusing `v0` URLs for incompatible shapes.
|
|
85
87
|
|
package/spec/manifest.md
CHANGED
|
@@ -22,7 +22,7 @@ A manifest **MUST** conform to [`manifest.schema.json`](../schemas/manifest.sche
|
|
|
22
22
|
| `include` | array of string | Semantic **queries** selecting subsets of foundation tokens to materialize. |
|
|
23
23
|
| `exclude` | array of string | Queries removing tokens from the included set. |
|
|
24
24
|
| `overrides` | array of object | Typed overrides; each entry **MUST** preserve the target token’s **value type**. |
|
|
25
|
-
| `extensions` | object | New tokens or
|
|
25
|
+
| `extensions` | object | New tokens or mode sets introduced at the platform layer. |
|
|
26
26
|
|
|
27
27
|
### `include` / `exclude`
|
|
28
28
|
|
|
@@ -38,7 +38,7 @@ Each override object **MUST** include enough information to identify a target to
|
|
|
38
38
|
|
|
39
39
|
### `extensions`
|
|
40
40
|
|
|
41
|
-
**RECOMMENDED:** `extensions` follows the same structural conventions as foundation token files (tokens,
|
|
41
|
+
**RECOMMENDED:** `extensions` follows the same structural conventions as foundation token files (tokens, mode sets) and **SHOULD** be validated with the same Layer 1 and Layer 2 rules.
|
|
42
42
|
|
|
43
43
|
#### `extensions.formatting`
|
|
44
44
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Mode Sets
|
|
2
|
+
|
|
3
|
+
**Spec version:** `1.0.0-draft` (see [Overview](index.md))
|
|
4
|
+
|
|
5
|
+
This document defines how **mode sets** (axes such as color scheme, scale, contrast) are **declared**, assigned **defaults**, and validated for **coverage**.
|
|
6
|
+
|
|
7
|
+
## Mode Set declaration
|
|
8
|
+
|
|
9
|
+
A **mode set declaration** is a JSON object describing one axis of variation. It **MUST** conform to [`mode-set.schema.json`](../schemas/mode-set.schema.json) (canonical `$id`: `https://opensource.adobe.com/spectrum-design-data/schemas/v0/mode-set.schema.json`).
|
|
10
|
+
|
|
11
|
+
### Required fields
|
|
12
|
+
|
|
13
|
+
| Field | Description |
|
|
14
|
+
| --------- | -------------------------------------------------------- |
|
|
15
|
+
| `name` | Stable identifier for the mode set (e.g. `colorScheme`). |
|
|
16
|
+
| `modes` | Array of allowed mode values (strings). |
|
|
17
|
+
| `default` | Default mode; **MUST** be a member of `modes`. |
|
|
18
|
+
|
|
19
|
+
### Optional fields
|
|
20
|
+
|
|
21
|
+
| Field | Description |
|
|
22
|
+
| ------------- | ------------------------------------ |
|
|
23
|
+
| `description` | Human-readable documentation. |
|
|
24
|
+
| `coverage` | Rules for mode coverage (see below). |
|
|
25
|
+
|
|
26
|
+
## Built-in mode sets
|
|
27
|
+
|
|
28
|
+
These mode sets are declared in the `mode-sets/` catalog (see [Mode Set catalog](#mode-set-catalog)) and **SHOULD** be used consistently across Spectrum-compatible datasets:
|
|
29
|
+
|
|
30
|
+
| `name` | `modes` | `default` | Notes |
|
|
31
|
+
| ------------- | ---------------------------- | --------- | --------------------------------------------------------------------------------- |
|
|
32
|
+
| `colorScheme` | `light`, `dark`, `wireframe` | `light` | Theme / appearance. |
|
|
33
|
+
| `scale` | `desktop`, `mobile` | `desktop` | Density scale. Legacy names; desktop = medium, mobile = large in W3C terminology. |
|
|
34
|
+
| `contrast` | `regular`, `high` | `regular` | Accessibility contrast level. |
|
|
35
|
+
|
|
36
|
+
## Mode Set catalog
|
|
37
|
+
|
|
38
|
+
The Spectrum foundation publishes mode set declarations as JSON files under `packages/design-data-spec/mode-sets/`. Each file conforms to [`mode-set.schema.json`](../schemas/mode-set.schema.json).
|
|
39
|
+
|
|
40
|
+
**NORMATIVE:** Tooling (validators, resolution engine) **MUST** load mode set declarations from the dataset's mode set catalog before performing specificity calculations or coverage validation.
|
|
41
|
+
|
|
42
|
+
**RECOMMENDED:** The catalog directory is named `mode-sets/` and is co-located with the dataset's spec package or manifest.
|
|
43
|
+
|
|
44
|
+
## Optional mode sets
|
|
45
|
+
|
|
46
|
+
Additional mode sets (e.g. `language`, `motion`) **MAY** be declared in a dataset's mode set catalog. Token name objects **MAY** include keys matching declared mode set names.
|
|
47
|
+
|
|
48
|
+
## Defaults and specificity
|
|
49
|
+
|
|
50
|
+
**NORMATIVE:** A token name object **omitting** a mode set field implies the token applies under the mode set's **`default`** mode for specificity and matching purposes unless the spec for that mode set states otherwise.
|
|
51
|
+
|
|
52
|
+
**NORMATIVE:** Only **non-default** mode set fields on the name object increase **semantic specificity** (see [Cascade](cascade.md)).
|
|
53
|
+
|
|
54
|
+
## Coverage validation
|
|
55
|
+
|
|
56
|
+
**RECOMMENDED:** If a mode set's `coverage` requires **peer modes** (e.g. defining `dark` requires `light`), validators implement rule **`SPEC-005`** (see `rules/rules.yaml`).
|
|
57
|
+
|
|
58
|
+
**RECOMMENDED:** Explicit **combination** tokens are used for rare cross-mode-set cases instead of inferring Cartesian products.
|
|
59
|
+
|
|
60
|
+
## References
|
|
61
|
+
|
|
62
|
+
* [#646 — Token Schema Structure and Validation System](https://github.com/adobe/spectrum-design-data/discussions/646)
|
|
63
|
+
* [#714 — Design Data Specification](https://github.com/adobe/spectrum-design-data/discussions/714)
|
|
64
|
+
* [#746 — Phase 2: Mode Set declarations (machine-readable)](https://github.com/adobe/spectrum-design-data/issues/746)
|
package/spec/query.md
CHANGED
|
@@ -8,29 +8,29 @@ This document defines the **query filter notation**: a concise syntax for select
|
|
|
8
8
|
|
|
9
9
|
A **filter expression** is a string that describes a set of conditions a token must satisfy to be included in the result. The notation uses `key=value` pairs combined with logical operators.
|
|
10
10
|
|
|
11
|
-
| Operator | Syntax
|
|
12
|
-
| -------- |
|
|
13
|
-
| `=` | `key=value`
|
|
14
|
-
| `!=` | `key!=value`
|
|
15
|
-
| `,` | `a=x,b=y`
|
|
16
|
-
| `\|` | `a=x\|b=y`
|
|
17
|
-
| `*` | `key=patt*ern`
|
|
11
|
+
| Operator | Syntax | Meaning |
|
|
12
|
+
| -------- | -------------- | ---------------------------------------------------- |
|
|
13
|
+
| `=` | `key=value` | Field `key` equals `value`. |
|
|
14
|
+
| `!=` | `key!=value` | Field `key` does not equal `value`. |
|
|
15
|
+
| `,` | `a=x,b=y` | Logical AND — both conditions must match. |
|
|
16
|
+
| `\|` | `a=x\|b=y` | Logical OR — at least one condition must match. |
|
|
17
|
+
| `*` | `key=patt*ern` | Glob wildcard — `*` matches zero or more characters. |
|
|
18
18
|
|
|
19
19
|
## Supported keys
|
|
20
20
|
|
|
21
21
|
**NORMATIVE:** Implementations **MUST** support the following keys:
|
|
22
22
|
|
|
23
|
-
| Key
|
|
24
|
-
|
|
|
25
|
-
| `property`
|
|
26
|
-
| `component`
|
|
27
|
-
| `variant`
|
|
28
|
-
| `state`
|
|
29
|
-
| `colorScheme`
|
|
30
|
-
| `scale`
|
|
31
|
-
| `contrast`
|
|
32
|
-
| `uuid`
|
|
33
|
-
| `$schema`
|
|
23
|
+
| Key | Source | Description |
|
|
24
|
+
| ------------- | ------------------ | ----------------------------------- |
|
|
25
|
+
| `property` | `name.property` | Token property identifier. |
|
|
26
|
+
| `component` | `name.component` | Associated component name. |
|
|
27
|
+
| `variant` | `name.variant` | Component variant. |
|
|
28
|
+
| `state` | `name.state` | Component or interaction state. |
|
|
29
|
+
| `colorScheme` | `name.colorScheme` | Color scheme mode set value. |
|
|
30
|
+
| `scale` | `name.scale` | Scale mode set value. |
|
|
31
|
+
| `contrast` | `name.contrast` | Contrast mode set value. |
|
|
32
|
+
| `uuid` | `uuid` | Token UUID (top-level field). |
|
|
33
|
+
| `$schema` | `$schema` | Token schema URL (top-level field). |
|
|
34
34
|
|
|
35
35
|
**NORMATIVE:** Implementations **MUST** reject filter expressions containing keys not listed above with a parse error. Future spec versions MAY add keys.
|
|
36
36
|
|
package/spec/taxonomy.md
CHANGED
|
@@ -139,15 +139,15 @@ Semantic fields describe identity, structure, and intent. They are used for quer
|
|
|
139
139
|
|
|
140
140
|
Semantic fields are those declared with `kind: "semantic"` in the field catalog. In Spectrum's foundation catalog, these are: `structure`, `substructure`, `component`, `anatomy`, `object`, `property`, `variant`, `state`, `orientation`, `position`, `size`, `density`, `shape`.
|
|
141
141
|
|
|
142
|
-
###
|
|
142
|
+
### Mode-set fields
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
Mode-set fields represent axes of variation that drive the [cascade](cascade.md) resolution algorithm and [specificity](cascade.md#semantic-specificity) calculation.
|
|
145
145
|
|
|
146
|
-
**NORMATIVE:**
|
|
146
|
+
**NORMATIVE:** Mode-set field values are validated against declared [mode set](mode-sets.md) modes with **strict** severity (error). An invalid mode value would silently fail to match any context during cascade resolution.
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
Mode-set fields are those declared with `kind: "mode-set"` in the field catalog, plus any additional mode set keys from the dataset's [mode set declarations](mode-sets.md). In Spectrum's foundation catalog, the standard mode-set fields are: `colorScheme`, `scale`, `contrast`.
|
|
149
149
|
|
|
150
|
-
See [
|
|
150
|
+
See [Mode Sets](mode-sets.md) for mode set declarations, modes, and defaults.
|
|
151
151
|
|
|
152
152
|
## Default serialization (legacy format)
|
|
153
153
|
|