@primer/primitives 9.1.0-rc.a6a70c5b → 9.1.0-rc.e0e1c4b6

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 (377) hide show
  1. package/dist/build/PrimerStyleDictionary.d.ts +9 -0
  2. package/dist/build/PrimerStyleDictionary.js +92 -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 +85 -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 +24 -0
  164. package/dist/build/transformers/index.js +51 -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/{src/transformers/namePathToPascalCase.ts → dist/build/transformers/namePathToPascalCase.d.ts} +2 -7
  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/package.json +4 -8
  222. package/src/PrimerStyleDictionary.ts +0 -232
  223. package/src/filters/index.ts +0 -13
  224. package/src/filters/isColorWithAlpha.ts +0 -11
  225. package/src/filters/isColorWithMix.ts +0 -33
  226. package/src/filters/isFromFile.ts +0 -12
  227. package/src/formats/cssAdvanced.ts +0 -99
  228. package/src/formats/cssCustomMedia.ts +0 -24
  229. package/src/formats/index.ts +0 -9
  230. package/src/formats/javascriptCommonJs.ts +0 -21
  231. package/src/formats/javascriptEsm.ts +0 -21
  232. package/src/formats/jsonFigma.ts +0 -134
  233. package/src/formats/jsonNestedPrefixed.ts +0 -23
  234. package/src/formats/jsonOneDimensional.ts +0 -18
  235. package/src/formats/jsonPostCssFallback.ts +0 -16
  236. package/src/formats/typescriptExportDefinition.ts +0 -170
  237. package/src/formats/utilities/jsonToNestedValue.ts +0 -20
  238. package/src/formats/utilities/prefixTokens.ts +0 -17
  239. package/src/parsers/index.ts +0 -1
  240. package/src/parsers/w3cJsonParser.ts +0 -25
  241. package/src/platforms/css.ts +0 -101
  242. package/src/platforms/deprecatedJson.ts +0 -16
  243. package/src/platforms/docJson.ts +0 -34
  244. package/src/platforms/fallbacks.ts +0 -34
  245. package/src/platforms/figma.ts +0 -58
  246. package/src/platforms/index.ts +0 -10
  247. package/src/platforms/javascript.ts +0 -30
  248. package/src/platforms/json.ts +0 -32
  249. package/src/platforms/styleLint.ts +0 -34
  250. package/src/platforms/typeDefinitions.ts +0 -30
  251. package/src/platforms/typescript.ts +0 -30
  252. package/src/schemas/alphaValue.ts +0 -12
  253. package/src/schemas/baseToken.ts +0 -8
  254. package/src/schemas/borderToken.ts +0 -19
  255. package/src/schemas/collections.ts +0 -49
  256. package/src/schemas/colorHexValue.ts +0 -18
  257. package/src/schemas/colorToken.ts +0 -50
  258. package/src/schemas/designToken.ts +0 -38
  259. package/src/schemas/dimensionToken.ts +0 -34
  260. package/src/schemas/dimensionValue.ts +0 -16
  261. package/src/schemas/durationToken.ts +0 -12
  262. package/src/schemas/durationValue.ts +0 -9
  263. package/src/schemas/fontFamilyToken.ts +0 -21
  264. package/src/schemas/fontWeightToken.ts +0 -22
  265. package/src/schemas/fontWeightValue.ts +0 -14
  266. package/src/schemas/numberToken.ts +0 -28
  267. package/src/schemas/referenceValue.ts +0 -12
  268. package/src/schemas/scopes.ts +0 -40
  269. package/src/schemas/shadowToken.ts +0 -45
  270. package/src/schemas/stringToken.ts +0 -11
  271. package/src/schemas/tokenName.ts +0 -12
  272. package/src/schemas/tokenType.ts +0 -4
  273. package/src/schemas/typographyToken.ts +0 -20
  274. package/src/schemas/validTokenType.ts +0 -44
  275. package/src/schemas/viewportRangeToken.ts +0 -11
  276. package/src/test-utilities/getMockDictionary.ts +0 -22
  277. package/src/test-utilities/getMockFormatterArguments.ts +0 -21
  278. package/src/test-utilities/getMockParserInput.ts +0 -72
  279. package/src/test-utilities/getMockToken.ts +0 -25
  280. package/src/test-utilities/index.ts +0 -4
  281. package/src/tokens/base/color/dark/dark.dimmed.json5 +0 -1164
  282. package/src/tokens/base/color/dark/dark.high-contrast.json5 +0 -764
  283. package/src/tokens/base/color/dark/dark.json5 +0 -911
  284. package/src/tokens/base/color/dark/display-dark.json5 +0 -1774
  285. package/src/tokens/base/color/light/display-light.json5 +0 -1774
  286. package/src/tokens/base/color/light/light.high-contrast.json5 +0 -755
  287. package/src/tokens/base/color/light/light.json5 +0 -911
  288. package/src/tokens/base/size/size.json +0 -196
  289. package/src/tokens/base/typography/typography.json +0 -48
  290. package/src/tokens/fallback/color-fallbacks.json +0 -270
  291. package/src/tokens/functional/border/dark.json5 +0 -12
  292. package/src/tokens/functional/border/light.json5 +0 -12
  293. package/src/tokens/functional/color/dark/app-dark.json5 +0 -554
  294. package/src/tokens/functional/color/dark/data-vis-dark.json5 +0 -284
  295. package/src/tokens/functional/color/dark/display-dark.json5 +0 -1258
  296. package/src/tokens/functional/color/dark/overrides/dark.dimmed.json5 +0 -194
  297. package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +0 -935
  298. package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +0 -310
  299. package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +0 -224
  300. package/src/tokens/functional/color/dark/patterns-dark.json5 +0 -3097
  301. package/src/tokens/functional/color/dark/primitives-dark.json5 +0 -1200
  302. package/src/tokens/functional/color/dark/syntax-dark.json5 +0 -559
  303. package/src/tokens/functional/color/light/app-light.json5 +0 -551
  304. package/src/tokens/functional/color/light/data-vis-light.json5 +0 -284
  305. package/src/tokens/functional/color/light/display-light.json5 +0 -1258
  306. package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +0 -819
  307. package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +0 -327
  308. package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +0 -237
  309. package/src/tokens/functional/color/light/patterns-light.json5 +0 -3091
  310. package/src/tokens/functional/color/light/primitives-light.json5 +0 -1193
  311. package/src/tokens/functional/color/light/syntax-light.json5 +0 -559
  312. package/src/tokens/functional/motion/loading.json5 +0 -17
  313. package/src/tokens/functional/motion/patterns.json5 +0 -28
  314. package/src/tokens/functional/shadow/dark.json5 +0 -383
  315. package/src/tokens/functional/shadow/light.json5 +0 -376
  316. package/src/tokens/functional/size/border.json +0 -111
  317. package/src/tokens/functional/size/breakpoints.json +0 -64
  318. package/src/tokens/functional/size/size-coarse.json +0 -28
  319. package/src/tokens/functional/size/size-fine.json +0 -28
  320. package/src/tokens/functional/size/size.json +0 -740
  321. package/src/tokens/functional/size/viewport.json +0 -28
  322. package/src/tokens/functional/typography/typography.json +0 -527
  323. package/src/tokens/removed/color.json +0 -421
  324. package/src/tokens/removed/testing.json5 +0 -4
  325. package/src/transformers/borderToCss.ts +0 -38
  326. package/src/transformers/colorToHex.ts +0 -16
  327. package/src/transformers/colorToHexAlpha.ts +0 -23
  328. package/src/transformers/colorToHexMix.ts +0 -19
  329. package/src/transformers/colorToRgbAlpha.ts +0 -19
  330. package/src/transformers/colorToRgbaFloat.ts +0 -45
  331. package/src/transformers/dimensionToPixelUnitless.ts +0 -60
  332. package/src/transformers/dimensionToRem.ts +0 -56
  333. package/src/transformers/dimensionToRemPxArray.ts +0 -60
  334. package/src/transformers/durationToCss.ts +0 -29
  335. package/src/transformers/figmaAttributes.ts +0 -79
  336. package/src/transformers/floatToPixel.ts +0 -40
  337. package/src/transformers/fontFamilyToCss.ts +0 -37
  338. package/src/transformers/fontFamilyToFigma.ts +0 -47
  339. package/src/transformers/fontWeightToNumber.ts +0 -53
  340. package/src/transformers/index.ts +0 -24
  341. package/src/transformers/jsonDeprecated.ts +0 -15
  342. package/src/transformers/namePathToDotNotation.ts +0 -34
  343. package/src/transformers/namePathToFigma.ts +0 -28
  344. package/src/transformers/namePathToKebabCase.ts +0 -19
  345. package/src/transformers/namePathToSlashNotation.ts +0 -19
  346. package/src/transformers/shadowToCss.ts +0 -37
  347. package/src/transformers/typographyToCss.ts +0 -31
  348. package/src/transformers/utilities/alpha.ts +0 -23
  349. package/src/transformers/utilities/checkRequiredTokenProperties.ts +0 -16
  350. package/src/transformers/utilities/getTokenValue.ts +0 -18
  351. package/src/transformers/utilities/hasSpaceInString.ts +0 -6
  352. package/src/transformers/utilities/hexToRgbaFloat.ts +0 -31
  353. package/src/transformers/utilities/invalidTokenError.ts +0 -34
  354. package/src/transformers/utilities/isRgbaFloat.ts +0 -29
  355. package/src/transformers/utilities/mix.ts +0 -46
  356. package/src/transformers/utilities/rgbaFloatToHex.ts +0 -15
  357. package/src/types/Border.d.ts +0 -5
  358. package/src/types/BorderTokenValue.d.ts +0 -10
  359. package/src/types/ColorHex.d.ts +0 -4
  360. package/src/types/PlatformInitializer.d.ts +0 -11
  361. package/src/types/Shadow.d.ts +0 -5
  362. package/src/types/ShadowTokenValue.d.ts +0 -14
  363. package/src/types/SizeEm.d.ts +0 -4
  364. package/src/types/SizePx.d.ts +0 -4
  365. package/src/types/SizeRem.d.ts +0 -4
  366. package/src/types/StyleDictionaryConfigGenerator.d.ts +0 -15
  367. package/src/types/TokenBuildInput.d.ts +0 -8
  368. package/src/types/TypographyTokenValue.d.ts +0 -12
  369. package/src/types/w3cTransformedToken.d.ts +0 -8
  370. package/src/utilities/copyFromDir.ts +0 -21
  371. package/src/utilities/filterStringArray.ts +0 -14
  372. package/src/utilities/index.ts +0 -3
  373. package/src/utilities/joinFriendly.ts +0 -2
  374. package/src/utilities/schemaErrorMessage.ts +0 -2
  375. package/src/utilities/toCamelCase.ts +0 -20
  376. package/src/utilities/toPascalCase.ts +0 -17
  377. package/src/utilities/treeWalker.ts +0 -27
@@ -0,0 +1,9 @@
1
+ import StyleDictionary from 'style-dictionary';
2
+ /**
3
+ * @name {@link PrimerStyleDictionary}
4
+ * @description Returns style dictionary object with primer preset that includes parsers, formats and transformers
5
+ * @parsers [w3cJsonParser](https://github.com/primer/primitives/blob/main/config//parsers/w3c-json-parser.ts)
6
+ * @formats [javascript/esm](https://github.com/primer/primitives/blob/main/config/formats/javascript-esm.ts), [javascript/commonJs](https://github.com/primer/primitives/blob/main/config/formats/javascript-commonJs.ts), [typescript/export-definition](https://github.com/primer/primitives/blob/main/config/formats/typescript-export-defition.ts)
7
+ * @transformers [color/rgbAlpha](https://github.com/primer/primitives/blob/main/config/tranformers/color-to-rgb-alpha.ts), [color/hexAlpha](https://github.com/primer/primitives/blob/main/config/tranformers/color-to-hex-alpha.ts), [color/hex](https://github.com/primer/primitives/blob/main/config/tranformers/color-to-hex6.ts), [json/deprecated](https://github.com/primer/primitives/blob/main/config/tranformers/json-deprecated.ts), [name/pathToDotNotation](https://github.com/primer/primitives/blob/main/config/tranformers/name-path-to-dot-notation.ts)
8
+ */
9
+ export declare const PrimerStyleDictionary: StyleDictionary.Core;
@@ -0,0 +1,92 @@
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.PrimerStyleDictionary = void 0;
7
+ const style_dictionary_1 = __importDefault(require("style-dictionary"));
8
+ const parsers_1 = require("./parsers");
9
+ const transformers_1 = require("./transformers");
10
+ const formats_1 = require("./formats");
11
+ /**
12
+ * Parsers
13
+ *
14
+ */
15
+ style_dictionary_1.default.registerParser(parsers_1.w3cJsonParser);
16
+ /**
17
+ * Formats
18
+ *
19
+ */
20
+ style_dictionary_1.default.registerFormat({
21
+ name: 'css/advanced',
22
+ formatter: formats_1.cssAdvanced,
23
+ });
24
+ style_dictionary_1.default.registerFormat({
25
+ name: 'css/customMedia',
26
+ formatter: formats_1.cssCustomMedia,
27
+ });
28
+ style_dictionary_1.default.registerFormat({
29
+ name: 'javascript/esm',
30
+ formatter: formats_1.javascriptEsm,
31
+ });
32
+ style_dictionary_1.default.registerFormat({
33
+ name: 'javascript/commonJs',
34
+ formatter: formats_1.javascriptCommonJs,
35
+ });
36
+ style_dictionary_1.default.registerFormat({
37
+ name: 'typescript/export-definition',
38
+ formatter: formats_1.typescriptExportDefinition,
39
+ });
40
+ style_dictionary_1.default.registerFormat({
41
+ name: 'json/nested-prefixed',
42
+ formatter: formats_1.jsonNestedPrefixed,
43
+ });
44
+ style_dictionary_1.default.registerFormat({
45
+ name: 'json/one-dimensional',
46
+ formatter: formats_1.jsonOneDimensional,
47
+ });
48
+ style_dictionary_1.default.registerFormat({
49
+ name: 'json/postCss-fallback',
50
+ formatter: formats_1.jsonPostCssFallback,
51
+ });
52
+ style_dictionary_1.default.registerFormat({
53
+ name: 'json/figma',
54
+ formatter: formats_1.jsonFigma,
55
+ });
56
+ /**
57
+ * Transformers
58
+ *
59
+ */
60
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'color/rgbAlpha' }, transformers_1.colorToRgbAlpha));
61
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'color/rgbaFloat' }, transformers_1.colorToRgbaFloat));
62
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'color/hexAlpha' }, transformers_1.colorToHexAlpha));
63
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'color/hexMix' }, transformers_1.colorToHexMix));
64
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'color/hex' }, transformers_1.colorToHex));
65
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'float/pixel' }, transformers_1.floatToPixel));
66
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'float/pixelUnitless' }, transformers_1.floatToPixelUnitless));
67
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'dimension/rem' }, transformers_1.dimensionToRem));
68
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'dimension/remPxArray' }, transformers_1.dimensionToRemPxArray));
69
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'dimension/pixelUnitless' }, transformers_1.dimensionToPixelUnitless));
70
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'duration/css' }, transformers_1.durationToCss));
71
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'figma/attributes' }, transformers_1.figmaAttributes));
72
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'json/deprecated' }, transformers_1.jsonDeprecated));
73
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'name/pathToCamelCase' }, transformers_1.namePathToCamelCase));
74
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'name/pathToDotNotation' }, transformers_1.namePathToDotNotation));
75
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'name/pathToFigma' }, transformers_1.namePathToFigma));
76
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'name/pathToCamelCase' }, transformers_1.namePathToCamelCase));
77
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'name/pathToKebabCase' }, transformers_1.namePathToKebabCase));
78
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'name/pathToSlashNotation' }, transformers_1.namePathToSlashNotation));
79
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'shadow/css' }, transformers_1.shadowToCss));
80
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'border/css' }, transformers_1.borderToCss));
81
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'typography/css' }, transformers_1.typographyToCss));
82
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'fontWeight/number' }, transformers_1.fontWeightToNumber));
83
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'fontFamily/css' }, transformers_1.fontFamilyToCss));
84
+ style_dictionary_1.default.registerTransform(Object.assign({ name: 'fontFamily/figma' }, transformers_1.fontFamilyToFigma));
85
+ /**
86
+ * @name {@link PrimerStyleDictionary}
87
+ * @description Returns style dictionary object with primer preset that includes parsers, formats and transformers
88
+ * @parsers [w3cJsonParser](https://github.com/primer/primitives/blob/main/config//parsers/w3c-json-parser.ts)
89
+ * @formats [javascript/esm](https://github.com/primer/primitives/blob/main/config/formats/javascript-esm.ts), [javascript/commonJs](https://github.com/primer/primitives/blob/main/config/formats/javascript-commonJs.ts), [typescript/export-definition](https://github.com/primer/primitives/blob/main/config/formats/typescript-export-defition.ts)
90
+ * @transformers [color/rgbAlpha](https://github.com/primer/primitives/blob/main/config/tranformers/color-to-rgb-alpha.ts), [color/hexAlpha](https://github.com/primer/primitives/blob/main/config/tranformers/color-to-hex-alpha.ts), [color/hex](https://github.com/primer/primitives/blob/main/config/tranformers/color-to-hex6.ts), [json/deprecated](https://github.com/primer/primitives/blob/main/config/tranformers/json-deprecated.ts), [name/pathToDotNotation](https://github.com/primer/primitives/blob/main/config/tranformers/name-path-to-dot-notation.ts)
91
+ */
92
+ exports.PrimerStyleDictionary = style_dictionary_1.default;
@@ -0,0 +1,13 @@
1
+ export { isBorder } from './isBorder';
2
+ export { isColor } from './isColor';
3
+ export { isColorWithAlpha } from './isColorWithAlpha';
4
+ export { isColorWithMix } from './isColorWithMix';
5
+ export { isDimension } from './isDimension';
6
+ export { isDeprecated } from './isDeprecated';
7
+ export { isFromFile } from './isFromFile';
8
+ export { isFontFamily } from './isFontFamily';
9
+ export { isFontWeight } from './isFontWeight';
10
+ export { isNumber } from './isNumber';
11
+ export { isShadow } from './isShadow';
12
+ export { isSource } from './isSource';
13
+ export { isTypography } from './isTypography';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTypography = exports.isSource = exports.isShadow = exports.isNumber = exports.isFontWeight = exports.isFontFamily = exports.isFromFile = exports.isDeprecated = exports.isDimension = exports.isColorWithMix = exports.isColorWithAlpha = exports.isColor = exports.isBorder = void 0;
4
+ var isBorder_1 = require("./isBorder");
5
+ Object.defineProperty(exports, "isBorder", { enumerable: true, get: function () { return isBorder_1.isBorder; } });
6
+ var isColor_1 = require("./isColor");
7
+ Object.defineProperty(exports, "isColor", { enumerable: true, get: function () { return isColor_1.isColor; } });
8
+ var isColorWithAlpha_1 = require("./isColorWithAlpha");
9
+ Object.defineProperty(exports, "isColorWithAlpha", { enumerable: true, get: function () { return isColorWithAlpha_1.isColorWithAlpha; } });
10
+ var isColorWithMix_1 = require("./isColorWithMix");
11
+ Object.defineProperty(exports, "isColorWithMix", { enumerable: true, get: function () { return isColorWithMix_1.isColorWithMix; } });
12
+ var isDimension_1 = require("./isDimension");
13
+ Object.defineProperty(exports, "isDimension", { enumerable: true, get: function () { return isDimension_1.isDimension; } });
14
+ var isDeprecated_1 = require("./isDeprecated");
15
+ Object.defineProperty(exports, "isDeprecated", { enumerable: true, get: function () { return isDeprecated_1.isDeprecated; } });
16
+ var isFromFile_1 = require("./isFromFile");
17
+ Object.defineProperty(exports, "isFromFile", { enumerable: true, get: function () { return isFromFile_1.isFromFile; } });
18
+ var isFontFamily_1 = require("./isFontFamily");
19
+ Object.defineProperty(exports, "isFontFamily", { enumerable: true, get: function () { return isFontFamily_1.isFontFamily; } });
20
+ var isFontWeight_1 = require("./isFontWeight");
21
+ Object.defineProperty(exports, "isFontWeight", { enumerable: true, get: function () { return isFontWeight_1.isFontWeight; } });
22
+ var isNumber_1 = require("./isNumber");
23
+ Object.defineProperty(exports, "isNumber", { enumerable: true, get: function () { return isNumber_1.isNumber; } });
24
+ var isShadow_1 = require("./isShadow");
25
+ Object.defineProperty(exports, "isShadow", { enumerable: true, get: function () { return isShadow_1.isShadow; } });
26
+ var isSource_1 = require("./isSource");
27
+ Object.defineProperty(exports, "isSource", { enumerable: true, get: function () { return isSource_1.isSource; } });
28
+ var isTypography_1 = require("./isTypography");
29
+ Object.defineProperty(exports, "isTypography", { enumerable: true, get: function () { return isTypography_1.isTypography; } });
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is of $type `border`
5
4
  * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isBorder = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.$type === 'border'
10
- }
7
+ export declare const isBorder: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBorder = void 0;
4
+ /**
5
+ * @description Checks if token is of $type `border`
6
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isBorder = (token) => {
10
+ return token.$type === 'border';
11
+ };
12
+ exports.isBorder = isBorder;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is of $type `color`
5
4
  * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isColor = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.$type === 'color'
10
- }
7
+ export declare const isColor: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isColor = void 0;
4
+ /**
5
+ * @description Checks if token is of $type `color`
6
+ * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isColor = (token) => {
10
+ return token.$type === 'color';
11
+ };
12
+ exports.isColor = isColor;
@@ -0,0 +1,7 @@
1
+ import type StyleDictionary from 'style-dictionary';
2
+ /**
3
+ * @description Checks if token is color with an alpha value
4
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
5
+ * @returns boolean
6
+ */
7
+ export declare const isColorWithAlpha: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isColorWithAlpha = void 0;
4
+ const isColor_1 = require("./isColor");
5
+ /**
6
+ * @description Checks if token is color with an alpha value
7
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
8
+ * @returns boolean
9
+ */
10
+ const isColorWithAlpha = (token) => {
11
+ return (0, isColor_1.isColor)(token) && token.alpha !== undefined && typeof token.alpha === 'number';
12
+ };
13
+ exports.isColorWithAlpha = isColorWithAlpha;
@@ -0,0 +1,7 @@
1
+ import type StyleDictionary from 'style-dictionary';
2
+ /**
3
+ * @description Checks if token is color and has a mix property
4
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
5
+ * @returns boolean
6
+ */
7
+ export declare const isColorWithMix: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isColorWithMix = void 0;
4
+ const isColor_1 = require("./isColor");
5
+ const throwError = (token) => {
6
+ throw new Error(`Invalid mix property on token: ${token.name}. "mix.color": ${token.mix.color}, "mix.weight": ${typeof token.mix.weight === 'string' ? `"${token.mix.weight}" (string)` : token.mix.weight} must be a number between 0 and 1. In file: "${token.filePath}".`);
7
+ };
8
+ /**
9
+ * @description Checks if token is color and has a mix property
10
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
11
+ * @returns boolean
12
+ */
13
+ const isColorWithMix = (token) => {
14
+ // no color or no mix property
15
+ if (!(0, isColor_1.isColor)(token) || token.mix === undefined || token.mix === null) {
16
+ return false;
17
+ }
18
+ // invalid mix property
19
+ if (typeof token.mix.color !== 'string' ||
20
+ typeof token.mix.weight !== 'number' ||
21
+ token.mix.weight < 0 ||
22
+ token.mix.weight > 1) {
23
+ throwError(token);
24
+ }
25
+ // valid mix property
26
+ return true;
27
+ };
28
+ exports.isColorWithMix = isColorWithMix;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token has a valid `deprecated` property
5
4
  * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isDeprecated = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.deprecated === true || typeof token.deprecated === 'string'
10
- }
7
+ export declare const isDeprecated: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDeprecated = void 0;
4
+ /**
5
+ * @description Checks if token has a valid `deprecated` property
6
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isDeprecated = (token) => {
10
+ return token.deprecated === true || typeof token.deprecated === 'string';
11
+ };
12
+ exports.isDeprecated = isDeprecated;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is of $type `dimension`
5
4
  * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isDimension = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.$type === 'dimension'
10
- }
7
+ export declare const isDimension: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDimension = void 0;
4
+ /**
5
+ * @description Checks if token is of $type `dimension`
6
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isDimension = (token) => {
10
+ return token.$type === 'dimension';
11
+ };
12
+ exports.isDimension = isDimension;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is of $type `duration`
5
4
  * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isDuration = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.$type === 'duration'
10
- }
7
+ export declare const isDuration: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDuration = void 0;
4
+ /**
5
+ * @description Checks if token is of $type `duration`
6
+ * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isDuration = (token) => {
10
+ return token.$type === 'duration';
11
+ };
12
+ exports.isDuration = isDuration;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is of $type `isFontFamily`
5
4
  * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isFontFamily = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.$type === 'fontFamily'
10
- }
7
+ export declare const isFontFamily: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isFontFamily = void 0;
4
+ /**
5
+ * @description Checks if token is of $type `isFontFamily`
6
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isFontFamily = (token) => {
10
+ return token.$type === 'fontFamily';
11
+ };
12
+ exports.isFontFamily = isFontFamily;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is of $type `fontWeight`
5
4
  * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isFontWeight = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.$type === 'fontWeight'
10
- }
7
+ export declare const isFontWeight: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isFontWeight = void 0;
4
+ /**
5
+ * @description Checks if token is of $type `fontWeight`
6
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isFontWeight = (token) => {
10
+ return token.$type === 'fontWeight';
11
+ };
12
+ exports.isFontWeight = isFontWeight;
@@ -0,0 +1,8 @@
1
+ import type StyleDictionary from 'style-dictionary';
2
+ /**
3
+ * @description Checks if token comes from a specific file
4
+ * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
5
+ * @param files - array of file paths
6
+ * @returns boolean
7
+ */
8
+ export declare const isFromFile: (token: StyleDictionary.TransformedToken, files: string[]) => boolean;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isFromFile = void 0;
4
+ /**
5
+ * @description Checks if token comes from a specific file
6
+ * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @param files - array of file paths
8
+ * @returns boolean
9
+ */
10
+ const isFromFile = (token, files) => {
11
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
12
+ return (files === null || files === void 0 ? void 0 : files.includes(token.filePath)) === true;
13
+ };
14
+ exports.isFromFile = isFromFile;
@@ -1,8 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token type is a number
5
4
  * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isNumber = (token: StyleDictionary.TransformedToken): boolean => token.$type === 'number'
7
+ export declare const isNumber: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNumber = void 0;
4
+ /**
5
+ * @description Checks if token type is a number
6
+ * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isNumber = (token) => token.$type === 'number';
10
+ exports.isNumber = isNumber;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is of $type `shadow`
5
4
  * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isShadow = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.$type === 'shadow'
10
- }
7
+ export declare const isShadow: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isShadow = void 0;
4
+ /**
5
+ * @description Checks if token is of $type `shadow`
6
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isShadow = (token) => {
10
+ return token.$type === 'shadow';
11
+ };
12
+ exports.isShadow = isShadow;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is source token
5
4
  * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isSource = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.isSource === true
10
- }
7
+ export declare const isSource: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSource = void 0;
4
+ /**
5
+ * @description Checks if token is source token
6
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isSource = (token) => {
10
+ return token.isSource === true;
11
+ };
12
+ exports.isSource = isSource;
@@ -1,10 +1,7 @@
1
- import type StyleDictionary from 'style-dictionary'
2
-
1
+ import type StyleDictionary from 'style-dictionary';
3
2
  /**
4
3
  * @description Checks if token is of $type `typography`
5
4
  * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
5
  * @returns boolean
7
6
  */
8
- export const isTypography = (token: StyleDictionary.TransformedToken): boolean => {
9
- return token.$type === 'typography'
10
- }
7
+ export declare const isTypography: (token: StyleDictionary.TransformedToken) => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTypography = void 0;
4
+ /**
5
+ * @description Checks if token is of $type `typography`
6
+ * @param arguments [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
7
+ * @returns boolean
8
+ */
9
+ const isTypography = (token) => {
10
+ return token.$type === 'typography';
11
+ };
12
+ exports.isTypography = isTypography;
@@ -0,0 +1,2 @@
1
+ import StyleDictionary from 'style-dictionary';
2
+ export declare const cssAdvanced: StyleDictionary.Formatter;
@@ -0,0 +1,85 @@
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.cssAdvanced = void 0;
7
+ const style_dictionary_1 = __importDefault(require("style-dictionary"));
8
+ const sync_1 = __importDefault(require("@prettier/sync"));
9
+ const { fileHeader, formattedVariables } = style_dictionary_1.default.formatHelpers;
10
+ const wrapWithSelector = (css, selector) => {
11
+ // return without selector
12
+ if (selector === false || selector.trim().length === 0)
13
+ return css;
14
+ // return with selector
15
+ return `${selector} { ${css} }`;
16
+ };
17
+ const cssAdvanced = ({ dictionary: originalDictionary, options = {
18
+ queries: [],
19
+ }, file, platform, }) => {
20
+ var _a, _b, _c, _d;
21
+ // get options
22
+ const { outputReferences, descriptions } = options;
23
+ // selector
24
+ const selector = ((_a = file.options) === null || _a === void 0 ? void 0 : _a.selector) !== undefined ? file.options.selector : ':root';
25
+ // query extension property
26
+ const queryExtProp = ((_b = file.options) === null || _b === void 0 ? void 0 : _b.queryExtensionProperty) || 'mediaQuery';
27
+ // get queries from file options
28
+ const queries = ((_c = file.options) === null || _c === void 0 ? void 0 : _c.queries) || [
29
+ {
30
+ query: undefined,
31
+ matcher: () => true,
32
+ },
33
+ ];
34
+ // set formatting
35
+ const formatting = {
36
+ commentStyle: descriptions ? 'long' : 'none',
37
+ };
38
+ // clone dictionary
39
+ const dictionary = Object.assign({}, originalDictionary);
40
+ // add prefix to tokens
41
+ if (platform.prefix) {
42
+ dictionary.allTokens = dictionary.allTokens.map(token => (Object.assign(Object.assign({}, token), { name: `${platform.prefix}-${token.name}`, path: [platform.prefix, ...token.path] })));
43
+ }
44
+ // get queries from tokens
45
+ for (const designToken of dictionary.allTokens) {
46
+ const query = (_d = designToken.$extensions) === null || _d === void 0 ? void 0 : _d[queryExtProp];
47
+ // early abort if query does not exist on token
48
+ if (!query)
49
+ continue;
50
+ // if query exists already from other token
51
+ const currentQueryIndex = queries.findIndex((q) => q.query === query);
52
+ // if query exists
53
+ if (currentQueryIndex > -1) {
54
+ queries[currentQueryIndex] = Object.assign(Object.assign({}, queries[currentQueryIndex]), { matcher: (token) => queries[currentQueryIndex].matcher(token) ||
55
+ token.$extensions[queryExtProp] === queries[currentQueryIndex].query });
56
+ }
57
+ // if query does not exist
58
+ else {
59
+ queries.push({
60
+ query,
61
+ matcher: (token) => { var _a; return ((_a = token.$extensions) === null || _a === void 0 ? void 0 : _a[queryExtProp]) === query; },
62
+ });
63
+ }
64
+ }
65
+ // add file header
66
+ const output = [fileHeader({ file })];
67
+ // add single theme css
68
+ for (const query of queries) {
69
+ const { query: queryString, matcher } = query;
70
+ // filter tokens to only include the ones that pass the matcher
71
+ const filteredDictionary = Object.assign(Object.assign({}, dictionary), { allTokens: dictionary.allTokens.filter(matcher || (() => true)) });
72
+ // early abort if no matches
73
+ if (!filteredDictionary.allTokens.length)
74
+ continue;
75
+ // add tokens into root
76
+ const css = formattedVariables({ format: 'css', dictionary: filteredDictionary, outputReferences, formatting });
77
+ // wrap css
78
+ const cssWithSelector = wrapWithSelector(css, query.selector !== undefined ? query.selector : selector);
79
+ // add css with or without query
80
+ output.push(queryString ? `${queryString} { ${cssWithSelector} }` : cssWithSelector);
81
+ }
82
+ // return prettified
83
+ return sync_1.default.format(output.join('\n'), { parser: 'css', printWidth: 500 });
84
+ };
85
+ exports.cssAdvanced = cssAdvanced;