@primer/primitives 11.4.1-rc.eb8ee149 → 11.4.1-rc.edbe0e39
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.
- package/DESIGN_TOKENS_GUIDE.md +185 -0
- package/DESIGN_TOKENS_SPEC.md +122 -3
- package/dist/build/formats/jsonFigma.js +8 -1
- package/dist/build/formats/markdownLlmGuidelines.js +349 -0
- package/dist/build/schemas/borderToken.d.ts +17 -3
- package/dist/build/schemas/colorToken.d.ts +1 -1
- package/dist/build/schemas/cubicBezierToken.d.ts +1 -1
- package/dist/build/schemas/dimensionToken.d.ts +9 -2
- package/dist/build/schemas/dimensionValue.d.ts +12 -1
- package/dist/build/schemas/dimensionValue.js +10 -13
- package/dist/build/schemas/durationToken.d.ts +8 -2
- package/dist/build/schemas/durationValue.d.ts +11 -1
- package/dist/build/schemas/durationValue.js +13 -3
- package/dist/build/schemas/fontFamilyToken.d.ts +1 -1
- package/dist/build/schemas/fontWeightToken.d.ts +1 -1
- package/dist/build/schemas/gradientToken.d.ts +1 -1
- package/dist/build/schemas/numberToken.d.ts +1 -1
- package/dist/build/schemas/shadowToken.d.ts +673 -85
- package/dist/build/schemas/stringToken.d.ts +1 -1
- package/dist/build/schemas/stringToken.js +1 -1
- package/dist/build/schemas/tokenType.d.ts +1 -1
- package/dist/build/schemas/transitionToken.d.ts +15 -3
- package/dist/build/schemas/typographyToken.d.ts +19 -5
- package/dist/build/schemas/typographyToken.js +1 -1
- package/dist/build/schemas/validTokenType.d.ts +1 -1
- package/dist/build/schemas/validTokenType.js +1 -1
- package/dist/build/schemas/viewportRangeToken.d.ts +1 -1
- package/dist/build/transformers/borderToCss.js +17 -1
- package/dist/build/transformers/dimensionToPixelUnitless.d.ts +3 -2
- package/dist/build/transformers/dimensionToPixelUnitless.js +22 -26
- package/dist/build/transformers/dimensionToRem.d.ts +2 -1
- package/dist/build/transformers/dimensionToRem.js +21 -22
- package/dist/build/transformers/dimensionToRemPxArray.d.ts +2 -1
- package/dist/build/transformers/dimensionToRemPxArray.js +21 -22
- package/dist/build/transformers/durationToCss.d.ts +2 -1
- package/dist/build/transformers/durationToCss.js +18 -11
- package/dist/build/transformers/shadowToCss.js +12 -1
- package/dist/build/transformers/utilities/parseDimension.d.ts +12 -0
- package/dist/build/transformers/utilities/parseDimension.js +31 -0
- package/dist/build/types/borderTokenValue.d.ts +3 -1
- package/dist/build/types/dimensionTokenValue.d.ts +9 -0
- package/dist/build/types/shadowTokenValue.d.ts +6 -4
- package/dist/css/functional/themes/dark-colorblind-high-contrast.css +28 -28
- package/dist/css/functional/themes/dark-colorblind.css +28 -28
- package/dist/css/functional/themes/dark-dimmed-high-contrast.css +28 -28
- package/dist/css/functional/themes/dark-dimmed.css +28 -28
- package/dist/css/functional/themes/dark-high-contrast.css +28 -28
- package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +28 -28
- package/dist/css/functional/themes/dark-tritanopia.css +28 -28
- package/dist/css/functional/themes/dark.css +28 -28
- package/dist/css/functional/themes/light-colorblind-high-contrast.css +28 -28
- package/dist/css/functional/themes/light-colorblind.css +28 -28
- package/dist/css/functional/themes/light-high-contrast.css +28 -28
- package/dist/css/functional/themes/light-tritanopia-high-contrast.css +28 -28
- package/dist/css/functional/themes/light-tritanopia.css +28 -28
- package/dist/css/functional/themes/light.css +28 -28
- package/dist/docs/base/motion/motion.json +96 -24
- package/dist/docs/base/size/size.json +76 -19
- package/dist/docs/base/typography/typography.json +24 -6
- package/dist/docs/functional/size/border.json +26 -11
- package/dist/docs/functional/size/breakpoints.json +24 -6
- package/dist/docs/functional/size/radius.json +16 -4
- package/dist/docs/functional/size/size.json +60 -15
- package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +1423 -346
- package/dist/docs/functional/themes/dark-colorblind.json +1423 -346
- package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +1423 -346
- package/dist/docs/functional/themes/dark-dimmed.json +1423 -346
- package/dist/docs/functional/themes/dark-high-contrast.json +1423 -346
- package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +1423 -346
- package/dist/docs/functional/themes/dark-tritanopia.json +1423 -346
- package/dist/docs/functional/themes/dark.json +1423 -346
- package/dist/docs/functional/themes/light-colorblind-high-contrast.json +1426 -349
- package/dist/docs/functional/themes/light-colorblind.json +1426 -349
- package/dist/docs/functional/themes/light-high-contrast.json +1426 -349
- package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +1426 -349
- package/dist/docs/functional/themes/light-tritanopia.json +1426 -349
- package/dist/docs/functional/themes/light.json +1426 -349
- package/dist/docs/functional/typography/typography.json +8 -2
- package/dist/fallbacks/base/motion/motion.json +48 -12
- package/dist/figma/themes/light-colorblind.json +4 -4
- package/dist/figma/themes/light-high-contrast.json +4 -4
- package/dist/figma/themes/light-tritanopia.json +4 -4
- package/dist/figma/themes/light.json +4 -4
- package/dist/internalCss/dark-colorblind-high-contrast.css +28 -28
- package/dist/internalCss/dark-colorblind.css +28 -28
- package/dist/internalCss/dark-dimmed-high-contrast.css +28 -28
- package/dist/internalCss/dark-dimmed.css +28 -28
- package/dist/internalCss/dark-high-contrast.css +28 -28
- package/dist/internalCss/dark-tritanopia-high-contrast.css +28 -28
- package/dist/internalCss/dark-tritanopia.css +28 -28
- package/dist/internalCss/dark.css +28 -28
- package/dist/internalCss/light-colorblind-high-contrast.css +28 -28
- package/dist/internalCss/light-colorblind.css +28 -28
- package/dist/internalCss/light-high-contrast.css +28 -28
- package/dist/internalCss/light-tritanopia-high-contrast.css +28 -28
- package/dist/internalCss/light-tritanopia.css +28 -28
- package/dist/internalCss/light.css +28 -28
- package/dist/styleLint/base/motion/motion.json +96 -24
- package/dist/styleLint/base/size/size.json +76 -19
- package/dist/styleLint/base/typography/typography.json +30 -12
- package/dist/styleLint/functional/size/border.json +27 -12
- package/dist/styleLint/functional/size/breakpoints.json +24 -6
- package/dist/styleLint/functional/size/radius.json +17 -5
- package/dist/styleLint/functional/size/size-coarse.json +3 -3
- package/dist/styleLint/functional/size/size-fine.json +3 -3
- package/dist/styleLint/functional/size/size.json +111 -66
- package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +1551 -366
- package/dist/styleLint/functional/themes/dark-colorblind.json +1551 -366
- package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +1551 -366
- package/dist/styleLint/functional/themes/dark-dimmed.json +1551 -366
- package/dist/styleLint/functional/themes/dark-high-contrast.json +1551 -366
- package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +1551 -366
- package/dist/styleLint/functional/themes/dark-tritanopia.json +1551 -366
- package/dist/styleLint/functional/themes/dark.json +1551 -366
- package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +1554 -369
- package/dist/styleLint/functional/themes/light-colorblind.json +1554 -369
- package/dist/styleLint/functional/themes/light-high-contrast.json +1554 -369
- package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +1554 -369
- package/dist/styleLint/functional/themes/light-tritanopia.json +1554 -369
- package/dist/styleLint/functional/themes/light.json +1554 -369
- package/dist/styleLint/functional/typography/typography.json +28 -22
- package/package.json +2 -2
- package/src/tokens/base/motion/timing.json5 +12 -12
- package/src/tokens/base/size/size.json5 +19 -19
- package/src/tokens/base/typography/typography.json5 +6 -6
- package/src/tokens/component/avatar.json5 +72 -44
- package/src/tokens/component/button.json5 +1545 -1193
- package/src/tokens/functional/border/border.json5 +4 -1
- package/src/tokens/functional/color/bgColor.json5 +8 -0
- package/src/tokens/functional/color/display.json5 +7 -0
- package/src/tokens/functional/color/fgColor.json5 +8 -0
- package/src/tokens/functional/color/syntax.json5 +14 -0
- package/src/tokens/functional/shadow/shadow.json5 +678 -163
- package/src/tokens/functional/size/border.json5 +8 -8
- package/src/tokens/functional/size/breakpoints.json5 +6 -6
- package/src/tokens/functional/size/radius.json5 +4 -4
- package/src/tokens/functional/size/size.json5 +15 -15
- package/src/tokens/functional/typography/typography.json5 +8 -4
- package/dist/build/parsers/index.d.ts +0 -1
- package/dist/build/parsers/index.js +0 -1
- package/dist/build/parsers/w3cJsonParser.d.ts +0 -6
- package/dist/build/parsers/w3cJsonParser.js +0 -25
- package/dist/removed/testing.json5 +0 -4
- package/guidelines/color.llm.md +0 -16
- package/guidelines/guidelines.llm.md +0 -34
- package/guidelines/motion.llm.md +0 -41
- package/guidelines/spacing.llm.md +0 -20
- package/guidelines/typography.llm.md +0 -14
- package/src/tokens/removed/testing.json5 +0 -4
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Design Tokens Master Guide
|
|
2
|
+
|
|
3
|
+
> Metadata: This file defines the Logic and Rules for the design system. For individual token definitions and raw values, refer to DESIGN_TOKENS_SPEC.md.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Core Rule
|
|
8
|
+
|
|
9
|
+
**You are a CSS expert. Never use raw values (hex, px, etc.). Only use semantic tokens.**
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Logic Matrix: Color Pairings
|
|
14
|
+
|
|
15
|
+
| Background Token | Foreground Token | Notes |
|
|
16
|
+
| ---------------------- | ---------------------- | ------------------------- |
|
|
17
|
+
| `--bgColor-*-emphasis` | `--fgColor-onEmphasis` | MUST pair |
|
|
18
|
+
| `--bgColor-*-muted` | `--fgColor-{semantic}` | MUST use semantic fg |
|
|
19
|
+
| `--bgColor-default` | `--fgColor-default` | Standard pairing |
|
|
20
|
+
| `--bgColor-muted` | `--fgColor-default` | NEVER use `fgColor-muted` |
|
|
21
|
+
|
|
22
|
+
**Contrast Requirements:**
|
|
23
|
+
|
|
24
|
+
| Context | Ratio | Standard |
|
|
25
|
+
| --------------- | ----- | -------- |
|
|
26
|
+
| Normal text | 4.5:1 | WCAG AA |
|
|
27
|
+
| Large text / UI | 3:1 | WCAG AA |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Pattern Compression
|
|
32
|
+
|
|
33
|
+
### Control Tokens
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
--control-[size]-[property]
|
|
37
|
+
├── size: xsmall | small | medium | large | xlarge
|
|
38
|
+
└── property: size | paddingInline-[density] | paddingBlock
|
|
39
|
+
└── density: condensed | normal | spacious
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Stack Tokens
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
--stack-[property]-[size]
|
|
46
|
+
├── property: gap | padding
|
|
47
|
+
└── size: condensed | normal | spacious
|
|
48
|
+
|
|
49
|
+
--controlStack-[size]-gap-[density]
|
|
50
|
+
├── size: small | medium | large
|
|
51
|
+
└── density: condensed | auto | spacious
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Typography Tokens
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
--text-[role]-shorthand-[size]
|
|
58
|
+
├── role: display | title | body | subtitle | caption | codeBlock | codeInline
|
|
59
|
+
└── size: small | medium | large
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Keyword Enforcement (RFC 2119)
|
|
65
|
+
|
|
66
|
+
### Motion
|
|
67
|
+
|
|
68
|
+
| Keyword | Rule |
|
|
69
|
+
| ------- | -------------------------------------------------------------- |
|
|
70
|
+
| MUST | Use motion for interactive state changes (hover, focus, press) |
|
|
71
|
+
| MUST | Keep animations ≤300ms for UI interactions |
|
|
72
|
+
| MUST | Respect `prefers-reduced-motion` media query |
|
|
73
|
+
| MUST | Provide instant alternatives when motion is reduced |
|
|
74
|
+
| SHOULD | Use 100-200ms for micro-interactions |
|
|
75
|
+
| SHOULD | Use 200-300ms for state changes |
|
|
76
|
+
| NEVER | Exceed 500ms for UI interactions |
|
|
77
|
+
| NEVER | Use motion purely for decoration |
|
|
78
|
+
| NEVER | Create indefinitely looping motion without user control |
|
|
79
|
+
| NEVER | Rely solely on motion to convey information |
|
|
80
|
+
|
|
81
|
+
### Typography
|
|
82
|
+
|
|
83
|
+
| Keyword | Rule |
|
|
84
|
+
| ---------- | --------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| **MUST** | Use **shorthand** tokens (e.g., `font: var(...)`) to ensure `line-height` and `font-weight` are synchronized. |
|
|
86
|
+
| **MUST** | Use `text-codeBlock` for multi-line blocks and `text-codeInline` for inline spans. |
|
|
87
|
+
| **SHOULD** | Match the token to the **semantic role** (e.g., use `title` tokens for headers, not just a large `body` token). |
|
|
88
|
+
| **SHOULD** | Downgrade one size level for mobile viewports (e.g., `title-large` → `title-medium`). |
|
|
89
|
+
| **NEVER** | Use individual `font-size` or `line-height` tokens if a shorthand variant is available. |
|
|
90
|
+
| **NEVER** | Use `text-caption-shorthand` for multi-line body text (accessibility/readability failure). |
|
|
91
|
+
|
|
92
|
+
### Spacing
|
|
93
|
+
|
|
94
|
+
| Keyword | Rule |
|
|
95
|
+
| ------- | ------------------------------------------- |
|
|
96
|
+
| MUST | Use control tokens for interactive elements |
|
|
97
|
+
| MUST | Use stack tokens for layout spacing |
|
|
98
|
+
| MUST | Match padding density to control's purpose |
|
|
99
|
+
| SHOULD | Use `medium` size as default |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Decision Tree: Easing Selection
|
|
104
|
+
|
|
105
|
+
1. Is element entering/exiting viewport? → ease-out (default)
|
|
106
|
+
2. Is element moving/morphing on screen? → ease-in-out
|
|
107
|
+
3. Is this a hover state change? → ease
|
|
108
|
+
4. Is this constant motion (loaders)? → linear
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Golden Example: Reference Component
|
|
113
|
+
|
|
114
|
+
```css
|
|
115
|
+
/* Button: All 5 interactive states with correct token usage */
|
|
116
|
+
.btn {
|
|
117
|
+
/* Base styles */
|
|
118
|
+
background-color: var(--control-bgColor-rest);
|
|
119
|
+
color: var(--fgColor-default);
|
|
120
|
+
border: none;
|
|
121
|
+
border-radius: var(--borderRadius-medium);
|
|
122
|
+
padding-block: var(--control-medium-paddingBlock);
|
|
123
|
+
padding-inline: var(--control-medium-paddingInline-normal);
|
|
124
|
+
font: var(--text-body-shorthand-medium);
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
|
|
127
|
+
/* Motion: MUST be <300ms */
|
|
128
|
+
transition:
|
|
129
|
+
background-color 150ms ease,
|
|
130
|
+
box-shadow 150ms ease,
|
|
131
|
+
transform 100ms ease;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* State: Hover */
|
|
135
|
+
.btn:hover {
|
|
136
|
+
background-color: var(--control-bgColor-hover);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* State: Focus-visible (MUST use :focus-visible, not :focus) */
|
|
140
|
+
.btn:focus-visible {
|
|
141
|
+
outline: var(--focus-outline);
|
|
142
|
+
outline-offset: var(--outline-focus-offset);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* State: Active/Pressed */
|
|
146
|
+
.btn:active {
|
|
147
|
+
background-color: var(--control-bgColor-active);
|
|
148
|
+
transform: scale(0.98);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* State: Disabled */
|
|
152
|
+
.btn:disabled {
|
|
153
|
+
background-color: var(--bgColor-disabled);
|
|
154
|
+
color: var(--fgColor-disabled);
|
|
155
|
+
cursor: not-allowed;
|
|
156
|
+
opacity: 1; /* NEVER use opacity for disabled */
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Accessibility: MUST respect reduced motion */
|
|
160
|
+
@media (prefers-reduced-motion: reduce) {
|
|
161
|
+
.btn {
|
|
162
|
+
transition: none;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Interactive States Checklist
|
|
170
|
+
|
|
171
|
+
All interactive elements MUST define:
|
|
172
|
+
|
|
173
|
+
| State | Selector | Required |
|
|
174
|
+
| -------- | -------------------------------------- | ------------------------ |
|
|
175
|
+
| Rest | `.element` | ✓ |
|
|
176
|
+
| Hover | `:hover` | ✓ |
|
|
177
|
+
| Focus | `:focus-visible` | ✓ (NEVER `:focus` alone) |
|
|
178
|
+
| Active | `:active` | ✓ |
|
|
179
|
+
| Disabled | `:disabled` / `[aria-disabled="true"]` | ✓ |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Hallucination Guard
|
|
184
|
+
|
|
185
|
+
> **If you suggest a token name not found in this spec or the system, suffix it with `/* check-token */`.**
|
package/DESIGN_TOKENS_SPEC.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Primer Design Token Guidelines
|
|
2
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
|
+
|
|
3
5
|
Reference for using GitHub Primer design tokens.
|
|
4
6
|
|
|
5
7
|
## Legend
|
|
@@ -36,6 +38,10 @@ Background color tokens for surfaces, containers, and UI elements.
|
|
|
36
38
|
- `bgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-emphasis`
|
|
37
39
|
- `bgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-muted`
|
|
38
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
|
+
|
|
39
45
|
### bgColor-default
|
|
40
46
|
Default background color for pages and main content areas
|
|
41
47
|
**U:** card-background, main-content, page-background
|
|
@@ -81,6 +87,10 @@ Fully transparent background
|
|
|
81
87
|
**U:** ghost-button, icon-button, overlay-trigger
|
|
82
88
|
**R:** Use for ghost/icon buttons or when element should blend with parent. Ensure sufficient contrast for interactive states.
|
|
83
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
|
+
|
|
84
94
|
## Border
|
|
85
95
|
|
|
86
96
|
Composite border tokens combining color, width, and style.
|
|
@@ -167,6 +177,44 @@ Thick 2px border for emphasis. Use for focus indicators, selected states, or to
|
|
|
167
177
|
**U:** emphasis-border, focus-indicator, selected-state
|
|
168
178
|
**R:** MUST use for focus rings on interactive elements. Do NOT use for subtle dividers.
|
|
169
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
|
+
|
|
170
218
|
## Controls
|
|
171
219
|
|
|
172
220
|
Tokens for interactive controls like buttons, inputs, and selects.
|
|
@@ -220,12 +268,40 @@ Colors for toggle switch tracks (the background rail that the knob slides along)
|
|
|
220
268
|
|
|
221
269
|
## Data Visualization
|
|
222
270
|
|
|
223
|
-
|
|
271
|
+
Color tokens for charts, graphs, and diagrams. Use emphasis variants for lines/bars, muted variants for fills.
|
|
224
272
|
|
|
225
|
-
**U:**
|
|
273
|
+
**U:** chart-series, graph-line, bar-fill
|
|
226
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.
|
|
227
275
|
|
|
228
|
-
**
|
|
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)*
|
|
229
305
|
|
|
230
306
|
## Easing
|
|
231
307
|
|
|
@@ -263,6 +339,10 @@ Text and icon color tokens.
|
|
|
263
339
|
**Semantic tokens** (see Semantic Key for meaning):
|
|
264
340
|
- `fgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]`
|
|
265
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
|
+
|
|
266
346
|
### fgColor-default
|
|
267
347
|
Default text color for primary content and headings
|
|
268
348
|
**U:** body-text, default-text, heading
|
|
@@ -298,6 +378,10 @@ Text color for use on inverse backgrounds
|
|
|
298
378
|
**U:** inverse-text, text-on-inverse
|
|
299
379
|
**R:** Use for text on bg.inverse. Provides appropriate contrast in both themes.
|
|
300
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
|
+
|
|
301
385
|
## Focus
|
|
302
386
|
|
|
303
387
|
Focus ring and outline tokens for keyboard navigation accessibility.
|
|
@@ -377,11 +461,46 @@ Large floating shadow for modals and dialogs
|
|
|
377
461
|
**U:** dialog, full-screen-overlay, modal
|
|
378
462
|
**R:** MUST use for modals and dialogs. Do NOT use for small floating elements.
|
|
379
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
|
+
|
|
380
474
|
### shadow-floating-small
|
|
381
475
|
Small floating shadow for dropdowns, tooltips, and small overlays
|
|
382
476
|
**U:** dropdown, popover, tooltip
|
|
383
477
|
**R:** Use for small floating elements like dropdowns and tooltips. Do NOT use for modals or dialogs.
|
|
384
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
|
+
|
|
385
504
|
## Spinner
|
|
386
505
|
|
|
387
506
|
Loading spinner size and stroke tokens.
|
|
@@ -35,10 +35,17 @@ const getFigmaType = (type) => {
|
|
|
35
35
|
throw new Error(`Invalid type: ${type}`);
|
|
36
36
|
};
|
|
37
37
|
const shadowToVariables = (name, values, token) => {
|
|
38
|
+
// Helper to extract numeric value from W3C dimension object
|
|
39
|
+
const getDimensionValue = (dim) => {
|
|
40
|
+
if (typeof dim === 'object' && 'value' in dim) {
|
|
41
|
+
return dim.value;
|
|
42
|
+
}
|
|
43
|
+
throw new Error(`Invalid shadow dimension: expected W3C object format, got ${JSON.stringify(dim)}`);
|
|
44
|
+
};
|
|
38
45
|
// floatValue
|
|
39
46
|
const floatValue = (property) => ({
|
|
40
47
|
name: `${name}/${property}`,
|
|
41
|
-
value:
|
|
48
|
+
value: getDimensionValue(values[property]),
|
|
42
49
|
type: 'FLOAT',
|
|
43
50
|
scopes: ['EFFECT_FLOAT'],
|
|
44
51
|
mode,
|