@datalayer/primer-addons 1.0.43 → 1.0.44
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/lib/theme/themeRegistry.js +8 -2
- package/lib/theme/themeTokens.js +2 -2
- package/lib/theme/themes/vscodeTheme.d.ts +8 -0
- package/lib/theme/themes/vscodeTheme.js +9 -0
- package/lib/theme/themes/vscodeThemeStyles.d.ts +6 -4
- package/lib/theme/themes/vscodeThemeStyles.js +11 -9
- package/package.json +1 -1
|
@@ -17,7 +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
|
+
import { vscodeTheme, vscodeThemeStyles } from './themes/vscodeTheme';
|
|
21
21
|
import { avatarColorsOf, brightPaletteOf, themeTokens, } from './themeTokens';
|
|
22
22
|
export { avatarColorsOf, brightPaletteOf, getCardGradient, getThemeTokens, themeTokens, themeVariants, } from './themeTokens';
|
|
23
23
|
const primerThemes = {
|
|
@@ -34,7 +34,13 @@ const primerThemes = {
|
|
|
34
34
|
};
|
|
35
35
|
export const themeConfigs = Object.fromEntries(Object.keys(themeTokens).map(variant => [
|
|
36
36
|
variant,
|
|
37
|
-
{
|
|
37
|
+
{
|
|
38
|
+
...themeTokens[variant],
|
|
39
|
+
// The web's vscode styles carry the editors' face, which the portable
|
|
40
|
+
// tokens leave out (see vscodeThemeStyles.ts).
|
|
41
|
+
...(variant === 'vscode' ? { themeStyles: vscodeThemeStyles } : {}),
|
|
42
|
+
primerTheme: primerThemes[variant],
|
|
43
|
+
},
|
|
38
44
|
]));
|
|
39
45
|
/** Look up a theme config by variant name. */
|
|
40
46
|
export function getThemeConfig(variant) {
|
package/lib/theme/themeTokens.js
CHANGED
|
@@ -11,7 +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 {
|
|
14
|
+
import { vscodePortableThemeStyles } from './themes/vscodeThemeStyles';
|
|
15
15
|
import { datalayerColors } from './colors/datalayerColors';
|
|
16
16
|
import { spatialColors } from './colors/spatialColors';
|
|
17
17
|
import { lovelyColors } from './colors/lovelyColors';
|
|
@@ -309,7 +309,7 @@ export const themeTokens = {
|
|
|
309
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
310
|
brandColor: vscodeColors.vscodeBrand,
|
|
311
311
|
defaultColorMode: 'auto',
|
|
312
|
-
themeStyles:
|
|
312
|
+
themeStyles: vscodePortableThemeStyles,
|
|
313
313
|
cardGradient: {
|
|
314
314
|
light: { from: vscodeColors.vscodeText, to: vscodeColors.brightLightSurge }, // #005FB8 → #0451A5
|
|
315
315
|
dark: { from: vscodeColors.vscodeAccent, to: vscodeColors.vscodeBrand }, // #4DAAFC → #0078D4
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export * from './vscodeThemeStyles';
|
|
2
2
|
export * from './vscodeEditorsCss';
|
|
3
|
+
/** Comprehensive Primer CSS-variable overrides for light & dark mode, with the editors' face. */
|
|
4
|
+
export declare const vscodeThemeStyles: {
|
|
5
|
+
css: string;
|
|
6
|
+
light: import("react").CSSProperties;
|
|
7
|
+
dark: import("react").CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
/** The theme's whole stylesheet (`ThemeStyles.css`). */
|
|
10
|
+
export declare const vscodeControlsCss: string;
|
|
3
11
|
/** The Primer theme object: Primer's default. */
|
|
4
12
|
export declare const vscodeTheme: {
|
|
5
13
|
animation: {
|
|
@@ -10,8 +10,17 @@
|
|
|
10
10
|
* without Primer React (a native app) imports the styles module instead.
|
|
11
11
|
*/
|
|
12
12
|
import { theme as primerTheme } from '@primer/react';
|
|
13
|
+
import { vscodeEditorsCss } from './vscodeEditorsCss';
|
|
14
|
+
import { vscodePortableThemeStyles } from './vscodeThemeStyles';
|
|
13
15
|
export * from './vscodeThemeStyles';
|
|
14
16
|
export * from './vscodeEditorsCss';
|
|
17
|
+
/** Comprehensive Primer CSS-variable overrides for light & dark mode, with the editors' face. */
|
|
18
|
+
export const vscodeThemeStyles = {
|
|
19
|
+
...vscodePortableThemeStyles,
|
|
20
|
+
css: `${vscodePortableThemeStyles.css ?? ''}\n${vscodeEditorsCss}`,
|
|
21
|
+
};
|
|
22
|
+
/** The theme's whole stylesheet (`ThemeStyles.css`). */
|
|
23
|
+
export const vscodeControlsCss = vscodeThemeStyles.css;
|
|
15
24
|
/** The Primer theme object: Primer's default. */
|
|
16
25
|
export const vscodeTheme = primerTheme;
|
|
17
26
|
export default vscodeTheme;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ThemeColorDefs } from '../css/createThemeCSSVars';
|
|
2
2
|
export declare const vscodeLight: ThemeColorDefs;
|
|
3
3
|
export declare const vscodeDark: ThemeColorDefs;
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The theme's tokens, shapes and focus ring, without the editors' face: what
|
|
6
|
+
* the portable theme tokens carry. The web's `vscodeThemeStyles`
|
|
7
|
+
* (`vscodeTheme.ts`) adds the editors' face to it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const vscodePortableThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
import { vscodeFontFamily, vscodeFontSize, vscodeMonoFontFamily, vscodeTint, vscodeVar, } from '../colors/vscodeColors';
|
|
21
21
|
import { buildThemeStyles } from '../css/createThemeCSSVars';
|
|
22
22
|
import { primerComponentSelectors } from '../css/primerComponentsCss';
|
|
23
|
-
import { vscodeEditorsCss } from './vscodeEditorsCss';
|
|
24
23
|
/* ── Colour definitions, one per mode ────────────────────────────────── */
|
|
25
24
|
/**
|
|
26
25
|
* The colour definitions for a mode: the same editor variables in both,
|
|
@@ -205,8 +204,10 @@ function vscodeVariables(mode) {
|
|
|
205
204
|
const sel = primerComponentSelectors;
|
|
206
205
|
/**
|
|
207
206
|
* What no token says: the editor's focus ring is one pixel, drawn inside
|
|
208
|
-
* the control, in the focus colour.
|
|
209
|
-
*
|
|
207
|
+
* the control, in the focus colour. The editors' face (`vscodeEditorsCss`:
|
|
208
|
+
* JupyterLab's variables, CodeMirror, Excalidraw) is web-only and joins it
|
|
209
|
+
* in `vscodeTheme.ts`, so the portable entry (`theme/portable`, read by
|
|
210
|
+
* Datalayer Mobile's Hermes bundle) never reaches it.
|
|
210
211
|
*/
|
|
211
212
|
const vscodeOwnCss = `
|
|
212
213
|
:scope ${sel.button}:focus-visible,
|
|
@@ -215,11 +216,14 @@ const vscodeOwnCss = `
|
|
|
215
216
|
outline: 1px solid var(--focus-outlineColor);
|
|
216
217
|
outline-offset: -1px;
|
|
217
218
|
box-shadow: none;
|
|
218
|
-
}
|
|
219
|
-
${vscodeEditorsCss}`;
|
|
219
|
+
}`;
|
|
220
220
|
/* ── Exports ─────────────────────────────────────────────────────────── */
|
|
221
|
-
/**
|
|
222
|
-
|
|
221
|
+
/**
|
|
222
|
+
* The theme's tokens, shapes and focus ring, without the editors' face: what
|
|
223
|
+
* the portable theme tokens carry. The web's `vscodeThemeStyles`
|
|
224
|
+
* (`vscodeTheme.ts`) adds the editors' face to it.
|
|
225
|
+
*/
|
|
226
|
+
export const vscodePortableThemeStyles = buildThemeStyles(vscodeLight, vscodeDark, {
|
|
223
227
|
fontFamily: vscodeFontFamily,
|
|
224
228
|
css: vscodeOwnCss,
|
|
225
229
|
// The editor's shape: tight corners, flat surfaces, no motion.
|
|
@@ -242,5 +246,3 @@ export const vscodeThemeStyles = buildThemeStyles(vscodeLight, vscodeDark, {
|
|
|
242
246
|
dark: vscodeVariables('dark'),
|
|
243
247
|
},
|
|
244
248
|
});
|
|
245
|
-
/** The theme's whole stylesheet (`ThemeStyles.css`). */
|
|
246
|
-
export const vscodeControlsCss = vscodeThemeStyles.css ?? '';
|