@primer/primitives 10.6.0-rc.efb715c5 → 10.6.0
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/isTransition.d.ts +7 -0
- package/dist/build/filters/isTransition.js +8 -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 +3 -3
- package/dist/build/schemas/numberToken.d.ts +3 -3
- 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/transitionToken.d.ts +38 -0
- package/dist/build/schemas/transitionToken.js +19 -0
- 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/cubicBezierToCss.d.ts +1 -0
- package/dist/build/transformers/cubicBezierToCss.js +9 -6
- package/dist/build/transformers/index.d.ts +1 -0
- package/dist/build/transformers/index.js +1 -0
- package/dist/build/transformers/transitionToCss.d.ts +8 -0
- package/dist/build/transformers/transitionToCss.js +27 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TransformedToken } from 'style-dictionary/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Checks if token is of $type `transition`
|
|
4
|
+
* @param token [TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
5
|
+
* @returns boolean
|
|
6
|
+
*/
|
|
7
|
+
export declare const isTransition: (token: TransformedToken) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Checks if token is of $type `transition`
|
|
3
|
+
* @param token [TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
4
|
+
* @returns boolean
|
|
5
|
+
*/
|
|
6
|
+
export const isTransition = (token) => {
|
|
7
|
+
return token.$type === 'transition';
|
|
8
|
+
};
|
|
@@ -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, gradientToCss, 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, transitionToCss, } 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';
|
|
@@ -82,6 +82,7 @@ PrimerStyleDictionary.registerTransform(namePathToSlashNotation);
|
|
|
82
82
|
PrimerStyleDictionary.registerTransform(shadowToCss);
|
|
83
83
|
PrimerStyleDictionary.registerTransform(borderToCss);
|
|
84
84
|
PrimerStyleDictionary.registerTransform(typographyToCss);
|
|
85
|
+
PrimerStyleDictionary.registerTransform(transitionToCss);
|
|
85
86
|
PrimerStyleDictionary.registerTransform(fontWeightToNumber);
|
|
86
87
|
PrimerStyleDictionary.registerTransform(fontFamilyToCss);
|
|
87
88
|
PrimerStyleDictionary.registerTransform(fontFamilyToFigma);
|
|
@@ -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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
32
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
39
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
48
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
9
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
412
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
482
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
16
16
|
$description?: string | undefined;
|
|
17
17
|
$deprecated?: string | boolean | undefined;
|
|
18
18
|
}>;
|
|
@@ -13,6 +13,7 @@ import { shadowToken } from './shadowToken.js';
|
|
|
13
13
|
import { durationToken } from './durationToken.js';
|
|
14
14
|
import { cubicBezierToken } from './cubicBezierToken.js';
|
|
15
15
|
import { gradientToken } from './gradientToken.js';
|
|
16
|
+
import { transitionToken } from './transitionToken.js';
|
|
16
17
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17
18
|
// @ts-ignore: TODO: fix this
|
|
18
19
|
export const designToken = z.record(tokenName, z.lazy(() => {
|
|
@@ -31,6 +32,7 @@ export const designToken = z.record(tokenName, z.lazy(() => {
|
|
|
31
32
|
numberToken,
|
|
32
33
|
durationToken,
|
|
33
34
|
stringToken,
|
|
35
|
+
transitionToken,
|
|
34
36
|
]),
|
|
35
37
|
designToken,
|
|
36
38
|
]);
|
|
@@ -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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
37
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
49
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
32
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
43
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
6
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
32
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
43
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
44
44
|
$description?: string | undefined;
|
|
45
45
|
$deprecated?: string | boolean | undefined;
|
|
46
46
|
$extensions?: {
|
|
@@ -13,7 +13,7 @@ export declare const gradientToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
13
13
|
color: string;
|
|
14
14
|
position: number;
|
|
15
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">;
|
|
16
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
17
17
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
18
18
|
'org.primer.gradient': z.ZodObject<{
|
|
19
19
|
angle: z.ZodOptional<z.ZodNumber>;
|
|
@@ -36,7 +36,7 @@ export declare const gradientToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
36
36
|
color: string;
|
|
37
37
|
position: number;
|
|
38
38
|
}[];
|
|
39
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
39
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
40
40
|
$description?: string | undefined;
|
|
41
41
|
$deprecated?: string | boolean | undefined;
|
|
42
42
|
$extensions?: {
|
|
@@ -49,7 +49,7 @@ export declare const gradientToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
49
49
|
color: string;
|
|
50
50
|
position: number;
|
|
51
51
|
}[];
|
|
52
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
52
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
53
53
|
$description?: string | undefined;
|
|
54
54
|
$deprecated?: string | boolean | undefined;
|
|
55
55
|
$extensions?: {
|
|
@@ -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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
45
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
59
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
60
60
|
$description?: string | undefined;
|
|
61
61
|
$deprecated?: string | boolean | undefined;
|
|
62
62
|
$extensions?: {
|
|
@@ -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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
80
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
1736
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
1955
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
3
|
+
export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const transitionToken: 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.ZodObject<{
|
|
7
|
+
duration: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
8
|
+
timingFunction: z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodNumber, "many">, z.ZodEffects<z.ZodString, string, string>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
9
|
+
delay: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, z.ZodEffects<z.ZodString, string, string>]>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
duration: string;
|
|
12
|
+
timingFunction: string | number[];
|
|
13
|
+
delay?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
duration: string;
|
|
16
|
+
timingFunction: string | number[];
|
|
17
|
+
delay?: string | undefined;
|
|
18
|
+
}>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
19
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
20
|
+
}>, "strict", z.ZodTypeAny, {
|
|
21
|
+
$value: string | {
|
|
22
|
+
duration: string;
|
|
23
|
+
timingFunction: string | number[];
|
|
24
|
+
delay?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
27
|
+
$description?: string | undefined;
|
|
28
|
+
$deprecated?: string | boolean | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
$value: string | {
|
|
31
|
+
duration: string;
|
|
32
|
+
timingFunction: string | number[];
|
|
33
|
+
delay?: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
36
|
+
$description?: string | undefined;
|
|
37
|
+
$deprecated?: string | boolean | undefined;
|
|
38
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseToken } from './baseToken.js';
|
|
3
|
+
import { referenceValue } from './referenceValue.js';
|
|
4
|
+
import { durationToken } from './durationToken.js';
|
|
5
|
+
import { cubicBezierToken } from './cubicBezierToken.js';
|
|
6
|
+
import { tokenType } from './tokenType.js';
|
|
7
|
+
export const transitionToken = baseToken
|
|
8
|
+
.extend({
|
|
9
|
+
$value: z.union([
|
|
10
|
+
z.object({
|
|
11
|
+
duration: z.union([durationToken.shape.$value, referenceValue]),
|
|
12
|
+
timingFunction: z.union([cubicBezierToken.shape.$value, referenceValue]),
|
|
13
|
+
delay: z.union([durationToken.shape.$value, referenceValue]).optional(),
|
|
14
|
+
}),
|
|
15
|
+
referenceValue,
|
|
16
|
+
]),
|
|
17
|
+
$type: tokenType('transition'),
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
@@ -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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
38
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
46
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
56
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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", "gradient", "number", "string", "custom-viewportRange"];
|
|
2
|
+
declare const validTypes: readonly ["color", "cubicBezier", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "gradient", "number", "string", "transition", "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "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" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
16
16
|
$description?: string | undefined;
|
|
17
17
|
$deprecated?: string | boolean | undefined;
|
|
18
18
|
}>;
|
|
@@ -13,11 +13,14 @@ export const cubicBezierToCss = {
|
|
|
13
13
|
transform: (token, _config) => {
|
|
14
14
|
var _a;
|
|
15
15
|
const value = (_a = token.$value) !== null && _a !== void 0 ? _a : token.value;
|
|
16
|
-
|
|
17
|
-
if (value.length !== 4 || value.some((item) => typeof item !== 'number')) {
|
|
18
|
-
throw new Error(`Invalid cubicBezier token ${token.path.join('.')}, must be an array with 4 numbers, but got this instead: ${JSON.stringify(value)}`);
|
|
19
|
-
}
|
|
20
|
-
// return value
|
|
21
|
-
return `cubic-bezier(${value.join(',')})`;
|
|
16
|
+
return cubicBezierArrayToCss(value, token.path);
|
|
22
17
|
},
|
|
23
18
|
};
|
|
19
|
+
export const cubicBezierArrayToCss = (value, path) => {
|
|
20
|
+
// throw value of more or less than 4 items in array
|
|
21
|
+
if (value.length !== 4 || value.some((item) => typeof item !== 'number')) {
|
|
22
|
+
throw new Error(`Invalid cubicBezier token ${path.join('.')}, must be an array with 4 numbers, but got this instead: ${JSON.stringify(value)}`);
|
|
23
|
+
}
|
|
24
|
+
// return value
|
|
25
|
+
return `cubic-bezier(${value.join(',')})`;
|
|
26
|
+
};
|
|
@@ -23,3 +23,4 @@ export { namePathToKebabCase } from './namePathToKebabCase.js';
|
|
|
23
23
|
export { namePathToSlashNotation } from './namePathToSlashNotation.js';
|
|
24
24
|
export { shadowToCss } from './shadowToCss.js';
|
|
25
25
|
export { typographyToCss } from './typographyToCss.js';
|
|
26
|
+
export { transitionToCss } from './transitionToCss.js';
|
|
@@ -23,3 +23,4 @@ export { namePathToKebabCase } from './namePathToKebabCase.js';
|
|
|
23
23
|
export { namePathToSlashNotation } from './namePathToSlashNotation.js';
|
|
24
24
|
export { shadowToCss } from './shadowToCss.js';
|
|
25
25
|
export { typographyToCss } from './typographyToCss.js';
|
|
26
|
+
export { transitionToCss } from './transitionToCss.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Transform } from 'style-dictionary/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description converts transition tokens to CSS transition 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 `transition`
|
|
6
|
+
* @transformer returns css transition `string`
|
|
7
|
+
*/
|
|
8
|
+
export declare const transitionToCss: Transform;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isTransition } from '../filters/index.js';
|
|
2
|
+
import { cubicBezierArrayToCss } from './cubicBezierToCss.js';
|
|
3
|
+
import { checkRequiredTokenProperties } from './utilities/checkRequiredTokenProperties.js';
|
|
4
|
+
import { getTokenValue } from './utilities/getTokenValue.js';
|
|
5
|
+
/**
|
|
6
|
+
* @description converts transition tokens to CSS transition string
|
|
7
|
+
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
8
|
+
* @matcher matches all tokens of $type `transition`
|
|
9
|
+
* @transformer returns css transition `string`
|
|
10
|
+
*/
|
|
11
|
+
export const transitionToCss = {
|
|
12
|
+
name: 'transition/css',
|
|
13
|
+
type: 'value',
|
|
14
|
+
transitive: true,
|
|
15
|
+
filter: isTransition,
|
|
16
|
+
transform: (token) => {
|
|
17
|
+
// extract value
|
|
18
|
+
const value = getTokenValue(token);
|
|
19
|
+
// if value is a string, it's probably a reference, return as is
|
|
20
|
+
if (typeof value === 'string') {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
// check required properties
|
|
24
|
+
checkRequiredTokenProperties(value, ['duration', 'timingFunction']);
|
|
25
|
+
return `${value.duration} ${cubicBezierArrayToCss(value.timingFunction, token.path)} ${value.delay ? value.delay : ''}`.trim();
|
|
26
|
+
},
|
|
27
|
+
};
|