@primer/primitives 11.4.1-rc.6196071f → 11.4.1-rc.7729391c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/build/schemas/borderToken.d.ts +16 -2
  2. package/dist/build/schemas/dimensionToken.d.ts +8 -1
  3. package/dist/build/schemas/dimensionValue.d.ts +24 -1
  4. package/dist/build/schemas/dimensionValue.js +20 -1
  5. package/dist/build/schemas/shadowToken.d.ts +672 -84
  6. package/dist/build/schemas/typographyToken.d.ts +32 -4
  7. package/dist/build/transformers/dimensionToPixelUnitless.d.ts +3 -2
  8. package/dist/build/transformers/dimensionToPixelUnitless.js +22 -26
  9. package/dist/build/transformers/dimensionToRem.d.ts +2 -1
  10. package/dist/build/transformers/dimensionToRem.js +21 -22
  11. package/dist/build/transformers/dimensionToRemPxArray.d.ts +2 -1
  12. package/dist/build/transformers/dimensionToRemPxArray.js +21 -22
  13. package/dist/build/transformers/utilities/parseDimension.d.ts +12 -0
  14. package/dist/build/transformers/utilities/parseDimension.js +31 -0
  15. package/dist/build/types/dimensionTokenValue.d.ts +9 -0
  16. package/dist/docs/base/size/size.json +76 -19
  17. package/dist/docs/base/typography/typography.json +24 -6
  18. package/dist/docs/functional/size/border.json +20 -5
  19. package/dist/docs/functional/size/breakpoints.json +24 -6
  20. package/dist/docs/functional/size/radius.json +16 -4
  21. package/dist/docs/functional/size/size.json +60 -15
  22. package/dist/docs/functional/typography/typography.json +8 -2
  23. package/dist/styleLint/base/size/size.json +76 -19
  24. package/dist/styleLint/base/typography/typography.json +30 -12
  25. package/dist/styleLint/functional/size/border.json +21 -6
  26. package/dist/styleLint/functional/size/breakpoints.json +24 -6
  27. package/dist/styleLint/functional/size/radius.json +17 -5
  28. package/dist/styleLint/functional/size/size-coarse.json +3 -3
  29. package/dist/styleLint/functional/size/size-fine.json +3 -3
  30. package/dist/styleLint/functional/size/size.json +111 -66
  31. package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +27 -27
  32. package/dist/styleLint/functional/themes/dark-colorblind.json +27 -27
  33. package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +27 -27
  34. package/dist/styleLint/functional/themes/dark-dimmed.json +27 -27
  35. package/dist/styleLint/functional/themes/dark-high-contrast.json +27 -27
  36. package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +27 -27
  37. package/dist/styleLint/functional/themes/dark-tritanopia.json +27 -27
  38. package/dist/styleLint/functional/themes/dark.json +27 -27
  39. package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +27 -27
  40. package/dist/styleLint/functional/themes/light-colorblind.json +27 -27
  41. package/dist/styleLint/functional/themes/light-high-contrast.json +27 -27
  42. package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +27 -27
  43. package/dist/styleLint/functional/themes/light-tritanopia.json +27 -27
  44. package/dist/styleLint/functional/themes/light.json +27 -27
  45. package/dist/styleLint/functional/typography/typography.json +28 -22
  46. package/package.json +1 -1
  47. package/src/tokens/base/size/size.json5 +19 -19
  48. package/src/tokens/base/typography/typography.json5 +6 -6
  49. package/src/tokens/functional/size/border.json5 +5 -5
  50. package/src/tokens/functional/size/breakpoints.json5 +6 -6
  51. package/src/tokens/functional/size/radius.json5 +4 -4
  52. package/src/tokens/functional/size/size.json5 +15 -15
  53. package/src/tokens/functional/typography/typography.json5 +8 -4
  54. package/dist/removed/testing.json5 +0 -4
  55. package/src/tokens/removed/testing.json5 +0 -4
@@ -11,7 +11,14 @@ export declare const borderValue: z.ZodObject<{
11
11
  ridge: "ridge";
12
12
  outset: "outset";
13
13
  }>;
14
- width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodString]>;
14
+ width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
15
+ value: z.ZodNumber;
16
+ unit: z.ZodEnum<{
17
+ em: "em";
18
+ px: "px";
19
+ rem: "rem";
20
+ }>;
21
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
15
22
  }, z.core.$strip>;
16
23
  export declare const borderToken: z.ZodObject<{
17
24
  $description: z.ZodOptional<z.ZodString>;
@@ -28,7 +35,14 @@ export declare const borderToken: z.ZodObject<{
28
35
  ridge: "ridge";
29
36
  outset: "outset";
30
37
  }>;
31
- width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodString]>;
38
+ width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
39
+ value: z.ZodNumber;
40
+ unit: z.ZodEnum<{
41
+ em: "em";
42
+ px: "px";
43
+ rem: "rem";
44
+ }>;
45
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
32
46
  }, z.core.$strip>, z.ZodString]>;
33
47
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
34
48
  $extensions: z.ZodOptional<z.ZodObject<{
@@ -2,7 +2,14 @@ import { z } from 'zod';
2
2
  export declare const dimensionToken: z.ZodObject<{
3
3
  $description: z.ZodOptional<z.ZodString>;
4
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]>;
5
+ $value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
6
+ value: z.ZodNumber;
7
+ unit: z.ZodEnum<{
8
+ em: "em";
9
+ px: "px";
10
+ rem: "rem";
11
+ }>;
12
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
6
13
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
14
  $extensions: z.ZodOptional<z.ZodObject<{
8
15
  'org.primer.figma': z.ZodOptional<z.ZodObject<{
@@ -1,2 +1,25 @@
1
1
  import { z } from 'zod';
2
- export declare const dimensionValue: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>;
2
+ /**
3
+ * W3C DTCG dimension value format
4
+ * @link https://www.designtokens.org/tr/drafts/format/#dimension
5
+ */
6
+ export declare const dimensionValueObject: z.ZodObject<{
7
+ value: z.ZodNumber;
8
+ unit: z.ZodEnum<{
9
+ em: "em";
10
+ px: "px";
11
+ rem: "rem";
12
+ }>;
13
+ }, z.core.$strict>;
14
+ /**
15
+ * Dimension value - supports both W3C DTCG object format and legacy string format
16
+ * Note: Transformers only accept W3C format, but schema validates both for migration period
17
+ */
18
+ export declare const dimensionValue: z.ZodUnion<readonly [z.ZodObject<{
19
+ value: z.ZodNumber;
20
+ unit: z.ZodEnum<{
21
+ em: "em";
22
+ px: "px";
23
+ rem: "rem";
24
+ }>;
25
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>;
@@ -1,6 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  import { schemaErrorMessage } from '../utilities/index.js';
3
- export const dimensionValue = z.union([
3
+ /**
4
+ * W3C DTCG dimension value format
5
+ * @link https://www.designtokens.org/tr/drafts/format/#dimension
6
+ */
7
+ export const dimensionValueObject = z
8
+ .object({
9
+ value: z.number(),
10
+ unit: z.enum(['px', 'rem', 'em']),
11
+ })
12
+ .strict();
13
+ /**
14
+ * Legacy dimension value format (string with unit)
15
+ * @deprecated Use W3C DTCG object format instead
16
+ */
17
+ const dimensionValueLegacy = z.union([
4
18
  z.string().superRefine((dim, ctx) => {
5
19
  if (!/(^-?[0-9]+\.?[0-9]*(px|rem)$|^-?[0-9]+\.?[0-9]*em$)/.test(dim)) {
6
20
  ctx.addIssue({
@@ -12,3 +26,8 @@ export const dimensionValue = z.union([
12
26
  z.literal('0'),
13
27
  z.literal(0),
14
28
  ]);
29
+ /**
30
+ * Dimension value - supports both W3C DTCG object format and legacy string format
31
+ * Note: Transformers only accept W3C format, but schema validates both for migration period
32
+ */
33
+ export const dimensionValue = z.union([dimensionValueObject, dimensionValueLegacy]);