@primer/primitives 10.0.0-rc.d5052313 → 10.0.0-rc.dd3dde40
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/README.md +2 -2
- package/dist/build/PrimerStyleDictionary.js +27 -26
- package/dist/build/filters/isCubicBezier.d.ts +7 -0
- package/dist/build/filters/isCubicBezier.js +10 -0
- package/dist/build/formats/typescriptExportDefinition.js +2 -2
- package/dist/build/parsers/w3cJsonParser.js +2 -2
- package/dist/build/platforms/css.js +1 -0
- 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 +18 -0
- package/dist/build/schemas/cubicBezierToken.js +8 -0
- package/dist/build/schemas/designToken.js +2 -1
- 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/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/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 +8 -0
- package/dist/build/transformers/cubicBezierToCss.js +23 -0
- package/dist/build/transformers/durationToCss.js +2 -2
- package/dist/build/transformers/index.d.ts +1 -0
- package/dist/build/transformers/index.js +1 -0
- package/dist/css/base/motion/motion.css +17 -0
- package/dist/css/functional/motion/motion.css +4 -3
- package/dist/css/functional/themes/dark-colorblind.css +42 -22
- package/dist/css/functional/themes/dark-dimmed.css +44 -24
- package/dist/css/functional/themes/dark-high-contrast.css +42 -22
- package/dist/css/functional/themes/dark-tritanopia.css +42 -22
- package/dist/css/functional/themes/dark.css +42 -22
- package/dist/css/functional/themes/light-colorblind.css +42 -22
- package/dist/css/functional/themes/light-high-contrast.css +44 -24
- package/dist/css/functional/themes/light-tritanopia.css +42 -22
- package/dist/css/functional/themes/light.css +42 -22
- package/dist/css/functional/typography/typography.css +43 -43
- package/dist/css/primitives.css +64 -46
- package/dist/docs/base/motion/motion.json +205 -0
- package/dist/docs/functional/motion/motion.json +18 -3
- package/dist/docs/functional/themes/dark-colorblind.json +533 -251
- package/dist/docs/functional/themes/dark-dimmed.json +560 -256
- package/dist/docs/functional/themes/dark-high-contrast.json +388 -148
- package/dist/docs/functional/themes/dark-tritanopia.json +535 -257
- package/dist/docs/functional/themes/dark.json +544 -256
- package/dist/docs/functional/themes/light-colorblind.json +355 -65
- package/dist/docs/functional/themes/light-high-contrast.json +333 -63
- package/dist/docs/functional/themes/light-tritanopia.json +307 -61
- package/dist/docs/functional/themes/light.json +336 -58
- package/dist/fallbacks/base/motion/motion.json +17 -0
- package/dist/fallbacks/functional/motion/motion.json +1 -0
- package/dist/figma/dimension/dimension.json +518 -518
- package/dist/figma/figma.json +19 -19
- package/dist/figma/scales/dark-dimmed.json +3536 -656
- package/dist/figma/scales/dark-high-constrast.json +3535 -655
- package/dist/figma/scales/dark.json +3371 -491
- package/dist/figma/scales/light-high-constrast.json +3533 -653
- package/dist/figma/scales/light.json +3370 -490
- package/dist/figma/shadows/dark-colorblind.json +285 -285
- package/dist/figma/shadows/dark-dimmed.json +285 -285
- package/dist/figma/shadows/dark-high-contrast.json +285 -285
- package/dist/figma/shadows/dark-tritanopia.json +285 -285
- package/dist/figma/shadows/dark.json +285 -285
- package/dist/figma/shadows/light-colorblind.json +254 -254
- package/dist/figma/shadows/light-high-contrast.json +254 -254
- package/dist/figma/shadows/light-tritanopia.json +254 -254
- package/dist/figma/shadows/light.json +254 -254
- package/dist/figma/themes/dark-colorblind.json +5177 -5048
- package/dist/figma/themes/dark-dimmed.json +5526 -5351
- package/dist/figma/themes/dark-high-contrast.json +4361 -4251
- package/dist/figma/themes/dark-tritanopia.json +5315 -5187
- package/dist/figma/themes/dark.json +5741 -5582
- package/dist/figma/themes/light-colorblind.json +5112 -4937
- package/dist/figma/themes/light-high-contrast.json +4465 -4322
- package/dist/figma/themes/light-tritanopia.json +5179 -5053
- package/dist/figma/themes/light.json +5657 -5500
- package/dist/figma/typography/typography.json +162 -162
- package/dist/internalCss/dark-colorblind.css +42 -22
- package/dist/internalCss/dark-dimmed.css +44 -24
- package/dist/internalCss/dark-high-contrast.css +42 -22
- package/dist/internalCss/dark-tritanopia.css +42 -22
- package/dist/internalCss/dark.css +42 -22
- package/dist/internalCss/light-colorblind.css +42 -22
- package/dist/internalCss/light-high-contrast.css +44 -24
- package/dist/internalCss/light-tritanopia.css +42 -22
- package/dist/internalCss/light.css +42 -22
- package/dist/styleLint/base/motion/motion.json +205 -0
- package/dist/styleLint/functional/motion/motion.json +18 -3
- package/dist/styleLint/functional/themes/dark-colorblind.json +533 -251
- package/dist/styleLint/functional/themes/dark-dimmed.json +560 -256
- package/dist/styleLint/functional/themes/dark-high-contrast.json +387 -147
- package/dist/styleLint/functional/themes/dark-tritanopia.json +535 -257
- package/dist/styleLint/functional/themes/dark.json +544 -256
- package/dist/styleLint/functional/themes/light-colorblind.json +355 -65
- package/dist/styleLint/functional/themes/light-high-contrast.json +333 -63
- package/dist/styleLint/functional/themes/light-tritanopia.json +307 -61
- package/dist/styleLint/functional/themes/light.json +336 -58
- package/package.json +20 -22
- package/src/tokens/base/motion/easing.json5 +26 -0
- package/src/tokens/base/motion/timing.json5 +50 -0
- package/src/tokens/functional/color/dark/app-dark.json5 +203 -88
- package/src/tokens/functional/color/dark/display-dark.json5 +95 -95
- package/src/tokens/functional/color/dark/overrides/dark.dimmed.json5 +0 -8
- package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +39 -26
- package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +54 -28
- package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +36 -13
- package/src/tokens/functional/color/dark/patterns-dark.json5 +16 -4
- package/src/tokens/functional/color/dark/primitives-dark.json5 +1 -1
- package/src/tokens/functional/color/light/app-light.json5 +195 -85
- package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +25 -25
- package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +59 -26
- package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +62 -10
- package/src/tokens/functional/color/light/patterns-light.json5 +13 -1
- package/src/tokens/functional/motion/loading.json5 +1 -1
- package/src/tokens/functional/motion/patterns.json5 +9 -2
package/README.md
CHANGED
|
@@ -138,10 +138,10 @@ In this case you can create the follwing structure. The `@` will be removed from
|
|
|
138
138
|
bgColor: {
|
|
139
139
|
accent: {
|
|
140
140
|
'@': {
|
|
141
|
-
// values for accent (default)
|
|
141
|
+
// values for bgColor-accent (default)
|
|
142
142
|
},
|
|
143
143
|
muted: {
|
|
144
|
-
// values for accent-muted
|
|
144
|
+
// values for bgColor-accent-muted
|
|
145
145
|
},
|
|
146
146
|
},
|
|
147
147
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import StyleDictionary from 'style-dictionary';
|
|
2
|
-
import { borderToCss, colorToRgbAlpha, colorToHex, colorToHexMix, colorToRgbaFloat, 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, colorToHexMix, 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';
|
|
3
3
|
import { javascriptCommonJs, javascriptEsm, typescriptExportDefinition, jsonNestedPrefixed, cssCustomMedia, jsonOneDimensional, jsonPostCssFallback, cssAdvanced, jsonFigma, } from './formats/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* @name {@link PrimerStyleDictionary}
|
|
@@ -52,28 +52,29 @@ PrimerStyleDictionary.registerFormat({
|
|
|
52
52
|
* Transformers
|
|
53
53
|
*
|
|
54
54
|
*/
|
|
55
|
-
PrimerStyleDictionary.registerTransform(
|
|
56
|
-
PrimerStyleDictionary.registerTransform(
|
|
57
|
-
PrimerStyleDictionary.registerTransform(
|
|
58
|
-
PrimerStyleDictionary.registerTransform(
|
|
59
|
-
PrimerStyleDictionary.registerTransform(
|
|
60
|
-
PrimerStyleDictionary.registerTransform(
|
|
61
|
-
PrimerStyleDictionary.registerTransform(
|
|
62
|
-
PrimerStyleDictionary.registerTransform(
|
|
63
|
-
PrimerStyleDictionary.registerTransform(
|
|
64
|
-
PrimerStyleDictionary.registerTransform(
|
|
65
|
-
PrimerStyleDictionary.registerTransform(
|
|
66
|
-
PrimerStyleDictionary.registerTransform(
|
|
67
|
-
PrimerStyleDictionary.registerTransform(
|
|
68
|
-
PrimerStyleDictionary.registerTransform(
|
|
69
|
-
PrimerStyleDictionary.registerTransform(
|
|
70
|
-
PrimerStyleDictionary.registerTransform(
|
|
71
|
-
PrimerStyleDictionary.registerTransform(
|
|
72
|
-
PrimerStyleDictionary.registerTransform(
|
|
73
|
-
PrimerStyleDictionary.registerTransform(
|
|
74
|
-
PrimerStyleDictionary.registerTransform(
|
|
75
|
-
PrimerStyleDictionary.registerTransform(
|
|
76
|
-
PrimerStyleDictionary.registerTransform(
|
|
77
|
-
PrimerStyleDictionary.registerTransform(
|
|
78
|
-
PrimerStyleDictionary.registerTransform(
|
|
79
|
-
PrimerStyleDictionary.registerTransform(
|
|
55
|
+
PrimerStyleDictionary.registerTransform(colorToRgbAlpha);
|
|
56
|
+
PrimerStyleDictionary.registerTransform(colorToRgbaFloat);
|
|
57
|
+
PrimerStyleDictionary.registerTransform(colorToHexMix);
|
|
58
|
+
PrimerStyleDictionary.registerTransform(colorToHex);
|
|
59
|
+
PrimerStyleDictionary.registerTransform(cubicBezierToCss);
|
|
60
|
+
PrimerStyleDictionary.registerTransform(floatToPixel);
|
|
61
|
+
PrimerStyleDictionary.registerTransform(floatToPixelUnitless);
|
|
62
|
+
PrimerStyleDictionary.registerTransform(dimensionToRem);
|
|
63
|
+
PrimerStyleDictionary.registerTransform(dimensionToRemPxArray);
|
|
64
|
+
PrimerStyleDictionary.registerTransform(dimensionToPixelUnitless);
|
|
65
|
+
PrimerStyleDictionary.registerTransform(durationToCss);
|
|
66
|
+
PrimerStyleDictionary.registerTransform(figmaAttributes);
|
|
67
|
+
PrimerStyleDictionary.registerTransform(jsonDeprecated);
|
|
68
|
+
PrimerStyleDictionary.registerTransform(namePathToCamelCase);
|
|
69
|
+
PrimerStyleDictionary.registerTransform(namePathToPascalCase);
|
|
70
|
+
PrimerStyleDictionary.registerTransform(namePathToDotNotation);
|
|
71
|
+
PrimerStyleDictionary.registerTransform(namePathToFigma);
|
|
72
|
+
PrimerStyleDictionary.registerTransform(namePathToCamelCase);
|
|
73
|
+
PrimerStyleDictionary.registerTransform(namePathToKebabCase);
|
|
74
|
+
PrimerStyleDictionary.registerTransform(namePathToSlashNotation);
|
|
75
|
+
PrimerStyleDictionary.registerTransform(shadowToCss);
|
|
76
|
+
PrimerStyleDictionary.registerTransform(borderToCss);
|
|
77
|
+
PrimerStyleDictionary.registerTransform(typographyToCss);
|
|
78
|
+
PrimerStyleDictionary.registerTransform(fontWeightToNumber);
|
|
79
|
+
PrimerStyleDictionary.registerTransform(fontFamilyToCss);
|
|
80
|
+
PrimerStyleDictionary.registerTransform(fontFamilyToFigma);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TransformedToken } from 'style-dictionary/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Checks if token is of $type `cubicBezier`
|
|
4
|
+
* @param token [TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
5
|
+
* @returns boolean
|
|
6
|
+
*/
|
|
7
|
+
export declare const isCubicBezier: (token: TransformedToken) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Checks if token is of $type `cubicBezier`
|
|
3
|
+
* @param token [TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
|
|
4
|
+
* @returns boolean
|
|
5
|
+
*/
|
|
6
|
+
export const isCubicBezier = (token) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const typeValue = (_a = token.$type) !== null && _a !== void 0 ? _a : token.type;
|
|
9
|
+
return typeValue === 'cubicBezier';
|
|
10
|
+
};
|
|
@@ -37,9 +37,9 @@ const getTokenType = (tokenTypesPath) => {
|
|
|
37
37
|
const designTokenType = readFileSync(resolvePath(tokenTypesPath), { encoding: 'utf-8' });
|
|
38
38
|
return designTokenType;
|
|
39
39
|
}
|
|
40
|
-
catch (
|
|
40
|
+
catch (error) {
|
|
41
41
|
// eslint-disable-next-line no-console
|
|
42
|
-
throw new Error(`Error trying to load design token type from file "${tokenTypesPath}"
|
|
42
|
+
throw new Error(`Error trying to load design token type from file "${tokenTypesPath}". Error: ${error}`);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
@@ -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" | "custom-viewportRange">;
|
|
32
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
39
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
48
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
49
49
|
$description?: string | undefined;
|
|
50
50
|
deprecated?: string | boolean | undefined;
|
|
51
51
|
}>;
|
|
@@ -4,7 +4,7 @@ export declare const colorToken: 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" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
8
|
alpha: z.ZodNullable<z.ZodOptional<z.ZodEffects<z.ZodAny, any, any>>>;
|
|
9
9
|
mix: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
10
10
|
color: z.ZodString;
|
|
@@ -48,7 +48,7 @@ export declare const colorToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
48
48
|
}>>;
|
|
49
49
|
}>, "strict", z.ZodTypeAny, {
|
|
50
50
|
$value: string;
|
|
51
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "custom-viewportRange";
|
|
51
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
52
52
|
alpha?: any;
|
|
53
53
|
$description?: string | undefined;
|
|
54
54
|
mix?: {
|
|
@@ -66,7 +66,7 @@ export declare const colorToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
66
66
|
} | undefined;
|
|
67
67
|
}, {
|
|
68
68
|
$value: string;
|
|
69
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "custom-viewportRange";
|
|
69
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
70
70
|
alpha?: any;
|
|
71
71
|
$description?: string | undefined;
|
|
72
72
|
mix?: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const cubicBezierToken: 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.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">;
|
|
8
|
+
}>, "strict", z.ZodTypeAny, {
|
|
9
|
+
$value: string | number[];
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
11
|
+
$description?: string | undefined;
|
|
12
|
+
deprecated?: string | boolean | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
$value: string | number[];
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
16
|
+
$description?: string | undefined;
|
|
17
|
+
deprecated?: string | boolean | undefined;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseToken } from './baseToken.js';
|
|
3
|
+
import { referenceValue } from './referenceValue.js';
|
|
4
|
+
import { tokenType } from './tokenType.js';
|
|
5
|
+
export const cubicBezierToken = baseToken.extend({
|
|
6
|
+
$value: z.union([z.array(z.number()).length(4), referenceValue]),
|
|
7
|
+
$type: tokenType('cubicBezier'),
|
|
8
|
+
});
|
|
@@ -11,12 +11,14 @@ import { colorToken } from './colorToken.js';
|
|
|
11
11
|
import { fontFamilyToken } from './fontFamilyToken.js';
|
|
12
12
|
import { shadowToken } from './shadowToken.js';
|
|
13
13
|
import { durationToken } from './durationToken.js';
|
|
14
|
+
import { cubicBezierToken } from './cubicBezierToken.js';
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
16
|
// @ts-ignore: TODO: fix this
|
|
16
17
|
export const designToken = z.record(tokenName, z.lazy(() => {
|
|
17
18
|
return z.union([
|
|
18
19
|
z.discriminatedUnion('$type', [
|
|
19
20
|
colorToken,
|
|
21
|
+
cubicBezierToken,
|
|
20
22
|
dimensionToken,
|
|
21
23
|
shadowToken,
|
|
22
24
|
borderToken,
|
|
@@ -28,7 +30,6 @@ export const designToken = z.record(tokenName, z.lazy(() => {
|
|
|
28
30
|
durationToken,
|
|
29
31
|
stringToken,
|
|
30
32
|
]),
|
|
31
|
-
// referenceToken,
|
|
32
33
|
designToken,
|
|
33
34
|
]);
|
|
34
35
|
}));
|
|
@@ -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" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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>;
|
|
@@ -29,7 +29,7 @@ export declare const dimensionToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
29
29
|
}>>;
|
|
30
30
|
}>, "strict", z.ZodTypeAny, {
|
|
31
31
|
$value: string | 0;
|
|
32
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "custom-viewportRange";
|
|
32
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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 dimensionToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
40
40
|
} | undefined;
|
|
41
41
|
}, {
|
|
42
42
|
$value: string | 0;
|
|
43
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "custom-viewportRange";
|
|
43
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
44
44
|
$description?: string | undefined;
|
|
45
45
|
deprecated?: string | boolean | undefined;
|
|
46
46
|
$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" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
32
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
43
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange">;
|
|
6
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
32
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
43
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
44
44
|
$description?: string | undefined;
|
|
45
45
|
deprecated?: string | boolean | undefined;
|
|
46
46
|
$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" | "shadow" | "typography" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
45
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
59
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "shadow" | "typography" | "custom-viewportRange">;
|
|
80
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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>>;
|
|
@@ -118,7 +118,7 @@ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
118
118
|
alpha?: any;
|
|
119
119
|
inset?: boolean | undefined;
|
|
120
120
|
}[];
|
|
121
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "custom-viewportRange";
|
|
121
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
122
122
|
$description?: string | undefined;
|
|
123
123
|
deprecated?: string | boolean | undefined;
|
|
124
124
|
$extensions?: {
|
|
@@ -145,7 +145,7 @@ export declare const shadowToken: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
145
145
|
alpha?: any;
|
|
146
146
|
inset?: boolean | undefined;
|
|
147
147
|
}[];
|
|
148
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "custom-viewportRange";
|
|
148
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
149
149
|
$description?: string | undefined;
|
|
150
150
|
deprecated?: string | boolean | undefined;
|
|
151
151
|
$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" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange">;
|
|
3
|
+
export declare const tokenType: ($type: TokenType) => z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange">;
|
|
38
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
46
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
56
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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", "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", "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" | "custom-viewportRange">;
|
|
7
|
+
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
10
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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" | "custom-viewportRange";
|
|
15
|
+
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "dimension" | "duration" | "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 cubicBezeir tokens array value to a css cubic-bezier
|
|
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 `duration`
|
|
6
|
+
* @transformer returns a css cubic-bezier function
|
|
7
|
+
*/
|
|
8
|
+
export declare const cubicBezierToCss: Transform;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isCubicBezier } from '../filters/isCubicBezier.js';
|
|
2
|
+
/**
|
|
3
|
+
* @description converts cubicBezeir tokens array value to a css cubic-bezier
|
|
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 `duration`
|
|
6
|
+
* @transformer returns a css cubic-bezier function
|
|
7
|
+
*/
|
|
8
|
+
export const cubicBezierToCss = {
|
|
9
|
+
name: 'cubicBezeir/css',
|
|
10
|
+
type: 'value',
|
|
11
|
+
transitive: true,
|
|
12
|
+
filter: isCubicBezier,
|
|
13
|
+
transform: (token, _config) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const value = (_a = token.$value) !== null && _a !== void 0 ? _a : token.value;
|
|
16
|
+
// throw value of more or less than 4 items in array
|
|
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(',')})`;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -13,8 +13,8 @@ export const durationToCss = {
|
|
|
13
13
|
transform: (token, _config, options) => {
|
|
14
14
|
const valueProp = options.usesDtcg ? '$value' : 'value';
|
|
15
15
|
// throw an error if token value is not a string or does not end with `ms`
|
|
16
|
-
if (typeof token[valueProp] !== `string` || !token[valueProp].endsWith(`ms`)) {
|
|
17
|
-
throw new Error(`duration token value must be a string with an "ms" unit`);
|
|
16
|
+
if (typeof token[valueProp] !== `string` || !(token[valueProp].endsWith(`ms`) || token[valueProp].endsWith(`s`))) {
|
|
17
|
+
throw new Error(`duration token value must be a string with an "ms" || "s" unit, invalid token: ${token.name} with value: ${token[valueProp]}`);
|
|
18
18
|
}
|
|
19
19
|
// get value
|
|
20
20
|
let value = parseInt(token[valueProp].replace('ms', ''));
|
|
@@ -3,6 +3,7 @@ export { colorToHex } from './colorToHex.js';
|
|
|
3
3
|
export { colorToHexMix } from './colorToHexMix.js';
|
|
4
4
|
export { colorToRgbAlpha } from './colorToRgbAlpha.js';
|
|
5
5
|
export { colorToRgbaFloat } from './colorToRgbaFloat.js';
|
|
6
|
+
export { cubicBezierToCss } from './cubicBezierToCss.js';
|
|
6
7
|
export { floatToPixel } from './floatToPixel.js';
|
|
7
8
|
export { floatToPixelUnitless } from './floatToPixel.js';
|
|
8
9
|
export { dimensionToRem } from './dimensionToRem.js';
|
|
@@ -3,6 +3,7 @@ export { colorToHex } from './colorToHex.js';
|
|
|
3
3
|
export { colorToHexMix } from './colorToHexMix.js';
|
|
4
4
|
export { colorToRgbAlpha } from './colorToRgbAlpha.js';
|
|
5
5
|
export { colorToRgbaFloat } from './colorToRgbaFloat.js';
|
|
6
|
+
export { cubicBezierToCss } from './cubicBezierToCss.js';
|
|
6
7
|
export { floatToPixel } from './floatToPixel.js';
|
|
7
8
|
export { floatToPixelUnitless } from './floatToPixel.js';
|
|
8
9
|
export { dimensionToRem } from './dimensionToRem.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--base-easing-linear: cubic-bezier(0, 0, 1, 1); /* Ideal for non-movement properties, like opacity or background color. */
|
|
3
|
+
--base-easing-easeIn: cubic-bezier(0.7, 0.1, 0.75, 0.9); /* Ideal for movement that starts on the page and ends off the page. */
|
|
4
|
+
--base-easing-easeOut: cubic-bezier(0.16, 1, 0.3, 1); /* Ideal for movement that starts off the page and ends on the page. */
|
|
5
|
+
--base-easing-easeInOut: cubic-bezier(0.6, 0, 0.2, 1); /* Ideal for movement that starts and ends on the page. */
|
|
6
|
+
--base-duration-0: 0ms;
|
|
7
|
+
--base-duration-75: 75ms;
|
|
8
|
+
--base-duration-200: 200ms;
|
|
9
|
+
--base-duration-300: 300ms;
|
|
10
|
+
--base-duration-400: 400ms;
|
|
11
|
+
--base-duration-500: 500ms;
|
|
12
|
+
--base-duration-600: 600ms;
|
|
13
|
+
--base-duration-700: 700ms;
|
|
14
|
+
--base-duration-800: 800ms;
|
|
15
|
+
--base-duration-900: 900ms;
|
|
16
|
+
--base-duration-1000: 1s;
|
|
17
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--motion-
|
|
3
|
-
--motion-spinner-duration-rotation:
|
|
4
|
-
--motion-
|
|
2
|
+
--motion-loading-delay-default: var(--base-duration-1000); /* The amount of time to wait before showing a loading indicator or announcing a loading state to assistive technologies. */
|
|
3
|
+
--motion-spinner-duration-rotation: var(--base-duration-1000); /* The amount of time it takes the "Spinner" loading indicator to make a full 360deg rotation */
|
|
4
|
+
--motion-spinner-easing-rotation: var(--base-easing-linear); /* The easing curve for the "Spinner" loading indicator rotation */
|
|
5
|
+
--motion-skeletonLoader-shimmer-duration-scale: var(--base-duration-1000); /* The amount of times it takes the "shimmer" effect to go from the start (left) of the skeleton loader to the end (right) */
|
|
5
6
|
}
|