@primer/primitives 11.4.0 → 11.4.1-rc.4e2d1de5

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 (131) hide show
  1. package/DESIGN_TOKENS_GUIDE.md +185 -0
  2. package/DESIGN_TOKENS_SPEC.md +565 -0
  3. package/dist/build/formats/markdownLlmGuidelines.d.ts +7 -6
  4. package/dist/build/formats/markdownLlmGuidelines.js +1034 -60
  5. package/dist/build/schemas/borderToken.d.ts +16 -2
  6. package/dist/build/schemas/dimensionToken.d.ts +8 -1
  7. package/dist/build/schemas/dimensionValue.d.ts +24 -1
  8. package/dist/build/schemas/dimensionValue.js +20 -1
  9. package/dist/build/schemas/durationToken.d.ts +7 -1
  10. package/dist/build/schemas/durationValue.d.ts +11 -1
  11. package/dist/build/schemas/durationValue.js +13 -3
  12. package/dist/build/schemas/shadowToken.d.ts +672 -84
  13. package/dist/build/schemas/transitionToken.d.ts +14 -2
  14. package/dist/build/schemas/typographyToken.d.ts +32 -4
  15. package/dist/build/transformers/dimensionToPixelUnitless.d.ts +3 -2
  16. package/dist/build/transformers/dimensionToPixelUnitless.js +22 -26
  17. package/dist/build/transformers/dimensionToRem.d.ts +2 -1
  18. package/dist/build/transformers/dimensionToRem.js +21 -22
  19. package/dist/build/transformers/dimensionToRemPxArray.d.ts +2 -1
  20. package/dist/build/transformers/dimensionToRemPxArray.js +21 -22
  21. package/dist/build/transformers/durationToCss.d.ts +2 -1
  22. package/dist/build/transformers/durationToCss.js +18 -11
  23. package/dist/build/transformers/utilities/parseDimension.d.ts +12 -0
  24. package/dist/build/transformers/utilities/parseDimension.js +31 -0
  25. package/dist/build/types/dimensionTokenValue.d.ts +9 -0
  26. package/dist/css/functional/themes/dark-colorblind-high-contrast.css +18 -14
  27. package/dist/css/functional/themes/dark-colorblind.css +18 -14
  28. package/dist/css/functional/themes/dark-dimmed-high-contrast.css +18 -14
  29. package/dist/css/functional/themes/dark-dimmed.css +18 -14
  30. package/dist/css/functional/themes/dark-high-contrast.css +18 -14
  31. package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +18 -14
  32. package/dist/css/functional/themes/dark-tritanopia.css +18 -14
  33. package/dist/css/functional/themes/dark.css +18 -14
  34. package/dist/css/functional/themes/light-colorblind-high-contrast.css +18 -14
  35. package/dist/css/functional/themes/light-colorblind.css +18 -14
  36. package/dist/css/functional/themes/light-high-contrast.css +18 -14
  37. package/dist/css/functional/themes/light-tritanopia-high-contrast.css +18 -14
  38. package/dist/css/functional/themes/light-tritanopia.css +18 -14
  39. package/dist/css/functional/themes/light.css +18 -14
  40. package/dist/css/primitives.css +4 -0
  41. package/dist/docs/base/motion/motion.json +96 -24
  42. package/dist/docs/base/size/size.json +76 -19
  43. package/dist/docs/base/typography/typography.json +24 -6
  44. package/dist/docs/functional/size/border.json +20 -5
  45. package/dist/docs/functional/size/breakpoints.json +24 -6
  46. package/dist/docs/functional/size/radius.json +16 -4
  47. package/dist/docs/functional/size/size.json +60 -15
  48. package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +109 -7
  49. package/dist/docs/functional/themes/dark-colorblind.json +109 -7
  50. package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +109 -7
  51. package/dist/docs/functional/themes/dark-dimmed.json +109 -7
  52. package/dist/docs/functional/themes/dark-high-contrast.json +109 -7
  53. package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +109 -7
  54. package/dist/docs/functional/themes/dark-tritanopia.json +109 -7
  55. package/dist/docs/functional/themes/dark.json +109 -7
  56. package/dist/docs/functional/themes/light-colorblind-high-contrast.json +115 -13
  57. package/dist/docs/functional/themes/light-colorblind.json +115 -13
  58. package/dist/docs/functional/themes/light-high-contrast.json +115 -13
  59. package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +115 -13
  60. package/dist/docs/functional/themes/light-tritanopia.json +115 -13
  61. package/dist/docs/functional/themes/light.json +115 -13
  62. package/dist/docs/functional/typography/typography.json +8 -2
  63. package/dist/fallbacks/base/motion/motion.json +48 -12
  64. package/dist/figma/themes/light-colorblind.json +4 -4
  65. package/dist/figma/themes/light-high-contrast.json +4 -4
  66. package/dist/figma/themes/light-tritanopia.json +4 -4
  67. package/dist/figma/themes/light.json +4 -4
  68. package/dist/internalCss/dark-colorblind-high-contrast.css +14 -14
  69. package/dist/internalCss/dark-colorblind.css +14 -14
  70. package/dist/internalCss/dark-dimmed-high-contrast.css +14 -14
  71. package/dist/internalCss/dark-dimmed.css +14 -14
  72. package/dist/internalCss/dark-high-contrast.css +14 -14
  73. package/dist/internalCss/dark-tritanopia-high-contrast.css +14 -14
  74. package/dist/internalCss/dark-tritanopia.css +14 -14
  75. package/dist/internalCss/dark.css +14 -14
  76. package/dist/internalCss/light-colorblind-high-contrast.css +14 -14
  77. package/dist/internalCss/light-colorblind.css +14 -14
  78. package/dist/internalCss/light-high-contrast.css +14 -14
  79. package/dist/internalCss/light-tritanopia-high-contrast.css +14 -14
  80. package/dist/internalCss/light-tritanopia.css +14 -14
  81. package/dist/internalCss/light.css +14 -14
  82. package/dist/styleLint/base/motion/motion.json +96 -24
  83. package/dist/styleLint/base/size/size.json +76 -19
  84. package/dist/styleLint/base/typography/typography.json +30 -12
  85. package/dist/styleLint/functional/size/border.json +21 -6
  86. package/dist/styleLint/functional/size/breakpoints.json +24 -6
  87. package/dist/styleLint/functional/size/radius.json +17 -5
  88. package/dist/styleLint/functional/size/size-coarse.json +3 -3
  89. package/dist/styleLint/functional/size/size-fine.json +3 -3
  90. package/dist/styleLint/functional/size/size.json +111 -66
  91. package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +129 -27
  92. package/dist/styleLint/functional/themes/dark-colorblind.json +129 -27
  93. package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +129 -27
  94. package/dist/styleLint/functional/themes/dark-dimmed.json +129 -27
  95. package/dist/styleLint/functional/themes/dark-high-contrast.json +129 -27
  96. package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +129 -27
  97. package/dist/styleLint/functional/themes/dark-tritanopia.json +129 -27
  98. package/dist/styleLint/functional/themes/dark.json +129 -27
  99. package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +135 -33
  100. package/dist/styleLint/functional/themes/light-colorblind.json +135 -33
  101. package/dist/styleLint/functional/themes/light-high-contrast.json +135 -33
  102. package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +135 -33
  103. package/dist/styleLint/functional/themes/light-tritanopia.json +135 -33
  104. package/dist/styleLint/functional/themes/light.json +135 -33
  105. package/dist/styleLint/functional/typography/typography.json +28 -22
  106. package/package.json +6 -5
  107. package/src/tokens/base/motion/timing.json5 +12 -12
  108. package/src/tokens/base/size/size.json5 +19 -19
  109. package/src/tokens/base/typography/typography.json5 +6 -6
  110. package/src/tokens/functional/color/bgColor.json5 +8 -0
  111. package/src/tokens/functional/color/display.json5 +7 -0
  112. package/src/tokens/functional/color/fgColor.json5 +8 -0
  113. package/src/tokens/functional/color/syntax.json5 +14 -0
  114. package/src/tokens/functional/shadow/shadow.json5 +39 -4
  115. package/src/tokens/functional/size/border.json5 +5 -5
  116. package/src/tokens/functional/size/breakpoints.json5 +6 -6
  117. package/src/tokens/functional/size/radius.json5 +4 -4
  118. package/src/tokens/functional/size/size.json5 +15 -15
  119. package/src/tokens/functional/typography/typography.json5 +8 -4
  120. package/dist/build/parsers/index.d.ts +0 -1
  121. package/dist/build/parsers/index.js +0 -1
  122. package/dist/build/parsers/w3cJsonParser.d.ts +0 -6
  123. package/dist/build/parsers/w3cJsonParser.js +0 -25
  124. package/dist/removed/testing.json5 +0 -4
  125. package/guidelines/color.llm.md +0 -16
  126. package/guidelines/guidelines.llm.md +0 -34
  127. package/guidelines/motion.llm.md +0 -41
  128. package/guidelines/spacing.llm.md +0 -20
  129. package/guidelines/typography.llm.md +0 -14
  130. package/src/tokens/removed/testing.json5 +0 -4
  131. package/token-guidelines.llm.md +0 -695
@@ -0,0 +1,565 @@
1
+ # Primer Design Token Guidelines
2
+
3
+ > Metadata: This file is a Dictionary of tokens. For usage rules, contrast requirements, and motion logic, refer to DESIGN_TOKENS_GUIDE.md.
4
+
5
+ Reference for using GitHub Primer design tokens.
6
+
7
+ ## Legend
8
+
9
+ - **U:** Use cases
10
+ - **R:** Token-specific rules (see Semantic Key for general meaning)
11
+ - **emphasis** variant: Strong/prominent version, use `fg.onEmphasis` for text
12
+ - **muted** variant: Subtle version, use matching `fg.*` color for text
13
+ - **[a, b]** Bracket notation groups related tokens
14
+
15
+ ## Semantic Key
16
+
17
+ These semantic meanings apply across all token types (bgColor, borderColor, fgColor, border).
18
+
19
+ | Semantic | Meaning | Example Usage | Text Pairing |
20
+ |---|---|---|---|
21
+ | **danger** | Errors, destructive actions, critical warnings | delete buttons, error messages, validation errors | fg.danger (muted bg) or fg.onEmphasis (emphasis bg) |
22
+ | **success** | Positive states, confirmations, completed actions | merge buttons, success messages, confirmations | fg.success (muted bg) or fg.onEmphasis (emphasis bg) |
23
+ | **attention** | Warnings, caution states requiring user awareness | warning banners, caution labels, pending states | fg.attention (muted bg) or fg.default (emphasis bg, due to yellow contrast) |
24
+ | **severe** | High-priority warnings, more urgent than attention | urgent messages, escalations, high-priority indicators | fg.severe (muted bg) or fg.onEmphasis (emphasis bg) |
25
+ | **accent** | Selected, focused, or highlighted interactive elements | active states, selected rows, focus indicators | fg.accent (muted bg) or fg.onEmphasis (emphasis bg) |
26
+ | **neutral** | Non-semantic, secondary UI elements | secondary buttons, tags, labels without status meaning | fg.default (muted bg) or fg.onEmphasis (emphasis bg) |
27
+ | **open** | Open/active state indicators (GitHub issues, PRs) | open issues, open PRs, active discussions | fg.open (muted bg) or fg.onEmphasis (emphasis bg) |
28
+ | **closed** | Closed/declined state indicators (GitHub issues, PRs) | closed issues, closed PRs, declined items | fg.closed (muted bg) or fg.onEmphasis (emphasis bg) |
29
+ | **done** | Completed/merged state indicators | merged PRs, completed tasks, finished items | fg.done (muted bg) or fg.onEmphasis (emphasis bg) |
30
+ | **sponsors** | GitHub Sponsors content only | sponsor buttons, funding prompts, sponsor cards | fg.sponsors (muted bg) or fg.onEmphasis (emphasis bg) |
31
+ | **upsell** | Upgrade prompts, premium features, promotional content | upgrade buttons, premium badges, promotional banners | fg.upsell (muted bg) or fg.onEmphasis (emphasis bg) |
32
+
33
+ ## Background Colors
34
+
35
+ Background color tokens for surfaces, containers, and UI elements.
36
+
37
+ **Semantic tokens** (see Semantic Key for meaning):
38
+ - `bgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-emphasis`
39
+ - `bgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-muted`
40
+
41
+ ### bgColor-black
42
+ Pure black background
43
+ **R:** Avoid using raw black. Use semantic alternatives: bg.emphasis for dark backgrounds, bg.inverse for inverted contexts. Raw black/white ignore theme preferences and accessibility settings.
44
+
45
+ ### bgColor-default
46
+ Default background color for pages and main content areas
47
+ **U:** card-background, main-content, page-background
48
+ **R:** Use as the primary background for pages and content areas. Do NOT use for emphasis or highlighting.
49
+
50
+ ### bgColor-disabled
51
+ Background for disabled interactive elements
52
+ **U:** disabled-button, disabled-input, inactive-element
53
+ **R:** MUST use for disabled state backgrounds. Pair -> fg.disabled for text. Do NOT use for active elements.
54
+
55
+ ### bgColor-draft-emphasis
56
+ Strong background for draft state badges and labels
57
+ **U:** draft-badge, draft-label, wip-indicator
58
+ **R:** Use for prominent draft state indicators. Pair -> fg.onEmphasis for text.
59
+
60
+ ### bgColor-draft-muted
61
+ Subtle background for draft state indicators
62
+ **U:** draft-issue, draft-pr, work-in-progress
63
+ **R:** Use for draft/WIP status indicators. Conveys incomplete or pending state.
64
+
65
+ ### bgColor-emphasis
66
+ High-emphasis dark background for strong visual contrast
67
+ **U:** badge-background, high-contrast-element, tooltip
68
+ **R:** Use for elements needing strong visual emphasis. Pair -> fg.onEmphasis for text. Do NOT use for large areas.
69
+
70
+ ### bgColor-inset
71
+ Inset background for recessed content areas like wells or sunken panels
72
+ **U:** recessed-area, sunken-panel, well
73
+ **R:** Use for visually recessed areas. Creates depth hierarchy. Suitable for input fields and wells.
74
+
75
+ ### bgColor-inverse
76
+ Inverse background that flips between light and dark modes
77
+ **U:** inverse-theme-element, overlay-content
78
+ **R:** Use when you need opposite theme background. Pair -> fg.onInverse for text.
79
+
80
+ ### bgColor-muted
81
+ Muted background for secondary content areas and subtle grouping
82
+ **U:** code-block-background, secondary-content, table-header
83
+ **R:** Use for secondary content areas or to create visual grouping. Do NOT use for primary page backgrounds.
84
+
85
+ ### bgColor-transparent
86
+ Fully transparent background
87
+ **U:** ghost-button, icon-button, overlay-trigger
88
+ **R:** Use for ghost/icon buttons or when element should blend with parent. Ensure sufficient contrast for interactive states.
89
+
90
+ ### bgColor-white
91
+ Pure white background
92
+ **R:** Avoid using raw white. Use semantic alternatives: bg.default for standard backgrounds, bg.inset for recessed areas, or bg.inverse for inverted contexts. Raw black/white ignore theme preferences and accessibility settings.
93
+
94
+ ## Border
95
+
96
+ Composite border tokens combining color, width, and style.
97
+
98
+ **Semantic tokens** (see Semantic Key for meaning):
99
+ - `border-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-emphasis`
100
+ - `border-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-muted`
101
+
102
+ **Tokens:** border-default, border-disabled, border-emphasis, border-muted, border-transparent
103
+
104
+ ## Border Colors
105
+
106
+ Border color tokens for boundaries, dividers, and outlines.
107
+
108
+ **Semantic tokens** (see Semantic Key for meaning):
109
+ - `borderColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-emphasis`
110
+ - `borderColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-muted`
111
+
112
+ ### borderColor-default
113
+ Default border color for most UI elements
114
+ **U:** card-border, default-border, input-border
115
+ **R:** RECOMMENDED default for all borders. Use for cards, inputs, and dividers.
116
+
117
+ ### borderColor-disabled
118
+ Border color for disabled interactive elements
119
+ **U:** disabled-border, inactive-border, unavailable
120
+ **R:** MUST use for disabled state borders. Pair -> bg.disabled. Do NOT use for active elements.
121
+
122
+ ### borderColor-draft-emphasis
123
+ Strong border for draft state badges
124
+ **U:** draft-emphasis, draft-status
125
+ **R:** Use for emphasized draft state borders. Pair -> bg.draft.emphasis.
126
+
127
+ ### borderColor-draft-muted
128
+ Subtle border for draft state indicators
129
+ **U:** draft-issue, draft-muted, draft-pr
130
+ **R:** Use for draft/WIP status borders. Conveys incomplete or pending state.
131
+
132
+ ### borderColor-emphasis
133
+ Strong border for emphasis and visual weight
134
+ **U:** emphasis-border, selected-border, strong-border
135
+ **R:** Use for borders needing more visual weight. Darker than border.default.
136
+
137
+ ### borderColor-muted
138
+ Subtle border for secondary elements and light separators
139
+ **U:** light-divider, secondary-border, subtle-border
140
+ **R:** Use for subtle borders and separators. Less prominent than border.default.
141
+
142
+ ### borderColor-translucent
143
+ Semi-transparent border for overlays and layered elements
144
+ **U:** overlay-border, translucent-border
145
+ **R:** Use for semi-transparent borders on overlays. Works well with translucent backgrounds.
146
+
147
+ ## Border Radius
148
+
149
+ Corner radius tokens for rounded elements.
150
+
151
+ ### borderRadius-full
152
+ Use this border radius for pill shaped elements
153
+ **U:** avatar, circular-button, pill-badge
154
+ **R:** Use for avatars and pill-shaped elements. Do NOT use for rectangular containers.
155
+
156
+ ### borderRadius-large
157
+ Large border radius (12px). Use for larger containers, dialogs, or when more visual softness is desired. Always use this for buttons.
158
+ **U:** card, dialog, modal
159
+ **R:** Recommended for dialogs and modals.
160
+
161
+ ### borderRadius-medium
162
+ Medium border radius (6px). The default choice for most buttons, cards, and containers
163
+ **U:** button, input, textarea
164
+ **R:** Default choice for most components. Use for inputs, cards, and general containers.
165
+
166
+ ### borderRadius-small
167
+ Small border radius (3px). Use for small variants of components or small UI elements like badges, tags, or anything below 16px in height
168
+ **U:** badge, label, tag
169
+ **R:** Use for small UI elements under 16px height. Do NOT use for buttons or cards.
170
+
171
+ ## Border Width
172
+
173
+ Border thickness tokens.
174
+
175
+ ### borderWidth-thick
176
+ Thick 2px border for emphasis. Use for focus indicators, selected states, or to emphasize important boundaries
177
+ **U:** emphasis-border, focus-indicator, selected-state
178
+ **R:** MUST use for focus rings on interactive elements. Do NOT use for subtle dividers.
179
+
180
+ ## Color
181
+ ### ANSI Terminal Colors
182
+
183
+ ANSI terminal color palette for command-line interfaces and terminal emulators. Maps standard ANSI color names to theme-appropriate values.
184
+
185
+ **U:** terminal-output, cli-interface, console-text
186
+ **R:** Use exclusively for terminal/CLI contexts. Do NOT use for general UI—use semantic colors (fgColor, bgColor) instead. These colors follow ANSI naming conventions (black, red, green, yellow, blue, magenta, cyan, white) with bright variants.
187
+
188
+ **Pattern:** `color-ansi-[color]` or `color-ansi-[color]-bright`
189
+
190
+ **Variables:**
191
+ - **color:** black | red | green | yellow | blue | magenta | cyan | white | gray
192
+ - **variant:** default (no suffix) | bright
193
+
194
+ ### Syntax Highlighting (prettylights)
195
+
196
+ Syntax highlighting colors for code display. Used by GitHub code rendering (prettylights theme).
197
+
198
+ **U:** code-syntax-highlighting, code-block, inline-code
199
+ **R:** Use exclusively for syntax highlighting in code display contexts. Do NOT use for general UI text or backgrounds. Each token maps to a specific syntax element (comment, keyword, string, etc.).
200
+
201
+ **Pattern:** `color-prettylights-syntax-[element]`
202
+
203
+ **Core elements:** comment, constant, entity, keyword, string, variable
204
+
205
+ **Compound elements:**
206
+ - `brackethighlighter-[angle, unmatched]`
207
+ - `carriage-[return]-[bg, text]`
208
+ - `constant-[other-reference-link]`
209
+ - `entity-[tag]`
210
+ - `invalid-[illegal]-[bg, text]`
211
+ - `markup-[bold, heading, italic, list]`
212
+ - `markup-[changed, deleted, ignored, inserted]-[bg, text]`
213
+ - `meta-[diff-range]`
214
+ - `storage-[modifier-import]`
215
+ - `string-[regexp]`
216
+ - `sublimelinter-[gutter-mark]`
217
+
218
+ ## Controls
219
+
220
+ Tokens for interactive controls like buttons, inputs, and selects.
221
+
222
+ **Scale:** Use xsmall/small for dense layouts, medium for default UI, large/xlarge for prominent CTAs.
223
+
224
+ **Size patterns:**
225
+ - `control-[xsmall, small, medium, large, xlarge]-[gap, lineBoxHeight, paddingBlock, paddingInline-normal, size]`
226
+ - `control-[xsmall, medium, large, xlarge]-paddingInline-spacious`
227
+ - `control-[xsmall, small, medium]-paddingInline-condensed`
228
+
229
+ **State variants:**
230
+ - `control-checked-[bgColor-active, bgColor-disabled, bgColor-hover, bgColor-rest, borderColor-active, borderColor-disabled, borderColor-hover, borderColor-rest, fgColor-disabled, fgColor-rest]`
231
+ - `control-transparent-[bgColor-active, bgColor-disabled, bgColor-hover, bgColor-rest, bgColor-selected, borderColor-active, borderColor-hover, borderColor-rest]`
232
+
233
+ **Other tokens:**
234
+ - `control-bgColor-[active, disabled, hover, rest, selected]`
235
+ - `control-borderColor-[danger, disabled, emphasis, rest, selected, success, warning]`
236
+ - `control-danger-bgColor-[active, hover]`
237
+ - `control-danger-fgColor-[hover, rest]`
238
+ - `control-fgColor-[disabled, placeholder, rest]`
239
+ - `control-iconColor-rest`
240
+ - `control-minTarget-[auto, coarse, fine]`
241
+
242
+ ## Control Knob
243
+
244
+ Colors for toggle switch knobs (the circular handle that moves along the track).
245
+
246
+ **U:** slider-thumb, switch-handle, toggle-knob
247
+ **R:** Use for the movable handle/thumb of toggle switches and sliders. Pair -> controlTrack tokens for the background rail.
248
+
249
+ **Tokens:** controlKnob-bgColor-checked, controlKnob-bgColor-disabled, controlKnob-bgColor-rest, controlKnob-borderColor-checked, controlKnob-borderColor-disabled, controlKnob-borderColor-rest
250
+
251
+ ## Control Stack
252
+
253
+ Gap tokens for groups of controls arranged in a row or column.
254
+
255
+ **Scale:** Match gap size to control size. Use condensed for tight groupings, spacious for separated actions.
256
+
257
+ **Size patterns:**
258
+ - `controlStack-[small, medium, large]-[gap-auto, gap-condensed, gap-spacious]`
259
+
260
+ ## Control Track
261
+
262
+ Colors for toggle switch tracks (the background rail that the knob slides along).
263
+
264
+ **U:** slider-track, switch-track, toggle-track
265
+ **R:** Use for the track/rail element of toggle switches and sliders. Pair -> controlKnob tokens for the movable handle.
266
+
267
+ **Tokens:** controlTrack-bgColor-active, controlTrack-bgColor-disabled, controlTrack-bgColor-hover, controlTrack-bgColor-rest, controlTrack-borderColor-disabled, controlTrack-borderColor-rest, controlTrack-fgColor-disabled, controlTrack-fgColor-rest
268
+
269
+ ## Data Visualization
270
+
271
+ Color tokens for charts, graphs, and diagrams. Use emphasis variants for lines/bars, muted variants for fills.
272
+
273
+ **U:** chart-series, graph-line, bar-fill
274
+ **R:** Use data colors for visualizations only. Do NOT use for semantic meaning (use bg.success/danger instead). When using multiple series, ensure sufficient contrast between adjacent colors. Pair emphasis with muted variants of the same color for cohesive styling.
275
+
276
+ **Pattern:** `data-[color]-color-[variant]`
277
+
278
+ **Variables:**
279
+ - **color:** auburn | blue | brown | coral | gray | green | lemon | lime | olive | orange | pine | pink | plum | purple | red | teal | yellow
280
+ - **variant:** emphasis | muted
281
+
282
+ **Variant usage:**
283
+ - **emphasis:** Lines, bars, borders, data points
284
+ - **muted:** Area fills, backgrounds, subtle regions
285
+
286
+ *Pair emphasis with muted variants of the same color for cohesive chart styling.*
287
+
288
+ ## Display Colors
289
+
290
+ Decorative colors for categorization without semantic meaning. Use for labels, tags, avatars, and user-assigned colors. Do NOT use for success/error/warning—use semantic colors instead.
291
+
292
+ **U:** label, tag, avatar
293
+ **R:** Use display colors for arbitrary categorization where the color has no inherent meaning (e.g., project labels, user avatars). For meaningful states like success, error, or warning, use semantic colors instead. Scales 0-2 are lighter (backgrounds), 3-5 are mid-tones, 6-9 are darker (foregrounds/borders).
294
+
295
+ **Pattern:** `display-[color]-[property]`
296
+
297
+ **Variables:**
298
+ - **color:** auburn | blue | brown | coral | cyan | gray | green | indigo | lemon | lime | olive | orange | pine | pink | plum | purple | red | teal | yellow
299
+ - **property:** bgColor-emphasis | bgColor-muted | borderColor-emphasis | borderColor-muted | fgColor
300
+
301
+ **Scale pattern:** `display-[color]-scale-[n]`
302
+ - **n:** 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
303
+
304
+ *Scale 0-2: lighter (backgrounds), 3-5: mid-tones, 6-9: darker (foregrounds/borders)*
305
+
306
+ ## Easing
307
+
308
+ Animation easing function tokens.
309
+
310
+ ### base-easing-ease
311
+ CSS default easing. Use for hover state changes and micro-interactions.
312
+ **U:** button-hover, hover-state, micro-interaction
313
+ **R:** Use for hover state changes.
314
+
315
+ ### base-easing-easeIn
316
+ Accelerating motion. Use for elements exiting the viewport (moving off-screen).
317
+ **U:** element-leaving, exit-animation, off-screen-motion
318
+ **R:** Rarely used alone. Prefer ease-out for most exit animations.
319
+
320
+ ### base-easing-easeInOut
321
+ Smooth acceleration and deceleration. Use for elements moving or morphing within the viewport.
322
+ **U:** morph-animation, position-change, size-change
323
+ **R:** Use if an element moves or morphs on screen.
324
+
325
+ ### base-easing-easeOut
326
+ Decelerating motion. Use for elements entering the viewport or appearing on screen.
327
+ **U:** element-appearing, enter-animation, modal-open
328
+ **R:** RECOMMENDED default. Use if an element enters or exits the viewport.
329
+
330
+ ### base-easing-linear
331
+ Constant motion with no acceleration. Use for continuous animations like progress bars or loaders.
332
+ **U:** continuous-animation, loader, progress-bar
333
+ **R:** Use if the motion is constant.
334
+
335
+ ## Foreground Colors
336
+
337
+ Text and icon color tokens.
338
+
339
+ **Semantic tokens** (see Semantic Key for meaning):
340
+ - `fgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]`
341
+
342
+ ### fgColor-black
343
+ Pure black text
344
+ **R:** Avoid using raw black. Use semantic alternatives: fg.default for standard text, fg.muted for secondary text. Raw black/white ignore theme preferences and accessibility settings.
345
+
346
+ ### fgColor-default
347
+ Default text color for primary content and headings
348
+ **U:** body-text, default-text, heading
349
+ **R:** RECOMMENDED default for all text. Use for headings, body text, and primary labels.
350
+
351
+ ### fgColor-disabled
352
+ Text color for disabled interactive elements
353
+ **U:** disabled-text, inactive-text, unavailable
354
+ **R:** MUST use for disabled state text. Pair -> bg.disabled. Do NOT use for active elements.
355
+
356
+ ### fgColor-draft
357
+ Text color for draft state indicators
358
+ **U:** draft-issue, draft-pr, draft-text
359
+ **R:** Use for draft/WIP status text. Conveys incomplete or pending state.
360
+
361
+ ### fgColor-link
362
+ Text color for hyperlinks
363
+ **U:** hyperlink, link-text
364
+ **R:** MUST use for all text links. Provides expected link affordance.
365
+
366
+ ### fgColor-muted
367
+ Muted text for secondary content and less important information
368
+ **U:** helper-text, muted-text, secondary-text
369
+ **R:** Use for secondary text like timestamps, metadata, and helper text. Do NOT use for primary content.
370
+
371
+ ### fgColor-onEmphasis
372
+ Text color for use on emphasis backgrounds
373
+ **U:** contrast-text, text-on-emphasis
374
+ **R:** MUST use for text on any emphasis background (bg.*.emphasis). Ensures accessibility contrast.
375
+
376
+ ### fgColor-onInverse
377
+ Text color for use on inverse backgrounds
378
+ **U:** inverse-text, text-on-inverse
379
+ **R:** Use for text on bg.inverse. Provides appropriate contrast in both themes.
380
+
381
+ ### fgColor-white
382
+ Pure white text
383
+ **R:** Avoid using raw white. Use semantic alternatives: fg.onEmphasis for text on dark backgrounds, fg.onInverse for inverted contexts. Raw black/white ignore theme preferences and accessibility settings.
384
+
385
+ ## Focus
386
+
387
+ Focus ring and outline tokens for keyboard navigation accessibility.
388
+
389
+ ### focus-outline
390
+ Focus ring outline for keyboard navigation and accessibility.
391
+ **U:** accessibility-indicator, focus-ring, keyboard-navigation
392
+ **R:** Always ensure focus states are visible. Do not override with custom focus styles that reduce visibility. Use for interactive elements like buttons, links, and form controls.
393
+
394
+ ### focus-outlineColor
395
+ Outline color for focus states on interactive elements
396
+ **U:** accessibility-indicator, focus-ring, keyboard-navigation
397
+ **R:** Use for focus outlines on interactive elements like buttons, links, and form controls. MUST be visible for keyboard navigation accessibility. Do NOT use for decorative borders or non-interactive elements.
398
+
399
+ ## Font Stacks
400
+
401
+ Font family tokens.
402
+
403
+ ### fontStack-monospace
404
+ Monospace font stack for code, technical content, and tabular data.
405
+ **U:** code-block, inline-code, terminal
406
+ **R:** MUST use for all code display. Use for technical content requiring fixed-width characters.
407
+
408
+ ### fontStack-sansSerif
409
+ Sans-serif font stack for body text and general UI elements.
410
+ **U:** body-text, form-inputs, labels
411
+ **R:** Default font stack for all UI text. Use for body text and standard UI elements. MUST use for readable content.
412
+
413
+ ### fontStack-sansSerifDisplay
414
+ Display font stack for headings and titles. Same as sansSerif but semantically distinct.
415
+ **U:** display-text, heading, title
416
+ **R:** Use for headings and display text. Prefer over sansSerif for titles.
417
+
418
+ ## Outline
419
+
420
+ Outline tokens for focus indicators.
421
+
422
+ ### outline-focus-width
423
+ Focus outline width (2px). Standard width for keyboard focus indicators to meet WCAG 2.4.7 accessibility requirements
424
+ **U:** accessibility, focus-ring, keyboard-focus
425
+ **R:** MUST use for all keyboard focus indicators. Required for WCAG 2.4.7 compliance.
426
+
427
+ ## Overlay
428
+
429
+ Tokens for modals, dialogs, popovers, and dropdown menus.
430
+
431
+ **Scale:** Use xsmall/small for menus and tooltips, medium for dialogs, large/xlarge for complex modals or sheets.
432
+
433
+ **Size patterns:**
434
+ - `overlay-height-[small, medium, large, xlarge]`
435
+ - `overlay-width-[xsmall, small, medium, large, xlarge]`
436
+
437
+ **Other tokens:**
438
+ - `overlay-backdrop-bgColor`
439
+ - `overlay-bgColor-default`
440
+ - `overlay-borderColor-default`
441
+ - `overlay-borderRadius-default`
442
+ - `overlay-offset-default`
443
+ - `overlay-padding-[condensed, normal]`
444
+ - `overlay-paddingBlock-[condensed, normal]`
445
+
446
+ ## Selection
447
+
448
+ Tokens for text selection highlights.
449
+
450
+ ### selection-bgColor
451
+ Background color for text selection highlights
452
+ **U:** highlighted-text, selected-content, text-selection
453
+ **R:** Use for native text selection (::selection) and programmatic text highlighting. Do NOT use for general emphasis or background colors on containers.
454
+
455
+ ## Shadow
456
+
457
+ Box shadow tokens for elevation and depth.
458
+
459
+ ### shadow-floating-large
460
+ Large floating shadow for modals and dialogs
461
+ **U:** dialog, full-screen-overlay, modal
462
+ **R:** MUST use for modals and dialogs. Do NOT use for small floating elements.
463
+
464
+ ### shadow-floating-legacy
465
+ Legacy floating shadow for backward compatibility
466
+ **U:** backward-compatibility, legacy-component
467
+ **R:** DEPRECATED: Use shadow-floating-small instead. Only use for maintaining backward compatibility with existing implementations.
468
+
469
+ ### shadow-floating-medium
470
+ Medium floating shadow for popovers and action menus
471
+ **U:** action-menu, popover, select-panel
472
+ **R:** Use for medium-sized floating elements like popovers and action menus. More prominent than small but less than dialogs. Do NOT use for full modals.
473
+
474
+ ### shadow-floating-small
475
+ Small floating shadow for dropdowns, tooltips, and small overlays
476
+ **U:** dropdown, popover, tooltip
477
+ **R:** Use for small floating elements like dropdowns and tooltips. Do NOT use for modals or dialogs.
478
+
479
+ ### shadow-floating-xlarge
480
+ Extra large floating shadow for full-screen overlays and sheets
481
+ **U:** drawer, full-screen-overlay, side-sheet
482
+ **R:** Use for full-screen or near-full-screen overlays like side sheets and drawers. Maximum elevation in the system. Do NOT use for small floating elements.
483
+
484
+ ### shadow-inset
485
+ Inset shadow for recessed elements
486
+ **U:** input-field, pressed-button, recessed-area
487
+ **R:** Use for elements that appear pressed or inset into the surface. Commonly used for input fields and wells. Do NOT use for floating elements.
488
+
489
+ ### shadow-resting-medium
490
+ Medium resting shadow for cards and elevated surfaces
491
+ **U:** card, elevated-surface, panel
492
+ **R:** Use for cards and content panels that sit above the page surface. Provides moderate elevation without appearing to float. Do NOT use for overlays or modals.
493
+
494
+ ### shadow-resting-small
495
+ Small resting shadow for buttons and interactive elements
496
+ **U:** button, clickable-element, interactive-card
497
+ **R:** Use for buttons and small interactive elements at rest. Provides subtle depth and clickable affordance. RECOMMENDED for default button shadows.
498
+
499
+ ### shadow-resting-xsmall
500
+ Extra small resting shadow for minimal elevation
501
+ **U:** badge, chip, small-card
502
+ **R:** Use for very subtle elevation on small elements. Provides minimal lift from surface. Do NOT use for interactive elements needing clear affordance.
503
+
504
+ ## Spinner
505
+
506
+ Loading spinner size and stroke tokens.
507
+
508
+ **Scale:** Use small for inline loading, medium for buttons/cards, large for full-page states.
509
+
510
+ **Size patterns:**
511
+ - `spinner-size-[small, medium, large]`
512
+
513
+ **Other tokens:**
514
+ - `spinner-strokeWidth-default`
515
+
516
+ ## Stack
517
+
518
+ Spacing tokens for Stack layout components.
519
+
520
+ **Scale:** Use condensed for dense lists, normal for standard layouts, spacious for prominent sections.
521
+
522
+ **Other tokens:**
523
+ - `stack-gap-[condensed, normal, spacious]`
524
+ - `stack-padding-[condensed, normal, spacious]`
525
+
526
+ ## Typography
527
+
528
+ Text style shorthand tokens for consistent typography across the UI.
529
+
530
+ ### Headings
531
+
532
+ Title and display text styles for headings and hero sections.
533
+
534
+ | Token | Description | U: | R: |
535
+ |---|---|---|---|
536
+ | **text-display-shorthand** | Hero-style text for brand to product transition pages. Utilize Title (large) styles on narrow viewports. | hero-section, landing-page, marketing-header | Use sparingly for hero sections. Switch to title.large on narrow viewports. |
537
+ | **text-subtitle-shorthand** | Page sections/sub headings, or less important object names in page titles (automated action titles, for example). Same line-height as title (medium). | subtitle, description, secondary-heading | Use below titles for supporting text. Normal weight distinguishes from title styles. |
538
+ | **text-title-shorthand-large** | Page headings for user-created objects, such as issues or pull requests. Utilize title (medium) styles on narrow viewports. | page-heading, issue-title, pr-title | Use for primary page headings. Switch to title.medium on narrow viewports. |
539
+ | **text-title-shorthand-medium** | Default page title. The 32px-equivalent line-height matches with button and other medium control heights. Great for page header composition. | section-heading, card-title, dialog-title | RECOMMENDED default for page titles. Use for section headings and dialog titles. |
540
+ | **text-title-shorthand-small** | Uses the same size as body (large) with a heavier weight of semibold (600). | subsection-heading, list-title, h3 | Use for smaller headings within sections. Same size as body.large but semibold. |
541
+
542
+ ### Body
543
+
544
+ Body text and caption styles for content and UI labels.
545
+
546
+ | Token | Description | U: | R: |
547
+ |---|---|---|---|
548
+ | **text-body-shorthand-large** | User-generated content, markdown rendering. | markdown-content, article-text, readme | Use for user-generated content and markdown. Better readability for longer text. |
549
+ | **text-body-shorthand-medium** | Default UI font. Most commonly used for body text. | body-text, ui-text, form-label | RECOMMENDED default for UI text. Use for buttons, labels, and general interface text. |
550
+ | **text-body-shorthand-small** | Small body text for discrete UI applications, such as helper, footnote text. Should be used sparingly across pages. Line-height matches Body (medium) at 20px. | helper-text, footnote, metadata | Use sparingly for secondary information. Do NOT use for primary content or interactive elements. |
551
+ | **text-caption-shorthand** | Compact small font with a smaller line height of 16px. Use it for single-line scenarios, as the small sizing doesn’t pass accessibility requirements. | caption, label, badge-text | Use only for single-line or short text. Does NOT meet accessibility requirements for body text. |
552
+
553
+ ### Code
554
+
555
+ Monospace text styles for code blocks and inline code.
556
+
557
+ | Token | Description | U: | R: |
558
+ |---|---|---|---|
559
+ | **text-codeBlock-shorthand** | Default style for rendering code blocks. | code-block, pre-element, code-snippet | MUST use for multi-line code. Use monospace font stack. |
560
+ | **text-codeInline-shorthand** | Inline code blocks using em units to inherit size from its parent. | inline-code, code-element, variable-name | Use for inline code within text. Size inherits from parent using em units. |
561
+
562
+ ---
563
+
564
+ **Final Directive for AI**:
565
+ Always cross-reference the `Semantic Key` at the top of this SPEC before confirming a token choice. If a specific component token is missing, derive it using the `[category]-[semantic]-[variant]` pattern.
@@ -1,10 +1,11 @@
1
1
  import type { FormatFn } from 'style-dictionary/types';
2
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
- * Tokens with identical guidelines (from group-level inheritance) are consolidated
6
- * into a single entry listing all token names.
7
- * @param FormatFnArguments
8
- * @returns formatted markdown `string`
3
+ * @description Outputs a hyper-optimized markdown file with LLM token guidelines.
4
+ * Optimizations:
5
+ * - Bracket notation for tokens with identical guidelines
6
+ * - Global category rules extracted to paragraph
7
+ * - Shortened keys (U:, R:, Pair ->)
8
+ * - Max 3 usage items
9
+ * - No boilerplate
9
10
  */
10
11
  export declare const markdownLlmGuidelines: FormatFn;