Skip to content

Commit 696b5f4

Browse files
authored
Merge pull request #13 from marklearst/pr-scenarios-patterns
Tighten scenarios and patterns cadence
2 parents d96611e + d8f9962 commit 696b5f4

File tree

7 files changed

+126
-48
lines changed

7 files changed

+126
-48
lines changed

docs/patterns/multi-brand-architecture.md

Lines changed: 89 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
2-
title: Patterns - Multi-Brand Architecture
2+
title: Patterns: Multi-Brand Architecture
33
---
44

55
# Multi-Brand Architecture
66

7-
Complete example of multi-brand variable architecture using Variable Design Standard (VDS).
7+
This pattern specifies a multi-brand architecture that keeps one semantic name set across brands.
8+
9+
Failure if ignored: brand values leak across outputs or require a mapped layer to resolve.
810

911
## Architecture overview
1012

@@ -24,6 +26,84 @@ tokens/
2426
typography.json
2527
```
2628

29+
## File structure is the API
30+
31+
Semantic names are the API. Consumers request `color.surface.brand`. The build selects the brand folder that defines that name.
32+
33+
This replaces a mapped collection with file selection.
34+
35+
JSON files are the contract input. The folder path is the selector. The semantic names stay the same across brands.
36+
37+
Rules:
38+
39+
- The semantic name set MUST match across brand folders.
40+
- Build config MUST select exactly one brand folder at a time.
41+
- Mapped variables MUST NOT exist in the contract graph.
42+
43+
## File selection rule
44+
45+
File selection rule is shorthand for this model.
46+
47+
- The files are the contract input.
48+
- The folder path and file name are the selector.
49+
- The build or import list is the switch.
50+
51+
JSON-as-API: the file set is the interface and the selector.
52+
53+
This keeps brand choice out of a mapped layer and out of tool panels.
54+
55+
This is a file selection rule. It is not a hosted service.
56+
57+
Example selector:
58+
59+
```
60+
tokens/brand-a/color.json
61+
tokens/brand-b/color.json
62+
```
63+
64+
Pick one folder. The semantic names stay the same. The values change.
65+
66+
If you can select files, you can switch brands. No map required.
67+
68+
Example build selection:
69+
70+
```json
71+
{
72+
"source": ["tokens/base/**/*.json", "tokens/brand-a/**/*.json"]
73+
}
74+
```
75+
76+
Example CSS selection:
77+
78+
```css
79+
@layer base, brand;
80+
@import "variables-base.css" layer(base);
81+
@import "variables-brand-a.css" layer(brand);
82+
```
83+
84+
## Decision surface
85+
86+
Decisions live in files and build inputs, not in a mapped collection.
87+
88+
- Choose the brand by the source list or by CSS imports.
89+
- Use alias modes in tools for preview. Do not store brand logic in a variables panel.
90+
- Use one decision point. Do not add a second map.
91+
92+
Example preview:
93+
94+
```
95+
Alias collection
96+
Mode: brand-a
97+
color.surface.brand -> {color.brand.primary}
98+
Mode: brand-b
99+
color.surface.brand -> {color.brand.primary}
100+
```
101+
102+
## Governance note
103+
104+
- The file list is the only switch.
105+
- Changes to brand folders follow the contract review gate.
106+
27107
### Shared base
28108

29109
All brands share base scales:
@@ -93,10 +173,7 @@ Each brand has specific variables:
93173

94174
```json
95175
{
96-
"source": [
97-
"tokens/base/**/*.json",
98-
"tokens/brand-a/**/*.json"
99-
],
176+
"source": ["tokens/base/**/*.json", "tokens/brand-a/**/*.json"],
100177
"platforms": {
101178
"css": {
102179
"transformGroup": "css",
@@ -116,10 +193,7 @@ Each brand has specific variables:
116193

117194
```json
118195
{
119-
"source": [
120-
"tokens/base/**/*.json",
121-
"tokens/brand-b/**/*.json"
122-
],
196+
"source": ["tokens/base/**/*.json", "tokens/brand-b/**/*.json"],
123197
"platforms": {
124198
"css": {
125199
"transformGroup": "css",
@@ -174,21 +248,23 @@ Consume brand-specific variables:
174248
1. Share base scales across brands
175249
2. Keep brand-specific variables minimal
176250
3. Reference base variables in brand variables
177-
4. Use consistent naming across brands
251+
4. Use the same semantic name set across brand folders
178252
5. Document brand differences
179253

180254
## Failure modes
181255

182256
If multi-brand architecture is wrong:
183257

184258
- Duplication of shared variables
185-
- Inconsistent branding
259+
- Brand A values appear in Brand B output
186260
- Maintenance burden
187261
- Build complexity
262+
- Mapped variables appear as a shadow layer
263+
- Brand selection leaks into token names
264+
- All brands end up in one output bundle
188265

189266
## Out of scope
190267

191268
- Brand management tools (use existing tools)
192269
- Brand switching at runtime (handle in consumption layer)
193270
- Brand-specific design decisions (focus on structure)
194-

docs/patterns/performance.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
2-
title: Patterns - Performance Optimization
2+
title: Patterns: Performance
33
---
44

5-
# Performance Optimization
5+
# Performance
66

7-
How to reduce build times and file sizes for Variable Design Standard (VDS) with large variable sets.
7+
This pattern specifies constraints that keep build time and file size within limits.
8+
9+
Failure if ignored: builds slow down and outputs become too large to manage.
810

911
## Performance considerations
1012

@@ -32,7 +34,7 @@ Poor organization causes:
3234
- Merge conflicts
3335
- Maintenance burden
3436

35-
## Optimization strategies
37+
## Performance strategies
3638

3739
### File organization
3840

@@ -92,7 +94,7 @@ async function processFilesParallel(files) {
9294
}
9395
```
9496

95-
## Build optimization
97+
## Build performance
9698

9799
### Caching
98100

@@ -144,6 +146,5 @@ If performance rules are not followed:
144146
## Out of scope
145147

146148
- Runtime performance (handle in consumption layer)
147-
- Database optimization (use version control)
148-
- Network optimization (separate concern)
149-
149+
- Database performance (use version control)
150+
- Network performance (separate concern)

docs/patterns/theme-composition.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
2-
title: Patterns - Theme Composition
2+
title: Patterns: Theme Composition
33
---
44

55
# Theme Composition Patterns
66

7-
How to compose themes using modes and variable references.
7+
This pattern specifies theme composition using modes and references.
8+
9+
Failure if ignored: theme variants diverge and outputs do not match expected modes.
810

911
## Theme composition patterns
1012

@@ -220,7 +222,7 @@ Theme with multiple modes:
220222

221223
1. Use modes for theme variants
222224
2. Reference base variables in mode values
223-
3. Keep mode keys consistent
225+
3. Keep the same mode key set across the collection
224226
4. Document mode strategy
225227
5. Test theme switching
226228

@@ -231,11 +233,10 @@ If theme composition is wrong:
231233
- Theme switching breaks
232234
- Mode-specific outputs fail
233235
- Reference resolution fails
234-
- Inconsistent theming
236+
- Mode keys differ across variables
235237

236238
## Out of scope
237239

238240
- Runtime theme switching (handle in consumption layer)
239241
- Theme management UI (use existing tools)
240242
- Theme persistence (handle in application layer)
241-

docs/scenarios/component-integration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Scenarios - Component Integration
2+
title: Scenarios: Component Integration
33
---
44

55
# Component Library Integration
66

7-
How to integrate Variable Design Standard (VDS) with component libraries.
7+
This scenario specifies how component libraries consume variables.
88

9-
If components don't use variables correctly, you get hardcoded values, inconsistent styling, and maintenance burden.
9+
Failure if ignored: components bypass semantic aliases and hardcode values.
1010

1111
## Component variable patterns
1212

docs/scenarios/large-sets.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Scenarios - Large Variable Sets
2+
title: Scenarios: Large Variable Sets
33
---
44

55
# Large Variable Sets
66

7-
How to handle large variable sets (100+ variables) with performance considerations.
7+
This scenario specifies constraints for large variable sets (100+ variables).
88

9-
If large sets are not organized correctly, you get slow builds, memory issues, and maintenance burden.
9+
Failure if ignored: build time and memory use grow until validation and output generation fail.
1010

1111
## Performance considerations
1212

@@ -133,7 +133,7 @@ Cons:
133133
- Potential duplication
134134
- Cross-component references
135135

136-
## Reference resolution optimization
136+
## Reference resolution performance
137137

138138
### Cache resolved references
139139

@@ -175,7 +175,7 @@ async function resolveReferencesParallel(variables) {
175175
}
176176
```
177177

178-
## Build time optimization
178+
## Build time performance
179179

180180
### Incremental builds
181181

@@ -276,7 +276,7 @@ tokens/
276276

277277
1. Organize by category or component
278278
2. Keep files under 1000 variables
279-
3. Use consistent naming
279+
3. Use the same naming rules across files
280280
4. Cache resolved references
281281
5. Reduce build time (parallelize, cache)
282282

docs/scenarios/multi-brand.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Scenarios - Multi-Brand
2+
title: Scenarios: Multi-Brand
33
---
44

55
# Multi-Brand Architecture
66

7-
How to structure variables for multiple brands using Variable Design Standard (VDS).
7+
This scenario specifies a folder-based multi-brand structure where semantic names stay identical across brands.
88

9-
If brands share variables incorrectly, you get duplication, maintenance burden, and inconsistent branding.
9+
Failure if ignored: brand values leak across outputs and maintenance cost grows.
1010

1111
## Architecture patterns
1212

@@ -285,15 +285,15 @@ Brands extend base groups:
285285
1. Share base scales (spacing, typography)
286286
2. Keep brand-specific variables minimal
287287
3. Reference base variables in brand variables
288-
4. Use consistent naming across brands
288+
4. Use the same semantic names across brand folders
289289
5. Document brand differences
290290

291291
## Failure modes
292292

293293
If multi-brand structure is wrong:
294294

295295
- Duplication of shared variables
296-
- Inconsistent branding
296+
- Brand A values appear in Brand B output
297297
- Maintenance burden
298298
- Build complexity
299299

docs/scenarios/multi-theme.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Scenarios - Multi-Theme
2+
title: Scenarios: Multi-Theme
33
---
44

55
# Multi-Theme Patterns
66

7-
How to structure variables for multiple themes (light/dark, mobile/desktop) using modes.
7+
This scenario specifies theme variants using mode keys (light/dark, mobile/desktop).
88

9-
If themes are inconsistent, theme switching breaks and mode-specific outputs fail.
9+
Failure if ignored: mode key sets diverge and theme switching fails.
1010

1111
## Theme composition patterns
1212

@@ -145,7 +145,7 @@ Example:
145145
}
146146
```
147147

148-
The `$extensions.modes` documents expected modes but does not enforce them. Validation should check mode consistency.
148+
The `$extensions.modes` documents expected modes but does not enforce them. Validation should check mode key sets.
149149

150150
## Theme switching implementation
151151

@@ -278,14 +278,14 @@ Avoid mode explosion. Prefer separate mode dimensions when possible.
278278
## Implementation rules
279279

280280
1. Keep modes limited (`light`, `dark`)
281-
2. Use consistent mode keys across variables
281+
2. Use the same mode keys on every variable in a collection
282282
3. Reference base variables in mode values
283283
4. Document mode strategy
284-
5. Validate mode consistency
284+
5. Validate that each variable exposes the same mode set
285285

286286
## Failure modes
287287

288-
If themes are inconsistent:
288+
If mode keys differ across variables in the same collection:
289289

290290
- Theme switching breaks
291291
- Mode-specific outputs fail
@@ -295,5 +295,5 @@ If themes are inconsistent:
295295
## Out of scope
296296

297297
- Runtime theme switching (handle in consumption layer)
298-
- Theme transformation (handle in adapters)
298+
- Theme conversion (handle in adapters)
299299
- Theme management UI (use existing tools)

0 commit comments

Comments
 (0)