@primer/primitives 11.4.0 → 11.4.1-rc.0499d5a6

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.
Files changed (165) hide show
  1. package/DESIGN_TOKENS_GUIDE.md +185 -0
  2. package/DESIGN_TOKENS_SPEC.md +565 -0
  3. package/dist/build/formats/jsonFigma.js +8 -1
  4. package/dist/build/formats/markdownLlmGuidelines.d.ts +7 -6
  5. package/dist/build/formats/markdownLlmGuidelines.js +1034 -60
  6. package/dist/build/schemas/borderToken.d.ts +61 -5
  7. package/dist/build/schemas/borderToken.js +2 -1
  8. package/dist/build/schemas/colorToken.d.ts +639 -30
  9. package/dist/build/schemas/colorToken.js +3 -2
  10. package/dist/build/schemas/colorW3cValue.d.ts +28 -0
  11. package/dist/build/schemas/colorW3cValue.js +42 -0
  12. package/dist/build/schemas/cubicBezierToken.d.ts +1 -1
  13. package/dist/build/schemas/dimensionToken.d.ts +9 -2
  14. package/dist/build/schemas/dimensionValue.d.ts +12 -1
  15. package/dist/build/schemas/dimensionValue.js +10 -13
  16. package/dist/build/schemas/durationToken.d.ts +8 -2
  17. package/dist/build/schemas/durationValue.d.ts +11 -1
  18. package/dist/build/schemas/durationValue.js +13 -3
  19. package/dist/build/schemas/fontFamilyToken.d.ts +1 -1
  20. package/dist/build/schemas/fontWeightToken.d.ts +1 -1
  21. package/dist/build/schemas/gradientToken.d.ts +23 -2
  22. package/dist/build/schemas/gradientToken.js +2 -1
  23. package/dist/build/schemas/numberToken.d.ts +1 -1
  24. package/dist/build/schemas/shadowToken.d.ts +1751 -127
  25. package/dist/build/schemas/shadowToken.js +8 -2
  26. package/dist/build/schemas/stringToken.d.ts +1 -1
  27. package/dist/build/schemas/stringToken.js +1 -1
  28. package/dist/build/schemas/tokenType.d.ts +1 -1
  29. package/dist/build/schemas/transitionToken.d.ts +15 -3
  30. package/dist/build/schemas/typographyToken.d.ts +19 -5
  31. package/dist/build/schemas/typographyToken.js +1 -1
  32. package/dist/build/schemas/validTokenType.d.ts +1 -1
  33. package/dist/build/schemas/validTokenType.js +1 -1
  34. package/dist/build/schemas/viewportRangeToken.d.ts +1 -1
  35. package/dist/build/transformers/borderToCss.js +19 -1
  36. package/dist/build/transformers/colorAlphaToCss.js +6 -3
  37. package/dist/build/transformers/colorToHex.js +5 -2
  38. package/dist/build/transformers/colorToRgbAlpha.js +5 -2
  39. package/dist/build/transformers/colorToRgbaFloat.js +5 -0
  40. package/dist/build/transformers/dimensionToPixelUnitless.d.ts +3 -2
  41. package/dist/build/transformers/dimensionToPixelUnitless.js +22 -26
  42. package/dist/build/transformers/dimensionToRem.d.ts +2 -1
  43. package/dist/build/transformers/dimensionToRem.js +21 -22
  44. package/dist/build/transformers/dimensionToRemPxArray.d.ts +2 -1
  45. package/dist/build/transformers/dimensionToRemPxArray.js +21 -22
  46. package/dist/build/transformers/durationToCss.d.ts +2 -1
  47. package/dist/build/transformers/durationToCss.js +18 -11
  48. package/dist/build/transformers/gradientToCss.js +2 -1
  49. package/dist/build/transformers/shadowToCss.js +15 -1
  50. package/dist/build/transformers/utilities/normalizeColorValue.d.ts +23 -0
  51. package/dist/build/transformers/utilities/normalizeColorValue.js +74 -0
  52. package/dist/build/transformers/utilities/parseDimension.d.ts +12 -0
  53. package/dist/build/transformers/utilities/parseDimension.js +31 -0
  54. package/dist/build/types/borderTokenValue.d.ts +5 -2
  55. package/dist/build/types/dimensionTokenValue.d.ts +9 -0
  56. package/dist/build/types/shadowTokenValue.d.ts +8 -5
  57. package/dist/css/functional/themes/dark-colorblind-high-contrast.css +32 -28
  58. package/dist/css/functional/themes/dark-colorblind.css +32 -28
  59. package/dist/css/functional/themes/dark-dimmed-high-contrast.css +32 -28
  60. package/dist/css/functional/themes/dark-dimmed.css +32 -28
  61. package/dist/css/functional/themes/dark-high-contrast.css +32 -28
  62. package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +32 -28
  63. package/dist/css/functional/themes/dark-tritanopia.css +32 -28
  64. package/dist/css/functional/themes/dark.css +32 -28
  65. package/dist/css/functional/themes/light-colorblind-high-contrast.css +32 -28
  66. package/dist/css/functional/themes/light-colorblind.css +32 -28
  67. package/dist/css/functional/themes/light-high-contrast.css +32 -28
  68. package/dist/css/functional/themes/light-tritanopia-high-contrast.css +32 -28
  69. package/dist/css/functional/themes/light-tritanopia.css +32 -28
  70. package/dist/css/functional/themes/light.css +32 -28
  71. package/dist/css/primitives.css +4 -0
  72. package/dist/docs/base/motion/motion.json +96 -24
  73. package/dist/docs/base/size/size.json +76 -19
  74. package/dist/docs/base/typography/typography.json +24 -6
  75. package/dist/docs/functional/size/border.json +26 -11
  76. package/dist/docs/functional/size/breakpoints.json +24 -6
  77. package/dist/docs/functional/size/radius.json +16 -4
  78. package/dist/docs/functional/size/size.json +60 -15
  79. package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +2629 -346
  80. package/dist/docs/functional/themes/dark-colorblind.json +2629 -346
  81. package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +2629 -346
  82. package/dist/docs/functional/themes/dark-dimmed.json +2629 -346
  83. package/dist/docs/functional/themes/dark-high-contrast.json +2629 -346
  84. package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +2629 -346
  85. package/dist/docs/functional/themes/dark-tritanopia.json +2629 -346
  86. package/dist/docs/functional/themes/dark.json +2629 -346
  87. package/dist/docs/functional/themes/light-colorblind-high-contrast.json +2635 -352
  88. package/dist/docs/functional/themes/light-colorblind.json +2632 -349
  89. package/dist/docs/functional/themes/light-high-contrast.json +2635 -352
  90. package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +2635 -352
  91. package/dist/docs/functional/themes/light-tritanopia.json +2632 -349
  92. package/dist/docs/functional/themes/light.json +2632 -349
  93. package/dist/docs/functional/typography/typography.json +8 -2
  94. package/dist/fallbacks/base/motion/motion.json +48 -12
  95. package/dist/figma/themes/light-colorblind.json +4 -4
  96. package/dist/figma/themes/light-high-contrast.json +4 -4
  97. package/dist/figma/themes/light-tritanopia.json +4 -4
  98. package/dist/figma/themes/light.json +4 -4
  99. package/dist/internalCss/dark-colorblind-high-contrast.css +28 -28
  100. package/dist/internalCss/dark-colorblind.css +28 -28
  101. package/dist/internalCss/dark-dimmed-high-contrast.css +28 -28
  102. package/dist/internalCss/dark-dimmed.css +28 -28
  103. package/dist/internalCss/dark-high-contrast.css +28 -28
  104. package/dist/internalCss/dark-tritanopia-high-contrast.css +28 -28
  105. package/dist/internalCss/dark-tritanopia.css +28 -28
  106. package/dist/internalCss/dark.css +28 -28
  107. package/dist/internalCss/light-colorblind-high-contrast.css +28 -28
  108. package/dist/internalCss/light-colorblind.css +28 -28
  109. package/dist/internalCss/light-high-contrast.css +28 -28
  110. package/dist/internalCss/light-tritanopia-high-contrast.css +28 -28
  111. package/dist/internalCss/light-tritanopia.css +28 -28
  112. package/dist/internalCss/light.css +28 -28
  113. package/dist/styleLint/base/motion/motion.json +96 -24
  114. package/dist/styleLint/base/size/size.json +76 -19
  115. package/dist/styleLint/base/typography/typography.json +30 -12
  116. package/dist/styleLint/functional/size/border.json +27 -12
  117. package/dist/styleLint/functional/size/breakpoints.json +24 -6
  118. package/dist/styleLint/functional/size/radius.json +17 -5
  119. package/dist/styleLint/functional/size/size-coarse.json +3 -3
  120. package/dist/styleLint/functional/size/size-fine.json +3 -3
  121. package/dist/styleLint/functional/size/size.json +111 -66
  122. package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +2757 -366
  123. package/dist/styleLint/functional/themes/dark-colorblind.json +2757 -366
  124. package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +2757 -366
  125. package/dist/styleLint/functional/themes/dark-dimmed.json +2757 -366
  126. package/dist/styleLint/functional/themes/dark-high-contrast.json +2757 -366
  127. package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +2757 -366
  128. package/dist/styleLint/functional/themes/dark-tritanopia.json +2757 -366
  129. package/dist/styleLint/functional/themes/dark.json +2757 -366
  130. package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +2763 -372
  131. package/dist/styleLint/functional/themes/light-colorblind.json +2760 -369
  132. package/dist/styleLint/functional/themes/light-high-contrast.json +2763 -372
  133. package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +2763 -372
  134. package/dist/styleLint/functional/themes/light-tritanopia.json +2760 -369
  135. package/dist/styleLint/functional/themes/light.json +2760 -369
  136. package/dist/styleLint/functional/typography/typography.json +28 -22
  137. package/package.json +9 -7
  138. package/src/tokens/base/motion/timing.json5 +12 -12
  139. package/src/tokens/base/size/size.json5 +194 -194
  140. package/src/tokens/base/typography/typography.json5 +6 -6
  141. package/src/tokens/component/avatar.json5 +72 -44
  142. package/src/tokens/component/button.json5 +1545 -1193
  143. package/src/tokens/functional/border/border.json5 +4 -1
  144. package/src/tokens/functional/color/bgColor.json5 +8 -0
  145. package/src/tokens/functional/color/display.json5 +7 -0
  146. package/src/tokens/functional/color/fgColor.json5 +8 -0
  147. package/src/tokens/functional/color/syntax.json5 +14 -0
  148. package/src/tokens/functional/shadow/shadow.json5 +1254 -163
  149. package/src/tokens/functional/size/border.json5 +8 -8
  150. package/src/tokens/functional/size/breakpoints.json5 +6 -6
  151. package/src/tokens/functional/size/radius.json5 +4 -4
  152. package/src/tokens/functional/size/size.json5 +15 -15
  153. package/src/tokens/functional/typography/typography.json5 +8 -4
  154. package/dist/build/parsers/index.d.ts +0 -1
  155. package/dist/build/parsers/index.js +0 -1
  156. package/dist/build/parsers/w3cJsonParser.d.ts +0 -6
  157. package/dist/build/parsers/w3cJsonParser.js +0 -25
  158. package/dist/removed/testing.json5 +0 -4
  159. package/guidelines/color.llm.md +0 -16
  160. package/guidelines/guidelines.llm.md +0 -34
  161. package/guidelines/motion.llm.md +0 -41
  162. package/guidelines/spacing.llm.md +0 -20
  163. package/guidelines/typography.llm.md +0 -14
  164. package/src/tokens/removed/testing.json5 +0 -4
  165. package/token-guidelines.llm.md +0 -695
@@ -3,17 +3,17 @@
3
3
  thin: {
4
4
  $value: 'inset 0 0 0 {borderWidth.thin}',
5
5
  $description: 'Thin shadow used instead of a border to prevent layout shift',
6
- $type: 'string',
6
+ $type: 'custom-string',
7
7
  },
8
8
  thick: {
9
9
  $value: 'inset 0 0 0 {borderWidth.thick}',
10
10
  $description: 'Thick shadow (2px) used instead of a border for emphasis without layout shift',
11
- $type: 'string',
11
+ $type: 'custom-string',
12
12
  },
13
13
  thicker: {
14
14
  $value: 'inset 0 0 0 {borderWidth.thicker}',
15
15
  $description: 'Thickest shadow (4px) used for high emphasis borders without layout shift. Use sparingly for maximum visual impact',
16
- $type: 'string',
16
+ $type: 'custom-string',
17
17
  },
18
18
  },
19
19
  borderWidth: {
@@ -29,7 +29,7 @@
29
29
  },
30
30
  },
31
31
  thin: {
32
- $value: '1px',
32
+ $value: {value: 1, unit: 'px'},
33
33
  $description: 'Standard 1px border width. Use for most borders, dividers, and outlines throughout the interface',
34
34
  $type: 'dimension',
35
35
  $extensions: {
@@ -40,7 +40,7 @@
40
40
  },
41
41
  },
42
42
  thick: {
43
- $value: '2px',
43
+ $value: {value: 2, unit: 'px'},
44
44
  $description: 'Thick 2px border for emphasis. Use for focus indicators, selected states, or to emphasize important boundaries',
45
45
  $type: 'dimension',
46
46
  $extensions: {
@@ -55,7 +55,7 @@
55
55
  },
56
56
  },
57
57
  thicker: {
58
- $value: '4px',
58
+ $value: {value: 4, unit: 'px'},
59
59
  $description: 'Extra thick 4px border for maximum emphasis. Use sparingly for high-contrast focus indicators or critical visual separators',
60
60
  $type: 'dimension',
61
61
  $extensions: {
@@ -69,7 +69,7 @@
69
69
  outline: {
70
70
  focus: {
71
71
  offset: {
72
- $value: '-2px',
72
+ $value: {value: -2, unit: 'px'},
73
73
  $description: 'Focus outline offset (-2px). Negative value creates an inset outline for keyboard focus indicators, ensuring the focus ring stays within the element bounds',
74
74
  $type: 'dimension',
75
75
  $extensions: {
@@ -80,7 +80,7 @@
80
80
  },
81
81
  },
82
82
  width: {
83
- $value: '2px',
83
+ $value: {value: 2, unit: 'px'},
84
84
  $description: 'Focus outline width (2px). Standard width for keyboard focus indicators to meet WCAG 2.4.7 accessibility requirements',
85
85
  $type: 'dimension',
86
86
  $extensions: {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "breakpoint": {
3
3
  "xsmall": {
4
- "$value": "320px",
4
+ "$value": {"value": 320, "unit": "px"},
5
5
  "$type": "dimension",
6
6
  "$extensions": {
7
7
  "org.primer.figma": {
@@ -11,7 +11,7 @@
11
11
  }
12
12
  },
13
13
  "small": {
14
- "$value": "544px",
14
+ "$value": {"value": 544, "unit": "px"},
15
15
  "$type": "dimension",
16
16
  "$extensions": {
17
17
  "org.primer.figma": {
@@ -21,7 +21,7 @@
21
21
  }
22
22
  },
23
23
  "medium": {
24
- "$value": "768px",
24
+ "$value": {"value": 768, "unit": "px"},
25
25
  "$type": "dimension",
26
26
  "$extensions": {
27
27
  "org.primer.figma": {
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  "large": {
34
- "$value": "1012px",
34
+ "$value": {"value": 1012, "unit": "px"},
35
35
  "$type": "dimension",
36
36
  "$extensions": {
37
37
  "org.primer.figma": {
@@ -41,7 +41,7 @@
41
41
  }
42
42
  },
43
43
  "xlarge": {
44
- "$value": "1280px",
44
+ "$value": {"value": 1280, "unit": "px"},
45
45
  "$type": "dimension",
46
46
  "$extensions": {
47
47
  "org.primer.figma": {
@@ -51,7 +51,7 @@
51
51
  }
52
52
  },
53
53
  "xxlarge": {
54
- "$value": "1400px",
54
+ "$value": {"value": 1400, "unit": "px"},
55
55
  "$type": "dimension",
56
56
  "$extensions": {
57
57
  "org.primer.figma": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  borderRadius: {
3
3
  small: {
4
- $value: '3px',
4
+ $value: {value: 3, unit: 'px'},
5
5
  $description: 'Small border radius (3px). Use for small variants of components or small UI elements like badges, tags, or anything below 16px in height',
6
6
  $type: 'dimension',
7
7
  $extensions: {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  },
21
21
  medium: {
22
- $value: '6px',
22
+ $value: {value: 6, unit: 'px'},
23
23
  $description: 'Medium border radius (6px). The default choice for most buttons, cards, and containers',
24
24
  $type: 'dimension',
25
25
  $extensions: {
@@ -37,7 +37,7 @@
37
37
  },
38
38
  },
39
39
  large: {
40
- $value: '12px',
40
+ $value: {value: 12, unit: 'px'},
41
41
  $description: 'Large border radius (12px). Use for larger containers, dialogs, or when more visual softness is desired. Always use this for buttons.',
42
42
  $type: 'dimension',
43
43
  $extensions: {
@@ -55,7 +55,7 @@
55
55
  },
56
56
  },
57
57
  full: {
58
- $value: '9999px',
58
+ $value: {value: 9999, unit: 'px'},
59
59
  $type: 'dimension',
60
60
  $description: 'Use this border radius for pill shaped elements',
61
61
  $extensions: {
@@ -51,7 +51,7 @@
51
51
  }
52
52
  },
53
53
  "paddingBlock": {
54
- "$value": "2px",
54
+ "$value": {"value": 2, "unit": "px"},
55
55
  "$type": "dimension",
56
56
  "$extensions": {
57
57
  "org.primer.figma": {
@@ -189,7 +189,7 @@
189
189
  }
190
190
  },
191
191
  "paddingBlock": {
192
- "$value": "6px",
192
+ "$value": {"value": 6, "unit": "px"},
193
193
  "$type": "dimension",
194
194
  "$extensions": {
195
195
  "org.primer.figma": {
@@ -263,7 +263,7 @@
263
263
  }
264
264
  },
265
265
  "paddingBlock": {
266
- "$value": "10px",
266
+ "$value": {"value": 10, "unit": "px"},
267
267
  "$type": "dimension",
268
268
  "$extensions": {
269
269
  "org.primer.figma": {
@@ -327,7 +327,7 @@
327
327
  }
328
328
  },
329
329
  "paddingBlock": {
330
- "$value": "14px",
330
+ "$value": {"value": 14, "unit": "px"},
331
331
  "$type": "dimension",
332
332
  "$extensions": {
333
333
  "org.primer.figma": {
@@ -380,7 +380,7 @@
380
380
  },
381
381
  "strokeWidth": {
382
382
  "default": {
383
- "$value": "2px",
383
+ "$value": {"value": 2, "unit": "px"},
384
384
  "$type": "dimension"
385
385
  }
386
386
  },
@@ -615,7 +615,7 @@
615
615
  },
616
616
  "width": {
617
617
  "xsmall": {
618
- "$value": "192px",
618
+ "$value": {"value": 192, "unit": "px"},
619
619
  "$type": "dimension",
620
620
  "$extensions": {
621
621
  "org.primer.figma": {
@@ -625,7 +625,7 @@
625
625
  }
626
626
  },
627
627
  "small": {
628
- "$value": "320px",
628
+ "$value": {"value": 320, "unit": "px"},
629
629
  "$type": "dimension",
630
630
  "$extensions": {
631
631
  "org.primer.figma": {
@@ -635,7 +635,7 @@
635
635
  }
636
636
  },
637
637
  "medium": {
638
- "$value": "480px",
638
+ "$value": {"value": 480, "unit": "px"},
639
639
  "$type": "dimension",
640
640
  "$extensions": {
641
641
  "org.primer.figma": {
@@ -645,7 +645,7 @@
645
645
  }
646
646
  },
647
647
  "large": {
648
- "$value": "640px",
648
+ "$value": {"value": 640, "unit": "px"},
649
649
  "$type": "dimension",
650
650
  "$extensions": {
651
651
  "org.primer.figma": {
@@ -655,7 +655,7 @@
655
655
  }
656
656
  },
657
657
  "xlarge": {
658
- "$value": "960px",
658
+ "$value": {"value": 960, "unit": "px"},
659
659
  "$type": "dimension",
660
660
  "$extensions": {
661
661
  "org.primer.figma": {
@@ -667,7 +667,7 @@
667
667
  },
668
668
  "height": {
669
669
  "small": {
670
- "$value": "256px",
670
+ "$value": {"value": 256, "unit": "px"},
671
671
  "$type": "dimension",
672
672
  "$extensions": {
673
673
  "org.primer.figma": {
@@ -677,7 +677,7 @@
677
677
  }
678
678
  },
679
679
  "medium": {
680
- "$value": "320px",
680
+ "$value": {"value": 320, "unit": "px"},
681
681
  "$type": "dimension",
682
682
  "$extensions": {
683
683
  "org.primer.figma": {
@@ -687,7 +687,7 @@
687
687
  }
688
688
  },
689
689
  "large": {
690
- "$value": "432px",
690
+ "$value": {"value": 432, "unit": "px"},
691
691
  "$type": "dimension",
692
692
  "$extensions": {
693
693
  "org.primer.figma": {
@@ -697,7 +697,7 @@
697
697
  }
698
698
  },
699
699
  "xlarge": {
700
- "$value": "600px",
700
+ "$value": {"value": 600, "unit": "px"},
701
701
  "$type": "dimension",
702
702
  "$extensions": {
703
703
  "org.primer.figma": {
@@ -762,7 +762,7 @@
762
762
  }
763
763
  },
764
764
  "offset": {
765
- "$value": "4px",
765
+ "$value": {"value": 4, "unit": "px"},
766
766
  "$type": "dimension",
767
767
  "$extensions": {
768
768
  "org.primer.figma": {
@@ -450,17 +450,18 @@
450
450
  fontFamily: '{fontStack.sansSerif}',
451
451
  },
452
452
  $type: 'typography',
453
- $description: 'Compact small font with a smaller line height of 16px. Use it for single-line scenarios, as the small sizing doesn’t pass accessibility requirements.',
453
+ $description: 'Compact small font with a smaller line height of 16px. Use it for single-line scenarios, as the small sizing doesn’t pass accessibility requirements.',
454
454
  $extensions: {
455
455
  'org.primer.llm': {
456
456
  usage: ['caption', 'label', 'badge-text', 'single-line-metadata'],
457
457
  rules: 'Use only for single-line or short text. Does NOT meet accessibility requirements for body text.',
458
458
  },
459
- }, },
459
+ },
460
+ },
460
461
  },
461
462
  codeBlock: {
462
463
  size: {
463
- $value: '13px',
464
+ $value: {value: 13, unit: 'px'},
464
465
  $type: 'dimension',
465
466
  $extensions: {
466
467
  'org.primer.figma': {
@@ -511,7 +512,10 @@
511
512
  },
512
513
  codeInline: {
513
514
  size: {
514
- $value: '0.9285em',
515
+ $value: {
516
+ value: 0.9285,
517
+ unit: 'em',
518
+ },
515
519
  $type: 'dimension',
516
520
  $extensions: {
517
521
  'org.primer.figma': {
@@ -1 +0,0 @@
1
- export { w3cJsonParser } from './w3cJsonParser.js';
@@ -1 +0,0 @@
1
- export { w3cJsonParser } from './w3cJsonParser.js';
@@ -1,6 +0,0 @@
1
- import type { Parser } from 'style-dictionary/types';
2
- /**
3
- * @description Parses a valid [json5](https://json5.org) file and replaces `$value` with `value` and `$description` with `comment` to make a w3c standard file compatible with style dictionary
4
- * @pattern supported file extensions `.json` or `.json5`
5
- */
6
- export declare const w3cJsonParser: Parser;
@@ -1,25 +0,0 @@
1
- import JSON5 from 'json5';
2
- /**
3
- * @description Parses a valid [json5](https://json5.org) file and replaces `$value` with `value` and `$description` with `comment` to make a w3c standard file compatible with style dictionary
4
- * @pattern supported file extensions `.json` or `.json5`
5
- */
6
- export const w3cJsonParser = {
7
- name: 'w3cJsonParser',
8
- pattern: /\.json5?$/,
9
- parser: ({ filePath, contents }) => {
10
- // replace $value with value so that style dictionary recognizes it
11
- try {
12
- contents = contents
13
- .replace(/["|']?\$value["|']?:/g, '"value":')
14
- // convert $description to comment
15
- .replace(/["|']?\$?description["|']?:/g, '"comment":')
16
- .replace(/["|']?\$?type["|']?:/g, '"$type":')
17
- .replace(/["|']?\$?extensions["|']?:/g, '"$extensions":');
18
- //
19
- return JSON5.parse(contents);
20
- }
21
- catch (error) {
22
- throw new Error(`Invalid json5 file "${filePath}". Error: ${error}`);
23
- }
24
- },
25
- };
@@ -1,4 +0,0 @@
1
- /* rename token to trigger actions to run on token change */
2
- {
3
- "testing": null
4
- }
@@ -1,16 +0,0 @@
1
- # Color Guidelines
2
-
3
- How to use color tokens correctly for accessible, themeable interfaces.
4
-
5
- ## Pairing Rules
6
-
7
- - MUST use `--fgColor-onEmphasis` for text on any `-emphasis` background
8
- - MUST use `--fgColor-{semantic}` for text on any `-muted` background
9
- - MUST use `--fgColor-default` for text on `--bgColor-default` or `--bgColor-muted`
10
- - NEVER pair `--fgColor-muted` with `--bgColor-muted` (insufficient contrast)
11
-
12
- ## Contrast Requirements
13
-
14
- - MUST ensure 4.5:1 contrast ratio for normal text (WCAG AA)
15
- - MUST ensure 3:1 contrast ratio for large text and UI components
16
- - SHOULD use semantic token pairings which are pre-validated for contrast
@@ -1,34 +0,0 @@
1
- # Primer Design Token Guidelines
2
-
3
- Quick reference for using Primer design tokens correctly.
4
-
5
- ## Tokens
6
-
7
- - MUST use CSS custom properties (design tokens) for all values—never raw values like `#fff` or `16px`
8
-
9
- ## Interactive Elements
10
-
11
- - MUST define all five states for interactive elements (rest, hover, focus, active/pressed, disabled)
12
- - MUST use `:focus-visible` (not `:focus`) for keyboard focus styles
13
- - NEVER remove hover or focus states for aesthetics
14
-
15
- ## Motion
16
-
17
- Use subtle motion to enhance interactivity and understanding. All interactive states (hover, focus, press) MUST have motion transitions. Keep animations under 300ms and respect `prefers-reduced-motion`.
18
-
19
- → [Full motion guidelines](motion.llm.md)
20
-
21
- ## Color
22
-
23
- - Use semantic pairings (fg/bg) and enforce contrast requirements.
24
- - See: [color guidelines](color.llm.md)
25
-
26
- ## Spacing
27
-
28
- - Use control/stack tokens for sizing, padding, and gaps.
29
- - See: [spacing guidelines](spacing.llm.md)
30
-
31
- ## Typography
32
-
33
- - Use shorthand text tokens and follow responsive guidance.
34
- - See: [typography guidelines](typography.llm.md)
@@ -1,41 +0,0 @@
1
- # Motion Guidelines
2
-
3
- Motion enhances user understanding and provides feedback. Keep it subtle and purposeful.
4
-
5
- ## Core Principles
6
-
7
- - MUST use motion for interactive state changes (hover, focus, press)
8
- - MUST keep motion subtle—users should feel it, not notice it
9
- - MUST use motion to support understanding, not distract
10
- - SHOULD keep animations under 300ms for UI interactions
11
- - NEVER use motion purely for decoration
12
- - NEVER create motion that loops indefinitely without user control
13
-
14
- ## When to Use Motion
15
-
16
- - MUST animate hover states on interactive elements (buttons, links, cards)
17
- - MUST animate focus states for keyboard navigation
18
- - MUST animate state transitions (expand/collapse, show/hide)
19
- - SHOULD animate page/view transitions
20
- - SHOULD animate loading states to indicate progress
21
- - NEVER animate static content or non-interactive elements
22
-
23
- ## Easing Selection
24
-
25
- 1. **Element entering or exiting viewport?** → `ease-out` (default)
26
- 2. **Moving or morphing on screen?** → `ease-in-out`
27
- 3. **Hover state change?** → `ease`
28
- 4. **Constant motion (loaders)?** → `linear`
29
-
30
- ## Duration Guidelines
31
-
32
- - MUST use 100-200ms for micro-interactions (hover, focus)
33
- - SHOULD use 200-300ms for state changes (expand, collapse)
34
- - SHOULD use 300-500ms for larger transitions (modals, page changes)
35
- - NEVER exceed 500ms for UI interactions
36
-
37
- ## Accessibility
38
-
39
- - MUST respect `prefers-reduced-motion` media query
40
- - MUST provide instant alternatives when motion is reduced
41
- - NEVER rely solely on motion to convey information
@@ -1,20 +0,0 @@
1
- # Spacing Guidelines
2
-
3
- How to use spacing and sizing tokens for consistent layouts.
4
-
5
- ## Control Sizing & Padding
6
-
7
- - Use the control size tokens (`--control-*-size`) for height and matching padding tokens per size.
8
- - Choose padding density via suffixes: `-condensed`, `-normal` (default), `-spacious`.
9
-
10
- ## Stack Spacing
11
-
12
- - Use stack tokens for layout gaps (`--stack-gap-*`, `--stack-padding-*`).
13
- - For control groups, use control stack tokens (e.g., `--controlStack-*-gap-*`).
14
-
15
- ## Rules
16
-
17
- - MUST use control tokens for interactive elements (buttons, inputs)
18
- - MUST use stack tokens for layout spacing
19
- - MUST match padding density to the control's purpose
20
- - SHOULD use `medium` size as the default
@@ -1,14 +0,0 @@
1
- # Typography Guidelines
2
-
3
- How to use typography tokens for readable, consistent text.
4
-
5
- ## Responsive Typography
6
-
7
- - SHOULD use `--text-title-shorthand-medium` on narrow viewports instead of `large`
8
- - SHOULD use `--text-body-shorthand-medium` instead of `large` on mobile
9
-
10
- ## Rules
11
-
12
- - MUST use shorthand tokens (they ensure proper line-height)
13
- - SHOULD use semantic heading levels (h1-h6) with corresponding title tokens
14
- - NEVER set font-size without also setting line-height
@@ -1,4 +0,0 @@
1
- /* rename token to trigger actions to run on token change */
2
- {
3
- "testing": null
4
- }