Skip to content

Commit 1e61829

Browse files
authored
fix: use real token types in examples, remove light/dark examples (#364)
* fix: use real token types in examples, remove light/dark examples * Address feedback
1 parent c84987c commit 1e61829

File tree

2 files changed

+154
-54
lines changed

2 files changed

+154
-54
lines changed

technical-reports/format/groups.md

Lines changed: 76 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,39 @@ Group extension follows **deep merge** behavior where local properties override
306306
```json
307307
{
308308
"base": {
309-
"color": { "$value": "#blue" },
310-
"spacing": { "$value": "16px" }
309+
"color": {
310+
"$type": "color",
311+
"$value": {
312+
"colorSpace": "srgb",
313+
"components": [0, 0.2, 0.8],
314+
"hex": "#0033cc"
315+
}
316+
},
317+
"spacing": {
318+
"$type": "dimension",
319+
"$value": { "value": 16, "unit": "px" }
320+
}
311321
},
312322
"extended": {
313323
"$extends": "{base}",
314-
"color": { "$value": "#red" }, // Overrides base.color
315-
"border": { "$value": "1px solid" } // Adds new token
324+
// Overrides base.color
325+
"color": {
326+
"$type": "color",
327+
"$value": {
328+
"colorSpace": "srgb",
329+
"components": [0.9, 0.05, 0],
330+
"hex": "#e60d00"
331+
}
332+
},
333+
// Adds new token
334+
"border": {
335+
"$type": "border",
336+
"$value": {
337+
"width": { "value": 1, "unit": "px" },
338+
"style": "solid",
339+
"color": "{extended.color}"
340+
}
341+
}
316342
}
317343
}
318344
```
@@ -321,11 +347,11 @@ Group extension follows **deep merge** behavior where local properties override
321347

322348
**Result for `extended`:**
323349

324-
| Token | Final Value | Source |
325-
| :-------- | :------------ | :--------- |
326-
| `color` | `"#red"` | overridden |
327-
| `spacing` | `"16px"` | inherited |
328-
| `border` | `"1px solid"` | added |
350+
| Token | Final Value | Source |
351+
| :----------------- | :------------------ | :--------- |
352+
| `extended.color` | `#e60d00` | overridden |
353+
| `extended.spacing` | `16px` | inherited |
354+
| `extended.border` | `1px solid #e60d00` | added |
329355

330356
### Circular Reference Prevention
331357

@@ -336,8 +362,10 @@ Groups MUST NOT create circular inheritance chains. The following patterns are *
336362
```jsonc
337363
{
338364
"button": {
339-
"color": { "$value": "#blue" },
340-
"border": { "$value": "1px solid" },
365+
"color": {
366+
"$type": "color",
367+
"$value": { "colorSpace": "srgb", "components": [0.4, 0.2, 0.6] },
368+
},
341369
"secondary": {
342370
"$extends": "{button}", // ❌ Invalid: circular reference
343371
},
@@ -353,11 +381,17 @@ Groups MUST NOT create circular inheritance chains. The following patterns are *
353381
{
354382
"groupA": {
355383
"$extends": "{groupB}",
356-
"token": { "$value": "valueA" },
384+
"token": {
385+
"$value": 1,
386+
"$type": "number",
387+
},
357388
},
358389
"groupB": {
359390
"$extends": "{groupA}", // ❌ Invalid: circular reference
360-
"token": { "$value": "valueB" },
391+
"token": {
392+
"$value": 2,
393+
"$type": "number",
394+
},
361395
},
362396
}
363397
```
@@ -371,16 +405,33 @@ Groups MUST NOT create circular inheritance chains. The following patterns are *
371405
```jsonc
372406
{
373407
"button": {
374-
"color": { "$value": "#blue" },
375-
"border": { "$value": "1px solid" },
408+
"color": {
409+
"$type": "color",
410+
"$value": {
411+
"colorSpace": "srgb",
412+
"components": [0, 1, 1],
413+
"hex": "#00ffff",
414+
},
415+
},
416+
"border": {
417+
"$type": "border",
418+
"$value": {
419+
"width": { "value": 1, "unit": "px" },
420+
"style": "solid",
421+
"color": "{button.color}",
422+
},
423+
},
376424
},
377425
"button-secondary": {
378426
"$extends": "{button}", // ✅ Valid: references parent group
379-
"color": { "$value": "#gray" },
427+
"color": {
428+
"$type": "color",
429+
"$value": { "colorSpace": "srgb", "components": [0.4, 0.4, 0.4] },
430+
},
380431
},
381432
"button-large": {
382433
"$extends": "{button}", // ✅ Valid: siblings can reference same parent
383-
"padding": { "$value": "16px" },
434+
"padding": { "$value": { "value": 16, "unit": "px" } },
384435
},
385436
}
386437
```
@@ -667,14 +718,14 @@ This demonstrates the key use case where a component extends a base component bu
667718
"hex": "#0066cc"
668719
}
669720
},
670-
"light": {
721+
"strong": {
671722
"$value": {
672723
"colorSpace": "srgb",
673724
"components": [0.2, 0.533, 0.867],
674725
"hex": "#3388dd"
675726
}
676727
},
677-
"dark": {
728+
"subdued": {
678729
"$value": {
679730
"colorSpace": "srgb",
680731
"components": [0, 0.267, 0.6],
@@ -692,14 +743,14 @@ This demonstrates the key use case where a component extends a base component bu
692743
"hex": "#00cc66"
693744
}
694745
},
695-
"light": {
746+
"strong": {
696747
"$value": {
697748
"colorSpace": "srgb",
698749
"components": [0.2, 0.867, 0.533],
699750
"hex": "#33dd88"
700751
}
701752
},
702-
"dark": {
753+
"subdued": {
703754
"$value": {
704755
"colorSpace": "srgb",
705756
"components": [0, 0.6, 0.267],
@@ -715,14 +766,14 @@ This demonstrates the key use case where a component extends a base component bu
715766
"hex": "#cc0000"
716767
}
717768
},
718-
"light": {
769+
"strong": {
719770
"$value": {
720771
"colorSpace": "srgb",
721772
"components": [1, 0.2, 0.2],
722773
"hex": "#ff3333"
723774
}
724775
},
725-
"dark": {
776+
"subdued": {
726777
"$value": {
727778
"colorSpace": "srgb",
728779
"components": [0.6, 0, 0],
@@ -742,9 +793,9 @@ This structure creates tokens accessible as:
742793
| Token Reference | Resolved Value |
743794
| :------------------------------- | :---------------------------------------------------------------------------- |
744795
| `{color.brand.$root}` | `{"colorSpace": "srgb", "components": [0, 0.4, 0.8], "hex": "#0066cc"}` |
745-
| `{color.brand.light}` | `{"colorSpace": "srgb", "components": [0.2, 0.533, 0.867], "hex": "#3388dd"}` |
796+
| `{color.brand.strong}` | `{"colorSpace": "srgb", "components": [0.2, 0.533, 0.867], "hex": "#3388dd"}` |
746797
| `{color.semantic.success.$root}` | `{"colorSpace": "srgb", "components": [0, 0.8, 0.4], "hex": "#00cc66"}` |
747-
| `{color.semantic.error.dark}` | `{"colorSpace": "srgb", "components": [0.6, 0, 0], "hex": "#990000"}` |
798+
| `{color.semantic.error.subdued}` | `{"colorSpace": "srgb", "components": [0.6, 0, 0], "hex": "#990000"}` |
748799

749800
## Use-cases
750801

0 commit comments

Comments
 (0)