@primer/primitives 9.0.3 → 9.1.0-rc.56a8ee48

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 (335) hide show
  1. package/dist/build/PrimerStyleDictionary.d.ts +9 -0
  2. package/dist/build/PrimerStyleDictionary.js +93 -0
  3. package/dist/build/filters/index.d.ts +13 -0
  4. package/dist/build/filters/index.js +29 -0
  5. package/{src/filters/isBorder.ts → dist/build/filters/isBorder.d.ts} +2 -5
  6. package/dist/build/filters/isBorder.js +12 -0
  7. package/{src/filters/isColor.ts → dist/build/filters/isColor.d.ts} +2 -5
  8. package/dist/build/filters/isColor.js +12 -0
  9. package/dist/build/filters/isColorWithAlpha.d.ts +7 -0
  10. package/dist/build/filters/isColorWithAlpha.js +13 -0
  11. package/dist/build/filters/isColorWithMix.d.ts +7 -0
  12. package/dist/build/filters/isColorWithMix.js +28 -0
  13. package/{src/filters/isDeprecated.ts → dist/build/filters/isDeprecated.d.ts} +2 -5
  14. package/dist/build/filters/isDeprecated.js +12 -0
  15. package/{src/filters/isDimension.ts → dist/build/filters/isDimension.d.ts} +2 -5
  16. package/dist/build/filters/isDimension.js +12 -0
  17. package/{src/filters/isDuration.ts → dist/build/filters/isDuration.d.ts} +2 -5
  18. package/dist/build/filters/isDuration.js +12 -0
  19. package/{src/filters/isFontFamily.ts → dist/build/filters/isFontFamily.d.ts} +2 -5
  20. package/dist/build/filters/isFontFamily.js +12 -0
  21. package/{src/filters/isFontWeight.ts → dist/build/filters/isFontWeight.d.ts} +2 -5
  22. package/dist/build/filters/isFontWeight.js +12 -0
  23. package/dist/build/filters/isFromFile.d.ts +8 -0
  24. package/dist/build/filters/isFromFile.js +14 -0
  25. package/{src/filters/isNumber.ts → dist/build/filters/isNumber.d.ts} +2 -3
  26. package/dist/build/filters/isNumber.js +10 -0
  27. package/{src/filters/isShadow.ts → dist/build/filters/isShadow.d.ts} +2 -5
  28. package/dist/build/filters/isShadow.js +12 -0
  29. package/{src/filters/isSource.ts → dist/build/filters/isSource.d.ts} +2 -5
  30. package/dist/build/filters/isSource.js +12 -0
  31. package/{src/filters/isTypography.ts → dist/build/filters/isTypography.d.ts} +2 -5
  32. package/dist/build/filters/isTypography.js +12 -0
  33. package/dist/build/formats/cssAdvanced.d.ts +2 -0
  34. package/dist/build/formats/cssAdvanced.js +84 -0
  35. package/dist/build/formats/cssCustomMedia.d.ts +7 -0
  36. package/dist/build/formats/cssCustomMedia.js +25 -0
  37. package/dist/build/formats/index.d.ts +9 -0
  38. package/dist/build/formats/index.js +21 -0
  39. package/dist/build/formats/javascriptCommonJs.d.ts +7 -0
  40. package/dist/build/formats/javascriptCommonJs.js +25 -0
  41. package/dist/build/formats/javascriptEsm.d.ts +7 -0
  42. package/dist/build/formats/javascriptEsm.js +25 -0
  43. package/dist/build/formats/jsonFigma.d.ts +7 -0
  44. package/dist/build/formats/jsonFigma.js +116 -0
  45. package/dist/build/formats/jsonNestedPrefixed.d.ts +8 -0
  46. package/dist/build/formats/jsonNestedPrefixed.js +28 -0
  47. package/dist/build/formats/jsonOneDimensional.d.ts +8 -0
  48. package/dist/build/formats/jsonOneDimensional.js +24 -0
  49. package/dist/build/formats/jsonPostCssFallback.d.ts +8 -0
  50. package/dist/build/formats/jsonPostCssFallback.js +21 -0
  51. package/dist/build/formats/typescriptExportDefinition.d.ts +7 -0
  52. package/dist/build/formats/typescriptExportDefinition.js +166 -0
  53. package/{src/formats/utilities/jsonToFlat.ts → dist/build/formats/utilities/jsonToFlat.d.ts} +4 -3
  54. package/dist/build/formats/utilities/jsonToFlat.js +12 -0
  55. package/dist/build/formats/utilities/jsonToNestedValue.d.ts +8 -0
  56. package/dist/build/formats/utilities/jsonToNestedValue.js +25 -0
  57. package/dist/build/formats/utilities/prefixTokens.d.ts +8 -0
  58. package/dist/build/formats/utilities/prefixTokens.js +17 -0
  59. package/dist/build/parsers/index.d.ts +1 -0
  60. package/dist/build/parsers/index.js +5 -0
  61. package/dist/build/parsers/w3cJsonParser.d.ts +6 -0
  62. package/dist/build/parsers/w3cJsonParser.js +27 -0
  63. package/dist/build/platforms/css.d.ts +2 -0
  64. package/dist/build/platforms/css.js +88 -0
  65. package/dist/build/platforms/deprecatedJson.d.ts +2 -0
  66. package/dist/build/platforms/deprecatedJson.js +17 -0
  67. package/dist/build/platforms/docJson.d.ts +2 -0
  68. package/dist/build/platforms/docJson.js +35 -0
  69. package/dist/build/platforms/fallbacks.d.ts +2 -0
  70. package/dist/build/platforms/fallbacks.js +35 -0
  71. package/dist/build/platforms/figma.d.ts +2 -0
  72. package/dist/build/platforms/figma.js +53 -0
  73. package/dist/build/platforms/index.d.ts +10 -0
  74. package/dist/build/platforms/index.js +23 -0
  75. package/dist/build/platforms/javascript.d.ts +2 -0
  76. package/dist/build/platforms/javascript.js +31 -0
  77. package/dist/build/platforms/json.d.ts +2 -0
  78. package/dist/build/platforms/json.js +33 -0
  79. package/dist/build/platforms/styleLint.d.ts +2 -0
  80. package/dist/build/platforms/styleLint.js +35 -0
  81. package/dist/build/platforms/typeDefinitions.d.ts +2 -0
  82. package/dist/build/platforms/typeDefinitions.js +31 -0
  83. package/dist/build/platforms/typescript.d.ts +2 -0
  84. package/dist/build/platforms/typescript.js +31 -0
  85. package/dist/build/schemas/alphaValue.d.ts +2 -0
  86. package/dist/build/schemas/alphaValue.js +8 -0
  87. package/dist/build/schemas/baseToken.d.ts +11 -0
  88. package/dist/build/schemas/baseToken.js +10 -0
  89. package/dist/build/schemas/borderToken.d.ts +51 -0
  90. package/dist/build/schemas/borderToken.js +20 -0
  91. package/dist/build/schemas/collections.d.ts +6 -0
  92. package/dist/build/schemas/collections.js +18 -0
  93. package/dist/build/schemas/colorHexValue.d.ts +2 -0
  94. package/dist/build/schemas/colorHexValue.js +12 -0
  95. package/dist/build/schemas/colorToken.d.ts +80 -0
  96. package/dist/build/schemas/colorToken.js +52 -0
  97. package/dist/build/schemas/designToken.d.ts +2 -0
  98. package/dist/build/schemas/designToken.js +37 -0
  99. package/dist/build/schemas/dimensionToken.d.ts +52 -0
  100. package/dist/build/schemas/dimensionToken.js +36 -0
  101. package/dist/build/schemas/dimensionValue.d.ts +2 -0
  102. package/dist/build/schemas/dimensionValue.js +12 -0
  103. package/dist/build/schemas/durationToken.d.ts +18 -0
  104. package/dist/build/schemas/durationToken.js +14 -0
  105. package/dist/build/schemas/durationValue.d.ts +2 -0
  106. package/dist/build/schemas/durationValue.js +8 -0
  107. package/dist/build/schemas/fontFamilyToken.d.ts +52 -0
  108. package/dist/build/schemas/fontFamilyToken.js +23 -0
  109. package/dist/build/schemas/fontWeightToken.d.ts +52 -0
  110. package/dist/build/schemas/fontWeightToken.js +24 -0
  111. package/dist/build/schemas/fontWeightValue.d.ts +2 -0
  112. package/dist/build/schemas/fontWeightValue.js +9 -0
  113. package/dist/build/schemas/numberToken.d.ts +71 -0
  114. package/dist/build/schemas/numberToken.js +30 -0
  115. package/dist/build/schemas/referenceValue.d.ts +2 -0
  116. package/dist/build/schemas/referenceValue.js +8 -0
  117. package/dist/build/schemas/scopes.d.ts +5 -0
  118. package/dist/build/schemas/scopes.js +34 -0
  119. package/dist/build/schemas/shadowToken.d.ts +157 -0
  120. package/dist/build/schemas/shadowToken.js +46 -0
  121. package/dist/build/schemas/stringToken.d.ts +18 -0
  122. package/dist/build/schemas/stringToken.js +13 -0
  123. package/dist/build/schemas/tokenName.d.ts +2 -0
  124. package/dist/build/schemas/tokenName.js +8 -0
  125. package/dist/build/schemas/tokenType.d.ts +3 -0
  126. package/dist/build/schemas/tokenType.js +6 -0
  127. package/dist/build/schemas/typographyToken.d.ts +59 -0
  128. package/dist/build/schemas/typographyToken.js +21 -0
  129. package/dist/build/schemas/validTokenType.d.ts +5 -0
  130. package/dist/build/schemas/validTokenType.js +34 -0
  131. package/dist/build/schemas/viewportRangeToken.d.ts +18 -0
  132. package/dist/build/schemas/viewportRangeToken.js +13 -0
  133. package/dist/build/transformers/borderToCss.d.ts +8 -0
  134. package/dist/build/transformers/borderToCss.js +38 -0
  135. package/dist/build/transformers/colorToHex.d.ts +8 -0
  136. package/dist/build/transformers/colorToHex.js +18 -0
  137. package/dist/build/transformers/colorToHexAlpha.d.ts +8 -0
  138. package/dist/build/transformers/colorToHexAlpha.js +25 -0
  139. package/dist/build/transformers/colorToHexMix.d.ts +8 -0
  140. package/dist/build/transformers/colorToHexMix.js +25 -0
  141. package/dist/build/transformers/colorToRgbAlpha.d.ts +8 -0
  142. package/dist/build/transformers/colorToRgbAlpha.js +22 -0
  143. package/dist/build/transformers/colorToRgbaFloat.d.ts +8 -0
  144. package/dist/build/transformers/colorToRgbaFloat.js +50 -0
  145. package/dist/build/transformers/dimensionToPixelUnitless.d.ts +8 -0
  146. package/dist/build/transformers/dimensionToPixelUnitless.js +50 -0
  147. package/dist/build/transformers/dimensionToRem.d.ts +8 -0
  148. package/dist/build/transformers/dimensionToRem.js +47 -0
  149. package/dist/build/transformers/dimensionToRemPxArray.d.ts +8 -0
  150. package/dist/build/transformers/dimensionToRemPxArray.js +47 -0
  151. package/dist/build/transformers/durationToCss.d.ts +8 -0
  152. package/dist/build/transformers/durationToCss.js +30 -0
  153. package/dist/build/transformers/figmaAttributes.d.ts +8 -0
  154. package/dist/build/transformers/figmaAttributes.js +57 -0
  155. package/dist/build/transformers/floatToPixel.d.ts +15 -0
  156. package/dist/build/transformers/floatToPixel.js +41 -0
  157. package/dist/build/transformers/fontFamilyToCss.d.ts +14 -0
  158. package/dist/build/transformers/fontFamilyToCss.js +40 -0
  159. package/dist/build/transformers/fontFamilyToFigma.d.ts +14 -0
  160. package/dist/build/transformers/fontFamilyToFigma.js +46 -0
  161. package/dist/build/transformers/fontWeightToNumber.d.ts +9 -0
  162. package/dist/build/transformers/fontWeightToNumber.js +53 -0
  163. package/dist/build/transformers/index.d.ts +25 -0
  164. package/dist/build/transformers/index.js +53 -0
  165. package/dist/build/transformers/jsonDeprecated.d.ts +8 -0
  166. package/dist/build/transformers/jsonDeprecated.js +16 -0
  167. package/{src/transformers/namePathToCamelCase.ts → dist/build/transformers/namePathToCamelCase.d.ts} +2 -8
  168. package/dist/build/transformers/namePathToCamelCase.js +14 -0
  169. package/dist/build/transformers/namePathToDotNotation.d.ts +8 -0
  170. package/dist/build/transformers/namePathToDotNotation.js +33 -0
  171. package/dist/build/transformers/namePathToFigma.d.ts +9 -0
  172. package/dist/build/transformers/namePathToFigma.js +24 -0
  173. package/dist/build/transformers/namePathToKebabCase.d.ts +8 -0
  174. package/dist/build/transformers/namePathToKebabCase.js +18 -0
  175. package/dist/build/transformers/namePathToPascalCase.d.ts +8 -0
  176. package/dist/build/transformers/namePathToPascalCase.js +14 -0
  177. package/dist/build/transformers/namePathToSlashNotation.d.ts +8 -0
  178. package/dist/build/transformers/namePathToSlashNotation.js +18 -0
  179. package/dist/build/transformers/shadowToCss.d.ts +8 -0
  180. package/dist/build/transformers/shadowToCss.js +35 -0
  181. package/dist/build/transformers/typographyToCss.d.ts +8 -0
  182. package/dist/build/transformers/typographyToCss.js +29 -0
  183. package/dist/build/transformers/utilities/alpha.d.ts +9 -0
  184. package/dist/build/transformers/utilities/alpha.js +20 -0
  185. package/dist/build/transformers/utilities/checkRequiredTokenProperties.d.ts +7 -0
  186. package/dist/build/transformers/utilities/checkRequiredTokenProperties.js +17 -0
  187. package/dist/build/transformers/utilities/getTokenValue.d.ts +2 -0
  188. package/dist/build/transformers/utilities/getTokenValue.js +18 -0
  189. package/dist/build/transformers/utilities/hasSpaceInString.d.ts +1 -0
  190. package/dist/build/transformers/utilities/hasSpaceInString.js +10 -0
  191. package/dist/build/transformers/utilities/hexToRgbaFloat.d.ts +2 -0
  192. package/dist/build/transformers/utilities/hexToRgbaFloat.js +33 -0
  193. package/dist/build/transformers/utilities/invalidTokenError.d.ts +7 -0
  194. package/dist/build/transformers/utilities/invalidTokenError.js +26 -0
  195. package/dist/build/transformers/utilities/isRgbaFloat.d.ts +7 -0
  196. package/dist/build/transformers/utilities/isRgbaFloat.js +24 -0
  197. package/dist/build/transformers/utilities/mix.d.ts +5 -0
  198. package/dist/build/transformers/utilities/mix.js +40 -0
  199. package/dist/build/transformers/utilities/rgbaFloatToHex.d.ts +6 -0
  200. package/dist/build/transformers/utilities/rgbaFloatToHex.js +15 -0
  201. package/dist/build/utilities/copyFromDir.d.ts +8 -0
  202. package/dist/build/utilities/copyFromDir.js +34 -0
  203. package/dist/build/utilities/filterStringArray.d.ts +1 -0
  204. package/dist/build/utilities/filterStringArray.js +17 -0
  205. package/{src/utilities/getFlag.ts → dist/build/utilities/getFlag.d.ts} +1 -5
  206. package/dist/build/utilities/getFlag.js +16 -0
  207. package/dist/build/utilities/index.d.ts +3 -0
  208. package/dist/build/utilities/index.js +9 -0
  209. package/dist/build/utilities/joinFriendly.d.ts +1 -0
  210. package/dist/build/utilities/joinFriendly.js +5 -0
  211. package/dist/build/utilities/schemaErrorMessage.d.ts +1 -0
  212. package/dist/build/utilities/schemaErrorMessage.js +5 -0
  213. package/dist/build/utilities/toCamelCase.d.ts +1 -0
  214. package/dist/build/utilities/toCamelCase.js +20 -0
  215. package/dist/build/utilities/toPascalCase.d.ts +1 -0
  216. package/dist/build/utilities/toPascalCase.js +17 -0
  217. package/dist/build/utilities/treeWalker.d.ts +8 -0
  218. package/dist/build/utilities/treeWalker.js +27 -0
  219. package/{src/utilities/upperCaseFirstCharacter.ts → dist/build/utilities/upperCaseFirstCharacter.d.ts} +1 -3
  220. package/dist/build/utilities/upperCaseFirstCharacter.js +14 -0
  221. package/dist/css/functional/motion/motion.css +3 -3
  222. package/dist/css/functional/size/border.css +2 -2
  223. package/dist/css/functional/typography/typography.css +11 -11
  224. package/dist/css/primitives.css +16 -16
  225. package/package.json +6 -8
  226. package/src/PrimerStyleDictionary.ts +0 -232
  227. package/src/filters/index.ts +0 -13
  228. package/src/filters/isColorWithAlpha.ts +0 -11
  229. package/src/filters/isColorWithMix.ts +0 -33
  230. package/src/filters/isFromFile.ts +0 -12
  231. package/src/formats/cssAdvanced.ts +0 -99
  232. package/src/formats/cssCustomMedia.ts +0 -24
  233. package/src/formats/index.ts +0 -9
  234. package/src/formats/javascriptCommonJs.ts +0 -21
  235. package/src/formats/javascriptEsm.ts +0 -21
  236. package/src/formats/jsonFigma.ts +0 -134
  237. package/src/formats/jsonNestedPrefixed.ts +0 -23
  238. package/src/formats/jsonOneDimensional.ts +0 -18
  239. package/src/formats/jsonPostCssFallback.ts +0 -16
  240. package/src/formats/typescriptExportDefinition.ts +0 -170
  241. package/src/formats/utilities/jsonToNestedValue.ts +0 -20
  242. package/src/formats/utilities/prefixTokens.ts +0 -17
  243. package/src/parsers/index.ts +0 -1
  244. package/src/parsers/w3cJsonParser.ts +0 -25
  245. package/src/platforms/css.ts +0 -101
  246. package/src/platforms/deprecatedJson.ts +0 -16
  247. package/src/platforms/docJson.ts +0 -34
  248. package/src/platforms/fallbacks.ts +0 -34
  249. package/src/platforms/figma.ts +0 -58
  250. package/src/platforms/index.ts +0 -10
  251. package/src/platforms/javascript.ts +0 -30
  252. package/src/platforms/json.ts +0 -32
  253. package/src/platforms/styleLint.ts +0 -34
  254. package/src/platforms/typeDefinitions.ts +0 -30
  255. package/src/platforms/typescript.ts +0 -30
  256. package/src/schemas/alphaValue.ts +0 -12
  257. package/src/schemas/baseToken.ts +0 -8
  258. package/src/schemas/borderToken.ts +0 -19
  259. package/src/schemas/collections.ts +0 -49
  260. package/src/schemas/colorHexValue.ts +0 -18
  261. package/src/schemas/colorToken.ts +0 -50
  262. package/src/schemas/designToken.ts +0 -38
  263. package/src/schemas/dimensionToken.ts +0 -34
  264. package/src/schemas/dimensionValue.ts +0 -16
  265. package/src/schemas/durationToken.ts +0 -12
  266. package/src/schemas/durationValue.ts +0 -9
  267. package/src/schemas/fontFamilyToken.ts +0 -21
  268. package/src/schemas/fontWeightToken.ts +0 -22
  269. package/src/schemas/fontWeightValue.ts +0 -14
  270. package/src/schemas/numberToken.ts +0 -28
  271. package/src/schemas/referenceValue.ts +0 -12
  272. package/src/schemas/scopes.ts +0 -40
  273. package/src/schemas/shadowToken.ts +0 -45
  274. package/src/schemas/stringToken.ts +0 -11
  275. package/src/schemas/tokenName.ts +0 -12
  276. package/src/schemas/tokenType.ts +0 -4
  277. package/src/schemas/typographyToken.ts +0 -20
  278. package/src/schemas/validTokenType.ts +0 -44
  279. package/src/schemas/viewportRangeToken.ts +0 -11
  280. package/src/test-utilities/getMockDictionary.ts +0 -22
  281. package/src/test-utilities/getMockFormatterArguments.ts +0 -21
  282. package/src/test-utilities/getMockParserInput.ts +0 -72
  283. package/src/test-utilities/getMockToken.ts +0 -25
  284. package/src/test-utilities/index.ts +0 -4
  285. package/src/transformers/borderToCss.ts +0 -38
  286. package/src/transformers/colorToHex.ts +0 -16
  287. package/src/transformers/colorToHexAlpha.ts +0 -23
  288. package/src/transformers/colorToHexMix.ts +0 -19
  289. package/src/transformers/colorToRgbAlpha.ts +0 -19
  290. package/src/transformers/colorToRgbaFloat.ts +0 -45
  291. package/src/transformers/dimensionToPixelUnitless.ts +0 -60
  292. package/src/transformers/dimensionToRem.ts +0 -56
  293. package/src/transformers/dimensionToRemPxArray.ts +0 -60
  294. package/src/transformers/durationToCss.ts +0 -29
  295. package/src/transformers/figmaAttributes.ts +0 -79
  296. package/src/transformers/floatToPixel.ts +0 -40
  297. package/src/transformers/fontFamilyToCss.ts +0 -37
  298. package/src/transformers/fontFamilyToFigma.ts +0 -47
  299. package/src/transformers/fontWeightToNumber.ts +0 -53
  300. package/src/transformers/index.ts +0 -24
  301. package/src/transformers/jsonDeprecated.ts +0 -15
  302. package/src/transformers/namePathToDotNotation.ts +0 -34
  303. package/src/transformers/namePathToFigma.ts +0 -28
  304. package/src/transformers/namePathToKebabCase.ts +0 -19
  305. package/src/transformers/namePathToSlashNotation.ts +0 -19
  306. package/src/transformers/shadowToCss.ts +0 -37
  307. package/src/transformers/typographyToCss.ts +0 -31
  308. package/src/transformers/utilities/alpha.ts +0 -23
  309. package/src/transformers/utilities/checkRequiredTokenProperties.ts +0 -16
  310. package/src/transformers/utilities/getTokenValue.ts +0 -18
  311. package/src/transformers/utilities/hasSpaceInString.ts +0 -6
  312. package/src/transformers/utilities/hexToRgbaFloat.ts +0 -31
  313. package/src/transformers/utilities/invalidTokenError.ts +0 -34
  314. package/src/transformers/utilities/isRgbaFloat.ts +0 -29
  315. package/src/transformers/utilities/mix.ts +0 -46
  316. package/src/transformers/utilities/rgbaFloatToHex.ts +0 -15
  317. package/src/types/Border.d.ts +0 -5
  318. package/src/types/BorderTokenValue.d.ts +0 -10
  319. package/src/types/ColorHex.d.ts +0 -4
  320. package/src/types/PlatformInitializer.d.ts +0 -11
  321. package/src/types/Shadow.d.ts +0 -5
  322. package/src/types/ShadowTokenValue.d.ts +0 -14
  323. package/src/types/SizeEm.d.ts +0 -4
  324. package/src/types/SizePx.d.ts +0 -4
  325. package/src/types/SizeRem.d.ts +0 -4
  326. package/src/types/StyleDictionaryConfigGenerator.d.ts +0 -15
  327. package/src/types/TokenBuildInput.d.ts +0 -8
  328. package/src/types/TypographyTokenValue.d.ts +0 -12
  329. package/src/types/w3cTransformedToken.d.ts +0 -8
  330. package/src/utilities/copyFromDir.ts +0 -21
  331. package/src/utilities/index.ts +0 -3
  332. package/src/utilities/joinFriendly.ts +0 -2
  333. package/src/utilities/schemaErrorMessage.ts +0 -2
  334. package/src/utilities/toCamelCase.ts +0 -29
  335. package/src/utilities/treeWalker.ts +0 -27
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scopes = void 0;
4
+ const zod_1 = require("zod");
5
+ const joinFriendly_1 = require("../utilities/joinFriendly");
6
+ const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
7
+ const validScopes = [
8
+ 'all',
9
+ 'bgColor',
10
+ 'fgColor',
11
+ 'borderColor',
12
+ 'borderWidth',
13
+ 'size',
14
+ 'gap',
15
+ 'radius',
16
+ 'effectColor',
17
+ 'effectFloat',
18
+ 'opacity',
19
+ 'fontFamily',
20
+ 'fontStyle',
21
+ 'fontWeight',
22
+ 'fontSize',
23
+ 'lineHeight',
24
+ 'letterSpacing',
25
+ 'paragraphSpacing',
26
+ 'paragraphIndent',
27
+ ];
28
+ const scopes = (scopeSubset) => {
29
+ const scopeArray = scopeSubset !== null && scopeSubset !== void 0 ? scopeSubset : validScopes;
30
+ return zod_1.z.array(zod_1.z.string()).refine(value => value.every(item => scopeArray.includes(item)), value => ({
31
+ message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid scope: "${value}"`, `Valid scopes are: ${(0, joinFriendly_1.joinFriendly)(scopeArray)}`),
32
+ }));
33
+ };
34
+ exports.scopes = scopes;
@@ -0,0 +1,157 @@
1
+ import { z } from 'zod';
2
+ export declare const shadowValue: z.ZodObject<{
3
+ color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
4
+ alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
5
+ offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
6
+ offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
7
+ blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
8
+ spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
9
+ inset: z.ZodOptional<z.ZodBoolean>;
10
+ }, "strict", z.ZodTypeAny, {
11
+ color: string;
12
+ blur: string | 0;
13
+ offsetX: string | 0;
14
+ offsetY: string | 0;
15
+ spread: string | 0;
16
+ alpha?: any;
17
+ inset?: boolean | undefined;
18
+ }, {
19
+ color: string;
20
+ blur: string | 0;
21
+ offsetX: string | 0;
22
+ offsetY: string | 0;
23
+ spread: string | 0;
24
+ alpha?: any;
25
+ inset?: boolean | undefined;
26
+ }>;
27
+ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
28
+ $description: z.ZodOptional<z.ZodString>;
29
+ deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
30
+ }, {
31
+ $value: z.ZodUnion<[z.ZodObject<{
32
+ color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
33
+ alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
34
+ offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
35
+ offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
36
+ blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
37
+ spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
38
+ inset: z.ZodOptional<z.ZodBoolean>;
39
+ }, "strict", z.ZodTypeAny, {
40
+ color: string;
41
+ blur: string | 0;
42
+ offsetX: string | 0;
43
+ offsetY: string | 0;
44
+ spread: string | 0;
45
+ alpha?: any;
46
+ inset?: boolean | undefined;
47
+ }, {
48
+ color: string;
49
+ blur: string | 0;
50
+ offsetX: string | 0;
51
+ offsetY: string | 0;
52
+ spread: string | 0;
53
+ alpha?: any;
54
+ inset?: boolean | undefined;
55
+ }>, z.ZodArray<z.ZodObject<{
56
+ color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
57
+ alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
58
+ offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
59
+ offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
60
+ blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
61
+ spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
62
+ inset: z.ZodOptional<z.ZodBoolean>;
63
+ }, "strict", z.ZodTypeAny, {
64
+ color: string;
65
+ blur: string | 0;
66
+ offsetX: string | 0;
67
+ offsetY: string | 0;
68
+ spread: string | 0;
69
+ alpha?: any;
70
+ inset?: boolean | undefined;
71
+ }, {
72
+ color: string;
73
+ blur: string | 0;
74
+ offsetX: string | 0;
75
+ offsetY: string | 0;
76
+ spread: string | 0;
77
+ alpha?: any;
78
+ inset?: boolean | undefined;
79
+ }>, "many">, z.ZodEffects<z.ZodString, string, string>]>;
80
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
81
+ $extensions: z.ZodOptional<z.ZodObject<{
82
+ 'org.primer.figma': z.ZodObject<{
83
+ collection: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
84
+ mode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ mode?: string | undefined;
87
+ collection?: string | undefined;
88
+ }, {
89
+ mode?: string | undefined;
90
+ collection?: string | undefined;
91
+ }>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ 'org.primer.figma': {
94
+ mode?: string | undefined;
95
+ collection?: string | undefined;
96
+ };
97
+ }, {
98
+ 'org.primer.figma': {
99
+ mode?: string | undefined;
100
+ collection?: string | undefined;
101
+ };
102
+ }>>;
103
+ }>, "strict", z.ZodTypeAny, {
104
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
105
+ $value: string | {
106
+ color: string;
107
+ blur: string | 0;
108
+ offsetX: string | 0;
109
+ offsetY: string | 0;
110
+ spread: string | 0;
111
+ alpha?: any;
112
+ inset?: boolean | undefined;
113
+ } | {
114
+ color: string;
115
+ blur: string | 0;
116
+ offsetX: string | 0;
117
+ offsetY: string | 0;
118
+ spread: string | 0;
119
+ alpha?: any;
120
+ inset?: boolean | undefined;
121
+ }[];
122
+ deprecated?: string | boolean | undefined;
123
+ $extensions?: {
124
+ 'org.primer.figma': {
125
+ mode?: string | undefined;
126
+ collection?: string | undefined;
127
+ };
128
+ } | undefined;
129
+ $description?: string | undefined;
130
+ }, {
131
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
132
+ $value: string | {
133
+ color: string;
134
+ blur: string | 0;
135
+ offsetX: string | 0;
136
+ offsetY: string | 0;
137
+ spread: string | 0;
138
+ alpha?: any;
139
+ inset?: boolean | undefined;
140
+ } | {
141
+ color: string;
142
+ blur: string | 0;
143
+ offsetX: string | 0;
144
+ offsetY: string | 0;
145
+ spread: string | 0;
146
+ alpha?: any;
147
+ inset?: boolean | undefined;
148
+ }[];
149
+ deprecated?: string | boolean | undefined;
150
+ $extensions?: {
151
+ 'org.primer.figma': {
152
+ mode?: string | undefined;
153
+ collection?: string | undefined;
154
+ };
155
+ } | undefined;
156
+ $description?: string | undefined;
157
+ }>;
@@ -0,0 +1,46 @@
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
13
+ .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(),
21
+ })
22
+ .strict();
23
+ exports.shadowToken = baseToken_1.baseToken
24
+ .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
28
+ .object({
29
+ 'org.primer.figma': zod_1.z.object({
30
+ collection: (0, collections_1.collection)(['mode']).optional(),
31
+ mode: (0, collections_1.mode)([
32
+ 'light',
33
+ 'dark',
34
+ 'dark dimmed',
35
+ 'light high contrast',
36
+ 'dark high contrast',
37
+ 'light colorblind',
38
+ 'dark colorblind',
39
+ 'light tritanopia',
40
+ 'dark tritanopia',
41
+ ]).optional(),
42
+ }),
43
+ })
44
+ .optional(),
45
+ })
46
+ .strict();
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const stringToken: z.ZodObject<z.objectUtil.extendShape<{
3
+ $description: z.ZodOptional<z.ZodString>;
4
+ deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
+ }, {
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">;
8
+ }>, "strict", z.ZodTypeAny, {
9
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
10
+ $value: string;
11
+ deprecated?: string | boolean | undefined;
12
+ $description?: string | undefined;
13
+ }, {
14
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
15
+ $value: string;
16
+ deprecated?: string | boolean | undefined;
17
+ $description?: string | undefined;
18
+ }>;
@@ -0,0 +1,13 @@
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
9
+ .extend({
10
+ $value: zod_1.z.union([zod_1.z.string(), referenceValue_1.referenceValue]),
11
+ $type: (0, tokenType_1.tokenType)('string'),
12
+ })
13
+ .strict();
@@ -0,0 +1,2 @@
1
+ import { z } from 'zod';
2
+ export declare const tokenName: z.ZodEffects<z.ZodString, string, string>;
@@ -0,0 +1,8 @@
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.'),
8
+ }));
@@ -0,0 +1,3 @@
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">;
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,59 @@
1
+ import { z } from 'zod';
2
+ export declare const typographyValue: z.ZodObject<{
3
+ fontSize: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
4
+ lineHeight: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>>;
5
+ fontWeight: z.ZodUnion<[z.ZodEffects<z.ZodNumber, number, number>, z.ZodEffects<z.ZodString, string, string>]>;
6
+ fontFamily: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ fontFamily: string;
9
+ fontSize: string | 0;
10
+ fontWeight: string | number;
11
+ lineHeight?: string | 0 | undefined;
12
+ }, {
13
+ fontFamily: string;
14
+ fontSize: string | 0;
15
+ fontWeight: string | number;
16
+ lineHeight?: string | 0 | undefined;
17
+ }>;
18
+ export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
19
+ $description: z.ZodOptional<z.ZodString>;
20
+ deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
21
+ }, {
22
+ $value: z.ZodUnion<[z.ZodObject<{
23
+ fontSize: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
24
+ lineHeight: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>>;
25
+ fontWeight: z.ZodUnion<[z.ZodEffects<z.ZodNumber, number, number>, z.ZodEffects<z.ZodString, string, string>]>;
26
+ fontFamily: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ fontFamily: string;
29
+ fontSize: string | 0;
30
+ fontWeight: string | number;
31
+ lineHeight?: string | 0 | undefined;
32
+ }, {
33
+ fontFamily: string;
34
+ fontSize: string | 0;
35
+ fontWeight: string | number;
36
+ lineHeight?: string | 0 | undefined;
37
+ }>, z.ZodEffects<z.ZodString, string, string>]>;
38
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
39
+ }>, "strict", z.ZodTypeAny, {
40
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
41
+ $value: string | {
42
+ fontFamily: string;
43
+ fontSize: string | 0;
44
+ fontWeight: string | number;
45
+ lineHeight?: string | 0 | undefined;
46
+ };
47
+ deprecated?: string | boolean | undefined;
48
+ $description?: string | undefined;
49
+ }, {
50
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
51
+ $value: string | {
52
+ fontFamily: string;
53
+ fontSize: string | 0;
54
+ fontWeight: string | number;
55
+ lineHeight?: string | 0 | undefined;
56
+ };
57
+ deprecated?: string | boolean | undefined;
58
+ $description?: string | undefined;
59
+ }>;
@@ -0,0 +1,21 @@
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]),
15
+ });
16
+ exports.typographyToken = baseToken_1.baseToken
17
+ .extend({
18
+ $value: zod_1.z.union([exports.typographyValue, referenceValue_1.referenceValue]),
19
+ $type: (0, tokenType_1.tokenType)('typography'),
20
+ })
21
+ .strict();
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ declare const validTypes: readonly ["color", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "number", "string", "custom-viewportRange"];
3
+ export type TokenType = (typeof validTypes)[number];
4
+ export declare const validateType: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodTypeAny>>;
5
+ export {};
@@ -0,0 +1,34 @@
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");
7
+ const validTypes = [
8
+ 'color',
9
+ 'typography',
10
+ 'dimension',
11
+ 'duration',
12
+ 'border',
13
+ 'shadow',
14
+ 'fontFamily',
15
+ 'fontWeight',
16
+ 'number',
17
+ 'string',
18
+ 'custom-viewportRange',
19
+ ];
20
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
21
+ // @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
25
+ .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')}`),
29
+ })),
30
+ })
31
+ .required(),
32
+ exports.validateType,
33
+ ]);
34
+ }));
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const viewportRangeToken: z.ZodObject<z.objectUtil.extendShape<{
3
+ $description: z.ZodOptional<z.ZodString>;
4
+ deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
+ }, {
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">;
8
+ }>, "strict", z.ZodTypeAny, {
9
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
10
+ $value: string;
11
+ deprecated?: string | boolean | undefined;
12
+ $description?: string | undefined;
13
+ }, {
14
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
15
+ $value: string;
16
+ deprecated?: string | boolean | undefined;
17
+ $description?: string | undefined;
18
+ }>;
@@ -0,0 +1,13 @@
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
9
+ .extend({
10
+ $value: zod_1.z.union([zod_1.z.string(), referenceValue_1.referenceValue]),
11
+ $type: (0, tokenType_1.tokenType)('custom-viewportRange'),
12
+ })
13
+ .strict();
@@ -0,0 +1,8 @@
1
+ import type StyleDictionary from 'style-dictionary';
2
+ /**
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)
5
+ * @matcher matches all tokens of $type `border`
6
+ * @transformer returns css border `string`
7
+ */
8
+ export declare const borderToCss: StyleDictionary.Transform;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.borderToCss = void 0;
4
+ const isBorder_1 = require("../filters/isBorder");
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) => {
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
+ exports.borderToCss = {
25
+ type: `value`,
26
+ transitive: true,
27
+ matcher: isBorder_1.isBorder,
28
+ transformer: ({ value }) => {
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,8 @@
1
+ import type StyleDictionary from 'style-dictionary';
2
+ /**
3
+ * @description converts color tokens value to `hex6` or `hex8`
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 `color`
6
+ * @transformer returns a `hex` string
7
+ */
8
+ export declare const colorToHex: StyleDictionary.Transform;
@@ -0,0 +1,18 @@
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
+ /**
8
+ * @description converts color tokens value to `hex6` or `hex8`
9
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
10
+ * @matcher matches all tokens of $type `color`
11
+ * @transformer returns a `hex` string
12
+ */
13
+ exports.colorToHex = {
14
+ type: `value`,
15
+ transitive: true,
16
+ matcher: filters_1.isColor,
17
+ transformer: (token) => (0, color2k_1.toHex)((0, getTokenValue_1.getTokenValue)(token)),
18
+ };
@@ -0,0 +1,8 @@
1
+ import type StyleDictionary from 'style-dictionary';
2
+ /**
3
+ * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
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 `color` with an `alpha` property
6
+ * @transformer returns `hex8` string
7
+ */
8
+ export declare const colorToHexAlpha: StyleDictionary.Transform;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.colorToHexAlpha = void 0;
4
+ const color2k_1 = require("color2k");
5
+ const alpha_1 = require("./utilities/alpha");
6
+ const filters_1 = require("../filters");
7
+ const getTokenValue_1 = require("./utilities/getTokenValue");
8
+ /**
9
+ * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
10
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
11
+ * @matcher matches all tokens of $type `color` with an `alpha` property
12
+ * @transformer returns `hex8` string
13
+ */
14
+ exports.colorToHexAlpha = {
15
+ type: `value`,
16
+ transitive: true,
17
+ matcher: filters_1.isColorWithAlpha,
18
+ transformer: (token) => {
19
+ // don't change if alpha is null
20
+ if (token.alpha === null) {
21
+ return (0, color2k_1.toHex)((0, getTokenValue_1.getTokenValue)(token));
22
+ }
23
+ return (0, color2k_1.toHex)((0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(token), token.alpha, token));
24
+ },
25
+ };
@@ -0,0 +1,8 @@
1
+ import type StyleDictionary from 'style-dictionary';
2
+ /**
3
+ * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
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 `color` with an `alpha` property
6
+ * @transformer returns `hex8` string
7
+ */
8
+ export declare const colorToHexMix: StyleDictionary.Transform;
@@ -0,0 +1,25 @@
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"));
11
+ /**
12
+ * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
13
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
14
+ * @matcher matches all tokens of $type `color` with an `alpha` property
15
+ * @transformer returns `hex8` string
16
+ */
17
+ exports.colorToHexMix = {
18
+ type: `value`,
19
+ transitive: true,
20
+ matcher: filters_1.isColorWithMix,
21
+ transformer: (token) => {
22
+ 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));
24
+ },
25
+ };
@@ -0,0 +1,8 @@
1
+ import type StyleDictionary from 'style-dictionary';
2
+ /**
3
+ * @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
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 `color` with an `alpha` property
6
+ * @transformer returns `rgba` string
7
+ */
8
+ export declare const colorToRgbAlpha: StyleDictionary.Transform;
@@ -0,0 +1,22 @@
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");
7
+ /**
8
+ * @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
9
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
10
+ * @matcher matches all tokens of $type `color` with an `alpha` property
11
+ * @transformer returns `rgba` string
12
+ */
13
+ exports.colorToRgbAlpha = {
14
+ type: `value`,
15
+ transitive: true,
16
+ matcher: filters_1.isColorWithAlpha,
17
+ transformer: (token) => {
18
+ 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);
21
+ },
22
+ };