@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.
- package/README.md +19 -8
- package/lib/components/box/boxCss.js +17 -1
- package/lib/components/box/boxTokens.d.ts +2 -1
- package/lib/components/box/boxTokens.js +2 -1
- package/lib/components/card/Card.d.ts +119 -5
- package/lib/components/card/Card.js +60 -46
- package/lib/components/card/Card.stories.d.ts +6 -0
- package/lib/components/card/Card.stories.js +26 -0
- package/lib/components/date-picker/TimeColumns.d.ts +5 -0
- package/lib/components/date-picker/TimeColumns.js +44 -3
- package/lib/components/entity-avatar/EntityAvatar.d.ts +73 -0
- package/lib/components/entity-avatar/EntityAvatar.js +63 -0
- package/lib/components/entity-avatar/index.d.ts +1 -0
- package/lib/components/entity-avatar/index.js +5 -0
- package/lib/components/hover-card/HoverCard.d.ts +63 -0
- package/lib/components/hover-card/HoverCard.js +55 -0
- package/lib/components/hover-card/HoverCardAnchor.d.ts +33 -0
- package/lib/components/hover-card/HoverCardAnchor.js +26 -0
- package/lib/components/hover-card/HoverCardDetails.d.ts +36 -0
- package/lib/components/hover-card/HoverCardDetails.js +65 -0
- package/lib/components/hover-card/HoverCardLayer.d.ts +34 -0
- package/lib/components/hover-card/HoverCardLayer.js +57 -0
- package/lib/components/hover-card/index.d.ts +12 -0
- package/lib/components/hover-card/index.js +16 -0
- package/lib/components/hover-card/useHoverCard.d.ts +57 -0
- package/lib/components/hover-card/useHoverCard.js +200 -0
- package/lib/components/hover-card/usePrefersReducedMotion.d.ts +10 -0
- package/lib/components/hover-card/usePrefersReducedMotion.js +28 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/logo/DatalayerLogo.js +18 -1
- package/lib/components/toolbar/ToolbarButton.d.ts +2 -2
- package/lib/components/toolbar/ToolbarButton.js +23 -21
- package/lib/components/toolbar/ToolbarDropdown.js +3 -1
- package/lib/theme/colors/index.d.ts +1 -0
- package/lib/theme/colors/index.js +3 -0
- package/lib/theme/colors/vscodeColors.d.ts +280 -0
- package/lib/theme/colors/vscodeColors.js +129 -0
- package/lib/theme/css/createThemeCSSVars.d.ts +18 -1
- package/lib/theme/css/createThemeCSSVars.js +17 -1
- package/lib/theme/css/primerBaseVars.js +59 -0
- package/lib/theme/css/primerComponentsCss.d.ts +47 -0
- package/lib/theme/css/primerComponentsCss.js +72 -0
- package/lib/theme/index.d.ts +2 -0
- package/lib/theme/index.js +2 -0
- package/lib/theme/palettes/ColorPalette.js +41 -1
- package/lib/theme/themeRegistry.js +2 -0
- package/lib/theme/themeTokens.d.ts +1 -1
- package/lib/theme/themeTokens.js +61 -1
- package/lib/theme/themes/loopThemeStyles.d.ts +4 -31
- package/lib/theme/themes/loopThemeStyles.js +17 -44
- package/lib/theme/themes/vscodeEditorsCss.d.ts +12 -0
- package/lib/theme/themes/vscodeEditorsCss.js +239 -0
- package/lib/theme/themes/vscodeTheme.d.ts +1085 -0
- package/lib/theme/themes/vscodeTheme.js +17 -0
- package/lib/theme/themes/vscodeThemeStyles.d.ts +7 -0
- package/lib/theme/themes/vscodeThemeStyles.js +246 -0
- package/package.json +3 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
export const primerComponentSelectors = {
|
|
6
|
+
button: '[class*="prc-Button-ButtonBase"]',
|
|
7
|
+
textInput: '[class*="prc-components-TextInputBaseWrapper"]',
|
|
8
|
+
textArea: '[class*="prc-Textarea-TextArea"]',
|
|
9
|
+
segmentedControl: '[class*="prc-SegmentedControl-SegmentedControl"]',
|
|
10
|
+
buttonGroup: '[class*="prc-ButtonGroup-ButtonGroup"]',
|
|
11
|
+
underlineTab: '[class*="prc-components-UnderlineItem"]',
|
|
12
|
+
toggleTrack: '[class*="ToggleSwitch__SwitchButton-"]',
|
|
13
|
+
toggleKnob: '[class*="ToggleSwitch__ToggleKnob-"]',
|
|
14
|
+
table: '[class*="prc-DataTable-Table-"]',
|
|
15
|
+
tableHeader: '[class*="prc-DataTable-TableHeader-"]',
|
|
16
|
+
tableCell: '[class*="prc-DataTable-TableCell-"]',
|
|
17
|
+
};
|
|
18
|
+
const sel = primerComponentSelectors;
|
|
19
|
+
/**
|
|
20
|
+
* The stylesheet for what a theme's shape says about Primer's components;
|
|
21
|
+
* empty when it says nothing about them.
|
|
22
|
+
*
|
|
23
|
+
* - `radiusControl` — every single-line control: a button, a text input, a
|
|
24
|
+
* select, a segmented control (outside and each segment), a button
|
|
25
|
+
* group's two ends, a toggle switch, an underline tab's hover. A
|
|
26
|
+
* multi-line text area keeps `--borderRadius-medium`: a pill of many
|
|
27
|
+
* lines is a lozenge. Where a control draws more than one element from the
|
|
28
|
+
* token — a segmented control's track and segments, a button group's ends
|
|
29
|
+
* — the token itself is set on the control, and Primer's rules draw it.
|
|
30
|
+
* - `radiusTable` — a data table's outer corners (`--table-border-radius`).
|
|
31
|
+
* - `tableHeaderBg`, `tableHeaderFg` — its header band and header text.
|
|
32
|
+
* - `tableBorder` — the hairline between and around its cells.
|
|
33
|
+
*/
|
|
34
|
+
export function primerComponentsCss(shape = {}) {
|
|
35
|
+
const rules = [];
|
|
36
|
+
if (shape.radiusControl !== undefined) {
|
|
37
|
+
rules.push(`:scope ${sel.button},
|
|
38
|
+
:scope ${sel.textInput}:not(:has(${sel.textArea})),
|
|
39
|
+
:scope ${sel.segmentedControl},
|
|
40
|
+
:scope ${sel.underlineTab},
|
|
41
|
+
:scope ${sel.toggleTrack},
|
|
42
|
+
:scope ${sel.toggleKnob} {
|
|
43
|
+
--borderRadius-medium: var(--theme-radius-control);
|
|
44
|
+
border-radius: var(--theme-radius-control);
|
|
45
|
+
}
|
|
46
|
+
:scope ${sel.buttonGroup} {
|
|
47
|
+
--borderRadius-medium: var(--theme-radius-control);
|
|
48
|
+
}`);
|
|
49
|
+
}
|
|
50
|
+
if (shape.radiusTable !== undefined) {
|
|
51
|
+
rules.push(`:scope ${sel.table} {
|
|
52
|
+
--table-border-radius: var(--theme-radius-table);
|
|
53
|
+
}`);
|
|
54
|
+
}
|
|
55
|
+
const header = [];
|
|
56
|
+
if (shape.tableHeaderBg !== undefined) {
|
|
57
|
+
header.push(' background-color: var(--theme-table-header-bg);');
|
|
58
|
+
}
|
|
59
|
+
if (shape.tableHeaderFg !== undefined) {
|
|
60
|
+
header.push(' color: var(--theme-table-header-fg);');
|
|
61
|
+
}
|
|
62
|
+
if (header.length) {
|
|
63
|
+
rules.push(`:scope ${sel.tableHeader} {\n${header.join('\n')}\n}`);
|
|
64
|
+
}
|
|
65
|
+
if (shape.tableBorder !== undefined) {
|
|
66
|
+
rules.push(`:scope ${sel.tableHeader},
|
|
67
|
+
:scope ${sel.tableCell} {
|
|
68
|
+
border-color: var(--theme-table-border);
|
|
69
|
+
}`);
|
|
70
|
+
}
|
|
71
|
+
return rules.length ? `\n${rules.join('\n')}\n` : '';
|
|
72
|
+
}
|
package/lib/theme/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './colors';
|
|
2
2
|
export * from './indicators';
|
|
3
3
|
export * from './css/createThemeCSSVars';
|
|
4
|
+
export * from './css/primerComponentsCss';
|
|
4
5
|
export * from './css/primerBaseVars';
|
|
5
6
|
export * from './themes/datalayerTheme';
|
|
6
7
|
export * from './DatalayerThemeProvider';
|
|
@@ -13,6 +14,7 @@ export * from './themes/sandTheme';
|
|
|
13
14
|
export * from './themes/ivoryTheme';
|
|
14
15
|
export * from './themes/sunTheme';
|
|
15
16
|
export * from './themes/loopTheme';
|
|
17
|
+
export * from './themes/vscodeTheme';
|
|
16
18
|
export * from './themes-brand/spatialBrandTheme';
|
|
17
19
|
export * from './themeRegistry';
|
|
18
20
|
export * from './portableTheme';
|
package/lib/theme/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export * from './colors';
|
|
6
6
|
export * from './indicators';
|
|
7
7
|
export * from './css/createThemeCSSVars';
|
|
8
|
+
export * from './css/primerComponentsCss';
|
|
8
9
|
export * from './css/primerBaseVars';
|
|
9
10
|
export * from './themes/datalayerTheme';
|
|
10
11
|
export * from './DatalayerThemeProvider';
|
|
@@ -17,6 +18,7 @@ export * from './themes/sandTheme';
|
|
|
17
18
|
export * from './themes/ivoryTheme';
|
|
18
19
|
export * from './themes/sunTheme';
|
|
19
20
|
export * from './themes/loopTheme';
|
|
21
|
+
export * from './themes/vscodeTheme';
|
|
20
22
|
export * from './themes-brand/spatialBrandTheme';
|
|
21
23
|
export * from './themeRegistry';
|
|
22
24
|
export * from './portableTheme';
|
|
@@ -7,7 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
* Shared palette types, theme-aware colour resolution, and reusable
|
|
8
8
|
* gradient / grid definitions.
|
|
9
9
|
*/
|
|
10
|
-
import { datalayerColors, spatialColors, lovelyColors, matrixColors, earthColors, sandColors, ivoryColors, sunColors, loopColors, } from '../colors';
|
|
10
|
+
import { datalayerColors, spatialColors, lovelyColors, matrixColors, earthColors, sandColors, ivoryColors, sunColors, loopColors, vscodeColors, } from '../colors';
|
|
11
11
|
import { getBrightPalette, } from '../themeRegistry';
|
|
12
12
|
import { useThemeStore } from '../useThemeStore';
|
|
13
13
|
const dlBrightDark = getBrightPalette('datalayer');
|
|
@@ -28,6 +28,8 @@ const suBrightDark = getBrightPalette('sun');
|
|
|
28
28
|
const suBrightLight = getBrightPalette('sun', 'light');
|
|
29
29
|
const loBrightDark = getBrightPalette('loop');
|
|
30
30
|
const loBrightLight = getBrightPalette('loop', 'light');
|
|
31
|
+
const vsBrightDark = getBrightPalette('vscode');
|
|
32
|
+
const vsBrightLight = getBrightPalette('vscode', 'light');
|
|
31
33
|
const palettes = {
|
|
32
34
|
datalayer: {
|
|
33
35
|
light: {
|
|
@@ -371,6 +373,44 @@ const palettes = {
|
|
|
371
373
|
isLight: false,
|
|
372
374
|
},
|
|
373
375
|
},
|
|
376
|
+
vscode: {
|
|
377
|
+
light: {
|
|
378
|
+
bg: vscodeColors.white,
|
|
379
|
+
bgPanel: '#F8F8F8',
|
|
380
|
+
bgAlt: '#F2F2F2',
|
|
381
|
+
primary: vscodeColors.vscodeText,
|
|
382
|
+
secondary: vscodeColors.vscodeBrand,
|
|
383
|
+
accent: vscodeColors.vscodeText,
|
|
384
|
+
glow: vsBrightLight.glow,
|
|
385
|
+
pop: vsBrightLight.pop,
|
|
386
|
+
spark: vsBrightLight.spark,
|
|
387
|
+
blaze: vsBrightLight.blaze,
|
|
388
|
+
surge: vsBrightLight.surge,
|
|
389
|
+
flame: vsBrightLight.flame,
|
|
390
|
+
gold: vsBrightLight.gold,
|
|
391
|
+
textLight: '#3B3B3B',
|
|
392
|
+
textMuted: '#767676',
|
|
393
|
+
isLight: true,
|
|
394
|
+
},
|
|
395
|
+
dark: {
|
|
396
|
+
bg: vscodeColors.black,
|
|
397
|
+
bgPanel: '#202020',
|
|
398
|
+
bgAlt: '#181818',
|
|
399
|
+
primary: vscodeColors.vscodeAccent,
|
|
400
|
+
secondary: vscodeColors.vscodeBrand,
|
|
401
|
+
accent: vscodeColors.vscodeAccent,
|
|
402
|
+
glow: vsBrightDark.glow,
|
|
403
|
+
pop: vsBrightDark.pop,
|
|
404
|
+
spark: vsBrightDark.spark,
|
|
405
|
+
blaze: vsBrightDark.blaze,
|
|
406
|
+
surge: vsBrightDark.surge,
|
|
407
|
+
flame: vsBrightDark.flame,
|
|
408
|
+
gold: vsBrightDark.gold,
|
|
409
|
+
textLight: '#CCCCCC',
|
|
410
|
+
textMuted: vscodeColors.gray,
|
|
411
|
+
isLight: false,
|
|
412
|
+
},
|
|
413
|
+
},
|
|
374
414
|
};
|
|
375
415
|
export function getColorPalette(theme = 'datalayer', colorMode = 'auto') {
|
|
376
416
|
const mode = colorMode === 'auto'
|
|
@@ -17,6 +17,7 @@ import { sandTheme } from './themes/sandTheme';
|
|
|
17
17
|
import { ivoryTheme } from './themes/ivoryTheme';
|
|
18
18
|
import { sunTheme } from './themes/sunTheme';
|
|
19
19
|
import { loopTheme } from './themes/loopTheme';
|
|
20
|
+
import { vscodeTheme } from './themes/vscodeTheme';
|
|
20
21
|
import { avatarColorsOf, brightPaletteOf, themeTokens, } from './themeTokens';
|
|
21
22
|
export { avatarColorsOf, brightPaletteOf, getCardGradient, getThemeTokens, themeTokens, themeVariants, } from './themeTokens';
|
|
22
23
|
const primerThemes = {
|
|
@@ -29,6 +30,7 @@ const primerThemes = {
|
|
|
29
30
|
ivory: ivoryTheme,
|
|
30
31
|
sun: sunTheme,
|
|
31
32
|
loop: loopTheme,
|
|
33
|
+
vscode: vscodeTheme,
|
|
32
34
|
};
|
|
33
35
|
export const themeConfigs = Object.fromEntries(Object.keys(themeTokens).map(variant => [
|
|
34
36
|
variant,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { type ColorMode } from './DatalayerBrandThemeProvider';
|
|
8
8
|
import { type ThemeStyles } from './css/createThemeCSSVars';
|
|
9
9
|
/** Available theme variants. */
|
|
10
|
-
export type ThemeVariant = 'datalayer' | 'spatial' | 'lovely' | 'matrix' | 'earth' | 'sand' | 'ivory' | 'sun' | 'loop';
|
|
10
|
+
export type ThemeVariant = 'datalayer' | 'spatial' | 'lovely' | 'matrix' | 'earth' | 'sand' | 'ivory' | 'sun' | 'loop' | 'vscode';
|
|
11
11
|
/** A pair of colours for a two-stop gradient. */
|
|
12
12
|
export interface GradientPair {
|
|
13
13
|
/** Start colour (brighter / brand). */
|
package/lib/theme/themeTokens.js
CHANGED
|
@@ -11,6 +11,7 @@ import { sandThemeStyles } from './themes/sandThemeStyles';
|
|
|
11
11
|
import { ivoryThemeStyles } from './themes/ivoryThemeStyles';
|
|
12
12
|
import { sunThemeStyles } from './themes/sunThemeStyles';
|
|
13
13
|
import { loopThemeStyles } from './themes/loopThemeStyles';
|
|
14
|
+
import { vscodeThemeStyles } from './themes/vscodeThemeStyles';
|
|
14
15
|
import { datalayerColors } from './colors/datalayerColors';
|
|
15
16
|
import { spatialColors } from './colors/spatialColors';
|
|
16
17
|
import { lovelyColors } from './colors/lovelyColors';
|
|
@@ -20,6 +21,7 @@ import { sandColors } from './colors/sandColors';
|
|
|
20
21
|
import { ivoryColors } from './colors/ivoryColors';
|
|
21
22
|
import { sunColors } from './colors/sunColors';
|
|
22
23
|
import { loopColors } from './colors/loopColors';
|
|
24
|
+
import { vscodeColors } from './colors/vscodeColors';
|
|
23
25
|
/* ─── Registry ────────────────────────────────────────────────────────── */
|
|
24
26
|
export const themeTokens = {
|
|
25
27
|
datalayer: {
|
|
@@ -302,9 +304,51 @@ export const themeTokens = {
|
|
|
302
304
|
gold: loopColors.brightLightGold, // #8A6A00 — deep sun
|
|
303
305
|
},
|
|
304
306
|
},
|
|
307
|
+
vscode: {
|
|
308
|
+
label: 'VS Code',
|
|
309
|
+
description: 'The editor’s own colours: in a Visual Studio Code webview it follows the colour theme in use, and changes with it; elsewhere, Dark Modern and Light Modern.',
|
|
310
|
+
brandColor: vscodeColors.vscodeBrand,
|
|
311
|
+
defaultColorMode: 'auto',
|
|
312
|
+
themeStyles: vscodeThemeStyles,
|
|
313
|
+
cardGradient: {
|
|
314
|
+
light: { from: vscodeColors.vscodeText, to: vscodeColors.brightLightSurge }, // #005FB8 → #0451A5
|
|
315
|
+
dark: { from: vscodeColors.vscodeAccent, to: vscodeColors.vscodeBrand }, // #4DAAFC → #0078D4
|
|
316
|
+
},
|
|
317
|
+
brightPalette: {
|
|
318
|
+
glow: vscodeColors.brightGlow, // #4DAAFC — link blue
|
|
319
|
+
onGlow: '#1F1F1F', // dark text on the light blue
|
|
320
|
+
pop: vscodeColors.brightPop, // #0DBC79 — ANSI green
|
|
321
|
+
spark: vscodeColors.brightSpark, // #11A8CD — ANSI cyan
|
|
322
|
+
blaze: vscodeColors.brightBlaze, // #F14C4C — ANSI bright red
|
|
323
|
+
surge: vscodeColors.brightSurge, // #2472C8 — ANSI blue
|
|
324
|
+
flame: vscodeColors.brightFlame, // #E5E510 — ANSI yellow
|
|
325
|
+
gold: vscodeColors.brightGold, // #FFCC00 — gold
|
|
326
|
+
},
|
|
327
|
+
brightPaletteLight: {
|
|
328
|
+
glow: vscodeColors.brightLightGlow, // #005FB8 — deep blue
|
|
329
|
+
onGlow: '#ffffff', // white text on deep blue
|
|
330
|
+
pop: vscodeColors.brightLightPop, // #107C10 — deep green
|
|
331
|
+
spark: vscodeColors.brightLightSpark, // #0598BC — deep cyan
|
|
332
|
+
blaze: vscodeColors.brightLightBlaze, // #CD3131 — deep red
|
|
333
|
+
surge: vscodeColors.brightLightSurge, // #0451A5 — deep blue
|
|
334
|
+
flame: vscodeColors.brightLightFlame, // #949800 — deep yellow
|
|
335
|
+
gold: vscodeColors.brightLightGold, // #9A7B00 — deep gold
|
|
336
|
+
},
|
|
337
|
+
},
|
|
305
338
|
};
|
|
306
339
|
/** All available theme variants in display order. */
|
|
307
|
-
export const themeVariants = [
|
|
340
|
+
export const themeVariants = [
|
|
341
|
+
'datalayer',
|
|
342
|
+
'spatial',
|
|
343
|
+
'lovely',
|
|
344
|
+
'matrix',
|
|
345
|
+
'earth',
|
|
346
|
+
'sand',
|
|
347
|
+
'ivory',
|
|
348
|
+
'sun',
|
|
349
|
+
'loop',
|
|
350
|
+
'vscode',
|
|
351
|
+
];
|
|
308
352
|
/** Look up a theme's tokens by variant name. */
|
|
309
353
|
export function getThemeTokens(variant) {
|
|
310
354
|
return themeTokens[variant];
|
|
@@ -483,6 +527,22 @@ const avatarColorPalettes = {
|
|
|
483
527
|
loopColors.brightGold, // #F8D469 — sun
|
|
484
528
|
],
|
|
485
529
|
},
|
|
530
|
+
vscode: {
|
|
531
|
+
light: [
|
|
532
|
+
vscodeColors.brightLightGlow, // #005FB8 — deep blue
|
|
533
|
+
vscodeColors.brightLightPop, // #107C10 — deep green
|
|
534
|
+
vscodeColors.brightLightSpark, // #0598BC — deep cyan
|
|
535
|
+
vscodeColors.brightLightBlaze, // #CD3131 — deep red
|
|
536
|
+
vscodeColors.gray, // #9D9D9D — neutral
|
|
537
|
+
],
|
|
538
|
+
dark: [
|
|
539
|
+
vscodeColors.brightGlow, // #4DAAFC — link blue
|
|
540
|
+
vscodeColors.brightPop, // #0DBC79 — ANSI green
|
|
541
|
+
vscodeColors.brightSpark, // #11A8CD — ANSI cyan
|
|
542
|
+
vscodeColors.brightBlaze, // #F14C4C — ANSI bright red
|
|
543
|
+
vscodeColors.brightFlame, // #E5E510 — ANSI yellow
|
|
544
|
+
],
|
|
545
|
+
},
|
|
486
546
|
};
|
|
487
547
|
/**
|
|
488
548
|
* The 5-colour avatar palette of a theme for a resolved colour mode, for the
|
|
@@ -93,37 +93,10 @@ export declare const loopFocusRing: {
|
|
|
93
93
|
readonly light: string;
|
|
94
94
|
readonly dark: "#636363";
|
|
95
95
|
};
|
|
96
|
+
/** Comprehensive Primer CSS-variable overrides for light & dark mode. */
|
|
97
|
+
export declare const loopThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
|
|
96
98
|
/**
|
|
97
|
-
* The
|
|
98
|
-
*
|
|
99
|
-
* each segment), a button group's two ends, a toggle switch, an underline
|
|
100
|
-
* tab's hover. A multi-line text area keeps `--borderRadius-medium`: a pill
|
|
101
|
-
* of many lines is a lozenge. Menus and overlays keep the card's radius,
|
|
102
|
-
* `--borderRadius-large`, which the theme already sets.
|
|
103
|
-
*
|
|
104
|
-
* Primer takes every control's corners from `--borderRadius-medium`, which
|
|
105
|
-
* cards and list items take too, so this cannot be a token: it is a
|
|
106
|
-
* stylesheet, scoped by the theme provider (`ThemeStyles.css`). Primer's
|
|
107
|
-
* class names are CSS-module hashes (`prc-Button-ButtonBase-c50BI`), so the
|
|
108
|
-
* selectors match their stable prefix; the toggle switch is a
|
|
109
|
-
* styled-component, matched by its display name, which styled-components
|
|
110
|
-
* puts in its class (`ToggleSwitch__SwitchButton-sc-e6gszy-0`). A test reads each of them
|
|
111
|
-
* back from the installed `@primer/react`.
|
|
112
|
-
*
|
|
113
|
-
* Where a control draws more than one element from the token — a segmented
|
|
114
|
-
* control's track and segments, a button group's ends — the token itself is
|
|
115
|
-
* set on the control, and Primer's own rules draw the pill.
|
|
99
|
+
* The loop theme's whole stylesheet (`ThemeStyles.css`): its controls as
|
|
100
|
+
* pills and its tables rounder, drawn from its shape, then its own rules.
|
|
116
101
|
*/
|
|
117
|
-
export declare const loopControlsSelectors: {
|
|
118
|
-
readonly button: "[class*=\"prc-Button-ButtonBase\"]";
|
|
119
|
-
readonly textInput: "[class*=\"prc-components-TextInputBaseWrapper\"]";
|
|
120
|
-
readonly textArea: "[class*=\"prc-Textarea-TextArea\"]";
|
|
121
|
-
readonly segmentedControl: "[class*=\"prc-SegmentedControl-SegmentedControl\"]";
|
|
122
|
-
readonly buttonGroup: "[class*=\"prc-ButtonGroup-ButtonGroup\"]";
|
|
123
|
-
readonly underlineTab: "[class*=\"prc-components-UnderlineItem\"]";
|
|
124
|
-
readonly toggleTrack: "[class*=\"ToggleSwitch__SwitchButton-\"]";
|
|
125
|
-
readonly toggleKnob: "[class*=\"ToggleSwitch__ToggleKnob-\"]";
|
|
126
|
-
};
|
|
127
102
|
export declare const loopControlsCss: string;
|
|
128
|
-
/** Comprehensive Primer CSS-variable overrides for light & dark mode. */
|
|
129
|
-
export declare const loopThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
|
|
@@ -431,50 +431,15 @@ export const loopMotionVars = {
|
|
|
431
431
|
*/
|
|
432
432
|
export const loopFocusRing = { light: loopColors.loopRing, dark: '#636363' };
|
|
433
433
|
/**
|
|
434
|
-
* The
|
|
435
|
-
*
|
|
436
|
-
* each segment), a button group's two ends, a toggle switch, an underline
|
|
437
|
-
* tab's hover. A multi-line text area keeps `--borderRadius-medium`: a pill
|
|
438
|
-
* of many lines is a lozenge. Menus and overlays keep the card's radius,
|
|
439
|
-
* `--borderRadius-large`, which the theme already sets.
|
|
440
|
-
*
|
|
441
|
-
* Primer takes every control's corners from `--borderRadius-medium`, which
|
|
442
|
-
* cards and list items take too, so this cannot be a token: it is a
|
|
443
|
-
* stylesheet, scoped by the theme provider (`ThemeStyles.css`). Primer's
|
|
444
|
-
* class names are CSS-module hashes (`prc-Button-ButtonBase-c50BI`), so the
|
|
445
|
-
* selectors match their stable prefix; the toggle switch is a
|
|
446
|
-
* styled-component, matched by its display name, which styled-components
|
|
447
|
-
* puts in its class (`ToggleSwitch__SwitchButton-sc-e6gszy-0`). A test reads each of them
|
|
448
|
-
* back from the installed `@primer/react`.
|
|
434
|
+
* The loop theme's own stylesheet, beside what its shape draws: bold is the
|
|
435
|
+
* theme's semibold, its second and last weight.
|
|
449
436
|
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
437
|
+
* Its controls are pills and its tables rounder by its shape
|
|
438
|
+
* (`radiusControl`, `radiusTable`), which `primerComponentsCss` draws for
|
|
439
|
+
* any theme that sets them: menus and overlays keep the card's radius,
|
|
440
|
+
* `--borderRadius-large`, which the theme already sets.
|
|
453
441
|
*/
|
|
454
|
-
|
|
455
|
-
button: '[class*="prc-Button-ButtonBase"]',
|
|
456
|
-
textInput: '[class*="prc-components-TextInputBaseWrapper"]',
|
|
457
|
-
textArea: '[class*="prc-Textarea-TextArea"]',
|
|
458
|
-
segmentedControl: '[class*="prc-SegmentedControl-SegmentedControl"]',
|
|
459
|
-
buttonGroup: '[class*="prc-ButtonGroup-ButtonGroup"]',
|
|
460
|
-
underlineTab: '[class*="prc-components-UnderlineItem"]',
|
|
461
|
-
toggleTrack: '[class*="ToggleSwitch__SwitchButton-"]',
|
|
462
|
-
toggleKnob: '[class*="ToggleSwitch__ToggleKnob-"]',
|
|
463
|
-
};
|
|
464
|
-
const sel = loopControlsSelectors;
|
|
465
|
-
export const loopControlsCss = `
|
|
466
|
-
:scope ${sel.button},
|
|
467
|
-
:scope ${sel.textInput}:not(:has(${sel.textArea})),
|
|
468
|
-
:scope ${sel.segmentedControl},
|
|
469
|
-
:scope ${sel.underlineTab},
|
|
470
|
-
:scope ${sel.toggleTrack},
|
|
471
|
-
:scope ${sel.toggleKnob} {
|
|
472
|
-
--borderRadius-medium: var(--loop-radius-control);
|
|
473
|
-
border-radius: var(--loop-radius-control);
|
|
474
|
-
}
|
|
475
|
-
:scope ${sel.buttonGroup} {
|
|
476
|
-
--borderRadius-medium: var(--loop-radius-control);
|
|
477
|
-
}
|
|
442
|
+
const loopOwnCss = `
|
|
478
443
|
:scope b,
|
|
479
444
|
:scope strong {
|
|
480
445
|
font-weight: var(--base-text-weight-semibold);
|
|
@@ -483,10 +448,13 @@ export const loopControlsCss = `
|
|
|
483
448
|
/** Comprehensive Primer CSS-variable overrides for light & dark mode. */
|
|
484
449
|
export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
|
|
485
450
|
fontFamily: loopFontFamily,
|
|
486
|
-
css:
|
|
487
|
-
// Rounder than the others: a pill for a control, soft cards,
|
|
451
|
+
css: loopOwnCss,
|
|
452
|
+
// Rounder than the others: a pill for a control (LOOP T-09), soft cards,
|
|
453
|
+
// round bubbles, a table with the corners of a list item.
|
|
488
454
|
shape: {
|
|
489
455
|
radiusControl: loopShapeVars['--loop-radius-control'],
|
|
456
|
+
radiusTable: loopShapeVars['--borderRadius-medium'],
|
|
457
|
+
radiusOverlay: loopShapeVars['--loop-radius-card'],
|
|
490
458
|
radiusCard: loopShapeVars['--loop-radius-card'],
|
|
491
459
|
radiusBubble: loopShapeVars['--loop-radius-bubble'],
|
|
492
460
|
radiusFrame: loopShapeVars['--loop-radius-frame'],
|
|
@@ -529,3 +497,8 @@ export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
|
|
|
529
497
|
},
|
|
530
498
|
},
|
|
531
499
|
});
|
|
500
|
+
/**
|
|
501
|
+
* The loop theme's whole stylesheet (`ThemeStyles.css`): its controls as
|
|
502
|
+
* pills and its tables rounder, drawn from its shape, then its own rules.
|
|
503
|
+
*/
|
|
504
|
+
export const loopControlsCss = loopThemeStyles.css ?? '';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The VS Code theme's face for the editors a page may hold: JupyterLab's
|
|
3
|
+
* variables, a notebook's cells and CodeMirror, and Excalidraw's, each read
|
|
4
|
+
* from the editor's own `--vscode-*` colours. Part of the theme's stylesheet
|
|
5
|
+
* (`ThemeStyles.css`), scoped to the theme's element: a page without a
|
|
6
|
+
* notebook pays nothing but a few unused rules.
|
|
7
|
+
*
|
|
8
|
+
* The `!important`s stand against JupyterLab's and CodeMirror's own
|
|
9
|
+
* stylesheets, which set these on their elements.
|
|
10
|
+
*/
|
|
11
|
+
/** The JupyterLab, CodeMirror and Excalidraw rules of the VS Code theme. */
|
|
12
|
+
export declare const vscodeEditorsCss = "\n:scope {\n /* JupyterLab's variables, each the editor's colour */\n --jp-layout-color0: var(--vscode-editor-background);\n --jp-layout-color1: var(--vscode-sideBar-background);\n --jp-layout-color2: var(--vscode-editorWidget-background);\n --jp-layout-color3: var(--vscode-input-background);\n --jp-layout-color4: var(--vscode-dropdown-background);\n\n --jp-ui-font-color0: var(--vscode-editor-foreground);\n --jp-ui-font-color1: var(--vscode-foreground);\n --jp-ui-font-color2: var(--vscode-descriptionForeground);\n --jp-ui-font-color3: var(--vscode-disabledForeground);\n\n --jp-border-color0: var(--vscode-panel-border);\n --jp-border-color1: var(--vscode-editorWidget-border);\n --jp-border-color2: var(--vscode-input-border);\n\n --jp-brand-color1: var(--vscode-button-background);\n --jp-accent-color1: var(--vscode-focusBorder);\n\n --jp-error-color1: var(--vscode-errorForeground);\n --jp-warn-color1: var(--vscode-editorWarning-foreground);\n --jp-success-color1: var(--vscode-terminal-ansiGreen);\n --jp-info-color1: var(--vscode-editorInfo-foreground);\n\n /* The editor */\n --jp-editor-background: var(--vscode-editor-background);\n --jp-editor-foreground: var(--vscode-editor-foreground);\n --jp-editor-border-color: var(--vscode-editorWidget-border);\n --jp-editor-selected-background: var(--vscode-editor-selectionBackground);\n\n /* A cell */\n --jp-cell-editor-background: var(--vscode-notebook-cellEditorBackground, var(--vscode-editor-background));\n --jp-cell-editor-border-color: var(--vscode-notebook-cellBorderColor, var(--vscode-editorWidget-border));\n\n /* Input and output */\n --jp-input-background: var(--vscode-input-background);\n --jp-input-foreground: var(--vscode-input-foreground);\n --jp-input-border: var(--vscode-input-border);\n\n /* Lists */\n --jp-list-hover-background: var(--vscode-list-hoverBackground);\n --jp-list-selected-background: var(--vscode-list-activeSelectionBackground);\n}\n\n/* No black gap: the notebook and its frame wear the editor's background */\n:scope #notebook-editor,\n:scope .dla-Jupyter-Notebook,\n:scope .jp-Notebook {\n background-color: var(--vscode-editor-background) !important;\n}\n\n/* CodeMirror's editor */\n:scope .cm-editor,\n:scope .cm-content {\n background-color: var(--vscode-notebook-cellEditorBackground, var(--vscode-editor-background)) !important;\n}\n\n/* A notebook's cells */\n:scope .jp-Cell {\n background-color: var(--vscode-editor-background) !important;\n}\n\n:scope .jp-InputArea-editor {\n background-color: var(--vscode-notebook-cellEditorBackground, var(--vscode-editor-background)) !important;\n}\n\n/* The toolbar */\n:scope .jp-Toolbar {\n background-color: var(--vscode-editorWidget-background) !important;\n border-bottom: 1px solid var(--vscode-panel-border) !important;\n}\n\n/* The sidebar */\n:scope .jp-SideBar {\n background-color: var(--vscode-sideBar-background) !important;\n border-color: var(--vscode-panel-border) !important;\n}\n\n/* Every widget inside a cell, the cell sidebar's included */\n:scope .jp-Cell .lm-Widget {\n background-color: var(--vscode-editor-background) !important;\n}\n\n:scope .dla-CellSidebar-Container {\n background-color: var(--vscode-editor-background) !important;\n color: var(--vscode-editor-foreground) !important;\n}\n\n:scope .dla-CellSidebar-Container * {\n background-color: inherit !important;\n}\n\n:scope .dla-CellSidebar-Container button {\n background-color: transparent !important;\n color: var(--vscode-editor-foreground) !important;\n border: none !important;\n}\n\n:scope .dla-CellSidebar-Container button:hover {\n background-color: var(--vscode-list-hoverBackground) !important;\n}\n\n/* CodeMirror's selection: its layer, and ::selection on every token */\n:scope .cm-selectionBackground,\n:scope .cm-editor .cm-selectionBackground,\n:scope .cm-editor > .cm-scroller > .cm-selectionLayer .cm-selectionBackground,\n:scope .cm-editor.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground {\n background: var(--vscode-editor-selectionBackground) !important;\n}\n\n:scope .cm-editor .cm-line ::selection,\n:scope .cm-editor .cm-line > *::selection,\n:scope .cm-editor .cm-line span::selection,\n:scope .cm-editor .cm-content ::selection,\n:scope .cm-editor .cm-activeLine ::selection,\n:scope .cm-editor *::selection {\n background: var(--vscode-editor-selectionBackground) !important;\n background-color: var(--vscode-editor-selectionBackground) !important;\n}\n\n/* Excalidraw, dark */\n:scope .ExcalidrawModal__row .excalidraw.theme--dark {\n --color-primary: var(--vscode-button-background, #0e639c);\n --color-primary-darker: var(--vscode-button-hoverBackground, #1177bb);\n --color-primary-darkest: var(--vscode-button-hoverBackground, #0a5285);\n --color-primary-hover: var(--vscode-button-hoverBackground, #1177bb);\n --color-primary-light: var(--vscode-list-activeSelectionBackground, #094771);\n --color-surface-primary: var(--vscode-editor-background, #1e1e1e);\n --default-bg-color: var(--vscode-editor-background, #1e1e1e);\n --color-on-surface: var(--vscode-editor-foreground, #d4d4d4);\n --text-primary-color: var(--vscode-editor-foreground, #d4d4d4);\n --popup-text-color: var(--vscode-editor-foreground, #d4d4d4);\n --color-surface-primary-container: var(--vscode-list-activeSelectionBackground, #094771);\n --color-on-primary-container: var(--vscode-list-activeSelectionForeground, #ffffff);\n --color-brand-hover: var(--vscode-button-hoverBackground, #1177bb);\n --color-brand-active: var(--vscode-focusBorder, #007fd4);\n --color-icon-white: #ffffff;\n --island-bg-color: var(--vscode-editorWidget-background, #252526);\n --sidebar-bg-color: var(--vscode-sideBar-background, #252526);\n --popup-bg-color: var(--vscode-editorWidget-background, #252526);\n --popup-secondary-bg-color: var(--vscode-dropdown-background, #3c3c3c);\n --color-surface-high: var(--vscode-editorWidget-background, #2e2d39);\n --color-surface-mid: var(--vscode-sideBar-background, #252526);\n --color-surface-low: var(--vscode-editor-background, #1e1e1e);\n --color-surface-lowest: var(--vscode-editor-background, #1e1e1e);\n --button-gray-1: var(--vscode-button-secondaryBackground, #3a3d41);\n --button-gray-2: var(--vscode-button-secondaryHoverBackground, #45494e);\n --button-gray-3: var(--vscode-button-secondaryHoverBackground, #45494e);\n --button-hover-bg: var(--vscode-list-hoverBackground, #2a2d2e);\n --button-active-bg: var(--vscode-list-activeSelectionBackground, #094771);\n --button-color: var(--vscode-button-foreground, #ffffff);\n --button-hover-color: var(--vscode-button-foreground, #ffffff);\n --button-bg: var(--vscode-button-background, #0e639c);\n --input-bg-color: var(--vscode-input-background, #3c3c3c);\n --input-border-color: var(--vscode-input-border, #3c3c3c);\n --input-hover-bg-color: var(--vscode-list-hoverBackground, #2a2d2e);\n --default-border-color: var(--vscode-panel-border, #3c3c3c);\n --color-border-outline: var(--vscode-editorWidget-border, #454545);\n --color-border-outline-variant: var(--vscode-panel-border, #3c3c3c);\n --sidebar-border-color: var(--vscode-panel-border, #3c3c3c);\n --dialog-border-color: var(--vscode-editorWidget-border, #454545);\n --focus-highlight-color: var(--vscode-focusBorder, #007fd4);\n --select-highlight-color: var(--vscode-editor-selectionBackground, #264f78);\n --color-selection: var(--vscode-editor-selectionBackground, #264f78);\n --button-active-border: var(--vscode-focusBorder, #007fd4);\n --link-color: var(--vscode-textLink-foreground, #3794ff);\n --scrollbar-thumb: var(--vscode-scrollbarSlider-background, rgba(121, 121, 121, 0.4));\n --scrollbar-thumb-hover: var(--vscode-scrollbarSlider-hoverBackground, rgba(100, 100, 100, 0.7));\n --icon-fill-color: var(--vscode-icon-foreground, #c5c5c5);\n}\n\n/* Excalidraw, light */\n:scope .ExcalidrawModal__row .excalidraw.theme--light {\n --color-primary: var(--vscode-button-background, #007acc);\n --color-primary-darker: var(--vscode-button-hoverBackground, #005a9e);\n --color-primary-darkest: var(--vscode-button-hoverBackground, #004578);\n --color-primary-hover: var(--vscode-button-hoverBackground, #005a9e);\n --color-primary-light: var(--vscode-list-activeSelectionBackground, #0060c0);\n --color-surface-primary: var(--vscode-editor-background, #ffffff);\n --default-bg-color: var(--vscode-editor-background, #ffffff);\n --color-on-surface: var(--vscode-editor-foreground, #000000);\n --text-primary-color: var(--vscode-editor-foreground, #000000);\n --popup-text-color: var(--vscode-editor-foreground, #000000);\n --color-surface-primary-container: var(--vscode-list-activeSelectionBackground, #0060c0);\n --color-on-primary-container: var(--vscode-list-activeSelectionForeground, #ffffff);\n --color-brand-hover: var(--vscode-button-hoverBackground, #005a9e);\n --color-brand-active: var(--vscode-focusBorder, #0090f1);\n --color-icon-white: #ffffff;\n --island-bg-color: var(--vscode-editorWidget-background, #f3f3f3);\n --sidebar-bg-color: var(--vscode-sideBar-background, #f3f3f3);\n --popup-bg-color: var(--vscode-editorWidget-background, #f3f3f3);\n --popup-secondary-bg-color: var(--vscode-dropdown-background, #ffffff);\n --color-surface-high: var(--vscode-editorWidget-background, #f1f0ff);\n --color-surface-mid: var(--vscode-sideBar-background, #f3f3f3);\n --color-surface-low: var(--vscode-editor-background, #ffffff);\n --color-surface-lowest: var(--vscode-editor-background, #ffffff);\n --button-gray-1: var(--vscode-button-secondaryBackground, #e1e1e1);\n --button-gray-2: var(--vscode-button-secondaryHoverBackground, #d0d0d0);\n --button-gray-3: var(--vscode-button-secondaryHoverBackground, #d0d0d0);\n --button-hover-bg: var(--vscode-list-hoverBackground, #f0f0f0);\n --button-active-bg: var(--vscode-list-activeSelectionBackground, #0060c0);\n --button-color: var(--vscode-button-foreground, #ffffff);\n --button-hover-color: var(--vscode-button-foreground, #ffffff);\n --button-bg: var(--vscode-button-background, #007acc);\n --input-bg-color: var(--vscode-input-background, #ffffff);\n --input-border-color: var(--vscode-input-border, #cecece);\n --input-hover-bg-color: var(--vscode-list-hoverBackground, #f0f0f0);\n --default-border-color: var(--vscode-panel-border, #e0e0e0);\n --color-border-outline: var(--vscode-editorWidget-border, #c8c8c8);\n --color-border-outline-variant: var(--vscode-panel-border, #e0e0e0);\n --sidebar-border-color: var(--vscode-panel-border, #e0e0e0);\n --dialog-border-color: var(--vscode-editorWidget-border, #c8c8c8);\n --focus-highlight-color: var(--vscode-focusBorder, #0090f1);\n --select-highlight-color: var(--vscode-editor-selectionBackground, #add6ff);\n --color-selection: var(--vscode-editor-selectionBackground, #add6ff);\n --button-active-border: var(--vscode-focusBorder, #0090f1);\n --link-color: var(--vscode-textLink-foreground, #006ab1);\n --scrollbar-thumb: var(--vscode-scrollbarSlider-background, rgba(100, 100, 100, 0.4));\n --scrollbar-thumb-hover: var(--vscode-scrollbarSlider-hoverBackground, rgba(100, 100, 100, 0.7));\n --icon-fill-color: var(--vscode-icon-foreground, #424242);\n}\n";
|