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

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 (154) 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 +8 -0
  8. package/dist/build/formats/markdownLlmGuidelines.js +93 -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 +16 -0
  14. package/dist/build/primerStyleDictionary.js +5 -1
  15. package/dist/build/schemas/borderToken.d.ts +6 -0
  16. package/dist/build/schemas/borderToken.js +6 -0
  17. package/dist/build/schemas/colorToken.d.ts +4 -0
  18. package/dist/build/schemas/colorToken.js +2 -0
  19. package/dist/build/schemas/cubicBezierToken.d.ts +6 -0
  20. package/dist/build/schemas/cubicBezierToken.js +10 -2
  21. package/dist/build/schemas/dimensionToken.d.ts +4 -0
  22. package/dist/build/schemas/dimensionToken.js +3 -1
  23. package/dist/build/schemas/dimensionValue.js +1 -1
  24. package/dist/build/schemas/durationToken.d.ts +6 -0
  25. package/dist/build/schemas/durationToken.js +6 -0
  26. package/dist/build/schemas/fontFamilyToken.d.ts +4 -0
  27. package/dist/build/schemas/fontFamilyToken.js +2 -0
  28. package/dist/build/schemas/fontWeightToken.d.ts +4 -0
  29. package/dist/build/schemas/fontWeightToken.js +2 -0
  30. package/dist/build/schemas/gradientToken.d.ts +4 -0
  31. package/dist/build/schemas/gradientToken.js +2 -0
  32. package/dist/build/schemas/llmExtension.d.ts +9 -0
  33. package/dist/build/schemas/llmExtension.js +11 -0
  34. package/dist/build/schemas/numberToken.d.ts +4 -0
  35. package/dist/build/schemas/numberToken.js +2 -0
  36. package/dist/build/schemas/shadowToken.d.ts +4 -0
  37. package/dist/build/schemas/shadowToken.js +2 -0
  38. package/dist/build/schemas/stringToken.d.ts +6 -0
  39. package/dist/build/schemas/stringToken.js +6 -0
  40. package/dist/build/schemas/transitionToken.d.ts +6 -0
  41. package/dist/build/schemas/transitionToken.js +6 -0
  42. package/dist/build/schemas/typographyToken.d.ts +6 -0
  43. package/dist/build/schemas/typographyToken.js +6 -0
  44. package/dist/build/schemas/viewportRangeToken.d.ts +6 -0
  45. package/dist/build/schemas/viewportRangeToken.js +6 -0
  46. package/dist/css/base/motion/motion.css +5 -4
  47. package/dist/css/base/typography/typography.css +6 -0
  48. package/dist/css/functional/size/border.css +9 -14
  49. package/dist/css/functional/size/radius.css +7 -0
  50. package/dist/css/functional/size/viewport.css +1 -1
  51. package/dist/css/functional/themes/dark-colorblind-high-contrast.css +172 -175
  52. package/dist/css/functional/themes/dark-colorblind.css +172 -175
  53. package/dist/css/functional/themes/dark-dimmed-high-contrast.css +172 -175
  54. package/dist/css/functional/themes/dark-dimmed.css +172 -175
  55. package/dist/css/functional/themes/dark-high-contrast.css +172 -175
  56. package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +172 -175
  57. package/dist/css/functional/themes/dark-tritanopia.css +172 -175
  58. package/dist/css/functional/themes/dark.css +172 -175
  59. package/dist/css/functional/themes/light-colorblind-high-contrast.css +172 -175
  60. package/dist/css/functional/themes/light-colorblind.css +172 -175
  61. package/dist/css/functional/themes/light-high-contrast.css +172 -175
  62. package/dist/css/functional/themes/light-tritanopia-high-contrast.css +172 -175
  63. package/dist/css/functional/themes/light-tritanopia.css +172 -175
  64. package/dist/css/functional/themes/light.css +172 -175
  65. package/dist/css/functional/typography/typography.css +13 -13
  66. package/dist/css/primitives.css +1 -0
  67. package/dist/docs/base/motion/motion.json +85 -8
  68. package/dist/docs/base/typography/typography.json +174 -0
  69. package/dist/docs/functional/size/border.json +42 -177
  70. package/dist/docs/functional/size/radius.json +209 -0
  71. package/dist/docs/functional/size/viewport.json +2 -2
  72. package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +897 -87
  73. package/dist/docs/functional/themes/dark-colorblind.json +897 -87
  74. package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +897 -87
  75. package/dist/docs/functional/themes/dark-dimmed.json +935 -125
  76. package/dist/docs/functional/themes/dark-high-contrast.json +897 -87
  77. package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +897 -87
  78. package/dist/docs/functional/themes/dark-tritanopia.json +897 -87
  79. package/dist/docs/functional/themes/dark.json +897 -87
  80. package/dist/docs/functional/themes/light-colorblind-high-contrast.json +897 -87
  81. package/dist/docs/functional/themes/light-colorblind.json +897 -87
  82. package/dist/docs/functional/themes/light-high-contrast.json +897 -87
  83. package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +897 -87
  84. package/dist/docs/functional/themes/light-tritanopia.json +897 -87
  85. package/dist/docs/functional/themes/light.json +897 -87
  86. package/dist/docs/functional/typography/typography.json +181 -17
  87. package/dist/fallbacks/base/motion/motion.json +1 -0
  88. package/dist/fallbacks/base/typography/typography.json +6 -0
  89. package/dist/fallbacks/functional/size/border.json +0 -5
  90. package/dist/fallbacks/functional/size/radius.json +7 -0
  91. package/dist/fallbacks/functional/size/viewport.json +1 -1
  92. package/dist/figma/dimension/dimension.json +30 -20
  93. package/dist/figma/themes/dark-colorblind.json +83 -0
  94. package/dist/figma/themes/dark-dimmed.json +132 -49
  95. package/dist/figma/themes/dark-high-contrast.json +83 -0
  96. package/dist/figma/themes/dark-tritanopia.json +83 -0
  97. package/dist/figma/themes/dark.json +83 -0
  98. package/dist/figma/themes/light-colorblind.json +83 -0
  99. package/dist/figma/themes/light-high-contrast.json +83 -0
  100. package/dist/figma/themes/light-tritanopia.json +83 -0
  101. package/dist/figma/themes/light.json +83 -0
  102. package/dist/figma/typography/typography.json +119 -40
  103. package/dist/internalCss/dark-colorblind-high-contrast.css +190 -203
  104. package/dist/internalCss/dark-colorblind.css +190 -203
  105. package/dist/internalCss/dark-dimmed-high-contrast.css +190 -203
  106. package/dist/internalCss/dark-dimmed.css +190 -203
  107. package/dist/internalCss/dark-high-contrast.css +190 -203
  108. package/dist/internalCss/dark-tritanopia-high-contrast.css +190 -203
  109. package/dist/internalCss/dark-tritanopia.css +190 -203
  110. package/dist/internalCss/dark.css +190 -203
  111. package/dist/internalCss/light-colorblind-high-contrast.css +190 -203
  112. package/dist/internalCss/light-colorblind.css +190 -203
  113. package/dist/internalCss/light-high-contrast.css +190 -203
  114. package/dist/internalCss/light-tritanopia-high-contrast.css +190 -203
  115. package/dist/internalCss/light-tritanopia.css +190 -203
  116. package/dist/internalCss/light.css +190 -203
  117. package/dist/styleLint/base/motion/motion.json +85 -8
  118. package/dist/styleLint/base/typography/typography.json +174 -0
  119. package/dist/styleLint/functional/size/border.json +34 -169
  120. package/dist/styleLint/functional/size/radius.json +209 -0
  121. package/dist/styleLint/functional/size/viewport.json +2 -2
  122. package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +812 -2
  123. package/dist/styleLint/functional/themes/dark-colorblind.json +812 -2
  124. package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +812 -2
  125. package/dist/styleLint/functional/themes/dark-dimmed.json +850 -40
  126. package/dist/styleLint/functional/themes/dark-high-contrast.json +812 -2
  127. package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +812 -2
  128. package/dist/styleLint/functional/themes/dark-tritanopia.json +812 -2
  129. package/dist/styleLint/functional/themes/dark.json +812 -2
  130. package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +812 -2
  131. package/dist/styleLint/functional/themes/light-colorblind.json +812 -2
  132. package/dist/styleLint/functional/themes/light-high-contrast.json +812 -2
  133. package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +812 -2
  134. package/dist/styleLint/functional/themes/light-tritanopia.json +812 -2
  135. package/dist/styleLint/functional/themes/light.json +812 -2
  136. package/dist/styleLint/functional/typography/typography.json +195 -31
  137. package/guidelines/color.llm.md +16 -0
  138. package/guidelines/guidelines.llm.md +34 -0
  139. package/guidelines/motion.llm.md +41 -0
  140. package/guidelines/spacing.llm.md +20 -0
  141. package/guidelines/typography.llm.md +14 -0
  142. package/package.json +4 -2
  143. package/src/tokens/base/motion/easing.json5 +39 -4
  144. package/src/tokens/base/typography/typography.json5 +68 -0
  145. package/src/tokens/functional/color/bgColor.json5 +157 -0
  146. package/src/tokens/functional/color/borderColor.json5 +146 -0
  147. package/src/tokens/functional/color/fgColor.json5 +93 -1
  148. package/src/tokens/functional/shadow/shadow.json5 +10 -0
  149. package/src/tokens/functional/size/border.json5 +17 -69
  150. package/src/tokens/functional/size/radius.json5 +90 -0
  151. package/src/tokens/functional/size/viewport.json5 +1 -1
  152. package/src/tokens/functional/typography/font-stack.json5 +60 -0
  153. package/src/tokens/functional/typography/typography.json5 +76 -53
  154. package/token-guidelines.llm.md +546 -0
@@ -0,0 +1,7 @@
1
+ import type { TransformedToken } from 'style-dictionary/types';
2
+ /**
3
+ * @description Checks if token has LLM extensions (`org.primer.llm` in `$extensions`)
4
+ * @param arguments [TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
5
+ * @returns boolean
6
+ */
7
+ export declare const hasLlmExtensions: (token: TransformedToken) => boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @description Checks if token has LLM extensions (`org.primer.llm` in `$extensions`)
3
+ * @param arguments [TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
4
+ * @returns boolean
5
+ */
6
+ export const hasLlmExtensions = (token) => {
7
+ return (token.$extensions !== undefined &&
8
+ token.$extensions !== null &&
9
+ typeof token.$extensions === 'object' &&
10
+ 'org.primer.llm' in token.$extensions);
11
+ };
@@ -1,3 +1,4 @@
1
+ export { hasLlmExtensions } from './hasLlmExtensions.js';
1
2
  export { isBorder } from './isBorder.js';
2
3
  export { isColor } from './isColor.js';
3
4
  export { isColorWithAlpha } from './isColorWithAlpha.js';
@@ -1,3 +1,4 @@
1
+ export { hasLlmExtensions } from './hasLlmExtensions.js';
1
2
  export { isBorder } from './isBorder.js';
2
3
  export { isColor } from './isColor.js';
3
4
  export { isColorWithAlpha } from './isColorWithAlpha.js';
@@ -1,5 +1,6 @@
1
1
  export { cssCustomMedia } from './cssCustomMedia.js';
2
2
  export { cssAdvanced } from './cssAdvanced.js';
3
+ export { markdownLlmGuidelines } from './markdownLlmGuidelines.js';
3
4
  export { jsonFigma } from './jsonFigma.js';
4
5
  export { javascriptCommonJs } from './javascriptCommonJs.js';
5
6
  export { javascriptEsm } from './javascriptEsm.js';
@@ -1,5 +1,6 @@
1
1
  export { cssCustomMedia } from './cssCustomMedia.js';
2
2
  export { cssAdvanced } from './cssAdvanced.js';
3
+ export { markdownLlmGuidelines } from './markdownLlmGuidelines.js';
3
4
  export { jsonFigma } from './jsonFigma.js';
4
5
  export { javascriptCommonJs } from './javascriptCommonJs.js';
5
6
  export { javascriptEsm } from './javascriptEsm.js';
@@ -0,0 +1,8 @@
1
+ import type { FormatFn } from 'style-dictionary/types';
2
+ /**
3
+ * @description Outputs a markdown file with LLM token guidelines, extracting
4
+ * description from $description and usage/rules from $extensions['org.primer.llm']
5
+ * @param FormatFnArguments
6
+ * @returns formatted markdown `string`
7
+ */
8
+ export declare const markdownLlmGuidelines: FormatFn;
@@ -0,0 +1,93 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { sortByName } from 'style-dictionary/utils';
11
+ /**
12
+ * Extracts category from token name
13
+ * - For "base-*" tokens, uses second word (e.g., "base-easing-ease" -> "easing")
14
+ * - Otherwise uses first word (e.g., "bgColor-danger-emphasis" -> "bgColor")
15
+ */
16
+ function extractCategory(tokenName) {
17
+ const parts = tokenName.split('-');
18
+ if (parts[0] === 'base' && parts[1]) {
19
+ return parts[1];
20
+ }
21
+ return parts[0] || 'other';
22
+ }
23
+ /**
24
+ * Formats category name for display
25
+ */
26
+ function formatCategoryName(category) {
27
+ const categoryMap = {
28
+ bgColor: 'background color',
29
+ fgColor: 'text and foreground color',
30
+ };
31
+ if (categoryMap[category]) {
32
+ return categoryMap[category];
33
+ }
34
+ // Capitalize first letter
35
+ return category.charAt(0).toUpperCase() + category.slice(1);
36
+ }
37
+ /**
38
+ * @description Outputs a markdown file with LLM token guidelines, extracting
39
+ * description from $description and usage/rules from $extensions['org.primer.llm']
40
+ * @param FormatFnArguments
41
+ * @returns formatted markdown `string`
42
+ */
43
+ export const markdownLlmGuidelines = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dictionary }) {
44
+ var _b;
45
+ const tokens = dictionary.allTokens.sort(sortByName);
46
+ const guidelines = [];
47
+ for (const token of tokens) {
48
+ const llmExt = (_b = token.$extensions) === null || _b === void 0 ? void 0 : _b['org.primer.llm'];
49
+ if (!llmExt)
50
+ continue;
51
+ const guideline = {
52
+ name: token.name,
53
+ category: extractCategory(token.name),
54
+ };
55
+ if (token.$description && typeof token.$description === 'string') {
56
+ guideline.description = token.$description;
57
+ }
58
+ if (llmExt.usage && Array.isArray(llmExt.usage)) {
59
+ guideline.usage = llmExt.usage;
60
+ }
61
+ if (llmExt.rules && typeof llmExt.rules === 'string') {
62
+ guideline.rules = llmExt.rules;
63
+ }
64
+ guidelines.push(guideline);
65
+ }
66
+ // Group by category
67
+ const grouped = {};
68
+ for (const guideline of guidelines) {
69
+ if (!Object.hasOwn(grouped, guideline.category)) {
70
+ grouped[guideline.category] = [];
71
+ }
72
+ grouped[guideline.category].push(guideline);
73
+ }
74
+ // Build markdown output
75
+ const lines = ['# Token Guidelines', ''];
76
+ for (const category of Object.keys(grouped).sort()) {
77
+ lines.push(`## ${formatCategoryName(category)}`, '');
78
+ for (const guideline of grouped[category]) {
79
+ lines.push(`### ${guideline.name}`);
80
+ if (guideline.description) {
81
+ lines.push(guideline.description);
82
+ }
83
+ if (guideline.usage && guideline.usage.length > 0) {
84
+ lines.push(`**Usage:** ${guideline.usage.join(', ')}`);
85
+ }
86
+ if (guideline.rules) {
87
+ lines.push(`**Rules:** ${guideline.rules}`);
88
+ }
89
+ lines.push('');
90
+ }
91
+ }
92
+ return lines.join('\n');
93
+ });
@@ -8,12 +8,12 @@ const getCssSelectors = (outputFile) => {
8
8
  const mode = outputBasename.substring(0, 4) === 'dark' ? 'dark' : 'light';
9
9
  return [
10
10
  {
11
- selector: `[data-color-mode="${mode}"][data-${mode}-theme="${themeName}"], [data-color-mode="${mode}"][data-${mode}-theme="${themeName}"] ::backdrop, [data-color-mode="auto"][data-light-theme="${themeName}"], [data-color-mode="auto"][data-light-theme="${themeName}"] ::backdrop`,
11
+ selector: `[data-color-mode="${mode}"][data-${mode}-theme="${themeName}"], [data-color-mode="auto"][data-light-theme="${themeName}"]`,
12
12
  },
13
13
  {
14
14
  query: '@media (prefers-color-scheme: dark)',
15
15
  // [data-color-mode] here is duplicated to increase the specificity so that light mode can't override it when prefers-color-scheme: dark is enabled
16
- selector: `[data-color-mode][data-color-mode="auto"][data-dark-theme="${themeName}"], [data-color-mode][data-color-mode="auto"][data-dark-theme="${themeName}"] ::backdrop`,
16
+ selector: `[data-color-mode][data-color-mode="auto"][data-dark-theme="${themeName}"]`,
17
17
  },
18
18
  ];
19
19
  };
@@ -1,3 +1,4 @@
1
+ export { llmGuidelines } from './llmGuidelines.js';
1
2
  export { css } from './css.js';
2
3
  export { deprecatedJson } from './deprecatedJson.js';
3
4
  export { docJson } from './docJson.js';
@@ -1,3 +1,4 @@
1
+ export { llmGuidelines } from './llmGuidelines.js';
1
2
  export { css } from './css.js';
2
3
  export { deprecatedJson } from './deprecatedJson.js';
3
4
  export { docJson } from './docJson.js';
@@ -0,0 +1,2 @@
1
+ import type { PlatformInitializer } from '../types/platformInitializer.js';
2
+ export declare const llmGuidelines: PlatformInitializer;
@@ -0,0 +1,16 @@
1
+ import { hasLlmExtensions } from '../filters/index.js';
2
+ export const llmGuidelines = (outputFile, prefix, buildPath) => ({
3
+ prefix,
4
+ buildPath,
5
+ transforms: ['name/pathToKebabCase'],
6
+ files: [
7
+ {
8
+ destination: outputFile,
9
+ format: 'json/llm-guidelines',
10
+ filter: hasLlmExtensions,
11
+ options: {
12
+ outputReferences: false,
13
+ },
14
+ },
15
+ ],
16
+ });
@@ -1,6 +1,6 @@
1
1
  import StyleDictionary from 'style-dictionary';
2
2
  import { borderToCss, colorToRgbAlpha, colorToHex, colorToRgbaFloat, cubicBezierToCss, dimensionToRem, dimensionToPixelUnitless, durationToCss, figmaAttributes, fontFamilyToCss, fontFamilyToFigma, fontWeightToNumber, gradientToCss, jsonDeprecated, namePathToDotNotation, namePathToCamelCase, namePathToPascalCase, namePathToKebabCase, namePathToSlashNotation, namePathToFigma, shadowToCss, typographyToCss, dimensionToRemPxArray, floatToPixel, floatToPixelUnitless, transitionToCss, } from './transformers/index.js';
3
- import { javascriptCommonJs, javascriptEsm, typescriptExportDefinition, jsonNestedPrefixed, cssCustomMedia, jsonOneDimensional, jsonPostCssFallback, cssAdvanced, jsonFigma, } from './formats/index.js';
3
+ import { javascriptCommonJs, javascriptEsm, typescriptExportDefinition, jsonNestedPrefixed, cssCustomMedia, jsonOneDimensional, jsonPostCssFallback, cssAdvanced, jsonFigma, markdownLlmGuidelines, } from './formats/index.js';
4
4
  import { themeOverrides } from './preprocessors/themeOverrides.js';
5
5
  import { colorAlphaToCss } from './transformers/colorAlphaToCss.js';
6
6
  /**
@@ -55,6 +55,10 @@ PrimerStyleDictionary.registerFormat({
55
55
  name: 'json/figma',
56
56
  format: jsonFigma,
57
57
  });
58
+ PrimerStyleDictionary.registerFormat({
59
+ name: 'json/llm-guidelines',
60
+ format: markdownLlmGuidelines,
61
+ });
58
62
  /**
59
63
  * Transformers
60
64
  *
@@ -31,4 +31,10 @@ export declare const borderToken: z.ZodObject<{
31
31
  width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>, z.ZodString]>;
32
32
  }, z.core.$strip>, z.ZodString]>;
33
33
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
34
+ $extensions: z.ZodOptional<z.ZodObject<{
35
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
36
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ rules: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>>;
39
+ }, z.core.$strip>>;
34
40
  }, z.core.$strict>;
@@ -4,6 +4,7 @@ import { referenceValue } from './referenceValue.js';
4
4
  import { colorHexValue } from './colorHexValue.js';
5
5
  import { dimensionValue } from './dimensionValue.js';
6
6
  import { tokenType } from './tokenType.js';
7
+ import { llmExtension } from './llmExtension.js';
7
8
  export const borderValue = z.object({
8
9
  color: z.union([colorHexValue, referenceValue]),
9
10
  style: z.enum(['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'outset', 'inset']),
@@ -13,5 +14,10 @@ export const borderToken = baseToken
13
14
  .extend({
14
15
  $value: z.union([borderValue, referenceValue]),
15
16
  $type: tokenType('border'),
17
+ $extensions: z
18
+ .object({
19
+ 'org.primer.llm': llmExtension,
20
+ })
21
+ .optional(),
16
22
  })
17
23
  .strict();
@@ -98,5 +98,9 @@ export declare const colorToken: z.ZodObject<{
98
98
  alpha: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodAny>>>;
99
99
  }, z.core.$strict>]>>;
100
100
  }, z.core.$strict>>;
101
+ 'org.primer.llm': z.ZodOptional<z.ZodObject<{
102
+ usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
103
+ rules: z.ZodOptional<z.ZodString>;
104
+ }, z.core.$strip>>;
101
105
  }, z.core.$strict>>;
102
106
  }, z.core.$strict>;
@@ -6,6 +6,7 @@ import { baseToken } from './baseToken.js';
6
6
  import { collection, mode } from './collections.js';
7
7
  import { scopes } from './scopes.js';
8
8
  import { tokenType } from './tokenType.js';
9
+ import { llmExtension } from './llmExtension.js';
9
10
  const baseColorToken = baseToken.extend({
10
11
  $value: z.union([colorHexValue, referenceValue]),
11
12
  alpha: alphaValue.optional().nullable(),
@@ -75,6 +76,7 @@ export const colorToken = baseColorToken
75
76
  })
76
77
  .strict()
77
78
  .optional(),
79
+ 'org.primer.llm': llmExtension,
78
80
  })
79
81
  .strict()
80
82
  .optional(),
@@ -4,4 +4,10 @@ export declare const cubicBezierToken: z.ZodObject<{
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
5
5
  $value: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, 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,7 +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
- export const cubicBezierToken = baseToken.extend({
5
+ import { llmExtension } from './llmExtension.js';
6
+ export const cubicBezierToken = baseToken
7
+ .extend({
6
8
  $value: z.union([z.array(z.number()).length(4), referenceValue]),
7
9
  $type: tokenType('cubicBezier'),
8
- });
10
+ $extensions: z
11
+ .object({
12
+ 'org.primer.llm': llmExtension,
13
+ })
14
+ .optional(),
15
+ })
16
+ .strict();
@@ -10,5 +10,9 @@ export declare const dimensionToken: z.ZodObject<{
10
10
  scopes: z.ZodArray<z.ZodString>;
11
11
  group: z.ZodOptional<z.ZodString>;
12
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,6 +5,7 @@ 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]),
@@ -12,7 +13,7 @@ export const dimensionToken = baseToken
12
13
  $extensions: z
13
14
  .object({
14
15
  'org.primer.figma': z.object({
15
- collection: collection(['base/size', 'functional/size', 'pattern/size', 'typography']),
16
+ collection: collection(['base/size', 'base/typography', 'functional/size', 'pattern/size', 'typography']),
16
17
  scopes: scopes([
17
18
  'all',
18
19
  'size',
@@ -29,6 +30,7 @@ export const dimensionToken = baseToken
29
30
  ]),
30
31
  group: z.string().optional(),
31
32
  }),
33
+ 'org.primer.llm': llmExtension,
32
34
  })
33
35
  .optional(),
34
36
  })
@@ -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>;