Skip to content

Commit 24c3957

Browse files
committed
docs(adapters): expand Figma export guidance
1 parent b14da0c commit 24c3957

File tree

9 files changed

+184
-79
lines changed

9 files changed

+184
-79
lines changed

docs/adapters/figma.md

Lines changed: 66 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ title: Figma Adapter
44

55
# Figma Adapter
66

7-
Figma Variables exports include tool-specific metadata and reference syntax. This adapter normalizes Figma exports into Variable Contract format.
7+
Figma Variables exports include tool-specific metadata and reference syntax. This adapter normalizes Figma exports into Variable Design Standard (VDS) format.
88

9-
## Input format
9+
## Supported export formats
1010

11-
Figma exports include:
11+
This adapter handles two export formats:
12+
13+
1. **Plugin export format**: Generated by Figma plugins (available on all plans). Uses `@` collection prefixes, `$` group prefixes, and `$variable_metadata`.
14+
2. **REST API format**: From the [Local Variables endpoint](https://developers.figma.com/docs/rest-api/variables-endpoints/) (**Enterprise plan only**). Uses `valuesByMode` with internal IDs.
15+
16+
The normalization steps below focus on the plugin export format, which is more commonly used.
17+
18+
## Plugin export input format
19+
20+
Plugin exports include:
1221

1322
- `$collection_metadata` at collection level
1423
- `$variable_metadata` on each variable
@@ -82,11 +91,13 @@ After:
8291

8392
### Step 2: Normalize collection names
8493

85-
Remove `@` prefix from collection names. Figma uses `@collection` but Variable Contract uses `collection`.
94+
Remove `@` prefix from collection names. The `@` prefix is added by the export plugin to distinguish collections from groups. In Figma UI, you name the collection "Primitives" (without `@`).
95+
96+
Before: `"@primitives"` (from export)
8697

87-
Before: `"@primitives"`
98+
After: `"primitives"` (normalized)
8899

89-
After: `"primitives"`
100+
Similarly, group names have `$` prefixes in exports (e.g., `$color`, `$green`). These are added by the plugin because Figma uses `/` as path separators in variable names (e.g., `color/green/200`), and the export converts these to nested JSON objects with `$` prefixes to avoid conflicts with DTCG reserved properties like `$type` and `$value`.
90101

91102
### Step 3: Extract variable metadata
92103

@@ -134,7 +145,7 @@ Convert Figma reference syntax to canonical format.
134145

135146
Figma uses: `{@collection.token}`
136147

137-
Variable Contract uses: `{collection.token}`
148+
Variable Design Standard (VDS) uses: `{collection.token}`
138149

139150
Before:
140151

@@ -212,7 +223,7 @@ After:
212223

213224
### Step 6: Validate naming
214225

215-
Check that normalized names follow Variable Contract naming convention (see [Naming](/contract/naming)).
226+
Check that normalized names follow Variable Design Standard (VDS) naming convention (see [Naming](/contract/naming)).
216227

217228
- Names MUST use dot-separated paths
218229
- Names MUST be lowercase
@@ -261,7 +272,7 @@ Figma export:
261272
}
262273
```
263274

264-
Normalized Variable Contract:
275+
Normalized Variable Design Standard (VDS):
265276

266277
```json
267278
{
@@ -336,7 +347,7 @@ After normalization, verify:
336347
- All `@` prefixes removed from collection names
337348
- All references use canonical format (`{path}`)
338349
- Mode values moved to `$value` object
339-
- Names follow Variable Contract naming convention
350+
- Names follow Variable Design Standard (VDS) naming convention
340351

341352
## Workflow
342353

@@ -377,11 +388,53 @@ Before exporting from Figma:
377388
### Artifacts that change
378389

379390
- Figma export JSON (input, not committed)
380-
- Normalized Variable Contract JSON (committed, reviewed)
391+
- Normalized Variable Design Standard (VDS) JSON (committed, reviewed)
381392
- Generated CSS/TypeScript files (output, not committed)
382393

394+
## REST API format handling
395+
396+
For Enterprise plan users with REST API access, the input format differs:
397+
398+
```json
399+
{
400+
"variables": {
401+
"VariableID:502:227": {
402+
"id": "VariableID:502:227",
403+
"name": "color/green/200",
404+
"resolvedType": "COLOR",
405+
"valuesByMode": {
406+
"502:0": {
407+
"r": 0.216,
408+
"g": 1,
409+
"b": 0.341,
410+
"a": 1
411+
}
412+
},
413+
"variableCollectionId": "VariableCollectionId:502:189"
414+
}
415+
},
416+
"variableCollections": {
417+
"VariableCollectionId:502:189": {
418+
"id": "VariableCollectionId:502:189",
419+
"name": "Primitives",
420+
"modes": [
421+
{ "modeId": "502:0", "name": "Light" }
422+
]
423+
}
424+
}
425+
}
426+
```
427+
428+
REST API normalization requires:
429+
430+
1. Convert `valuesByMode` to `$value` object with mode names
431+
2. Convert RGBA objects to color format (hex or colorSpace object)
432+
3. Build variable hierarchy from `/`-separated names
433+
4. Resolve variable aliases (which use `VariableAlias` type)
434+
5. Map collection/mode IDs to names
435+
383436
## Out of scope
384437

385-
- Figma API integration (use Figma REST API or plugins)
386-
- Real-time sync (handle via version control)
438+
- Real-time sync with Figma (handle via version control)
387439
- Conflict resolution (handle via PR review)
440+
- Figma plugin development (see [Plugin API](https://developers.figma.com/docs/plugins/api/figma-variables/))

docs/adapters/index.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ title: Adapters
44

55
# Adapters
66

7-
Adapters normalize tool outputs into Variable Contract format and transform Variable Contract format into tool inputs.
7+
Adapters normalize tool outputs into Variable Design Standard (VDS) format and transform Variable Design Standard (VDS) format into tool inputs.
88

99
## Why adapters exist
1010

11-
Design tools export variables in formats that include tool-specific metadata and syntax. Variable Contract defines a canonical format for version control. Adapters bridge the gap between tool formats and the contract.
11+
Design tools export variables in formats that include tool-specific metadata and syntax. Variable Design Standard (VDS) defines a canonical format for version control. Adapters bridge the gap between tool formats and the contract.
1212

1313
## Adapter responsibilities
1414

1515
Adapters MUST:
1616

17-
1. Normalize naming to match Variable Contract naming convention
17+
1. Normalize naming to match Variable Design Standard (VDS) naming convention
1818
2. Convert reference syntax to canonical format (`{path.to.token}`)
1919
3. Move tool metadata to `$extensions`
20-
4. Validate that output conforms to Variable Contract rules
20+
4. Validate that output conforms to Variable Design Standard (VDS) rules
2121

2222
Adapters MAY:
2323

@@ -29,22 +29,22 @@ Adapters MAY:
2929

3030
### Input adapters
3131

32-
Input adapters convert tool exports into Variable Contract format.
32+
Input adapters convert tool exports into Variable Design Standard (VDS) format.
3333

3434
Examples:
3535

36-
- Figma Variables export → Variable Contract
37-
- Tokens Studio export → Variable Contract
36+
- Figma Variables export → Variable Design Standard (VDS)
37+
- Tokens Studio export → Variable Design Standard (VDS)
3838

3939
### Output adapters
4040

41-
Output adapters convert Variable Contract format into tool or platform formats.
41+
Output adapters convert Variable Design Standard (VDS) format into tool or platform formats.
4242

4343
Examples:
4444

45-
- Variable Contract → Style Dictionary → CSS variables
46-
- Variable Contract → TypeScript types
47-
- Variable Contract → Tailwind CSS v4 (`@theme` directive)
45+
- Variable Design Standard (VDS) → Style Dictionary → CSS variables
46+
- Variable Design Standard (VDS) → TypeScript types
47+
- Variable Design Standard (VDS) → Tailwind CSS v4 (`@theme` directive)
4848

4949
## Adapter pattern
5050

@@ -55,7 +55,7 @@ A typical adapter workflow:
5555
3. Normalize naming (if needed)
5656
4. Convert references to canonical format
5757
5. Move metadata to `$extensions`
58-
6. Validate output against Variable Contract
58+
6. Validate output against Variable Design Standard (VDS)
5959
7. Write normalized JSON
6060

6161
## Failure modes
@@ -71,7 +71,7 @@ If adapters fail:
7171

7272
- [Figma Adapter](figma) - Figma Variables export normalization
7373
- [Tokens Studio Adapter](tokens-studio) - Tokens Studio export normalization
74-
- [Style Dictionary Adapter](style-dictionary) - Variable Contract to CSS/TypeScript/etc.
74+
- [Style Dictionary Adapter](style-dictionary) - Variable Design Standard (VDS) to CSS/TypeScript/etc.
7575
- [Tailwind Adapter](tailwind) - Tailwind theme configuration generation
7676

7777
## Out of scope

docs/adapters/style-dictionary.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ title: Style Dictionary Adapter
44

55
# Style Dictionary Adapter
66

7-
Style Dictionary consumes Variable Contract (DTCG) format and generates platform outputs like CSS variables, TypeScript types, and Tailwind CSS v4 custom properties.
7+
Style Dictionary consumes Variable Design Standard (VDS) (DTCG) format and generates platform outputs like CSS variables, TypeScript types, and Tailwind CSS v4 custom properties.
88

99
## Role
1010

11-
Style Dictionary is an output adapter. It reads Variable Contract JSON and produces files for consumption in code.
11+
Style Dictionary is an output adapter. It reads Variable Design Standard (VDS) JSON and produces files for consumption in code.
1212

1313
## DTCG format support
1414

15-
Style Dictionary supports DTCG format natively. Use Variable Contract JSON files directly as Style Dictionary source files.
15+
Style Dictionary supports DTCG format natively. Use Variable Design Standard (VDS) JSON files directly as Style Dictionary source files.
1616

1717
## Configuration
1818

@@ -77,7 +77,7 @@ Legacy Style Dictionary format:
7777
}
7878
```
7979

80-
DTCG format (Variable Contract):
80+
DTCG format (Variable Design Standard (VDS)):
8181

8282
```json
8383
{
@@ -90,7 +90,7 @@ DTCG format (Variable Contract):
9090
}
9191
```
9292

93-
Style Dictionary handles both formats. Use DTCG format for Variable Contract compliance.
93+
Style Dictionary handles both formats. Use DTCG format for Variable Design Standard (VDS) compliance.
9494

9595
## Transform groups
9696

@@ -196,7 +196,7 @@ CSS output (separate files):
196196

197197
Typical workflow:
198198

199-
1. Store Variable Contract JSON in `tokens/` directory
199+
1. Store Variable Design Standard (VDS) JSON in `tokens/` directory
200200
2. Configure Style Dictionary to read from `tokens/`
201201
3. Run Style Dictionary build
202202
4. Generated files appear in `dist/`
@@ -219,7 +219,7 @@ Style Dictionary validates:
219219
- Reference resolution
220220
- Type correctness (for transforms that check types)
221221

222-
Variable Contract validation should happen before Style Dictionary build (in CI or pre-commit hooks).
222+
Variable Design Standard (VDS) validation should happen before Style Dictionary build (in CI or pre-commit hooks).
223223

224224
## Examples
225225

docs/adapters/tailwind.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ title: Tailwind Adapter
44

55
# Tailwind Adapter
66

7-
Tailwind CSS v4 integration patterns for Variable Contract. Generate CSS custom properties from Variable Contract JSON using Tailwind CSS v4's CSS-first approach.
7+
Tailwind CSS v4 integration patterns for Variable Design Standard (VDS). Generate CSS custom properties from Variable Design Standard (VDS) JSON using Tailwind CSS v4's CSS-first approach.
88

99
## Role
1010

11-
Tailwind adapter generates CSS custom properties from Variable Contract JSON. Variables map to Tailwind CSS v4's `@theme` directive. No JavaScript config files. Pure CSS.
11+
Tailwind adapter generates CSS custom properties from Variable Design Standard (VDS) JSON. Variables map to Tailwind CSS v4's `@theme` directive. No JavaScript config files. Pure CSS.
1212

1313
## Why Tailwind CSS v4
1414

15-
Tailwind CSS v4 is pure CSS. No JavaScript config. Design Engineers MUST master Tailwind CSS v4. Variable Contract variables map directly to CSS custom properties that Tailwind CSS v4 consumes.
15+
Tailwind CSS v4 is pure CSS. No JavaScript config. Design Engineers MUST master Tailwind CSS v4. Variable Design Standard (VDS) variables map directly to CSS custom properties that Tailwind CSS v4 consumes.
1616

1717
## Tailwind CSS v4 approach
1818

@@ -32,7 +32,7 @@ See [Tailwind CSS v4 documentation](https://tailwindcss.com/docs) for complete d
3232

3333
### Pattern 1: CSS custom properties
3434

35-
Generate CSS custom properties from Variable Contract JSON. Tailwind CSS v4 reads CSS variables directly.
35+
Generate CSS custom properties from Variable Design Standard (VDS) JSON. Tailwind CSS v4 reads CSS variables directly.
3636

3737
**Style Dictionary config:**
3838

@@ -92,9 +92,9 @@ Generate CSS custom properties from Variable Contract JSON. Tailwind CSS v4 read
9292

9393
### Pattern 2: Direct CSS generation
9494

95-
Transform Variable Contract JSON directly to CSS custom properties.
95+
Transform Variable Design Standard (VDS) JSON directly to CSS custom properties.
9696

97-
**Variable Contract:**
97+
**Variable Design Standard (VDS):**
9898

9999
```json
100100
{
@@ -137,29 +137,29 @@ Transform Variable Contract JSON directly to CSS custom properties.
137137

138138
### Colors
139139

140-
Variable Contract: `color.primary.500`
140+
Variable Design Standard (VDS): `color.primary.500`
141141
CSS: `--color-primary-500: #0066cc`
142142
Tailwind: `bg-primary-500` or `text-primary-500`
143143

144144
### Spacing
145145

146-
Variable Contract: `spacing.md`
146+
Variable Design Standard (VDS): `spacing.md`
147147
CSS: `--spacing-md: 1rem`
148148
Tailwind: `p-md` or `m-md`
149149

150150
Tailwind CSS v4 uses a dynamic spacing scale. The `--spacing` variable defines the base unit, and utilities like `px-8`, `mt-17`, `w-29` are generated dynamically using `calc(var(--spacing) * N)`.
151151

152152
### Typography
153153

154-
Variable Contract: `typography.fontFamily.sans`
154+
Variable Design Standard (VDS): `typography.fontFamily.sans`
155155
CSS: `--font-family-sans: "Inter", sans-serif`
156156
Tailwind: `font-sans`
157157

158158
## Modes support
159159

160160
Tailwind CSS v4 handles modes via CSS custom properties. Generate mode-specific CSS or use CSS variable overrides.
161161

162-
**Variable Contract with modes:**
162+
**Variable Design Standard (VDS) with modes:**
163163

164164
```json
165165
{
@@ -197,7 +197,7 @@ Design Engineer MUST:
197197

198198
- Master Tailwind CSS v4 CSS-first approach
199199
- Understand CSS custom properties and `@theme` directive
200-
- Map Variable Contract structure to CSS custom properties
200+
- Map Variable Design Standard (VDS) structure to CSS custom properties
201201
- Test variables in Tailwind components before approval
202202
- Maintain CSS generation pipeline (no JavaScript config)
203203

@@ -206,14 +206,14 @@ Design Engineer MUST:
206206
1. Designer creates variables in Figma
207207
2. Export from Figma
208208
3. Design Engineer normalizes with adapter
209-
4. Design Engineer generates CSS custom properties from Variable Contract JSON
209+
4. Design Engineer generates CSS custom properties from Variable Design Standard (VDS) JSON
210210
5. Design Engineer tests variables in Tailwind CSS v4 components
211-
6. Commit Variable Contract JSON and generated CSS
211+
6. Commit Variable Design Standard (VDS) JSON and generated CSS
212212
7. Frontend Developer consumes Tailwind utilities in components
213213

214214
## Example component
215215

216-
**Variable Contract:**
216+
**Variable Design Standard (VDS):**
217217

218218
```json
219219
{
@@ -254,7 +254,7 @@ Tailwind CSS v4 generates: `background-color: var(--color-surface-brand)`
254254
Tailwind adapter MUST:
255255

256256
- Generate valid CSS custom properties syntax
257-
- Map all Variable Contract variables to CSS custom properties
257+
- Map all Variable Design Standard (VDS) variables to CSS custom properties
258258
- Preserve variable references (use CSS `var()` syntax)
259259
- Handle modes (generate mode-specific CSS or CSS variable overrides)
260260
- Follow Tailwind CSS v4 naming conventions (`--color-*`, `--spacing-*`, `--font-*`)

0 commit comments

Comments
 (0)