@primer/primitives 7.16.0 → 7.17.0-rc.1685583f

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 (259) hide show
  1. package/dist/styleLint/base/size/size.json +427 -0
  2. package/dist/styleLint/base/typography/typography.json +54 -0
  3. package/dist/styleLint/functional/motion/motion.json +47 -0
  4. package/dist/styleLint/functional/size/border.json +234 -0
  5. package/dist/styleLint/functional/size/breakpoints.json +152 -0
  6. package/dist/styleLint/functional/size/size-coarse.json +41 -0
  7. package/dist/styleLint/functional/size/size-fine.json +41 -0
  8. package/dist/styleLint/functional/size/size.json +1838 -0
  9. package/dist/styleLint/functional/size/viewport.json +80 -0
  10. package/dist/styleLint/functional/themes/dark-colorblind.json +16155 -0
  11. package/dist/styleLint/functional/themes/dark-dimmed.json +16159 -0
  12. package/dist/styleLint/functional/themes/dark-high-contrast.json +16175 -0
  13. package/dist/styleLint/functional/themes/dark-tritanopia.json +16161 -0
  14. package/dist/styleLint/functional/themes/dark.json +16159 -0
  15. package/dist/styleLint/functional/themes/light-colorblind.json +16123 -0
  16. package/dist/styleLint/functional/themes/light-high-contrast.json +16125 -0
  17. package/dist/styleLint/functional/themes/light-tritanopia.json +16115 -0
  18. package/dist/styleLint/functional/themes/light.json +16113 -0
  19. package/dist/styleLint/functional/typography/typography.json +663 -0
  20. package/package.json +11 -9
  21. package/src/PrimerStyleDictionary.ts +226 -0
  22. package/src/filters/index.ts +12 -0
  23. package/src/filters/isBorder.ts +10 -0
  24. package/src/filters/isColor.ts +10 -0
  25. package/src/filters/isColorWithAlpha.ts +11 -0
  26. package/src/filters/isColorWithMix.ts +33 -0
  27. package/src/filters/isDeprecated.ts +10 -0
  28. package/src/filters/isDimension.ts +10 -0
  29. package/src/filters/isDuration.ts +10 -0
  30. package/src/filters/isFontFamily.ts +10 -0
  31. package/src/filters/isFontWeight.ts +10 -0
  32. package/src/filters/isFromFile.ts +12 -0
  33. package/src/filters/isShadow.ts +10 -0
  34. package/src/filters/isSource.ts +10 -0
  35. package/src/filters/isTypography.ts +10 -0
  36. package/src/formats/cssCustomMedia.ts +24 -0
  37. package/src/formats/cssThemed.ts +35 -0
  38. package/src/formats/cssVariables.ts +25 -0
  39. package/src/formats/cssWrapMediaQuery.ts +29 -0
  40. package/src/formats/index.ts +11 -0
  41. package/src/formats/javascriptCommonJs.ts +21 -0
  42. package/src/formats/javascriptEsm.ts +21 -0
  43. package/src/formats/jsonFigma.ts +131 -0
  44. package/src/formats/jsonNestedPrefixed.ts +23 -0
  45. package/src/formats/jsonOneDimensional.ts +18 -0
  46. package/src/formats/jsonPostCssFallback.ts +16 -0
  47. package/src/formats/typescriptExportDefinition.ts +170 -0
  48. package/src/formats/utilities/jsonToFlat.ts +10 -0
  49. package/src/formats/utilities/jsonToNestedValue.ts +20 -0
  50. package/src/formats/utilities/prefixTokens.ts +17 -0
  51. package/src/parsers/index.ts +1 -0
  52. package/src/parsers/w3cJsonParser.ts +25 -0
  53. package/src/platforms/css.ts +93 -0
  54. package/src/platforms/deprecatedJson.ts +16 -0
  55. package/src/platforms/docJson.ts +34 -0
  56. package/src/platforms/fallbacks.ts +34 -0
  57. package/src/platforms/figma.ts +48 -0
  58. package/src/platforms/index.ts +10 -0
  59. package/src/platforms/javascript.ts +30 -0
  60. package/src/platforms/json.ts +32 -0
  61. package/src/platforms/styleLint.ts +34 -0
  62. package/src/platforms/typeDefinitions.ts +30 -0
  63. package/src/platforms/typescript.ts +30 -0
  64. package/src/schemas/alphaValue.ts +12 -0
  65. package/src/schemas/baseToken.ts +7 -0
  66. package/src/schemas/borderToken.ts +19 -0
  67. package/src/schemas/collections.ts +47 -0
  68. package/src/schemas/colorHexValue.ts +18 -0
  69. package/src/schemas/colorToken.ts +50 -0
  70. package/src/schemas/designToken.ts +38 -0
  71. package/src/schemas/dimensionToken.ts +22 -0
  72. package/src/schemas/dimensionValue.ts +16 -0
  73. package/src/schemas/durationToken.ts +12 -0
  74. package/src/schemas/durationValue.ts +9 -0
  75. package/src/schemas/fontFamilyToken.ts +11 -0
  76. package/src/schemas/fontWeightToken.ts +12 -0
  77. package/src/schemas/fontWeightValue.ts +14 -0
  78. package/src/schemas/numberToken.ts +11 -0
  79. package/src/schemas/referenceValue.ts +12 -0
  80. package/src/schemas/scopes.ts +16 -0
  81. package/src/schemas/shadowToken.ts +45 -0
  82. package/src/schemas/stringToken.ts +11 -0
  83. package/src/schemas/tokenName.ts +12 -0
  84. package/src/schemas/tokenType.ts +4 -0
  85. package/src/schemas/typographyToken.ts +20 -0
  86. package/src/schemas/validTokenType.ts +44 -0
  87. package/src/schemas/viewportRangeToken.ts +11 -0
  88. package/src/test-utilities/getMockDictionary.ts +22 -0
  89. package/src/test-utilities/getMockFormatterArguments.ts +21 -0
  90. package/src/test-utilities/getMockParserInput.ts +72 -0
  91. package/src/test-utilities/getMockToken.ts +25 -0
  92. package/src/test-utilities/index.ts +4 -0
  93. package/src/tokens/base/color/dark/dark.dimmed.json5 +1326 -0
  94. package/src/tokens/base/color/dark/dark.high-contrast.json5 +856 -0
  95. package/src/tokens/base/color/dark/dark.json5 +866 -0
  96. package/src/tokens/base/color/dark/display-dark.json5 +1774 -0
  97. package/src/tokens/base/color/light/display-light.json5 +1774 -0
  98. package/src/tokens/base/color/light/light.high-contrast.json5 +847 -0
  99. package/src/tokens/base/color/light/light.json5 +866 -0
  100. package/src/tokens/base/size/size.json +176 -0
  101. package/src/tokens/base/typography/typography.json +24 -0
  102. package/src/tokens/fallback/color-fallbacks.json +260 -0
  103. package/src/tokens/functional/border/dark.json5 +12 -0
  104. package/src/tokens/functional/border/light.json5 +12 -0
  105. package/src/tokens/functional/color/dark/app-dark.json5 +554 -0
  106. package/src/tokens/functional/color/dark/data-vis-dark.json5 +144 -0
  107. package/src/tokens/functional/color/dark/display-dark.json5 +1060 -0
  108. package/src/tokens/functional/color/dark/overrides/dark.dimmed.json5 +57 -0
  109. package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +390 -0
  110. package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +314 -0
  111. package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +229 -0
  112. package/src/tokens/functional/color/dark/patterns-dark.json5 +3073 -0
  113. package/src/tokens/functional/color/dark/primitives-dark.json5 +1206 -0
  114. package/src/tokens/functional/color/dark/syntax-dark.json5 +559 -0
  115. package/src/tokens/functional/color/light/app-light.json5 +551 -0
  116. package/src/tokens/functional/color/light/data-vis-light.json5 +144 -0
  117. package/src/tokens/functional/color/light/display-light.json5 +1060 -0
  118. package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +440 -0
  119. package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +340 -0
  120. package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +249 -0
  121. package/src/tokens/functional/color/light/patterns-light.json5 +3070 -0
  122. package/src/tokens/functional/color/light/primitives-light.json5 +1196 -0
  123. package/src/tokens/functional/color/light/syntax-light.json5 +559 -0
  124. package/src/tokens/functional/motion/loading.json5 +17 -0
  125. package/src/tokens/functional/motion/patterns.json5 +28 -0
  126. package/src/tokens/functional/shadow/dark.json5 +383 -0
  127. package/src/tokens/functional/shadow/light.json5 +376 -0
  128. package/src/tokens/functional/size/border.json +98 -0
  129. package/src/tokens/functional/size/breakpoints.json +64 -0
  130. package/src/tokens/functional/size/size-coarse.json +28 -0
  131. package/src/tokens/functional/size/size-fine.json +28 -0
  132. package/src/tokens/functional/size/size.json +802 -0
  133. package/src/tokens/functional/size/viewport.json +28 -0
  134. package/src/tokens/functional/typography/typography.json +279 -0
  135. package/src/tokens/removed/color.json +421 -0
  136. package/src/transformers/borderToCss.ts +38 -0
  137. package/src/transformers/colorToHex.ts +16 -0
  138. package/src/transformers/colorToHexAlpha.ts +23 -0
  139. package/src/transformers/colorToHexMix.ts +19 -0
  140. package/src/transformers/colorToRgbAlpha.ts +19 -0
  141. package/src/transformers/colorToRgbaFloat.ts +45 -0
  142. package/src/transformers/dimensionToPixelUnitless.ts +60 -0
  143. package/src/transformers/dimensionToRem.ts +56 -0
  144. package/src/transformers/dimensionToRemPxArray.ts +60 -0
  145. package/src/transformers/durationToCss.ts +29 -0
  146. package/src/transformers/figmaAttributes.ts +55 -0
  147. package/src/transformers/fontFamilyToCss.ts +38 -0
  148. package/src/transformers/fontWeightToNumber.ts +53 -0
  149. package/src/transformers/index.ts +21 -0
  150. package/src/transformers/jsonDeprecated.ts +15 -0
  151. package/src/transformers/namePathToCamelCase.ts +14 -0
  152. package/src/transformers/namePathToDotNotation.ts +34 -0
  153. package/src/transformers/namePathToFigma.ts +28 -0
  154. package/src/transformers/namePathToKebabCase.ts +19 -0
  155. package/src/transformers/namePathToSlashNotation.ts +19 -0
  156. package/src/transformers/shadowToCss.ts +37 -0
  157. package/src/transformers/typographyToCss.ts +31 -0
  158. package/src/transformers/utilities/alpha.ts +23 -0
  159. package/src/transformers/utilities/checkRequiredTokenProperties.ts +16 -0
  160. package/src/transformers/utilities/getTokenValue.ts +18 -0
  161. package/src/transformers/utilities/hexToRgbaFloat.ts +31 -0
  162. package/src/transformers/utilities/invalidTokenError.ts +34 -0
  163. package/src/transformers/utilities/isRgbaFloat.ts +29 -0
  164. package/src/transformers/utilities/mix.ts +46 -0
  165. package/src/transformers/utilities/rgbaFloatToHex.ts +15 -0
  166. package/src/types/Border.d.ts +5 -0
  167. package/src/types/BorderTokenValue.d.ts +10 -0
  168. package/src/types/ColorHex.d.ts +4 -0
  169. package/src/types/PlatformInitializer.d.ts +11 -0
  170. package/src/types/Shadow.d.ts +5 -0
  171. package/src/types/ShadowTokenValue.d.ts +14 -0
  172. package/src/types/SizeEm.d.ts +4 -0
  173. package/src/types/SizePx.d.ts +4 -0
  174. package/src/types/SizeRem.d.ts +4 -0
  175. package/src/types/StyleDictionaryConfigGenerator.d.ts +15 -0
  176. package/src/types/TokenBuildInput.d.ts +8 -0
  177. package/src/types/TypographyTokenValue.d.ts +12 -0
  178. package/src/types/w3cTransformedToken.d.ts +8 -0
  179. package/src/utilities/copyFromDir.ts +21 -0
  180. package/src/utilities/getFlag.ts +12 -0
  181. package/src/utilities/index.ts +3 -0
  182. package/src/utilities/joinFriendly.ts +2 -0
  183. package/src/utilities/schemaErrorMessage.ts +2 -0
  184. package/src/utilities/toCamelCase.ts +29 -0
  185. package/src/utilities/treeWalker.ts +27 -0
  186. package/src/utilities/upperCaseFirstCharacter.ts +10 -0
  187. package/src/utils-v1.ts +36 -0
  188. package/tokens-next-private/styleLint/base/size/size.json +427 -0
  189. package/tokens-next-private/styleLint/base/typography/typography.json +54 -0
  190. package/tokens-next-private/styleLint/functional/motion/motion.json +47 -0
  191. package/tokens-next-private/styleLint/functional/size/border.json +234 -0
  192. package/tokens-next-private/styleLint/functional/size/breakpoints.json +152 -0
  193. package/tokens-next-private/styleLint/functional/size/size-coarse.json +41 -0
  194. package/tokens-next-private/styleLint/functional/size/size-fine.json +41 -0
  195. package/tokens-next-private/styleLint/functional/size/size.json +1838 -0
  196. package/tokens-next-private/styleLint/functional/size/viewport.json +80 -0
  197. package/tokens-next-private/styleLint/functional/themes/dark-colorblind.json +16155 -0
  198. package/tokens-next-private/styleLint/functional/themes/dark-dimmed.json +16159 -0
  199. package/tokens-next-private/styleLint/functional/themes/dark-high-contrast.json +16175 -0
  200. package/tokens-next-private/styleLint/functional/themes/dark-tritanopia.json +16161 -0
  201. package/tokens-next-private/styleLint/functional/themes/dark.json +16159 -0
  202. package/tokens-next-private/styleLint/functional/themes/light-colorblind.json +16123 -0
  203. package/tokens-next-private/styleLint/functional/themes/light-high-contrast.json +16125 -0
  204. package/tokens-next-private/styleLint/functional/themes/light-tritanopia.json +16115 -0
  205. package/tokens-next-private/styleLint/functional/themes/light.json +16113 -0
  206. package/tokens-next-private/styleLint/functional/typography/typography.json +663 -0
  207. package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
  208. package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
  209. package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
  210. package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
  211. package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
  212. package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
  213. package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
  214. package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
  215. package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
  216. package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
  217. package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
  218. package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
  219. package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
  220. package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
  221. package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
  222. package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
  223. package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
  224. package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
  225. package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
  226. package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
  227. package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
  228. package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
  229. package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
  230. package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
  231. package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
  232. package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
  233. package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
  234. package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
  235. package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
  236. package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
  237. package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
  238. package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
  239. package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
  240. package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
  241. package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
  242. package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
  243. package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
  244. package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
  245. package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
  246. package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
  247. package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
  248. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  249. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
  250. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  251. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
  252. package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
  253. package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
  254. package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
  255. package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
  256. package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
  257. package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
  258. package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
  259. package/tokens-v2-private/ts/tokens/functional/typography/typography.js +1 -1
@@ -0,0 +1,421 @@
1
+ {
2
+ "auto.black": null,
3
+ "auto.white": null,
4
+ "auto.gray.0": null,
5
+ "auto.gray.1": null,
6
+ "auto.gray.2": null,
7
+ "auto.gray.3": null,
8
+ "auto.gray.4": null,
9
+ "auto.gray.5": null,
10
+ "auto.gray.6": null,
11
+ "auto.gray.7": null,
12
+ "auto.gray.8": null,
13
+ "auto.gray.9": null,
14
+ "auto.blue.0": null,
15
+ "auto.blue.1": null,
16
+ "auto.blue.2": null,
17
+ "auto.blue.3": null,
18
+ "auto.blue.4": null,
19
+ "auto.blue.5": null,
20
+ "auto.blue.6": null,
21
+ "auto.blue.7": null,
22
+ "auto.blue.8": null,
23
+ "auto.blue.9": null,
24
+ "auto.green.0": null,
25
+ "auto.green.1": null,
26
+ "auto.green.2": null,
27
+ "auto.green.3": null,
28
+ "auto.green.4": null,
29
+ "auto.green.5": null,
30
+ "auto.green.6": null,
31
+ "auto.green.7": null,
32
+ "auto.green.8": null,
33
+ "auto.green.9": null,
34
+ "auto.yellow.0": null,
35
+ "auto.yellow.1": null,
36
+ "auto.yellow.2": null,
37
+ "auto.yellow.3": null,
38
+ "auto.yellow.4": null,
39
+ "auto.yellow.5": null,
40
+ "auto.yellow.6": null,
41
+ "auto.yellow.7": null,
42
+ "auto.yellow.8": null,
43
+ "auto.yellow.9": null,
44
+ "auto.orange.0": null,
45
+ "auto.orange.1": null,
46
+ "auto.orange.2": null,
47
+ "auto.orange.3": null,
48
+ "auto.orange.4": null,
49
+ "auto.orange.5": null,
50
+ "auto.orange.6": null,
51
+ "auto.orange.7": null,
52
+ "auto.orange.8": null,
53
+ "auto.orange.9": null,
54
+ "auto.red.0": null,
55
+ "auto.red.1": null,
56
+ "auto.red.2": null,
57
+ "auto.red.3": null,
58
+ "auto.red.4": null,
59
+ "auto.red.5": null,
60
+ "auto.red.6": null,
61
+ "auto.red.7": null,
62
+ "auto.red.8": null,
63
+ "auto.red.9": null,
64
+ "auto.purple.0": null,
65
+ "auto.purple.1": null,
66
+ "auto.purple.2": null,
67
+ "auto.purple.3": null,
68
+ "auto.purple.4": null,
69
+ "auto.purple.5": null,
70
+ "auto.purple.6": null,
71
+ "auto.purple.7": null,
72
+ "auto.purple.8": null,
73
+ "auto.purple.9": null,
74
+ "auto.pink.0": null,
75
+ "auto.pink.1": null,
76
+ "auto.pink.2": null,
77
+ "auto.pink.3": null,
78
+ "auto.pink.4": null,
79
+ "auto.pink.5": null,
80
+ "auto.pink.6": null,
81
+ "auto.pink.7": null,
82
+ "auto.pink.8": null,
83
+ "auto.pink.9": null,
84
+ "text.primary": "fg.default",
85
+ "text.secondary": "fg.muted",
86
+ "text.tertiary": "fg.muted",
87
+ "text.placeholder": "fg.subtle",
88
+ "text.disabled": "fg.muted",
89
+ "text.inverse": "fg.onEmphasis",
90
+ "text.link": "accent.fg",
91
+ "text.danger": "danger.fg",
92
+ "text.success": "success.fg",
93
+ "text.warning": "attention.fg",
94
+ "text.white": null,
95
+ "icon.primary": "fg.default",
96
+ "icon.secondary": "fg.muted",
97
+ "icon.tertiary": "fg.muted",
98
+ "icon.info": "accent.fg",
99
+ "icon.danger": "danger.fg",
100
+ "icon.success": "success.fg",
101
+ "icon.warning": "attention.fg",
102
+ "border.primary": "border.default",
103
+ "border.secondary": "border.muted",
104
+ "border.tertiary": "border.default",
105
+ "border.overlay": "border.default",
106
+ "border.inverse": "fg.onEmphasis",
107
+ "border.info": "accent.emphasis",
108
+ "border.danger": "danger.emphasis",
109
+ "border.success": "success.emphasis",
110
+ "border.warning": "attention.emphasis",
111
+ "bg.canvas": "canvas.default",
112
+ "bg.canvasMobile": null,
113
+ "bg.canvasInverse": "neutral.emphasis",
114
+ "bg.canvasInset": "canvas.inset",
115
+ "bg.primary": "canvas.default",
116
+ "bg.secondary": "canvas.subtle",
117
+ "bg.tertiary": "canvas.subtle",
118
+ "bg.overlay": "canvas.overlay",
119
+ "bg.backdrop": "primer.canvas.backdrop",
120
+ "bg.info": "accent.subtle",
121
+ "bg.infoInverse": "accent.emphasis",
122
+ "bg.danger": "danger.subtle",
123
+ "bg.dangerInverse": "danger.emphasis",
124
+ "bg.success": "success.subtle",
125
+ "bg.successInverse": "success.emphasis",
126
+ "bg.warning": "attention.subtle",
127
+ "bg.warningInverse": "attention.emphasis",
128
+ "shadow.highlight": "primer.shadow.highlight",
129
+ "shadow.inset": "primer.shadow.inset",
130
+ "state.hover.primaryBg": "accent.emphasis",
131
+ "state.hover.primaryBorder": "accent.emphasis",
132
+ "state.hover.primaryText": "fg.onEmphasis",
133
+ "state.hover.primaryIcon": "fg.onEmphasis",
134
+ "state.hover.secondaryBg": "neutral.subtle",
135
+ "state.hover.secondaryBorder": "neutral.subtle",
136
+ "state.selected.primaryBg": "accent.emphasis",
137
+ "state.selected.primaryBorder": "accent.emphasis",
138
+ "state.selected.primaryText": "fg.onEmphasis",
139
+ "state.selected.primaryIcon": "fg.onEmphasis",
140
+ "state.focus.border": "accent.emphasis",
141
+ "state.focus.shadow": "primer.shadow.focus",
142
+ "fade.fg10": null,
143
+ "fade.fg15": null,
144
+ "fade.fg30": null,
145
+ "fade.fg50": null,
146
+ "fade.fg70": null,
147
+ "fade.fg85": null,
148
+ "fade.black10": null,
149
+ "fade.black15": null,
150
+ "fade.black30": null,
151
+ "fade.black50": null,
152
+ "fade.black70": null,
153
+ "fade.black85": null,
154
+ "fade.white10": null,
155
+ "fade.white15": null,
156
+ "fade.white30": null,
157
+ "fade.white50": null,
158
+ "fade.white70": null,
159
+ "fade.white85": null,
160
+ "alert.info.text": "fg.default",
161
+ "alert.info.icon": "accent.fg",
162
+ "alert.info.bg": "accent.subtle",
163
+ "alert.info.border": "accent.muted",
164
+ "alert.warn.text": "fg.default",
165
+ "alert.warn.icon": "attention.fg",
166
+ "alert.warn.bg": "attention.subtle",
167
+ "alert.warn.border": "attention.muted",
168
+ "alert.error.text": "fg.default",
169
+ "alert.error.icon": "danger.fg",
170
+ "alert.error.bg": "danger.subtle",
171
+ "alert.error.border": "danger.muted",
172
+ "alert.success.text": "fg.default",
173
+ "alert.success.icon": "success.fg",
174
+ "alert.success.bg": "success.subtle",
175
+ "alert.success.border": "success.muted",
176
+ "autocomplete.shadow": "shadow.medium",
177
+ "autocomplete.rowBorder": "border.muted",
178
+ "blankslate.icon": "fg.muted",
179
+ "counter.text": "fg.default",
180
+ "counter.bg": "neutral.muted",
181
+ "counter.primary.text": "fg.onEmphasis",
182
+ "counter.primary.bg": "neutral.emphasis",
183
+ "counter.secondary.text": "fg.muted",
184
+ "counter.secondary.bg": "neutral.subtle",
185
+ "box.blueBorder": "accent.muted",
186
+ "box.rowYellowBg": "attention.subtle",
187
+ "box.rowBlueBg": "accent.subtle",
188
+ "box.headerBlueBg": "accent.subtle",
189
+ "box.headerBlueBorder": "accent.muted",
190
+ "box.borderInfo": "accent.muted",
191
+ "box.bgInfo": "accent.subtle",
192
+ "box.borderWarning": "attention.muted",
193
+ "box.bgWarning": "attention.subtle",
194
+ "branchName.text": "fg.muted",
195
+ "branchName.icon": "fg.muted",
196
+ "branchName.bg": "accent.subtle",
197
+ "branchName.link.text": "accent.fg",
198
+ "branchName.link.icon": "accent.fg",
199
+ "branchName.link.bg": "accent.subtle",
200
+ "markdown.codeBg": "neutral.muted",
201
+ "markdown.frameBorder": "border.default",
202
+ "markdown.blockquoteBorder": "border.default",
203
+ "markdown.tableBorder": "border.default",
204
+ "markdown.tableTrBorder": "border.muted",
205
+ "filterItem.barBg": "neutral.subtle",
206
+ "hiddenTextExpander.bg": "neutral.muted",
207
+ "hiddenTextExpander.bgHover": "accent.muted",
208
+ "dragAndDrop.border": "border.default",
209
+ "uploadEnabled.border": "border.default",
210
+ "uploadEnabled.borderFocused": "accent.emphasis",
211
+ "previewableCommentForm.border": "border.default",
212
+ "verifiedBadge.text": "success.fg",
213
+ "verifiedBadge.bg": "canvas.default",
214
+ "verifiedBadge.border": "border.default",
215
+ "socialCount.bg": "canvas.default",
216
+ "tooltip.text": "fg.onEmphasis",
217
+ "tooltip.bg": "neutral.emphasisPlus",
218
+ "filesExplorerIcon": "accent.fg",
219
+ "hlAuthorBg": "accent.subtle",
220
+ "hlAuthorBorder": "accent.muted",
221
+ "logoSubdued": "neutral.muted",
222
+ "discussionBorder": "success.muted",
223
+ "discussionBgSuccess": "success.emphasis",
224
+ "actionsWorkflowTableStickyBg": "primer.canvas.sticky",
225
+ "repoLanguageColorBorder": "primer.border.contrast",
226
+ "codeSelectionBg": "accent.muted",
227
+ "highlight.text": "fg.default",
228
+ "highlight.bg": "attention.subtle",
229
+ "blob.lineHighlightBg": "attention.subtle",
230
+ "blob.lineHighlightBorder": "attention.muted",
231
+ "topicTag.text": "accent.fg",
232
+ "topicTag.bg": "accent.subtle",
233
+ "topicTag.hoverBg": "accent.emphasis",
234
+ "topicTag.activeBg": "accent.subtle",
235
+ "footerInvertocat.octicon": "fg.subtle",
236
+ "footerInvertocat.octiconHover": "fg.muted",
237
+ "dropdown.shadow": "shadow.large",
238
+ "label.border": "border.default",
239
+ "label.primary.text": "fg.default",
240
+ "label.primary.border": "neutral.emphasis",
241
+ "label.secondary.text": "fg.muted",
242
+ "label.secondary.border": "border.default",
243
+ "label.info.text": "accent.fg",
244
+ "label.info.border": "accent.emphasis",
245
+ "label.success.text": "success.fg",
246
+ "label.success.border": "success.emphasis",
247
+ "label.warning.text": "attention.fg",
248
+ "label.warning.border": "attention.emphasis",
249
+ "label.danger.text": "danger.fg",
250
+ "label.danger.border": "danger.emphasis",
251
+ "label.orange.text": "severe.fg",
252
+ "label.orange.border": "severe.emphasis",
253
+ "input.bg": "canvas.default",
254
+ "input.contrastBg": "canvas.inset",
255
+ "input.border": "border.default",
256
+ "input.shadow": "primer.shadow.inset",
257
+ "input.disabledBorder": "border.default",
258
+ "input.warningBorder": "attention.emphasis",
259
+ "input.errorBorder": "danger.emphasis",
260
+ "input.tooltip.success.text": "fg.default",
261
+ "input.tooltip.success.bg": "success.subtle",
262
+ "input.tooltip.success.border": "success.muted",
263
+ "input.tooltip.warning.text": "fg.default",
264
+ "input.tooltip.warning.bg": "attention.subtle",
265
+ "input.tooltip.warning.border": "attention.muted",
266
+ "input.tooltip.error.text": "fg.default",
267
+ "input.tooltip.error.bg": "danger.subtle",
268
+ "input.tooltip.error.border": "danger.muted",
269
+ "toast.text": "fg.default",
270
+ "toast.bg": "canvas.default",
271
+ "toast.border": "border.default",
272
+ "toast.shadow": "shadow.large",
273
+ "toast.icon": "fg.onEmphasis",
274
+ "toast.iconBg": "accent.emphasis",
275
+ "toast.iconBorder": null,
276
+ "toast.success.text": "fg.default",
277
+ "toast.success.border": "border.default",
278
+ "toast.success.icon": "fg.onEmphasis",
279
+ "toast.success.iconBg": "success.emphasis",
280
+ "toast.success.iconBorder": null,
281
+ "toast.warning.text": "fg.default",
282
+ "toast.warning.border": "border.default",
283
+ "toast.warning.icon": "fg.default",
284
+ "toast.warning.iconBg": "attention.emphasis",
285
+ "toast.warning.iconBorder": null,
286
+ "toast.danger.text": "fg.default",
287
+ "toast.danger.border": "border.default",
288
+ "toast.danger.icon": "fg.onEmphasis",
289
+ "toast.danger.iconBg": "danger.emphasis",
290
+ "toast.danger.iconBorder": null,
291
+ "toast.loading.text": "fg.default",
292
+ "toast.loading.border": "border.default",
293
+ "toast.loading.icon": "fg.onEmphasis",
294
+ "toast.loading.iconBg": "neutral.emphasis",
295
+ "toast.loading.iconBorder": null,
296
+ "timeline.text": "fg.muted",
297
+ "timeline.badgeSuccessBorder": null,
298
+ "timeline.targetBadgeBorder": "accent.emphasis",
299
+ "timeline.targetBadgeShadow": "accent.muted",
300
+ "diffstat.neutralBg": "neutral.muted",
301
+ "diffstat.neutralBorder": "border.subtle",
302
+ "diffstat.deletionBg": "danger.emphasis",
303
+ "diff.addition.text": "fg.default",
304
+ "diff.addition.bg": "success.subtle",
305
+ "diff.addition.border": "success.muted",
306
+ "diff.deletion.text": "fg.default",
307
+ "diff.deletion.bg": "danger.subtle",
308
+ "diff.deletion.border": "danger.muted",
309
+ "diff.change.text": "attention.fg",
310
+ "diff.change.bg": "attention.subtle",
311
+ "diff.change.border": "attention.muted",
312
+ "mergeBox.successIconBg": "success.emphasis",
313
+ "mergeBox.successIconText": "fg.onEmphasis",
314
+ "mergeBox.successIconBorder": null,
315
+ "mergeBox.successIndicatorBg": "success.emphasis",
316
+ "mergeBox.successIndicatorBorder": null,
317
+ "mergeBox.mergedIconBg": "done.emphasis",
318
+ "mergeBox.mergedIconText": "fg.onEmphasis",
319
+ "mergeBox.mergedIconBorder": null,
320
+ "mergeBox.mergedBoxBorder": "done.emphasis",
321
+ "mergeBox.neutralIconBg": "neutral.emphasis",
322
+ "mergeBox.neutralIconText": "fg.onEmphasis",
323
+ "mergeBox.neutralIconBorder": null,
324
+ "mergeBox.neutralIndicatorBg": "neutral.emphasis",
325
+ "mergeBox.neutralIndicatorBorder": null,
326
+ "mergeBox.warningIconBg": "attention.emphasis",
327
+ "mergeBox.warningIconText": "fg.onEmphasis",
328
+ "mergeBox.warningIconBorder": null,
329
+ "mergeBox.warningBoxBorder": "attention.emphasis",
330
+ "mergeBox.warningMergeHighlight": null,
331
+ "mergeBox.errorIconBg": "danger.emphasis",
332
+ "mergeBox.errorIconText": "fg.onEmphasis",
333
+ "mergeBox.errorIconBorder": null,
334
+ "mergeBox.errorIndicatorBg": "danger.emphasis",
335
+ "mergeBox.errorIndicatorBorder": null,
336
+ "underlinenav.border": null,
337
+ "underlinenav.borderActive": "primer.border.active",
338
+ "underlinenav.text": "fg.default",
339
+ "underlinenav.textHover": "fg.default",
340
+ "underlinenav.textActive": "fg.default",
341
+ "underlinenav.iconHover": "fg.subtle",
342
+ "underlinenav.iconActive": "fg.default",
343
+ "underlinenav.counterText": "fg.default",
344
+ "underlinenav.counterBg": "neutral.muted",
345
+ "selectMenu.borderSecondary": "border.muted",
346
+ "selectMenu.shadow": "shadow.large",
347
+ "selectMenu.backdropBg": "primer.canvas.backdrop",
348
+ "sidenav.borderActive": "primer.border.active",
349
+ "menu.headingText": "fg.default",
350
+ "menu.borderActive": "primer.border.active",
351
+ "project.cardBg": "canvas.overlay",
352
+ "prState.draft.text": "fg.onEmphasis",
353
+ "prState.draft.bg": "neutral.emphasis",
354
+ "prState.draft.border": null,
355
+ "prState.open.text": "fg.onEmphasis",
356
+ "prState.open.bg": "success.emphasis",
357
+ "prState.open.border": null,
358
+ "prState.merged.text": "fg.onEmphasis",
359
+ "prState.merged.bg": "done.emphasis",
360
+ "prState.merged.border": null,
361
+ "prState.closed.text": "fg.onEmphasis",
362
+ "prState.closed.bg": "danger.emphasis",
363
+ "prState.closed.border": null,
364
+ "diffBlob.numText": "fg.subtle",
365
+ "diffBlob.numHoverText": "fg.default",
366
+ "diffBlob.addition.numHoverText": "fg.default",
367
+ "diffBlob.deletion.numHoverText": "fg.default",
368
+ "diffBlob.hunk.text": "fg.muted",
369
+ "diffBlob.hunk.lineBg": "accent.subtle",
370
+ "diffBlob.emptyBlockBg": "neutral.subtle",
371
+ "diffBlob.selectedLineHighlightBg": "attention.subtle",
372
+ "diffBlob.selectedLineHighlightBorder": "attention.muted",
373
+ "diffBlob.expander.hoverIcon": "fg.onEmphasis",
374
+ "diffBlob.expander.hoverBg": "accent.emphasis",
375
+ "diffBlob.commentButton.icon": "fg.onEmphasis",
376
+ "diffBlob.commentButton.bg": "accent.emphasis",
377
+ "diffBlob.commentButton.gradientBg": null,
378
+ "globalNav.logo": null,
379
+ "globalNav.bg": null,
380
+ "globalNav.text": null,
381
+ "globalNav.icon": null,
382
+ "globalNav.inputBg": null,
383
+ "globalNav.inputBorder": null,
384
+ "globalNav.inputIcon": null,
385
+ "globalNav.inputPlaceholder": null,
386
+ "introShelf.gradientLeft": "accent.subtle",
387
+ "introShelf.gradientRight": "success.subtle",
388
+ "introShelf.gradientIn": "canvas.default",
389
+ "introShelf.gradientOut": null,
390
+ "mktg.success": null,
391
+ "mktg.info": null,
392
+ "mktg.bgShadeGradient.top": null,
393
+ "mktg.bgShadeGradient.bottom": null,
394
+ "mktg.btn.bg.top": null,
395
+ "mktg.btn.bg.bottom": null,
396
+ "mktg.btn.bgOverlay.top": null,
397
+ "mktg.btn.bgOverlay.bottom": null,
398
+ "mktg.btn.text": null,
399
+ "mktg.btn.primary.bg.top": null,
400
+ "mktg.btn.primary.bg.bottom": null,
401
+ "mktg.btn.primary.bgOverlay.top": null,
402
+ "mktg.btn.primary.bgOverlay.bottom": null,
403
+ "mktg.btn.primary.text": null,
404
+ "mktg.btn.enterprise.bg.top": null,
405
+ "mktg.btn.enterprise.bg.bottom": null,
406
+ "mktg.btn.enterprise.bgOverlay.top": null,
407
+ "mktg.btn.enterprise.bgOverlay.bottom": null,
408
+ "mktg.btn.enterprise.text": null,
409
+ "mktg.btn.outline.text": null,
410
+ "mktg.btn.outline.border": null,
411
+ "mktg.btn.outline.hover.text": null,
412
+ "mktg.btn.outline.hover.border": null,
413
+ "mktg.btn.outline.focus.border": null,
414
+ "mktg.btn.outline.focus.borderInset": null,
415
+ "mktg.btn.dark.text": null,
416
+ "mktg.btn.dark.border": null,
417
+ "mktg.btn.dark.hover.text": null,
418
+ "mktg.btn.dark.hover.border": null,
419
+ "mktg.btn.dark.focus.border": null,
420
+ "mktg.btn.dark.focus.borderInset": null
421
+ }
@@ -0,0 +1,38 @@
1
+ import {isBorder} from '../filters/isBorder'
2
+ import type StyleDictionary from 'style-dictionary'
3
+ import type {BorderTokenValue} from '../types/BorderTokenValue'
4
+
5
+ /**
6
+ * checks if all required properties exist on shadow token
7
+ * @param object - BorderTokenValue
8
+ * @returns void or throws error
9
+ */
10
+ const checkForBorderTokenProperties = (border: BorderTokenValue) => {
11
+ const requiredProperties = ['color', 'width', 'style']
12
+ for (const prop of requiredProperties) {
13
+ if (prop in border === false) {
14
+ throw new Error(`Missing propery: ${prop} on border token ${JSON.stringify(border)}`)
15
+ }
16
+ }
17
+ }
18
+ /**
19
+ * @description converts w3c border tokens in css border string
20
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
21
+ * @matcher matches all tokens of $type `border`
22
+ * @transformer returns css border `string`
23
+ */
24
+ export const borderToCss: StyleDictionary.Transform = {
25
+ type: `value`,
26
+ transitive: true,
27
+ matcher: isBorder,
28
+ transformer: ({value}: {value: BorderTokenValue}) => {
29
+ //
30
+ checkForBorderTokenProperties(value)
31
+ // if value === string it was probably already transformed
32
+ if (typeof value === 'string') {
33
+ return value
34
+ }
35
+ /* color | style | width */
36
+ return `${value.color} ${value.style} ${value.width}`
37
+ },
38
+ }
@@ -0,0 +1,16 @@
1
+ import {toHex} from 'color2k'
2
+ import {isColor} from '../filters'
3
+ import type StyleDictionary from 'style-dictionary'
4
+ import {getTokenValue} from './utilities/getTokenValue'
5
+ /**
6
+ * @description converts color tokens value to `hex6` or `hex8`
7
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
8
+ * @matcher matches all tokens of $type `color`
9
+ * @transformer returns a `hex` string
10
+ */
11
+ export const colorToHex: StyleDictionary.Transform = {
12
+ type: `value`,
13
+ transitive: true,
14
+ matcher: isColor,
15
+ transformer: (token: StyleDictionary.TransformedToken) => toHex(getTokenValue(token)),
16
+ }
@@ -0,0 +1,23 @@
1
+ import {toHex} from 'color2k'
2
+ import {alpha} from './utilities/alpha'
3
+ import {isColorWithAlpha} from '../filters'
4
+ import type StyleDictionary from 'style-dictionary'
5
+ import {getTokenValue} from './utilities/getTokenValue'
6
+ /**
7
+ * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
8
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
9
+ * @matcher matches all tokens of $type `color` with an `alpha` property
10
+ * @transformer returns `hex8` string
11
+ */
12
+ export const colorToHexAlpha: StyleDictionary.Transform = {
13
+ type: `value`,
14
+ transitive: true,
15
+ matcher: isColorWithAlpha,
16
+ transformer: (token: StyleDictionary.TransformedToken) => {
17
+ // don't change if alpha is null
18
+ if (token.alpha === null) {
19
+ return toHex(getTokenValue(token))
20
+ }
21
+ return toHex(alpha(getTokenValue(token), token.alpha, token))
22
+ },
23
+ }
@@ -0,0 +1,19 @@
1
+ import {toHex} from 'color2k'
2
+ import {isColorWithMix} from '../filters'
3
+ import type StyleDictionary from 'style-dictionary'
4
+ import {getTokenValue} from './utilities/getTokenValue'
5
+ import mix from './utilities/mix'
6
+ /**
7
+ * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
8
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
9
+ * @matcher matches all tokens of $type `color` with an `alpha` property
10
+ * @transformer returns `hex8` string
11
+ */
12
+ export const colorToHexMix: StyleDictionary.Transform = {
13
+ type: `value`,
14
+ transitive: true,
15
+ matcher: isColorWithMix,
16
+ transformer: (token: StyleDictionary.TransformedToken) => {
17
+ return toHex(mix(getTokenValue(token), token.mix?.color || getTokenValue(token), token.mix?.weight || 0))
18
+ },
19
+ }
@@ -0,0 +1,19 @@
1
+ import {isColorWithAlpha} from '../filters'
2
+ import {alpha} from './utilities/alpha'
3
+ import type StyleDictionary from 'style-dictionary'
4
+ import {getTokenValue} from './utilities/getTokenValue'
5
+ /**
6
+ * @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
7
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
8
+ * @matcher matches all tokens of $type `color` with an `alpha` property
9
+ * @transformer returns `rgba` string
10
+ */
11
+ export const colorToRgbAlpha: StyleDictionary.Transform = {
12
+ type: `value`,
13
+ transitive: true,
14
+ matcher: isColorWithAlpha,
15
+ transformer: (token: StyleDictionary.TransformedToken) => {
16
+ if (token.alpha === null) return getTokenValue(token)
17
+ return alpha(getTokenValue(token), token.alpha, token)
18
+ },
19
+ }
@@ -0,0 +1,45 @@
1
+ import {toHex} from 'color2k'
2
+ import {isColor} from '../filters'
3
+ import type StyleDictionary from 'style-dictionary'
4
+ import {getTokenValue} from './utilities/getTokenValue'
5
+ import {rgbaFloatToHex} from './utilities/rgbaFloatToHex'
6
+ import mix from './utilities/mix'
7
+ import {hexToRgbaFloat} from './utilities/hexToRgbaFloat'
8
+ import {isRgbaFloat} from './utilities/isRgbaFloat'
9
+
10
+ const toRgbaFloat = (token: StyleDictionary.TransformedToken, alpha?: number) => {
11
+ let tokenValue = getTokenValue(token)
12
+ let tokenMixColor = token.mix?.color
13
+ // get hex value from color string
14
+ if (isRgbaFloat(tokenValue)) {
15
+ tokenValue = rgbaFloatToHex(tokenValue, false)
16
+ }
17
+ if (tokenMixColor && isRgbaFloat(tokenMixColor)) {
18
+ tokenMixColor = rgbaFloatToHex(tokenMixColor, false)
19
+ }
20
+ let hex = toHex(tokenValue)
21
+ // mix color with mix color and weight
22
+ if (token.mix && token.mix.color && token.mix.weight) {
23
+ hex = toHex(mix(tokenValue, tokenMixColor, token.mix.weight))
24
+ }
25
+ // return color as RgbaFloat
26
+ return hexToRgbaFloat(hex, alpha)
27
+ }
28
+
29
+ /**
30
+ * @description converts color tokens rgba float with values from 0 - 1
31
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
32
+ * @matcher matches all tokens of $type `color`
33
+ * @transformer returns a `rgb` float object
34
+ */
35
+ export const colorToRgbaFloat: StyleDictionary.Transform = {
36
+ type: `value`,
37
+ transitive: true,
38
+ matcher: isColor,
39
+ transformer: (token: StyleDictionary.TransformedToken) => {
40
+ // skip if value is already rgb float
41
+ if (isRgbaFloat(token.value) && !('mix' in token) && !('alpha' in token)) return token.value
42
+ // convert hex or rgb values to rgba float
43
+ return toRgbaFloat(token, token.alpha)
44
+ },
45
+ }
@@ -0,0 +1,60 @@
1
+ import {isDimension} from '../filters'
2
+ import type StyleDictionary from 'style-dictionary'
3
+ import type {Platform} from 'style-dictionary'
4
+
5
+ /**
6
+ * @description base font size from options or 16
7
+ * @param options
8
+ * @returns number
9
+ */
10
+ const getBasePxFontSize = (options?: Platform): number => (options && options.basePxFontSize) || 16
11
+
12
+ /**
13
+ * @description checks if token value has a specific unit
14
+ * @param value token value
15
+ * @param unit unit string like px or value
16
+ * @returns boolean
17
+ */
18
+ const hasUnit = (value: string | number, unit: string): boolean => {
19
+ if (typeof value === 'number') {
20
+ return false
21
+ }
22
+
23
+ return value.indexOf(unit) > -1
24
+ }
25
+
26
+ /**
27
+ * @description converts dimension tokens value to pixel value without unit, ignores `em` as they are relative to the font size of the parent element
28
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
29
+ * @matcher matches all tokens of $type `dimension`
30
+ * @transformer returns a float number
31
+ */
32
+ export const dimensionToPixelUnitless: StyleDictionary.Transform = {
33
+ type: `value`,
34
+ transitive: true,
35
+ matcher: isDimension,
36
+ transformer: (token: StyleDictionary.TransformedToken, options?: Platform) => {
37
+ const baseFont = getBasePxFontSize(options)
38
+ const floatVal = parseFloat(token.value)
39
+
40
+ if (isNaN(floatVal)) {
41
+ throw new Error(
42
+ `Invalid dimension token: '${token.name}: ${token.value}' is not valid and cannot be transform to 'float' \n`,
43
+ )
44
+ }
45
+
46
+ if (floatVal === 0) {
47
+ return 0
48
+ }
49
+
50
+ if (hasUnit(token.value, 'rem')) {
51
+ return floatVal * baseFont
52
+ }
53
+
54
+ if (hasUnit(token.value, 'px')) {
55
+ return floatVal
56
+ }
57
+
58
+ return token.value
59
+ },
60
+ }