@datalayer/primer-addons 1.0.42 → 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.
Files changed (47) hide show
  1. package/README.md +6 -2
  2. package/lib/components/appearance/AppearanceControls.stories.d.ts +45 -0
  3. package/lib/components/appearance/AppearanceControls.stories.js +91 -0
  4. package/lib/components/appearance/AppearanceMenu.stories.d.ts +49 -0
  5. package/lib/components/appearance/AppearanceMenu.stories.js +80 -0
  6. package/lib/components/appearance/CollaboratorPalette.stories.d.ts +34 -0
  7. package/lib/components/appearance/CollaboratorPalette.stories.js +59 -0
  8. package/lib/components/appearance/ColorModeCircle.stories.d.ts +47 -0
  9. package/lib/components/appearance/ColorModeCircle.stories.js +80 -0
  10. package/lib/components/appearance/ThemeCircle.stories.d.ts +31 -0
  11. package/lib/components/appearance/ThemeCircle.stories.js +54 -0
  12. package/lib/components/appearance/ThemePreviewCard.stories.d.ts +38 -0
  13. package/lib/components/appearance/ThemePreviewCard.stories.js +72 -0
  14. package/lib/components/box/Box.stories.d.ts +61 -0
  15. package/lib/components/box/Box.stories.js +103 -0
  16. package/lib/components/calendar-picker/CalendarPicker.stories.d.ts +53 -0
  17. package/lib/components/calendar-picker/CalendarPicker.stories.js +89 -0
  18. package/lib/components/card/Card.d.ts +40 -0
  19. package/lib/components/card/Card.js +59 -3
  20. package/lib/components/card/Card.stories.d.ts +8 -0
  21. package/lib/components/card/Card.stories.js +17 -1
  22. package/lib/components/color/ColorSwatch.stories.d.ts +26 -0
  23. package/lib/components/color/ColorSwatch.stories.js +54 -0
  24. package/lib/components/color-picker/ColorPicker.stories.d.ts +36 -0
  25. package/lib/components/color-picker/ColorPicker.stories.js +85 -0
  26. package/lib/components/date-picker/DatePicker.stories.d.ts +65 -0
  27. package/lib/components/date-picker/DatePicker.stories.js +110 -0
  28. package/lib/components/entity-avatar/EntityAvatar.stories.d.ts +47 -0
  29. package/lib/components/entity-avatar/EntityAvatar.stories.js +81 -0
  30. package/lib/components/hover-card/HoverCard.js +4 -1
  31. package/lib/components/hover-card/HoverCard.stories.d.ts +48 -0
  32. package/lib/components/hover-card/HoverCard.stories.js +98 -0
  33. package/lib/components/logo/DatalayerLogo.stories.d.ts +37 -0
  34. package/lib/components/logo/DatalayerLogo.stories.js +58 -0
  35. package/lib/components/sheet/Sheet.stories.d.ts +25 -0
  36. package/lib/components/sheet/Sheet.stories.js +32 -0
  37. package/lib/components/toolbar/Toolbar.stories.d.ts +36 -0
  38. package/lib/components/toolbar/Toolbar.stories.js +209 -0
  39. package/lib/story-helpers.d.ts +11 -0
  40. package/lib/story-helpers.js +19 -1
  41. package/lib/theme/themeRegistry.js +8 -2
  42. package/lib/theme/themeTokens.js +2 -2
  43. package/lib/theme/themes/vscodeTheme.d.ts +8 -0
  44. package/lib/theme/themes/vscodeTheme.js +9 -0
  45. package/lib/theme/themes/vscodeThemeStyles.d.ts +6 -4
  46. package/lib/theme/themes/vscodeThemeStyles.js +11 -9
  47. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from "@primer/react";
3
+ import { DatalayerLogo, DatalayerLogoText, DatalayerText, DatalayerTextAI, themeConfigs, themeVariants, } from "../..";
4
+ const meta = {
5
+ title: "Components/DatalayerLogo",
6
+ component: DatalayerLogo,
7
+ tags: ["autodocs"],
8
+ parameters: {
9
+ layout: "fullscreen",
10
+ },
11
+ argTypes: {
12
+ variant: {
13
+ options: themeVariants,
14
+ control: "select",
15
+ },
16
+ colorMode: {
17
+ options: ["light", "dark", "auto"],
18
+ control: "radio",
19
+ },
20
+ },
21
+ args: {
22
+ size: 64,
23
+ variant: "datalayer",
24
+ colorMode: "light",
25
+ gradient: false,
26
+ },
27
+ };
28
+ export default meta;
29
+ /** The square mark, in a theme's colours. */
30
+ export const Logo = {
31
+ render: (args) => (_jsx(Box, { p: 3, bg: "canvas.default", children: _jsx(DatalayerLogo, { ...args }) })),
32
+ };
33
+ /** The mark with gradients. */
34
+ export const Gradient = {
35
+ args: {
36
+ gradient: true,
37
+ variant: "loop",
38
+ },
39
+ render: (args) => (_jsx(Box, { p: 3, bg: "canvas.default", children: _jsx(DatalayerLogo, { ...args }) })),
40
+ };
41
+ /** The mark beside the wordmark, and the wordmark with the AI glyph. */
42
+ export const LogoTextAndTextAI = {
43
+ args: {
44
+ size: 32,
45
+ },
46
+ render: (args) => (_jsxs(Box, { p: 3, bg: "canvas.default", sx: { display: "grid", gap: 4, justifyItems: "start" }, children: [_jsx(DatalayerLogoText, { size: args.size, variant: args.variant, colorMode: args.colorMode }), _jsx(DatalayerLogoText, { size: args.size, variant: args.variant, colorMode: args.colorMode, inverse: true }), _jsx(DatalayerTextAI, { size: args.size, variant: args.variant, colorMode: args.colorMode })] })),
47
+ };
48
+ /** The bare wordmark: an SVG group, placed in an SVG of the host's own. */
49
+ export const Wordmark = {
50
+ render: () => (_jsx(Box, { p: 3, bg: "canvas.default", children: _jsx("svg", { viewBox: "0 0 124.672 25", height: 50, role: "img", "aria-label": "Datalayer", children: _jsx(DatalayerText, { x: -12 }) }) })),
51
+ };
52
+ /** The mark in every theme. */
53
+ export const AllThemes = {
54
+ args: {
55
+ size: 48,
56
+ },
57
+ render: (args) => (_jsx(Box, { p: 3, bg: "canvas.default", sx: { display: "flex", flexWrap: "wrap", gap: 4 }, children: themeVariants.map((variant) => (_jsxs(Box, { sx: { display: "grid", gap: 1, justifyItems: "center" }, children: [_jsx(DatalayerLogo, { size: args.size, variant: variant, colorMode: args.colorMode, gradient: args.gradient }), _jsx(Text, { sx: { fontSize: 0, color: "fg.muted" }, children: themeConfigs[variant].label })] }, variant))) })),
58
+ };
@@ -0,0 +1,25 @@
1
+ import type { StoryObj } from "@storybook/react";
2
+ import { Sheet } from "../..";
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof Sheet;
6
+ tags: string[];
7
+ parameters: {
8
+ layout: string;
9
+ };
10
+ args: {
11
+ px: (string | number)[];
12
+ py: number;
13
+ maxWidth: number;
14
+ mx: string;
15
+ };
16
+ };
17
+ export default meta;
18
+ type Story = StoryObj<typeof meta>;
19
+ /**
20
+ * A sheet on a quiet canvas — the page the page layout draws, on its own:
21
+ * the canvas colour, its hairline, the theme's card corner and a paper's shadow.
22
+ */
23
+ export declare const Page: Story;
24
+ /** Three sheets side by side, each padded as its content needs. */
25
+ export declare const SideBySide: Story;
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Sheet } from "../..";
3
+ const meta = {
4
+ title: "Components/Sheet",
5
+ component: Sheet,
6
+ tags: ["autodocs"],
7
+ parameters: {
8
+ layout: "fullscreen",
9
+ },
10
+ args: {
11
+ px: [3, 4, "56px"],
12
+ py: 4,
13
+ maxWidth: 640,
14
+ mx: "auto",
15
+ },
16
+ };
17
+ export default meta;
18
+ /**
19
+ * A sheet on a quiet canvas — the page the page layout draws, on its own:
20
+ * the canvas colour, its hairline, the theme's card corner and a paper's shadow.
21
+ */
22
+ export const Page = {
23
+ render: (args) => (_jsx(Box, { bg: "canvas.subtle", p: 4, children: _jsxs(Sheet, { ...args, children: [_jsx(Box, { as: "h3", m: 0, mb: 2, fontSize: 3, children: "A page" }), _jsx(Box, { as: "p", m: 0, color: "fg.muted", children: "The canvas colour, its hairline, the theme's card corner and the shadow a sheet of paper has. Its size, padding and layout are yours." })] }) })),
24
+ };
25
+ /** Three sheets side by side, each padded as its content needs. */
26
+ export const SideBySide = {
27
+ args: {
28
+ p: 3,
29
+ minHeight: 120,
30
+ },
31
+ render: (args) => (_jsx(Box, { bg: "canvas.subtle", p: 4, display: "grid", gridTemplateColumns: ["1fr", "repeat(3, 1fr)"], gap: 3, children: ["Notes", "Draft", "Report"].map((name) => (_jsxs(Sheet, { p: args.p, minHeight: args.minHeight, children: [_jsx(Box, { fontWeight: "semibold", children: name }), _jsx(Box, { color: "fg.muted", fontSize: 0, children: "Three sheets side by side, each padded as its content needs." })] }, name))) })),
32
+ };
@@ -0,0 +1,36 @@
1
+ import type { StoryObj } from "@storybook/react";
2
+ import { Toolbar } from "../..";
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof Toolbar;
6
+ tags: string[];
7
+ parameters: {
8
+ layout: string;
9
+ };
10
+ argTypes: {
11
+ items: {
12
+ control: false;
13
+ };
14
+ extraItems: {
15
+ control: false;
16
+ };
17
+ };
18
+ args: {
19
+ items: never[];
20
+ ariaLabel: string;
21
+ disabled: false;
22
+ overflow: true;
23
+ };
24
+ };
25
+ export default meta;
26
+ type Story = StoryObj<typeof meta>;
27
+ /** A formatting toolbar: a block-type dropdown, toggles that stay pressed, dividers. */
28
+ export declare const Default: Story;
29
+ /** Text labels instead of icons. */
30
+ export declare const TextLabels: Story;
31
+ /** In a narrow column: what does not fit moves into the overflow menu. */
32
+ export declare const Overflow: Story;
33
+ /** The whole toolbar disabled. */
34
+ export declare const Disabled: Story;
35
+ /** `FloatingToolbar`: select text in the paragraph and it appears by the selection. */
36
+ export declare const Floating: Story;
@@ -0,0 +1,209 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2021-2026 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ import { useRef, useState } from "react";
7
+ import { BoldIcon, CodeIcon, ItalicIcon, LinkIcon, ListOrderedIcon, ListUnorderedIcon, QuoteIcon, StrikethroughIcon, } from "@primer/octicons-react";
8
+ import { Box, Text } from "@primer/react";
9
+ import { FloatingToolbar, Toolbar } from "../..";
10
+ const BLOCK_LABELS = {
11
+ paragraph: "Paragraph",
12
+ heading: "Heading",
13
+ quote: "Quote",
14
+ };
15
+ /** An editor's formatting state, and the toolbar items that change it. */
16
+ const useFormattingItems = () => {
17
+ const [formats, setFormats] = useState({
18
+ bold: false,
19
+ italic: false,
20
+ strikethrough: false,
21
+ code: false,
22
+ });
23
+ const [block, setBlock] = useState("paragraph");
24
+ const toggle = (key) => setFormats((previous) => ({ ...previous, [key]: !previous[key] }));
25
+ const items = [
26
+ {
27
+ key: "block-type",
28
+ type: "dropdown",
29
+ ariaLabel: "Block type",
30
+ label: BLOCK_LABELS[block],
31
+ minWidth: 96,
32
+ options: Object.keys(BLOCK_LABELS).map((key) => ({
33
+ key,
34
+ label: BLOCK_LABELS[key],
35
+ isActive: block === key,
36
+ onClick: () => setBlock(key),
37
+ })),
38
+ },
39
+ { key: "divider-1", type: "divider" },
40
+ {
41
+ key: "bold",
42
+ type: "button",
43
+ ariaLabel: "Bold",
44
+ title: "Bold",
45
+ icon: BoldIcon,
46
+ shortcut: "⌘B",
47
+ isActive: formats.bold,
48
+ onClick: () => toggle("bold"),
49
+ },
50
+ {
51
+ key: "italic",
52
+ type: "button",
53
+ ariaLabel: "Italic",
54
+ title: "Italic",
55
+ icon: ItalicIcon,
56
+ shortcut: "⌘I",
57
+ isActive: formats.italic,
58
+ onClick: () => toggle("italic"),
59
+ },
60
+ {
61
+ key: "strikethrough",
62
+ type: "button",
63
+ ariaLabel: "Strikethrough",
64
+ title: "Strikethrough",
65
+ icon: StrikethroughIcon,
66
+ isActive: formats.strikethrough,
67
+ onClick: () => toggle("strikethrough"),
68
+ },
69
+ {
70
+ key: "code",
71
+ type: "button",
72
+ ariaLabel: "Inline code",
73
+ title: "Inline code",
74
+ icon: CodeIcon,
75
+ isActive: formats.code,
76
+ onClick: () => toggle("code"),
77
+ },
78
+ { key: "divider-2", type: "divider" },
79
+ {
80
+ key: "bullets",
81
+ type: "button",
82
+ ariaLabel: "Bulleted list",
83
+ title: "Bulleted list",
84
+ icon: ListUnorderedIcon,
85
+ onClick: () => setBlock("paragraph"),
86
+ },
87
+ {
88
+ key: "numbers",
89
+ type: "button",
90
+ ariaLabel: "Numbered list",
91
+ title: "Numbered list",
92
+ icon: ListOrderedIcon,
93
+ onClick: () => setBlock("paragraph"),
94
+ },
95
+ {
96
+ key: "quote",
97
+ type: "button",
98
+ ariaLabel: "Quote",
99
+ title: "Quote",
100
+ icon: QuoteIcon,
101
+ isActive: block === "quote",
102
+ onClick: () => setBlock("quote"),
103
+ },
104
+ {
105
+ key: "link",
106
+ type: "button",
107
+ ariaLabel: "Insert link",
108
+ title: "Insert link",
109
+ icon: LinkIcon,
110
+ onClick: () => console.log("Insert link"),
111
+ },
112
+ ];
113
+ return [items, formats, block];
114
+ };
115
+ const meta = {
116
+ title: "Components/Toolbar",
117
+ component: Toolbar,
118
+ tags: ["autodocs"],
119
+ parameters: {
120
+ layout: "fullscreen",
121
+ },
122
+ argTypes: {
123
+ items: { control: false },
124
+ extraItems: { control: false },
125
+ },
126
+ args: {
127
+ items: [],
128
+ ariaLabel: "Editor toolbar",
129
+ disabled: false,
130
+ overflow: true,
131
+ },
132
+ };
133
+ export default meta;
134
+ /** A formatting toolbar: a block-type dropdown, toggles that stay pressed, dividers. */
135
+ export const Default = {
136
+ render: function DefaultStory(args) {
137
+ const [items, formats, block] = useFormattingItems();
138
+ return (_jsxs(Box, { p: 3, bg: "canvas.default", children: [_jsx(Toolbar, { ...args, items: items }), _jsxs(Text, { as: "p", sx: { mt: 2, fontSize: 0, color: "fg.muted" }, children: [BLOCK_LABELS[block], ";", " ", Object.entries(formats)
139
+ .filter(([, on]) => on)
140
+ .map(([key]) => key)
141
+ .join(", ") || "no inline format", "."] })] }));
142
+ },
143
+ };
144
+ /** Text labels instead of icons. */
145
+ export const TextLabels = {
146
+ render: function TextLabelsStory(args) {
147
+ const [bold, setBold] = useState(false);
148
+ const [italic, setItalic] = useState(false);
149
+ const items = [
150
+ {
151
+ key: "bold",
152
+ type: "button",
153
+ ariaLabel: "Bold",
154
+ label: "B",
155
+ isActive: bold,
156
+ onClick: () => setBold((value) => !value),
157
+ },
158
+ {
159
+ key: "italic",
160
+ type: "button",
161
+ ariaLabel: "Italic",
162
+ label: "I",
163
+ isActive: italic,
164
+ onClick: () => setItalic((value) => !value),
165
+ },
166
+ ];
167
+ return (_jsx(Box, { p: 3, bg: "canvas.default", children: _jsx(Toolbar, { ...args, items: items }) }));
168
+ },
169
+ };
170
+ /** In a narrow column: what does not fit moves into the overflow menu. */
171
+ export const Overflow = {
172
+ render: function OverflowStory(args) {
173
+ const [items] = useFormattingItems();
174
+ return (_jsx(Box, { p: 3, bg: "canvas.default", children: _jsx(Box, { sx: {
175
+ width: 240,
176
+ border: "1px dashed",
177
+ borderColor: "border.default",
178
+ }, children: _jsx(Toolbar, { ...args, items: items }) }) }));
179
+ },
180
+ };
181
+ /** The whole toolbar disabled. */
182
+ export const Disabled = {
183
+ args: {
184
+ disabled: true,
185
+ },
186
+ render: function DisabledStory(args) {
187
+ const [items] = useFormattingItems();
188
+ return (_jsx(Box, { p: 3, bg: "canvas.default", children: _jsx(Toolbar, { ...args, items: items }) }));
189
+ },
190
+ };
191
+ /** `FloatingToolbar`: select text in the paragraph and it appears by the selection. */
192
+ export const Floating = {
193
+ render: function FloatingStory(args) {
194
+ const [items] = useFormattingItems();
195
+ const [visible, setVisible] = useState(false);
196
+ const anchorRef = useRef(null);
197
+ const onSelectionChange = () => {
198
+ const selection = window.getSelection();
199
+ setVisible(Boolean(selection && !selection.isCollapsed));
200
+ };
201
+ return (_jsxs(Box, { p: 3, bg: "canvas.default", minHeight: 240, children: [_jsx(Text, { as: "p", sx: { mb: 2, fontSize: 0, color: "fg.muted" }, children: "Select a few words below." }), _jsxs("div", { ref: anchorRef, style: { position: "relative", paddingTop: 56 }, children: [_jsx(Box, { contentEditable: true, suppressContentEditableWarning: true, onMouseUp: onSelectionChange, onKeyUp: onSelectionChange, sx: {
202
+ p: 3,
203
+ border: "1px solid",
204
+ borderColor: "border.default",
205
+ borderRadius: 2,
206
+ maxWidth: 560,
207
+ }, children: "The floating toolbar suits inline editing: select a few words in this paragraph and it appears near the selection, then goes when the selection collapses." }), _jsx(FloatingToolbar, { anchorElement: anchorRef.current, isVisible: visible, items: items, ariaLabel: args.ariaLabel, disabled: args.disabled, onClose: () => setVisible(false) })] })] }));
208
+ },
209
+ };
@@ -4,6 +4,7 @@ import { Icon } from '@primer/octicons-react';
4
4
  type StoryContext = Record<string, unknown> & {
5
5
  globals: {
6
6
  colorScheme: string;
7
+ themeVariant?: string;
7
8
  };
8
9
  parameters: Record<string, unknown>;
9
10
  };
@@ -20,6 +21,16 @@ export declare const toolbarTypes: {
20
21
  title: string;
21
22
  };
22
23
  };
24
+ themeVariant: {
25
+ name: string;
26
+ description: string;
27
+ defaultValue: string;
28
+ toolbar: {
29
+ icon: string;
30
+ items: string[];
31
+ title: string;
32
+ };
33
+ };
23
34
  };
24
35
  export declare const inputWrapperArgTypes: ArgTypes;
25
36
  export declare const getTextInputArgTypes: (category?: string) => Record<string, unknown>;
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createGlobalStyle } from 'styled-components';
3
3
  import { ThemeProvider, themeGet, BaseStyles, theme } from '@primer/react';
4
+ import { DatalayerThemeProvider } from './theme/DatalayerThemeProvider';
5
+ import { themeConfigs, themeVariants, } from './theme/themeRegistry';
4
6
  // set global theme styles for each story
5
7
  const GlobalStyle = createGlobalStyle `
6
8
  body,
@@ -16,7 +18,13 @@ export const withThemeProvider = (Story, context) => {
16
18
  // used for testing ThemeProvider.stories.tsx
17
19
  if (context.parameters.disableThemeDecorator)
18
20
  return Story(context);
19
- const { colorScheme } = context.globals;
21
+ const { colorScheme, themeVariant } = context.globals;
22
+ // One of the package's themes: the provider applications use, so the
23
+ // story wears that theme's tokens (its corners, hairlines, palette).
24
+ if (themeVariant && themeVariant !== 'primer') {
25
+ const config = themeConfigs[themeVariant];
26
+ return (_jsx(DatalayerThemeProvider, { colorMode: colormodeFromScheme(colorScheme), theme: config.primerTheme, themeStyles: config.themeStyles, children: _jsx("div", { id: "html-addon-root", children: Story(context) }) }));
27
+ }
20
28
  return (_jsxs(ThemeProvider, { theme: theme, colorMode: colormodeFromScheme(colorScheme), dayScheme: colorScheme, nightScheme: colorScheme, children: [colorScheme.startsWith('light') ? (_jsx(GlobalStyle, { "$lightTheme": true })) : (_jsx(GlobalStyle, {})), _jsx(BaseStyles, { children: _jsx("div", { id: "html-addon-root", children: Story(context) }) })] }));
21
29
  };
22
30
  export const toolbarTypes = {
@@ -30,6 +38,16 @@ export const toolbarTypes = {
30
38
  title: 'Color Scheme',
31
39
  },
32
40
  },
41
+ themeVariant: {
42
+ name: 'Theme',
43
+ description: "The package's theme the story is drawn in, or plain Primer",
44
+ defaultValue: 'datalayer',
45
+ toolbar: {
46
+ icon: 'paintbrush',
47
+ items: ['primer', ...themeVariants],
48
+ title: 'Theme',
49
+ },
50
+ },
33
51
  };
34
52
  export const inputWrapperArgTypes = {
35
53
  block: {
@@ -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
- { ...themeTokens[variant], primerTheme: primerThemes[variant] },
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) {
@@ -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 { vscodeThemeStyles } from './themes/vscodeThemeStyles';
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: vscodeThemeStyles,
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
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
5
- export declare const vscodeThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
6
- /** The theme's whole stylesheet (`ThemeStyles.css`). */
7
- export declare const vscodeControlsCss: string;
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. Then the editors' face
209
- * (`vscodeEditorsCss`): JupyterLab's variables, CodeMirror, Excalidraw.
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
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
222
- export const vscodeThemeStyles = buildThemeStyles(vscodeLight, vscodeDark, {
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 ?? '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/primer-addons",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "license": "BSD-3-Clause",
5
5
  "scripts": {
6
6
  "build": "npm run build:lib",