@primer/primitives 11.4.0-rc.b3c35298 → 11.4.0-rc.bbfc39e6

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 (174) hide show
  1. package/dist/build/filters/hasLlmExtensions.d.ts +7 -0
  2. package/dist/build/filters/hasLlmExtensions.js +11 -0
  3. package/dist/build/filters/index.d.ts +1 -0
  4. package/dist/build/filters/index.js +1 -0
  5. package/dist/build/formats/index.d.ts +1 -0
  6. package/dist/build/formats/index.js +1 -0
  7. package/dist/build/formats/markdownLlmGuidelines.d.ts +10 -0
  8. package/dist/build/formats/markdownLlmGuidelines.js +194 -0
  9. package/dist/build/platforms/css.js +2 -2
  10. package/dist/build/platforms/index.d.ts +1 -0
  11. package/dist/build/platforms/index.js +1 -0
  12. package/dist/build/platforms/llmGuidelines.d.ts +2 -0
  13. package/dist/build/platforms/llmGuidelines.js +17 -0
  14. package/dist/build/preprocessors/inheritGroupProperties.d.ts +7 -0
  15. package/dist/build/preprocessors/inheritGroupProperties.js +70 -0
  16. package/dist/build/primerStyleDictionary.js +7 -1
  17. package/dist/build/schemas/borderToken.d.ts +6 -0
  18. package/dist/build/schemas/borderToken.js +6 -0
  19. package/dist/build/schemas/colorToken.d.ts +4 -0
  20. package/dist/build/schemas/colorToken.js +2 -0
  21. package/dist/build/schemas/cubicBezierToken.d.ts +6 -0
  22. package/dist/build/schemas/cubicBezierToken.js +10 -2
  23. package/dist/build/schemas/designToken.d.ts +1 -1
  24. package/dist/build/schemas/designToken.js +113 -21
  25. package/dist/build/schemas/dimensionToken.d.ts +6 -2
  26. package/dist/build/schemas/dimensionToken.js +7 -3
  27. package/dist/build/schemas/dimensionValue.js +1 -1
  28. package/dist/build/schemas/durationToken.d.ts +6 -0
  29. package/dist/build/schemas/durationToken.js +6 -0
  30. package/dist/build/schemas/fontFamilyToken.d.ts +4 -0
  31. package/dist/build/schemas/fontFamilyToken.js +2 -0
  32. package/dist/build/schemas/fontWeightToken.d.ts +4 -0
  33. package/dist/build/schemas/fontWeightToken.js +2 -0
  34. package/dist/build/schemas/gradientToken.d.ts +4 -0
  35. package/dist/build/schemas/gradientToken.js +2 -0
  36. package/dist/build/schemas/llmExtension.d.ts +9 -0
  37. package/dist/build/schemas/llmExtension.js +11 -0
  38. package/dist/build/schemas/numberToken.d.ts +4 -0
  39. package/dist/build/schemas/numberToken.js +2 -0
  40. package/dist/build/schemas/shadowToken.d.ts +4 -0
  41. package/dist/build/schemas/shadowToken.js +2 -0
  42. package/dist/build/schemas/stringToken.d.ts +6 -0
  43. package/dist/build/schemas/stringToken.js +6 -0
  44. package/dist/build/schemas/transitionToken.d.ts +6 -0
  45. package/dist/build/schemas/transitionToken.js +6 -0
  46. package/dist/build/schemas/typographyToken.d.ts +6 -0
  47. package/dist/build/schemas/typographyToken.js +6 -0
  48. package/dist/build/schemas/validTokenType.d.ts +5 -1
  49. package/dist/build/schemas/validTokenType.js +71 -17
  50. package/dist/build/schemas/viewportRangeToken.d.ts +6 -0
  51. package/dist/build/schemas/viewportRangeToken.js +6 -0
  52. package/dist/css/base/motion/motion.css +5 -4
  53. package/dist/css/base/typography/typography.css +6 -0
  54. package/dist/css/functional/size/border.css +9 -14
  55. package/dist/css/functional/size/radius.css +7 -0
  56. package/dist/css/functional/size/size-coarse.css +3 -3
  57. package/dist/css/functional/size/size-fine.css +3 -3
  58. package/dist/css/functional/size/viewport.css +1 -1
  59. package/dist/css/functional/themes/dark-colorblind-high-contrast.css +178 -181
  60. package/dist/css/functional/themes/dark-colorblind.css +178 -181
  61. package/dist/css/functional/themes/dark-dimmed-high-contrast.css +178 -181
  62. package/dist/css/functional/themes/dark-dimmed.css +178 -181
  63. package/dist/css/functional/themes/dark-high-contrast.css +178 -181
  64. package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +178 -181
  65. package/dist/css/functional/themes/dark-tritanopia.css +178 -181
  66. package/dist/css/functional/themes/dark.css +178 -181
  67. package/dist/css/functional/themes/light-colorblind-high-contrast.css +178 -181
  68. package/dist/css/functional/themes/light-colorblind.css +178 -181
  69. package/dist/css/functional/themes/light-high-contrast.css +178 -181
  70. package/dist/css/functional/themes/light-tritanopia-high-contrast.css +178 -181
  71. package/dist/css/functional/themes/light-tritanopia.css +178 -181
  72. package/dist/css/functional/themes/light.css +178 -181
  73. package/dist/css/functional/typography/typography.css +13 -13
  74. package/dist/css/primitives.css +1 -0
  75. package/dist/docs/base/motion/motion.json +85 -8
  76. package/dist/docs/base/typography/typography.json +174 -0
  77. package/dist/docs/functional/size/border.json +42 -177
  78. package/dist/docs/functional/size/radius.json +209 -0
  79. package/dist/docs/functional/size/size-coarse.json +45 -3
  80. package/dist/docs/functional/size/size-fine.json +45 -3
  81. package/dist/docs/functional/size/viewport.json +2 -2
  82. package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +934 -90
  83. package/dist/docs/functional/themes/dark-colorblind.json +934 -90
  84. package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +934 -90
  85. package/dist/docs/functional/themes/dark-dimmed.json +972 -128
  86. package/dist/docs/functional/themes/dark-high-contrast.json +934 -90
  87. package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +934 -90
  88. package/dist/docs/functional/themes/dark-tritanopia.json +934 -90
  89. package/dist/docs/functional/themes/dark.json +934 -90
  90. package/dist/docs/functional/themes/light-colorblind-high-contrast.json +934 -90
  91. package/dist/docs/functional/themes/light-colorblind.json +934 -90
  92. package/dist/docs/functional/themes/light-high-contrast.json +934 -90
  93. package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +934 -90
  94. package/dist/docs/functional/themes/light-tritanopia.json +934 -90
  95. package/dist/docs/functional/themes/light.json +934 -90
  96. package/dist/docs/functional/typography/typography.json +181 -17
  97. package/dist/fallbacks/base/motion/motion.json +1 -0
  98. package/dist/fallbacks/base/typography/typography.json +6 -0
  99. package/dist/fallbacks/functional/size/border.json +0 -5
  100. package/dist/fallbacks/functional/size/radius.json +7 -0
  101. package/dist/fallbacks/functional/size/viewport.json +1 -1
  102. package/dist/figma/dimension/dimension.json +30 -20
  103. package/dist/figma/themes/dark-colorblind.json +85 -0
  104. package/dist/figma/themes/dark-dimmed.json +134 -49
  105. package/dist/figma/themes/dark-high-contrast.json +85 -0
  106. package/dist/figma/themes/dark-tritanopia.json +85 -0
  107. package/dist/figma/themes/dark.json +85 -0
  108. package/dist/figma/themes/light-colorblind.json +85 -0
  109. package/dist/figma/themes/light-high-contrast.json +85 -0
  110. package/dist/figma/themes/light-tritanopia.json +85 -0
  111. package/dist/figma/themes/light.json +85 -0
  112. package/dist/figma/typography/typography.json +119 -40
  113. package/dist/internalCss/dark-colorblind-high-contrast.css +196 -209
  114. package/dist/internalCss/dark-colorblind.css +196 -209
  115. package/dist/internalCss/dark-dimmed-high-contrast.css +196 -209
  116. package/dist/internalCss/dark-dimmed.css +196 -209
  117. package/dist/internalCss/dark-high-contrast.css +196 -209
  118. package/dist/internalCss/dark-tritanopia-high-contrast.css +196 -209
  119. package/dist/internalCss/dark-tritanopia.css +196 -209
  120. package/dist/internalCss/dark.css +196 -209
  121. package/dist/internalCss/light-colorblind-high-contrast.css +196 -209
  122. package/dist/internalCss/light-colorblind.css +196 -209
  123. package/dist/internalCss/light-high-contrast.css +196 -209
  124. package/dist/internalCss/light-tritanopia-high-contrast.css +196 -209
  125. package/dist/internalCss/light-tritanopia.css +196 -209
  126. package/dist/internalCss/light.css +196 -209
  127. package/dist/styleLint/base/motion/motion.json +85 -8
  128. package/dist/styleLint/base/typography/typography.json +174 -0
  129. package/dist/styleLint/functional/size/border.json +34 -169
  130. package/dist/styleLint/functional/size/radius.json +209 -0
  131. package/dist/styleLint/functional/size/size-coarse.json +42 -0
  132. package/dist/styleLint/functional/size/size-fine.json +42 -0
  133. package/dist/styleLint/functional/size/viewport.json +2 -2
  134. package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +846 -2
  135. package/dist/styleLint/functional/themes/dark-colorblind.json +846 -2
  136. package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +846 -2
  137. package/dist/styleLint/functional/themes/dark-dimmed.json +884 -40
  138. package/dist/styleLint/functional/themes/dark-high-contrast.json +846 -2
  139. package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +846 -2
  140. package/dist/styleLint/functional/themes/dark-tritanopia.json +846 -2
  141. package/dist/styleLint/functional/themes/dark.json +846 -2
  142. package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +846 -2
  143. package/dist/styleLint/functional/themes/light-colorblind.json +846 -2
  144. package/dist/styleLint/functional/themes/light-high-contrast.json +846 -2
  145. package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +846 -2
  146. package/dist/styleLint/functional/themes/light-tritanopia.json +846 -2
  147. package/dist/styleLint/functional/themes/light.json +846 -2
  148. package/dist/styleLint/functional/typography/typography.json +195 -31
  149. package/guidelines/color.llm.md +16 -0
  150. package/guidelines/guidelines.llm.md +34 -0
  151. package/guidelines/motion.llm.md +41 -0
  152. package/guidelines/spacing.llm.md +20 -0
  153. package/guidelines/typography.llm.md +14 -0
  154. package/package.json +4 -2
  155. package/src/tokens/base/motion/easing.json5 +39 -4
  156. package/src/tokens/base/typography/typography.json5 +68 -0
  157. package/src/tokens/functional/border/border.json5 +25 -0
  158. package/src/tokens/functional/color/bgColor.json5 +157 -0
  159. package/src/tokens/functional/color/borderColor.json5 +146 -0
  160. package/src/tokens/functional/color/control.json5 +24 -0
  161. package/src/tokens/functional/color/data-vis.json5 +7 -0
  162. package/src/tokens/functional/color/fgColor.json5 +93 -1
  163. package/src/tokens/functional/color/focus.json5 +5 -0
  164. package/src/tokens/functional/color/selection.json5 +5 -0
  165. package/src/tokens/functional/shadow/shadow.json5 +10 -0
  166. package/src/tokens/functional/size/border.json5 +17 -69
  167. package/src/tokens/functional/size/radius.json5 +90 -0
  168. package/src/tokens/functional/size/size-coarse.json5 +24 -3
  169. package/src/tokens/functional/size/size-fine.json5 +45 -24
  170. package/src/tokens/functional/size/size.json5 +35 -0
  171. package/src/tokens/functional/size/viewport.json5 +1 -1
  172. package/src/tokens/functional/typography/font-stack.json5 +60 -0
  173. package/src/tokens/functional/typography/typography.json5 +76 -53
  174. package/token-guidelines.llm.md +695 -0
@@ -5,10 +5,14 @@ export declare const dimensionToken: z.ZodObject<{
5
5
  $value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodString]>;
6
6
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
7
  $extensions: z.ZodOptional<z.ZodObject<{
8
- 'org.primer.figma': z.ZodObject<{
8
+ 'org.primer.figma': z.ZodOptional<z.ZodObject<{
9
9
  collection: z.ZodString;
10
10
  scopes: z.ZodArray<z.ZodString>;
11
11
  group: z.ZodOptional<z.ZodString>;
12
- }, z.core.$strip>;
12
+ }, z.core.$strip>>;
13
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
14
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ rules: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>>;
13
17
  }, z.core.$strip>>;
14
18
  }, z.core.$strict>;
@@ -5,14 +5,16 @@ import { collection } from './collections.js';
5
5
  import { scopes } from './scopes.js';
6
6
  import { dimensionValue } from './dimensionValue.js';
7
7
  import { tokenType } from './tokenType.js';
8
+ import { llmExtension } from './llmExtension.js';
8
9
  export const dimensionToken = baseToken
9
10
  .extend({
10
11
  $value: z.union([dimensionValue, referenceValue]),
11
12
  $type: tokenType('dimension'),
12
13
  $extensions: z
13
14
  .object({
14
- 'org.primer.figma': z.object({
15
- collection: collection(['base/size', 'functional/size', 'pattern/size', 'typography']),
15
+ 'org.primer.figma': z
16
+ .object({
17
+ collection: collection(['base/size', 'base/typography', 'functional/size', 'pattern/size', 'typography']),
16
18
  scopes: scopes([
17
19
  'all',
18
20
  'size',
@@ -28,7 +30,9 @@ export const dimensionToken = baseToken
28
30
  'paragraphIndent',
29
31
  ]),
30
32
  group: z.string().optional(),
31
- }),
33
+ })
34
+ .optional(),
35
+ 'org.primer.llm': llmExtension,
32
36
  })
33
37
  .optional(),
34
38
  })
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { schemaErrorMessage } from '../utilities/index.js';
3
3
  export const dimensionValue = z.union([
4
4
  z.string().superRefine((dim, ctx) => {
5
- if (!/(^-?[0-9]+(px|rem)$|^-?[0-9]+\.?[0-9]*em$)/.test(dim)) {
5
+ if (!/(^-?[0-9]+\.?[0-9]*(px|rem)$|^-?[0-9]+\.?[0-9]*em$)/.test(dim)) {
6
6
  ctx.addIssue({
7
7
  code: 'custom',
8
8
  message: schemaErrorMessage(`Invalid dimension: "${dim}"`, `Dimension must be a string with a unit (px, rem or em) or 0`),
@@ -4,4 +4,10 @@ export declare const durationToken: z.ZodObject<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
5
5
  $value: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
6
6
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
+ $extensions: z.ZodOptional<z.ZodObject<{
8
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
9
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ rules: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>>;
7
13
  }, z.core.$strict>;
@@ -3,9 +3,15 @@ import { baseToken } from './baseToken.js';
3
3
  import { referenceValue } from './referenceValue.js';
4
4
  import { durationValue } from './durationValue.js';
5
5
  import { tokenType } from './tokenType.js';
6
+ import { llmExtension } from './llmExtension.js';
6
7
  export const durationToken = baseToken
7
8
  .extend({
8
9
  $value: z.union([durationValue, referenceValue]),
9
10
  $type: tokenType('duration'),
11
+ $extensions: z
12
+ .object({
13
+ 'org.primer.llm': llmExtension,
14
+ })
15
+ .optional(),
10
16
  })
11
17
  .strict();
@@ -9,5 +9,9 @@ export declare const fontFamilyToken: z.ZodObject<{
9
9
  collection: z.ZodOptional<z.ZodString>;
10
10
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
11
  }, z.core.$strip>;
12
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
13
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ rules: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>>;
12
16
  }, z.core.$strip>>;
13
17
  }, z.core.$strict>;
@@ -4,6 +4,7 @@ import { baseToken } from './baseToken.js';
4
4
  import { tokenType } from './tokenType.js';
5
5
  import { collection } from './collections.js';
6
6
  import { scopes } from './scopes.js';
7
+ import { llmExtension } from './llmExtension.js';
7
8
  export const fontFamilyToken = baseToken
8
9
  .extend({
9
10
  $value: z.union([z.string(), referenceValue]),
@@ -14,6 +15,7 @@ export const fontFamilyToken = baseToken
14
15
  collection: collection(['base/typography', 'typography']).optional(),
15
16
  scopes: scopes(['fontFamily']).optional(),
16
17
  }),
18
+ 'org.primer.llm': llmExtension,
17
19
  })
18
20
  .optional(),
19
21
  })
@@ -9,5 +9,9 @@ export declare const fontWeightToken: z.ZodObject<{
9
9
  collection: z.ZodOptional<z.ZodString>;
10
10
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
11
  }, z.core.$strip>;
12
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
13
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ rules: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>>;
12
16
  }, z.core.$strip>>;
13
17
  }, z.core.$strict>;
@@ -5,6 +5,7 @@ import { baseToken } from './baseToken.js';
5
5
  import { tokenType } from './tokenType.js';
6
6
  import { collection } from './collections.js';
7
7
  import { scopes } from './scopes.js';
8
+ import { llmExtension } from './llmExtension.js';
8
9
  export const fontWeightToken = baseToken
9
10
  .extend({
10
11
  $type: tokenType('fontWeight'),
@@ -15,6 +16,7 @@ export const fontWeightToken = baseToken
15
16
  collection: collection(['base/typography', 'typography']).optional(),
16
17
  scopes: scopes(['fontWeight']).optional(),
17
18
  }),
19
+ 'org.primer.llm': llmExtension,
18
20
  })
19
21
  .optional(),
20
22
  })
@@ -11,5 +11,9 @@ export declare const gradientToken: z.ZodObject<{
11
11
  'org.primer.gradient': z.ZodObject<{
12
12
  angle: z.ZodOptional<z.ZodNumber>;
13
13
  }, z.core.$strip>;
14
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
15
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
+ rules: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>>;
14
18
  }, z.core.$strip>>;
15
19
  }, z.core.$strict>;
@@ -3,6 +3,7 @@ import { baseToken } from './baseToken.js';
3
3
  import { referenceValue } from './referenceValue.js';
4
4
  import { tokenType } from './tokenType.js';
5
5
  import { colorHexValue } from './colorHexValue.js';
6
+ import { llmExtension } from './llmExtension.js';
6
7
  export const gradientToken = baseToken
7
8
  .extend({
8
9
  $value: z.union([
@@ -20,6 +21,7 @@ export const gradientToken = baseToken
20
21
  'org.primer.gradient': z.object({
21
22
  angle: z.number().int().min(0).max(360).optional(),
22
23
  }),
24
+ 'org.primer.llm': llmExtension,
23
25
  })
24
26
  .optional(),
25
27
  })
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Schema for org.primer.llm extension
4
+ * Used to provide LLM-friendly metadata for tokens
5
+ */
6
+ export declare const llmExtension: z.ZodOptional<z.ZodObject<{
7
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ rules: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>>;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Schema for org.primer.llm extension
4
+ * Used to provide LLM-friendly metadata for tokens
5
+ */
6
+ export const llmExtension = z
7
+ .object({
8
+ usage: z.array(z.string()).optional(),
9
+ rules: z.string().optional(),
10
+ })
11
+ .optional();
@@ -12,5 +12,9 @@ export declare const numberToken: z.ZodObject<{
12
12
  collection: z.ZodOptional<z.ZodString>;
13
13
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
14
  }, z.core.$strip>>;
15
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
16
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
17
+ rules: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strip>>;
15
19
  }, z.core.$strip>>;
16
20
  }, z.core.$strict>;
@@ -4,6 +4,7 @@ import { referenceValue } from './referenceValue.js';
4
4
  import { tokenType } from './tokenType.js';
5
5
  import { scopes } from './scopes.js';
6
6
  import { collection } from './collections.js';
7
+ import { llmExtension } from './llmExtension.js';
7
8
  export const numberToken = baseToken
8
9
  .extend({
9
10
  $value: z.union([z.number(), referenceValue]),
@@ -21,6 +22,7 @@ export const numberToken = baseToken
21
22
  scopes: scopes(['fontWeight', 'lineHeight']).optional(),
22
23
  })
23
24
  .optional(),
25
+ 'org.primer.llm': llmExtension,
24
26
  })
25
27
  .optional(),
26
28
  })
@@ -226,5 +226,9 @@ export declare const shadowToken: z.ZodObject<{
226
226
  }, z.core.$strict>>]>;
227
227
  }, z.core.$strict>]>>;
228
228
  }, z.core.$strict>>;
229
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
230
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
231
+ rules: z.ZodOptional<z.ZodString>;
232
+ }, z.core.$strip>>;
229
233
  }, z.core.$strip>>;
230
234
  }, z.core.$strict>;
@@ -6,6 +6,7 @@ import { alphaValue } from './alphaValue.js';
6
6
  import { dimensionValue } from './dimensionValue.js';
7
7
  import { tokenType } from './tokenType.js';
8
8
  import { collection, mode } from './collections.js';
9
+ import { llmExtension } from './llmExtension.js';
9
10
  export const shadowValue = z
10
11
  .object({
11
12
  color: z.union([colorHexValue, referenceValue]),
@@ -58,6 +59,7 @@ export const shadowToken = baseToken
58
59
  })
59
60
  .strict()
60
61
  .optional(),
62
+ 'org.primer.llm': llmExtension,
61
63
  })
62
64
  .optional(),
63
65
  })
@@ -4,4 +4,10 @@ export declare const stringToken: z.ZodObject<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
5
5
  $value: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
6
6
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
+ $extensions: z.ZodOptional<z.ZodObject<{
8
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
9
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ rules: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>>;
7
13
  }, z.core.$strict>;
@@ -2,9 +2,15 @@ import { z } from 'zod';
2
2
  import { baseToken } from './baseToken.js';
3
3
  import { referenceValue } from './referenceValue.js';
4
4
  import { tokenType } from './tokenType.js';
5
+ import { llmExtension } from './llmExtension.js';
5
6
  export const stringToken = baseToken
6
7
  .extend({
7
8
  $value: z.union([z.string(), referenceValue]),
8
9
  $type: tokenType('string'),
10
+ $extensions: z
11
+ .object({
12
+ 'org.primer.llm': llmExtension,
13
+ })
14
+ .optional(),
9
15
  })
10
16
  .strict();
@@ -8,4 +8,10 @@ export declare const transitionToken: z.ZodObject<{
8
8
  delay: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
9
9
  }, z.core.$strip>, z.ZodString]>;
10
10
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
11
+ $extensions: z.ZodOptional<z.ZodObject<{
12
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
13
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ rules: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>>;
16
+ }, z.core.$strip>>;
11
17
  }, z.core.$strict>;
@@ -4,6 +4,7 @@ import { referenceValue } from './referenceValue.js';
4
4
  import { durationToken } from './durationToken.js';
5
5
  import { cubicBezierToken } from './cubicBezierToken.js';
6
6
  import { tokenType } from './tokenType.js';
7
+ import { llmExtension } from './llmExtension.js';
7
8
  export const transitionToken = baseToken
8
9
  .extend({
9
10
  $value: z.union([
@@ -15,5 +16,10 @@ export const transitionToken = baseToken
15
16
  referenceValue,
16
17
  ]),
17
18
  $type: tokenType('transition'),
19
+ $extensions: z
20
+ .object({
21
+ 'org.primer.llm': llmExtension,
22
+ })
23
+ .optional(),
18
24
  })
19
25
  .strict();
@@ -15,4 +15,10 @@ export declare const typographyToken: z.ZodObject<{
15
15
  fontFamily: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
16
16
  }, z.core.$strip>, z.ZodString]>;
17
17
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
18
+ $extensions: z.ZodOptional<z.ZodObject<{
19
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
20
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
+ rules: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strip>>;
23
+ }, z.core.$strip>>;
18
24
  }, z.core.$strict>;
@@ -4,6 +4,7 @@ import { dimensionValue } from './dimensionValue.js';
4
4
  import { baseToken } from './baseToken.js';
5
5
  import { fontWeightValue } from './fontWeightValue.js';
6
6
  import { tokenType } from './tokenType.js';
7
+ import { llmExtension } from './llmExtension.js';
7
8
  export const typographyValue = z.object({
8
9
  fontSize: z.union([dimensionValue, referenceValue]),
9
10
  lineHeight: z.union([dimensionValue, referenceValue]).optional(),
@@ -14,5 +15,10 @@ export const typographyToken = baseToken
14
15
  .extend({
15
16
  $value: z.union([typographyValue, referenceValue]),
16
17
  $type: tokenType('typography'),
18
+ $extensions: z
19
+ .object({
20
+ 'org.primer.llm': llmExtension,
21
+ })
22
+ .optional(),
17
23
  })
18
24
  .strict();
@@ -1,5 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  declare const validTypes: readonly ["color", "cubicBezier", "typography", "dimension", "duration", "border", "shadow", "fontFamily", "fontWeight", "gradient", "number", "string", "transition", "custom-viewportRange"];
3
3
  export type TokenType = (typeof validTypes)[number];
4
- export declare const validateType: z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
4
+ /**
5
+ * Recursively validates $type properties in token structure
6
+ * Allows group-level properties ($description, $extensions) per W3C Design Tokens spec
7
+ */
8
+ export declare const validateType: z.ZodType<unknown>;
5
9
  export {};
@@ -16,23 +16,77 @@ const validTypes = [
16
16
  'transition',
17
17
  'custom-viewportRange',
18
18
  ];
19
+ /**
20
+ * Token schema that validates $type property
21
+ */
22
+ const tokenWithType = z
23
+ .object({
24
+ $value: z.any(),
25
+ $type: z.string().superRefine((value, ctx) => {
26
+ if (!validTypes.includes(value)) {
27
+ ctx.addIssue({
28
+ code: 'custom',
29
+ message: schemaErrorMessage(`Invalid token $type: "${value}"`, `Must be one of the following: ${joinFriendly([...validTypes], 'or')}`),
30
+ });
31
+ }
32
+ }),
33
+ })
34
+ .required();
35
+ /**
36
+ * Recursively validates $type properties in token structure
37
+ * Allows group-level properties ($description, $extensions) per W3C Design Tokens spec
38
+ */
19
39
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
20
40
  // @ts-ignore: TODO: fix this
21
- export const validateType = z.record(z.string(), z.lazy(() => {
22
- return z.union([
23
- z
24
- .object({
25
- $value: z.any(),
26
- $type: z.string().superRefine((value, ctx) => {
27
- if (!validTypes.includes(value)) {
28
- ctx.addIssue({
29
- code: 'custom',
30
- message: schemaErrorMessage(`Invalid token $type: "${value}"`, `Must be one of the following: ${joinFriendly([...validTypes], 'or')}`),
31
- });
41
+ export const validateType = z.record(z.string(), z.unknown()).superRefine((obj, ctx) => {
42
+ for (const [key, value] of Object.entries(obj)) {
43
+ if (key === '$description') {
44
+ // Group-level $description must be a string
45
+ if (typeof value !== 'string') {
46
+ ctx.addIssue({
47
+ code: z.ZodIssueCode.custom,
48
+ message: `$description must be a string`,
49
+ path: [key],
50
+ });
51
+ }
52
+ }
53
+ else if (key === '$extensions') {
54
+ // Group-level $extensions must be an object
55
+ if (typeof value !== 'object' || value === null) {
56
+ ctx.addIssue({
57
+ code: z.ZodIssueCode.custom,
58
+ message: `$extensions must be an object`,
59
+ path: [key],
60
+ });
61
+ }
62
+ }
63
+ else if (key.startsWith('$')) {
64
+ // Unknown $-prefixed keys are not allowed
65
+ ctx.addIssue({
66
+ code: z.ZodIssueCode.custom,
67
+ message: `Unknown group property: ${key}`,
68
+ path: [key],
69
+ });
70
+ }
71
+ else if (typeof value === 'object' && value !== null) {
72
+ // Check if it's a token (has $type) or a nested group
73
+ if ('$type' in value) {
74
+ const result = tokenWithType.safeParse(value);
75
+ if (!result.success) {
76
+ for (const issue of result.error.issues) {
77
+ ctx.addIssue(Object.assign(Object.assign({}, issue), { path: [key, ...issue.path] }));
78
+ }
32
79
  }
33
- }),
34
- })
35
- .required(),
36
- validateType,
37
- ]);
38
- }));
80
+ }
81
+ else {
82
+ // Recursively validate nested group
83
+ const result = validateType.safeParse(value);
84
+ if (!result.success) {
85
+ for (const issue of result.error.issues) {
86
+ ctx.addIssue(Object.assign(Object.assign({}, issue), { path: [key, ...issue.path] }));
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ });
@@ -4,4 +4,10 @@ export declare const viewportRangeToken: z.ZodObject<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
5
5
  $value: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
6
6
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
7
+ $extensions: z.ZodOptional<z.ZodObject<{
8
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
9
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ rules: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>>;
7
13
  }, z.core.$strict>;
@@ -2,9 +2,15 @@ import { z } from 'zod';
2
2
  import { baseToken } from './baseToken.js';
3
3
  import { referenceValue } from './referenceValue.js';
4
4
  import { tokenType } from './tokenType.js';
5
+ import { llmExtension } from './llmExtension.js';
5
6
  export const viewportRangeToken = baseToken
6
7
  .extend({
7
8
  $value: z.union([z.string(), referenceValue]),
8
9
  $type: tokenType('custom-viewportRange'),
10
+ $extensions: z
11
+ .object({
12
+ 'org.primer.llm': llmExtension,
13
+ })
14
+ .optional(),
9
15
  })
10
16
  .strict();
@@ -11,8 +11,9 @@
11
11
  --base-duration-700: 700ms;
12
12
  --base-duration-800: 800ms;
13
13
  --base-duration-900: 900ms;
14
- --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. */
15
- --base-easing-easeInOut: cubic-bezier(0.6, 0, 0.2, 1); /** Ideal for movement that starts and ends on the page. */
16
- --base-easing-easeOut: cubic-bezier(0.3, 0.8, 0.6, 1); /** Ideal for movement that starts off the page and ends on the page. */
17
- --base-easing-linear: cubic-bezier(0, 0, 1, 1); /** Ideal for non-movement properties, like opacity or background color. */
14
+ --base-easing-ease: cubic-bezier(0.25, 0.1, 0.25, 1); /** CSS default easing. Use for hover state changes and micro-interactions. */
15
+ --base-easing-easeIn: cubic-bezier(0.7, 0.1, 0.75, 0.9); /** Accelerating motion. Use for elements exiting the viewport (moving off-screen). */
16
+ --base-easing-easeInOut: cubic-bezier(0.6, 0, 0.2, 1); /** Smooth acceleration and deceleration. Use for elements moving or morphing within the viewport. */
17
+ --base-easing-easeOut: cubic-bezier(0.3, 0.8, 0.6, 1); /** Decelerating motion. Use for elements entering the viewport or appearing on screen. */
18
+ --base-easing-linear: cubic-bezier(0, 0, 1, 1); /** Constant motion with no acceleration. Use for continuous animations like progress bars or loaders. */
18
19
  }
@@ -4,6 +4,12 @@
4
4
  --base-text-lineHeight-relaxed: 1.625; /** Use for longer-form content, smaller text sizes (12-13px), or when increased readability is desired. Good for text that needs extra breathing room. */
5
5
  --base-text-lineHeight-snug: 1.375; /** Use for display text, large headings, or short multi-line text where moderate density is needed. Good for hero sections and marketing headlines. */
6
6
  --base-text-lineHeight-tight: 1.25; /** Use for single-line text in compact UI elements like labels, badges, buttons, or captions where vertical space is limited. Not recommended for multi-line body text due to reduced readability. */
7
+ --base-text-size-2xl: 2.5rem; /** 40px - Display text for hero sections. */
8
+ --base-text-size-lg: 1.25rem; /** 20px - Medium titles and subtitles. */
9
+ --base-text-size-md: 1rem; /** 16px - Large body text and small titles. */
10
+ --base-text-size-sm: 0.875rem; /** 14px - Default body text size for UI. */
11
+ --base-text-size-xl: 2rem; /** 32px - Large titles and page headings. */
12
+ --base-text-size-xs: 0.75rem; /** 12px - Smallest text size for captions and compact UI elements. */
7
13
  --base-text-weight-light: 300;
8
14
  --base-text-weight-medium: 500;
9
15
  --base-text-weight-normal: 400;
@@ -1,16 +1,11 @@
1
1
  :root {
2
- --borderRadius-full: 624.9375rem; /** Use this border radius for pill shaped elements */
3
- --borderRadius-large: 0.75rem;
4
- --borderRadius-medium: 0.375rem;
5
- --borderRadius-small: 0.1875rem;
6
- --borderWidth-thick: 0.125rem;
7
- --borderWidth-thicker: 0.25rem;
8
- --borderWidth-thin: 0.0625rem;
9
- --outline-focus-offset: -0.125rem;
10
- --outline-focus-width: 0.125rem;
11
- --borderRadius-default: var(--borderRadius-medium);
12
- --borderWidth-default: var(--borderWidth-thin);
13
- --boxShadow-thick: inset 0 0 0 var(--borderWidth-thick);
14
- --boxShadow-thicker: inset 0 0 0 var(--borderWidth-thicker);
15
- --boxShadow-thin: inset 0 0 0 var(--borderWidth-thin); /** Thin shadow for borders */
2
+ --borderWidth-thick: 0.125rem; /** Thick 2px border for emphasis. Use for focus indicators, selected states, or to emphasize important boundaries */
3
+ --borderWidth-thicker: 0.25rem; /** Extra thick 4px border for maximum emphasis. Use sparingly for high-contrast focus indicators or critical visual separators */
4
+ --borderWidth-thin: 0.0625rem; /** Standard 1px border width. Use for most borders, dividers, and outlines throughout the interface */
5
+ --outline-focus-offset: -0.125rem; /** Focus outline offset (-2px). Negative value creates an inset outline for keyboard focus indicators, ensuring the focus ring stays within the element bounds */
6
+ --outline-focus-width: 0.125rem; /** Focus outline width (2px). Standard width for keyboard focus indicators to meet WCAG 2.4.7 accessibility requirements */
7
+ --borderWidth-default: var(--borderWidth-thin); /** Default border width for most UI elements. Alias of borderWidth.thin (1px) */
8
+ --boxShadow-thick: inset 0 0 0 var(--borderWidth-thick); /** Thick shadow (2px) used instead of a border for emphasis without layout shift */
9
+ --boxShadow-thicker: inset 0 0 0 var(--borderWidth-thicker); /** Thickest shadow (4px) used for high emphasis borders without layout shift. Use sparingly for maximum visual impact */
10
+ --boxShadow-thin: inset 0 0 0 var(--borderWidth-thin); /** Thin shadow used instead of a border to prevent layout shift */
16
11
  }
@@ -0,0 +1,7 @@
1
+ :root {
2
+ --borderRadius-full: 624.9375rem; /** Use this border radius for pill shaped elements */
3
+ --borderRadius-large: 0.75rem; /** Large border radius (12px). Use for larger containers, dialogs, or when more visual softness is desired. Always use this for buttons. */
4
+ --borderRadius-medium: 0.375rem; /** Medium border radius (6px). The default choice for most buttons, cards, and containers */
5
+ --borderRadius-small: 0.1875rem; /** Small border radius (3px). Use for small variants of components or small UI elements like badges, tags, or anything below 16px in height */
6
+ --borderRadius-default: var(--borderRadius-medium); /** Default border radius for most UI elements. Alias of borderRadius.medium (6px). Use when in doubt */
7
+ }
@@ -1,7 +1,7 @@
1
1
  @media (pointer: coarse) {
2
2
  :root {
3
- --control-minTarget-auto: 2.75rem;
4
- --controlStack-medium-gap-auto: 0.75rem;
5
- --controlStack-small-gap-auto: 1rem;
3
+ --control-minTarget-auto: 2.75rem; /** Minimum touch target size for coarse pointer devices (touch screens) */
4
+ --controlStack-medium-gap-auto: 0.75rem; /** Gap between stacked controls in medium density layouts for touch devices */
5
+ --controlStack-small-gap-auto: 1rem; /** Gap between stacked controls in small density layouts for touch devices */
6
6
  }
7
7
  }
@@ -1,7 +1,7 @@
1
1
  @media (pointer: fine) {
2
2
  :root {
3
- --control-minTarget-auto: 1rem;
4
- --controlStack-medium-gap-auto: 0.5rem;
5
- --controlStack-small-gap-auto: 0.5rem;
3
+ --control-minTarget-auto: 1rem; /** Minimum target size for fine pointer devices (mouse) */
4
+ --controlStack-medium-gap-auto: 0.5rem; /** Gap between stacked controls in medium density layouts for mouse interfaces */
5
+ --controlStack-small-gap-auto: 0.5rem; /** Gap between stacked controls in small density layouts for mouse interfaces */
6
6
  }
7
7
  }
@@ -1,6 +1,6 @@
1
1
  @custom-media --viewportRange-landscape (orientation: landscape);
2
2
  @custom-media --viewportRange-narrow (max-width: calc(48rem - 0.02px));
3
- @custom-media --viewportRange-narrowLandscape (max-width: calc(63.25rem - 0.02px) and (max-height: calc(34rem - 0.02px)) and (orientation: landscape));
3
+ @custom-media --viewportRange-narrowLandscape ((max-width: calc(63.25rem - 0.02px)) and (max-height: calc(34rem - 0.02px)) and (orientation: landscape));
4
4
  @custom-media --viewportRange-portrait (orientation: portrait);
5
5
  @custom-media --viewportRange-regular (min-width: 48rem);
6
6
  @custom-media --viewportRange-wide (min-width: 87.5rem);