@datalayer/core 0.0.17 → 0.0.18

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 (107) hide show
  1. package/README.md +9 -13
  2. package/lib/client/auth/AuthenticationManager.d.ts +95 -0
  3. package/lib/client/auth/AuthenticationManager.js +214 -0
  4. package/lib/client/auth/index.d.ts +8 -0
  5. package/lib/client/auth/index.js +17 -0
  6. package/lib/client/auth/storage.d.ts +154 -0
  7. package/lib/client/auth/storage.js +447 -0
  8. package/lib/client/auth/strategies.d.ts +54 -0
  9. package/lib/client/auth/strategies.js +238 -0
  10. package/lib/client/auth/types.d.ts +151 -0
  11. package/lib/{examples/index.js → client/auth/types.js} +4 -2
  12. package/lib/client/base.d.ts +3 -0
  13. package/lib/client/base.js +9 -0
  14. package/lib/client/index.d.ts +1 -0
  15. package/lib/client/index.js +2 -0
  16. package/lib/components/auth/Login.d.ts +40 -0
  17. package/lib/components/auth/Login.js +173 -0
  18. package/lib/components/auth/Login.stories.d.ts +54 -0
  19. package/lib/components/auth/Login.stories.js +104 -0
  20. package/lib/components/auth/LoginToken.d.ts +16 -0
  21. package/lib/components/auth/LoginToken.js +63 -0
  22. package/lib/components/auth/index.d.ts +5 -0
  23. package/lib/components/auth/index.js +16 -0
  24. package/lib/components/avatars/BoringAvatar.d.ts +6 -15
  25. package/lib/components/avatars/BoringAvatar.js +30 -34
  26. package/lib/components/avatars/BoringAvatar.stories.d.ts +7 -16
  27. package/lib/components/avatars/UserProfileAvatar.d.ts +1 -6
  28. package/lib/components/avatars/UserProfileAvatar.js +3 -8
  29. package/lib/components/buttons/DownloadCSVButton.d.ts +2 -7
  30. package/lib/components/buttons/DownloadCSVButton.js +1 -5
  31. package/lib/components/buttons/DownloadJsonButton.d.ts +3 -10
  32. package/lib/components/buttons/DownloadJsonButton.js +1 -7
  33. package/lib/components/buttons/UploadButton.d.ts +1 -4
  34. package/lib/components/buttons/UploadButton.js +3 -7
  35. package/lib/components/chat/ChatComponent.js +4 -0
  36. package/lib/components/chat/display/ReasoningPart.js +4 -0
  37. package/lib/components/chat/display/ToolPart.js +4 -0
  38. package/lib/components/chat/display/index.js +4 -0
  39. package/lib/components/chat/handler.js +4 -0
  40. package/lib/components/chat/index.js +4 -0
  41. package/lib/components/display/CenteredSpinner.d.ts +1 -4
  42. package/lib/components/display/CenteredSpinner.js +1 -5
  43. package/lib/components/display/HorizontalCenter.d.ts +1 -4
  44. package/lib/components/display/HorizontalCenter.js +1 -5
  45. package/lib/components/flashes/FlashClosable.d.ts +1 -4
  46. package/lib/components/flashes/FlashClosable.js +1 -5
  47. package/lib/components/flashes/FlashDisclaimer.js +1 -1
  48. package/lib/components/index.d.ts +1 -0
  49. package/lib/components/index.js +1 -0
  50. package/lib/components/notebooks/JupyterNotebook.d.ts +1 -6
  51. package/lib/components/notebooks/JupyterNotebook.js +1 -5
  52. package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -4
  53. package/lib/components/snapshots/RuntimeSnapshotMenu.js +1 -5
  54. package/lib/config/Configuration.js +1 -1
  55. package/lib/examples/CellExample.js +11 -47
  56. package/lib/examples/lexical-theme.css +436 -0
  57. package/lib/examples/notebooks/Matplotlib.ipynb.json +1 -1
  58. package/lib/examples/notebooks/NotebookExample1.ipynb.json +1 -1
  59. package/lib/hooks/useAIJupyterChat.js +4 -0
  60. package/lib/hooks/useBackdrop.d.ts +4 -4
  61. package/lib/hooks/useBackdrop.js +5 -9
  62. package/lib/hooks/useCache.d.ts +5 -1
  63. package/lib/hooks/useCache.js +27 -14
  64. package/lib/hooks/useMobile.js +4 -0
  65. package/lib/hooks/useScreenshot.d.ts +3 -5
  66. package/lib/hooks/useScreenshot.js +1 -8
  67. package/lib/models/Outbound.d.ts +2 -0
  68. package/lib/models/Outbound.js +3 -1
  69. package/lib/state/substates/CoreState.js +1 -1
  70. package/lib/state/substates/IAMState.js +15 -6
  71. package/lib/tools/adapters/agui/AgUIToolAdapter.d.ts +75 -0
  72. package/lib/tools/adapters/agui/AgUIToolAdapter.js +244 -0
  73. package/lib/tools/adapters/agui/index.d.ts +10 -0
  74. package/lib/tools/adapters/agui/index.js +19 -0
  75. package/lib/tools/adapters/agui/lexicalHooks.d.ts +27 -0
  76. package/lib/tools/adapters/agui/lexicalHooks.js +64 -0
  77. package/lib/tools/adapters/agui/notebookHooks.d.ts +27 -0
  78. package/lib/tools/adapters/agui/notebookHooks.js +61 -0
  79. package/lib/tools/index.d.ts +6 -0
  80. package/lib/tools/index.js +18 -0
  81. package/lib/types.js +2 -3
  82. package/lib/utils/cli/index.d.ts +4 -0
  83. package/lib/utils/cli/index.js +13 -0
  84. package/lib/utils/cli/query.d.ts +6 -0
  85. package/lib/utils/cli/query.js +26 -0
  86. package/lib/utils/index.d.ts +1 -0
  87. package/lib/utils/index.js +1 -0
  88. package/package.json +50 -7
  89. package/lib/examples/ChatExample.d.ts +0 -8
  90. package/lib/examples/ChatExample.js +0 -51
  91. package/lib/examples/DatalayerNotebookExample.d.ts +0 -16
  92. package/lib/examples/DatalayerNotebookExample.js +0 -75
  93. package/lib/examples/NativeNavigationExample.d.ts +0 -8
  94. package/lib/examples/NativeNavigationExample.js +0 -97
  95. package/lib/examples/NotebookMutationsKernel.d.ts +0 -2
  96. package/lib/examples/NotebookMutationsKernel.js +0 -115
  97. package/lib/examples/NotebookMutationsServiceManager.d.ts +0 -2
  98. package/lib/examples/NotebookMutationsServiceManager.js +0 -107
  99. package/lib/examples/ReactRouterExample.d.ts +0 -6
  100. package/lib/examples/ReactRouterExample.js +0 -175
  101. package/lib/examples/example-selector.d.ts +0 -22
  102. package/lib/examples/example-selector.js +0 -46
  103. package/lib/examples/index.d.ts +0 -2
  104. package/lib/examples/main.d.ts +0 -1
  105. package/lib/examples/main.js +0 -153
  106. package/lib/examples/notebooks/OutputIPyWidgetsExample.d.ts +0 -145
  107. package/lib/examples/notebooks/OutputIPyWidgetsExample.js +0 -153
@@ -10,8 +10,7 @@ import { useCallback, useState } from 'react';
10
10
  /**
11
11
  * Closable flash component with actions.
12
12
  */
13
- export const FlashClosable = (props) => {
14
- const { actions, children, closable, variant, sx, ...others } = props;
13
+ export const FlashClosable = ({ actions, children, closable = true, variant, sx, ...others }) => {
15
14
  const [open, setOpen] = useState(true);
16
15
  const visual = variant === 'warning' ? (_jsx(AlertIcon, {})) : variant === 'success' ? (_jsx(CheckIcon, {})) : variant === 'danger' ? (_jsx(StopIcon, {})) : (_jsx(InfoIcon, {}));
17
16
  const onClose = useCallback(() => {
@@ -58,7 +57,4 @@ export const FlashClosable = (props) => {
58
57
  '& > svg': { marginRight: 0, color: 'var(--fgColor-default)' },
59
58
  } }) }))] })) : (_jsx(_Fragment, {}));
60
59
  };
61
- FlashClosable.defaultProps = {
62
- closable: true,
63
- };
64
60
  export default FlashClosable;
@@ -12,6 +12,6 @@ export const FlashDisclaimer = () => {
12
12
  const { configuration } = useCoreStore();
13
13
  const { showDisclaimer, setShowDisclaimer } = useRuntimesStore();
14
14
  const navigate = useNavigate();
15
- return (_jsx(_Fragment, { children: configuration?.whiteLabel === false && showDisclaimer && (_jsx(Banner, { variant: "info", title: "AI Platform for Data Analysis", description: _jsxs(Box, { children: [_jsx(Label, { style: { marginRight: 10 }, children: "PRIVATE BETA" }), "Create Kernels and use them from your JupyterLab, VS Code or CLI. Read the", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate('/docs', e), children: "documentation" }), ' ', "for any question or", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate('/support/request', e), children: "contact us for support" }), "."] }), onDismiss: () => setShowDisclaimer(false) })) }));
15
+ return (_jsx(_Fragment, { children: configuration?.whiteLabel === false && showDisclaimer && (_jsx(Banner, { variant: "info", title: "AI Agents for Data Analysis", description: _jsxs(Box, { children: [_jsx(Label, { style: { marginRight: 10 }, children: "PRIVATE BETA" }), "Create Kernels and use them from your JupyterLab, VS Code or CLI. Read the", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate('/docs', e), children: "documentation" }), ' ', "for any question or", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate('/support/request', e), children: "contact us for support" }), "."] }), onDismiss: () => setShowDisclaimer(false) })) }));
16
16
  };
17
17
  export default FlashDisclaimer;
@@ -1 +1,2 @@
1
+ export * from './auth';
1
2
  export * from './chat';
@@ -2,4 +2,5 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
+ export * from './auth';
5
6
  export * from './chat';
@@ -3,10 +3,5 @@ type IJupyterNotebooProps = {
3
3
  boxPanel: BoxPanel;
4
4
  height?: string;
5
5
  };
6
- export declare const JupyterNotebook: {
7
- (props: IJupyterNotebooProps): import("react/jsx-runtime").JSX.Element;
8
- defaultProps: {
9
- height: string;
10
- };
11
- };
6
+ export declare const JupyterNotebook: ({ boxPanel, height, }: IJupyterNotebooProps) => import("react/jsx-runtime").JSX.Element;
12
7
  export default JupyterNotebook;
@@ -5,8 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  */
6
6
  import { Box } from '@datalayer/primer-addons';
7
7
  import { Lumino } from '@datalayer/jupyter-react';
8
- export const JupyterNotebook = (props) => {
9
- const { boxPanel, height } = props;
8
+ export const JupyterNotebook = ({ boxPanel, height = '100%', }) => {
10
9
  return (_jsx("div", { style: { position: 'relative' }, children: _jsx(Box, { className: "jp-LabShell", sx: {
11
10
  position: 'relative',
12
11
  '& .dla-Jupyter-Notebook': {
@@ -30,7 +29,4 @@ export const JupyterNotebook = (props) => {
30
29
  },
31
30
  }, children: _jsx(Lumino, { children: boxPanel }) }) }));
32
31
  };
33
- JupyterNotebook.defaultProps = {
34
- height: '100%',
35
- };
36
32
  export default JupyterNotebook;
@@ -29,8 +29,5 @@ type IRuntimeSnapshotMenu = {
29
29
  /**
30
30
  * Runtime Snapshot menu component.
31
31
  */
32
- export declare function RuntimeSnapshotMenu(props: PropsWithChildren<IRuntimeSnapshotMenu>): JSX.Element;
33
- export declare namespace RuntimeSnapshotMenu {
34
- var defaultProps: Partial<IRuntimeSnapshotMenu>;
35
- }
32
+ export declare function RuntimeSnapshotMenu({ children, connection, podName, multiServiceManager, disabled, }: PropsWithChildren<IRuntimeSnapshotMenu>): JSX.Element;
36
33
  export {};
@@ -15,8 +15,7 @@ import { createRuntimeSnapshotName } from '../../utils';
15
15
  /**
16
16
  * Runtime Snapshot menu component.
17
17
  */
18
- export function RuntimeSnapshotMenu(props) {
19
- const { children, connection, podName, multiServiceManager, disabled } = props;
18
+ export function RuntimeSnapshotMenu({ children, connection, podName, multiServiceManager, disabled = false, }) {
20
19
  const { addRuntimeSnapshot, runtimesRunUrl, runtimeSnapshots, setRuntimeSnapshots, } = useRuntimesStore();
21
20
  const { enqueueToast, trackAsyncTask } = useToast();
22
21
  const [openLoadDialog, setOpenLoadDialog] = useState(false);
@@ -168,6 +167,3 @@ export function RuntimeSnapshotMenu(props) {
168
167
  },
169
168
  ], children: _jsxs(Box, { as: "form", children: [_jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Snapshot" }), _jsx(Select, { name: "snapshot", value: selection, onChange: onRuntimeSnapshotChanged, block: true, children: runtimeSnapshots.map(s => (_jsx(Select.Option, { value: s.id, children: s.name ? `${s.name} (${s.id})` : s.id }, s.id))) })] }), error && _jsx(Flash, { variant: "danger", children: error })] }) }))] }));
170
169
  }
171
- RuntimeSnapshotMenu.defaultProps = {
172
- disabled: false,
173
- };
@@ -26,7 +26,7 @@ export class DatalayerConfiguration {
26
26
  * Default configuration values for Datalayer
27
27
  */
28
28
  export const DEFAULT_DATALAYER_CONFIG = {
29
- runUrl: 'https://prod1.datalayer.run',
29
+ runUrl: 'https://oss.datalayer.run',
30
30
  credits: 100,
31
31
  cpuEnvironment: 'python-cpu-env',
32
32
  gpuEnvironment: 'ai-env',
@@ -1,55 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- /*
3
- * Copyright (c) 2023-2025 Datalayer, Inc.
4
- * Distributed under the terms of the Modified BSD License.
5
- */
6
- /*
7
- * Copyright (c) 2021-2023 Datalayer, Inc.
8
- *
9
- * MIT License
10
- */
11
- import { useEffect, useState } from 'react';
12
- import { Box, Button, Label } from '@primer/react';
13
- import { ServiceManager } from '@jupyterlab/services';
14
- import { createServerSettings, getJupyterServerUrl, getJupyterServerToken, } from '@datalayer/jupyter-react';
15
- import { Cell, KernelIndicator, useKernelsStore, useCellsStore, Kernel, } from '@datalayer/jupyter-react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Jupyter, Cell, KernelIndicator, useJupyter, useKernelsStore, useCellsStore, } from '@datalayer/jupyter-react';
3
+ import { Button, Label } from '@primer/react';
4
+ import { Box } from '@datalayer/primer-addons';
16
5
  const CELL_ID = 'cell-example-1';
17
6
  const DEFAULT_SOURCE = `from IPython.display import display
18
7
 
19
8
  for i in range(10):
20
9
  display('I am a long string which is repeatedly added to the dom in separated divs: %d' % i)`;
21
- export const CellExample = (props) => {
22
- const [kernel, setKernel] = useState();
23
- const [serviceManager, setServiceManager] = useState(props.serviceManager);
24
- const kernelsStore = useKernelsStore();
25
- useEffect(() => {
26
- // Create service manager if not provided
27
- if (!props.serviceManager) {
28
- const serverSettings = createServerSettings(getJupyterServerUrl(), getJupyterServerToken());
29
- const manager = new ServiceManager({ serverSettings });
30
- setServiceManager(manager);
31
- }
32
- }, [props.serviceManager]);
33
- useEffect(() => {
34
- if (!kernel && serviceManager) {
35
- // Create a kernel using the service manager
36
- const createKernel = async () => {
37
- // Create a Kernel wrapper
38
- const k = new Kernel({
39
- kernelName: 'python3',
40
- });
41
- // @ts-expect-error - Set service manager after construction
42
- k._serviceManager = serviceManager;
43
- await k.ready;
44
- setKernel(k);
45
- };
46
- createKernel();
47
- }
48
- }, [serviceManager]);
10
+ const CellExampleContent = () => {
11
+ const { defaultKernel } = useJupyter({ startDefaultKernel: true });
49
12
  const cellsStore = useCellsStore();
50
- if (!kernel) {
51
- return (_jsxs(Box, { p: 4, children: [_jsx(Box, { as: "h1", children: "A Jupyter Cell" }), _jsx(Box, { children: "Loading kernel..." })] }));
52
- }
53
- return (_jsxs(_Fragment, { children: [_jsx(Box, { as: "h1", children: "A Jupyter Cell" }), _jsxs(Box, { children: ["Source: ", cellsStore.getSource(CELL_ID)] }), _jsxs(Box, { children: ["Outputs Count: ", cellsStore.getOutputsCount(CELL_ID)] }), _jsxs(Box, { children: ["Kernel State: ", _jsx(Label, { children: kernelsStore.getExecutionState(kernel.id) })] }), _jsxs(Box, { children: ["Kernel Phase: ", _jsx(Label, { children: kernelsStore.getExecutionPhase(kernel.id) })] }), _jsxs(Box, { display: "flex", children: [_jsx(Box, { children: "Kernel Indicator:" }), _jsx(Box, { ml: 3, children: _jsx(KernelIndicator, { kernel: kernel.connection }) })] }), _jsx(Box, { children: _jsx(Button, { onClick: () => cellsStore.execute(CELL_ID), children: "Run cell" }) }), _jsx(Cell, { source: DEFAULT_SOURCE, id: CELL_ID })] }));
13
+ const kernelsStore = useKernelsStore();
14
+ return (_jsxs(Box, { p: 4, children: [_jsx(Box, { as: "h1", children: "A Jupyter Cell" }), _jsxs(Box, { children: ["Source: ", cellsStore.getSource(CELL_ID)] }), _jsxs(Box, { children: ["Outputs Count: ", cellsStore.getOutputsCount(CELL_ID)] }), _jsxs(Box, { children: ["Kernel State:", ' ', _jsx(Label, { children: defaultKernel && kernelsStore.getExecutionState(defaultKernel.id) })] }), _jsxs(Box, { children: ["Kernel Phase:", ' ', _jsx(Label, { children: defaultKernel && kernelsStore.getExecutionPhase(defaultKernel.id) })] }), _jsxs(Box, { display: "flex", children: [_jsx(Box, { children: "Kernel Indicator:" }), _jsx(Box, { ml: 3, children: _jsx(KernelIndicator, { kernel: defaultKernel && defaultKernel.connection }) })] }), _jsx(Box, { children: _jsx(Button, { onClick: () => cellsStore.execute(CELL_ID), children: "Run cell" }) }), _jsx(Cell, { source: DEFAULT_SOURCE, id: CELL_ID, kernel: defaultKernel })] }));
15
+ };
16
+ export const CellExample = (props) => {
17
+ return (_jsx(Jupyter, { serviceManager: props.serviceManager, children: _jsx(CellExampleContent, {}) }));
54
18
  };
55
19
  export default CellExample;
@@ -0,0 +1,436 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+
6
+ /**
7
+ * Lexical Editor Theme - Integrated with JupyterReactTheme
8
+ *
9
+ * This theme uses CSS variables from:
10
+ * - JupyterLab theme (--jp-* variables)
11
+ * - Primer design system (--bgColor-*, --fgColor-*, --borderColor-*, etc.)
12
+ * - Automatically adapts to light/dark mode via JupyterReactTheme
13
+ *
14
+ * Based on Lexical's theming guide: https://lexical.dev/docs/getting-started/theming
15
+ */
16
+
17
+ /* ============================================
18
+ Text Formatting
19
+ ============================================ */
20
+
21
+ .lexical-theme-bold {
22
+ font-weight: bold;
23
+ }
24
+
25
+ .lexical-theme-italic {
26
+ font-style: italic;
27
+ }
28
+
29
+ .lexical-theme-underline {
30
+ text-decoration: underline;
31
+ }
32
+
33
+ .lexical-theme-strikethrough {
34
+ text-decoration: line-through;
35
+ }
36
+
37
+ .lexical-theme-code {
38
+ background-color: var(--jp-layout-color2, var(--bgColor-neutral-muted));
39
+ border-radius: 3px;
40
+ padding: 2px 4px;
41
+ font-family: var(
42
+ --jp-code-font-family,
43
+ 'Monaco',
44
+ 'Menlo',
45
+ 'Ubuntu Mono',
46
+ 'Consolas',
47
+ monospace
48
+ );
49
+ font-size: var(--jp-code-font-size, 0.9em);
50
+ color: var(--jp-mirror-editor-keyword-color, var(--fgColor-accent));
51
+ }
52
+
53
+ .lexical-theme-subscript {
54
+ font-size: 0.8em;
55
+ vertical-align: sub;
56
+ }
57
+
58
+ .lexical-theme-superscript {
59
+ font-size: 0.8em;
60
+ vertical-align: super;
61
+ }
62
+
63
+ /* ============================================
64
+ Block Elements
65
+ ============================================ */
66
+
67
+ .lexical-theme-paragraph {
68
+ margin: 0;
69
+ padding: 8px 0;
70
+ line-height: var(--jp-content-line-height, 1.6);
71
+ color: var(--jp-ui-font-color1, var(--fgColor-default));
72
+ }
73
+
74
+ .lexical-theme-heading-h1 {
75
+ font-size: var(--jp-content-heading-font-size1, 2em);
76
+ font-weight: 600;
77
+ margin: 0.67em 0;
78
+ line-height: var(--jp-content-heading-line-height, 1.3);
79
+ color: var(--jp-ui-font-color0, var(--fgColor-default));
80
+ }
81
+
82
+ .lexical-theme-heading-h2 {
83
+ font-size: var(--jp-content-heading-font-size2, 1.5em);
84
+ font-weight: 600;
85
+ margin: 0.75em 0;
86
+ line-height: var(--jp-content-heading-line-height, 1.3);
87
+ color: var(--jp-ui-font-color0, var(--fgColor-default));
88
+ }
89
+
90
+ .lexical-theme-heading-h3 {
91
+ font-size: var(--jp-content-heading-font-size3, 1.25em);
92
+ font-weight: 600;
93
+ margin: 0.83em 0;
94
+ line-height: var(--jp-content-heading-line-height, 1.3);
95
+ color: var(--jp-ui-font-color0, var(--fgColor-default));
96
+ }
97
+
98
+ .lexical-theme-heading-h4 {
99
+ font-size: var(--jp-content-heading-font-size4, 1.1em);
100
+ font-weight: 600;
101
+ margin: 1em 0;
102
+ line-height: var(--jp-content-heading-line-height, 1.3);
103
+ color: var(--jp-ui-font-color0, var(--fgColor-default));
104
+ }
105
+
106
+ .lexical-theme-heading-h5 {
107
+ font-size: var(--jp-content-heading-font-size5, 1em);
108
+ font-weight: 600;
109
+ margin: 1.33em 0;
110
+ line-height: var(--jp-content-heading-line-height, 1.3);
111
+ color: var(--jp-ui-font-color0, var(--fgColor-default));
112
+ }
113
+
114
+ .lexical-theme-heading-h6 {
115
+ font-size: 0.875em;
116
+ font-weight: 600;
117
+ margin: 1.67em 0;
118
+ line-height: var(--jp-content-heading-line-height, 1.3);
119
+ color: var(--jp-ui-font-color1, var(--fgColor-muted));
120
+ }
121
+
122
+ .lexical-theme-quote {
123
+ margin: 16px 0;
124
+ padding: 8px 16px;
125
+ border-left: 4px solid
126
+ var(--jp-border-color2, var(--borderColor-accent-emphasis));
127
+ background-color: var(--jp-layout-color2, var(--bgColor-neutral-muted));
128
+ font-style: italic;
129
+ color: var(--jp-ui-font-color2, var(--fgColor-muted));
130
+ }
131
+
132
+ /* ============================================
133
+ Lists
134
+ ============================================ */
135
+
136
+ .lexical-theme-list-ul {
137
+ margin: 8px 0;
138
+ padding-left: 24px;
139
+ list-style-type: disc;
140
+ color: var(--jp-ui-font-color1, var(--fgColor-default));
141
+ }
142
+
143
+ .lexical-theme-list-ol {
144
+ margin: 8px 0;
145
+ padding-left: 24px;
146
+ list-style-type: decimal;
147
+ color: var(--jp-ui-font-color1, var(--fgColor-default));
148
+ }
149
+
150
+ .lexical-theme-list-listitem {
151
+ margin: 4px 0;
152
+ line-height: var(--jp-content-line-height, 1.6);
153
+ }
154
+
155
+ .lexical-theme-list-nested-listitem {
156
+ list-style-type: none;
157
+ }
158
+
159
+ .lexical-theme-list-checklist {
160
+ padding-left: 4px;
161
+ list-style-type: none;
162
+ }
163
+
164
+ .lexical-theme-list-listitemChecked {
165
+ text-decoration: line-through;
166
+ opacity: 0.7;
167
+ }
168
+
169
+ .lexical-theme-list-listitemUnchecked {
170
+ text-decoration: none;
171
+ }
172
+
173
+ /* ============================================
174
+ Code Blocks
175
+ ============================================ */
176
+
177
+ /* Code blocks styled like Jupyter cells */
178
+ code.lexical-theme-code-block,
179
+ code.lexical-theme-code-block[spellcheck],
180
+ code.lexical-theme-code-block[data-highlight-language] {
181
+ background-color: #f7f7f7 !important;
182
+ background: #f7f7f7 !important;
183
+ border: 1px solid #d3d3d3 !important;
184
+ border-radius: 6px !important;
185
+ border-left: 3px solid #0366d6 !important;
186
+ padding: 8px 16px 8px 70px !important;
187
+ margin: 16px 0 0 0 !important;
188
+ overflow-x: auto !important;
189
+ font-family: var(
190
+ --jp-code-font-family,
191
+ 'Monaco',
192
+ 'Menlo',
193
+ 'Ubuntu Mono',
194
+ monospace
195
+ ) !important;
196
+ font-size: 13px !important;
197
+ line-height: 1.6 !important;
198
+ color: #24292e !important;
199
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
200
+ display: block !important;
201
+ min-height: 50px !important;
202
+ position: relative !important;
203
+ }
204
+
205
+ /* Display line numbers from data-gutter attribute */
206
+ code.lexical-theme-code-block::before {
207
+ content: attr(data-gutter);
208
+ position: absolute !important;
209
+ left: 0 !important;
210
+ top: 0 !important;
211
+ bottom: 0 !important;
212
+ width: 50px !important;
213
+ padding: 8px 8px 8px 0 !important;
214
+ color: #999 !important;
215
+ text-align: right !important;
216
+ white-space: pre !important;
217
+ font-family: monospace !important;
218
+ font-size: 13px !important;
219
+ line-height: 1.6 !important;
220
+ background-color: #f7f7f7 !important;
221
+ border-right: 1px solid #e1e4e8 !important;
222
+ }
223
+
224
+ /* Force transparent background on all child elements */
225
+ code.lexical-theme-code-block *,
226
+ code.lexical-theme-code-block span,
227
+ code.lexical-theme-code-block span[class*='lexical-theme-code-token'],
228
+ code.lexical-theme-code-block span[data-lexical-text],
229
+ code.lexical-theme-code-block br {
230
+ background-color: transparent !important;
231
+ background: transparent !important;
232
+ }
233
+
234
+ code.lexical-theme-code-block:hover {
235
+ border-color: #66afe9 !important;
236
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
237
+ }
238
+
239
+ /* Code syntax highlighting tokens using JupyterLab CodeMirror colors */
240
+ .lexical-theme-code-tokenComment {
241
+ color: var(--jp-mirror-editor-comment-color, var(--fgColor-muted));
242
+ }
243
+
244
+ .lexical-theme-code-tokenPunctuation {
245
+ color: var(--jp-content-font-color1, var(--fgColor-default));
246
+ }
247
+
248
+ .lexical-theme-code-tokenProperty {
249
+ color: var(--jp-mirror-editor-attribute-color, var(--fgColor-accent));
250
+ }
251
+
252
+ .lexical-theme-code-tokenSelector {
253
+ color: var(--jp-mirror-editor-builtin-color, var(--fgColor-done));
254
+ }
255
+
256
+ .lexical-theme-code-tokenOperator {
257
+ color: var(--jp-mirror-editor-operator-color, var(--fgColor-danger));
258
+ }
259
+
260
+ .lexical-theme-code-tokenAttr {
261
+ color: var(--jp-mirror-editor-attribute-color, var(--fgColor-accent));
262
+ }
263
+
264
+ .lexical-theme-code-tokenVariable {
265
+ color: var(--jp-mirror-editor-variable-color, var(--fgColor-attention));
266
+ }
267
+
268
+ .lexical-theme-code-tokenFunction {
269
+ color: var(--jp-mirror-editor-def-color, var(--fgColor-done));
270
+ }
271
+
272
+ .lexical-theme-code-tokenKeyword {
273
+ color: var(--jp-mirror-editor-keyword-color, var(--fgColor-danger));
274
+ }
275
+
276
+ .lexical-theme-code-tokenString {
277
+ color: var(--jp-mirror-editor-string-color, var(--fgColor-success));
278
+ }
279
+
280
+ .lexical-theme-code-tokenNumber {
281
+ color: var(--jp-mirror-editor-number-color, var(--fgColor-accent));
282
+ }
283
+
284
+ .lexical-theme-code-tokenBoolean {
285
+ color: var(--jp-mirror-editor-number-color, var(--fgColor-accent));
286
+ }
287
+
288
+ .lexical-theme-code-tokenRegex {
289
+ color: var(--jp-mirror-editor-string-color, var(--fgColor-success));
290
+ }
291
+
292
+ /* ============================================
293
+ Links
294
+ ============================================ */
295
+
296
+ .lexical-theme-link {
297
+ color: var(--jp-content-link-color, var(--fgColor-accent));
298
+ text-decoration: none;
299
+ cursor: pointer;
300
+ }
301
+
302
+ .lexical-theme-link:hover {
303
+ text-decoration: underline;
304
+ color: var(--jp-content-link-color, var(--fgColor-accent));
305
+ }
306
+
307
+ .lexical-theme-autolink {
308
+ color: var(--jp-content-link-color, var(--fgColor-accent));
309
+ text-decoration: none;
310
+ }
311
+
312
+ .lexical-theme-autolink:hover {
313
+ text-decoration: underline;
314
+ }
315
+
316
+ /* ============================================
317
+ Tables
318
+ ============================================ */
319
+
320
+ .lexical-theme-table {
321
+ border-collapse: collapse;
322
+ border: 1px solid var(--jp-border-color2, var(--borderColor-default));
323
+ margin: 16px 0;
324
+ width: 100%;
325
+ }
326
+
327
+ .lexical-theme-tableCell {
328
+ border: 1px solid var(--jp-border-color2, var(--borderColor-default));
329
+ padding: 8px 12px;
330
+ min-width: 75px;
331
+ vertical-align: top;
332
+ color: var(--jp-ui-font-color1, var(--fgColor-default));
333
+ }
334
+
335
+ .lexical-theme-tableCellHeader {
336
+ background-color: var(--jp-layout-color2, var(--bgColor-neutral-muted));
337
+ border: 1px solid var(--jp-border-color2, var(--borderColor-default));
338
+ padding: 8px 12px;
339
+ font-weight: 600;
340
+ text-align: left;
341
+ color: var(--jp-ui-font-color0, var(--fgColor-default));
342
+ }
343
+
344
+ /* ============================================
345
+ Special Nodes
346
+ ============================================ */
347
+
348
+ .lexical-theme-hashtag {
349
+ color: var(--jp-brand-color1, var(--fgColor-accent));
350
+ background-color: var(--jp-layout-color2, var(--bgColor-accent-muted));
351
+ border-radius: 3px;
352
+ padding: 2px 4px;
353
+ cursor: pointer;
354
+ }
355
+
356
+ .lexical-theme-image {
357
+ max-width: 100%;
358
+ height: auto;
359
+ margin: 16px 0;
360
+ border-radius: var(--jp-border-radius, 6px);
361
+ }
362
+
363
+ .lexical-theme-hr {
364
+ border: none;
365
+ border-top: 2px solid var(--jp-border-color2, var(--borderColor-default));
366
+ margin: 24px 0;
367
+ }
368
+
369
+ .lexical-theme-mark {
370
+ background-color: var(--jp-warn-color3, rgba(255, 212, 0, 0.4));
371
+ padding: 2px 0;
372
+ }
373
+
374
+ /* ============================================
375
+ Jupyter-specific Nodes
376
+ ============================================ */
377
+
378
+ /* Jupyter cells are styled by the jupyter-lexical components themselves.
379
+ Do not add theme CSS here as it conflicts with the component's internal styling.
380
+ The JupyterCellNode, JupyterInputNode, and JupyterOutputNode components
381
+ handle their own styling and theming. */
382
+
383
+ /* ============================================
384
+ Editor Container Styles
385
+ ============================================ */
386
+
387
+ .lexical-editor-content {
388
+ min-height: 450px;
389
+ outline: none;
390
+ padding: 16px;
391
+ font-family: var(
392
+ --jp-ui-font-family,
393
+ -apple-system,
394
+ BlinkMacSystemFont,
395
+ 'Segoe UI',
396
+ Helvetica,
397
+ Arial,
398
+ sans-serif
399
+ );
400
+ font-size: var(--jp-ui-font-size1, 16px);
401
+ line-height: var(--jp-content-line-height, 1.6);
402
+ color: var(--jp-ui-font-color1, var(--fgColor-default));
403
+ background-color: var(--jp-layout-color1, var(--bgColor-default));
404
+ }
405
+
406
+ .lexical-editor-content:focus {
407
+ outline: none;
408
+ }
409
+
410
+ .lexical-editor-inner {
411
+ position: relative;
412
+ background-color: var(--jp-layout-color1, var(--bgColor-default));
413
+ }
414
+
415
+ /* ============================================
416
+ Placeholder
417
+ ============================================ */
418
+
419
+ .lexical-theme-placeholder {
420
+ color: var(--jp-ui-font-color3, var(--fgColor-muted));
421
+ overflow: hidden;
422
+ position: absolute;
423
+ text-overflow: ellipsis;
424
+ top: 16px;
425
+ left: 16px;
426
+ font-size: var(--jp-ui-font-size1, 16px);
427
+ user-select: none;
428
+ pointer-events: none;
429
+ }
430
+
431
+ /* ============================================
432
+ Dark Mode Adjustments
433
+ ============================================ */
434
+
435
+ /* Dark mode is handled automatically via CSS variables from JupyterReactTheme */
436
+ /* The --jp-* and Primer variables change based on colormode */