@primer/primitives 10.4.0 → 10.5.0-rc.2284dc61
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.
- package/dist/build/filters/index.d.ts +1 -0
- package/dist/build/filters/index.js +1 -0
- package/dist/build/filters/isGradient.d.ts +7 -0
- package/dist/build/filters/isGradient.js +10 -0
- package/dist/build/platforms/css.js +1 -0
- package/dist/build/primerStyleDictionary.js +2 -1
- package/dist/build/schemas/borderToken.d.ts +3 -3
- package/dist/build/schemas/colorToken.d.ts +3 -3
- package/dist/build/schemas/cubicBezierToken.d.ts +3 -3
- package/dist/build/schemas/designToken.js +2 -0
- package/dist/build/schemas/dimensionToken.d.ts +3 -3
- package/dist/build/schemas/durationToken.d.ts +3 -3
- package/dist/build/schemas/fontFamilyToken.d.ts +3 -3
- package/dist/build/schemas/fontWeightToken.d.ts +3 -3
- package/dist/build/schemas/gradientToken.d.ts +60 -0
- package/dist/build/schemas/gradientToken.js +26 -0
- package/dist/build/schemas/numberToken.d.ts +3 -3
- package/dist/build/schemas/referenceValue.js +1 -1
- package/dist/build/schemas/shadowToken.d.ts +3 -3
- package/dist/build/schemas/stringToken.d.ts +3 -3
- package/dist/build/schemas/tokenType.d.ts +1 -1
- package/dist/build/schemas/typographyToken.d.ts +3 -3
- package/dist/build/schemas/validTokenType.d.ts +1 -1
- package/dist/build/schemas/validTokenType.js +1 -0
- package/dist/build/schemas/viewportRangeToken.d.ts +3 -3
- package/dist/build/transformers/gradientToCss.d.ts +8 -0
- package/dist/build/transformers/gradientToCss.js +23 -0
- package/dist/build/transformers/index.d.ts +1 -0
- package/dist/build/transformers/index.js +1 -0
- package/dist/css/functional/themes/dark-colorblind.css +130 -0
- package/dist/css/functional/themes/dark-dimmed.css +130 -0
- package/dist/css/functional/themes/dark-high-contrast.css +130 -0
- package/dist/css/functional/themes/dark-tritanopia.css +130 -0
- package/dist/css/functional/themes/dark.css +130 -0
- package/dist/css/functional/themes/light-colorblind.css +130 -0
- package/dist/css/functional/themes/light-high-contrast.css +130 -0
- package/dist/css/functional/themes/light-tritanopia.css +130 -0
- package/dist/css/functional/themes/light.css +130 -0
- package/dist/docs/functional/themes/dark-colorblind.json +2167 -161
- package/dist/docs/functional/themes/dark-dimmed.json +2167 -161
- package/dist/docs/functional/themes/dark-high-contrast.json +2168 -162
- package/dist/docs/functional/themes/dark-tritanopia.json +2167 -161
- package/dist/docs/functional/themes/dark.json +2167 -161
- package/dist/docs/functional/themes/light-colorblind.json +2166 -160
- package/dist/docs/functional/themes/light-high-contrast.json +2168 -162
- package/dist/docs/functional/themes/light-tritanopia.json +2166 -160
- package/dist/docs/functional/themes/light.json +2166 -160
- package/dist/figma/themes/dark-colorblind.json +811 -26
- package/dist/figma/themes/dark-dimmed.json +811 -26
- package/dist/figma/themes/dark-high-contrast.json +811 -26
- package/dist/figma/themes/dark-tritanopia.json +811 -26
- package/dist/figma/themes/dark.json +811 -26
- package/dist/figma/themes/light-colorblind.json +810 -25
- package/dist/figma/themes/light-high-contrast.json +810 -25
- package/dist/figma/themes/light-tritanopia.json +810 -25
- package/dist/figma/themes/light.json +810 -25
- package/dist/internalCss/dark-colorblind.css +130 -0
- package/dist/internalCss/dark-dimmed.css +130 -0
- package/dist/internalCss/dark-high-contrast.css +130 -0
- package/dist/internalCss/dark-tritanopia.css +130 -0
- package/dist/internalCss/dark.css +130 -0
- package/dist/internalCss/light-colorblind.css +130 -0
- package/dist/internalCss/light-high-contrast.css +130 -0
- package/dist/internalCss/light-tritanopia.css +130 -0
- package/dist/internalCss/light.css +130 -0
- package/dist/styleLint/functional/themes/dark-colorblind.json +2167 -161
- package/dist/styleLint/functional/themes/dark-dimmed.json +2167 -161
- package/dist/styleLint/functional/themes/dark-high-contrast.json +2168 -162
- package/dist/styleLint/functional/themes/dark-tritanopia.json +2167 -161
- package/dist/styleLint/functional/themes/dark.json +2167 -161
- package/dist/styleLint/functional/themes/light-colorblind.json +2180 -174
- package/dist/styleLint/functional/themes/light-high-contrast.json +2168 -162
- package/dist/styleLint/functional/themes/light-tritanopia.json +2180 -174
- package/dist/styleLint/functional/themes/light.json +2180 -174
- package/package.json +1 -1
- package/src/tokens/functional/color/data-vis.json5 +911 -41
|
@@ -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
|
+
};
|
|
@@ -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+(
|
|
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
|
}));
|
|
@@ -77,7 +77,7 @@ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
77
77
|
alpha?: any;
|
|
78
78
|
inset?: boolean | undefined;
|
|
79
79
|
}>, "many">, z.ZodEffects<z.ZodString, string, string>]>;
|
|
80
|
-
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
80
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
81
81
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
82
82
|
'org.primer.figma': z.ZodObject<{
|
|
83
83
|
collection: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
@@ -1733,7 +1733,7 @@ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1733
1733
|
alpha?: any;
|
|
1734
1734
|
inset?: boolean | undefined;
|
|
1735
1735
|
}[];
|
|
1736
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
1736
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
1737
1737
|
$description?: string | undefined;
|
|
1738
1738
|
$deprecated?: string | boolean | undefined;
|
|
1739
1739
|
$extensions?: {
|
|
@@ -1952,7 +1952,7 @@ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1952
1952
|
alpha?: any;
|
|
1953
1953
|
inset?: boolean | undefined;
|
|
1954
1954
|
}[];
|
|
1955
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
1955
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
1956
1956
|
$description?: string | undefined;
|
|
1957
1957
|
$deprecated?: string | boolean | undefined;
|
|
1958
1958
|
$extensions?: {
|
|
@@ -4,15 +4,15 @@ export declare const stringToken: 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
|
}>, "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
|
}>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { TokenType } from './validTokenType.js';
|
|
3
|
-
export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
3
|
+
export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
@@ -35,7 +35,7 @@ export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
35
35
|
fontWeight: string | number;
|
|
36
36
|
lineHeight?: string | 0 | undefined;
|
|
37
37
|
}>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
38
|
-
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
38
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
39
39
|
}>, "strict", z.ZodTypeAny, {
|
|
40
40
|
$value: string | {
|
|
41
41
|
fontFamily: string;
|
|
@@ -43,7 +43,7 @@ export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
43
43
|
fontWeight: string | number;
|
|
44
44
|
lineHeight?: string | 0 | undefined;
|
|
45
45
|
};
|
|
46
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
46
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
47
47
|
$description?: string | undefined;
|
|
48
48
|
$deprecated?: string | boolean | undefined;
|
|
49
49
|
}, {
|
|
@@ -53,7 +53,7 @@ export declare const typographyToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
53
53
|
fontWeight: string | number;
|
|
54
54
|
lineHeight?: string | 0 | undefined;
|
|
55
55
|
};
|
|
56
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
56
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
57
57
|
$description?: string | undefined;
|
|
58
58
|
$deprecated?: string | boolean | undefined;
|
|
59
59
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
declare const validTypes: readonly ["color", "cubicBezier", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "number", "string", "custom-viewportRange"];
|
|
2
|
+
declare const validTypes: readonly ["color", "cubicBezier", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "gradient", "number", "string", "custom-viewportRange"];
|
|
3
3
|
export type TokenType = (typeof validTypes)[number];
|
|
4
4
|
export declare const validateType: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodTypeAny>>;
|
|
5
5
|
export {};
|
|
@@ -4,15 +4,15 @@ export declare const viewportRangeToken: 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
|
}>, "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
|
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description converts gradient tokens value to css gradient
|
|
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 `gradient`
|
|
6
|
+
* @transformer returns a `css gradient` string
|
|
7
|
+
*/
|
|
8
|
+
export declare const gradientToCss: Transform;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { toHex } from 'color2k';
|
|
2
|
+
import { isGradient } from '../filters/isGradient.js';
|
|
3
|
+
import { getTokenValue } from './utilities/getTokenValue.js';
|
|
4
|
+
/**
|
|
5
|
+
* @description converts gradient tokens value to css gradient
|
|
6
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
7
|
+
* @matcher matches all tokens of $type `gradient`
|
|
8
|
+
* @transformer returns a `css gradient` string
|
|
9
|
+
*/
|
|
10
|
+
export const gradientToCss = {
|
|
11
|
+
name: 'gradient/css',
|
|
12
|
+
type: 'value',
|
|
13
|
+
transitive: true,
|
|
14
|
+
filter: isGradient,
|
|
15
|
+
transform: (token) => {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const { angle } = (_b = (_a = token.$extensions) === null || _a === void 0 ? void 0 : _a['org.primer.gradient']) !== null && _b !== void 0 ? _b : {};
|
|
18
|
+
const stops = getTokenValue(token).map(({ color, position }) => {
|
|
19
|
+
return `${toHex(color)} ${position * 100}%`;
|
|
20
|
+
});
|
|
21
|
+
return `linear-gradient(${angle || 180}deg, ${stops.join(', ')})`;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -5,6 +5,7 @@ export { colorToRgbaFloat } from './colorToRgbaFloat.js';
|
|
|
5
5
|
export { cubicBezierToCss } from './cubicBezierToCss.js';
|
|
6
6
|
export { floatToPixel } from './floatToPixel.js';
|
|
7
7
|
export { floatToPixelUnitless } from './floatToPixel.js';
|
|
8
|
+
export { gradientToCss } from './gradientToCss.js';
|
|
8
9
|
export { dimensionToRem } from './dimensionToRem.js';
|
|
9
10
|
export { dimensionToRemPxArray } from './dimensionToRemPxArray.js';
|
|
10
11
|
export { dimensionToPixelUnitless } from './dimensionToPixelUnitless.js';
|
|
@@ -5,6 +5,7 @@ export { colorToRgbaFloat } from './colorToRgbaFloat.js';
|
|
|
5
5
|
export { cubicBezierToCss } from './cubicBezierToCss.js';
|
|
6
6
|
export { floatToPixel } from './floatToPixel.js';
|
|
7
7
|
export { floatToPixelUnitless } from './floatToPixel.js';
|
|
8
|
+
export { gradientToCss } from './gradientToCss.js';
|
|
8
9
|
export { dimensionToRem } from './dimensionToRem.js';
|
|
9
10
|
export { dimensionToRemPxArray } from './dimensionToRemPxArray.js';
|
|
10
11
|
export { dimensionToPixelUnitless } from './dimensionToPixelUnitless.js';
|