@primer/primitives 11.1.0 → 11.2.0-rc.1012e204
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/schemas/alphaValue.d.ts +1 -1
- package/dist/build/schemas/alphaValue.js +8 -3
- package/dist/build/schemas/baseToken.d.ts +2 -8
- package/dist/build/schemas/borderToken.d.ts +30 -47
- package/dist/build/schemas/collections.d.ts +2 -2
- package/dist/build/schemas/collections.js +16 -6
- package/dist/build/schemas/colorHexValue.d.ts +1 -1
- package/dist/build/schemas/colorHexValue.js +8 -3
- package/dist/build/schemas/colorToken.d.ts +81 -789
- package/dist/build/schemas/colorToken.js +1 -1
- package/dist/build/schemas/cubicBezierToken.d.ts +4 -15
- package/dist/build/schemas/designToken.d.ts +1 -1
- package/dist/build/schemas/dimensionToken.d.ts +8 -53
- package/dist/build/schemas/dimensionValue.d.ts +1 -1
- package/dist/build/schemas/dimensionValue.js +8 -3
- package/dist/build/schemas/durationToken.d.ts +4 -15
- package/dist/build/schemas/durationValue.d.ts +1 -1
- package/dist/build/schemas/durationValue.js +8 -3
- package/dist/build/schemas/fontFamilyToken.d.ts +8 -47
- package/dist/build/schemas/fontWeightToken.d.ts +8 -47
- package/dist/build/schemas/fontWeightValue.d.ts +1 -1
- package/dist/build/schemas/fontWeightValue.js +8 -3
- package/dist/build/schemas/gradientToken.d.ts +8 -53
- package/dist/build/schemas/numberToken.d.ts +9 -64
- package/dist/build/schemas/referenceValue.d.ts +1 -1
- package/dist/build/schemas/referenceValue.js +8 -3
- package/dist/build/schemas/scopes.d.ts +1 -1
- package/dist/build/schemas/scopes.js +8 -3
- package/dist/build/schemas/shadowToken.d.ts +210 -2136
- package/dist/build/schemas/shadowToken.js +0 -9
- package/dist/build/schemas/stringToken.d.ts +4 -15
- package/dist/build/schemas/tokenName.d.ts +1 -1
- package/dist/build/schemas/tokenName.js +8 -3
- package/dist/build/schemas/transitionToken.d.ts +8 -35
- package/dist/build/schemas/typographyToken.d.ts +14 -55
- package/dist/build/schemas/validTokenType.d.ts +1 -1
- package/dist/build/schemas/validTokenType.js +8 -3
- package/dist/build/schemas/viewportRangeToken.d.ts +4 -15
- package/dist/build/types/tokenBuildInput.d.ts +2 -0
- package/dist/build/utilities/log.js +0 -3
- package/dist/css/functional/themes/dark-colorblind-high-contrast.css +10 -0
- package/dist/css/functional/themes/dark-colorblind.css +10 -0
- package/dist/css/functional/themes/dark-dimmed-high-contrast.css +10 -0
- package/dist/css/functional/themes/dark-dimmed.css +10 -0
- package/dist/css/functional/themes/dark-high-contrast.css +10 -0
- package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +10 -0
- package/dist/css/functional/themes/dark-tritanopia.css +10 -0
- package/dist/css/functional/themes/dark.css +10 -0
- package/dist/css/functional/themes/light-colorblind-high-contrast.css +10 -0
- package/dist/css/functional/themes/light-colorblind.css +10 -0
- package/dist/css/functional/themes/light-high-contrast.css +10 -0
- package/dist/css/functional/themes/light-tritanopia-high-contrast.css +10 -0
- package/dist/css/functional/themes/light-tritanopia.css +10 -0
- package/dist/css/functional/themes/light.css +10 -0
- package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +349 -0
- package/dist/docs/functional/themes/dark-colorblind.json +349 -0
- package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +345 -0
- package/dist/docs/functional/themes/dark-dimmed.json +345 -0
- package/dist/docs/functional/themes/dark-high-contrast.json +345 -0
- package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +347 -0
- package/dist/docs/functional/themes/dark-tritanopia.json +349 -0
- package/dist/docs/functional/themes/dark.json +345 -0
- package/dist/docs/functional/themes/light-colorblind-high-contrast.json +347 -0
- package/dist/docs/functional/themes/light-colorblind.json +347 -0
- package/dist/docs/functional/themes/light-high-contrast.json +345 -0
- package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +347 -0
- package/dist/docs/functional/themes/light-tritanopia.json +347 -0
- package/dist/docs/functional/themes/light.json +345 -0
- package/dist/figma/figma.json +4 -14
- package/dist/figma/themes/dark-colorblind.json +97 -0
- package/dist/figma/themes/dark-dimmed.json +95 -0
- package/dist/figma/themes/dark-high-contrast.json +95 -0
- package/dist/figma/themes/dark-tritanopia.json +97 -0
- package/dist/figma/themes/dark.json +95 -0
- package/dist/figma/themes/light-colorblind.json +96 -0
- package/dist/figma/themes/light-high-contrast.json +95 -0
- package/dist/figma/themes/light-tritanopia.json +96 -0
- package/dist/figma/themes/light.json +95 -0
- package/dist/internalCss/dark-colorblind-high-contrast.css +10 -0
- package/dist/internalCss/dark-colorblind.css +10 -0
- package/dist/internalCss/dark-dimmed-high-contrast.css +10 -0
- package/dist/internalCss/dark-dimmed.css +10 -0
- package/dist/internalCss/dark-high-contrast.css +10 -0
- package/dist/internalCss/dark-tritanopia-high-contrast.css +10 -0
- package/dist/internalCss/dark-tritanopia.css +10 -0
- package/dist/internalCss/dark.css +10 -0
- package/dist/internalCss/light-colorblind-high-contrast.css +10 -0
- package/dist/internalCss/light-colorblind.css +10 -0
- package/dist/internalCss/light-high-contrast.css +10 -0
- package/dist/internalCss/light-tritanopia-high-contrast.css +10 -0
- package/dist/internalCss/light-tritanopia.css +10 -0
- package/dist/internalCss/light.css +10 -0
- package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +349 -0
- package/dist/styleLint/functional/themes/dark-colorblind.json +349 -0
- package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +345 -0
- package/dist/styleLint/functional/themes/dark-dimmed.json +345 -0
- package/dist/styleLint/functional/themes/dark-high-contrast.json +345 -0
- package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +347 -0
- package/dist/styleLint/functional/themes/dark-tritanopia.json +349 -0
- package/dist/styleLint/functional/themes/dark.json +345 -0
- package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +347 -0
- package/dist/styleLint/functional/themes/light-colorblind.json +347 -0
- package/dist/styleLint/functional/themes/light-high-contrast.json +345 -0
- package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +347 -0
- package/dist/styleLint/functional/themes/light-tritanopia.json +347 -0
- package/dist/styleLint/functional/themes/light.json +345 -0
- package/package.json +17 -17
- package/src/tokens/functional/color/bgColor.json5 +48 -0
- package/src/tokens/functional/color/borderColor.json5 +64 -0
- package/src/tokens/functional/color/fgColor.json5 +14 -0
- package/dist/figma/themes/dark-colorblind-high-contrast.json +0 -14341
- package/dist/figma/themes/dark-dimmed-high-contrast.json +0 -14335
- package/dist/figma/themes/dark-tritanopia-high-contrast.json +0 -14337
- package/dist/figma/themes/light-colorblind-high-contrast.json +0 -14321
- package/dist/figma/themes/light-tritanopia-high-contrast.json +0 -14320
|
@@ -64,7 +64,7 @@ export const colorToken = baseColorToken
|
|
|
64
64
|
'dark-dimmed': override,
|
|
65
65
|
'dark-dimmed-high-contrast': override,
|
|
66
66
|
}, {
|
|
67
|
-
|
|
67
|
+
error: e => {
|
|
68
68
|
if (e.code === 'unrecognized_keys') {
|
|
69
69
|
return {
|
|
70
70
|
message: `Unrecognized key: "${e.keys.join(', ')}", must be one of: light, light-tritanopia, light-protanopia-deuteranopia, light-high-contrast, dark, dark-tritanopia, dark-protanopia-deuteranopia, dark-high-contrast, dark-dimmed`,
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const cubicBezierToken: z.ZodObject<
|
|
2
|
+
export declare const cubicBezierToken: z.ZodObject<{
|
|
3
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>]>;
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
|
+
$value: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, z.ZodString]>;
|
|
7
6
|
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
|
-
}
|
|
9
|
-
$value: string | number[];
|
|
10
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "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" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
16
|
-
$description?: string | undefined;
|
|
17
|
-
$deprecated?: string | boolean | undefined;
|
|
18
|
-
}>;
|
|
7
|
+
}, z.core.$strict>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const designToken: z.ZodRecord<z.
|
|
2
|
+
export declare const designToken: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
@@ -1,59 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const dimensionToken: z.ZodObject<
|
|
2
|
+
export declare const dimensionToken: z.ZodObject<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
|
-
|
|
6
|
-
$value: z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
|
+
$value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodString]>;
|
|
7
6
|
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
7
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
9
8
|
'org.primer.figma': z.ZodObject<{
|
|
10
|
-
collection: z.
|
|
11
|
-
scopes: z.
|
|
9
|
+
collection: z.ZodString;
|
|
10
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
12
11
|
group: z.ZodOptional<z.ZodString>;
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
group?: string | undefined;
|
|
17
|
-
}, {
|
|
18
|
-
collection: string;
|
|
19
|
-
scopes: string[];
|
|
20
|
-
group?: string | undefined;
|
|
21
|
-
}>;
|
|
22
|
-
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
'org.primer.figma': {
|
|
24
|
-
collection: string;
|
|
25
|
-
scopes: string[];
|
|
26
|
-
group?: string | undefined;
|
|
27
|
-
};
|
|
28
|
-
}, {
|
|
29
|
-
'org.primer.figma': {
|
|
30
|
-
collection: string;
|
|
31
|
-
scopes: string[];
|
|
32
|
-
group?: string | undefined;
|
|
33
|
-
};
|
|
34
|
-
}>>;
|
|
35
|
-
}>, "strict", z.ZodTypeAny, {
|
|
36
|
-
$value: string | 0;
|
|
37
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
38
|
-
$description?: string | undefined;
|
|
39
|
-
$deprecated?: string | boolean | undefined;
|
|
40
|
-
$extensions?: {
|
|
41
|
-
'org.primer.figma': {
|
|
42
|
-
collection: string;
|
|
43
|
-
scopes: string[];
|
|
44
|
-
group?: string | undefined;
|
|
45
|
-
};
|
|
46
|
-
} | undefined;
|
|
47
|
-
}, {
|
|
48
|
-
$value: string | 0;
|
|
49
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
50
|
-
$description?: string | undefined;
|
|
51
|
-
$deprecated?: string | boolean | undefined;
|
|
52
|
-
$extensions?: {
|
|
53
|
-
'org.primer.figma': {
|
|
54
|
-
collection: string;
|
|
55
|
-
scopes: string[];
|
|
56
|
-
group?: string | undefined;
|
|
57
|
-
};
|
|
58
|
-
} | undefined;
|
|
59
|
-
}>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
}, z.core.$strict>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const dimensionValue: z.ZodUnion<[z.
|
|
2
|
+
export declare const dimensionValue: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { schemaErrorMessage } from '../utilities/index.js';
|
|
3
3
|
export const dimensionValue = z.union([
|
|
4
|
-
z.string().
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
z.string().superRefine((dim, ctx) => {
|
|
5
|
+
if (!/(^-?[0-9]+(px|rem)$|^-?[0-9]+\.?[0-9]*em$)/.test(dim)) {
|
|
6
|
+
ctx.addIssue({
|
|
7
|
+
code: 'custom',
|
|
8
|
+
message: schemaErrorMessage(`Invalid dimension: "${dim}"`, `Dimension must be a string with a unit (px, rem or em) or 0`),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}),
|
|
7
12
|
z.literal('0'),
|
|
8
13
|
z.literal(0),
|
|
9
14
|
]);
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const durationToken: z.ZodObject<
|
|
2
|
+
export declare const durationToken: z.ZodObject<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
|
-
|
|
6
|
-
$value: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
|
+
$value: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
7
6
|
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
|
-
}
|
|
9
|
-
$value: string;
|
|
10
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
11
|
-
$description?: string | undefined;
|
|
12
|
-
$deprecated?: string | boolean | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
$value: string;
|
|
15
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
16
|
-
$description?: string | undefined;
|
|
17
|
-
$deprecated?: string | boolean | undefined;
|
|
18
|
-
}>;
|
|
7
|
+
}, z.core.$strict>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const durationValue: z.
|
|
2
|
+
export declare const durationValue: z.ZodString;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { schemaErrorMessage } from '../utilities/index.js';
|
|
3
|
-
export const durationValue = z.string().
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export const durationValue = z.string().superRefine((duration, ctx) => {
|
|
4
|
+
if (!/^[0-9]+ms$/.test(duration)) {
|
|
5
|
+
ctx.addIssue({
|
|
6
|
+
code: 'custom',
|
|
7
|
+
message: schemaErrorMessage(`Invalid duration: "${duration}"`, `A duration must be a string with an "ms"`),
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
});
|
|
@@ -1,52 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const fontFamilyToken: z.ZodObject<
|
|
2
|
+
export declare const fontFamilyToken: z.ZodObject<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
|
-
|
|
6
|
-
$value: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>;
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
|
+
$value: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
7
6
|
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
7
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
9
8
|
'org.primer.figma': z.ZodObject<{
|
|
10
|
-
collection: z.ZodOptional<z.
|
|
11
|
-
scopes: z.ZodOptional<z.
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, {
|
|
16
|
-
collection?: string | undefined;
|
|
17
|
-
scopes?: string[] | undefined;
|
|
18
|
-
}>;
|
|
19
|
-
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
'org.primer.figma': {
|
|
21
|
-
collection?: string | undefined;
|
|
22
|
-
scopes?: string[] | undefined;
|
|
23
|
-
};
|
|
24
|
-
}, {
|
|
25
|
-
'org.primer.figma': {
|
|
26
|
-
collection?: string | undefined;
|
|
27
|
-
scopes?: string[] | undefined;
|
|
28
|
-
};
|
|
29
|
-
}>>;
|
|
30
|
-
}>, "strict", z.ZodTypeAny, {
|
|
31
|
-
$value: string;
|
|
32
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
33
|
-
$description?: string | undefined;
|
|
34
|
-
$deprecated?: string | boolean | undefined;
|
|
35
|
-
$extensions?: {
|
|
36
|
-
'org.primer.figma': {
|
|
37
|
-
collection?: string | undefined;
|
|
38
|
-
scopes?: string[] | undefined;
|
|
39
|
-
};
|
|
40
|
-
} | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
$value: string;
|
|
43
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
44
|
-
$description?: string | undefined;
|
|
45
|
-
$deprecated?: string | boolean | undefined;
|
|
46
|
-
$extensions?: {
|
|
47
|
-
'org.primer.figma': {
|
|
48
|
-
collection?: string | undefined;
|
|
49
|
-
scopes?: string[] | undefined;
|
|
50
|
-
};
|
|
51
|
-
} | undefined;
|
|
52
|
-
}>;
|
|
9
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
10
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
}, z.core.$strict>;
|
|
@@ -1,52 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const fontWeightToken: z.ZodObject<
|
|
2
|
+
export declare const fontWeightToken: z.ZodObject<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
|
-
}, {
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
6
5
|
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
7
|
-
$value: z.ZodUnion<[z.
|
|
6
|
+
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
8
7
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
9
8
|
'org.primer.figma': z.ZodObject<{
|
|
10
|
-
collection: z.ZodOptional<z.
|
|
11
|
-
scopes: z.ZodOptional<z.
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, {
|
|
16
|
-
collection?: string | undefined;
|
|
17
|
-
scopes?: string[] | undefined;
|
|
18
|
-
}>;
|
|
19
|
-
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
'org.primer.figma': {
|
|
21
|
-
collection?: string | undefined;
|
|
22
|
-
scopes?: string[] | undefined;
|
|
23
|
-
};
|
|
24
|
-
}, {
|
|
25
|
-
'org.primer.figma': {
|
|
26
|
-
collection?: string | undefined;
|
|
27
|
-
scopes?: string[] | undefined;
|
|
28
|
-
};
|
|
29
|
-
}>>;
|
|
30
|
-
}>, "strict", z.ZodTypeAny, {
|
|
31
|
-
$value: string | number;
|
|
32
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
33
|
-
$description?: string | undefined;
|
|
34
|
-
$deprecated?: string | boolean | undefined;
|
|
35
|
-
$extensions?: {
|
|
36
|
-
'org.primer.figma': {
|
|
37
|
-
collection?: string | undefined;
|
|
38
|
-
scopes?: string[] | undefined;
|
|
39
|
-
};
|
|
40
|
-
} | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
$value: string | number;
|
|
43
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
44
|
-
$description?: string | undefined;
|
|
45
|
-
$deprecated?: string | boolean | undefined;
|
|
46
|
-
$extensions?: {
|
|
47
|
-
'org.primer.figma': {
|
|
48
|
-
collection?: string | undefined;
|
|
49
|
-
scopes?: string[] | undefined;
|
|
50
|
-
};
|
|
51
|
-
} | undefined;
|
|
52
|
-
}>;
|
|
9
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
10
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
}, z.core.$strict>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const fontWeightValue: z.
|
|
2
|
+
export declare const fontWeightValue: z.ZodNumber;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { schemaErrorMessage } from '../utilities/index.js';
|
|
3
3
|
const allowed = [100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
4
|
-
export const fontWeightValue = z.number().
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export const fontWeightValue = z.number().superRefine((value, ctx) => {
|
|
5
|
+
if (!allowed.includes(value)) {
|
|
6
|
+
ctx.addIssue({
|
|
7
|
+
code: 'custom',
|
|
8
|
+
message: schemaErrorMessage(`Invalid font weight value: "${value}"`, `Font weight must be one of ${allowed.join(', ')}`),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
});
|
|
@@ -1,60 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const gradientToken: z.ZodObject<
|
|
2
|
+
export declare const gradientToken: z.ZodObject<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
color: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>;
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
|
+
$value: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
6
|
+
color: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
8
7
|
position: z.ZodNumber;
|
|
9
|
-
},
|
|
10
|
-
color: string;
|
|
11
|
-
position: number;
|
|
12
|
-
}, {
|
|
13
|
-
color: string;
|
|
14
|
-
position: number;
|
|
15
|
-
}>, "many">, z.ZodEffects<z.ZodString, string, string>]>;
|
|
8
|
+
}, z.core.$strip>>, z.ZodString]>;
|
|
16
9
|
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
17
10
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
18
11
|
'org.primer.gradient': z.ZodObject<{
|
|
19
12
|
angle: z.ZodOptional<z.ZodNumber>;
|
|
20
|
-
},
|
|
21
|
-
|
|
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" | "transition" | "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" | "transition" | "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
|
-
}>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
}, z.core.$strict>;
|
|
@@ -1,71 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const numberToken: z.ZodObject<
|
|
2
|
+
export declare const numberToken: z.ZodObject<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
$deprecated: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
5
|
-
|
|
6
|
-
$value: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, string, string>]>;
|
|
4
|
+
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
|
+
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
7
6
|
$type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
|
|
8
7
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
9
8
|
'org.primer.data': z.ZodOptional<z.ZodObject<{
|
|
10
9
|
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
},
|
|
12
|
-
fontSize?: number | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
fontSize?: number | undefined;
|
|
15
|
-
}>>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
16
11
|
'org.primer.figma': z.ZodOptional<z.ZodObject<{
|
|
17
|
-
collection: z.ZodOptional<z.
|
|
18
|
-
scopes: z.ZodOptional<z.
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, {
|
|
23
|
-
collection?: string | undefined;
|
|
24
|
-
scopes?: string[] | undefined;
|
|
25
|
-
}>>;
|
|
26
|
-
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
'org.primer.data'?: {
|
|
28
|
-
fontSize?: number | undefined;
|
|
29
|
-
} | undefined;
|
|
30
|
-
'org.primer.figma'?: {
|
|
31
|
-
collection?: string | undefined;
|
|
32
|
-
scopes?: string[] | undefined;
|
|
33
|
-
} | undefined;
|
|
34
|
-
}, {
|
|
35
|
-
'org.primer.data'?: {
|
|
36
|
-
fontSize?: number | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
'org.primer.figma'?: {
|
|
39
|
-
collection?: string | undefined;
|
|
40
|
-
scopes?: string[] | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
}>>;
|
|
43
|
-
}>, "strict", z.ZodTypeAny, {
|
|
44
|
-
$value: string | number;
|
|
45
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
46
|
-
$description?: string | undefined;
|
|
47
|
-
$deprecated?: string | boolean | undefined;
|
|
48
|
-
$extensions?: {
|
|
49
|
-
'org.primer.data'?: {
|
|
50
|
-
fontSize?: number | undefined;
|
|
51
|
-
} | undefined;
|
|
52
|
-
'org.primer.figma'?: {
|
|
53
|
-
collection?: string | undefined;
|
|
54
|
-
scopes?: string[] | undefined;
|
|
55
|
-
} | undefined;
|
|
56
|
-
} | undefined;
|
|
57
|
-
}, {
|
|
58
|
-
$value: string | number;
|
|
59
|
-
$type: "string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange";
|
|
60
|
-
$description?: string | undefined;
|
|
61
|
-
$deprecated?: string | boolean | undefined;
|
|
62
|
-
$extensions?: {
|
|
63
|
-
'org.primer.data'?: {
|
|
64
|
-
fontSize?: number | undefined;
|
|
65
|
-
} | undefined;
|
|
66
|
-
'org.primer.figma'?: {
|
|
67
|
-
collection?: string | undefined;
|
|
68
|
-
scopes?: string[] | undefined;
|
|
69
|
-
} | undefined;
|
|
70
|
-
} | undefined;
|
|
71
|
-
}>;
|
|
12
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
13
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strict>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const referenceValue: z.
|
|
2
|
+
export declare const referenceValue: z.ZodString;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { schemaErrorMessage } from '../utilities/index.js';
|
|
3
|
-
export const referenceValue = z.string().
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export const referenceValue = z.string().superRefine((value, ctx) => {
|
|
4
|
+
if (!/^{[\w-]+(\.[\w-]+)*(\.[\w-]+|\.@)}$/.test(value)) {
|
|
5
|
+
ctx.addIssue({
|
|
6
|
+
code: 'custom',
|
|
7
|
+
message: schemaErrorMessage(`Invalid reference: "${value}"`, 'Reference must be a string in the format "{path.to.token}".'),
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
declare const validScopes: readonly ["all", "bgColor", "fgColor", "borderColor", "borderWidth", "size", "gap", "radius", "effectColor", "effectFloat", "opacity", "fontFamily", "fontStyle", "fontWeight", "fontSize", "lineHeight", "letterSpacing", "paragraphSpacing", "paragraphIndent"];
|
|
3
3
|
export type ValidScope = (typeof validScopes)[number];
|
|
4
|
-
export declare const scopes: (scopeSubset?: ValidScope[]) => z.
|
|
4
|
+
export declare const scopes: (scopeSubset?: ValidScope[]) => z.ZodArray<z.ZodString>;
|
|
5
5
|
export {};
|
|
@@ -23,7 +23,12 @@ const validScopes = [
|
|
|
23
23
|
];
|
|
24
24
|
export const scopes = (scopeSubset) => {
|
|
25
25
|
const scopeArray = scopeSubset !== null && scopeSubset !== void 0 ? scopeSubset : validScopes;
|
|
26
|
-
return z.array(z.string()).
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
return z.array(z.string()).superRefine((value, ctx) => {
|
|
27
|
+
if (!value.every(item => scopeArray.includes(item))) {
|
|
28
|
+
ctx.addIssue({
|
|
29
|
+
code: 'custom',
|
|
30
|
+
message: schemaErrorMessage(`Invalid scope: "${value}"`, `Valid scopes are: ${joinFriendly(scopeArray)}`),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
29
34
|
};
|