@adobe/design-system-registry 0.0.0-layout-20260209174611
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/AUTHORING.md +290 -0
- package/CHANGELOG.md +23 -0
- package/LICENSE +201 -0
- package/PLATFORM_EXTENSIONS.md +315 -0
- package/README.md +268 -0
- package/ava.config.js +21 -0
- package/index.js +189 -0
- package/moon.yml +40 -0
- package/package.json +46 -0
- package/registry/anatomy-terms.json +151 -0
- package/registry/categories.json +56 -0
- package/registry/components.json +277 -0
- package/registry/glossary.json +181 -0
- package/registry/navigation-terms.json +241 -0
- package/registry/platform-extensions/ios-states.json +59 -0
- package/registry/platform-extensions/web-components-states.json +58 -0
- package/registry/platforms.json +37 -0
- package/registry/scale-values.json +91 -0
- package/registry/sizes.json +152 -0
- package/registry/states.json +184 -0
- package/registry/token-terminology.json +925 -0
- package/registry/variants.json +176 -0
- package/schemas/platform-extension.json +79 -0
- package/schemas/registry-value.json +230 -0
- package/scripts/validate-registry.js +134 -0
- package/test/registry.test.js +280 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# Platform Extensions Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how platform teams can extend the Spectrum Design System Registry with platform-specific terminology and implementation details.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Platform Extension system allows platform implementations (iOS, Android, Web Components, Qt, etc.) to:
|
|
8
|
+
|
|
9
|
+
* Define platform-specific terminology for registry terms
|
|
10
|
+
* Document implementation differences
|
|
11
|
+
* Provide code examples in platform-specific APIs
|
|
12
|
+
* Map Spectrum terms to platform conventions
|
|
13
|
+
|
|
14
|
+
## Extension Approaches
|
|
15
|
+
|
|
16
|
+
Platform teams have two options for contributing extensions:
|
|
17
|
+
|
|
18
|
+
### Option 1: Centralized Contributions (Recommended)
|
|
19
|
+
|
|
20
|
+
Contribute platform-specific metadata directly to the central registry via pull requests.
|
|
21
|
+
|
|
22
|
+
**Pros**:
|
|
23
|
+
|
|
24
|
+
* Single source of truth
|
|
25
|
+
* Easy to discover for all users
|
|
26
|
+
* Maintained alongside core registry
|
|
27
|
+
* Included in npm package
|
|
28
|
+
|
|
29
|
+
**Cons**:
|
|
30
|
+
|
|
31
|
+
* Requires PR approval from registry maintainers
|
|
32
|
+
* May slow down platform-specific updates
|
|
33
|
+
|
|
34
|
+
**When to use**: For stable, well-established platform terminology that benefits the entire Spectrum community.
|
|
35
|
+
|
|
36
|
+
### Option 2: Plugin/Extension System
|
|
37
|
+
|
|
38
|
+
Maintain platform extensions in your own repository or as separate files.
|
|
39
|
+
|
|
40
|
+
**Pros**:
|
|
41
|
+
|
|
42
|
+
* Platform teams have full control
|
|
43
|
+
* Faster iteration for platform-specific changes
|
|
44
|
+
* Can be versioned independently
|
|
45
|
+
* No approval required from central team
|
|
46
|
+
|
|
47
|
+
**Cons**:
|
|
48
|
+
|
|
49
|
+
* Users must load extensions separately
|
|
50
|
+
* Risk of fragmentation
|
|
51
|
+
* May become out of sync with base registry
|
|
52
|
+
|
|
53
|
+
**When to use**: For experimental features, platform-specific implementations, or rapidly changing APIs.
|
|
54
|
+
|
|
55
|
+
## Creating a Platform Extension
|
|
56
|
+
|
|
57
|
+
### 1. Create Extension File
|
|
58
|
+
|
|
59
|
+
Extensions are JSON files that reference base registry terms and add platform-specific information.
|
|
60
|
+
|
|
61
|
+
**File naming convention**: `{platform}-{registry}.json`
|
|
62
|
+
|
|
63
|
+
Examples:
|
|
64
|
+
|
|
65
|
+
* `ios-states.json` - iOS extensions for interaction states
|
|
66
|
+
* `android-sizes.json` - Android extensions for size values
|
|
67
|
+
* `web-components-variants.json` - Web Components extensions for variants
|
|
68
|
+
|
|
69
|
+
### 2. Extension Schema
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/platform-extension.json",
|
|
74
|
+
"platform": "iOS",
|
|
75
|
+
"platformVersion": "iOS 17+",
|
|
76
|
+
"description": "iOS-specific terminology for interaction states",
|
|
77
|
+
"extends": "states",
|
|
78
|
+
"extensions": [
|
|
79
|
+
{
|
|
80
|
+
"termId": "hover",
|
|
81
|
+
"platformTerm": "highlighted",
|
|
82
|
+
"platformAliases": ["isHighlighted"],
|
|
83
|
+
"notes": "iOS uses 'highlighted' state for pointer interactions",
|
|
84
|
+
"reference": "UIControl.State.highlighted",
|
|
85
|
+
"codeExample": "button.isHighlighted = true",
|
|
86
|
+
"differences": [
|
|
87
|
+
"Only available on devices with pointer support",
|
|
88
|
+
"Not triggered by touch interactions"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 3. Extension Fields
|
|
96
|
+
|
|
97
|
+
| Field | Required | Description |
|
|
98
|
+
| ----------------- | -------- | --------------------------------------------------------- |
|
|
99
|
+
| `platform` | Yes | Platform name (iOS, Android, Web Components, Qt, etc.) |
|
|
100
|
+
| `platformVersion` | No | Platform or framework version |
|
|
101
|
+
| `description` | No | What this extension provides |
|
|
102
|
+
| `extends` | Yes | Which registry it extends (sizes, states, variants, etc.) |
|
|
103
|
+
| `extensions` | Yes | Array of term extensions |
|
|
104
|
+
|
|
105
|
+
### 4. Term Extension Fields
|
|
106
|
+
|
|
107
|
+
| Field | Required | Description |
|
|
108
|
+
| ----------------- | -------- | -------------------------------------------- |
|
|
109
|
+
| `termId` | Yes | ID of the base term (must exist in registry) |
|
|
110
|
+
| `platformTerm` | No | Platform-specific term name |
|
|
111
|
+
| `platformAliases` | No | Platform-specific aliases |
|
|
112
|
+
| `notes` | No | Implementation notes |
|
|
113
|
+
| `reference` | No | API name or documentation reference |
|
|
114
|
+
| `codeExample` | No | Code snippet showing usage |
|
|
115
|
+
| `differences` | No | Key differences from base term |
|
|
116
|
+
|
|
117
|
+
## Using Platform Extensions
|
|
118
|
+
|
|
119
|
+
### In Code
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
import {
|
|
123
|
+
states,
|
|
124
|
+
getTermForPlatform,
|
|
125
|
+
loadPlatformExtension
|
|
126
|
+
} from '@adobe/design-system-registry';
|
|
127
|
+
|
|
128
|
+
// Load platform extension
|
|
129
|
+
const iosStates = loadPlatformExtension('./platform-extensions/ios-states.json');
|
|
130
|
+
|
|
131
|
+
// Get platform-specific term
|
|
132
|
+
const hoverTerm = getTermForPlatform(states, 'hover', 'iOS', iosStates);
|
|
133
|
+
|
|
134
|
+
console.log(hoverTerm.platform.term); // "highlighted"
|
|
135
|
+
console.log(hoverTerm.platform.reference); // "UIControl.State.highlighted"
|
|
136
|
+
console.log(hoverTerm.platform.codeExample); // "button.isHighlighted = true"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Loading All Extensions
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
import { loadAllPlatformExtensions } from '@adobe/design-system-registry';
|
|
143
|
+
import { join } from 'node:path';
|
|
144
|
+
|
|
145
|
+
const extensionsDir = join(__dirname, 'registry', 'platform-extensions');
|
|
146
|
+
const allExtensions = loadAllPlatformExtensions(extensionsDir);
|
|
147
|
+
|
|
148
|
+
// Filter by platform
|
|
149
|
+
const iosExtensions = allExtensions.filter(ext => ext.platform === 'iOS');
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Example: iOS States Extension
|
|
153
|
+
|
|
154
|
+
Here's a complete example showing how iOS extends the states registry:
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/platform-extension.json",
|
|
159
|
+
"platform": "iOS",
|
|
160
|
+
"platformVersion": "iOS 17+",
|
|
161
|
+
"description": "iOS-specific terminology for interaction states",
|
|
162
|
+
"extends": "states",
|
|
163
|
+
"extensions": [
|
|
164
|
+
{
|
|
165
|
+
"termId": "hover",
|
|
166
|
+
"platformTerm": "highlighted",
|
|
167
|
+
"platformAliases": ["isHighlighted"],
|
|
168
|
+
"notes": "iOS uses 'highlighted' for pointer interactions on devices with pointer support",
|
|
169
|
+
"reference": "UIControl.State.highlighted",
|
|
170
|
+
"codeExample": "button.isHighlighted = true",
|
|
171
|
+
"differences": [
|
|
172
|
+
"Only available on iOS devices with pointer support",
|
|
173
|
+
"Not triggered by touch interactions",
|
|
174
|
+
"Maps to UIControl.State.highlighted property"
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"termId": "disabled",
|
|
179
|
+
"platformTerm": "disabled",
|
|
180
|
+
"platformAliases": ["isEnabled"],
|
|
181
|
+
"notes": "iOS uses isEnabled property (inverted boolean)",
|
|
182
|
+
"reference": "UIControl.isEnabled",
|
|
183
|
+
"codeExample": "button.isEnabled = false",
|
|
184
|
+
"differences": [
|
|
185
|
+
"Property is named 'isEnabled' but inverted (false = disabled)",
|
|
186
|
+
"Affects both visual appearance and interaction"
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Contributing Centralized Extensions
|
|
194
|
+
|
|
195
|
+
### 1. Fork and Clone
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
git clone https://github.com/adobe/spectrum-design-data.git
|
|
199
|
+
cd spectrum-design-data
|
|
200
|
+
pnpm install
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 2. Create Extension File
|
|
204
|
+
|
|
205
|
+
Create your extension file in `packages/design-system-registry/registry/platform-extensions/`.
|
|
206
|
+
|
|
207
|
+
### 3. Validate
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
cd packages/design-system-registry
|
|
211
|
+
pnpm validate
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 4. Test
|
|
215
|
+
|
|
216
|
+
Ensure helper functions work with your extension:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
pnpm test
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 5. Create Changeset
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
pnpm changeset
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Select `@adobe/design-system-registry` and describe your changes.
|
|
229
|
+
|
|
230
|
+
### 6. Submit Pull Request
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
git checkout -b feat/add-{platform}-{registry}-extension
|
|
234
|
+
git add .
|
|
235
|
+
git commit -m "feat(registry): add {platform} extensions for {registry}"
|
|
236
|
+
git push origin feat/add-{platform}-{registry}-extension
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Create a PR with:
|
|
240
|
+
|
|
241
|
+
* Clear description of platform and what's being extended
|
|
242
|
+
* Examples of how the extension improves platform consistency
|
|
243
|
+
* Link to platform documentation
|
|
244
|
+
|
|
245
|
+
## Maintaining Platform Extensions
|
|
246
|
+
|
|
247
|
+
### Versioning
|
|
248
|
+
|
|
249
|
+
* Extension files should evolve with the platform
|
|
250
|
+
* Use `platformVersion` field to indicate compatibility
|
|
251
|
+
* Breaking changes should be documented in commit messages
|
|
252
|
+
|
|
253
|
+
### Deprecation
|
|
254
|
+
|
|
255
|
+
When platform APIs change:
|
|
256
|
+
|
|
257
|
+
1. Add new extension for the new API
|
|
258
|
+
2. Mark old extension term with deprecation note
|
|
259
|
+
3. Provide migration guidance in `differences` field
|
|
260
|
+
|
|
261
|
+
Example:
|
|
262
|
+
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"termId": "hover",
|
|
266
|
+
"platformTerm": "highlighted",
|
|
267
|
+
"notes": "DEPRECATED: Use isPointerInteractionEnabled instead (iOS 18+)",
|
|
268
|
+
"differences": [
|
|
269
|
+
"Deprecated in iOS 18",
|
|
270
|
+
"Replace with isPointerInteractionEnabled property"
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Review Cycle
|
|
276
|
+
|
|
277
|
+
Centralized extensions should be reviewed:
|
|
278
|
+
|
|
279
|
+
* Annually for accuracy
|
|
280
|
+
* When platform versions update
|
|
281
|
+
* When base registry terms change
|
|
282
|
+
|
|
283
|
+
## Best Practices
|
|
284
|
+
|
|
285
|
+
### DO
|
|
286
|
+
|
|
287
|
+
* ✅ Use official platform terminology
|
|
288
|
+
* ✅ Link to official platform documentation
|
|
289
|
+
* ✅ Provide code examples in platform's language
|
|
290
|
+
* ✅ Document key differences from base term
|
|
291
|
+
* ✅ Use platform naming conventions
|
|
292
|
+
|
|
293
|
+
### DON'T
|
|
294
|
+
|
|
295
|
+
* ❌ Invent new terminology not used by platform
|
|
296
|
+
* ❌ Duplicate information already in base term
|
|
297
|
+
* ❌ Include deprecated APIs without notes
|
|
298
|
+
* ❌ Skip validation before submitting
|
|
299
|
+
* ❌ Mix multiple platforms in one extension file
|
|
300
|
+
|
|
301
|
+
## Questions?
|
|
302
|
+
|
|
303
|
+
For questions or feedback:
|
|
304
|
+
|
|
305
|
+
* Slack: #spectrum\_dna
|
|
306
|
+
* GitHub: [Spectrum Design Data Issues](https://github.com/adobe/spectrum-design-data/issues)
|
|
307
|
+
* Email platform leads for platform-specific questions
|
|
308
|
+
|
|
309
|
+
## Related Resources
|
|
310
|
+
|
|
311
|
+
* [Design System Registry README](README.md)
|
|
312
|
+
* [Authoring Guide](AUTHORING.md)
|
|
313
|
+
* [Platform Extension Schema](schemas/platform-extension.json)
|
|
314
|
+
* [Example: iOS States Extension](registry/platform-extensions/ios-states.json)
|
|
315
|
+
* [Example: Web Components States Extension](registry/platform-extensions/web-components-states.json)
|
package/README.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Design System Registry
|
|
2
|
+
|
|
3
|
+
A single source of truth for design system terminology used across Spectrum tokens, component schemas, and anatomy.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Design System Registry provides a centralized, validated registry of terminology used throughout the Adobe Spectrum Design System. It ensures consistency in naming and helps prevent divergence across different packages and tools.
|
|
8
|
+
|
|
9
|
+
## Registries
|
|
10
|
+
|
|
11
|
+
The package includes the following registries:
|
|
12
|
+
|
|
13
|
+
### Core Registries
|
|
14
|
+
|
|
15
|
+
* **sizes.json** - Size scale values (xs, s, m, l, xl, xxl, xxxl, numeric sizes)
|
|
16
|
+
* **states.json** - Interaction states (default, hover, focus, disabled, etc.) with enhanced definitions
|
|
17
|
+
* **variants.json** - Color and style variants (accent, negative, primary, etc.)
|
|
18
|
+
* **anatomy-terms.json** - Anatomical part names (edge, visual, text, icon, etc.)
|
|
19
|
+
* **components.json** - Spectrum component names
|
|
20
|
+
* **scale-values.json** - Numeric scale values (50, 75, 100, 200, etc.)
|
|
21
|
+
* **categories.json** - Component categories (actions, inputs, navigation, etc.)
|
|
22
|
+
* **platforms.json** - Platform names (desktop, mobile, web, iOS, Android)
|
|
23
|
+
|
|
24
|
+
### Glossary Registries
|
|
25
|
+
|
|
26
|
+
* **glossary.json** - General design system terminology and concepts
|
|
27
|
+
* **navigation-terms.json** - Navigation-specific terminology (side navigation, header, nav items, etc.)
|
|
28
|
+
* **token-terminology.json** - Token-specific concepts (component, object, scale, property, edge, visual)
|
|
29
|
+
|
|
30
|
+
### Platform Extensions
|
|
31
|
+
|
|
32
|
+
Platform-specific terminology extensions are available in `registry/platform-extensions/`:
|
|
33
|
+
|
|
34
|
+
* **ios-states.json** - iOS-specific state terminology (UIControl.State, etc.)
|
|
35
|
+
* **web-components-states.json** - Web Components state terminology (CSS pseudo-classes, etc.)
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm add @adobe/design-system-registry
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Importing Registries
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import {
|
|
49
|
+
// Core registries
|
|
50
|
+
sizes,
|
|
51
|
+
states,
|
|
52
|
+
variants,
|
|
53
|
+
anatomyTerms,
|
|
54
|
+
components,
|
|
55
|
+
scaleValues,
|
|
56
|
+
categories,
|
|
57
|
+
platforms,
|
|
58
|
+
|
|
59
|
+
// Glossary registries
|
|
60
|
+
glossary,
|
|
61
|
+
navigationTerms,
|
|
62
|
+
tokenTerminology
|
|
63
|
+
} from '@adobe/design-system-registry';
|
|
64
|
+
|
|
65
|
+
// Access registry values
|
|
66
|
+
console.log(sizes.values); // Array of size values
|
|
67
|
+
console.log(states.values); // Array of state values with enhanced definitions
|
|
68
|
+
console.log(glossary.values); // General glossary terms
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Enhanced Definitions
|
|
72
|
+
|
|
73
|
+
Many registry values now include rich definitions following the [Spectrum Naming and Definition Writing Guide](https://wiki.corp.adobe.com/display/AdobeDesign/Spectrum+Design+System%3A+Naming+and+definition+writing+guide):
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
import { states } from '@adobe/design-system-registry';
|
|
77
|
+
|
|
78
|
+
const hoverState = states.values.find(v => v.id === 'hover');
|
|
79
|
+
|
|
80
|
+
console.log(hoverState.definition.superordinate); // "interaction state"
|
|
81
|
+
console.log(hoverState.definition.description); // Full definition
|
|
82
|
+
console.log(hoverState.definition.essentialCharacteristics); // Array of key features
|
|
83
|
+
console.log(hoverState.platforms.web); // Web-specific info
|
|
84
|
+
console.log(hoverState.platforms.iOS); // iOS-specific info
|
|
85
|
+
console.log(hoverState.sources); // Documentation references
|
|
86
|
+
console.log(hoverState.governance); // Ownership and status
|
|
87
|
+
console.log(hoverState.relatedTerms); // Cross-references
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Using Helper Functions
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
import {
|
|
94
|
+
sizes,
|
|
95
|
+
getValues,
|
|
96
|
+
findValue,
|
|
97
|
+
hasValue,
|
|
98
|
+
getDefault,
|
|
99
|
+
getActiveValues
|
|
100
|
+
} from '@adobe/design-system-registry';
|
|
101
|
+
|
|
102
|
+
// Get all value IDs
|
|
103
|
+
const sizeIds = getValues(sizes);
|
|
104
|
+
// => ['xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl', ...]
|
|
105
|
+
|
|
106
|
+
// Find a value by ID or alias
|
|
107
|
+
const mediumSize = findValue(sizes, 'm');
|
|
108
|
+
const alsoMedium = findValue(sizes, 'medium'); // Using alias
|
|
109
|
+
// => { id: 'm', label: 'Medium', aliases: ['medium'], ... }
|
|
110
|
+
|
|
111
|
+
// Check if a value exists
|
|
112
|
+
if (hasValue(sizes, 'xl')) {
|
|
113
|
+
console.log('XL is a valid size');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Get the default value
|
|
117
|
+
const defaultSize = getDefault(sizes);
|
|
118
|
+
// => { id: 'm', label: 'Medium', default: true, ... }
|
|
119
|
+
|
|
120
|
+
// Get only non-deprecated values
|
|
121
|
+
const activeSizes = getActiveValues(sizes);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Importing Individual Registry Files
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
import sizesData from '@adobe/design-system-registry/registry/sizes.json' assert { type: 'json' };
|
|
128
|
+
import statesData from '@adobe/design-system-registry/registry/states.json' assert { type: 'json' };
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Registry Structure
|
|
132
|
+
|
|
133
|
+
Each registry file follows this JSON structure:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"$schema": "../schemas/registry-value.json",
|
|
138
|
+
"type": "size",
|
|
139
|
+
"description": "Standard size scale values used across Spectrum",
|
|
140
|
+
"values": [
|
|
141
|
+
{
|
|
142
|
+
"id": "m",
|
|
143
|
+
"label": "Medium",
|
|
144
|
+
"aliases": ["medium"],
|
|
145
|
+
"default": true,
|
|
146
|
+
"usedIn": ["tokens", "component-options", "component-schemas"],
|
|
147
|
+
"description": "Optional detailed description"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Value Properties
|
|
154
|
+
|
|
155
|
+
#### Basic Properties
|
|
156
|
+
|
|
157
|
+
* **id** (required): Unique identifier
|
|
158
|
+
* **label** (required): Human-readable label
|
|
159
|
+
* **aliases**: Alternative names or spellings
|
|
160
|
+
* **description**: Detailed description
|
|
161
|
+
* **default**: Whether this is the default value
|
|
162
|
+
* **deprecated**: Whether this value is deprecated
|
|
163
|
+
* **usedIn**: Where this value is used (tokens, component-schemas, etc.)
|
|
164
|
+
* **category**: Category or grouping
|
|
165
|
+
* **value**: Actual value if different from ID
|
|
166
|
+
* **documentationUrl**: URL to documentation
|
|
167
|
+
|
|
168
|
+
#### Enhanced Glossary Properties
|
|
169
|
+
|
|
170
|
+
* **definition**: Structured definition (superordinate, description, essentialCharacteristics)
|
|
171
|
+
* **platforms**: Platform-specific terminology and notes
|
|
172
|
+
* **terminology**: Classification and naming rationale (conceptType, namingRationale, alternatives)
|
|
173
|
+
* **sources**: References to source documentation
|
|
174
|
+
* **governance**: Ownership and review metadata (owner, reviewDate, status, replacedBy)
|
|
175
|
+
* **relatedTerms**: IDs of related terms
|
|
176
|
+
|
|
177
|
+
See [AUTHORING.md](AUTHORING.md) for detailed documentation on using these properties.
|
|
178
|
+
|
|
179
|
+
## Validation
|
|
180
|
+
|
|
181
|
+
The registry includes JSON Schema validation and consistency checks:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Validate all registries
|
|
185
|
+
pnpm run validate
|
|
186
|
+
|
|
187
|
+
# Run tests
|
|
188
|
+
pnpm test
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The validation script checks for:
|
|
192
|
+
|
|
193
|
+
* JSON Schema compliance
|
|
194
|
+
* Duplicate IDs within a registry
|
|
195
|
+
* Duplicate aliases within a registry
|
|
196
|
+
* Multiple default values
|
|
197
|
+
* Required fields
|
|
198
|
+
* Valid relatedTerms references
|
|
199
|
+
* Valid governance.replacedBy references
|
|
200
|
+
|
|
201
|
+
### Working with Platform Extensions
|
|
202
|
+
|
|
203
|
+
Platform teams can extend the registry with platform-specific terminology:
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
import {
|
|
207
|
+
states,
|
|
208
|
+
getTermForPlatform,
|
|
209
|
+
loadPlatformExtension
|
|
210
|
+
} from '@adobe/design-system-registry';
|
|
211
|
+
|
|
212
|
+
// Load platform extension
|
|
213
|
+
const iosStates = loadPlatformExtension('./registry/platform-extensions/ios-states.json');
|
|
214
|
+
|
|
215
|
+
// Get platform-specific term
|
|
216
|
+
const hoverTerm = getTermForPlatform(states, 'hover', 'iOS', iosStates);
|
|
217
|
+
|
|
218
|
+
console.log(hoverTerm.platform.term); // "highlighted"
|
|
219
|
+
console.log(hoverTerm.platform.reference); // "UIControl.State.highlighted"
|
|
220
|
+
console.log(hoverTerm.platform.codeExample); // "button.isHighlighted = true"
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
See [PLATFORM\_EXTENSIONS.md](PLATFORM_EXTENSIONS.md) for detailed documentation.
|
|
224
|
+
|
|
225
|
+
## Development
|
|
226
|
+
|
|
227
|
+
### Running Tests
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
pnpm test
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Validating Registry
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
pnpm run validate
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Contributing
|
|
240
|
+
|
|
241
|
+
When adding new values to registries:
|
|
242
|
+
|
|
243
|
+
1. Ensure the value has a unique `id`
|
|
244
|
+
2. Provide a clear `label`
|
|
245
|
+
3. Add `aliases` for common alternative names
|
|
246
|
+
4. Set `usedIn` to indicate where it's used
|
|
247
|
+
5. Add `description` for clarity
|
|
248
|
+
6. Run validation to check for errors
|
|
249
|
+
7. Run tests to ensure consistency
|
|
250
|
+
|
|
251
|
+
## Used By
|
|
252
|
+
|
|
253
|
+
This registry is consumed by:
|
|
254
|
+
|
|
255
|
+
* `@adobe/spectrum-tokens` - Design tokens
|
|
256
|
+
* `@adobe/spectrum-component-api-schemas` - Component schemas
|
|
257
|
+
* `@adobe/component-options-editor` - Component options authoring tool
|
|
258
|
+
* Token validation tools
|
|
259
|
+
* Future anatomy editor
|
|
260
|
+
|
|
261
|
+
## Related Packages
|
|
262
|
+
|
|
263
|
+
* [@adobe/spectrum-tokens](../tokens) - Design tokens for Spectrum
|
|
264
|
+
* [@adobe/spectrum-component-api-schemas](../component-schemas) - Component API schemas
|
|
265
|
+
|
|
266
|
+
## License
|
|
267
|
+
|
|
268
|
+
Apache 2.0
|
package/ava.config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
files: ["test/**/*.test.js"],
|
|
15
|
+
environmentVariables: {
|
|
16
|
+
NODE_ENV: "test",
|
|
17
|
+
},
|
|
18
|
+
verbose: true,
|
|
19
|
+
failFast: false,
|
|
20
|
+
failWithoutAssertions: true,
|
|
21
|
+
};
|