@primer/primitives 10.4.0-rc.fd8ac4c9 → 10.5.0-rc.1c002767

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 (123) hide show
  1. package/dist/build/filters/index.d.ts +1 -0
  2. package/dist/build/filters/index.js +1 -0
  3. package/dist/build/filters/isGradient.d.ts +7 -0
  4. package/dist/build/filters/isGradient.js +10 -0
  5. package/dist/build/platforms/css.js +1 -0
  6. package/dist/build/primerStyleDictionary.js +2 -1
  7. package/dist/build/schemas/borderToken.d.ts +3 -3
  8. package/dist/build/schemas/colorToken.d.ts +3 -3
  9. package/dist/build/schemas/cubicBezierToken.d.ts +3 -3
  10. package/dist/build/schemas/designToken.js +2 -0
  11. package/dist/build/schemas/dimensionToken.d.ts +3 -3
  12. package/dist/build/schemas/durationToken.d.ts +3 -3
  13. package/dist/build/schemas/fontFamilyToken.d.ts +3 -3
  14. package/dist/build/schemas/fontWeightToken.d.ts +3 -3
  15. package/dist/build/schemas/gradientToken.d.ts +60 -0
  16. package/dist/build/schemas/gradientToken.js +26 -0
  17. package/dist/build/schemas/numberToken.d.ts +3 -3
  18. package/dist/build/schemas/referenceValue.js +1 -1
  19. package/dist/build/schemas/shadowToken.d.ts +1995 -3
  20. package/dist/build/schemas/shadowToken.js +27 -0
  21. package/dist/build/schemas/stringToken.d.ts +3 -3
  22. package/dist/build/schemas/tokenType.d.ts +1 -1
  23. package/dist/build/schemas/typographyToken.d.ts +3 -3
  24. package/dist/build/schemas/validTokenType.d.ts +1 -1
  25. package/dist/build/schemas/validTokenType.js +1 -0
  26. package/dist/build/schemas/viewportRangeToken.d.ts +3 -3
  27. package/dist/build/transformers/gradientToCss.d.ts +8 -0
  28. package/dist/build/transformers/gradientToCss.js +23 -0
  29. package/dist/build/transformers/index.d.ts +1 -0
  30. package/dist/build/transformers/index.js +1 -0
  31. package/dist/css/functional/themes/dark-colorblind.css +138 -8
  32. package/dist/css/functional/themes/dark-dimmed.css +138 -8
  33. package/dist/css/functional/themes/dark-high-contrast.css +150 -20
  34. package/dist/css/functional/themes/dark-tritanopia.css +138 -8
  35. package/dist/css/functional/themes/dark.css +138 -8
  36. package/dist/css/functional/themes/light-colorblind.css +138 -8
  37. package/dist/css/functional/themes/light-high-contrast.css +150 -20
  38. package/dist/css/functional/themes/light-tritanopia.css +138 -8
  39. package/dist/css/functional/themes/light.css +138 -8
  40. package/dist/css/primitives.css +0 -6
  41. package/dist/docs/functional/themes/dark-colorblind.json +13601 -2768
  42. package/dist/docs/functional/themes/dark-dimmed.json +13889 -2760
  43. package/dist/docs/functional/themes/dark-high-contrast.json +15016 -2909
  44. package/dist/docs/functional/themes/dark-tritanopia.json +13546 -2741
  45. package/dist/docs/functional/themes/dark.json +12052 -1345
  46. package/dist/docs/functional/themes/light-colorblind.json +13567 -2764
  47. package/dist/docs/functional/themes/light-high-contrast.json +15056 -3021
  48. package/dist/docs/functional/themes/light-tritanopia.json +13555 -2780
  49. package/dist/docs/functional/themes/light.json +12092 -1359
  50. package/dist/figma/figma.json +1 -10
  51. package/dist/figma/themes/dark-colorblind.json +6380 -5472
  52. package/dist/figma/themes/dark-dimmed.json +6453 -5214
  53. package/dist/figma/themes/dark-high-contrast.json +6402 -4025
  54. package/dist/figma/themes/dark-tritanopia.json +6364 -5490
  55. package/dist/figma/themes/dark.json +5560 -4791
  56. package/dist/figma/themes/light-colorblind.json +6285 -5324
  57. package/dist/figma/themes/light-high-contrast.json +6362 -3994
  58. package/dist/figma/themes/light-tritanopia.json +6282 -5352
  59. package/dist/figma/themes/light.json +6281 -5396
  60. package/dist/internalCss/dark-colorblind.css +138 -8
  61. package/dist/internalCss/dark-dimmed.css +138 -8
  62. package/dist/internalCss/dark-high-contrast.css +150 -20
  63. package/dist/internalCss/dark-tritanopia.css +138 -8
  64. package/dist/internalCss/dark.css +138 -8
  65. package/dist/internalCss/light-colorblind.css +138 -8
  66. package/dist/internalCss/light-high-contrast.css +150 -20
  67. package/dist/internalCss/light-tritanopia.css +138 -8
  68. package/dist/internalCss/light.css +138 -8
  69. package/dist/styleLint/functional/themes/dark-colorblind.json +13581 -2748
  70. package/dist/styleLint/functional/themes/dark-dimmed.json +13905 -2776
  71. package/dist/styleLint/functional/themes/dark-high-contrast.json +15028 -2921
  72. package/dist/styleLint/functional/themes/dark-tritanopia.json +13587 -2782
  73. package/dist/styleLint/functional/themes/dark.json +12085 -1378
  74. package/dist/styleLint/functional/themes/light-colorblind.json +13535 -2732
  75. package/dist/styleLint/functional/themes/light-high-contrast.json +15071 -3036
  76. package/dist/styleLint/functional/themes/light-tritanopia.json +13524 -2749
  77. package/dist/styleLint/functional/themes/light.json +12097 -1364
  78. package/package.json +1 -1
  79. package/src/tokens/component/avatar.json5 +33 -0
  80. package/src/tokens/component/button.json5 +1714 -0
  81. package/src/tokens/component/contribution.json5 +0 -37
  82. package/src/tokens/component/header.json5 +3 -0
  83. package/src/tokens/component/label.json5 +1942 -0
  84. package/src/tokens/component/menu.json5 +24 -0
  85. package/src/tokens/component/overlay.json5 +1 -1
  86. package/src/tokens/component/selectMenu.json5 +38 -0
  87. package/src/tokens/component/sideNav.json5 +22 -0
  88. package/src/tokens/component/treeView.json5 +24 -0
  89. package/src/tokens/component/underlineNav.json5 +56 -0
  90. package/src/tokens/functional/color/borderColor.json5 +8 -8
  91. package/src/tokens/functional/color/control.json5 +1087 -0
  92. package/src/tokens/functional/color/data-vis.json5 +911 -41
  93. package/src/tokens/functional/color/display.json5 +2170 -0
  94. package/src/tokens/functional/color/selection.json5 +22 -0
  95. package/src/tokens/functional/shadow/shadow.json5 +478 -0
  96. package/dist/css/functional/motion/motion.css +0 -6
  97. package/dist/docs/functional/motion/motion.json +0 -66
  98. package/dist/fallbacks/functional/motion/motion.json +0 -6
  99. package/dist/figma/shadows/dark-colorblind.json +0 -1152
  100. package/dist/figma/shadows/dark-dimmed.json +0 -1152
  101. package/dist/figma/shadows/dark-high-contrast.json +0 -1152
  102. package/dist/figma/shadows/dark-tritanopia.json +0 -1152
  103. package/dist/figma/shadows/dark.json +0 -1152
  104. package/dist/figma/shadows/light-colorblind.json +0 -1052
  105. package/dist/figma/shadows/light-high-contrast.json +0 -1052
  106. package/dist/figma/shadows/light-tritanopia.json +0 -1052
  107. package/dist/figma/shadows/light.json +0 -1052
  108. package/dist/styleLint/functional/motion/motion.json +0 -66
  109. package/src/tokens/functional/color/dark/display-dark.json5 +0 -1258
  110. package/src/tokens/functional/color/dark/overrides/dark.dimmed.json5 +0 -199
  111. package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +0 -618
  112. package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +0 -65
  113. package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +0 -47
  114. package/src/tokens/functional/color/dark/patterns-dark.json5 +0 -2589
  115. package/src/tokens/functional/color/light/display-light.json5 +0 -1163
  116. package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +0 -581
  117. package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +0 -69
  118. package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +0 -41
  119. package/src/tokens/functional/color/light/patterns-light.json5 +0 -2583
  120. package/src/tokens/functional/motion/loading.json5 +0 -17
  121. package/src/tokens/functional/motion/patterns.json5 +0 -35
  122. package/src/tokens/functional/shadow/dark.json5 +0 -369
  123. package/src/tokens/functional/shadow/light.json5 +0 -363
@@ -7,6 +7,7 @@ export { isDuration } from './isDuration.js';
7
7
  export { isFromFile } from './isFromFile.js';
8
8
  export { isFontFamily } from './isFontFamily.js';
9
9
  export { isFontWeight } from './isFontWeight.js';
10
+ export { isGradient } from './isGradient.js';
10
11
  export { isNumber } from './isNumber.js';
11
12
  export { isShadow } from './isShadow.js';
12
13
  export { isSource } from './isSource.js';
@@ -7,6 +7,7 @@ export { isDuration } from './isDuration.js';
7
7
  export { isFromFile } from './isFromFile.js';
8
8
  export { isFontFamily } from './isFontFamily.js';
9
9
  export { isFontWeight } from './isFontWeight.js';
10
+ export { isGradient } from './isGradient.js';
10
11
  export { isNumber } from './isNumber.js';
11
12
  export { isShadow } from './isShadow.js';
12
13
  export { isSource } from './isSource.js';
@@ -0,0 +1,7 @@
1
+ import type { TransformedToken } from 'style-dictionary/types';
2
+ /**
3
+ * @description Checks if token is of $type `gradient`
4
+ * @param token [TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
5
+ * @returns boolean
6
+ */
7
+ export declare const isGradient: (token: TransformedToken) => boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @description Checks if token is of $type `gradient`
3
+ * @param token [TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
4
+ * @returns boolean
5
+ */
6
+ export const isGradient = (token) => {
7
+ var _a;
8
+ const typeValue = (_a = token.$type) !== null && _a !== void 0 ? _a : token.type;
9
+ return typeValue === 'gradient';
10
+ };
@@ -32,6 +32,7 @@ export const css = (outputFile, prefix, buildPath, options) => {
32
32
  'typography/css',
33
33
  'fontFamily/css',
34
34
  'fontWeight/number',
35
+ 'gradient/css',
35
36
  ],
36
37
  options: {
37
38
  basePxFontSize: 16,
@@ -1,5 +1,5 @@
1
1
  import StyleDictionary from 'style-dictionary';
2
- import { borderToCss, colorToRgbAlpha, colorToHex, colorToRgbaFloat, cubicBezierToCss, dimensionToRem, dimensionToPixelUnitless, durationToCss, figmaAttributes, fontFamilyToCss, fontFamilyToFigma, fontWeightToNumber, jsonDeprecated, namePathToDotNotation, namePathToCamelCase, namePathToPascalCase, namePathToKebabCase, namePathToSlashNotation, namePathToFigma, shadowToCss, typographyToCss, dimensionToRemPxArray, floatToPixel, floatToPixelUnitless, } from './transformers/index.js';
2
+ import { borderToCss, colorToRgbAlpha, colorToHex, colorToRgbaFloat, cubicBezierToCss, dimensionToRem, dimensionToPixelUnitless, durationToCss, figmaAttributes, fontFamilyToCss, fontFamilyToFigma, fontWeightToNumber, gradientToCss, jsonDeprecated, namePathToDotNotation, namePathToCamelCase, namePathToPascalCase, namePathToKebabCase, namePathToSlashNotation, namePathToFigma, shadowToCss, typographyToCss, dimensionToRemPxArray, floatToPixel, floatToPixelUnitless, } from './transformers/index.js';
3
3
  import { javascriptCommonJs, javascriptEsm, typescriptExportDefinition, jsonNestedPrefixed, cssCustomMedia, jsonOneDimensional, jsonPostCssFallback, cssAdvanced, jsonFigma, } from './formats/index.js';
4
4
  import { themeOverrides } from './preprocessors/themeOverrides.js';
5
5
  import { colorAlphaToCss } from './transformers/colorAlphaToCss.js';
@@ -85,4 +85,5 @@ PrimerStyleDictionary.registerTransform(typographyToCss);
85
85
  PrimerStyleDictionary.registerTransform(fontWeightToNumber);
86
86
  PrimerStyleDictionary.registerTransform(fontFamilyToCss);
87
87
  PrimerStyleDictionary.registerTransform(fontFamilyToFigma);
88
+ PrimerStyleDictionary.registerTransform(gradientToCss);
88
89
  PrimerStyleDictionary.registerPreprocessor(themeOverrides);
@@ -29,14 +29,14 @@ export declare const borderToken: z.ZodObject<z.objectUtil.extendShape<{
29
29
  color: string;
30
30
  style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
31
31
  }>, z.ZodEffects<z.ZodString, string, string>]>;
32
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
32
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
33
33
  }>, "strict", z.ZodTypeAny, {
34
34
  $value: string | {
35
35
  width: string | 0;
36
36
  color: string;
37
37
  style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
38
38
  };
39
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
39
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
40
40
  $description?: string | undefined;
41
41
  $deprecated?: string | boolean | undefined;
42
42
  }, {
@@ -45,7 +45,7 @@ export declare const borderToken: z.ZodObject<z.objectUtil.extendShape<{
45
45
  color: string;
46
46
  style: "inset" | "solid" | "dashed" | "dotted" | "double" | "groove" | "ridge" | "outset";
47
47
  };
48
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
48
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
49
49
  $description?: string | undefined;
50
50
  $deprecated?: string | boolean | undefined;
51
51
  }>;
@@ -6,7 +6,7 @@ export declare const colorToken: z.ZodObject<z.objectUtil.extendShape<z.objectUt
6
6
  $value: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
7
7
  alpha: z.ZodNullable<z.ZodOptional<z.ZodEffects<z.ZodAny, any, any>>>;
8
8
  }>, {
9
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
9
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
10
10
  $extensions: z.ZodOptional<z.ZodObject<{
11
11
  'org.primer.figma': z.ZodOptional<z.ZodObject<{
12
12
  collection: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -409,7 +409,7 @@ export declare const colorToken: z.ZodObject<z.objectUtil.extendShape<z.objectUt
409
409
  }>>;
410
410
  }>, "strict", z.ZodTypeAny, {
411
411
  $value: string;
412
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
412
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
413
413
  alpha?: any;
414
414
  $description?: string | undefined;
415
415
  $deprecated?: string | boolean | undefined;
@@ -479,7 +479,7 @@ export declare const colorToken: z.ZodObject<z.objectUtil.extendShape<z.objectUt
479
479
  } | undefined;
480
480
  }, {
481
481
  $value: string;
482
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
482
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
483
483
  alpha?: any;
484
484
  $description?: string | undefined;
485
485
  $deprecated?: string | boolean | undefined;
@@ -4,15 +4,15 @@ export declare const cubicBezierToken: z.ZodObject<z.objectUtil.extendShape<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
5
  }, {
6
6
  $value: z.ZodUnion<[z.ZodArray<z.ZodNumber, "many">, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
8
8
  }>, "strict", z.ZodTypeAny, {
9
9
  $value: string | number[];
10
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
10
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
11
11
  $description?: string | undefined;
12
12
  $deprecated?: string | boolean | undefined;
13
13
  }, {
14
14
  $value: string | number[];
15
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
15
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
16
16
  $description?: string | undefined;
17
17
  $deprecated?: string | boolean | undefined;
18
18
  }>;
@@ -12,6 +12,7 @@ import { fontFamilyToken } from './fontFamilyToken.js';
12
12
  import { shadowToken } from './shadowToken.js';
13
13
  import { durationToken } from './durationToken.js';
14
14
  import { cubicBezierToken } from './cubicBezierToken.js';
15
+ import { gradientToken } from './gradientToken.js';
15
16
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
16
17
  // @ts-ignore: TODO: fix this
17
18
  export const designToken = z.record(tokenName, z.lazy(() => {
@@ -24,6 +25,7 @@ export const designToken = z.record(tokenName, z.lazy(() => {
24
25
  borderToken,
25
26
  fontFamilyToken,
26
27
  fontWeightToken,
28
+ gradientToken,
27
29
  typographyToken,
28
30
  viewportRangeToken,
29
31
  numberToken,
@@ -4,7 +4,7 @@ export declare const dimensionToken: z.ZodObject<z.objectUtil.extendShape<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
5
  }, {
6
6
  $value: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
8
8
  $extensions: z.ZodOptional<z.ZodObject<{
9
9
  'org.primer.figma': z.ZodObject<{
10
10
  collection: z.ZodEffects<z.ZodString, string, string>;
@@ -34,7 +34,7 @@ export declare const dimensionToken: z.ZodObject<z.objectUtil.extendShape<{
34
34
  }>>;
35
35
  }>, "strict", z.ZodTypeAny, {
36
36
  $value: string | 0;
37
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
37
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
38
38
  $description?: string | undefined;
39
39
  $deprecated?: string | boolean | undefined;
40
40
  $extensions?: {
@@ -46,7 +46,7 @@ export declare const dimensionToken: z.ZodObject<z.objectUtil.extendShape<{
46
46
  } | undefined;
47
47
  }, {
48
48
  $value: string | 0;
49
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
49
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
50
50
  $description?: string | undefined;
51
51
  $deprecated?: string | boolean | undefined;
52
52
  $extensions?: {
@@ -4,15 +4,15 @@ export declare const durationToken: z.ZodObject<z.objectUtil.extendShape<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
5
  }, {
6
6
  $value: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
8
8
  }>, "strict", z.ZodTypeAny, {
9
9
  $value: string;
10
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
10
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
11
11
  $description?: string | undefined;
12
12
  $deprecated?: string | boolean | undefined;
13
13
  }, {
14
14
  $value: string;
15
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
15
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
16
16
  $description?: string | undefined;
17
17
  $deprecated?: string | boolean | undefined;
18
18
  }>;
@@ -4,7 +4,7 @@ export declare const fontFamilyToken: z.ZodObject<z.objectUtil.extendShape<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
5
  }, {
6
6
  $value: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
8
8
  $extensions: z.ZodOptional<z.ZodObject<{
9
9
  'org.primer.figma': z.ZodObject<{
10
10
  collection: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -29,7 +29,7 @@ export declare const fontFamilyToken: z.ZodObject<z.objectUtil.extendShape<{
29
29
  }>>;
30
30
  }>, "strict", z.ZodTypeAny, {
31
31
  $value: string;
32
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
32
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
33
33
  $description?: string | undefined;
34
34
  $deprecated?: string | boolean | undefined;
35
35
  $extensions?: {
@@ -40,7 +40,7 @@ export declare const fontFamilyToken: z.ZodObject<z.objectUtil.extendShape<{
40
40
  } | undefined;
41
41
  }, {
42
42
  $value: string;
43
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
43
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
44
44
  $description?: string | undefined;
45
45
  $deprecated?: string | boolean | undefined;
46
46
  $extensions?: {
@@ -3,7 +3,7 @@ export declare const fontWeightToken: z.ZodObject<z.objectUtil.extendShape<{
3
3
  $description: z.ZodOptional<z.ZodString>;
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
5
  }, {
6
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
6
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
7
  $value: z.ZodUnion<[z.ZodEffects<z.ZodNumber, number, number>, z.ZodEffects<z.ZodString, string, string>]>;
8
8
  $extensions: z.ZodOptional<z.ZodObject<{
9
9
  'org.primer.figma': z.ZodObject<{
@@ -29,7 +29,7 @@ export declare const fontWeightToken: z.ZodObject<z.objectUtil.extendShape<{
29
29
  }>>;
30
30
  }>, "strict", z.ZodTypeAny, {
31
31
  $value: string | number;
32
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
32
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
33
33
  $description?: string | undefined;
34
34
  $deprecated?: string | boolean | undefined;
35
35
  $extensions?: {
@@ -40,7 +40,7 @@ export declare const fontWeightToken: z.ZodObject<z.objectUtil.extendShape<{
40
40
  } | undefined;
41
41
  }, {
42
42
  $value: string | number;
43
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
43
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
44
44
  $description?: string | undefined;
45
45
  $deprecated?: string | boolean | undefined;
46
46
  $extensions?: {
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod';
2
+ export declare const gradientToken: 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.ZodArray<z.ZodObject<{
7
+ color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
8
+ position: z.ZodNumber;
9
+ }, "strip", z.ZodTypeAny, {
10
+ color: string;
11
+ position: number;
12
+ }, {
13
+ color: string;
14
+ position: number;
15
+ }>, "many">, z.ZodEffects<z.ZodString, string, string>]>;
16
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
17
+ $extensions: z.ZodOptional<z.ZodObject<{
18
+ 'org.primer.gradient': z.ZodObject<{
19
+ angle: z.ZodOptional<z.ZodNumber>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ angle?: number | undefined;
22
+ }, {
23
+ angle?: number | undefined;
24
+ }>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ 'org.primer.gradient': {
27
+ angle?: number | undefined;
28
+ };
29
+ }, {
30
+ 'org.primer.gradient': {
31
+ angle?: number | undefined;
32
+ };
33
+ }>>;
34
+ }>, "strict", z.ZodTypeAny, {
35
+ $value: string | {
36
+ color: string;
37
+ position: number;
38
+ }[];
39
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
40
+ $description?: string | undefined;
41
+ $deprecated?: string | boolean | undefined;
42
+ $extensions?: {
43
+ 'org.primer.gradient': {
44
+ angle?: number | undefined;
45
+ };
46
+ } | undefined;
47
+ }, {
48
+ $value: string | {
49
+ color: string;
50
+ position: number;
51
+ }[];
52
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
53
+ $description?: string | undefined;
54
+ $deprecated?: string | boolean | undefined;
55
+ $extensions?: {
56
+ 'org.primer.gradient': {
57
+ angle?: number | undefined;
58
+ };
59
+ } | undefined;
60
+ }>;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { baseToken } from './baseToken.js';
3
+ import { referenceValue } from './referenceValue.js';
4
+ import { tokenType } from './tokenType.js';
5
+ import { colorHexValue } from './colorHexValue.js';
6
+ export const gradientToken = baseToken
7
+ .extend({
8
+ $value: z.union([
9
+ z
10
+ .array(z.object({
11
+ color: z.union([colorHexValue, referenceValue]),
12
+ position: z.number().min(0).max(1),
13
+ }))
14
+ .min(2),
15
+ referenceValue,
16
+ ]),
17
+ $type: tokenType('gradient'),
18
+ $extensions: z
19
+ .object({
20
+ 'org.primer.gradient': z.object({
21
+ angle: z.number().int().min(0).max(360).optional(),
22
+ }),
23
+ })
24
+ .optional(),
25
+ })
26
+ .strict();
@@ -4,7 +4,7 @@ export declare const numberToken: z.ZodObject<z.objectUtil.extendShape<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
5
5
  }, {
6
6
  $value: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, string, string>]>;
7
- $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
+ $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
8
8
  $extensions: z.ZodOptional<z.ZodObject<{
9
9
  'org.primer.data': z.ZodOptional<z.ZodObject<{
10
10
  fontSize: z.ZodOptional<z.ZodNumber>;
@@ -42,7 +42,7 @@ export declare const numberToken: z.ZodObject<z.objectUtil.extendShape<{
42
42
  }>>;
43
43
  }>, "strict", z.ZodTypeAny, {
44
44
  $value: string | number;
45
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
45
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
46
46
  $description?: string | undefined;
47
47
  $deprecated?: string | boolean | undefined;
48
48
  $extensions?: {
@@ -56,7 +56,7 @@ export declare const numberToken: z.ZodObject<z.objectUtil.extendShape<{
56
56
  } | undefined;
57
57
  }, {
58
58
  $value: string | number;
59
- $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
59
+ $type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
60
60
  $description?: string | undefined;
61
61
  $deprecated?: string | boolean | undefined;
62
62
  $extensions?: {
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  import { schemaErrorMessage } from '../utilities/index.js';
3
- export const referenceValue = z.string().refine(ref => /^{\w+(\.\w+)*(\.\w+|\.@)}$/.test(ref), ref => ({
3
+ export const referenceValue = z.string().refine(ref => /^{[\w-]+(\.[\w-]+)*(\.[\w-]+|\.@)}$/.test(ref), ref => ({
4
4
  message: schemaErrorMessage(`Invalid reference: "${ref}"`, 'Reference must be a string in the format "{path.to.token}".'),
5
5
  }));