@primer/primitives 7.17.0-rc.61b28bca → 7.17.0-rc.6fa44402

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 (308) hide show
  1. package/dist/css/functional/themes/dark-colorblind.css +14 -14
  2. package/dist/css/functional/themes/dark-tritanopia.css +14 -14
  3. package/dist/css/functional/themes/dark.css +14 -14
  4. package/dist/docs/functional/themes/dark-colorblind.json +7 -7
  5. package/dist/docs/functional/themes/dark-tritanopia.json +7 -7
  6. package/dist/docs/functional/themes/dark.json +7 -7
  7. package/dist/figma/scales/dark.json +5 -5
  8. package/dist/figma/themes/dark-colorblind.json +20 -20
  9. package/dist/figma/themes/dark-tritanopia.json +20 -20
  10. package/dist/figma/themes/dark.json +20 -20
  11. package/dist/internalCss/dark-colorblind.css +18 -18
  12. package/dist/internalCss/dark-tritanopia.css +18 -18
  13. package/dist/internalCss/dark.css +18 -18
  14. package/dist/styleLint/functional/themes/dark-colorblind.json +7 -7
  15. package/dist/styleLint/functional/themes/dark-tritanopia.json +7 -7
  16. package/dist/styleLint/functional/themes/dark.json +7 -7
  17. package/package.json +2 -3
  18. package/src/PrimerStyleDictionary.ts +6 -0
  19. package/src/formats/jsonFigma.ts +2 -0
  20. package/src/platforms/figma.ts +7 -1
  21. package/src/schemas/collections.ts +2 -0
  22. package/src/schemas/dimensionToken.ts +1 -1
  23. package/src/schemas/fontFamilyToken.ts +10 -0
  24. package/src/schemas/fontWeightToken.ts +10 -0
  25. package/src/tokens/base/color/dark/dark.json5 +2 -2
  26. package/src/transformers/fontFamilyToCss.ts +3 -4
  27. package/src/transformers/fontFamilyToFigma.ts +47 -0
  28. package/src/transformers/index.ts +1 -0
  29. package/src/transformers/utilities/hasSpaceInString.ts +6 -0
  30. package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
  31. package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
  32. package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
  33. package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
  34. package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
  35. package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
  36. package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
  37. package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
  38. package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
  39. package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
  40. package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
  41. package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
  42. package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
  43. package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
  44. package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
  45. package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
  46. package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
  47. package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
  48. package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
  49. package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
  50. package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
  51. package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
  52. package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
  53. package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
  54. package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
  55. package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
  56. package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
  57. package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
  58. package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
  59. package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
  60. package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
  61. package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
  62. package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
  63. package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
  64. package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
  65. package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
  66. package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
  67. package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
  68. package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
  69. package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
  70. package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
  71. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  72. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
  73. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  74. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
  75. package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
  76. package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
  77. package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
  78. package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
  79. package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
  80. package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
  81. package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
  82. package/tokens-v2-private/ts/tokens/functional/typography/typography.js +1 -1
  83. package/dist/deprecated/colors.json +0 -7
  84. package/dist/js/colors/dark.d.ts +0 -516
  85. package/dist/js/colors/dark.js +0 -616
  86. package/dist/js/colors/dark_colorblind.d.ts +0 -516
  87. package/dist/js/colors/dark_colorblind.js +0 -616
  88. package/dist/js/colors/dark_dimmed.d.ts +0 -516
  89. package/dist/js/colors/dark_dimmed.js +0 -616
  90. package/dist/js/colors/dark_high_contrast.d.ts +0 -516
  91. package/dist/js/colors/dark_high_contrast.js +0 -616
  92. package/dist/js/colors/dark_tritanopia.d.ts +0 -516
  93. package/dist/js/colors/dark_tritanopia.js +0 -616
  94. package/dist/js/colors/index.d.ts +0 -4638
  95. package/dist/js/colors/index.js +0 -15
  96. package/dist/js/colors/light.d.ts +0 -516
  97. package/dist/js/colors/light.js +0 -616
  98. package/dist/js/colors/light_colorblind.d.ts +0 -516
  99. package/dist/js/colors/light_colorblind.js +0 -616
  100. package/dist/js/colors/light_high_contrast.d.ts +0 -516
  101. package/dist/js/colors/light_high_contrast.js +0 -616
  102. package/dist/js/colors/light_tritanopia.d.ts +0 -516
  103. package/dist/js/colors/light_tritanopia.js +0 -616
  104. package/dist/js/index.d.ts +0 -4655
  105. package/dist/js/index.js +0 -9
  106. package/dist/js/spacing/index.d.ts +0 -6
  107. package/dist/js/spacing/index.js +0 -7
  108. package/dist/js/spacing/normal.d.ts +0 -4
  109. package/dist/js/spacing/normal.js +0 -13
  110. package/dist/js/typography/index.d.ts +0 -11
  111. package/dist/js/typography/index.js +0 -7
  112. package/dist/js/typography/normal.d.ts +0 -9
  113. package/dist/js/typography/normal.js +0 -19
  114. package/dist/json/colors/dark.json +0 -614
  115. package/dist/json/colors/dark_colorblind.json +0 -614
  116. package/dist/json/colors/dark_dimmed.json +0 -614
  117. package/dist/json/colors/dark_high_contrast.json +0 -614
  118. package/dist/json/colors/dark_tritanopia.json +0 -614
  119. package/dist/json/colors/light.json +0 -614
  120. package/dist/json/colors/light_colorblind.json +0 -614
  121. package/dist/json/colors/light_high_contrast.json +0 -614
  122. package/dist/json/colors/light_tritanopia.json +0 -614
  123. package/dist/json/spacing/normal.json +0 -11
  124. package/dist/json/typography/normal.json +0 -17
  125. package/dist/removed/colors.json +0 -432
  126. package/dist/scss/colors/_dark.scss +0 -452
  127. package/dist/scss/colors/_dark_colorblind.scss +0 -452
  128. package/dist/scss/colors/_dark_dimmed.scss +0 -452
  129. package/dist/scss/colors/_dark_high_contrast.scss +0 -452
  130. package/dist/scss/colors/_dark_tritanopia.scss +0 -452
  131. package/dist/scss/colors/_light.scss +0 -452
  132. package/dist/scss/colors/_light_colorblind.scss +0 -452
  133. package/dist/scss/colors/_light_high_contrast.scss +0 -452
  134. package/dist/scss/colors/_light_tritanopia.scss +0 -452
  135. package/dist/scss/spacing/_normal.scss +0 -11
  136. package/dist/scss/typography/_normal.scss +0 -15
  137. package/dist/ts/colors/dark.ts +0 -614
  138. package/dist/ts/colors/dark_colorblind.ts +0 -614
  139. package/dist/ts/colors/dark_dimmed.ts +0 -614
  140. package/dist/ts/colors/dark_high_contrast.ts +0 -614
  141. package/dist/ts/colors/dark_tritanopia.ts +0 -614
  142. package/dist/ts/colors/index.ts +0 -10
  143. package/dist/ts/colors/light.ts +0 -614
  144. package/dist/ts/colors/light_colorblind.ts +0 -614
  145. package/dist/ts/colors/light_high_contrast.ts +0 -614
  146. package/dist/ts/colors/light_tritanopia.ts +0 -614
  147. package/dist/ts/index.ts +0 -4
  148. package/dist/ts/spacing/index.ts +0 -2
  149. package/dist/ts/spacing/normal.ts +0 -11
  150. package/dist/ts/typography/index.ts +0 -2
  151. package/dist/ts/typography/normal.ts +0 -17
  152. package/src/filters/isBorder.test.ts +0 -18
  153. package/src/filters/isColor.test.ts +0 -22
  154. package/src/filters/isColorWithAlpha.test.ts +0 -34
  155. package/src/filters/isColorWithMix.test.ts +0 -108
  156. package/src/filters/isDeprecated.test.ts +0 -56
  157. package/src/filters/isDimension.test.ts +0 -22
  158. package/src/filters/isDuration.test.ts +0 -22
  159. package/src/filters/isFontFamily.test.ts +0 -22
  160. package/src/filters/isFontWeight.test.ts +0 -22
  161. package/src/filters/isFromFile.test.ts +0 -34
  162. package/src/filters/isShadow.test.ts +0 -18
  163. package/src/filters/isSource.test.ts +0 -44
  164. package/src/filters/isTypography.test.ts +0 -18
  165. package/src/formats/cssCustomMedia.test.ts +0 -11
  166. package/src/formats/cssThemed.test.ts +0 -87
  167. package/src/formats/cssWrapMediaQuery.test.ts +0 -170
  168. package/src/formats/javascriptCommonJs.test.ts +0 -43
  169. package/src/formats/javascriptEsm.test.ts +0 -41
  170. package/src/formats/jsonNestedPrefixed.test.ts +0 -73
  171. package/src/formats/jsonOneDimensional.test.ts +0 -56
  172. package/src/formats/typescriptExportDefinition.test.ts +0 -178
  173. package/src/formats/utilities/jsonToFlat.test.ts +0 -47
  174. package/src/formats/utilities/jsonToNestedValue.test.ts +0 -39
  175. package/src/formats/utilities/prefixTokens.test.ts +0 -38
  176. package/src/parsers/w3cJsonParser.test.ts +0 -35
  177. package/src/schemas/alphaValueSchema.test.ts +0 -24
  178. package/src/schemas/baseTokenSchema.test.ts +0 -17
  179. package/src/schemas/borderTokenSchema.test.ts +0 -53
  180. package/src/schemas/collectionSchema.test.ts +0 -58
  181. package/src/schemas/colorHexValueSchema.test.ts +0 -26
  182. package/src/schemas/colorTokenSchema.test.ts +0 -27
  183. package/src/schemas/dimensionTokenSchema.test.ts +0 -28
  184. package/src/schemas/dimensionValueSchema.test.ts +0 -21
  185. package/src/schemas/durationTokenSchema.test.ts +0 -58
  186. package/src/schemas/durationValueSchema.test.ts +0 -25
  187. package/src/schemas/fontFamilyTokenSchema.test.ts +0 -82
  188. package/src/schemas/fontWeightTokenSchema.test.ts +0 -88
  189. package/src/schemas/fontWeightValue.test.ts +0 -17
  190. package/src/schemas/numberTokenSchema.test.ts +0 -82
  191. package/src/schemas/referenceValueSchema.test.ts +0 -20
  192. package/src/schemas/schema.test.ts +0 -33
  193. package/src/schemas/scopeTokenSchema.test.ts +0 -29
  194. package/src/schemas/shadowTokenSchema.test.ts +0 -163
  195. package/src/schemas/stringTokenSchema.test.ts +0 -81
  196. package/src/schemas/tokenNameSchema.test.ts +0 -33
  197. package/src/schemas/typographyTokenSchema.test.ts +0 -58
  198. package/src/schemas/validTokenTypeSchema.test.ts +0 -32
  199. package/src/schemas/viewportRangeTokenSchema.test.ts +0 -59
  200. package/src/transformers/borderToCss.test.ts +0 -58
  201. package/src/transformers/colorToHex.test.ts +0 -27
  202. package/src/transformers/colorToHexAlpha.test.ts +0 -30
  203. package/src/transformers/colorToHexMix.test.ts +0 -83
  204. package/src/transformers/colorToRgbAlpha.test.ts +0 -33
  205. package/src/transformers/colorToRgbaFloat.test.ts +0 -168
  206. package/src/transformers/dimensionToPixelUnitless.test.ts +0 -93
  207. package/src/transformers/dimensionToRem.test.ts +0 -81
  208. package/src/transformers/durationToCss.test.ts +0 -56
  209. package/src/transformers/fontFamilyToCss.test.ts +0 -71
  210. package/src/transformers/fontWeightToNumbers.test.ts +0 -117
  211. package/src/transformers/jsonDeprecated.test.ts +0 -31
  212. package/src/transformers/namePathToCamelCase.test.ts +0 -74
  213. package/src/transformers/namePathToDotNotation.test.ts +0 -74
  214. package/src/transformers/namePathToFigma.test.ts +0 -74
  215. package/src/transformers/namePathToKebabCase.test.ts +0 -74
  216. package/src/transformers/namePathToSlashNotation.test.ts +0 -74
  217. package/src/transformers/shadowToCss.test.ts +0 -175
  218. package/src/transformers/typographyToCss.test.ts +0 -164
  219. package/src/transformers/utilities/alpha.test.ts +0 -28
  220. package/src/transformers/utilities/checkRequiredTokenProperties.test.ts +0 -28
  221. package/src/transformers/utilities/getTokenValue.test.ts +0 -18
  222. package/src/transformers/utilities/hexToRgbaFloat.test.ts +0 -66
  223. package/src/transformers/utilities/invalidTokenError.test.ts +0 -21
  224. package/src/transformers/utilities/isRgbaFloat.test.ts +0 -20
  225. package/src/transformers/utilities/rgbaFloatToHex.test.ts +0 -16
  226. package/src/utilities/getFlag.test.ts +0 -31
  227. package/src/utilities/joinFriendly.test.ts +0 -15
  228. package/src/utilities/toCamelCase.test.ts +0 -27
  229. package/src/utilities/treeWalker.test.ts +0 -51
  230. package/src/utilities/upperCaseFirstCharacter.test.ts +0 -19
  231. package/tokens-next-private/css/base/size/size.css +0 -19
  232. package/tokens-next-private/css/base/typography/typography.css +0 -6
  233. package/tokens-next-private/css/functional/motion/motion.css +0 -5
  234. package/tokens-next-private/css/functional/size/border.css +0 -14
  235. package/tokens-next-private/css/functional/size/breakpoints.css +0 -8
  236. package/tokens-next-private/css/functional/size/size-coarse.css +0 -7
  237. package/tokens-next-private/css/functional/size/size-fine.css +0 -7
  238. package/tokens-next-private/css/functional/size/size.css +0 -74
  239. package/tokens-next-private/css/functional/size/viewport.css +0 -6
  240. package/tokens-next-private/css/functional/themes/dark-colorblind.css +0 -1078
  241. package/tokens-next-private/css/functional/themes/dark-dimmed.css +0 -1078
  242. package/tokens-next-private/css/functional/themes/dark-high-contrast.css +0 -1078
  243. package/tokens-next-private/css/functional/themes/dark-tritanopia.css +0 -1078
  244. package/tokens-next-private/css/functional/themes/dark.css +0 -1078
  245. package/tokens-next-private/css/functional/themes/light-colorblind.css +0 -1078
  246. package/tokens-next-private/css/functional/themes/light-high-contrast.css +0 -1078
  247. package/tokens-next-private/css/functional/themes/light-tritanopia.css +0 -1078
  248. package/tokens-next-private/css/functional/themes/light.css +0 -1078
  249. package/tokens-next-private/css/functional/typography/typography.css +0 -47
  250. package/tokens-next-private/docs/base/size/size.json +0 -427
  251. package/tokens-next-private/docs/base/typography/typography.json +0 -54
  252. package/tokens-next-private/docs/functional/motion/motion.json +0 -47
  253. package/tokens-next-private/docs/functional/size/border.json +0 -234
  254. package/tokens-next-private/docs/functional/size/breakpoints.json +0 -152
  255. package/tokens-next-private/docs/functional/size/size-coarse.json +0 -41
  256. package/tokens-next-private/docs/functional/size/size-fine.json +0 -41
  257. package/tokens-next-private/docs/functional/size/size.json +0 -1838
  258. package/tokens-next-private/docs/functional/size/viewport.json +0 -80
  259. package/tokens-next-private/docs/functional/themes/dark-colorblind.json +0 -16155
  260. package/tokens-next-private/docs/functional/themes/dark-dimmed.json +0 -16159
  261. package/tokens-next-private/docs/functional/themes/dark-high-contrast.json +0 -16175
  262. package/tokens-next-private/docs/functional/themes/dark-tritanopia.json +0 -16161
  263. package/tokens-next-private/docs/functional/themes/dark.json +0 -16159
  264. package/tokens-next-private/docs/functional/themes/light-colorblind.json +0 -16123
  265. package/tokens-next-private/docs/functional/themes/light-high-contrast.json +0 -16125
  266. package/tokens-next-private/docs/functional/themes/light-tritanopia.json +0 -16115
  267. package/tokens-next-private/docs/functional/themes/light.json +0 -16113
  268. package/tokens-next-private/docs/functional/typography/typography.json +0 -663
  269. package/tokens-next-private/fallbacks/base/size/size.json +0 -19
  270. package/tokens-next-private/fallbacks/base/typography/typography.json +0 -6
  271. package/tokens-next-private/fallbacks/color-fallbacks.json +0 -260
  272. package/tokens-next-private/fallbacks/functional/motion/motion.json +0 -5
  273. package/tokens-next-private/fallbacks/functional/size/border.json +0 -14
  274. package/tokens-next-private/fallbacks/functional/size/breakpoints.json +0 -8
  275. package/tokens-next-private/fallbacks/functional/size/size-coarse.json +0 -5
  276. package/tokens-next-private/fallbacks/functional/size/size-fine.json +0 -5
  277. package/tokens-next-private/fallbacks/functional/size/size.json +0 -74
  278. package/tokens-next-private/fallbacks/functional/size/viewport.json +0 -8
  279. package/tokens-next-private/fallbacks/functional/typography/typography.json +0 -47
  280. package/tokens-next-private/internalCss/dark-colorblind.css +0 -1648
  281. package/tokens-next-private/internalCss/dark-dimmed.css +0 -1648
  282. package/tokens-next-private/internalCss/dark-high-contrast.css +0 -1648
  283. package/tokens-next-private/internalCss/dark-tritanopia.css +0 -1648
  284. package/tokens-next-private/internalCss/dark.css +0 -1648
  285. package/tokens-next-private/internalCss/light-colorblind.css +0 -1648
  286. package/tokens-next-private/internalCss/light-high-contrast.css +0 -1648
  287. package/tokens-next-private/internalCss/light-tritanopia.css +0 -1648
  288. package/tokens-next-private/internalCss/light.css +0 -1648
  289. package/tokens-next-private/removed/color.json +0 -421
  290. package/tokens-next-private/styleLint/base/size/size.json +0 -427
  291. package/tokens-next-private/styleLint/base/typography/typography.json +0 -54
  292. package/tokens-next-private/styleLint/functional/motion/motion.json +0 -47
  293. package/tokens-next-private/styleLint/functional/size/border.json +0 -234
  294. package/tokens-next-private/styleLint/functional/size/breakpoints.json +0 -152
  295. package/tokens-next-private/styleLint/functional/size/size-coarse.json +0 -41
  296. package/tokens-next-private/styleLint/functional/size/size-fine.json +0 -41
  297. package/tokens-next-private/styleLint/functional/size/size.json +0 -1838
  298. package/tokens-next-private/styleLint/functional/size/viewport.json +0 -80
  299. package/tokens-next-private/styleLint/functional/themes/dark-colorblind.json +0 -16155
  300. package/tokens-next-private/styleLint/functional/themes/dark-dimmed.json +0 -16159
  301. package/tokens-next-private/styleLint/functional/themes/dark-high-contrast.json +0 -16175
  302. package/tokens-next-private/styleLint/functional/themes/dark-tritanopia.json +0 -16161
  303. package/tokens-next-private/styleLint/functional/themes/dark.json +0 -16159
  304. package/tokens-next-private/styleLint/functional/themes/light-colorblind.json +0 -16123
  305. package/tokens-next-private/styleLint/functional/themes/light-high-contrast.json +0 -16125
  306. package/tokens-next-private/styleLint/functional/themes/light-tritanopia.json +0 -16115
  307. package/tokens-next-private/styleLint/functional/themes/light.json +0 -16113
  308. package/tokens-next-private/styleLint/functional/typography/typography.json +0 -663
@@ -8,11 +8,13 @@ type Collections =
8
8
  | 'base/color/dark'
9
9
  | 'base/color/dark-dimmed'
10
10
  | 'base/color/dark-high-contrast'
11
+ | 'base/typography'
11
12
  | 'mode'
12
13
  | 'pattern/mode'
13
14
  | 'base/size'
14
15
  | 'functional/size'
15
16
  | 'pattern/size'
17
+ | 'typography'
16
18
 
17
19
  export const collection = (collections: Collections[]) => {
18
20
  return z.string().refine(
@@ -13,7 +13,7 @@ export const dimensionToken = baseToken
13
13
  $extensions: z
14
14
  .object({
15
15
  'org.primer.figma': z.object({
16
- collection: collection(['base/size', 'functional/size', 'pattern/size']),
16
+ collection: collection(['base/size', 'functional/size', 'pattern/size', 'typography']),
17
17
  scopes: scopes(['all', 'size', 'gap', 'radius', 'borderColor']),
18
18
  }),
19
19
  })
@@ -2,10 +2,20 @@ import {z} from 'zod'
2
2
  import {referenceValue} from './referenceValue'
3
3
  import {baseToken} from './baseToken'
4
4
  import {tokenType} from './tokenType'
5
+ import {collection} from './collections'
6
+ import {scopes} from './scopes'
5
7
 
6
8
  export const fontFamilyToken = baseToken
7
9
  .extend({
8
10
  $value: z.union([z.string(), referenceValue]),
9
11
  $type: tokenType('fontFamily'),
12
+ $extensions: z
13
+ .object({
14
+ 'org.primer.figma': z.object({
15
+ collection: collection(['base/typography', 'typography']).optional(),
16
+ scopes: scopes(['all']).optional(),
17
+ }),
18
+ })
19
+ .optional(),
10
20
  })
11
21
  .strict()
@@ -3,10 +3,20 @@ import {fontWeightValue} from './fontWeightValue'
3
3
  import {referenceValue} from './referenceValue'
4
4
  import {baseToken} from './baseToken'
5
5
  import {tokenType} from './tokenType'
6
+ import {collection} from './collections'
7
+ import {scopes} from './scopes'
6
8
 
7
9
  export const fontWeightToken = baseToken
8
10
  .extend({
9
11
  $type: tokenType('fontWeight'),
10
12
  $value: z.union([fontWeightValue, referenceValue]),
13
+ $extensions: z
14
+ .object({
15
+ 'org.primer.figma': z.object({
16
+ collection: collection(['base/typography', 'typography']).optional(),
17
+ scopes: scopes(['all']).optional(),
18
+ }),
19
+ })
20
+ .optional(),
11
21
  })
12
22
  .strict()
@@ -614,7 +614,7 @@
614
614
  },
615
615
  },
616
616
  '3': {
617
- $value: '#bc8cff',
617
+ $value: '#BE8FFF',
618
618
  $type: 'color',
619
619
  $extensions: {
620
620
  'org.primer.figma': {
@@ -623,7 +623,7 @@
623
623
  },
624
624
  },
625
625
  '4': {
626
- $value: '#a371f7',
626
+ $value: '#AB7DF8',
627
627
  $type: 'color',
628
628
  $extensions: {
629
629
  'org.primer.figma': {
@@ -1,8 +1,7 @@
1
1
  import type StyleDictionary from 'style-dictionary'
2
2
  import {isFontFamily} from '../filters'
3
3
  import {getTokenValue} from './utilities/getTokenValue'
4
-
5
- const hasSpaceInName = (string: string) => /\s/g.test(string)
4
+ import {hasSpaceInString} from './utilities/hasSpaceInString'
6
5
  /**
7
6
  * takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
8
7
  * @param value
@@ -18,7 +17,7 @@ export const parseFontFamily = (value: unknown): string => {
18
17
  if (typeof string !== 'string') {
19
18
  throw new Error(`Invalid value in array ${string}, must be a string`)
20
19
  }
21
- return hasSpaceInName(string) ? `'${string}'` : string
20
+ return hasSpaceInString(string) ? `'${string}'` : string
22
21
  })
23
22
  .join(', ')
24
23
  }
@@ -28,7 +27,7 @@ export const parseFontFamily = (value: unknown): string => {
28
27
  * @description converts fontFamily tokens value to string
29
28
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
30
29
  * @matcher matches all tokens of $type `fontFamily`
31
- * @transformer returns a number
30
+ * @transformer returns a string
32
31
  */
33
32
  export const fontFamilyToCss: StyleDictionary.Transform = {
34
33
  type: `value`,
@@ -0,0 +1,47 @@
1
+ import type StyleDictionary from 'style-dictionary'
2
+ import {isFontFamily} from '../filters'
3
+ import {hasSpaceInString} from './utilities/hasSpaceInString'
4
+ /**
5
+ * takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
6
+ * @param value
7
+ * @returns string
8
+ */
9
+ export const parseFontFamily = (
10
+ token: StyleDictionary.TransformedToken,
11
+ fontFamilies: Record<string, string> = {},
12
+ ): string => {
13
+ // return value from fontFamilies
14
+ if (token.name in fontFamilies) {
15
+ return fontFamilies[token.name]
16
+ }
17
+ // return string
18
+ if (typeof token.value === 'string') {
19
+ return token.value
20
+ }
21
+ // return stringified array
22
+ if (Array.isArray(token.value)) {
23
+ return token.value
24
+ .map((string: string) => {
25
+ if (typeof string !== 'string') {
26
+ throw new Error(`Invalid value in array ${string}, must be a string`)
27
+ }
28
+ return hasSpaceInString(string) ? `'${string}'` : string
29
+ })
30
+ .join(', ')
31
+ }
32
+ // invalid value
33
+ throw new Error(`Invalid value ${token.value}, should be a string or array of strings`)
34
+ }
35
+ /**
36
+ * @description converts fontFamily tokens value to string
37
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
38
+ * @matcher matches all tokens of $type `fontFamily`
39
+ * @transformer returns a string
40
+ */
41
+ export const fontFamilyToFigma: StyleDictionary.Transform = {
42
+ type: `value`,
43
+ transitive: true,
44
+ matcher: isFontFamily,
45
+ transformer: (token: StyleDictionary.TransformedToken, platform: StyleDictionary.Platform): string =>
46
+ parseFontFamily(token, platform.options?.fontFamilies),
47
+ }
@@ -10,6 +10,7 @@ export {dimensionToPixelUnitless} from './dimensionToPixelUnitless'
10
10
  export {durationToCss} from './durationToCss'
11
11
  export {figmaAttributes} from './figmaAttributes'
12
12
  export {fontFamilyToCss} from './fontFamilyToCss'
13
+ export {fontFamilyToFigma} from './fontFamilyToFigma'
13
14
  export {fontWeightToNumber} from './fontWeightToNumber'
14
15
  export {jsonDeprecated} from './jsonDeprecated'
15
16
  export {namePathToCamelCase} from './namePathToCamelCase'
@@ -0,0 +1,6 @@
1
+ export const hasSpaceInString = (string: string): boolean => {
2
+ if (typeof string !== 'string') {
3
+ throw new TypeError(`Invalid input. Input must be a string, ${typeof string} provided`)
4
+ }
5
+ return /\s/g.test(string)
6
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const BaseSize4 = "0.25rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const BaseTextWeightLight = "300";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const PrimerBorderInsetThin = "inset 0 0 0 max(1px, 0.0625rem)";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const PrimerBreakpointXsmall = "20rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const PrimerControlMinTargetAuto = "2.75rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const PrimerControlMinTargetAuto = "1rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const PrimerControlMinTargetFine = "1rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const PrimerViewportRangeNarrow = "(max-width: calc(48rem - 0.02px))";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
  export const PrimerFontStackSystem = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $base-size-128: 8rem;
6
6
  $base-size-112: 7rem;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $base-text-weight-semibold: 600;
6
6
  $base-text-weight-medium: 500;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $primer-borderRadius-full: 100vh;
6
6
  $primer-borderRadius-large: 0.75rem;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $primer-breakpoint-xxlarge: 90rem;
6
6
  $primer-breakpoint-xlarge: 80rem;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $primer-controlStack-medium-gap-auto: $base-size-12;
6
6
  $primer-controlStack-small-gap-auto: $base-size-16;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $primer-controlStack-medium-gap-auto: $base-size-8;
6
6
  $primer-controlStack-small-gap-auto: $base-size-8;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $primer-controlStack-large-gap-spacious: $base-size-12;
6
6
  $primer-controlStack-large-gap-condensed: $base-size-8;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $primer-viewportRange-landscape: (orientation: landscape);
6
6
  $primer-viewportRange-portrait: (orientation: portrait);
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ // Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
 
5
5
  $primer-text-codeInline-size: 0.9285em;
6
6
  $primer-text-codeBlock-lineHeight: calc(20/13);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:38 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 15 Apr 2024 12:25:37 GMT
3
+ * Generated on Thu, 18 Apr 2024 11:52:56 GMT
4
4
  */
5
5
 
6
6