@primer/primitives 9.1.2 → 10.0.0-rc.2963a70e

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 (328) hide show
  1. package/README.md +2 -2
  2. package/dist/build/PrimerStyleDictionary.d.ts +1 -2
  3. package/dist/build/PrimerStyleDictionary.js +52 -64
  4. package/dist/build/filters/index.d.ts +14 -13
  5. package/dist/build/filters/index.js +14 -29
  6. package/dist/build/filters/isBorder.d.ts +3 -3
  7. package/dist/build/filters/isBorder.js +2 -6
  8. package/dist/build/filters/isColor.d.ts +3 -3
  9. package/dist/build/filters/isColor.js +8 -7
  10. package/dist/build/filters/isColorWithAlpha.d.ts +3 -3
  11. package/dist/build/filters/isColorWithAlpha.js +4 -8
  12. package/dist/build/filters/isColorWithMix.d.ts +3 -3
  13. package/dist/build/filters/isColorWithMix.js +4 -8
  14. package/dist/build/filters/isCubicBezier.d.ts +7 -0
  15. package/dist/build/filters/isCubicBezier.js +10 -0
  16. package/dist/build/filters/isDeprecated.d.ts +3 -3
  17. package/dist/build/filters/isDeprecated.js +2 -6
  18. package/dist/build/filters/isDimension.d.ts +3 -3
  19. package/dist/build/filters/isDimension.js +2 -6
  20. package/dist/build/filters/isDuration.d.ts +3 -3
  21. package/dist/build/filters/isDuration.js +2 -6
  22. package/dist/build/filters/isFontFamily.d.ts +3 -3
  23. package/dist/build/filters/isFontFamily.js +2 -6
  24. package/dist/build/filters/isFontWeight.d.ts +3 -3
  25. package/dist/build/filters/isFontWeight.js +2 -6
  26. package/dist/build/filters/isFromFile.d.ts +3 -3
  27. package/dist/build/filters/isFromFile.js +2 -6
  28. package/dist/build/filters/isNumber.d.ts +3 -3
  29. package/dist/build/filters/isNumber.js +4 -6
  30. package/dist/build/filters/isShadow.d.ts +3 -3
  31. package/dist/build/filters/isShadow.js +2 -6
  32. package/dist/build/filters/isSource.d.ts +3 -3
  33. package/dist/build/filters/isSource.js +2 -6
  34. package/dist/build/filters/isTypography.d.ts +3 -3
  35. package/dist/build/filters/isTypography.js +2 -6
  36. package/dist/build/formats/cssAdvanced.d.ts +2 -2
  37. package/dist/build/formats/cssAdvanced.js +22 -20
  38. package/dist/build/formats/cssCustomMedia.d.ts +2 -2
  39. package/dist/build/formats/cssCustomMedia.js +16 -15
  40. package/dist/build/formats/index.d.ts +9 -9
  41. package/dist/build/formats/index.js +9 -21
  42. package/dist/build/formats/javascriptCommonJs.d.ts +2 -2
  43. package/dist/build/formats/javascriptCommonJs.js +17 -16
  44. package/dist/build/formats/javascriptEsm.d.ts +2 -2
  45. package/dist/build/formats/javascriptEsm.js +17 -16
  46. package/dist/build/formats/jsonFigma.d.ts +2 -2
  47. package/dist/build/formats/jsonFigma.js +27 -22
  48. package/dist/build/formats/jsonNestedPrefixed.d.ts +3 -3
  49. package/dist/build/formats/jsonNestedPrefixed.js +17 -15
  50. package/dist/build/formats/jsonOneDimensional.d.ts +3 -3
  51. package/dist/build/formats/jsonOneDimensional.js +24 -16
  52. package/dist/build/formats/jsonPostCssFallback.d.ts +3 -3
  53. package/dist/build/formats/jsonPostCssFallback.js +5 -12
  54. package/dist/build/formats/typescriptExportDefinition.d.ts +2 -2
  55. package/dist/build/formats/typescriptExportDefinition.js +50 -46
  56. package/dist/build/formats/utilities/getPropName.d.ts +1 -0
  57. package/dist/build/formats/utilities/getPropName.js +16 -0
  58. package/dist/build/formats/utilities/jsonToFlat.d.ts +2 -2
  59. package/dist/build/formats/utilities/jsonToFlat.js +1 -5
  60. package/dist/build/formats/utilities/jsonToNestedValue.d.ts +2 -2
  61. package/dist/build/formats/utilities/jsonToNestedValue.js +4 -6
  62. package/dist/build/formats/utilities/prefixTokens.d.ts +2 -2
  63. package/dist/build/formats/utilities/prefixTokens.js +1 -5
  64. package/dist/build/parsers/index.d.ts +1 -1
  65. package/dist/build/parsers/index.js +1 -5
  66. package/dist/build/parsers/w3cJsonParser.d.ts +2 -2
  67. package/dist/build/parsers/w3cJsonParser.js +7 -9
  68. package/dist/build/platforms/css.d.ts +1 -1
  69. package/dist/build/platforms/css.js +20 -11
  70. package/dist/build/platforms/deprecatedJson.d.ts +1 -1
  71. package/dist/build/platforms/deprecatedJson.js +3 -7
  72. package/dist/build/platforms/docJson.d.ts +1 -1
  73. package/dist/build/platforms/docJson.js +8 -7
  74. package/dist/build/platforms/fallbacks.d.ts +1 -1
  75. package/dist/build/platforms/fallbacks.js +3 -7
  76. package/dist/build/platforms/figma.d.ts +1 -1
  77. package/dist/build/platforms/figma.js +21 -14
  78. package/dist/build/platforms/index.d.ts +10 -10
  79. package/dist/build/platforms/index.js +10 -23
  80. package/dist/build/platforms/javascript.d.ts +1 -1
  81. package/dist/build/platforms/javascript.js +3 -7
  82. package/dist/build/platforms/json.d.ts +1 -1
  83. package/dist/build/platforms/json.js +3 -7
  84. package/dist/build/platforms/styleLint.d.ts +1 -1
  85. package/dist/build/platforms/styleLint.js +3 -7
  86. package/dist/build/platforms/typeDefinitions.d.ts +1 -1
  87. package/dist/build/platforms/typeDefinitions.js +6 -10
  88. package/dist/build/platforms/typescript.d.ts +1 -1
  89. package/dist/build/platforms/typescript.js +3 -7
  90. package/dist/build/schemas/alphaValue.js +4 -7
  91. package/dist/build/schemas/baseToken.d.ts +2 -2
  92. package/dist/build/schemas/baseToken.js +4 -7
  93. package/dist/build/schemas/borderToken.d.ts +5 -5
  94. package/dist/build/schemas/borderToken.js +13 -16
  95. package/dist/build/schemas/collections.js +8 -14
  96. package/dist/build/schemas/colorHexValue.js +4 -7
  97. package/dist/build/schemas/colorToken.d.ts +20 -15
  98. package/dist/build/schemas/colorToken.js +24 -24
  99. package/dist/build/schemas/cubicBezierToken.d.ts +18 -0
  100. package/dist/build/schemas/cubicBezierToken.js +8 -0
  101. package/dist/build/schemas/designToken.js +30 -32
  102. package/dist/build/schemas/dimensionToken.d.ts +5 -5
  103. package/dist/build/schemas/dimensionToken.js +14 -17
  104. package/dist/build/schemas/dimensionValue.js +7 -10
  105. package/dist/build/schemas/durationToken.d.ts +5 -5
  106. package/dist/build/schemas/durationToken.js +8 -11
  107. package/dist/build/schemas/durationValue.js +4 -7
  108. package/dist/build/schemas/fontFamilyToken.d.ts +5 -5
  109. package/dist/build/schemas/fontFamilyToken.js +13 -16
  110. package/dist/build/schemas/fontWeightToken.d.ts +5 -5
  111. package/dist/build/schemas/fontWeightToken.js +14 -17
  112. package/dist/build/schemas/fontWeightValue.js +4 -7
  113. package/dist/build/schemas/numberToken.d.ts +5 -5
  114. package/dist/build/schemas/numberToken.js +15 -18
  115. package/dist/build/schemas/referenceValue.js +4 -7
  116. package/dist/build/schemas/scopes.js +5 -10
  117. package/dist/build/schemas/shadowToken.d.ts +5 -5
  118. package/dist/build/schemas/shadowToken.js +23 -26
  119. package/dist/build/schemas/stringToken.d.ts +5 -5
  120. package/dist/build/schemas/stringToken.js +7 -10
  121. package/dist/build/schemas/tokenName.js +4 -7
  122. package/dist/build/schemas/tokenType.d.ts +2 -2
  123. package/dist/build/schemas/tokenType.js +2 -6
  124. package/dist/build/schemas/typographyToken.d.ts +5 -5
  125. package/dist/build/schemas/typographyToken.js +14 -17
  126. package/dist/build/schemas/validTokenType.d.ts +1 -1
  127. package/dist/build/schemas/validTokenType.js +10 -13
  128. package/dist/build/schemas/viewportRangeToken.d.ts +5 -5
  129. package/dist/build/schemas/viewportRangeToken.js +7 -10
  130. package/dist/build/transformers/borderToCss.d.ts +3 -3
  131. package/dist/build/transformers/borderToCss.js +16 -16
  132. package/dist/build/transformers/colorToHex.d.ts +2 -2
  133. package/dist/build/transformers/colorToHex.js +11 -13
  134. package/dist/build/transformers/colorToHexMix.d.ts +2 -2
  135. package/dist/build/transformers/colorToHexMix.js +10 -15
  136. package/dist/build/transformers/colorToRgbAlpha.d.ts +2 -2
  137. package/dist/build/transformers/colorToRgbAlpha.js +10 -12
  138. package/dist/build/transformers/colorToRgbaFloat.d.ts +2 -2
  139. package/dist/build/transformers/colorToRgbaFloat.js +24 -28
  140. package/dist/build/transformers/cubicBezierToCss.d.ts +8 -0
  141. package/dist/build/transformers/cubicBezierToCss.js +23 -0
  142. package/dist/build/transformers/dimensionToPixelUnitless.d.ts +2 -2
  143. package/dist/build/transformers/dimensionToPixelUnitless.js +13 -14
  144. package/dist/build/transformers/dimensionToRem.d.ts +2 -2
  145. package/dist/build/transformers/dimensionToRem.js +12 -13
  146. package/dist/build/transformers/dimensionToRemPxArray.d.ts +2 -2
  147. package/dist/build/transformers/dimensionToRemPxArray.js +11 -12
  148. package/dist/build/transformers/durationToCss.d.ts +2 -2
  149. package/dist/build/transformers/durationToCss.js +10 -11
  150. package/dist/build/transformers/figmaAttributes.d.ts +2 -2
  151. package/dist/build/transformers/figmaAttributes.js +3 -5
  152. package/dist/build/transformers/floatToPixel.d.ts +4 -4
  153. package/dist/build/transformers/floatToPixel.js +12 -14
  154. package/dist/build/transformers/fontFamilyToCss.d.ts +2 -2
  155. package/dist/build/transformers/fontFamilyToCss.js +10 -13
  156. package/dist/build/transformers/fontFamilyToFigma.d.ts +3 -3
  157. package/dist/build/transformers/fontFamilyToFigma.js +15 -17
  158. package/dist/build/transformers/fontWeightToNumber.d.ts +2 -2
  159. package/dist/build/transformers/fontWeightToNumber.js +8 -11
  160. package/dist/build/transformers/index.d.ts +25 -24
  161. package/dist/build/transformers/index.js +25 -51
  162. package/dist/build/transformers/jsonDeprecated.d.ts +2 -2
  163. package/dist/build/transformers/jsonDeprecated.js +6 -8
  164. package/dist/build/transformers/namePathToCamelCase.d.ts +2 -2
  165. package/dist/build/transformers/namePathToCamelCase.js +5 -7
  166. package/dist/build/transformers/namePathToDotNotation.d.ts +2 -2
  167. package/dist/build/transformers/namePathToDotNotation.js +6 -8
  168. package/dist/build/transformers/namePathToFigma.d.ts +3 -3
  169. package/dist/build/transformers/namePathToFigma.js +5 -8
  170. package/dist/build/transformers/namePathToKebabCase.d.ts +2 -2
  171. package/dist/build/transformers/namePathToKebabCase.js +4 -6
  172. package/dist/build/transformers/namePathToPascalCase.d.ts +2 -2
  173. package/dist/build/transformers/namePathToPascalCase.js +5 -7
  174. package/dist/build/transformers/namePathToSlashNotation.d.ts +2 -2
  175. package/dist/build/transformers/namePathToSlashNotation.js +4 -6
  176. package/dist/build/transformers/shadowToCss.d.ts +2 -2
  177. package/dist/build/transformers/shadowToCss.js +14 -15
  178. package/dist/build/transformers/typographyToCss.d.ts +2 -2
  179. package/dist/build/transformers/typographyToCss.js +13 -15
  180. package/dist/build/transformers/utilities/alpha.d.ts +1 -1
  181. package/dist/build/transformers/utilities/alpha.js +4 -8
  182. package/dist/build/transformers/utilities/checkRequiredTokenProperties.js +1 -5
  183. package/dist/build/transformers/utilities/getTokenValue.d.ts +2 -2
  184. package/dist/build/transformers/utilities/getTokenValue.js +10 -12
  185. package/dist/build/transformers/utilities/hasSpaceInString.js +1 -5
  186. package/dist/build/transformers/utilities/hexToRgbaFloat.d.ts +1 -1
  187. package/dist/build/transformers/utilities/hexToRgbaFloat.js +1 -5
  188. package/dist/build/transformers/utilities/invalidTokenError.d.ts +1 -1
  189. package/dist/build/transformers/utilities/invalidTokenError.js +11 -10
  190. package/dist/build/transformers/utilities/isRgbaFloat.js +1 -5
  191. package/dist/build/transformers/utilities/mix.js +5 -7
  192. package/dist/build/transformers/utilities/rgbaFloatToHex.js +1 -5
  193. package/dist/build/types/Border.d.ts +5 -0
  194. package/dist/build/types/BorderTokenValue.d.ts +10 -0
  195. package/dist/build/types/ColorHex.d.ts +4 -0
  196. package/dist/build/types/PlatformInitializer.d.ts +11 -0
  197. package/dist/build/types/Shadow.d.ts +5 -0
  198. package/dist/build/types/ShadowTokenValue.d.ts +14 -0
  199. package/dist/build/types/SizeEm.d.ts +4 -0
  200. package/dist/build/types/SizePx.d.ts +4 -0
  201. package/dist/build/types/SizeRem.d.ts +4 -0
  202. package/dist/build/types/StyleDictionaryConfigGenerator.d.ts +15 -0
  203. package/dist/build/types/TokenBuildInput.d.ts +8 -0
  204. package/dist/build/types/TypographyTokenValue.d.ts +12 -0
  205. package/dist/build/types/w3cTransformedToken.d.ts +8 -0
  206. package/dist/build/utilities/copyFromDir.d.ts +2 -2
  207. package/dist/build/utilities/copyFromDir.js +7 -10
  208. package/dist/build/utilities/filterStringArray.js +1 -5
  209. package/dist/build/utilities/getFlag.js +1 -5
  210. package/dist/build/utilities/index.d.ts +9 -3
  211. package/dist/build/utilities/index.js +9 -9
  212. package/dist/build/utilities/joinFriendly.js +1 -5
  213. package/dist/build/utilities/schemaErrorMessage.js +1 -5
  214. package/dist/build/utilities/toCamelCase.js +5 -9
  215. package/dist/build/utilities/toPascalCase.js +5 -9
  216. package/dist/build/utilities/treeWalker.js +2 -6
  217. package/dist/build/utilities/upperCaseFirstCharacter.js +1 -5
  218. package/dist/css/base/motion/motion.css +17 -0
  219. package/dist/css/functional/motion/motion.css +4 -3
  220. package/dist/css/functional/themes/dark-colorblind.css +58 -38
  221. package/dist/css/functional/themes/dark-dimmed.css +44 -24
  222. package/dist/css/functional/themes/dark-high-contrast.css +62 -42
  223. package/dist/css/functional/themes/dark-tritanopia.css +44 -24
  224. package/dist/css/functional/themes/dark.css +42 -22
  225. package/dist/css/functional/themes/light-colorblind.css +60 -40
  226. package/dist/css/functional/themes/light-high-contrast.css +58 -38
  227. package/dist/css/functional/themes/light-tritanopia.css +42 -22
  228. package/dist/css/functional/themes/light.css +42 -22
  229. package/dist/css/functional/typography/typography.css +43 -43
  230. package/dist/css/primitives.css +64 -46
  231. package/dist/docs/base/motion/motion.json +205 -0
  232. package/dist/docs/base/size/size.json +76 -76
  233. package/dist/docs/base/typography/typography.json +16 -16
  234. package/dist/docs/functional/motion/motion.json +33 -18
  235. package/dist/docs/functional/size/border.json +56 -56
  236. package/dist/docs/functional/size/breakpoints.json +24 -24
  237. package/dist/docs/functional/size/size-coarse.json +12 -12
  238. package/dist/docs/functional/size/size-fine.json +12 -12
  239. package/dist/docs/functional/size/size.json +264 -264
  240. package/dist/docs/functional/size/viewport.json +24 -24
  241. package/dist/docs/functional/themes/dark-colorblind.json +2868 -3462
  242. package/dist/docs/functional/themes/dark-dimmed.json +2826 -3016
  243. package/dist/docs/functional/themes/dark-high-contrast.json +2822 -5100
  244. package/dist/docs/functional/themes/dark-tritanopia.json +2829 -3203
  245. package/dist/docs/functional/themes/dark.json +2808 -2520
  246. package/dist/docs/functional/themes/light-colorblind.json +2604 -3150
  247. package/dist/docs/functional/themes/light-high-contrast.json +2653 -4609
  248. package/dist/docs/functional/themes/light-tritanopia.json +2546 -2960
  249. package/dist/docs/functional/themes/light.json +2590 -2312
  250. package/dist/docs/functional/typography/typography.json +206 -206
  251. package/dist/fallbacks/base/motion/motion.json +17 -0
  252. package/dist/fallbacks/functional/motion/motion.json +1 -0
  253. package/dist/figma/dimension/dimension.json +492 -492
  254. package/dist/figma/figma.json +21 -13
  255. package/dist/figma/scales/dark-dimmed.json +3536 -656
  256. package/dist/figma/scales/dark-high-constrast.json +3535 -655
  257. package/dist/figma/scales/dark.json +3371 -491
  258. package/dist/figma/scales/light-high-constrast.json +3532 -652
  259. package/dist/figma/scales/light.json +3367 -487
  260. package/dist/figma/shadows/dark-colorblind.json +199 -199
  261. package/dist/figma/shadows/dark-dimmed.json +199 -199
  262. package/dist/figma/shadows/dark-high-contrast.json +199 -199
  263. package/dist/figma/shadows/dark-tritanopia.json +199 -199
  264. package/dist/figma/shadows/dark.json +199 -199
  265. package/dist/figma/shadows/light-colorblind.json +189 -189
  266. package/dist/figma/shadows/light-high-contrast.json +191 -191
  267. package/dist/figma/shadows/light-tritanopia.json +189 -189
  268. package/dist/figma/shadows/light.json +189 -189
  269. package/dist/figma/themes/dark-colorblind.json +4470 -5204
  270. package/dist/figma/themes/dark-dimmed.json +4771 -5081
  271. package/dist/figma/themes/dark-high-contrast.json +4189 -6548
  272. package/dist/figma/themes/dark-tritanopia.json +4629 -5153
  273. package/dist/figma/themes/dark.json +5072 -4916
  274. package/dist/figma/themes/light-colorblind.json +4490 -5127
  275. package/dist/figma/themes/light-high-contrast.json +4170 -6201
  276. package/dist/figma/themes/light-tritanopia.json +4525 -5027
  277. package/dist/figma/themes/light.json +4982 -4825
  278. package/dist/figma/typography/typography.json +159 -203
  279. package/dist/internalCss/dark-colorblind.css +58 -38
  280. package/dist/internalCss/dark-dimmed.css +44 -24
  281. package/dist/internalCss/dark-high-contrast.css +62 -42
  282. package/dist/internalCss/dark-tritanopia.css +44 -24
  283. package/dist/internalCss/dark.css +42 -22
  284. package/dist/internalCss/light-colorblind.css +60 -40
  285. package/dist/internalCss/light-high-contrast.css +58 -38
  286. package/dist/internalCss/light-tritanopia.css +42 -22
  287. package/dist/internalCss/light.css +42 -22
  288. package/dist/styleLint/base/motion/motion.json +205 -0
  289. package/dist/styleLint/base/size/size.json +38 -38
  290. package/dist/styleLint/base/typography/typography.json +8 -8
  291. package/dist/styleLint/functional/motion/motion.json +27 -12
  292. package/dist/styleLint/functional/size/border.json +30 -30
  293. package/dist/styleLint/functional/size/breakpoints.json +12 -12
  294. package/dist/styleLint/functional/size/size-coarse.json +6 -6
  295. package/dist/styleLint/functional/size/size-fine.json +6 -6
  296. package/dist/styleLint/functional/size/size.json +132 -132
  297. package/dist/styleLint/functional/size/viewport.json +12 -12
  298. package/dist/styleLint/functional/themes/dark-colorblind.json +1644 -2238
  299. package/dist/styleLint/functional/themes/dark-dimmed.json +1699 -1889
  300. package/dist/styleLint/functional/themes/dark-high-contrast.json +1627 -3905
  301. package/dist/styleLint/functional/themes/dark-tritanopia.json +1704 -2078
  302. package/dist/styleLint/functional/themes/dark.json +1692 -1404
  303. package/dist/styleLint/functional/themes/light-colorblind.json +1506 -2052
  304. package/dist/styleLint/functional/themes/light-high-contrast.json +1515 -3471
  305. package/dist/styleLint/functional/themes/light-tritanopia.json +1434 -1848
  306. package/dist/styleLint/functional/themes/light.json +1474 -1196
  307. package/dist/styleLint/functional/typography/typography.json +114 -114
  308. package/package.json +22 -22
  309. package/src/tokens/base/motion/easing.json5 +26 -0
  310. package/src/tokens/base/motion/timing.json5 +50 -0
  311. package/src/tokens/functional/color/dark/app-dark.json5 +203 -88
  312. package/src/tokens/functional/color/dark/data-vis-dark.json5 +20 -20
  313. package/src/tokens/functional/color/dark/display-dark.json5 +95 -95
  314. package/src/tokens/functional/color/dark/overrides/dark.dimmed.json5 +0 -8
  315. package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +43 -30
  316. package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +62 -30
  317. package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +53 -12
  318. package/src/tokens/functional/color/dark/patterns-dark.json5 +16 -4
  319. package/src/tokens/functional/color/dark/primitives-dark.json5 +4 -4
  320. package/src/tokens/functional/color/light/app-light.json5 +195 -85
  321. package/src/tokens/functional/color/light/data-vis-light.json5 +20 -20
  322. package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +25 -25
  323. package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +65 -34
  324. package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +66 -11
  325. package/src/tokens/functional/color/light/patterns-light.json5 +13 -1
  326. package/src/tokens/functional/color/light/primitives-light.json5 +2 -2
  327. package/src/tokens/functional/motion/loading.json5 +1 -1
  328. package/src/tokens/functional/motion/patterns.json5 +9 -2
@@ -1,34 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shadowToken = exports.shadowValue = void 0;
4
- const zod_1 = require("zod");
5
- const baseToken_1 = require("./baseToken");
6
- const referenceValue_1 = require("./referenceValue");
7
- const colorHexValue_1 = require("./colorHexValue");
8
- const alphaValue_1 = require("./alphaValue");
9
- const dimensionValue_1 = require("./dimensionValue");
10
- const tokenType_1 = require("./tokenType");
11
- const collections_1 = require("./collections");
12
- exports.shadowValue = zod_1.z
1
+ import { z } from 'zod';
2
+ import { baseToken } from './baseToken.js';
3
+ import { referenceValue } from './referenceValue.js';
4
+ import { colorHexValue } from './colorHexValue.js';
5
+ import { alphaValue } from './alphaValue.js';
6
+ import { dimensionValue } from './dimensionValue.js';
7
+ import { tokenType } from './tokenType.js';
8
+ import { collection, mode } from './collections.js';
9
+ export const shadowValue = z
13
10
  .object({
14
- color: zod_1.z.union([colorHexValue_1.colorHexValue, referenceValue_1.referenceValue]),
15
- alpha: zod_1.z.union([alphaValue_1.alphaValue, referenceValue_1.referenceValue]),
16
- offsetX: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
17
- offsetY: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
18
- blur: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
19
- spread: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
20
- inset: zod_1.z.boolean().optional(),
11
+ color: z.union([colorHexValue, referenceValue]),
12
+ alpha: z.union([alphaValue, referenceValue]),
13
+ offsetX: z.union([dimensionValue, referenceValue]),
14
+ offsetY: z.union([dimensionValue, referenceValue]),
15
+ blur: z.union([dimensionValue, referenceValue]),
16
+ spread: z.union([dimensionValue, referenceValue]),
17
+ inset: z.boolean().optional(),
21
18
  })
22
19
  .strict();
23
- exports.shadowToken = baseToken_1.baseToken
20
+ export const shadowToken = baseToken
24
21
  .extend({
25
- $value: zod_1.z.union([exports.shadowValue, zod_1.z.array(exports.shadowValue), referenceValue_1.referenceValue]),
26
- $type: (0, tokenType_1.tokenType)('shadow'),
27
- $extensions: zod_1.z
22
+ $value: z.union([shadowValue, z.array(shadowValue), referenceValue]),
23
+ $type: tokenType('shadow'),
24
+ $extensions: z
28
25
  .object({
29
- 'org.primer.figma': zod_1.z.object({
30
- collection: (0, collections_1.collection)(['mode']).optional(),
31
- mode: (0, collections_1.mode)([
26
+ 'org.primer.figma': z.object({
27
+ collection: collection(['mode']).optional(),
28
+ mode: mode([
32
29
  'light',
33
30
  'dark',
34
31
  'dark dimmed',
@@ -4,15 +4,15 @@ export declare const stringToken: z.ZodObject<z.objectUtil.extendShape<{
4
4
  deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
5
  }, {
6
6
  $value: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
7
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
8
8
  }>, "strict", z.ZodTypeAny, {
9
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
10
9
  $value: string;
11
- deprecated?: string | boolean | undefined;
10
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
12
11
  $description?: string | undefined;
12
+ deprecated?: string | boolean | undefined;
13
13
  }, {
14
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
15
14
  $value: string;
16
- deprecated?: string | boolean | undefined;
15
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
17
16
  $description?: string | undefined;
17
+ deprecated?: string | boolean | undefined;
18
18
  }>;
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringToken = void 0;
4
- const zod_1 = require("zod");
5
- const baseToken_1 = require("./baseToken");
6
- const referenceValue_1 = require("./referenceValue");
7
- const tokenType_1 = require("./tokenType");
8
- exports.stringToken = baseToken_1.baseToken
1
+ import { z } from 'zod';
2
+ import { baseToken } from './baseToken.js';
3
+ import { referenceValue } from './referenceValue.js';
4
+ import { tokenType } from './tokenType.js';
5
+ export const stringToken = baseToken
9
6
  .extend({
10
- $value: zod_1.z.union([zod_1.z.string(), referenceValue_1.referenceValue]),
11
- $type: (0, tokenType_1.tokenType)('string'),
7
+ $value: z.union([z.string(), referenceValue]),
8
+ $type: tokenType('string'),
12
9
  })
13
10
  .strict();
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenName = void 0;
4
- const zod_1 = require("zod");
5
- const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
6
- exports.tokenName = zod_1.z.string().refine(name => /(^[a-z0-9][A-Za-z0-9-]*$|^@$)/.test(name), name => ({
7
- message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid token name: "${name}"`, 'Token name must be kebab-case or camelCase, and start with a lowercase letter or number and consist only of letters, numbers, and hyphens.'),
1
+ import { z } from 'zod';
2
+ import { schemaErrorMessage } from '../utilities/index.js';
3
+ export const tokenName = z.string().refine(name => /(^[a-z0-9][A-Za-z0-9-]*$|^@$)/.test(name), name => ({
4
+ message: schemaErrorMessage(`Invalid token name: "${name}"`, 'Token name must be kebab-case or camelCase, and start with a lowercase letter or number and consist only of letters, numbers, and hyphens.'),
8
5
  }));
@@ -1,3 +1,3 @@
1
1
  import { z } from 'zod';
2
- import type { TokenType } from './validTokenType';
3
- export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
2
+ import type { TokenType } from './validTokenType.js';
3
+ export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
@@ -1,6 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenType = void 0;
4
- const zod_1 = require("zod");
5
- const tokenType = ($type) => zod_1.z.literal($type);
6
- exports.tokenType = tokenType;
1
+ import { z } from 'zod';
2
+ export const tokenType = ($type) => z.literal($type);
@@ -35,25 +35,25 @@ export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
35
35
  fontWeight: string | number;
36
36
  lineHeight?: string | 0 | undefined;
37
37
  }>, z.ZodEffects<z.ZodString, string, string>]>;
38
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
38
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
39
39
  }>, "strict", z.ZodTypeAny, {
40
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
41
40
  $value: string | {
42
41
  fontFamily: string;
43
42
  fontSize: string | 0;
44
43
  fontWeight: string | number;
45
44
  lineHeight?: string | 0 | undefined;
46
45
  };
47
- deprecated?: string | boolean | undefined;
46
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
48
47
  $description?: string | undefined;
48
+ deprecated?: string | boolean | undefined;
49
49
  }, {
50
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
51
50
  $value: string | {
52
51
  fontFamily: string;
53
52
  fontSize: string | 0;
54
53
  fontWeight: string | number;
55
54
  lineHeight?: string | 0 | undefined;
56
55
  };
57
- deprecated?: string | boolean | undefined;
56
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
58
57
  $description?: string | undefined;
58
+ deprecated?: string | boolean | undefined;
59
59
  }>;
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typographyToken = exports.typographyValue = void 0;
4
- const zod_1 = require("zod");
5
- const referenceValue_1 = require("./referenceValue");
6
- const dimensionValue_1 = require("./dimensionValue");
7
- const baseToken_1 = require("./baseToken");
8
- const fontWeightValue_1 = require("./fontWeightValue");
9
- const tokenType_1 = require("./tokenType");
10
- exports.typographyValue = zod_1.z.object({
11
- fontSize: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
12
- lineHeight: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]).optional(),
13
- fontWeight: zod_1.z.union([fontWeightValue_1.fontWeightValue, referenceValue_1.referenceValue]),
14
- fontFamily: zod_1.z.union([zod_1.z.string().min(1), referenceValue_1.referenceValue]),
1
+ import { z } from 'zod';
2
+ import { referenceValue } from './referenceValue.js';
3
+ import { dimensionValue } from './dimensionValue.js';
4
+ import { baseToken } from './baseToken.js';
5
+ import { fontWeightValue } from './fontWeightValue.js';
6
+ import { tokenType } from './tokenType.js';
7
+ export const typographyValue = z.object({
8
+ fontSize: z.union([dimensionValue, referenceValue]),
9
+ lineHeight: z.union([dimensionValue, referenceValue]).optional(),
10
+ fontWeight: z.union([fontWeightValue, referenceValue]),
11
+ fontFamily: z.union([z.string().min(1), referenceValue]),
15
12
  });
16
- exports.typographyToken = baseToken_1.baseToken
13
+ export const typographyToken = baseToken
17
14
  .extend({
18
- $value: zod_1.z.union([exports.typographyValue, referenceValue_1.referenceValue]),
19
- $type: (0, tokenType_1.tokenType)('typography'),
15
+ $value: z.union([typographyValue, referenceValue]),
16
+ $type: tokenType('typography'),
20
17
  })
21
18
  .strict();
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- declare const validTypes: readonly ["color", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "number", "string", "custom-viewportRange"];
2
+ declare const validTypes: readonly ["color", "cubicBezier", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "number", "string", "custom-viewportRange"];
3
3
  export type TokenType = (typeof validTypes)[number];
4
4
  export declare const validateType: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodTypeAny>>;
5
5
  export {};
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateType = void 0;
4
- const zod_1 = require("zod");
5
- const joinFriendly_1 = require("../utilities/joinFriendly");
6
- const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
1
+ import { z } from 'zod';
2
+ import { joinFriendly, schemaErrorMessage } from '../utilities/index.js';
7
3
  const validTypes = [
8
4
  'color',
5
+ 'cubicBezier',
9
6
  'typography',
10
7
  'dimension',
11
8
  'duration',
@@ -19,16 +16,16 @@ const validTypes = [
19
16
  ];
20
17
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
21
18
  // @ts-ignore: TODO: fix this
22
- exports.validateType = zod_1.z.record(zod_1.z.string(), zod_1.z.lazy(() => {
23
- return zod_1.z.union([
24
- zod_1.z
19
+ export const validateType = z.record(z.string(), z.lazy(() => {
20
+ return z.union([
21
+ z
25
22
  .object({
26
- $value: zod_1.z.any(),
27
- $type: zod_1.z.string().refine(type => validTypes.includes(type), val => ({
28
- message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid token $type: "${val}"`, `Must be one of the following: ${(0, joinFriendly_1.joinFriendly)([...validTypes], 'or')}`),
23
+ $value: z.any(),
24
+ $type: z.string().refine(type => validTypes.includes(type), val => ({
25
+ message: schemaErrorMessage(`Invalid token $type: "${val}"`, `Must be one of the following: ${joinFriendly([...validTypes], 'or')}`),
29
26
  })),
30
27
  })
31
28
  .required(),
32
- exports.validateType,
29
+ validateType,
33
30
  ]);
34
31
  }));
@@ -4,15 +4,15 @@ export declare const viewportRangeToken: z.ZodObject<z.objectUtil.extendShape<{
4
4
  deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
5
  }, {
6
6
  $value: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
7
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
8
8
  }>, "strict", z.ZodTypeAny, {
9
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
10
9
  $value: string;
11
- deprecated?: string | boolean | undefined;
10
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
12
11
  $description?: string | undefined;
12
+ deprecated?: string | boolean | undefined;
13
13
  }, {
14
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
15
14
  $value: string;
16
- deprecated?: string | boolean | undefined;
15
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
17
16
  $description?: string | undefined;
17
+ deprecated?: string | boolean | undefined;
18
18
  }>;
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.viewportRangeToken = void 0;
4
- const zod_1 = require("zod");
5
- const baseToken_1 = require("./baseToken");
6
- const referenceValue_1 = require("./referenceValue");
7
- const tokenType_1 = require("./tokenType");
8
- exports.viewportRangeToken = baseToken_1.baseToken
1
+ import { z } from 'zod';
2
+ import { baseToken } from './baseToken.js';
3
+ import { referenceValue } from './referenceValue.js';
4
+ import { tokenType } from './tokenType.js';
5
+ export const viewportRangeToken = baseToken
9
6
  .extend({
10
- $value: zod_1.z.union([zod_1.z.string(), referenceValue_1.referenceValue]),
11
- $type: (0, tokenType_1.tokenType)('custom-viewportRange'),
7
+ $value: z.union([z.string(), referenceValue]),
8
+ $type: tokenType('custom-viewportRange'),
12
9
  })
13
10
  .strict();
@@ -1,8 +1,8 @@
1
- import type StyleDictionary from 'style-dictionary';
1
+ import type { Transform } from 'style-dictionary/types';
2
2
  /**
3
3
  * @description converts w3c border tokens in css border string
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
4
+ * @type valueTransformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
5
  * @matcher matches all tokens of $type `border`
6
6
  * @transformer returns css border `string`
7
7
  */
8
- export declare const borderToCss: StyleDictionary.Transform;
8
+ export declare const borderToCss: Transform;
@@ -1,37 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.borderToCss = void 0;
4
- const isBorder_1 = require("../filters/isBorder");
1
+ import { isBorder } from '../filters/isBorder.js';
5
2
  /**
6
3
  * checks if all required properties exist on shadow token
7
4
  * @param object - BorderTokenValue
8
5
  * @returns void or throws error
9
6
  */
10
7
  const checkForBorderTokenProperties = (border) => {
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
- }
8
+ if ('color' in border && 'width' in border && 'style' in border) {
9
+ return true;
16
10
  }
11
+ return false;
17
12
  };
18
13
  /**
19
14
  * @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)
15
+ * @type valueTransformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
21
16
  * @matcher matches all tokens of $type `border`
22
17
  * @transformer returns css border `string`
23
18
  */
24
- exports.borderToCss = {
25
- type: `value`,
19
+ export const borderToCss = {
20
+ name: 'border/css',
21
+ type: 'value',
26
22
  transitive: true,
27
- matcher: isBorder_1.isBorder,
28
- transformer: ({ value }) => {
29
- //
30
- checkForBorderTokenProperties(value);
23
+ filter: isBorder,
24
+ transform: (token) => {
25
+ var _a;
26
+ const value = (_a = token.$value) !== null && _a !== void 0 ? _a : token.value;
31
27
  // if value === string it was probably already transformed
32
28
  if (typeof value === 'string') {
33
29
  return value;
34
30
  }
31
+ //
32
+ if (!checkForBorderTokenProperties(value)) {
33
+ throw new Error(`Invalid border token property ${JSON.stringify(value)}. Must be an object with color, width and style properties.`);
34
+ }
35
35
  /* color | style | width */
36
36
  return `${value.color} ${value.style} ${value.width}`;
37
37
  },
@@ -1,8 +1,8 @@
1
- import type StyleDictionary from 'style-dictionary';
1
+ import type { Transform } from 'style-dictionary/types';
2
2
  /**
3
3
  * @description converts color tokens value to `hex6` or `hex8`
4
4
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
5
  * @matcher matches all tokens of $type `color`
6
6
  * @transformer returns a `hex` string
7
7
  */
8
- export declare const colorToHex: StyleDictionary.Transform;
8
+ export declare const colorToHex: Transform;
@@ -1,26 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.colorToHex = void 0;
4
- const color2k_1 = require("color2k");
5
- const filters_1 = require("../filters");
6
- const getTokenValue_1 = require("./utilities/getTokenValue");
7
- const alpha_1 = require("./utilities/alpha");
1
+ import { toHex } from 'color2k';
2
+ import { isColor } from '../filters/index.js';
3
+ import { getTokenValue } from './utilities/getTokenValue.js';
4
+ import { alpha } from './utilities/alpha.js';
8
5
  /**
9
6
  * @description converts color tokens value to `hex6` or `hex8`
10
7
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
11
8
  * @matcher matches all tokens of $type `color`
12
9
  * @transformer returns a `hex` string
13
10
  */
14
- exports.colorToHex = {
15
- type: `value`,
11
+ export const colorToHex = {
12
+ name: 'color/hex',
13
+ type: 'value',
16
14
  transitive: true,
17
- matcher: filters_1.isColor,
18
- transformer: (token) => {
15
+ filter: isColor,
16
+ transform: (token) => {
19
17
  var _a, _b;
20
18
  const alphaValue = (_a = token.alpha) !== null && _a !== void 0 ? _a : (_b = token.$extensions) === null || _b === void 0 ? void 0 : _b.alpha;
21
19
  if (alphaValue === null || alphaValue === undefined) {
22
- return (0, color2k_1.toHex)((0, getTokenValue_1.getTokenValue)(token));
20
+ return toHex(getTokenValue(token));
23
21
  }
24
- return (0, color2k_1.toHex)((0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(token), alphaValue, token));
22
+ return toHex(alpha(getTokenValue(token), alphaValue, token));
25
23
  },
26
24
  };
@@ -1,8 +1,8 @@
1
- import type StyleDictionary from 'style-dictionary';
1
+ import type { Transform } from 'style-dictionary/types';
2
2
  /**
3
3
  * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
4
4
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
5
  * @matcher matches all tokens of $type `color` with an `alpha` property
6
6
  * @transformer returns `hex8` string
7
7
  */
8
- export declare const colorToHexMix: StyleDictionary.Transform;
8
+ export declare const colorToHexMix: Transform;
@@ -1,25 +1,20 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.colorToHexMix = void 0;
7
- const color2k_1 = require("color2k");
8
- const filters_1 = require("../filters");
9
- const getTokenValue_1 = require("./utilities/getTokenValue");
10
- const mix_1 = __importDefault(require("./utilities/mix"));
1
+ import { toHex } from 'color2k';
2
+ import { isColorWithMix } from '../filters/index.js';
3
+ import { getTokenValue } from './utilities/getTokenValue.js';
4
+ import mix from './utilities/mix.js';
11
5
  /**
12
6
  * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
13
7
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
14
8
  * @matcher matches all tokens of $type `color` with an `alpha` property
15
9
  * @transformer returns `hex8` string
16
10
  */
17
- exports.colorToHexMix = {
18
- type: `value`,
11
+ export const colorToHexMix = {
12
+ name: 'color/hexMix',
13
+ type: 'value',
19
14
  transitive: true,
20
- matcher: filters_1.isColorWithMix,
21
- transformer: (token) => {
15
+ filter: isColorWithMix,
16
+ transform: (token) => {
22
17
  var _a, _b;
23
- return (0, color2k_1.toHex)((0, mix_1.default)((0, getTokenValue_1.getTokenValue)(token), ((_a = token.mix) === null || _a === void 0 ? void 0 : _a.color) || (0, getTokenValue_1.getTokenValue)(token), ((_b = token.mix) === null || _b === void 0 ? void 0 : _b.weight) || 0));
18
+ return toHex(mix(getTokenValue(token), ((_a = token.mix) === null || _a === void 0 ? void 0 : _a.color) || getTokenValue(token), ((_b = token.mix) === null || _b === void 0 ? void 0 : _b.weight) || 0));
24
19
  },
25
20
  };
@@ -1,8 +1,8 @@
1
- import type StyleDictionary from 'style-dictionary';
1
+ import type { Transform } from 'style-dictionary/types';
2
2
  /**
3
3
  * @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
4
4
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
5
  * @matcher matches all tokens of $type `color` with an `alpha` property
6
6
  * @transformer returns `rgba` string
7
7
  */
8
- export declare const colorToRgbAlpha: StyleDictionary.Transform;
8
+ export declare const colorToRgbAlpha: Transform;
@@ -1,22 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.colorToRgbAlpha = void 0;
4
- const filters_1 = require("../filters");
5
- const alpha_1 = require("./utilities/alpha");
6
- const getTokenValue_1 = require("./utilities/getTokenValue");
1
+ import { isColorWithAlpha } from '../filters/index.js';
2
+ import { alpha } from './utilities/alpha.js';
3
+ import { getTokenValue } from './utilities/getTokenValue.js';
7
4
  /**
8
5
  * @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
9
6
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
10
7
  * @matcher matches all tokens of $type `color` with an `alpha` property
11
8
  * @transformer returns `rgba` string
12
9
  */
13
- exports.colorToRgbAlpha = {
14
- type: `value`,
10
+ export const colorToRgbAlpha = {
11
+ name: 'color/rgbAlpha',
12
+ type: 'value',
15
13
  transitive: true,
16
- matcher: filters_1.isColorWithAlpha,
17
- transformer: (token) => {
14
+ filter: isColorWithAlpha,
15
+ transform: (token) => {
18
16
  if (token.alpha === null)
19
- return (0, getTokenValue_1.getTokenValue)(token);
20
- return (0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(token), token.alpha, token);
17
+ return getTokenValue(token);
18
+ return alpha(getTokenValue(token), token.alpha, token);
21
19
  },
22
20
  };
@@ -1,8 +1,8 @@
1
- import type StyleDictionary from 'style-dictionary';
1
+ import type { Transform } from 'style-dictionary/types';
2
2
  /**
3
3
  * @description converts color tokens rgba float with values from 0 - 1
4
4
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
5
  * @matcher matches all tokens of $type `color`
6
6
  * @transformer returns a `rgb` float object
7
7
  */
8
- export declare const colorToRgbaFloat: StyleDictionary.Transform;
8
+ export declare const colorToRgbaFloat: Transform;
@@ -1,34 +1,28 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.colorToRgbaFloat = void 0;
7
- const color2k_1 = require("color2k");
8
- const filters_1 = require("../filters");
9
- const getTokenValue_1 = require("./utilities/getTokenValue");
10
- const rgbaFloatToHex_1 = require("./utilities/rgbaFloatToHex");
11
- const mix_1 = __importDefault(require("./utilities/mix"));
12
- const hexToRgbaFloat_1 = require("./utilities/hexToRgbaFloat");
13
- const isRgbaFloat_1 = require("./utilities/isRgbaFloat");
14
- const toRgbaFloat = (token, alpha) => {
1
+ import { toHex } from 'color2k';
2
+ import { isColor } from '../filters/index.js';
3
+ import { getTokenValue } from './utilities/getTokenValue.js';
4
+ import { rgbaFloatToHex } from './utilities/rgbaFloatToHex.js';
5
+ import mix from './utilities/mix.js';
6
+ import { hexToRgbaFloat } from './utilities/hexToRgbaFloat.js';
7
+ import { isRgbaFloat } from './utilities/isRgbaFloat.js';
8
+ const toRgbaFloat = (token, alpha = undefined) => {
15
9
  var _a;
16
- let tokenValue = (0, getTokenValue_1.getTokenValue)(token);
10
+ let tokenValue = getTokenValue(token);
17
11
  let tokenMixColor = (_a = token.mix) === null || _a === void 0 ? void 0 : _a.color;
18
12
  // get hex value from color string
19
- if ((0, isRgbaFloat_1.isRgbaFloat)(tokenValue)) {
20
- tokenValue = (0, rgbaFloatToHex_1.rgbaFloatToHex)(tokenValue, false);
13
+ if (isRgbaFloat(tokenValue)) {
14
+ tokenValue = rgbaFloatToHex(tokenValue, false);
21
15
  }
22
- if (tokenMixColor && (0, isRgbaFloat_1.isRgbaFloat)(tokenMixColor)) {
23
- tokenMixColor = (0, rgbaFloatToHex_1.rgbaFloatToHex)(tokenMixColor, false);
16
+ if (tokenMixColor && isRgbaFloat(tokenMixColor)) {
17
+ tokenMixColor = rgbaFloatToHex(tokenMixColor, false);
24
18
  }
25
- let hex = (0, color2k_1.toHex)(tokenValue);
19
+ let hex = toHex(tokenValue);
26
20
  // mix color with mix color and weight
27
21
  if (token.mix && token.mix.color && token.mix.weight) {
28
- hex = (0, color2k_1.toHex)((0, mix_1.default)(tokenValue, tokenMixColor, token.mix.weight));
22
+ hex = toHex(mix(tokenValue, tokenMixColor, token.mix.weight));
29
23
  }
30
24
  // return color as RgbaFloat
31
- return (0, hexToRgbaFloat_1.hexToRgbaFloat)(hex, alpha);
25
+ return hexToRgbaFloat(hex, alpha);
32
26
  };
33
27
  /**
34
28
  * @description converts color tokens rgba float with values from 0 - 1
@@ -36,14 +30,16 @@ const toRgbaFloat = (token, alpha) => {
36
30
  * @matcher matches all tokens of $type `color`
37
31
  * @transformer returns a `rgb` float object
38
32
  */
39
- exports.colorToRgbaFloat = {
40
- type: `value`,
33
+ export const colorToRgbaFloat = {
34
+ name: 'color/rgbaFloat',
35
+ type: 'value',
41
36
  transitive: true,
42
- matcher: filters_1.isColor,
43
- transformer: (token) => {
37
+ filter: isColor,
38
+ transform: (token) => {
39
+ const value = getTokenValue(token);
44
40
  // skip if value is already rgb float
45
- if ((0, isRgbaFloat_1.isRgbaFloat)(token.value) && !('mix' in token) && !('alpha' in token))
46
- return token.value;
41
+ if (isRgbaFloat(value) && !('mix' in token) && !('alpha' in token))
42
+ return value;
47
43
  // convert hex or rgb values to rgba float
48
44
  return toRgbaFloat(token, token.alpha);
49
45
  },
@@ -0,0 +1,8 @@
1
+ import type { Transform } from 'style-dictionary/types';
2
+ /**
3
+ * @description converts cubicBezeir tokens array value to a css cubic-bezier
4
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
+ * @matcher matches all tokens of $type `duration`
6
+ * @transformer returns a css cubic-bezier function
7
+ */
8
+ export declare const cubicBezierToCss: Transform;