@primer/primitives 9.1.2 → 10.0.0-rc.367a0502

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 (219) hide show
  1. package/package.json +9 -8
  2. package/dist/build/PrimerStyleDictionary.d.ts +0 -9
  3. package/dist/build/PrimerStyleDictionary.js +0 -92
  4. package/dist/build/filters/index.d.ts +0 -13
  5. package/dist/build/filters/index.js +0 -29
  6. package/dist/build/filters/isBorder.d.ts +0 -7
  7. package/dist/build/filters/isBorder.js +0 -12
  8. package/dist/build/filters/isColor.d.ts +0 -7
  9. package/dist/build/filters/isColor.js +0 -12
  10. package/dist/build/filters/isColorWithAlpha.d.ts +0 -7
  11. package/dist/build/filters/isColorWithAlpha.js +0 -13
  12. package/dist/build/filters/isColorWithMix.d.ts +0 -7
  13. package/dist/build/filters/isColorWithMix.js +0 -28
  14. package/dist/build/filters/isDeprecated.d.ts +0 -7
  15. package/dist/build/filters/isDeprecated.js +0 -12
  16. package/dist/build/filters/isDimension.d.ts +0 -7
  17. package/dist/build/filters/isDimension.js +0 -12
  18. package/dist/build/filters/isDuration.d.ts +0 -7
  19. package/dist/build/filters/isDuration.js +0 -12
  20. package/dist/build/filters/isFontFamily.d.ts +0 -7
  21. package/dist/build/filters/isFontFamily.js +0 -12
  22. package/dist/build/filters/isFontWeight.d.ts +0 -7
  23. package/dist/build/filters/isFontWeight.js +0 -12
  24. package/dist/build/filters/isFromFile.d.ts +0 -8
  25. package/dist/build/filters/isFromFile.js +0 -14
  26. package/dist/build/filters/isNumber.d.ts +0 -7
  27. package/dist/build/filters/isNumber.js +0 -10
  28. package/dist/build/filters/isShadow.d.ts +0 -7
  29. package/dist/build/filters/isShadow.js +0 -12
  30. package/dist/build/filters/isSource.d.ts +0 -7
  31. package/dist/build/filters/isSource.js +0 -12
  32. package/dist/build/filters/isTypography.d.ts +0 -7
  33. package/dist/build/filters/isTypography.js +0 -12
  34. package/dist/build/formats/cssAdvanced.d.ts +0 -2
  35. package/dist/build/formats/cssAdvanced.js +0 -84
  36. package/dist/build/formats/cssCustomMedia.d.ts +0 -7
  37. package/dist/build/formats/cssCustomMedia.js +0 -25
  38. package/dist/build/formats/index.d.ts +0 -9
  39. package/dist/build/formats/index.js +0 -21
  40. package/dist/build/formats/javascriptCommonJs.d.ts +0 -7
  41. package/dist/build/formats/javascriptCommonJs.js +0 -25
  42. package/dist/build/formats/javascriptEsm.d.ts +0 -7
  43. package/dist/build/formats/javascriptEsm.js +0 -25
  44. package/dist/build/formats/jsonFigma.d.ts +0 -7
  45. package/dist/build/formats/jsonFigma.js +0 -116
  46. package/dist/build/formats/jsonNestedPrefixed.d.ts +0 -8
  47. package/dist/build/formats/jsonNestedPrefixed.js +0 -28
  48. package/dist/build/formats/jsonOneDimensional.d.ts +0 -8
  49. package/dist/build/formats/jsonOneDimensional.js +0 -24
  50. package/dist/build/formats/jsonPostCssFallback.d.ts +0 -8
  51. package/dist/build/formats/jsonPostCssFallback.js +0 -21
  52. package/dist/build/formats/typescriptExportDefinition.d.ts +0 -7
  53. package/dist/build/formats/typescriptExportDefinition.js +0 -166
  54. package/dist/build/formats/utilities/jsonToFlat.d.ts +0 -11
  55. package/dist/build/formats/utilities/jsonToFlat.js +0 -12
  56. package/dist/build/formats/utilities/jsonToNestedValue.d.ts +0 -8
  57. package/dist/build/formats/utilities/jsonToNestedValue.js +0 -25
  58. package/dist/build/formats/utilities/prefixTokens.d.ts +0 -8
  59. package/dist/build/formats/utilities/prefixTokens.js +0 -17
  60. package/dist/build/parsers/index.d.ts +0 -1
  61. package/dist/build/parsers/index.js +0 -5
  62. package/dist/build/parsers/w3cJsonParser.d.ts +0 -6
  63. package/dist/build/parsers/w3cJsonParser.js +0 -27
  64. package/dist/build/platforms/css.d.ts +0 -2
  65. package/dist/build/platforms/css.js +0 -87
  66. package/dist/build/platforms/deprecatedJson.d.ts +0 -2
  67. package/dist/build/platforms/deprecatedJson.js +0 -17
  68. package/dist/build/platforms/docJson.d.ts +0 -2
  69. package/dist/build/platforms/docJson.js +0 -34
  70. package/dist/build/platforms/fallbacks.d.ts +0 -2
  71. package/dist/build/platforms/fallbacks.js +0 -34
  72. package/dist/build/platforms/figma.d.ts +0 -2
  73. package/dist/build/platforms/figma.js +0 -53
  74. package/dist/build/platforms/index.d.ts +0 -10
  75. package/dist/build/platforms/index.js +0 -23
  76. package/dist/build/platforms/javascript.d.ts +0 -2
  77. package/dist/build/platforms/javascript.js +0 -30
  78. package/dist/build/platforms/json.d.ts +0 -2
  79. package/dist/build/platforms/json.js +0 -32
  80. package/dist/build/platforms/styleLint.d.ts +0 -2
  81. package/dist/build/platforms/styleLint.js +0 -34
  82. package/dist/build/platforms/typeDefinitions.d.ts +0 -2
  83. package/dist/build/platforms/typeDefinitions.js +0 -30
  84. package/dist/build/platforms/typescript.d.ts +0 -2
  85. package/dist/build/platforms/typescript.js +0 -30
  86. package/dist/build/schemas/alphaValue.d.ts +0 -2
  87. package/dist/build/schemas/alphaValue.js +0 -8
  88. package/dist/build/schemas/baseToken.d.ts +0 -11
  89. package/dist/build/schemas/baseToken.js +0 -10
  90. package/dist/build/schemas/borderToken.d.ts +0 -51
  91. package/dist/build/schemas/borderToken.js +0 -20
  92. package/dist/build/schemas/collections.d.ts +0 -6
  93. package/dist/build/schemas/collections.js +0 -18
  94. package/dist/build/schemas/colorHexValue.d.ts +0 -2
  95. package/dist/build/schemas/colorHexValue.js +0 -12
  96. package/dist/build/schemas/colorToken.d.ts +0 -80
  97. package/dist/build/schemas/colorToken.js +0 -52
  98. package/dist/build/schemas/designToken.d.ts +0 -2
  99. package/dist/build/schemas/designToken.js +0 -37
  100. package/dist/build/schemas/dimensionToken.d.ts +0 -52
  101. package/dist/build/schemas/dimensionToken.js +0 -36
  102. package/dist/build/schemas/dimensionValue.d.ts +0 -2
  103. package/dist/build/schemas/dimensionValue.js +0 -12
  104. package/dist/build/schemas/durationToken.d.ts +0 -18
  105. package/dist/build/schemas/durationToken.js +0 -14
  106. package/dist/build/schemas/durationValue.d.ts +0 -2
  107. package/dist/build/schemas/durationValue.js +0 -8
  108. package/dist/build/schemas/fontFamilyToken.d.ts +0 -52
  109. package/dist/build/schemas/fontFamilyToken.js +0 -23
  110. package/dist/build/schemas/fontWeightToken.d.ts +0 -52
  111. package/dist/build/schemas/fontWeightToken.js +0 -24
  112. package/dist/build/schemas/fontWeightValue.d.ts +0 -2
  113. package/dist/build/schemas/fontWeightValue.js +0 -9
  114. package/dist/build/schemas/numberToken.d.ts +0 -71
  115. package/dist/build/schemas/numberToken.js +0 -30
  116. package/dist/build/schemas/referenceValue.d.ts +0 -2
  117. package/dist/build/schemas/referenceValue.js +0 -8
  118. package/dist/build/schemas/scopes.d.ts +0 -5
  119. package/dist/build/schemas/scopes.js +0 -34
  120. package/dist/build/schemas/shadowToken.d.ts +0 -157
  121. package/dist/build/schemas/shadowToken.js +0 -46
  122. package/dist/build/schemas/stringToken.d.ts +0 -18
  123. package/dist/build/schemas/stringToken.js +0 -13
  124. package/dist/build/schemas/tokenName.d.ts +0 -2
  125. package/dist/build/schemas/tokenName.js +0 -8
  126. package/dist/build/schemas/tokenType.d.ts +0 -3
  127. package/dist/build/schemas/tokenType.js +0 -6
  128. package/dist/build/schemas/typographyToken.d.ts +0 -59
  129. package/dist/build/schemas/typographyToken.js +0 -21
  130. package/dist/build/schemas/validTokenType.d.ts +0 -5
  131. package/dist/build/schemas/validTokenType.js +0 -34
  132. package/dist/build/schemas/viewportRangeToken.d.ts +0 -18
  133. package/dist/build/schemas/viewportRangeToken.js +0 -13
  134. package/dist/build/transformers/borderToCss.d.ts +0 -8
  135. package/dist/build/transformers/borderToCss.js +0 -38
  136. package/dist/build/transformers/colorToHex.d.ts +0 -8
  137. package/dist/build/transformers/colorToHex.js +0 -26
  138. package/dist/build/transformers/colorToHexMix.d.ts +0 -8
  139. package/dist/build/transformers/colorToHexMix.js +0 -25
  140. package/dist/build/transformers/colorToRgbAlpha.d.ts +0 -8
  141. package/dist/build/transformers/colorToRgbAlpha.js +0 -22
  142. package/dist/build/transformers/colorToRgbaFloat.d.ts +0 -8
  143. package/dist/build/transformers/colorToRgbaFloat.js +0 -50
  144. package/dist/build/transformers/dimensionToPixelUnitless.d.ts +0 -8
  145. package/dist/build/transformers/dimensionToPixelUnitless.js +0 -50
  146. package/dist/build/transformers/dimensionToRem.d.ts +0 -8
  147. package/dist/build/transformers/dimensionToRem.js +0 -47
  148. package/dist/build/transformers/dimensionToRemPxArray.d.ts +0 -8
  149. package/dist/build/transformers/dimensionToRemPxArray.js +0 -47
  150. package/dist/build/transformers/durationToCss.d.ts +0 -8
  151. package/dist/build/transformers/durationToCss.js +0 -30
  152. package/dist/build/transformers/figmaAttributes.d.ts +0 -8
  153. package/dist/build/transformers/figmaAttributes.js +0 -57
  154. package/dist/build/transformers/floatToPixel.d.ts +0 -15
  155. package/dist/build/transformers/floatToPixel.js +0 -41
  156. package/dist/build/transformers/fontFamilyToCss.d.ts +0 -14
  157. package/dist/build/transformers/fontFamilyToCss.js +0 -40
  158. package/dist/build/transformers/fontFamilyToFigma.d.ts +0 -14
  159. package/dist/build/transformers/fontFamilyToFigma.js +0 -46
  160. package/dist/build/transformers/fontWeightToNumber.d.ts +0 -9
  161. package/dist/build/transformers/fontWeightToNumber.js +0 -53
  162. package/dist/build/transformers/index.d.ts +0 -24
  163. package/dist/build/transformers/index.js +0 -51
  164. package/dist/build/transformers/jsonDeprecated.d.ts +0 -8
  165. package/dist/build/transformers/jsonDeprecated.js +0 -16
  166. package/dist/build/transformers/namePathToCamelCase.d.ts +0 -8
  167. package/dist/build/transformers/namePathToCamelCase.js +0 -14
  168. package/dist/build/transformers/namePathToDotNotation.d.ts +0 -8
  169. package/dist/build/transformers/namePathToDotNotation.js +0 -33
  170. package/dist/build/transformers/namePathToFigma.d.ts +0 -9
  171. package/dist/build/transformers/namePathToFigma.js +0 -24
  172. package/dist/build/transformers/namePathToKebabCase.d.ts +0 -8
  173. package/dist/build/transformers/namePathToKebabCase.js +0 -18
  174. package/dist/build/transformers/namePathToPascalCase.d.ts +0 -8
  175. package/dist/build/transformers/namePathToPascalCase.js +0 -14
  176. package/dist/build/transformers/namePathToSlashNotation.d.ts +0 -8
  177. package/dist/build/transformers/namePathToSlashNotation.js +0 -18
  178. package/dist/build/transformers/shadowToCss.d.ts +0 -8
  179. package/dist/build/transformers/shadowToCss.js +0 -35
  180. package/dist/build/transformers/typographyToCss.d.ts +0 -8
  181. package/dist/build/transformers/typographyToCss.js +0 -29
  182. package/dist/build/transformers/utilities/alpha.d.ts +0 -9
  183. package/dist/build/transformers/utilities/alpha.js +0 -20
  184. package/dist/build/transformers/utilities/checkRequiredTokenProperties.d.ts +0 -7
  185. package/dist/build/transformers/utilities/checkRequiredTokenProperties.js +0 -17
  186. package/dist/build/transformers/utilities/getTokenValue.d.ts +0 -2
  187. package/dist/build/transformers/utilities/getTokenValue.js +0 -18
  188. package/dist/build/transformers/utilities/hasSpaceInString.d.ts +0 -1
  189. package/dist/build/transformers/utilities/hasSpaceInString.js +0 -10
  190. package/dist/build/transformers/utilities/hexToRgbaFloat.d.ts +0 -2
  191. package/dist/build/transformers/utilities/hexToRgbaFloat.js +0 -33
  192. package/dist/build/transformers/utilities/invalidTokenError.d.ts +0 -7
  193. package/dist/build/transformers/utilities/invalidTokenError.js +0 -26
  194. package/dist/build/transformers/utilities/isRgbaFloat.d.ts +0 -7
  195. package/dist/build/transformers/utilities/isRgbaFloat.js +0 -24
  196. package/dist/build/transformers/utilities/mix.d.ts +0 -5
  197. package/dist/build/transformers/utilities/mix.js +0 -40
  198. package/dist/build/transformers/utilities/rgbaFloatToHex.d.ts +0 -6
  199. package/dist/build/transformers/utilities/rgbaFloatToHex.js +0 -15
  200. package/dist/build/utilities/copyFromDir.d.ts +0 -8
  201. package/dist/build/utilities/copyFromDir.js +0 -34
  202. package/dist/build/utilities/filterStringArray.d.ts +0 -1
  203. package/dist/build/utilities/filterStringArray.js +0 -17
  204. package/dist/build/utilities/getFlag.d.ts +0 -8
  205. package/dist/build/utilities/getFlag.js +0 -16
  206. package/dist/build/utilities/index.d.ts +0 -3
  207. package/dist/build/utilities/index.js +0 -9
  208. package/dist/build/utilities/joinFriendly.d.ts +0 -1
  209. package/dist/build/utilities/joinFriendly.js +0 -5
  210. package/dist/build/utilities/schemaErrorMessage.d.ts +0 -1
  211. package/dist/build/utilities/schemaErrorMessage.js +0 -5
  212. package/dist/build/utilities/toCamelCase.d.ts +0 -1
  213. package/dist/build/utilities/toCamelCase.js +0 -20
  214. package/dist/build/utilities/toPascalCase.d.ts +0 -1
  215. package/dist/build/utilities/toPascalCase.js +0 -17
  216. package/dist/build/utilities/treeWalker.d.ts +0 -8
  217. package/dist/build/utilities/treeWalker.js +0 -27
  218. package/dist/build/utilities/upperCaseFirstCharacter.d.ts +0 -8
  219. package/dist/build/utilities/upperCaseFirstCharacter.js +0 -14
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scopes = void 0;
4
- const zod_1 = require("zod");
5
- const joinFriendly_1 = require("../utilities/joinFriendly");
6
- const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
7
- const validScopes = [
8
- 'all',
9
- 'bgColor',
10
- 'fgColor',
11
- 'borderColor',
12
- 'borderWidth',
13
- 'size',
14
- 'gap',
15
- 'radius',
16
- 'effectColor',
17
- 'effectFloat',
18
- 'opacity',
19
- 'fontFamily',
20
- 'fontStyle',
21
- 'fontWeight',
22
- 'fontSize',
23
- 'lineHeight',
24
- 'letterSpacing',
25
- 'paragraphSpacing',
26
- 'paragraphIndent',
27
- ];
28
- const scopes = (scopeSubset) => {
29
- const scopeArray = scopeSubset !== null && scopeSubset !== void 0 ? scopeSubset : validScopes;
30
- return zod_1.z.array(zod_1.z.string()).refine(value => value.every(item => scopeArray.includes(item)), value => ({
31
- message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid scope: "${value}"`, `Valid scopes are: ${(0, joinFriendly_1.joinFriendly)(scopeArray)}`),
32
- }));
33
- };
34
- exports.scopes = scopes;
@@ -1,157 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const shadowValue: z.ZodObject<{
3
- color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
4
- alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
5
- offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
6
- offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
7
- blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
8
- spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
9
- inset: z.ZodOptional<z.ZodBoolean>;
10
- }, "strict", z.ZodTypeAny, {
11
- color: string;
12
- blur: string | 0;
13
- offsetX: string | 0;
14
- offsetY: string | 0;
15
- spread: string | 0;
16
- alpha?: any;
17
- inset?: boolean | undefined;
18
- }, {
19
- color: string;
20
- blur: string | 0;
21
- offsetX: string | 0;
22
- offsetY: string | 0;
23
- spread: string | 0;
24
- alpha?: any;
25
- inset?: boolean | undefined;
26
- }>;
27
- export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
28
- $description: z.ZodOptional<z.ZodString>;
29
- deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
30
- }, {
31
- $value: z.ZodUnion<[z.ZodObject<{
32
- color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
33
- alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
34
- offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
35
- offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
36
- blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
37
- spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
38
- inset: z.ZodOptional<z.ZodBoolean>;
39
- }, "strict", z.ZodTypeAny, {
40
- color: string;
41
- blur: string | 0;
42
- offsetX: string | 0;
43
- offsetY: string | 0;
44
- spread: string | 0;
45
- alpha?: any;
46
- inset?: boolean | undefined;
47
- }, {
48
- color: string;
49
- blur: string | 0;
50
- offsetX: string | 0;
51
- offsetY: string | 0;
52
- spread: string | 0;
53
- alpha?: any;
54
- inset?: boolean | undefined;
55
- }>, z.ZodArray<z.ZodObject<{
56
- color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
57
- alpha: z.ZodUnion<[z.ZodEffects<z.ZodAny, any, any>, z.ZodEffects<z.ZodString, string, string>]>;
58
- offsetX: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
59
- offsetY: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
60
- blur: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
61
- spread: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
62
- inset: z.ZodOptional<z.ZodBoolean>;
63
- }, "strict", z.ZodTypeAny, {
64
- color: string;
65
- blur: string | 0;
66
- offsetX: string | 0;
67
- offsetY: string | 0;
68
- spread: string | 0;
69
- alpha?: any;
70
- inset?: boolean | undefined;
71
- }, {
72
- color: string;
73
- blur: string | 0;
74
- offsetX: string | 0;
75
- offsetY: string | 0;
76
- spread: string | 0;
77
- alpha?: any;
78
- inset?: boolean | undefined;
79
- }>, "many">, z.ZodEffects<z.ZodString, string, string>]>;
80
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
81
- $extensions: z.ZodOptional<z.ZodObject<{
82
- 'org.primer.figma': z.ZodObject<{
83
- collection: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
84
- mode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
85
- }, "strip", z.ZodTypeAny, {
86
- mode?: string | undefined;
87
- collection?: string | undefined;
88
- }, {
89
- mode?: string | undefined;
90
- collection?: string | undefined;
91
- }>;
92
- }, "strip", z.ZodTypeAny, {
93
- 'org.primer.figma': {
94
- mode?: string | undefined;
95
- collection?: string | undefined;
96
- };
97
- }, {
98
- 'org.primer.figma': {
99
- mode?: string | undefined;
100
- collection?: string | undefined;
101
- };
102
- }>>;
103
- }>, "strict", z.ZodTypeAny, {
104
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
105
- $value: string | {
106
- color: string;
107
- blur: string | 0;
108
- offsetX: string | 0;
109
- offsetY: string | 0;
110
- spread: string | 0;
111
- alpha?: any;
112
- inset?: boolean | undefined;
113
- } | {
114
- color: string;
115
- blur: string | 0;
116
- offsetX: string | 0;
117
- offsetY: string | 0;
118
- spread: string | 0;
119
- alpha?: any;
120
- inset?: boolean | undefined;
121
- }[];
122
- deprecated?: string | boolean | undefined;
123
- $extensions?: {
124
- 'org.primer.figma': {
125
- mode?: string | undefined;
126
- collection?: string | undefined;
127
- };
128
- } | undefined;
129
- $description?: string | undefined;
130
- }, {
131
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
132
- $value: string | {
133
- color: string;
134
- blur: string | 0;
135
- offsetX: string | 0;
136
- offsetY: string | 0;
137
- spread: string | 0;
138
- alpha?: any;
139
- inset?: boolean | undefined;
140
- } | {
141
- color: string;
142
- blur: string | 0;
143
- offsetX: string | 0;
144
- offsetY: string | 0;
145
- spread: string | 0;
146
- alpha?: any;
147
- inset?: boolean | undefined;
148
- }[];
149
- deprecated?: string | boolean | undefined;
150
- $extensions?: {
151
- 'org.primer.figma': {
152
- mode?: string | undefined;
153
- collection?: string | undefined;
154
- };
155
- } | undefined;
156
- $description?: string | undefined;
157
- }>;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shadowToken = exports.shadowValue = void 0;
4
- const zod_1 = require("zod");
5
- const baseToken_1 = require("./baseToken");
6
- const referenceValue_1 = require("./referenceValue");
7
- const colorHexValue_1 = require("./colorHexValue");
8
- const alphaValue_1 = require("./alphaValue");
9
- const dimensionValue_1 = require("./dimensionValue");
10
- const tokenType_1 = require("./tokenType");
11
- const collections_1 = require("./collections");
12
- exports.shadowValue = zod_1.z
13
- .object({
14
- color: zod_1.z.union([colorHexValue_1.colorHexValue, referenceValue_1.referenceValue]),
15
- alpha: zod_1.z.union([alphaValue_1.alphaValue, referenceValue_1.referenceValue]),
16
- offsetX: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
17
- offsetY: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
18
- blur: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
19
- spread: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
20
- inset: zod_1.z.boolean().optional(),
21
- })
22
- .strict();
23
- exports.shadowToken = baseToken_1.baseToken
24
- .extend({
25
- $value: zod_1.z.union([exports.shadowValue, zod_1.z.array(exports.shadowValue), referenceValue_1.referenceValue]),
26
- $type: (0, tokenType_1.tokenType)('shadow'),
27
- $extensions: zod_1.z
28
- .object({
29
- 'org.primer.figma': zod_1.z.object({
30
- collection: (0, collections_1.collection)(['mode']).optional(),
31
- mode: (0, collections_1.mode)([
32
- 'light',
33
- 'dark',
34
- 'dark dimmed',
35
- 'light high contrast',
36
- 'dark high contrast',
37
- 'light colorblind',
38
- 'dark colorblind',
39
- 'light tritanopia',
40
- 'dark tritanopia',
41
- ]).optional(),
42
- }),
43
- })
44
- .optional(),
45
- })
46
- .strict();
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const stringToken: z.ZodObject<z.objectUtil.extendShape<{
3
- $description: z.ZodOptional<z.ZodString>;
4
- deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
- }, {
6
- $value: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
8
- }>, "strict", z.ZodTypeAny, {
9
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
10
- $value: string;
11
- deprecated?: string | boolean | undefined;
12
- $description?: string | undefined;
13
- }, {
14
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
15
- $value: string;
16
- deprecated?: string | boolean | undefined;
17
- $description?: string | undefined;
18
- }>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringToken = void 0;
4
- const zod_1 = require("zod");
5
- const baseToken_1 = require("./baseToken");
6
- const referenceValue_1 = require("./referenceValue");
7
- const tokenType_1 = require("./tokenType");
8
- exports.stringToken = baseToken_1.baseToken
9
- .extend({
10
- $value: zod_1.z.union([zod_1.z.string(), referenceValue_1.referenceValue]),
11
- $type: (0, tokenType_1.tokenType)('string'),
12
- })
13
- .strict();
@@ -1,2 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const tokenName: z.ZodEffects<z.ZodString, string, string>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenName = void 0;
4
- const zod_1 = require("zod");
5
- const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
6
- exports.tokenName = zod_1.z.string().refine(name => /(^[a-z0-9][A-Za-z0-9-]*$|^@$)/.test(name), name => ({
7
- message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid token name: "${name}"`, 'Token name must be kebab-case or camelCase, and start with a lowercase letter or number and consist only of letters, numbers, and hyphens.'),
8
- }));
@@ -1,3 +0,0 @@
1
- import { z } from 'zod';
2
- import type { TokenType } from './validTokenType';
3
- export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenType = void 0;
4
- const zod_1 = require("zod");
5
- const tokenType = ($type) => zod_1.z.literal($type);
6
- exports.tokenType = tokenType;
@@ -1,59 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const typographyValue: z.ZodObject<{
3
- fontSize: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
4
- lineHeight: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>>;
5
- fontWeight: z.ZodUnion<[z.ZodEffects<z.ZodNumber, number, number>, z.ZodEffects<z.ZodString, string, string>]>;
6
- fontFamily: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
7
- }, "strip", z.ZodTypeAny, {
8
- fontFamily: string;
9
- fontSize: string | 0;
10
- fontWeight: string | number;
11
- lineHeight?: string | 0 | undefined;
12
- }, {
13
- fontFamily: string;
14
- fontSize: string | 0;
15
- fontWeight: string | number;
16
- lineHeight?: string | 0 | undefined;
17
- }>;
18
- export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
19
- $description: z.ZodOptional<z.ZodString>;
20
- deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
21
- }, {
22
- $value: z.ZodUnion<[z.ZodObject<{
23
- fontSize: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
24
- lineHeight: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>>;
25
- fontWeight: z.ZodUnion<[z.ZodEffects<z.ZodNumber, number, number>, z.ZodEffects<z.ZodString, string, string>]>;
26
- fontFamily: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
27
- }, "strip", z.ZodTypeAny, {
28
- fontFamily: string;
29
- fontSize: string | 0;
30
- fontWeight: string | number;
31
- lineHeight?: string | 0 | undefined;
32
- }, {
33
- fontFamily: string;
34
- fontSize: string | 0;
35
- fontWeight: string | number;
36
- lineHeight?: string | 0 | undefined;
37
- }>, z.ZodEffects<z.ZodString, string, string>]>;
38
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
39
- }>, "strict", z.ZodTypeAny, {
40
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
41
- $value: string | {
42
- fontFamily: string;
43
- fontSize: string | 0;
44
- fontWeight: string | number;
45
- lineHeight?: string | 0 | undefined;
46
- };
47
- deprecated?: string | boolean | undefined;
48
- $description?: string | undefined;
49
- }, {
50
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
51
- $value: string | {
52
- fontFamily: string;
53
- fontSize: string | 0;
54
- fontWeight: string | number;
55
- lineHeight?: string | 0 | undefined;
56
- };
57
- deprecated?: string | boolean | undefined;
58
- $description?: string | undefined;
59
- }>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typographyToken = exports.typographyValue = void 0;
4
- const zod_1 = require("zod");
5
- const referenceValue_1 = require("./referenceValue");
6
- const dimensionValue_1 = require("./dimensionValue");
7
- const baseToken_1 = require("./baseToken");
8
- const fontWeightValue_1 = require("./fontWeightValue");
9
- const tokenType_1 = require("./tokenType");
10
- exports.typographyValue = zod_1.z.object({
11
- fontSize: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]),
12
- lineHeight: zod_1.z.union([dimensionValue_1.dimensionValue, referenceValue_1.referenceValue]).optional(),
13
- fontWeight: zod_1.z.union([fontWeightValue_1.fontWeightValue, referenceValue_1.referenceValue]),
14
- fontFamily: zod_1.z.union([zod_1.z.string().min(1), referenceValue_1.referenceValue]),
15
- });
16
- exports.typographyToken = baseToken_1.baseToken
17
- .extend({
18
- $value: zod_1.z.union([exports.typographyValue, referenceValue_1.referenceValue]),
19
- $type: (0, tokenType_1.tokenType)('typography'),
20
- })
21
- .strict();
@@ -1,5 +0,0 @@
1
- import { z } from 'zod';
2
- declare const validTypes: readonly ["color", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "number", "string", "custom-viewportRange"];
3
- export type TokenType = (typeof validTypes)[number];
4
- export declare const validateType: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodTypeAny>>;
5
- export {};
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateType = void 0;
4
- const zod_1 = require("zod");
5
- const joinFriendly_1 = require("../utilities/joinFriendly");
6
- const schemaErrorMessage_1 = require("../utilities/schemaErrorMessage");
7
- const validTypes = [
8
- 'color',
9
- 'typography',
10
- 'dimension',
11
- 'duration',
12
- 'border',
13
- 'shadow',
14
- 'fontFamily',
15
- 'fontWeight',
16
- 'number',
17
- 'string',
18
- 'custom-viewportRange',
19
- ];
20
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
21
- // @ts-ignore: TODO: fix this
22
- exports.validateType = zod_1.z.record(zod_1.z.string(), zod_1.z.lazy(() => {
23
- return zod_1.z.union([
24
- zod_1.z
25
- .object({
26
- $value: zod_1.z.any(),
27
- $type: zod_1.z.string().refine(type => validTypes.includes(type), val => ({
28
- message: (0, schemaErrorMessage_1.schemaErrorMessage)(`Invalid token $type: "${val}"`, `Must be one of the following: ${(0, joinFriendly_1.joinFriendly)([...validTypes], 'or')}`),
29
- })),
30
- })
31
- .required(),
32
- exports.validateType,
33
- ]);
34
- }));
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const viewportRangeToken: z.ZodObject<z.objectUtil.extendShape<{
3
- $description: z.ZodOptional<z.ZodString>;
4
- deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
- }, {
6
- $value: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange">;
8
- }>, "strict", z.ZodTypeAny, {
9
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
10
- $value: string;
11
- deprecated?: string | boolean | undefined;
12
- $description?: string | undefined;
13
- }, {
14
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "shadow" | "typography" | "duration" | "custom-viewportRange";
15
- $value: string;
16
- deprecated?: string | boolean | undefined;
17
- $description?: string | undefined;
18
- }>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.viewportRangeToken = void 0;
4
- const zod_1 = require("zod");
5
- const baseToken_1 = require("./baseToken");
6
- const referenceValue_1 = require("./referenceValue");
7
- const tokenType_1 = require("./tokenType");
8
- exports.viewportRangeToken = baseToken_1.baseToken
9
- .extend({
10
- $value: zod_1.z.union([zod_1.z.string(), referenceValue_1.referenceValue]),
11
- $type: (0, tokenType_1.tokenType)('custom-viewportRange'),
12
- })
13
- .strict();
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts w3c border tokens in css border string
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher matches all tokens of $type `border`
6
- * @transformer returns css border `string`
7
- */
8
- export declare const borderToCss: StyleDictionary.Transform;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.borderToCss = void 0;
4
- const isBorder_1 = require("../filters/isBorder");
5
- /**
6
- * checks if all required properties exist on shadow token
7
- * @param object - BorderTokenValue
8
- * @returns void or throws error
9
- */
10
- const checkForBorderTokenProperties = (border) => {
11
- const requiredProperties = ['color', 'width', 'style'];
12
- for (const prop of requiredProperties) {
13
- if (prop in border === false) {
14
- throw new Error(`Missing propery: ${prop} on border token ${JSON.stringify(border)}`);
15
- }
16
- }
17
- };
18
- /**
19
- * @description converts w3c border tokens in css border string
20
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
21
- * @matcher matches all tokens of $type `border`
22
- * @transformer returns css border `string`
23
- */
24
- exports.borderToCss = {
25
- type: `value`,
26
- transitive: true,
27
- matcher: isBorder_1.isBorder,
28
- transformer: ({ value }) => {
29
- //
30
- checkForBorderTokenProperties(value);
31
- // if value === string it was probably already transformed
32
- if (typeof value === 'string') {
33
- return value;
34
- }
35
- /* color | style | width */
36
- return `${value.color} ${value.style} ${value.width}`;
37
- },
38
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts color tokens value to `hex6` or `hex8`
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher matches all tokens of $type `color`
6
- * @transformer returns a `hex` string
7
- */
8
- export declare const colorToHex: StyleDictionary.Transform;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.colorToHex = void 0;
4
- const color2k_1 = require("color2k");
5
- const filters_1 = require("../filters");
6
- const getTokenValue_1 = require("./utilities/getTokenValue");
7
- const alpha_1 = require("./utilities/alpha");
8
- /**
9
- * @description converts color tokens value to `hex6` or `hex8`
10
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
11
- * @matcher matches all tokens of $type `color`
12
- * @transformer returns a `hex` string
13
- */
14
- exports.colorToHex = {
15
- type: `value`,
16
- transitive: true,
17
- matcher: filters_1.isColor,
18
- transformer: (token) => {
19
- var _a, _b;
20
- const alphaValue = (_a = token.alpha) !== null && _a !== void 0 ? _a : (_b = token.$extensions) === null || _b === void 0 ? void 0 : _b.alpha;
21
- if (alphaValue === null || alphaValue === undefined) {
22
- return (0, color2k_1.toHex)((0, getTokenValue_1.getTokenValue)(token));
23
- }
24
- return (0, color2k_1.toHex)((0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(token), alphaValue, token));
25
- },
26
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher matches all tokens of $type `color` with an `alpha` property
6
- * @transformer returns `hex8` string
7
- */
8
- export declare const colorToHexMix: StyleDictionary.Transform;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.colorToHexMix = void 0;
7
- const color2k_1 = require("color2k");
8
- const filters_1 = require("../filters");
9
- const getTokenValue_1 = require("./utilities/getTokenValue");
10
- const mix_1 = __importDefault(require("./utilities/mix"));
11
- /**
12
- * @description replaces tokens value with `hex8` color using the tokens `alpha` property to specify the value used for alpha
13
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
14
- * @matcher matches all tokens of $type `color` with an `alpha` property
15
- * @transformer returns `hex8` string
16
- */
17
- exports.colorToHexMix = {
18
- type: `value`,
19
- transitive: true,
20
- matcher: filters_1.isColorWithMix,
21
- transformer: (token) => {
22
- var _a, _b;
23
- return (0, color2k_1.toHex)((0, mix_1.default)((0, getTokenValue_1.getTokenValue)(token), ((_a = token.mix) === null || _a === void 0 ? void 0 : _a.color) || (0, getTokenValue_1.getTokenValue)(token), ((_b = token.mix) === null || _b === void 0 ? void 0 : _b.weight) || 0));
24
- },
25
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher matches all tokens of $type `color` with an `alpha` property
6
- * @transformer returns `rgba` string
7
- */
8
- export declare const colorToRgbAlpha: StyleDictionary.Transform;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.colorToRgbAlpha = void 0;
4
- const filters_1 = require("../filters");
5
- const alpha_1 = require("./utilities/alpha");
6
- const getTokenValue_1 = require("./utilities/getTokenValue");
7
- /**
8
- * @description replaces tokens value with `rgba` color using the tokens `alpha` property to specify the value used for alpha
9
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
10
- * @matcher matches all tokens of $type `color` with an `alpha` property
11
- * @transformer returns `rgba` string
12
- */
13
- exports.colorToRgbAlpha = {
14
- type: `value`,
15
- transitive: true,
16
- matcher: filters_1.isColorWithAlpha,
17
- transformer: (token) => {
18
- if (token.alpha === null)
19
- return (0, getTokenValue_1.getTokenValue)(token);
20
- return (0, alpha_1.alpha)((0, getTokenValue_1.getTokenValue)(token), token.alpha, token);
21
- },
22
- };
@@ -1,8 +0,0 @@
1
- import type StyleDictionary from 'style-dictionary';
2
- /**
3
- * @description converts color tokens rgba float with values from 0 - 1
4
- * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
5
- * @matcher matches all tokens of $type `color`
6
- * @transformer returns a `rgb` float object
7
- */
8
- export declare const colorToRgbaFloat: StyleDictionary.Transform;