@primer/primitives 0.0.0-20260130160751 → 0.0.0-20260207163214

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 (81) hide show
  1. package/dist/build/formats/jsonFigma.js +1 -8
  2. package/dist/build/schemas/borderToken.d.ts +4 -4
  3. package/dist/build/schemas/dimensionToken.d.ts +2 -2
  4. package/dist/build/schemas/dimensionValue.d.ts +13 -1
  5. package/dist/build/schemas/dimensionValue.js +23 -1
  6. package/dist/build/schemas/shadowToken.d.ts +168 -168
  7. package/dist/build/schemas/typographyToken.d.ts +8 -8
  8. package/dist/build/transformers/shadowToCss.js +1 -12
  9. package/dist/build/types/shadowTokenValue.d.ts +4 -6
  10. package/dist/css/functional/themes/dark-colorblind-high-contrast.css +28 -28
  11. package/dist/css/functional/themes/dark-colorblind.css +28 -28
  12. package/dist/css/functional/themes/dark-dimmed-high-contrast.css +28 -28
  13. package/dist/css/functional/themes/dark-dimmed.css +28 -28
  14. package/dist/css/functional/themes/dark-high-contrast.css +28 -28
  15. package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +28 -28
  16. package/dist/css/functional/themes/dark-tritanopia.css +28 -28
  17. package/dist/css/functional/themes/dark.css +28 -28
  18. package/dist/css/functional/themes/light-colorblind-high-contrast.css +28 -28
  19. package/dist/css/functional/themes/light-colorblind.css +28 -28
  20. package/dist/css/functional/themes/light-high-contrast.css +28 -28
  21. package/dist/css/functional/themes/light-tritanopia-high-contrast.css +28 -28
  22. package/dist/css/functional/themes/light-tritanopia.css +28 -28
  23. package/dist/css/functional/themes/light.css +28 -28
  24. package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +338 -1310
  25. package/dist/docs/functional/themes/dark-colorblind.json +338 -1310
  26. package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +338 -1310
  27. package/dist/docs/functional/themes/dark-dimmed.json +338 -1310
  28. package/dist/docs/functional/themes/dark-high-contrast.json +338 -1310
  29. package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +338 -1310
  30. package/dist/docs/functional/themes/dark-tritanopia.json +338 -1310
  31. package/dist/docs/functional/themes/dark.json +338 -1310
  32. package/dist/docs/functional/themes/light-colorblind-high-contrast.json +330 -1278
  33. package/dist/docs/functional/themes/light-colorblind.json +330 -1278
  34. package/dist/docs/functional/themes/light-high-contrast.json +330 -1278
  35. package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +330 -1278
  36. package/dist/docs/functional/themes/light-tritanopia.json +330 -1278
  37. package/dist/docs/functional/themes/light.json +330 -1278
  38. package/dist/figma/dimension/dimension.json +1109 -0
  39. package/dist/figma/figma.json +124 -0
  40. package/dist/figma/themes/dark-colorblind.json +15104 -0
  41. package/dist/figma/themes/dark-dimmed.json +15089 -0
  42. package/dist/figma/themes/dark-high-contrast.json +15098 -0
  43. package/dist/figma/themes/dark-tritanopia.json +15097 -0
  44. package/dist/figma/themes/dark.json +15095 -0
  45. package/dist/figma/themes/light-colorblind.json +15082 -0
  46. package/dist/figma/themes/light-high-contrast.json +15076 -0
  47. package/dist/figma/themes/light-tritanopia.json +15080 -0
  48. package/dist/figma/themes/light.json +15076 -0
  49. package/dist/figma/typography/typography.json +472 -0
  50. package/dist/internalCss/dark-colorblind-high-contrast.css +28 -28
  51. package/dist/internalCss/dark-colorblind.css +28 -28
  52. package/dist/internalCss/dark-dimmed-high-contrast.css +28 -28
  53. package/dist/internalCss/dark-dimmed.css +28 -28
  54. package/dist/internalCss/dark-high-contrast.css +28 -28
  55. package/dist/internalCss/dark-tritanopia-high-contrast.css +28 -28
  56. package/dist/internalCss/dark-tritanopia.css +28 -28
  57. package/dist/internalCss/dark.css +28 -28
  58. package/dist/internalCss/light-colorblind-high-contrast.css +28 -28
  59. package/dist/internalCss/light-colorblind.css +28 -28
  60. package/dist/internalCss/light-high-contrast.css +28 -28
  61. package/dist/internalCss/light-tritanopia-high-contrast.css +28 -28
  62. package/dist/internalCss/light-tritanopia.css +28 -28
  63. package/dist/internalCss/light.css +28 -28
  64. package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +338 -1310
  65. package/dist/styleLint/functional/themes/dark-colorblind.json +338 -1310
  66. package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +338 -1310
  67. package/dist/styleLint/functional/themes/dark-dimmed.json +338 -1310
  68. package/dist/styleLint/functional/themes/dark-high-contrast.json +338 -1310
  69. package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +338 -1310
  70. package/dist/styleLint/functional/themes/dark-tritanopia.json +338 -1310
  71. package/dist/styleLint/functional/themes/dark.json +338 -1310
  72. package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +330 -1278
  73. package/dist/styleLint/functional/themes/light-colorblind.json +330 -1278
  74. package/dist/styleLint/functional/themes/light-high-contrast.json +330 -1278
  75. package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +330 -1278
  76. package/dist/styleLint/functional/themes/light-tritanopia.json +330 -1278
  77. package/dist/styleLint/functional/themes/light.json +330 -1278
  78. package/package.json +1 -1
  79. package/src/tokens/component/avatar.json5 +44 -72
  80. package/src/tokens/component/button.json5 +1193 -1545
  81. package/src/tokens/functional/shadow/shadow.json5 +152 -608
@@ -35,17 +35,10 @@ const getFigmaType = (type) => {
35
35
  throw new Error(`Invalid type: ${type}`);
36
36
  };
37
37
  const shadowToVariables = (name, values, token) => {
38
- // Helper to extract numeric value from W3C dimension object
39
- const getDimensionValue = (dim) => {
40
- if (typeof dim === 'object' && 'value' in dim) {
41
- return dim.value;
42
- }
43
- throw new Error(`Invalid shadow dimension: expected W3C object format, got ${JSON.stringify(dim)}`);
44
- };
45
38
  // floatValue
46
39
  const floatValue = (property) => ({
47
40
  name: `${name}/${property}`,
48
- value: getDimensionValue(values[property]),
41
+ value: parseInt(values[property].replace('px', '')),
49
42
  type: 'FLOAT',
50
43
  scopes: ['EFFECT_FLOAT'],
51
44
  mode,
@@ -11,14 +11,14 @@ export declare const borderValue: z.ZodObject<{
11
11
  ridge: "ridge";
12
12
  outset: "outset";
13
13
  }>;
14
- width: z.ZodUnion<readonly [z.ZodObject<{
14
+ width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
15
15
  value: z.ZodNumber;
16
16
  unit: z.ZodEnum<{
17
17
  em: "em";
18
18
  px: "px";
19
19
  rem: "rem";
20
20
  }>;
21
- }, z.core.$strict>, z.ZodString]>;
21
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
22
22
  }, z.core.$strip>;
23
23
  export declare const borderToken: z.ZodObject<{
24
24
  $description: z.ZodOptional<z.ZodString>;
@@ -35,14 +35,14 @@ export declare const borderToken: z.ZodObject<{
35
35
  ridge: "ridge";
36
36
  outset: "outset";
37
37
  }>;
38
- width: z.ZodUnion<readonly [z.ZodObject<{
38
+ width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
39
39
  value: z.ZodNumber;
40
40
  unit: z.ZodEnum<{
41
41
  em: "em";
42
42
  px: "px";
43
43
  rem: "rem";
44
44
  }>;
45
- }, z.core.$strict>, z.ZodString]>;
45
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
46
46
  }, z.core.$strip>, z.ZodString]>;
47
47
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
48
48
  $extensions: z.ZodOptional<z.ZodObject<{
@@ -2,14 +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.ZodObject<{
5
+ $value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
6
6
  value: z.ZodNumber;
7
7
  unit: z.ZodEnum<{
8
8
  em: "em";
9
9
  px: "px";
10
10
  rem: "rem";
11
11
  }>;
12
- }, z.core.$strict>, z.ZodString]>;
12
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
13
13
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
14
14
  $extensions: z.ZodOptional<z.ZodObject<{
15
15
  'org.primer.figma': z.ZodOptional<z.ZodObject<{
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  * W3C DTCG dimension value format
4
4
  * @link https://www.designtokens.org/tr/drafts/format/#dimension
5
5
  */
6
- export declare const dimensionValue: z.ZodObject<{
6
+ export declare const dimensionValueObject: z.ZodObject<{
7
7
  value: z.ZodNumber;
8
8
  unit: z.ZodEnum<{
9
9
  em: "em";
@@ -11,3 +11,15 @@ export declare const dimensionValue: z.ZodObject<{
11
11
  rem: "rem";
12
12
  }>;
13
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,11 +1,33 @@
1
1
  import { z } from 'zod';
2
+ import { schemaErrorMessage } from '../utilities/index.js';
2
3
  /**
3
4
  * W3C DTCG dimension value format
4
5
  * @link https://www.designtokens.org/tr/drafts/format/#dimension
5
6
  */
6
- export const dimensionValue = z
7
+ export const dimensionValueObject = z
7
8
  .object({
8
9
  value: z.number(),
9
10
  unit: z.enum(['px', 'rem', 'em']),
10
11
  })
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([
18
+ z.string().superRefine((dim, ctx) => {
19
+ if (!/(^-?[0-9]+\.?[0-9]*(px|rem)$|^-?[0-9]+\.?[0-9]*em$)/.test(dim)) {
20
+ ctx.addIssue({
21
+ code: 'custom',
22
+ message: schemaErrorMessage(`Invalid dimension: "${dim}"`, `Dimension must be a string with a unit (px, rem or em) or 0`),
23
+ });
24
+ }
25
+ }),
26
+ z.literal('0'),
27
+ z.literal(0),
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]);