@datalayer/primer-addons 1.0.39 → 1.0.41

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 (58) hide show
  1. package/README.md +19 -8
  2. package/lib/components/box/boxCss.js +17 -1
  3. package/lib/components/box/boxTokens.d.ts +2 -1
  4. package/lib/components/box/boxTokens.js +2 -1
  5. package/lib/components/card/Card.d.ts +119 -5
  6. package/lib/components/card/Card.js +60 -46
  7. package/lib/components/card/Card.stories.d.ts +6 -0
  8. package/lib/components/card/Card.stories.js +26 -0
  9. package/lib/components/date-picker/TimeColumns.d.ts +5 -0
  10. package/lib/components/date-picker/TimeColumns.js +44 -3
  11. package/lib/components/entity-avatar/EntityAvatar.d.ts +73 -0
  12. package/lib/components/entity-avatar/EntityAvatar.js +63 -0
  13. package/lib/components/entity-avatar/index.d.ts +1 -0
  14. package/lib/components/entity-avatar/index.js +5 -0
  15. package/lib/components/hover-card/HoverCard.d.ts +63 -0
  16. package/lib/components/hover-card/HoverCard.js +55 -0
  17. package/lib/components/hover-card/HoverCardAnchor.d.ts +33 -0
  18. package/lib/components/hover-card/HoverCardAnchor.js +26 -0
  19. package/lib/components/hover-card/HoverCardDetails.d.ts +36 -0
  20. package/lib/components/hover-card/HoverCardDetails.js +65 -0
  21. package/lib/components/hover-card/HoverCardLayer.d.ts +34 -0
  22. package/lib/components/hover-card/HoverCardLayer.js +57 -0
  23. package/lib/components/hover-card/index.d.ts +12 -0
  24. package/lib/components/hover-card/index.js +16 -0
  25. package/lib/components/hover-card/useHoverCard.d.ts +57 -0
  26. package/lib/components/hover-card/useHoverCard.js +200 -0
  27. package/lib/components/hover-card/usePrefersReducedMotion.d.ts +10 -0
  28. package/lib/components/hover-card/usePrefersReducedMotion.js +28 -0
  29. package/lib/components/index.d.ts +2 -0
  30. package/lib/components/index.js +2 -0
  31. package/lib/components/logo/DatalayerLogo.js +18 -1
  32. package/lib/components/toolbar/ToolbarButton.d.ts +2 -2
  33. package/lib/components/toolbar/ToolbarButton.js +23 -21
  34. package/lib/components/toolbar/ToolbarDropdown.js +3 -1
  35. package/lib/theme/colors/index.d.ts +1 -0
  36. package/lib/theme/colors/index.js +3 -0
  37. package/lib/theme/colors/vscodeColors.d.ts +280 -0
  38. package/lib/theme/colors/vscodeColors.js +129 -0
  39. package/lib/theme/css/createThemeCSSVars.d.ts +18 -1
  40. package/lib/theme/css/createThemeCSSVars.js +17 -1
  41. package/lib/theme/css/primerBaseVars.js +59 -0
  42. package/lib/theme/css/primerComponentsCss.d.ts +47 -0
  43. package/lib/theme/css/primerComponentsCss.js +72 -0
  44. package/lib/theme/index.d.ts +2 -0
  45. package/lib/theme/index.js +2 -0
  46. package/lib/theme/palettes/ColorPalette.js +41 -1
  47. package/lib/theme/themeRegistry.js +2 -0
  48. package/lib/theme/themeTokens.d.ts +1 -1
  49. package/lib/theme/themeTokens.js +61 -1
  50. package/lib/theme/themes/loopThemeStyles.d.ts +4 -31
  51. package/lib/theme/themes/loopThemeStyles.js +17 -44
  52. package/lib/theme/themes/vscodeEditorsCss.d.ts +12 -0
  53. package/lib/theme/themes/vscodeEditorsCss.js +239 -0
  54. package/lib/theme/themes/vscodeTheme.d.ts +1085 -0
  55. package/lib/theme/themes/vscodeTheme.js +17 -0
  56. package/lib/theme/themes/vscodeThemeStyles.d.ts +7 -0
  57. package/lib/theme/themes/vscodeThemeStyles.js +246 -0
  58. package/package.json +3 -2
@@ -0,0 +1,280 @@
1
+ /**
2
+ * VS Code Color System – the editor's own colours.
3
+ *
4
+ * Inside a Visual Studio Code webview the editor publishes its colour theme
5
+ * as `--vscode-*` custom properties on the page and rewrites them when the
6
+ * person picks another theme (Abyss, Dark Modern, Quiet Light…). The VS Code
7
+ * theme reads those variables, so the webview follows the editor at paint
8
+ * time, with no re-render: {@link vscodeVar} writes
9
+ * `var(--vscode-<name>, <fallback>)`, the fallback being VS Code's own
10
+ * *Dark Modern* or *Light Modern* value, which is what the theme looks like
11
+ * outside VS Code (the appearance menu on the web, a native app).
12
+ *
13
+ * `vscodeColors` holds the Dark Modern hexes under the keys the other colour
14
+ * systems have, for the consumers that need a literal colour: the swatch,
15
+ * the avatars, the illustrations.
16
+ */
17
+ /** One VS Code theme colour: its variable, and the value when it is not published. */
18
+ export interface VSCodeColor {
19
+ /** The `--vscode-*` variable, without the prefix (`editor-background`). */
20
+ variable: string;
21
+ /** VS Code's Light Modern value. */
22
+ light: string;
23
+ /** VS Code's Dark Modern value. */
24
+ dark: string;
25
+ }
26
+ /**
27
+ * The editor colours the theme reads, with their Light Modern and Dark
28
+ * Modern values (VS Code's own defaults) as the fallbacks outside VS Code.
29
+ */
30
+ export declare const vscodeVars: {
31
+ readonly editorBackground: {
32
+ readonly variable: "editor-background";
33
+ readonly light: "#FFFFFF";
34
+ readonly dark: "#1F1F1F";
35
+ };
36
+ readonly editorForeground: {
37
+ readonly variable: "editor-foreground";
38
+ readonly light: "#3B3B3B";
39
+ readonly dark: "#CCCCCC";
40
+ };
41
+ readonly foreground: {
42
+ readonly variable: "foreground";
43
+ readonly light: "#3B3B3B";
44
+ readonly dark: "#CCCCCC";
45
+ };
46
+ readonly descriptionForeground: {
47
+ readonly variable: "descriptionForeground";
48
+ readonly light: "#3B3B3BB3";
49
+ readonly dark: "#9D9D9D";
50
+ };
51
+ readonly disabledForeground: {
52
+ readonly variable: "disabledForeground";
53
+ readonly light: "#3B3B3B80";
54
+ readonly dark: "#CCCCCC80";
55
+ };
56
+ readonly sideBarBackground: {
57
+ readonly variable: "sideBar-background";
58
+ readonly light: "#F8F8F8";
59
+ readonly dark: "#181818";
60
+ };
61
+ readonly editorWidgetBackground: {
62
+ readonly variable: "editorWidget-background";
63
+ readonly light: "#F8F8F8";
64
+ readonly dark: "#202020";
65
+ };
66
+ readonly editorWidgetBorder: {
67
+ readonly variable: "editorWidget-border";
68
+ readonly light: "#E5E5E5";
69
+ readonly dark: "#313131";
70
+ };
71
+ readonly panelBorder: {
72
+ readonly variable: "panel-border";
73
+ readonly light: "#E5E5E5";
74
+ readonly dark: "#2B2B2B";
75
+ };
76
+ readonly widgetShadow: {
77
+ readonly variable: "widget-shadow";
78
+ readonly light: "#00000029";
79
+ readonly dark: "#0000005C";
80
+ };
81
+ readonly focusBorder: {
82
+ readonly variable: "focusBorder";
83
+ readonly light: "#005FB8";
84
+ readonly dark: "#0078D4";
85
+ };
86
+ readonly textLinkForeground: {
87
+ readonly variable: "textLink-foreground";
88
+ readonly light: "#005FB8";
89
+ readonly dark: "#4DAAFC";
90
+ };
91
+ readonly buttonBackground: {
92
+ readonly variable: "button-background";
93
+ readonly light: "#005FB8";
94
+ readonly dark: "#0078D4";
95
+ };
96
+ readonly buttonForeground: {
97
+ readonly variable: "button-foreground";
98
+ readonly light: "#FFFFFF";
99
+ readonly dark: "#FFFFFF";
100
+ };
101
+ readonly buttonHoverBackground: {
102
+ readonly variable: "button-hoverBackground";
103
+ readonly light: "#0258A8";
104
+ readonly dark: "#026EC1";
105
+ };
106
+ readonly buttonBorder: {
107
+ readonly variable: "button-border";
108
+ readonly light: "#0000001A";
109
+ readonly dark: "#FFFFFF12";
110
+ };
111
+ readonly buttonSecondaryBackground: {
112
+ readonly variable: "button-secondaryBackground";
113
+ readonly light: "#E5E5E5";
114
+ readonly dark: "#313131";
115
+ };
116
+ readonly buttonSecondaryForeground: {
117
+ readonly variable: "button-secondaryForeground";
118
+ readonly light: "#3B3B3B";
119
+ readonly dark: "#CCCCCC";
120
+ };
121
+ readonly buttonSecondaryHoverBackground: {
122
+ readonly variable: "button-secondaryHoverBackground";
123
+ readonly light: "#CCCCCC";
124
+ readonly dark: "#3C3C3C";
125
+ };
126
+ readonly inputBackground: {
127
+ readonly variable: "input-background";
128
+ readonly light: "#FFFFFF";
129
+ readonly dark: "#313131";
130
+ };
131
+ readonly inputForeground: {
132
+ readonly variable: "input-foreground";
133
+ readonly light: "#3B3B3B";
134
+ readonly dark: "#CCCCCC";
135
+ };
136
+ readonly inputBorder: {
137
+ readonly variable: "input-border";
138
+ readonly light: "#CECECE";
139
+ readonly dark: "#3C3C3C";
140
+ };
141
+ readonly inputPlaceholderForeground: {
142
+ readonly variable: "input-placeholderForeground";
143
+ readonly light: "#767676";
144
+ readonly dark: "#989898";
145
+ };
146
+ readonly listHoverBackground: {
147
+ readonly variable: "list-hoverBackground";
148
+ readonly light: "#F2F2F2";
149
+ readonly dark: "#2A2D2E";
150
+ };
151
+ readonly listActiveSelectionBackground: {
152
+ readonly variable: "list-activeSelectionBackground";
153
+ readonly light: "#E8E8E8";
154
+ readonly dark: "#04395E";
155
+ };
156
+ readonly errorForeground: {
157
+ readonly variable: "errorForeground";
158
+ readonly light: "#F85149";
159
+ readonly dark: "#F85149";
160
+ };
161
+ readonly editorWarningForeground: {
162
+ readonly variable: "editorWarning-foreground";
163
+ readonly light: "#BF8803";
164
+ readonly dark: "#CCA700";
165
+ };
166
+ readonly editorInfoForeground: {
167
+ readonly variable: "editorInfo-foreground";
168
+ readonly light: "#1A85FF";
169
+ readonly dark: "#3794FF";
170
+ };
171
+ readonly testingIconPassed: {
172
+ readonly variable: "testing-iconPassed";
173
+ readonly light: "#388A34";
174
+ readonly dark: "#73C991";
175
+ };
176
+ readonly terminalAnsiBlue: {
177
+ readonly variable: "terminal-ansiBlue";
178
+ readonly light: "#0451A5";
179
+ readonly dark: "#2472C8";
180
+ };
181
+ readonly terminalAnsiGreen: {
182
+ readonly variable: "terminal-ansiGreen";
183
+ readonly light: "#107C10";
184
+ readonly dark: "#0DBC79";
185
+ };
186
+ readonly terminalAnsiMagenta: {
187
+ readonly variable: "terminal-ansiMagenta";
188
+ readonly light: "#BC05BC";
189
+ readonly dark: "#BC3FBC";
190
+ };
191
+ readonly terminalAnsiYellow: {
192
+ readonly variable: "terminal-ansiYellow";
193
+ readonly light: "#949800";
194
+ readonly dark: "#E5E510";
195
+ };
196
+ readonly terminalAnsiRed: {
197
+ readonly variable: "terminal-ansiRed";
198
+ readonly light: "#CD3131";
199
+ readonly dark: "#CD3131";
200
+ };
201
+ readonly terminalAnsiCyan: {
202
+ readonly variable: "terminal-ansiCyan";
203
+ readonly light: "#0598BC";
204
+ readonly dark: "#11A8CD";
205
+ };
206
+ };
207
+ /** The names of the colours the theme reads. */
208
+ export type VSCodeVarName = keyof typeof vscodeVars;
209
+ /**
210
+ * An editor colour as the theme writes it: the live variable, its
211
+ * mode's default when the page is not a VS Code webview.
212
+ *
213
+ * @param name - The colour.
214
+ * @param mode - Which default to fall back on.
215
+ *
216
+ * @returns `var(--vscode-<variable>, <fallback>)`.
217
+ */
218
+ export declare function vscodeVar(name: VSCodeVarName, mode: 'light' | 'dark'): string;
219
+ /**
220
+ * An editor colour at a fraction of its opacity, for the muted surfaces
221
+ * (a banner's tint, a chip's background): the live colour mixed with
222
+ * transparency, which keeps following the editor's theme.
223
+ *
224
+ * @param name - The colour.
225
+ * @param mode - Which default to fall back on.
226
+ * @param percent - How much of the colour, 0 to 100.
227
+ *
228
+ * @returns A `color-mix()` of the colour and transparent.
229
+ */
230
+ export declare function vscodeTint(name: VSCodeVarName, mode: 'light' | 'dark', percent: number): string;
231
+ /** The editor's UI font: VS Code's, else what VS Code picks on each OS. */
232
+ export declare const vscodeFontFamily = "var(--vscode-font-family, system-ui, \"Ubuntu\", \"Droid Sans\", -apple-system, BlinkMacSystemFont, \"Segoe WPC\", \"Segoe UI\", sans-serif)";
233
+ /** The editor's code font. */
234
+ export declare const vscodeMonoFontFamily = "var(--vscode-editor-font-family, \"Droid Sans Mono\", \"monospace\", monospace)";
235
+ /** The editor's UI font size (13px by default). */
236
+ export declare const vscodeFontSize = "var(--vscode-font-size, 13px)";
237
+ /**
238
+ * The VS Code colours as literal values — Dark Modern's — under the keys the
239
+ * other colour systems share, for the swatch, the avatars and the
240
+ * illustrations, which need a colour rather than a reference.
241
+ */
242
+ export declare const vscodeColors: {
243
+ readonly black: "#1F1F1F";
244
+ readonly gray: "#9D9D9D";
245
+ readonly white: "#FFFFFF";
246
+ readonly vscodeBase: "#0078D4";
247
+ readonly vscodeBrand: "#0078D4";
248
+ readonly vscodeAccent: "#4DAAFC";
249
+ readonly vscodeText: "#005FB8";
250
+ readonly vscodeTint: "#E8F1FB";
251
+ readonly vscodeBright: "#4DAAFC";
252
+ readonly vscodeHover: "#026EC1";
253
+ readonly attentionBrand: "#BF8803";
254
+ readonly attentionAccent: "#CCA700";
255
+ readonly attentionTint: "#FFF4CE";
256
+ readonly dangerBrand: "#F85149";
257
+ readonly dangerAccent: "#F85149";
258
+ readonly dangerTint: "#FDE7E6";
259
+ readonly severeBrand: "#BC4C00";
260
+ readonly severeAccent: "#DB6D28";
261
+ readonly severeTint: "#FFE9D9";
262
+ readonly doneBrand: "#BC05BC";
263
+ readonly doneAccent: "#BC3FBC";
264
+ readonly doneTint: "#F5E1F5";
265
+ readonly brightGlow: "#4DAAFC";
266
+ readonly brightPop: "#0DBC79";
267
+ readonly brightSpark: "#11A8CD";
268
+ readonly brightBlaze: "#F14C4C";
269
+ readonly brightSurge: "#2472C8";
270
+ readonly brightFlame: "#E5E510";
271
+ readonly brightGold: "#FFCC00";
272
+ readonly brightLightGlow: "#005FB8";
273
+ readonly brightLightPop: "#107C10";
274
+ readonly brightLightSpark: "#0598BC";
275
+ readonly brightLightBlaze: "#CD3131";
276
+ readonly brightLightSurge: "#0451A5";
277
+ readonly brightLightFlame: "#949800";
278
+ readonly brightLightGold: "#9A7B00";
279
+ };
280
+ export default vscodeColors;
@@ -0,0 +1,129 @@
1
+ /*
2
+ * Copyright (c) 2023-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * The editor colours the theme reads, with their Light Modern and Dark
7
+ * Modern values (VS Code's own defaults) as the fallbacks outside VS Code.
8
+ */
9
+ export const vscodeVars = {
10
+ editorBackground: { variable: 'editor-background', light: '#FFFFFF', dark: '#1F1F1F' },
11
+ editorForeground: { variable: 'editor-foreground', light: '#3B3B3B', dark: '#CCCCCC' },
12
+ foreground: { variable: 'foreground', light: '#3B3B3B', dark: '#CCCCCC' },
13
+ descriptionForeground: { variable: 'descriptionForeground', light: '#3B3B3BB3', dark: '#9D9D9D' },
14
+ disabledForeground: { variable: 'disabledForeground', light: '#3B3B3B80', dark: '#CCCCCC80' },
15
+ sideBarBackground: { variable: 'sideBar-background', light: '#F8F8F8', dark: '#181818' },
16
+ editorWidgetBackground: { variable: 'editorWidget-background', light: '#F8F8F8', dark: '#202020' },
17
+ editorWidgetBorder: { variable: 'editorWidget-border', light: '#E5E5E5', dark: '#313131' },
18
+ panelBorder: { variable: 'panel-border', light: '#E5E5E5', dark: '#2B2B2B' },
19
+ widgetShadow: { variable: 'widget-shadow', light: '#00000029', dark: '#0000005C' },
20
+ focusBorder: { variable: 'focusBorder', light: '#005FB8', dark: '#0078D4' },
21
+ textLinkForeground: { variable: 'textLink-foreground', light: '#005FB8', dark: '#4DAAFC' },
22
+ buttonBackground: { variable: 'button-background', light: '#005FB8', dark: '#0078D4' },
23
+ buttonForeground: { variable: 'button-foreground', light: '#FFFFFF', dark: '#FFFFFF' },
24
+ buttonHoverBackground: { variable: 'button-hoverBackground', light: '#0258A8', dark: '#026EC1' },
25
+ buttonBorder: { variable: 'button-border', light: '#0000001A', dark: '#FFFFFF12' },
26
+ buttonSecondaryBackground: { variable: 'button-secondaryBackground', light: '#E5E5E5', dark: '#313131' },
27
+ buttonSecondaryForeground: { variable: 'button-secondaryForeground', light: '#3B3B3B', dark: '#CCCCCC' },
28
+ buttonSecondaryHoverBackground: { variable: 'button-secondaryHoverBackground', light: '#CCCCCC', dark: '#3C3C3C' },
29
+ inputBackground: { variable: 'input-background', light: '#FFFFFF', dark: '#313131' },
30
+ inputForeground: { variable: 'input-foreground', light: '#3B3B3B', dark: '#CCCCCC' },
31
+ inputBorder: { variable: 'input-border', light: '#CECECE', dark: '#3C3C3C' },
32
+ inputPlaceholderForeground: { variable: 'input-placeholderForeground', light: '#767676', dark: '#989898' },
33
+ listHoverBackground: { variable: 'list-hoverBackground', light: '#F2F2F2', dark: '#2A2D2E' },
34
+ listActiveSelectionBackground: { variable: 'list-activeSelectionBackground', light: '#E8E8E8', dark: '#04395E' },
35
+ errorForeground: { variable: 'errorForeground', light: '#F85149', dark: '#F85149' },
36
+ editorWarningForeground: { variable: 'editorWarning-foreground', light: '#BF8803', dark: '#CCA700' },
37
+ editorInfoForeground: { variable: 'editorInfo-foreground', light: '#1A85FF', dark: '#3794FF' },
38
+ testingIconPassed: { variable: 'testing-iconPassed', light: '#388A34', dark: '#73C991' },
39
+ terminalAnsiBlue: { variable: 'terminal-ansiBlue', light: '#0451A5', dark: '#2472C8' },
40
+ terminalAnsiGreen: { variable: 'terminal-ansiGreen', light: '#107C10', dark: '#0DBC79' },
41
+ terminalAnsiMagenta: { variable: 'terminal-ansiMagenta', light: '#BC05BC', dark: '#BC3FBC' },
42
+ terminalAnsiYellow: { variable: 'terminal-ansiYellow', light: '#949800', dark: '#E5E510' },
43
+ terminalAnsiRed: { variable: 'terminal-ansiRed', light: '#CD3131', dark: '#CD3131' },
44
+ terminalAnsiCyan: { variable: 'terminal-ansiCyan', light: '#0598BC', dark: '#11A8CD' },
45
+ };
46
+ /**
47
+ * An editor colour as the theme writes it: the live variable, its
48
+ * mode's default when the page is not a VS Code webview.
49
+ *
50
+ * @param name - The colour.
51
+ * @param mode - Which default to fall back on.
52
+ *
53
+ * @returns `var(--vscode-<variable>, <fallback>)`.
54
+ */
55
+ export function vscodeVar(name, mode) {
56
+ const color = vscodeVars[name];
57
+ return `var(--vscode-${color.variable}, ${color[mode]})`;
58
+ }
59
+ /**
60
+ * An editor colour at a fraction of its opacity, for the muted surfaces
61
+ * (a banner's tint, a chip's background): the live colour mixed with
62
+ * transparency, which keeps following the editor's theme.
63
+ *
64
+ * @param name - The colour.
65
+ * @param mode - Which default to fall back on.
66
+ * @param percent - How much of the colour, 0 to 100.
67
+ *
68
+ * @returns A `color-mix()` of the colour and transparent.
69
+ */
70
+ export function vscodeTint(name, mode, percent) {
71
+ return `color-mix(in srgb, ${vscodeVar(name, mode)} ${percent}%, transparent)`;
72
+ }
73
+ /** The editor's sans-serif, when the page is not a VS Code webview. */
74
+ const vscodeSystemFont = 'system-ui, "Ubuntu", "Droid Sans", -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", sans-serif';
75
+ /** The editor's UI font: VS Code's, else what VS Code picks on each OS. */
76
+ export const vscodeFontFamily = `var(--vscode-font-family, ${vscodeSystemFont})`;
77
+ /** The editor's code font. */
78
+ export const vscodeMonoFontFamily = 'var(--vscode-editor-font-family, "Droid Sans Mono", "monospace", monospace)';
79
+ /** The editor's UI font size (13px by default). */
80
+ export const vscodeFontSize = 'var(--vscode-font-size, 13px)';
81
+ /**
82
+ * The VS Code colours as literal values — Dark Modern's — under the keys the
83
+ * other colour systems share, for the swatch, the avatars and the
84
+ * illustrations, which need a colour rather than a reference.
85
+ */
86
+ export const vscodeColors = {
87
+ // Core Neutrals — Dark Modern
88
+ black: vscodeVars.editorBackground.dark, // #1F1F1F — editor background
89
+ gray: vscodeVars.descriptionForeground.dark, // #9D9D9D — secondary text
90
+ white: vscodeVars.editorBackground.light, // #FFFFFF — Light Modern background
91
+ // VS Code palette (Brand) — the product's blue
92
+ vscodeBase: '#0078D4', // Base color — the button, the focus ring
93
+ vscodeBrand: '#0078D4', // Brand / swatch
94
+ vscodeAccent: '#4DAAFC', // Links on dark surfaces
95
+ vscodeText: '#005FB8', // Accessible text and buttons on white
96
+ vscodeTint: '#E8F1FB', // Pale blue — callouts on light surfaces
97
+ vscodeBright: '#4DAAFC', // Highlights on dark backgrounds
98
+ vscodeHover: '#026EC1', // Primary button hover
99
+ // Semantic roles — the editor's
100
+ attentionBrand: vscodeVars.editorWarningForeground.light,
101
+ attentionAccent: vscodeVars.editorWarningForeground.dark,
102
+ attentionTint: '#FFF4CE',
103
+ dangerBrand: vscodeVars.errorForeground.light,
104
+ dangerAccent: vscodeVars.errorForeground.dark,
105
+ dangerTint: '#FDE7E6',
106
+ severeBrand: '#BC4C00',
107
+ severeAccent: '#DB6D28',
108
+ severeTint: '#FFE9D9',
109
+ doneBrand: vscodeVars.terminalAnsiMagenta.light,
110
+ doneAccent: vscodeVars.terminalAnsiMagenta.dark,
111
+ doneTint: '#F5E1F5',
112
+ // Bright / vivid colours for SVG illustrations — the terminal's ANSI colours
113
+ brightGlow: '#4DAAFC', // Link blue — primary glow
114
+ brightPop: '#0DBC79', // ANSI green — contrasting accent
115
+ brightSpark: '#11A8CD', // ANSI cyan — sparkle
116
+ brightBlaze: '#F14C4C', // ANSI bright red — warm accent
117
+ brightSurge: '#2472C8', // ANSI blue — cool accent
118
+ brightFlame: '#E5E510', // ANSI yellow — warm energy
119
+ brightGold: '#FFCC00', // Gold — highlight
120
+ // Vivid brights for light backgrounds — deeper for contrast on white
121
+ brightLightGlow: '#005FB8', // Deep blue
122
+ brightLightPop: '#107C10', // Deep green
123
+ brightLightSpark: '#0598BC', // Deep cyan
124
+ brightLightBlaze: '#CD3131', // Deep red
125
+ brightLightSurge: '#0451A5', // Deep blue
126
+ brightLightFlame: '#949800', // Deep yellow
127
+ brightLightGold: '#9A7B00', // Deep gold
128
+ };
129
+ export default vscodeColors;
@@ -195,6 +195,14 @@ export interface ThemeStyles {
195
195
  * And how a link reads in a message (LOOP T-06): in the accent, as today, or
196
196
  * — `currentColor` — plain, the colour of the words around it, underlined in
197
197
  * every theme.
198
+ *
199
+ * And the corner of a panel floating over the page — a menu, a header's
200
+ * mega-menu (`--theme-radius-overlay`, `borderRadius="overlay"` on a Box).
201
+ *
202
+ * And Primer's own components, as the theme draws them: a data table's
203
+ * corner, header band, header text and hairline. Primer's values unless the
204
+ * theme says otherwise; what a theme says about a control or a table is
205
+ * drawn by the stylesheet `primerComponentsCss` makes of it.
198
206
  */
199
207
  export interface ThemeShape {
200
208
  radiusControl: string;
@@ -208,6 +216,11 @@ export interface ThemeShape {
208
216
  motionPane: string;
209
217
  motionEasing: string;
210
218
  messageLink: string;
219
+ radiusTable: string;
220
+ radiusOverlay: string;
221
+ tableHeaderBg: string;
222
+ tableHeaderFg: string;
223
+ tableBorder: string;
211
224
  }
212
225
  /** Today's shape, which every theme has unless it says otherwise. */
213
226
  export declare const DEFAULT_THEME_SHAPE: ThemeShape;
@@ -225,6 +238,10 @@ export declare function buildThemeStyles(light: ThemeColorDefs, dark: ThemeColor
225
238
  light?: Record<string, string>;
226
239
  dark?: Record<string, string>;
227
240
  };
228
- /** A stylesheet of the theme's own, relative to `:scope`; see `ThemeStyles.css`. */
241
+ /**
242
+ * A stylesheet of the theme's own, relative to `:scope`; see
243
+ * `ThemeStyles.css`. It follows what `primerComponentsCss` makes of the
244
+ * shape.
245
+ */
229
246
  css?: string;
230
247
  }): ThemeStyles;
@@ -3,6 +3,7 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  import { themeTintVars } from '../colors/themeAccents';
6
+ import { primerComponentsCss } from './primerComponentsCss';
6
7
  /* ─── Helper ──────────────────────────────────────────────────────────── */
7
8
  /**
8
9
  * Convert a structured `ThemeColorDefs` object into a flat
@@ -260,6 +261,14 @@ export const DEFAULT_THEME_SHAPE = {
260
261
  motionPane: '0ms',
261
262
  motionEasing: 'ease',
262
263
  messageLink: 'var(--fgColor-accent, #0969da)',
264
+ // Primer's own DataTable: its corner, its header band and text, its hairline.
265
+ radiusTable: '0.375rem',
266
+ // A panel that floats over the page — a menu, a header's mega-menu: Primer's
267
+ // overlay corner unless the theme says otherwise.
268
+ radiusOverlay: 'var(--borderRadius-large, 12px)',
269
+ tableHeaderBg: 'var(--bgColor-muted)',
270
+ tableHeaderFg: 'var(--fgColor-muted)',
271
+ tableBorder: 'var(--borderColor-default)',
263
272
  };
264
273
  /** A shape as custom properties. */
265
274
  export function shapeVars(shape = {}) {
@@ -276,9 +285,16 @@ export function shapeVars(shape = {}) {
276
285
  '--theme-motion-pane': full.motionPane,
277
286
  '--theme-motion-easing': full.motionEasing,
278
287
  '--theme-message-link': full.messageLink,
288
+ '--theme-radius-table': full.radiusTable,
289
+ '--theme-radius-overlay': full.radiusOverlay,
290
+ '--theme-table-header-bg': full.tableHeaderBg,
291
+ '--theme-table-header-fg': full.tableHeaderFg,
292
+ '--theme-table-border': full.tableBorder,
279
293
  };
280
294
  }
281
295
  export function buildThemeStyles(light, dark, options) {
296
+ // What the shape says about Primer's components, then the theme's own.
297
+ const css = primerComponentsCss(options?.shape) + (options?.css ?? '');
282
298
  const fontVars = {};
283
299
  if (options?.fontFamily) {
284
300
  const f = options.fontFamily;
@@ -325,6 +341,6 @@ export function buildThemeStyles(light, dark, options) {
325
341
  ...themeTintVars(dark),
326
342
  ...(options?.variables?.dark ?? {}),
327
343
  },
328
- ...(options?.css ? { css: options.css } : {}),
344
+ ...(css ? { css } : {}),
329
345
  };
330
346
  }
@@ -22,6 +22,63 @@ const radii = {
22
22
  '--borderRadius-full': '9999px',
23
23
  };
24
24
  /** The open and closed states are success and danger, as in Primer. */
25
+ /*
26
+ * The sizes Primer's controls read from `@primer/primitives`' size and
27
+ * border sheets (`--base-size-*`, `--borderWidth-*`, the control sizes),
28
+ * for a page that loads no primitives sheet — a VS Code webview, a page of
29
+ * Primer components alone: without them a text input has no border and a
30
+ * button no height, their shorthands being invalid. The values are the
31
+ * primitives' own.
32
+ */
33
+ const sizes = {
34
+ '--base-size-2': '0.125rem',
35
+ '--base-size-4': '0.25rem',
36
+ '--base-size-6': '0.375rem',
37
+ '--base-size-8': '0.5rem',
38
+ '--base-size-12': '0.75rem',
39
+ '--base-size-16': '1rem',
40
+ '--base-size-20': '1.25rem',
41
+ '--base-size-24': '1.5rem',
42
+ '--base-size-28': '1.75rem',
43
+ '--base-size-32': '2rem',
44
+ '--base-size-36': '2.25rem',
45
+ '--base-size-40': '2.5rem',
46
+ '--base-size-44': '2.75rem',
47
+ '--base-size-48': '3rem',
48
+ '--base-size-64': '4rem',
49
+ '--base-size-80': '5rem',
50
+ '--base-size-96': '6rem',
51
+ '--base-size-112': '7rem',
52
+ '--base-size-128': '8rem',
53
+ '--borderWidth-thin': '0.0625rem',
54
+ '--borderWidth-default': 'var(--borderWidth-thin)',
55
+ '--borderWidth-thick': '0.125rem',
56
+ '--borderWidth-thicker': '0.25rem',
57
+ '--boxShadow-thin': 'inset 0 0 0 var(--borderWidth-thin)',
58
+ '--stack-gap-condensed': '0.5rem',
59
+ '--control-xsmall-size': '1.5rem',
60
+ '--control-xsmall-paddingBlock': '0.125rem',
61
+ '--control-xsmall-paddingInline-condensed': '0.25rem',
62
+ '--control-xsmall-paddingInline-normal': '0.5rem',
63
+ '--control-xsmall-paddingInline-spacious': '0.75rem',
64
+ '--control-small-size': '1.75rem',
65
+ '--control-small-paddingBlock': '0.25rem',
66
+ '--control-small-paddingInline-condensed': '0.5rem',
67
+ '--control-small-paddingInline-normal': '0.75rem',
68
+ '--control-medium-size': '2rem',
69
+ '--control-medium-paddingBlock': '0.375rem',
70
+ '--control-medium-paddingInline-condensed': '0.5rem',
71
+ '--control-medium-paddingInline-normal': '0.75rem',
72
+ '--control-medium-paddingInline-spacious': '1rem',
73
+ '--control-large-size': '2.5rem',
74
+ '--control-large-paddingBlock': '0.625rem',
75
+ '--control-large-paddingInline-normal': '0.75rem',
76
+ '--control-large-paddingInline-spacious': '1rem',
77
+ '--control-xlarge-size': '3rem',
78
+ '--control-xlarge-paddingBlock': '0.875rem',
79
+ '--control-xlarge-paddingInline-normal': '0.75rem',
80
+ '--control-xlarge-paddingInline-spacious': '1rem',
81
+ };
25
82
  const states = {
26
83
  '--fgColor-open': 'var(--fgColor-success)',
27
84
  '--bgColor-open-emphasis': 'var(--bgColor-success-emphasis)',
@@ -34,6 +91,7 @@ const states = {
34
91
  };
35
92
  export const primerBaseVars = {
36
93
  light: {
94
+ ...sizes,
37
95
  ...radii,
38
96
  ...states,
39
97
  '--bgColor-emphasis': '#25292e',
@@ -52,6 +110,7 @@ export const primerBaseVars = {
52
110
  '--shadow-floating-xlarge': '0px 0px 0px 1px #d1d9e0, 0px 56px 112px 0px #25292e52',
53
111
  },
54
112
  dark: {
113
+ ...sizes,
55
114
  ...radii,
56
115
  ...states,
57
116
  '--bgColor-emphasis': '#3d444d',
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Primer's own components, drawn by the theme's shape.
3
+ *
4
+ * A theme's shape (`ThemeShape`) names a control's corner and a table's
5
+ * corner, header and hairline. Primer takes a control's corners from
6
+ * `--borderRadius-medium`, which cards and list items take too, and a data
7
+ * table's from its own `--table-border-radius`, so none of this can be a
8
+ * token alone: it is a stylesheet, scoped by the theme provider
9
+ * (`ThemeStyles.css`), with one rule per thing the theme says. A theme that
10
+ * says nothing gets no rule and keeps Primer's look, and no stylesheet.
11
+ *
12
+ * Primer's class names are CSS-module hashes (`prc-Button-ButtonBase-c50BI`),
13
+ * so the selectors match their stable prefix; the toggle switch is a
14
+ * styled-component, matched by its display name, which styled-components
15
+ * puts in its class (`ToggleSwitch__SwitchButton-sc-e6gszy-0`). A test reads
16
+ * each of them back from the installed `@primer/react`.
17
+ */
18
+ import type { ThemeShape } from './createThemeCSSVars';
19
+ export declare const primerComponentSelectors: {
20
+ readonly button: "[class*=\"prc-Button-ButtonBase\"]";
21
+ readonly textInput: "[class*=\"prc-components-TextInputBaseWrapper\"]";
22
+ readonly textArea: "[class*=\"prc-Textarea-TextArea\"]";
23
+ readonly segmentedControl: "[class*=\"prc-SegmentedControl-SegmentedControl\"]";
24
+ readonly buttonGroup: "[class*=\"prc-ButtonGroup-ButtonGroup\"]";
25
+ readonly underlineTab: "[class*=\"prc-components-UnderlineItem\"]";
26
+ readonly toggleTrack: "[class*=\"ToggleSwitch__SwitchButton-\"]";
27
+ readonly toggleKnob: "[class*=\"ToggleSwitch__ToggleKnob-\"]";
28
+ readonly table: "[class*=\"prc-DataTable-Table-\"]";
29
+ readonly tableHeader: "[class*=\"prc-DataTable-TableHeader-\"]";
30
+ readonly tableCell: "[class*=\"prc-DataTable-TableCell-\"]";
31
+ };
32
+ /**
33
+ * The stylesheet for what a theme's shape says about Primer's components;
34
+ * empty when it says nothing about them.
35
+ *
36
+ * - `radiusControl` — every single-line control: a button, a text input, a
37
+ * select, a segmented control (outside and each segment), a button
38
+ * group's two ends, a toggle switch, an underline tab's hover. A
39
+ * multi-line text area keeps `--borderRadius-medium`: a pill of many
40
+ * lines is a lozenge. Where a control draws more than one element from the
41
+ * token — a segmented control's track and segments, a button group's ends
42
+ * — the token itself is set on the control, and Primer's rules draw it.
43
+ * - `radiusTable` — a data table's outer corners (`--table-border-radius`).
44
+ * - `tableHeaderBg`, `tableHeaderFg` — its header band and header text.
45
+ * - `tableBorder` — the hairline between and around its cells.
46
+ */
47
+ export declare function primerComponentsCss(shape?: Partial<ThemeShape>): string;