@datalayer/primer-addons 1.0.52 → 1.0.54
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 +32 -32
- package/lib/components/appearance/AppearanceControls.js +1 -1
- package/lib/components/appearance/AppearanceMenu.stories.d.ts +1 -1
- package/lib/components/appearance/AppearanceMenu.stories.js +2 -2
- package/lib/components/appearance/CollaboratorPalette.stories.d.ts +1 -1
- package/lib/components/appearance/CollaboratorPalette.stories.js +2 -2
- package/lib/components/appearance/ColorModeCircle.js +1 -1
- package/lib/components/appearance/ThemeCircle.stories.js +1 -1
- package/lib/components/appearance/ThemePalettePreview.d.ts +1 -1
- package/lib/components/appearance/ThemePreviewCard.js +1 -1
- package/lib/components/appearance/ThemePreviewCard.stories.d.ts +1 -1
- package/lib/components/appearance/ThemePreviewCard.stories.js +1 -1
- package/lib/components/box/Box.d.ts +3 -3
- package/lib/components/box/Box.js +3 -3
- package/lib/components/box/Box.stories.d.ts +1 -1
- package/lib/components/box/Box.stories.js +1 -1
- package/lib/components/box/boxTokens.d.ts +2 -2
- package/lib/components/box/boxTokens.js +2 -2
- package/lib/components/calendar-picker/CalendarPicker.js +1 -1
- package/lib/components/card/Card.js +1 -1
- package/lib/components/color/ColorSwatch.js +1 -1
- package/lib/components/entity-avatar/EntityAvatar.d.ts +1 -1
- package/lib/components/entity-avatar/EntityAvatar.js +1 -1
- package/lib/components/hover-card/HoverCard.d.ts +1 -1
- package/lib/components/logo/DatalayerLogo.js +12 -12
- package/lib/components/logo/DatalayerLogo.stories.js +1 -1
- package/lib/components/sheet/Sheet.d.ts +1 -1
- package/lib/components/sheet/Sheet.js +1 -1
- package/lib/components/toolbar/ToolbarButton.js +1 -1
- package/lib/reactor/ThemePlugin.js +1 -1
- package/lib/reactor/index.d.ts +1 -1
- package/lib/reactor/index.js +1 -1
- package/lib/reactor/page-layout/PageLayout.d.ts +2 -2
- package/lib/reactor/page-layout/PageLayout.js +3 -3
- package/lib/reactor/page-layout/PageLayoutPlugin.js +2 -2
- package/lib/theme/DatalayerThemeProvider.js +1 -1
- package/lib/theme/{loopEyes.d.ts → agentEyes.d.ts} +3 -3
- package/lib/theme/{loopEyes.js → agentEyes.js} +3 -3
- package/lib/theme/colorMode.d.ts +6 -0
- package/lib/theme/{themes-brand/index.js → colorMode.js} +1 -1
- package/lib/theme/colors/{loopColors.d.ts → agentColors.d.ts} +15 -15
- package/lib/theme/colors/{loopColors.js → agentColors.js} +16 -16
- package/lib/theme/colors/hueColors.d.ts +1 -1
- package/lib/theme/colors/hueColors.js +2 -2
- package/lib/theme/colors/index.d.ts +1 -1
- package/lib/theme/colors/index.js +3 -3
- package/lib/theme/colors/metalColors.d.ts +12 -12
- package/lib/theme/colors/metalColors.js +6 -6
- package/lib/theme/colors/themeAccents.d.ts +5 -6
- package/lib/theme/colors/themeAccents.js +4 -5
- package/lib/theme/css/createThemeCSSVars.d.ts +5 -5
- package/lib/theme/css/primerBaseVars.js +1 -1
- package/lib/theme/index.d.ts +4 -4
- package/lib/theme/index.js +4 -4
- package/lib/theme/palettes/ColorPalette.js +18 -18
- package/lib/theme/portable.d.ts +1 -1
- package/lib/theme/portable.js +1 -1
- package/lib/theme/portableTheme.d.ts +1 -1
- package/lib/theme/themeRegistry.js +2 -2
- package/lib/theme/themeTokens.d.ts +2 -2
- package/lib/theme/themeTokens.js +38 -38
- package/lib/theme/themes/{loopTheme.d.ts → agentTheme.d.ts} +5 -5
- package/lib/theme/themes/{loopTheme.js → agentTheme.js} +11 -11
- package/lib/theme/themes/{loopThemeStyles.d.ts → agentThemeStyles.d.ts} +21 -21
- package/lib/theme/themes/{loopThemeStyles.js → agentThemeStyles.js} +179 -189
- package/lib/theme/themes/ivoryThemeStyles.d.ts +4 -1
- package/lib/theme/themes/ivoryThemeStyles.js +7 -1
- package/lib/theme/themes/metalThemeStyles.d.ts +1 -1
- package/lib/theme/themes/metalThemeStyles.js +27 -31
- package/lib/theme/themes/roundedShape.d.ts +18 -0
- package/lib/theme/themes/roundedShape.js +24 -0
- package/lib/theme/themes/sandThemeStyles.d.ts +4 -1
- package/lib/theme/themes/sandThemeStyles.js +7 -1
- package/lib/theme/themes/sunThemeStyles.d.ts +4 -1
- package/lib/theme/themes/sunThemeStyles.js +7 -1
- package/lib/theme/useThemeStore.d.ts +7 -1
- package/lib/theme/useThemeStore.js +29 -6
- package/lib/utils/Helper.d.ts +1 -16
- package/lib/utils/Helper.js +4 -20
- package/lib/utils/Portals.d.ts +1 -1
- package/lib/utils/Portals.js +1 -1
- package/package.json +1 -2
- package/style/{loop-face.css → agent-face.css} +2 -2
- package/lib/theme/DatalayerBrandThemeProvider.d.ts +0 -41
- package/lib/theme/DatalayerBrandThemeProvider.js +0 -32
- package/lib/theme/themes-brand/index.d.ts +0 -1
- package/lib/theme/themes-brand/spatialBrandTheme.d.ts +0 -16
- package/lib/theme/themes-brand/spatialBrandTheme.js +0 -157
|
@@ -21,5 +21,5 @@ export declare const metalFocusRing: {
|
|
|
21
21
|
readonly light: string;
|
|
22
22
|
readonly dark: string;
|
|
23
23
|
};
|
|
24
|
-
/** Comprehensive Primer CSS-variable overrides for light & dark mode:
|
|
24
|
+
/** Comprehensive Primer CSS-variable overrides for light & dark mode: Agent's curves, Metal's look. */
|
|
25
25
|
export declare const metalThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Metal Theme for Primer React.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Agent's curves and motion, with a look of its own. On light, a page that is
|
|
9
9
|
* not white: a blue-grey wash and a dot grid, panels drawn by a pale steel
|
|
10
10
|
* line rather than floated on a shadow, outlined controls, a brushed filled
|
|
11
11
|
* button. On dark, the page is the surface: a deep mesh of sage, steel, mauve
|
|
@@ -16,10 +16,11 @@
|
|
|
16
16
|
import { metalColors } from '../colors/metalColors';
|
|
17
17
|
import { themeAccentTints } from '../colors/themeAccents';
|
|
18
18
|
import { buildThemeStyles } from '../css/createThemeCSSVars';
|
|
19
|
-
import {
|
|
19
|
+
import { agentDark, agentLight, agentMotionVars, agentShapeVars, agentTypeScale, agentTypeVars, } from './agentThemeStyles';
|
|
20
|
+
import { roundedShape } from './roundedShape';
|
|
20
21
|
/* ── Colour definitions ────────────────────────────────────────── */
|
|
21
22
|
export const metalLight = {
|
|
22
|
-
...
|
|
23
|
+
...agentLight,
|
|
23
24
|
canvas: {
|
|
24
25
|
default: metalColors.white,
|
|
25
26
|
subtle: metalColors.subtle,
|
|
@@ -40,7 +41,7 @@ export const metalLight = {
|
|
|
40
41
|
muted: metalColors.lineMuted,
|
|
41
42
|
},
|
|
42
43
|
btn: {
|
|
43
|
-
...
|
|
44
|
+
...agentLight.btn,
|
|
44
45
|
text: metalColors.ink,
|
|
45
46
|
// Outlined, not filled: a control is drawn as a panel is.
|
|
46
47
|
bg: '#FFFFFF',
|
|
@@ -51,7 +52,7 @@ export const metalLight = {
|
|
|
51
52
|
selectedBg: '#E3E9F2',
|
|
52
53
|
counterBg: 'rgba(34, 38, 43, 0.08)',
|
|
53
54
|
primary: {
|
|
54
|
-
...
|
|
55
|
+
...agentLight.btn.primary,
|
|
55
56
|
text: metalColors.metalOn,
|
|
56
57
|
bg: metalColors.metalBrand,
|
|
57
58
|
border: metalColors.metalBrand,
|
|
@@ -65,7 +66,7 @@ export const metalLight = {
|
|
|
65
66
|
counterBg: 'rgba(255, 255, 255, 0.2)',
|
|
66
67
|
},
|
|
67
68
|
outline: {
|
|
68
|
-
...
|
|
69
|
+
...agentLight.btn.outline,
|
|
69
70
|
text: metalColors.metalText,
|
|
70
71
|
hoverText: metalColors.metalOn,
|
|
71
72
|
hoverBg: metalColors.metalBrand,
|
|
@@ -83,7 +84,7 @@ export const metalLight = {
|
|
|
83
84
|
},
|
|
84
85
|
};
|
|
85
86
|
export const metalDark = {
|
|
86
|
-
...
|
|
87
|
+
...agentDark,
|
|
87
88
|
// Solid stand-ins for the page behind the glass, which the checks read;
|
|
88
89
|
// what is painted is `metalVariables` and the mesh.
|
|
89
90
|
canvas: {
|
|
@@ -107,7 +108,7 @@ export const metalDark = {
|
|
|
107
108
|
muted: metalColors.lineMutedDark,
|
|
108
109
|
},
|
|
109
110
|
btn: {
|
|
110
|
-
...
|
|
111
|
+
...agentDark.btn,
|
|
111
112
|
text: metalColors.inkDark,
|
|
112
113
|
bg: 'rgba(255, 255, 255, 0.10)',
|
|
113
114
|
border: 'rgba(255, 255, 255, 0.22)',
|
|
@@ -118,7 +119,7 @@ export const metalDark = {
|
|
|
118
119
|
counterBg: 'rgba(238, 242, 247, 0.12)',
|
|
119
120
|
// White on the mesh, the brightest thing on the page.
|
|
120
121
|
primary: {
|
|
121
|
-
...
|
|
122
|
+
...agentDark.btn.primary,
|
|
122
123
|
text: metalColors.metalOnDark,
|
|
123
124
|
bg: metalColors.white,
|
|
124
125
|
border: metalColors.white,
|
|
@@ -132,7 +133,7 @@ export const metalDark = {
|
|
|
132
133
|
counterBg: 'rgba(11, 26, 48, 0.12)',
|
|
133
134
|
},
|
|
134
135
|
outline: {
|
|
135
|
-
...
|
|
136
|
+
...agentDark.btn.outline,
|
|
136
137
|
text: metalColors.metalBright,
|
|
137
138
|
hoverText: metalColors.metalOnDark,
|
|
138
139
|
hoverBg: metalColors.metalBright,
|
|
@@ -155,12 +156,12 @@ export const metalFontFamily = '"Geist Variable", ui-sans-serif, system-ui, -app
|
|
|
155
156
|
export const metalMonoFamily = '"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace';
|
|
156
157
|
/** The two weights: titles stay regular, what must stand out is 500. */
|
|
157
158
|
export const metalFontWeights = { regular: 400, medium: 500 };
|
|
158
|
-
/**
|
|
159
|
+
/** Agent's sizes, in Metal's weights: a title is large and light, never bold. */
|
|
159
160
|
const metalTypeVars = () => {
|
|
160
161
|
const { regular, medium } = metalFontWeights;
|
|
161
|
-
const { display, title, heading } =
|
|
162
|
+
const { display, title, heading } = agentTypeScale;
|
|
162
163
|
return {
|
|
163
|
-
...
|
|
164
|
+
...agentTypeVars(metalFontFamily),
|
|
164
165
|
'--base-text-weight-medium': String(medium),
|
|
165
166
|
'--base-text-weight-semibold': String(medium),
|
|
166
167
|
'--text-display-weight': String(regular),
|
|
@@ -168,8 +169,8 @@ const metalTypeVars = () => {
|
|
|
168
169
|
'--text-title-shorthand-large': `${regular} ${display.size}/${display.lineHeight} ${metalFontFamily}`,
|
|
169
170
|
'--text-title-shorthand-medium': `${regular} ${title.size}/${title.lineHeight} ${metalFontFamily}`,
|
|
170
171
|
'--text-title-shorthand-small': `${medium} ${heading.size}/${heading.lineHeight} ${metalFontFamily}`,
|
|
171
|
-
'--
|
|
172
|
-
'--
|
|
172
|
+
'--agent-tracking-display': '-0.03em',
|
|
173
|
+
'--agent-tracking-title': '-0.02em',
|
|
173
174
|
'--fontStack-monospace': metalMonoFamily,
|
|
174
175
|
};
|
|
175
176
|
};
|
|
@@ -234,7 +235,7 @@ const metalPainted = {
|
|
|
234
235
|
/** A panel lies on the page: a line and nothing under it, a menu alone floats. */
|
|
235
236
|
export const metalShadows = {
|
|
236
237
|
light: {
|
|
237
|
-
'--
|
|
238
|
+
'--agent-shadow-frame': 'none',
|
|
238
239
|
'--theme-shadow': 'none',
|
|
239
240
|
'--shadow-resting-xsmall': 'none',
|
|
240
241
|
'--shadow-resting-small': 'none',
|
|
@@ -245,7 +246,7 @@ export const metalShadows = {
|
|
|
245
246
|
'--shadow-floating-xlarge': '0 0 0 1px rgba(76, 118, 186, 0.16), 0 24px 64px rgba(34, 52, 84, 0.14)',
|
|
246
247
|
},
|
|
247
248
|
dark: {
|
|
248
|
-
'--
|
|
249
|
+
'--agent-shadow-frame': 'none',
|
|
249
250
|
'--theme-shadow': 'none',
|
|
250
251
|
'--shadow-resting-xsmall': 'none',
|
|
251
252
|
'--shadow-resting-small': 'none',
|
|
@@ -264,15 +265,15 @@ const metalTints = (mode) => themeAccentTints({
|
|
|
264
265
|
quiet: mode === 'light' ? metalColors.metalTint : metalColors.metalTintDark,
|
|
265
266
|
});
|
|
266
267
|
const metalVariables = (mode) => ({
|
|
267
|
-
...
|
|
268
|
+
...agentShapeVars,
|
|
268
269
|
...metalTints(mode),
|
|
269
|
-
...
|
|
270
|
+
...agentMotionVars,
|
|
270
271
|
...metalShadows[mode],
|
|
271
272
|
...metalTypeVars(),
|
|
272
273
|
...metalSurfaceVars,
|
|
273
274
|
...metalPainted[mode],
|
|
274
275
|
'--metal-page': metalPage[mode],
|
|
275
|
-
'--
|
|
276
|
+
'--agent-hairline': metalHairline[mode],
|
|
276
277
|
'--borderColor-default': metalHairline[mode],
|
|
277
278
|
'--borderColor-muted': metalHairline[mode],
|
|
278
279
|
'--focus-outlineColor': metalFocusRing[mode],
|
|
@@ -318,22 +319,17 @@ const metalOwnCss = `
|
|
|
318
319
|
}
|
|
319
320
|
`;
|
|
320
321
|
/* ── Exports ───────────────────────────────────────────────────── */
|
|
321
|
-
/** Comprehensive Primer CSS-variable overrides for light & dark mode:
|
|
322
|
+
/** Comprehensive Primer CSS-variable overrides for light & dark mode: Agent's curves, Metal's look. */
|
|
322
323
|
export const metalThemeStyles = buildThemeStyles(metalLight, metalDark, {
|
|
323
324
|
fontFamily: metalFontFamily,
|
|
324
325
|
css: metalOwnCss,
|
|
325
326
|
shape: {
|
|
326
|
-
|
|
327
|
-
radiusTable: loopShapeVars['--borderRadius-medium'],
|
|
328
|
-
radiusOverlay: loopShapeVars['--loop-radius-card'],
|
|
329
|
-
radiusCard: loopShapeVars['--loop-radius-card'],
|
|
330
|
-
radiusBubble: loopShapeVars['--loop-radius-bubble'],
|
|
331
|
-
radiusFrame: loopShapeVars['--loop-radius-frame'],
|
|
327
|
+
...roundedShape,
|
|
332
328
|
shadow: 'none',
|
|
333
|
-
motionStatus:
|
|
334
|
-
motionMessage:
|
|
335
|
-
motionPane:
|
|
336
|
-
motionEasing:
|
|
329
|
+
motionStatus: agentMotionVars['--agent-motion-status'],
|
|
330
|
+
motionMessage: agentMotionVars['--agent-motion-message'],
|
|
331
|
+
motionPane: agentMotionVars['--agent-motion-pane'],
|
|
332
|
+
motionEasing: agentMotionVars['--agent-motion-easing'],
|
|
337
333
|
messageLink: 'currentColor',
|
|
338
334
|
},
|
|
339
335
|
variables: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rounded shape: Agent's corners, which Metal, Sand, Ivory and Sun share.
|
|
3
|
+
*
|
|
4
|
+
* Primer's own radii made rounder (a list item, a card, a menu take them),
|
|
5
|
+
* the `--agent-radius-*` properties an application is drawn with, and the
|
|
6
|
+
* theme shape that says so: a pill for every single-line control (a button,
|
|
7
|
+
* an icon button, a text input, a select, a segmented control), soft cards
|
|
8
|
+
* and overlays, round bubbles, a table with the corners of a list item.
|
|
9
|
+
* `primerComponentsCss` draws the controls and the table from it.
|
|
10
|
+
*
|
|
11
|
+
* A theme that is rounded passes `roundedShape` (with its own shadow, motion
|
|
12
|
+
* and the rest beside it) and sets `roundedRadiusVars` in both modes.
|
|
13
|
+
*/
|
|
14
|
+
import type { ThemeShape } from '../css/createThemeCSSVars';
|
|
15
|
+
/** The radii as custom properties, the same in both modes. */
|
|
16
|
+
export declare const roundedRadiusVars: Record<string, string>;
|
|
17
|
+
/** The radii of the theme shape (`--theme-radius-*`). */
|
|
18
|
+
export declare const roundedShape: Pick<ThemeShape, 'radiusControl' | 'radiusTable' | 'radiusOverlay' | 'radiusCard' | 'radiusBubble' | 'radiusFrame'>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/** The radii as custom properties, the same in both modes. */
|
|
6
|
+
export const roundedRadiusVars = {
|
|
7
|
+
'--borderRadius-small': '10px',
|
|
8
|
+
'--borderRadius-medium': '14px',
|
|
9
|
+
'--borderRadius-large': '20px',
|
|
10
|
+
'--borderRadius-default': '14px',
|
|
11
|
+
'--agent-radius-control': '999px',
|
|
12
|
+
'--agent-radius-card': '20px',
|
|
13
|
+
'--agent-radius-bubble': '22px',
|
|
14
|
+
'--agent-radius-frame': '28px',
|
|
15
|
+
};
|
|
16
|
+
/** The radii of the theme shape (`--theme-radius-*`). */
|
|
17
|
+
export const roundedShape = {
|
|
18
|
+
radiusControl: roundedRadiusVars['--agent-radius-control'],
|
|
19
|
+
radiusTable: roundedRadiusVars['--borderRadius-medium'],
|
|
20
|
+
radiusOverlay: roundedRadiusVars['--agent-radius-card'],
|
|
21
|
+
radiusCard: roundedRadiusVars['--agent-radius-card'],
|
|
22
|
+
radiusBubble: roundedRadiusVars['--agent-radius-bubble'],
|
|
23
|
+
radiusFrame: roundedRadiusVars['--agent-radius-frame'],
|
|
24
|
+
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive Primer CSS-variable overrides for light & dark mode, with
|
|
3
|
+
* the rounded shape: Agent's and Metal's corners, pill controls (`roundedShape`).
|
|
4
|
+
*/
|
|
2
5
|
export declare const sandThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { sandColors } from '../colors/sandColors';
|
|
14
14
|
import { buildThemeStyles } from '../css/createThemeCSSVars';
|
|
15
|
+
import { roundedRadiusVars, roundedShape } from './roundedShape';
|
|
15
16
|
/* ── Light-mode colour definitions ───────────────────────────────────── */
|
|
16
17
|
const sandLight = {
|
|
17
18
|
canvas: {
|
|
@@ -240,7 +241,12 @@ const sandDark = {
|
|
|
240
241
|
* loading (same no-download approach as the Matrix monospace stack).
|
|
241
242
|
*/
|
|
242
243
|
const sandFontFamily = 'Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Cambria, serif';
|
|
243
|
-
/**
|
|
244
|
+
/**
|
|
245
|
+
* Comprehensive Primer CSS-variable overrides for light & dark mode, with
|
|
246
|
+
* the rounded shape: Agent's and Metal's corners, pill controls (`roundedShape`).
|
|
247
|
+
*/
|
|
244
248
|
export const sandThemeStyles = buildThemeStyles(sandLight, sandDark, {
|
|
245
249
|
fontFamily: sandFontFamily,
|
|
250
|
+
shape: roundedShape,
|
|
251
|
+
variables: { light: roundedRadiusVars, dark: roundedRadiusVars },
|
|
246
252
|
});
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive Primer CSS-variable overrides for light & dark mode, with
|
|
3
|
+
* the rounded shape: Agent's and Metal's corners, pill controls (`roundedShape`).
|
|
4
|
+
*/
|
|
2
5
|
export declare const sunThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { sunColors } from '../colors/sunColors';
|
|
14
14
|
import { buildThemeStyles } from '../css/createThemeCSSVars';
|
|
15
|
+
import { roundedRadiusVars, roundedShape } from './roundedShape';
|
|
15
16
|
/* ── Light-mode colour definitions ───────────────────────────────────── */
|
|
16
17
|
const sunLight = {
|
|
17
18
|
canvas: {
|
|
@@ -241,7 +242,12 @@ const sunDark = {
|
|
|
241
242
|
* approach as the Matrix monospace stack).
|
|
242
243
|
*/
|
|
243
244
|
const sunFontFamily = '"Avenir Next", Avenir, "Segoe UI", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif';
|
|
244
|
-
/**
|
|
245
|
+
/**
|
|
246
|
+
* Comprehensive Primer CSS-variable overrides for light & dark mode, with
|
|
247
|
+
* the rounded shape: Agent's and Metal's corners, pill controls (`roundedShape`).
|
|
248
|
+
*/
|
|
245
249
|
export const sunThemeStyles = buildThemeStyles(sunLight, sunDark, {
|
|
246
250
|
fontFamily: sunFontFamily,
|
|
251
|
+
shape: roundedShape,
|
|
252
|
+
variables: { light: roundedRadiusVars, dark: roundedRadiusVars },
|
|
247
253
|
});
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { type StoreApi, type UseBoundStore } from 'zustand';
|
|
23
23
|
import type { ThemeVariant } from './themeRegistry';
|
|
24
|
-
import type { ColorMode } from './
|
|
24
|
+
import type { ColorMode } from './colorMode';
|
|
25
25
|
export type VariantPreference = {
|
|
26
26
|
theme: ThemeVariant;
|
|
27
27
|
colorMode: ColorMode;
|
|
@@ -29,6 +29,12 @@ export type VariantPreference = {
|
|
|
29
29
|
};
|
|
30
30
|
/** Per-variant theme + colorMode preferences. */
|
|
31
31
|
export type VariantDefaults = Record<string, VariantPreference>;
|
|
32
|
+
/**
|
|
33
|
+
* Themes renamed here, read under their new id when a store hydrates (the
|
|
34
|
+
* user, 22 November 2026: the 'loop' theme is the 'agent' theme): a person's
|
|
35
|
+
* choice follows the theme it named rather than falling back to the default.
|
|
36
|
+
*/
|
|
37
|
+
export declare const RENAMED_THEMES: Readonly<Record<string, ThemeVariant>>;
|
|
32
38
|
export interface ThemeState {
|
|
33
39
|
/** Current color mode (light, dark, or auto = follow OS). */
|
|
34
40
|
colorMode: ColorMode;
|
|
@@ -47,6 +47,25 @@ function normalizeVariants(variants) {
|
|
|
47
47
|
}
|
|
48
48
|
return normalized;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* A stored theme the registry no longer has (a renamed theme: 'loop' became
|
|
52
|
+
* 'agent' on 22 November 2026) is not drawn: it would leave the page without
|
|
53
|
+
* a theme. The stored choice is dropped and the store's own default stands.
|
|
54
|
+
*/
|
|
55
|
+
function isKnownTheme(theme) {
|
|
56
|
+
return typeof theme === 'string' && Object.prototype.hasOwnProperty.call(themeConfigs, theme);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Themes renamed here, read under their new id when a store hydrates (the
|
|
60
|
+
* user, 22 November 2026: the 'loop' theme is the 'agent' theme): a person's
|
|
61
|
+
* choice follows the theme it named rather than falling back to the default.
|
|
62
|
+
*/
|
|
63
|
+
export const RENAMED_THEMES = {
|
|
64
|
+
loop: 'agent',
|
|
65
|
+
};
|
|
66
|
+
function renamedTheme(theme) {
|
|
67
|
+
return typeof theme === 'string' && theme in RENAMED_THEMES ? RENAMED_THEMES[theme] : theme;
|
|
68
|
+
}
|
|
50
69
|
function hasMissingVariantVersion(variants) {
|
|
51
70
|
if (!variants || Object.keys(variants).length === 0) {
|
|
52
71
|
return false;
|
|
@@ -180,7 +199,7 @@ export function createThemeStore(storageKey, defaults) {
|
|
|
180
199
|
// Legacy snapshots without per-variant versions are upgraded to v1.
|
|
181
200
|
// Anonymous defaults are forced to matrix/dark during this upgrade.
|
|
182
201
|
if (missingVariantVersion) {
|
|
183
|
-
variants['
|
|
202
|
+
variants['site-anonymous'] = {
|
|
184
203
|
theme: 'matrix',
|
|
185
204
|
colorMode: 'dark',
|
|
186
205
|
version: VARIANT_SCHEMA_VERSION,
|
|
@@ -191,8 +210,8 @@ export function createThemeStore(storageKey, defaults) {
|
|
|
191
210
|
variants,
|
|
192
211
|
...(missingVariantVersion
|
|
193
212
|
? {
|
|
194
|
-
theme: p.activeVariant === '
|
|
195
|
-
colorMode: p.activeVariant === '
|
|
213
|
+
theme: p.activeVariant === 'site-anonymous' ? 'matrix' : p.theme,
|
|
214
|
+
colorMode: p.activeVariant === 'site-anonymous' ? 'dark' : p.colorMode,
|
|
196
215
|
}
|
|
197
216
|
: {}),
|
|
198
217
|
};
|
|
@@ -211,14 +230,18 @@ export function createThemeStore(storageKey, defaults) {
|
|
|
211
230
|
const mergedVariants = normalizeVariants(current.variants);
|
|
212
231
|
if (p.variants) {
|
|
213
232
|
for (const [key, val] of Object.entries(p.variants)) {
|
|
214
|
-
|
|
215
|
-
|
|
233
|
+
const theme = val && typeof val === 'object' ? renamedTheme(val.theme) : undefined;
|
|
234
|
+
if (val && typeof val === 'object' && isKnownTheme(theme)) {
|
|
235
|
+
mergedVariants[key] = normalizeVariantPreference({ ...val, theme });
|
|
216
236
|
}
|
|
217
237
|
}
|
|
218
238
|
}
|
|
239
|
+
const { theme: stored, ...rest } = p;
|
|
240
|
+
const storedTheme = renamedTheme(stored);
|
|
219
241
|
return {
|
|
220
242
|
...current,
|
|
221
|
-
...
|
|
243
|
+
...rest,
|
|
244
|
+
...(isKnownTheme(storedTheme) ? { theme: storedTheme } : {}),
|
|
222
245
|
variants: mergedVariants,
|
|
223
246
|
};
|
|
224
247
|
},
|
package/lib/utils/Helper.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { AnimateProps } from '@primer/react-brand';
|
|
3
|
-
/**
|
|
4
|
-
* Layout
|
|
5
|
-
*/
|
|
6
|
-
export declare const Container: ({ children, style, }: {
|
|
7
|
-
children: React.ReactElement[] | React.ReactElement;
|
|
8
|
-
style?: React.CSSProperties;
|
|
9
|
-
}) => React.JSX.Element;
|
|
10
|
-
type RedlineBackgroundProps = {
|
|
11
|
-
height?: number;
|
|
12
|
-
hasBorder?: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare function RedlineBackground({ height, hasBorder, ...rest }: PropsWithChildren<RedlineBackgroundProps>): React.JSX.Element;
|
|
1
|
+
import { Ref } from 'react';
|
|
15
2
|
/**
|
|
16
3
|
* Base Types
|
|
17
4
|
*
|
|
@@ -27,6 +14,4 @@ export type BaseProps<T> = {
|
|
|
27
14
|
className?: string;
|
|
28
15
|
id?: string;
|
|
29
16
|
ref?: Ref<T>;
|
|
30
|
-
animate?: AnimateProps;
|
|
31
17
|
};
|
|
32
|
-
export {};
|
package/lib/utils/Helper.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
export function RedlineBackground({ height, hasBorder = true, ...rest }) {
|
|
7
|
-
return (_jsx("div", { style: {
|
|
8
|
-
display: 'flex',
|
|
9
|
-
overflow: 'hidden',
|
|
10
|
-
border: hasBorder
|
|
11
|
-
? '1px solid var(--base-color-scale-red-2)'
|
|
12
|
-
: undefined,
|
|
13
|
-
backgroundImage: 'linear-gradient(45deg, var(--base-color-scale-red-0) 12.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 12.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 50%, var(--base-color-scale-red-0) 50%, var(--base-color-scale-red-0) 62.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 62.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 100%)',
|
|
14
|
-
backgroundSize: '5.66px 5.66px',
|
|
15
|
-
WebkitBoxPack: 'center',
|
|
16
|
-
justifyContent: 'center',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
width: '100%',
|
|
19
|
-
height,
|
|
20
|
-
}, ...rest }));
|
|
21
|
-
}
|
|
5
|
+
export {};
|
package/lib/utils/Portals.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare const THEME_SCOPE_ATTRIBUTE = "data-datalayer-theme-scope";
|
|
|
36
36
|
/**
|
|
37
37
|
* The attribute an application puts on its own outer Primer `BaseStyles`
|
|
38
38
|
* when it wraps everything in Primer's provider above a Datalayer one: that
|
|
39
|
-
* element is the application's, not a host page's
|
|
39
|
+
* element is the application's, not a host page's, so the
|
|
40
40
|
* provider inside it still themes the page's portal root.
|
|
41
41
|
*/
|
|
42
42
|
export declare const APP_ROOT_ATTRIBUTE = "data-datalayer-app-root";
|
package/lib/utils/Portals.js
CHANGED
|
@@ -220,7 +220,7 @@ export const THEME_SCOPE_ATTRIBUTE = 'data-datalayer-theme-scope';
|
|
|
220
220
|
/**
|
|
221
221
|
* The attribute an application puts on its own outer Primer `BaseStyles`
|
|
222
222
|
* when it wraps everything in Primer's provider above a Datalayer one: that
|
|
223
|
-
* element is the application's, not a host page's
|
|
223
|
+
* element is the application's, not a host page's, so the
|
|
224
224
|
* provider inside it still themes the page's portal root.
|
|
225
225
|
*/
|
|
226
226
|
export const APP_ROOT_ATTRIBUTE = 'data-datalayer-app-root';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/primer-addons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.54",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run build:lib",
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"@primer/octicons-react": "^19.42.0",
|
|
40
40
|
"@primer/primitives": "^10.7.0",
|
|
41
41
|
"@primer/react": "^37.31.0",
|
|
42
|
-
"@primer/react-brand": "^0.58.2",
|
|
43
42
|
"react-loading-skeleton": "^3.5.0",
|
|
44
43
|
"styled-components": "^5.3.10",
|
|
45
44
|
"zustand": "^5.0.0"
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
|
-
* The `
|
|
7
|
+
* The `agent` theme's face: Inter, open licence (SIL OFL 1.1) and
|
|
8
8
|
* variable, served by the page's own build from `@fontsource-variable/inter`
|
|
9
9
|
* — the woff2 is bundled as an asset of the importing application, so it is
|
|
10
10
|
* fetched from that application's origin and never from a third party.
|
|
11
11
|
*
|
|
12
12
|
* Import it once where the theme can be worn:
|
|
13
13
|
*
|
|
14
|
-
* import '@datalayer/primer-addons/style/
|
|
14
|
+
* import '@datalayer/primer-addons/style/agent-face.css';
|
|
15
15
|
*
|
|
16
16
|
* Only the upright variable axis (weights 100 to 900 in one file; the theme
|
|
17
17
|
* uses 400 and 600) and only two subsets, latin and latin-ext: a browser
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
-
import type { BrandTheme } from './themes-brand/spatialBrandTheme';
|
|
3
|
-
export type ColorMode = 'light' | 'dark' | 'auto';
|
|
4
|
-
export interface IDatalayerBrandThemeProviderProps {
|
|
5
|
-
/**
|
|
6
|
-
* Color mode to use.
|
|
7
|
-
* - `'light'` / `'dark'` — explicit override
|
|
8
|
-
* - `'auto'` — follow the operating system preference (prefers-color-scheme)
|
|
9
|
-
*/
|
|
10
|
-
colorMode?: ColorMode;
|
|
11
|
-
/**
|
|
12
|
-
* A brand theme object with per-mode CSS variable overrides.
|
|
13
|
-
* Each key (`light` / `dark`) is a `CSSProperties` map whose entries
|
|
14
|
-
* are `--brand-color-*` / `--brand-button-*` custom properties.
|
|
15
|
-
*
|
|
16
|
-
* When omitted, the default Primer Brand tokens are used unchanged.
|
|
17
|
-
*/
|
|
18
|
-
brandTheme?: BrandTheme;
|
|
19
|
-
/**
|
|
20
|
-
* Additional inline styles merged on top of the resolved brand theme.
|
|
21
|
-
*/
|
|
22
|
-
style?: CSSProperties;
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Theme provider for Primer Brand (`@primer/react-brand`) components.
|
|
27
|
-
*
|
|
28
|
-
* Works by passing CSS custom-property overrides as inline `style` to
|
|
29
|
-
* `ThemeProvider`, which scopes them to its DOM subtree — exactly how
|
|
30
|
-
* the VS Code extension re-skins Primer via CSS variables.
|
|
31
|
-
*
|
|
32
|
-
* ```tsx
|
|
33
|
-
* import { DatalayerBrandThemeProvider } from '@datalayer/core/lib/theme';
|
|
34
|
-
* import { spatialBrandTheme } from '@datalayer/core/lib/theme/themes-brand/spatialBrandTheme';
|
|
35
|
-
*
|
|
36
|
-
* <DatalayerBrandThemeProvider colorMode="dark" brandTheme={spatialBrandTheme}>
|
|
37
|
-
* <Hero>…</Hero>
|
|
38
|
-
* </DatalayerBrandThemeProvider>
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare function DatalayerBrandThemeProvider({ colorMode, brandTheme, style, children, }: IDatalayerBrandThemeProviderProps): React.JSX.Element;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ThemeProvider as PrimerBrandThemeProvider } from '@primer/react-brand';
|
|
3
|
-
import { useSystemColorMode } from './useSystemColorMode';
|
|
4
|
-
/**
|
|
5
|
-
* Theme provider for Primer Brand (`@primer/react-brand`) components.
|
|
6
|
-
*
|
|
7
|
-
* Works by passing CSS custom-property overrides as inline `style` to
|
|
8
|
-
* `ThemeProvider`, which scopes them to its DOM subtree — exactly how
|
|
9
|
-
* the VS Code extension re-skins Primer via CSS variables.
|
|
10
|
-
*
|
|
11
|
-
* ```tsx
|
|
12
|
-
* import { DatalayerBrandThemeProvider } from '@datalayer/core/lib/theme';
|
|
13
|
-
* import { spatialBrandTheme } from '@datalayer/core/lib/theme/themes-brand/spatialBrandTheme';
|
|
14
|
-
*
|
|
15
|
-
* <DatalayerBrandThemeProvider colorMode="dark" brandTheme={spatialBrandTheme}>
|
|
16
|
-
* <Hero>…</Hero>
|
|
17
|
-
* </DatalayerBrandThemeProvider>
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export function DatalayerBrandThemeProvider({ colorMode = 'light', brandTheme, style, children, }) {
|
|
21
|
-
const systemMode = useSystemColorMode();
|
|
22
|
-
const resolved = colorMode === 'auto' ? systemMode : colorMode;
|
|
23
|
-
const themeOverrides = brandTheme
|
|
24
|
-
? resolved === 'dark'
|
|
25
|
-
? brandTheme.dark
|
|
26
|
-
: brandTheme.light
|
|
27
|
-
: undefined;
|
|
28
|
-
return (_jsx(PrimerBrandThemeProvider, { colorMode: resolved, style: {
|
|
29
|
-
...themeOverrides,
|
|
30
|
-
...style,
|
|
31
|
-
}, children: children }));
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './spatialBrandTheme';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type CSSProperties } from 'react';
|
|
2
|
-
export declare const spatialBrandLight: CSSProperties;
|
|
3
|
-
export declare const spatialBrandDark: CSSProperties;
|
|
4
|
-
/**
|
|
5
|
-
* Spatial Brand Theme — combined light + dark overrides.
|
|
6
|
-
*
|
|
7
|
-
* Pass to `DatalayerBrandThemeProvider`'s `brandTheme` prop.
|
|
8
|
-
*/
|
|
9
|
-
export declare const spatialBrandTheme: {
|
|
10
|
-
light: CSSProperties;
|
|
11
|
-
dark: CSSProperties;
|
|
12
|
-
};
|
|
13
|
-
export type BrandTheme = {
|
|
14
|
-
light: CSSProperties;
|
|
15
|
-
dark: CSSProperties;
|
|
16
|
-
};
|