@datalayer/jupyter-react 0.19.4 → 0.19.6
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/app/tabs/components/NotebookComponent.js +3 -2
- package/lib/app/tabs/components/NotebookComponent.js.map +1 -1
- package/lib/components/cell/CellCommands.d.ts +1 -1
- package/lib/components/cell/CellCommands.js +7 -7
- package/lib/components/cell/CellCommands.js.map +1 -1
- package/lib/components/console/Console.js +5 -5
- package/lib/components/console/Console.js.map +1 -1
- package/lib/components/notebook/BaseNotebook.d.ts +7 -7
- package/lib/components/notebook/BaseNotebook.js +95 -80
- package/lib/components/notebook/BaseNotebook.js.map +1 -1
- package/lib/components/notebook/Notebook.css +13 -0
- package/lib/components/notebook/Notebook.d.ts +0 -3
- package/lib/components/notebook/Notebook.js +11 -18
- package/lib/components/notebook/Notebook.js.map +1 -1
- package/lib/components/notebook/NotebookAdapter.d.ts +7 -9
- package/lib/components/notebook/NotebookAdapter.js +17 -21
- package/lib/components/notebook/NotebookAdapter.js.map +1 -1
- package/lib/components/notebook/NotebookCommands.d.ts +2 -2
- package/lib/components/notebook/NotebookCommands.js +62 -52
- package/lib/components/notebook/NotebookCommands.js.map +1 -1
- package/lib/components/notebook/SimpleNotebook.d.ts +9 -3
- package/lib/components/notebook/SimpleNotebook.js +2 -13
- package/lib/components/notebook/SimpleNotebook.js.map +1 -1
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.d.ts +14 -6
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.js +35 -37
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.js.map +1 -1
- package/lib/components/notebook/cell/metadata/NbGraderCells.d.ts +2 -2
- package/lib/components/notebook/cell/metadata/NbGraderCells.js +2 -2
- package/lib/components/notebook/cell/metadata/NbGraderCells.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebar.d.ts +28 -2
- package/lib/components/notebook/cell/sidebar/CellSidebar.js +64 -78
- package/lib/components/notebook/cell/sidebar/CellSidebar.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.d.ts +3 -2
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.js +57 -72
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarRun.d.ts +3 -2
- package/lib/components/notebook/cell/sidebar/CellSidebarRun.js +14 -29
- package/lib/components/notebook/cell/sidebar/CellSidebarRun.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/extension.d.ts +31 -0
- package/lib/components/notebook/cell/sidebar/extension.js +121 -0
- package/lib/components/notebook/cell/sidebar/extension.js.map +1 -0
- package/lib/components/notebook/cell/sidebar/index.d.ts +1 -1
- package/lib/components/notebook/cell/sidebar/index.js +1 -1
- package/lib/components/notebook/cell/sidebar/index.js.map +1 -1
- package/lib/components/notebook/content/JupyterReactContentFactory.d.ts +1 -12
- package/lib/components/notebook/content/JupyterReactContentFactory.js +2 -21
- package/lib/components/notebook/content/JupyterReactContentFactory.js.map +1 -1
- package/lib/components/output/Output.js +1 -1
- package/lib/components/output/Output.js.map +1 -1
- package/lib/components/output/OutputAdapter.js +2 -2
- package/lib/components/output/OutputAdapter.js.map +1 -1
- package/lib/examples/Bokeh.js +8 -4
- package/lib/examples/Bokeh.js.map +1 -1
- package/lib/examples/Bqplot.js +8 -4
- package/lib/examples/Bqplot.js.map +1 -1
- package/lib/examples/CellLite.js +2 -2
- package/lib/examples/CellLite.js.map +1 -1
- package/lib/examples/ConsoleLite.js +2 -2
- package/lib/examples/ConsoleLite.js.map +1 -1
- package/lib/examples/Dashboard.js +8 -9
- package/lib/examples/Dashboard.js.map +1 -1
- package/lib/examples/Deno.js +8 -4
- package/lib/examples/Deno.js.map +1 -1
- package/lib/examples/GeoJson.js +10 -5
- package/lib/examples/GeoJson.js.map +1 -1
- package/lib/examples/IPyLeaflet.js +8 -4
- package/lib/examples/IPyLeaflet.js.map +1 -1
- package/lib/examples/IPyReact.js +8 -4
- package/lib/examples/IPyReact.js.map +1 -1
- package/lib/examples/IPyWidgets.js +8 -9
- package/lib/examples/IPyWidgets.js.map +1 -1
- package/lib/examples/IPyWidgetsState.js +8 -9
- package/lib/examples/IPyWidgetsState.js.map +1 -1
- package/lib/examples/JupyterContext.js +20 -22
- package/lib/examples/JupyterContext.js.map +1 -1
- package/lib/examples/KernelExecute.js +1 -1
- package/lib/examples/KernelExecute.js.map +1 -1
- package/lib/examples/KernelExecutor.js +1 -1
- package/lib/examples/KernelExecutor.js.map +1 -1
- package/lib/examples/Kernels.js +1 -1
- package/lib/examples/Kernels.js.map +1 -1
- package/lib/examples/Matplotlib.js +8 -9
- package/lib/examples/Matplotlib.js.map +1 -1
- package/lib/examples/Notebook.js +4 -3
- package/lib/examples/Notebook.js.map +1 -1
- package/lib/examples/NotebookCellSidebar.js +5 -9
- package/lib/examples/NotebookCellSidebar.js.map +1 -1
- package/lib/examples/NotebookCellToolbar.js +11 -12
- package/lib/examples/NotebookCellToolbar.js.map +1 -1
- package/lib/examples/NotebookCollaborative.js +6 -3
- package/lib/examples/NotebookCollaborative.js.map +1 -1
- package/lib/examples/NotebookColormode.js +7 -11
- package/lib/examples/NotebookColormode.js.map +1 -1
- package/lib/examples/NotebookExtension.js +11 -12
- package/lib/examples/NotebookExtension.js.map +1 -1
- package/lib/examples/NotebookExternalContent.js +10 -12
- package/lib/examples/NotebookExternalContent.js.map +1 -1
- package/lib/examples/NotebookInit.js +5 -4
- package/lib/examples/NotebookInit.js.map +1 -1
- package/lib/examples/NotebookKernelChange.js +7 -6
- package/lib/examples/NotebookKernelChange.js.map +1 -1
- package/lib/examples/NotebookLess.js +8 -12
- package/lib/examples/NotebookLess.js.map +1 -1
- package/lib/examples/NotebookLite.js +6 -11
- package/lib/examples/NotebookLite.js.map +1 -1
- package/lib/examples/NotebookLiteContext.js +9 -10
- package/lib/examples/NotebookLiteContext.js.map +1 -1
- package/lib/examples/NotebookLocalServer.js +10 -7
- package/lib/examples/NotebookLocalServer.js.map +1 -1
- package/lib/examples/NotebookNbformat.js +8 -9
- package/lib/examples/NotebookNbformat.js.map +1 -1
- package/lib/examples/NotebookNbformatChange.js +9 -11
- package/lib/examples/NotebookNbformatChange.js.map +1 -1
- package/lib/examples/NotebookNoContext.js +4 -3
- package/lib/examples/NotebookNoContext.js.map +1 -1
- package/lib/examples/NotebookNoPrimer.js +5 -4
- package/lib/examples/NotebookNoPrimer.js.map +1 -1
- package/lib/examples/NotebookOnSessionConnection.js +7 -11
- package/lib/examples/NotebookOnSessionConnection.js.map +1 -1
- package/lib/examples/NotebookPath.js +4 -3
- package/lib/examples/NotebookPath.js.map +1 -1
- package/lib/examples/NotebookPathChange.js +9 -6
- package/lib/examples/NotebookPathChange.js.map +1 -1
- package/lib/examples/NotebookReadonly.js +6 -4
- package/lib/examples/NotebookReadonly.js.map +1 -1
- package/lib/examples/NotebookServiceManager.js +10 -14
- package/lib/examples/NotebookServiceManager.js.map +1 -1
- package/lib/examples/NotebookSkeleton.js +5 -4
- package/lib/examples/NotebookSkeleton.js.map +1 -1
- package/lib/examples/NotebookTheme.js +9 -14
- package/lib/examples/NotebookTheme.js.map +1 -1
- package/lib/examples/NotebookThemeColormode.js +10 -14
- package/lib/examples/NotebookThemeColormode.js.map +1 -1
- package/lib/examples/NotebookURL.js +4 -3
- package/lib/examples/NotebookURL.js.map +1 -1
- package/lib/examples/NotebookUnmount.js +7 -11
- package/lib/examples/NotebookUnmount.js.map +1 -1
- package/lib/examples/ObservableHQ.js +8 -4
- package/lib/examples/ObservableHQ.js.map +1 -1
- package/lib/examples/Output.js +3 -3
- package/lib/examples/Output.js.map +1 -1
- package/lib/examples/OutputWithMonitoring.js +1 -1
- package/lib/examples/OutputWithMonitoring.js.map +1 -1
- package/lib/examples/Outputs.js +3 -3
- package/lib/examples/Outputs.js.map +1 -1
- package/lib/examples/Panel.js +6 -3
- package/lib/examples/Panel.js.map +1 -1
- package/lib/examples/Plotly.js +8 -4
- package/lib/examples/Plotly.js.map +1 -1
- package/lib/examples/PyGWalker.js +8 -9
- package/lib/examples/PyGWalker.js.map +1 -1
- package/lib/examples/Theme.js +18 -0
- package/lib/examples/Theme.js.map +1 -0
- package/lib/examples/Vega.js +5 -4
- package/lib/examples/Vega.js.map +1 -1
- package/lib/examples/sidebars/CellSidebarSource.js +56 -73
- package/lib/examples/sidebars/CellSidebarSource.js.map +1 -1
- package/lib/jupyter/JupyterContext.d.ts +11 -0
- package/lib/jupyter/JupyterContext.js +2 -0
- package/lib/jupyter/JupyterContext.js.map +1 -1
- package/lib/theme/JupyterReactTheme.d.ts +2 -0
- package/lib/theme/JupyterReactTheme.js +4 -3
- package/lib/theme/JupyterReactTheme.js.map +1 -1
- package/lib/theme/index.d.ts +1 -1
- package/lib/theme/index.js +1 -1
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/{JupyterPrimerTheme.d.ts → themes/JupyterLabTheme.d.ts} +2 -2
- package/lib/theme/{JupyterPrimerTheme.js → themes/JupyterLabTheme.js} +10 -12
- package/lib/theme/themes/JupyterLabTheme.js.map +1 -0
- package/lib/theme/themes/index.d.ts +1 -0
- package/lib/theme/themes/index.js +7 -0
- package/lib/theme/themes/index.js.map +1 -0
- package/package.json +2 -17
- package/lib/components/notebook/cell/sidebar/CellSidebarWidget.d.ts +0 -16
- package/lib/components/notebook/cell/sidebar/CellSidebarWidget.js +0 -37
- package/lib/components/notebook/cell/sidebar/CellSidebarWidget.js.map +0 -1
- package/lib/examples/NotebookSimple.js +0 -36
- package/lib/examples/NotebookSimple.js.map +0 -1
- package/lib/examples/notebooks/Lite.ipynb.json +0 -146
- package/lib/theme/JupyterPrimerTheme.js.map +0 -1
- /package/lib/examples/{NotebookSimple.d.ts → Theme.d.ts} +0 -0
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
-
*
|
|
5
|
-
* MIT License
|
|
6
|
-
*/
|
|
7
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
-
import { createRoot } from 'react-dom/client';
|
|
9
2
|
import { Text, ToggleSwitch } from '@primer/react';
|
|
10
|
-
import {
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
5
|
+
import { CellSidebarExtension } from '../components';
|
|
11
6
|
import { Notebook } from '../components/notebook/Notebook';
|
|
7
|
+
import { Jupyter } from '../jupyter/Jupyter';
|
|
12
8
|
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
13
|
-
import { CellSidebar } from '../components/notebook/cell/sidebar/CellSidebar';
|
|
14
9
|
import nbformat from './notebooks/NotebookExample1.ipynb.json';
|
|
15
10
|
const NotebookColormode = () => {
|
|
16
11
|
const [colormode, setColormode] = useState('light');
|
|
17
12
|
const [isOn, setIsOn] = useState(false);
|
|
13
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
18
14
|
useEffect(() => {
|
|
19
15
|
if (isOn) {
|
|
20
16
|
setColormode('dark');
|
|
@@ -29,8 +25,8 @@ const NotebookColormode = () => {
|
|
|
29
25
|
const handleSwitchChange = useCallback((on) => {
|
|
30
26
|
setIsOn(on);
|
|
31
27
|
}, []);
|
|
32
|
-
return (_jsx(_Fragment, { children: _jsxs(Jupyter, {
|
|
33
|
-
,
|
|
28
|
+
return (_jsx(_Fragment, { children: _jsxs(Jupyter, { colormode: colormode, children: [_jsxs(Text, { fontSize: 2, fontWeight: "bold", id: "switch-label", display: "block", mb: 1, children: [colormode === 'light' ? 'Light' : 'Dark', " Mode"] }), _jsx(ToggleSwitch, { size: "small", onClick: onClick, onChange: handleSwitchChange, checked: isOn, statusLabelPosition: "end", "aria-labelledby": "switch-label" }), _jsx(Notebook, { nbformat: nbformat, id: "notebook-model-id", height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
29
|
+
, extensions: extensions, Toolbar: NotebookToolbar })] }) }));
|
|
34
30
|
};
|
|
35
31
|
const div = document.createElement('div');
|
|
36
32
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookColormode.js","sourceRoot":"","sources":["../../src/examples/NotebookColormode.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NotebookColormode.js","sourceRoot":"","sources":["../../src/examples/NotebookColormode.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAE/D,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC7B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAY,OAAO,CAAC,CAAC;IAC/D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACrE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,EAAE;YACR,YAAY,CAAC,MAAM,CAAC,CAAC;SACtB;aAAM;YACL,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;IACH,CAAC,E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1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
-
*
|
|
5
|
-
* MIT License
|
|
6
|
-
*/
|
|
7
|
-
import { useState } from 'react';
|
|
2
|
+
import { useMemo } from 'react';
|
|
8
3
|
import { createRoot } from 'react-dom/client';
|
|
9
|
-
import { JupyterReactTheme } from '../theme/JupyterReactTheme';
|
|
10
|
-
import { Notebook } from '../components/notebook/Notebook';
|
|
11
|
-
import { ExecTimeExtension } from './extensions';
|
|
12
4
|
import { CellSidebarButton } from '../components/notebook/cell/sidebar/CellSidebarButton';
|
|
5
|
+
import { Notebook } from '../components/notebook/Notebook';
|
|
6
|
+
import { JupyterReactTheme } from '../theme/JupyterReactTheme';
|
|
13
7
|
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
8
|
+
import { ExecTimeExtension } from './extensions';
|
|
9
|
+
import { CellSidebarExtension } from '../components';
|
|
14
10
|
import nbformat from './notebooks/NotebookExample1.ipynb.json';
|
|
15
11
|
const NotebookExtension = () => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const extensions = useMemo(() => [
|
|
13
|
+
new ExecTimeExtension(),
|
|
14
|
+
new CellSidebarExtension({ factory: CellSidebarButton }),
|
|
15
|
+
], []);
|
|
16
|
+
return (_jsx(JupyterReactTheme, { children: _jsx(Notebook, { nbformat: nbformat, extensions: extensions, id: "notebook-extension-id", height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
17
|
+
, Toolbar: NotebookToolbar }) }));
|
|
19
18
|
};
|
|
20
19
|
const div = document.createElement('div');
|
|
21
20
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookExtension.js","sourceRoot":"","sources":["../../src/examples/NotebookExtension.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NotebookExtension.js","sourceRoot":"","sources":["../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sx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
-
*
|
|
5
|
-
* MIT License
|
|
6
|
-
*/
|
|
7
|
-
import { useState, useEffect } from 'react';
|
|
8
|
-
import { createRoot } from 'react-dom/client';
|
|
9
|
-
import { Box, IconButton } from '@primer/react';
|
|
10
2
|
import { ZapIcon } from '@primer/octicons-react';
|
|
11
|
-
import {
|
|
3
|
+
import { Box, IconButton } from '@primer/react';
|
|
4
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
5
|
+
import { createRoot } from 'react-dom/client';
|
|
6
|
+
import { CellSidebarExtension } from '../components';
|
|
12
7
|
import { Notebook } from '../components/notebook/Notebook';
|
|
13
|
-
import { CellSidebar } from '../components/notebook/cell/sidebar/CellSidebar';
|
|
14
8
|
import { notebookStore } from '../components/notebook/NotebookState';
|
|
9
|
+
import { JupyterReactTheme } from '../theme/JupyterReactTheme';
|
|
15
10
|
import notebook from './notebooks/NotebookExample1.ipynb.json';
|
|
16
11
|
const NOTEBOOK_ID = 'notebook-model-id';
|
|
17
12
|
const NotebookExternalContent = () => {
|
|
18
13
|
const [nbformat, setNbformat] = useState();
|
|
19
14
|
const [updatedNbFormat, setUpdatedNbFormat] = useState();
|
|
20
|
-
const
|
|
15
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
16
|
+
const model = notebookStore
|
|
17
|
+
.getState()
|
|
18
|
+
.selectNotebookModel(NOTEBOOK_ID)?.model;
|
|
21
19
|
useEffect(() => {
|
|
22
20
|
// Set nbformat with any content.
|
|
23
21
|
// This may come from an external storage that you fetch in this react effect.
|
|
@@ -40,7 +38,7 @@ const NotebookExternalContent = () => {
|
|
|
40
38
|
e.preventDefault();
|
|
41
39
|
saveNotebook();
|
|
42
40
|
}, icon: ZapIcon }) }), _jsx(Notebook, { nbformat: nbformat, id: NOTEBOOK_ID, height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
43
|
-
,
|
|
41
|
+
, extensions: extensions })] })) : (_jsx(_Fragment, {}));
|
|
44
42
|
};
|
|
45
43
|
const div = document.createElement('div');
|
|
46
44
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookExternalContent.js","sourceRoot":"","sources":["../../src/examples/NotebookExternalContent.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NotebookExternalContent.js","sourceRoot":"","sources":["../../src/examples/NotebookExternalContent.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAE/D,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAExC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IACnC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAC7D,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAC3E,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,KAAK,GAAG,aAAa;SACxB,QAAQ,EAAE;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AAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAE7B,IAAI,CAAC,MAAM,CACT,KAAC,iBAAiB,cAChB,KAAC,uBAAuB,KAAG,GACT,CACrB,CAAC"}
|
|
@@ -4,11 +4,11 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
6
6
|
*/
|
|
7
|
-
import { useEffect, useState } from 'react';
|
|
7
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
8
8
|
import { createRoot } from 'react-dom/client';
|
|
9
|
-
import { useJupyter, CellSidebar, Jupyter, Kernel, Notebook, } from '../index';
|
|
10
|
-
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
11
9
|
import useNotebookStore from '../components/notebook/NotebookState';
|
|
10
|
+
import { CellSidebarExtension, Jupyter, Kernel, Notebook, useJupyter, } from '../index';
|
|
11
|
+
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
12
12
|
const NOTEBOOK_ID = 'notebook';
|
|
13
13
|
const NOTEBOOK_WIDTH = '100%';
|
|
14
14
|
const NOTEBOOK_HEIGHT = 500;
|
|
@@ -47,6 +47,7 @@ const NotebookInit = () => {
|
|
|
47
47
|
const kernel = useKernel();
|
|
48
48
|
const notebookStore = useNotebookStore();
|
|
49
49
|
const notebook = notebookStore.selectNotebook(NOTEBOOK_ID);
|
|
50
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
50
51
|
useEffect(() => {
|
|
51
52
|
if (notebook && !IS_INITIALIZED) {
|
|
52
53
|
notebook.adapter?.notebookPanel?.model?.contentChanged.connect(_ => {
|
|
@@ -63,7 +64,7 @@ const NotebookInit = () => {
|
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
}, [kernel, notebook]);
|
|
66
|
-
return kernel ? (_jsx(Notebook, { path: "ipywidgets.ipynb", id: NOTEBOOK_ID, kernel: kernel, height: `calc(${NOTEBOOK_HEIGHT}px - 2.6rem)`,
|
|
67
|
+
return kernel ? (_jsx(Notebook, { path: "ipywidgets.ipynb", id: NOTEBOOK_ID, kernel: kernel, height: `calc(${NOTEBOOK_HEIGHT}px - 2.6rem)`, extensions: extensions, Toolbar: NotebookToolbar })) : (_jsx(_Fragment, {}));
|
|
67
68
|
};
|
|
68
69
|
const div = document.createElement('div');
|
|
69
70
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookInit.js","sourceRoot":"","sources":["../../src/examples/NotebookInit.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NotebookInit.js","sourceRoot":"","sources":["../../src/examples/NotebookInit.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EACL,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,GACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAEnF,MAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAErC,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE,CAAC;I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
|
-
import { createRoot } from 'react-dom/client';
|
|
9
7
|
import { Box, Button, Flash } from '@primer/react';
|
|
8
|
+
import { useMemo, useState } from 'react';
|
|
9
|
+
import { createRoot } from 'react-dom/client';
|
|
10
|
+
import { CellSidebarExtension } from '../components';
|
|
11
|
+
import { Notebook } from '../components/notebook/Notebook';
|
|
12
|
+
import useNotebookStore from '../components/notebook/NotebookState';
|
|
10
13
|
import { Jupyter } from '../jupyter/Jupyter';
|
|
11
14
|
import { useJupyter } from '../jupyter/JupyterContext';
|
|
12
15
|
import { Kernel } from '../jupyter/kernel/Kernel';
|
|
13
|
-
import { Notebook } from '../components/notebook/Notebook';
|
|
14
|
-
import { CellSidebar } from '../components/notebook/cell/sidebar/CellSidebar';
|
|
15
|
-
import useNotebookStore from '../components/notebook/NotebookState';
|
|
16
16
|
const NOTEBOOK_ID = 'notebook-kernel-change-id';
|
|
17
17
|
const PYTHON_KERNEL_NAME = 'python';
|
|
18
18
|
const DENO_KERNEL_NAME = 'deno';
|
|
@@ -21,6 +21,7 @@ const NotebookKernelChange = () => {
|
|
|
21
21
|
const [message, setMessage] = useState("");
|
|
22
22
|
const notebookStore = useNotebookStore();
|
|
23
23
|
const notebook = notebookStore.selectNotebook(NOTEBOOK_ID);
|
|
24
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
24
25
|
const changeKernel = () => {
|
|
25
26
|
if (kernelManager && serviceManager) {
|
|
26
27
|
const newKernel = new Kernel({
|
|
@@ -37,7 +38,7 @@ const NotebookKernelChange = () => {
|
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
40
|
return (_jsxs(Jupyter, { defaultKernelName: PYTHON_KERNEL_NAME, children: [_jsxs(Box, { display: "flex", children: [_jsx(Box, { children: _jsx(Button, { variant: "default", size: "small", onClick: changeKernel, children: "Assign another Kernel" }) }), _jsxs(Box, { ml: 3, children: ["Kernel ID: ", kernel?.id] }), _jsxs(Box, { ml: 3, children: ["Kernel Client ID: ", notebook?.adapter?.kernel?.clientId] }), _jsxs(Box, { ml: 3, children: ["Kernel Session ID: ", notebook?.adapter?.kernel?.session.id] }), _jsxs(Box, { ml: 3, children: ["Kernel Info: ", notebook?.adapter?.kernel?.info?.language_info.name] })] }), message &&
|
|
40
|
-
_jsx(Box, { children: _jsx(Flash, { children: message }) }), _jsx(Notebook, { id: NOTEBOOK_ID, path: "test.ipynb", height: "500px",
|
|
41
|
+
_jsx(Box, { children: _jsx(Flash, { children: message }) }), _jsx(Notebook, { id: NOTEBOOK_ID, path: "test.ipynb", height: "500px", extensions: extensions })] }));
|
|
41
42
|
};
|
|
42
43
|
const div = document.createElement('div');
|
|
43
44
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookKernelChange.js","sourceRoot":"","sources":["../../src/examples/NotebookKernelChange.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"NotebookKernelChange.js","sourceRoot":"","sources":["../../src/examples/NotebookKernelChange.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEhD,MAAM,kBAAkB,GAAG,QAAQ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AEnD,GACL,EACN,MAAC,GAAG,IAAC,EAAE,EAAE,CAAC,4BACI,MAAM,EAAE,EAAE,IAClB,EACN,MAAC,GAAG,IAAC,EAAE,EAAE,CAAC,mCACW,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,IAClD,EACN,MAAC,GAAG,IAAC,EAAE,EAAE,CAAC,oCACY,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IACrD,EACN,MAAC,GAAG,IAAC,EAAE,EAAE,CAAC,8BACM,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,IAC7D,IACF,EACL,OAAO;gBACN,KAAC,GAAG,cACF,KAAC,KAAK,cAAE,OAAO,GAAS,GACpB,EAER,KAAC,QAAQ,IACP,EAAE,EAAE,WAAW,EACf,IAAI,EAAC,YAAY,EACjB,MAAM,EAAC,OAAO,EACd,UAAU,EAAE,UAAU,GACtB,IACM,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAE7B,IAAI,CAAC,MAAM,CACP,KAAC,oBAAoB,KAAG,CAC3B,CAAC"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
-
*
|
|
5
|
-
* MIT License
|
|
6
|
-
*/
|
|
7
|
-
import { useState } from 'react';
|
|
8
|
-
import { createRoot } from 'react-dom/client';
|
|
9
2
|
import { Box } from '@primer/react';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
12
5
|
import { Notebook } from '../components/notebook/Notebook';
|
|
6
|
+
import { ServiceManagerLess } from '../jupyter';
|
|
7
|
+
import { JupyterReactTheme } from '../theme';
|
|
13
8
|
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
14
|
-
import {
|
|
9
|
+
import { CellSidebarExtension } from '../components';
|
|
15
10
|
import nbformat from './notebooks/NotebookExample1.ipynb.json';
|
|
16
11
|
const NotebookLess = () => {
|
|
17
|
-
const
|
|
12
|
+
const serviceManager = useMemo(() => new ServiceManagerLess(), []);
|
|
13
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
18
14
|
return (_jsxs(JupyterReactTheme, { children: [_jsx(Box, { as: "h1", children: "A Jupyter Notebook with a Less Service Manager" }), _jsx(Notebook, { serverless: true, nbformat: nbformat, id: "notebook-less-id", height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
19
|
-
,
|
|
15
|
+
, readonly: true, serviceManager: serviceManager, extensions: extensions, Toolbar: NotebookToolbar })] }));
|
|
20
16
|
};
|
|
21
17
|
const div = document.createElement('div');
|
|
22
18
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookLess.js","sourceRoot":"","sources":["../../src/examples/NotebookLess.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NotebookLess.js","sourceRoot":"","sources":["../../src/examples/NotebookLess.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAA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
-
import { useState } from 'react';
|
|
9
2
|
import { Box, Text } from '@primer/react';
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
5
|
+
import { CellSidebarExtension, KernelIndicator, Notebook } from '../components';
|
|
10
6
|
import { JupyterReactTheme } from '../theme';
|
|
11
|
-
import { Notebook, KernelIndicator } from '../components';
|
|
12
7
|
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
13
|
-
import
|
|
14
|
-
import nbformat from './notebooks/Lite.ipynb.json';
|
|
8
|
+
import nbformat from './notebooks/NotebookExample1.ipynb.json';
|
|
15
9
|
const NotebookLite = () => {
|
|
16
10
|
const [session, setSession] = useState();
|
|
11
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
17
12
|
const onSessionConnection = (session) => {
|
|
18
13
|
console.log('Received a Kernel Session.', session?.id, session?.kernel?.clientId);
|
|
19
14
|
setSession(session);
|
|
20
15
|
};
|
|
21
16
|
return (_jsxs(JupyterReactTheme, { children: [_jsx(Box, { as: "h1", children: "A Jupyter Notebook with a Lite Kernel" }), _jsxs(Box, { display: "flex", children: [_jsx(Box, { children: _jsx(Text, { children: "Kernel Indicator" }) }), _jsx(Box, { ml: 3, children: _jsx(KernelIndicator, { kernel: session?.kernel }) })] }), _jsx(Notebook, { startDefaultKernel: true, lite: true, nbformat: nbformat, id: "notebook-lite-id", height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
22
|
-
, onSessionConnection: onSessionConnection,
|
|
17
|
+
, onSessionConnection: onSessionConnection, extensions: extensions, Toolbar: NotebookToolbar })] }));
|
|
23
18
|
};
|
|
24
19
|
const div = document.createElement('div');
|
|
25
20
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookLite.js","sourceRoot":"","sources":["../../src/examples/NotebookLite.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NotebookLite.js","sourceRoot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QAAQ,EAAE,QAA4B,EACtC,EAAE,EAAC,kBAAkB,EACrB,MAAM,EAAC,sBAAsB,CAAC,6BAA6B;kBAC3D,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,eAAe,GACxB,IACgB,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAE7B,IAAI,CAAC,MAAM,CAAC,KAAC,YAAY,KAAG,CAAC,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
-
*
|
|
5
|
-
* MIT License
|
|
6
|
-
*/
|
|
7
|
-
import { createRoot } from 'react-dom/client';
|
|
8
2
|
import { Box } from '@primer/react';
|
|
9
|
-
import {
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
5
|
+
import { CellSidebarExtension } from '../components';
|
|
10
6
|
import { Notebook } from '../components/notebook/Notebook';
|
|
7
|
+
import { Jupyter } from '../jupyter/Jupyter';
|
|
11
8
|
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
12
|
-
import { CellSidebar } from '../components/notebook/cell/sidebar/CellSidebar';
|
|
13
9
|
import nbformat from './notebooks/NotebookExample1.ipynb.json';
|
|
14
|
-
const NotebookLite = () =>
|
|
15
|
-
|
|
10
|
+
const NotebookLite = () => {
|
|
11
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
12
|
+
return (_jsxs(Jupyter, { lite: true, children: [_jsx(Box, { as: "h1", children: "A Jupyter Notebook with a Lite Kernel (with a Jupyter Context)" }), _jsx(Notebook, { nbformat: nbformat, id: "notebook-lite-context-id", height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
13
|
+
, extensions: extensions, Toolbar: NotebookToolbar })] }));
|
|
14
|
+
};
|
|
16
15
|
const div = document.createElement('div');
|
|
17
16
|
document.body.appendChild(div);
|
|
18
17
|
const root = createRoot(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookLiteContext.js","sourceRoot":"","sources":["../../src/examples/NotebookLiteContext.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NotebookLiteContext.js","sourceRoot":"","sources":["../../src/examples/NotebookLiteContext.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAE/D,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACnE,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,mBACX,KAAC,GAAG,IAAC,EAAE,EAAC,IAAI,+EAEN,EACN,KAAC,QAAQ,IACP,QAAQ,EAAE,QAA4B,EACtC,EAAE,EAAC,0BAA0B,EAC7B,MAAM,EAAC,sBAAsB,CAAC,6BAA6B;kBAC3D,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,eAAe,GACxB,IACM,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAE7B,IAAI,CAAC,MAAM,CAAC,KAAC,YAAY,KAAG,CAAC,CAAC"}
|
|
@@ -4,22 +4,25 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
6
6
|
*/
|
|
7
|
-
import { createRoot } from 'react-dom/client';
|
|
8
7
|
import { Text } from '@primer/react';
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
|
+
import { createRoot } from 'react-dom/client';
|
|
10
|
+
import { CellSidebarExtension } from '../components';
|
|
11
|
+
import { CellSidebarButton } from '../components/notebook/cell/sidebar/CellSidebarButton';
|
|
12
|
+
import { Notebook } from '../components/notebook/Notebook';
|
|
9
13
|
import { Jupyter, useJupyter } from '../jupyter';
|
|
10
14
|
import { JupyterReactTheme } from '../theme';
|
|
11
|
-
import { Notebook } from '../components/notebook/Notebook';
|
|
12
15
|
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
13
|
-
import { CellSidebarButton } from '../components/notebook/cell/sidebar/CellSidebarButton';
|
|
14
16
|
const NotebookJupyter = () => (_jsx(Jupyter, { jupyterServerUrl: "http://localhost:8686/api/jupyter-server", jupyterServerToken: "60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6", startDefaultKernel: true, children: _jsx(Notebook, { path: "ipywidgets.ipynb", id: "notebook-jupyter-id", height: "calc(100vh - 250px)" // (Height - Toolbar Height).
|
|
15
|
-
,
|
|
17
|
+
, extensions: [new CellSidebarExtension({ factory: CellSidebarButton })], Toolbar: NotebookToolbar }) }));
|
|
16
18
|
const NotebookJupyterReactTheme = () => {
|
|
17
19
|
useJupyter({
|
|
18
|
-
jupyterServerUrl:
|
|
19
|
-
jupyterServerToken:
|
|
20
|
+
jupyterServerUrl: 'http://localhost:8686/api/jupyter-server',
|
|
21
|
+
jupyterServerToken: '60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6',
|
|
20
22
|
});
|
|
23
|
+
const extensions = useMemo(() => [new CellSidebarExtension({ factory: CellSidebarButton })], []);
|
|
21
24
|
return (_jsx(JupyterReactTheme, { children: _jsx(Notebook, { startDefaultKernel: true, path: "ipywidgets.ipynb", id: "notebook-jupyter-react-themeid", height: "calc(100vh - 250px)" // (Height - Toolbar Height).
|
|
22
|
-
,
|
|
25
|
+
, extensions: extensions, Toolbar: NotebookToolbar }) }));
|
|
23
26
|
};
|
|
24
27
|
const div = document.createElement('div');
|
|
25
28
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookLocalServer.js","sourceRoot":"","sources":["../../src/examples/NotebookLocalServer.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"NotebookLocalServer.js","sourceRoot":"","sources":["../../src/examples/NotebookLocalServer.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM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,8DAAqD,EAClE,KAAC,eAAe,KAAG,EACnB,KAAC,IAAI,IAAC,EAAE,EAAC,IAAI,kEAAyD,EACtE,KAAC,yBAAyB,KAAG,IAC5B,CACJ,CAAC"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
-
*
|
|
5
|
-
* MIT License
|
|
6
|
-
*/
|
|
7
2
|
import { createRoot } from 'react-dom/client';
|
|
8
|
-
import { JupyterReactTheme } from '../theme/JupyterReactTheme';
|
|
9
3
|
import { Notebook } from '../components/notebook/Notebook';
|
|
4
|
+
import { JupyterReactTheme } from '../theme/JupyterReactTheme';
|
|
10
5
|
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
11
|
-
import {
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { CellSidebarExtension } from '../components';
|
|
12
8
|
import nbformat from './notebooks/NotebookExample1.ipynb.json';
|
|
13
|
-
const NotebookNbformat = () =>
|
|
14
|
-
|
|
9
|
+
const NotebookNbformat = () => {
|
|
10
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
11
|
+
return (_jsx(JupyterReactTheme, { children: _jsx(Notebook, { nbformat: nbformat, id: "notebook-nbformat-id", startDefaultKernel: true, height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
12
|
+
, extensions: extensions, Toolbar: NotebookToolbar }) }));
|
|
13
|
+
};
|
|
15
14
|
const div = document.createElement('div');
|
|
16
15
|
document.body.appendChild(div);
|
|
17
16
|
const root = createRoot(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookNbformat.js","sourceRoot":"","sources":["../../src/examples/NotebookNbformat.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NotebookNbformat.js","sourceRoot":"","sources":["../../src/examples/NotebookNbformat.tsx"],"names":[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
-
import { useState } from 'react';
|
|
8
|
-
import { createRoot } from 'react-dom/client';
|
|
9
2
|
import { Box, Button, ButtonGroup } from '@primer/react';
|
|
10
|
-
import {
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
5
|
+
import { CellSidebarExtension } from '../components';
|
|
11
6
|
import { Notebook } from '../components/notebook/Notebook';
|
|
12
|
-
import { CellSidebar } from '../components/notebook/cell/sidebar/CellSidebar';
|
|
13
7
|
import useNotebookStore from '../components/notebook/NotebookState';
|
|
8
|
+
import { JupyterReactTheme } from '../theme/JupyterReactTheme';
|
|
14
9
|
import nbformat1 from './notebooks/NotebookExample1.ipynb.json';
|
|
15
10
|
import nbformat2 from './notebooks/NotebookExample2.ipynb.json';
|
|
16
11
|
const NOTEBOOK_ID = 'notebook-model-change-id';
|
|
17
12
|
const NotebookNbformatChange = () => {
|
|
18
13
|
const notebookStore = useNotebookStore();
|
|
19
14
|
const [nbformat, setNbformat] = useState(nbformat1);
|
|
15
|
+
const extensions = useMemo(() => [new CellSidebarExtension()], []);
|
|
20
16
|
const changeNbformat = () => {
|
|
21
|
-
console.log('Notebook Nbformat from store', notebookStore.notebooks
|
|
17
|
+
console.log('Notebook Nbformat from store', notebookStore.notebooks
|
|
18
|
+
.get(NOTEBOOK_ID)
|
|
19
|
+
?.model?.toJSON());
|
|
22
20
|
nbformat === nbformat1 ? setNbformat(nbformat2) : setNbformat(nbformat1);
|
|
23
21
|
};
|
|
24
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, { display: "flex", children: _jsx(ButtonGroup, { children: _jsx(Button, { variant: "default", size: "small", onClick: changeNbformat, children: "Change Nbformat" }) }) }), _jsx(Notebook, { id: NOTEBOOK_ID, nbformat: nbformat, height: "700px",
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { display: "flex", children: _jsx(ButtonGroup, { children: _jsx(Button, { variant: "default", size: "small", onClick: changeNbformat, children: "Change Nbformat" }) }) }), _jsx(Notebook, { id: NOTEBOOK_ID, nbformat: nbformat, height: "700px", extensions: extensions })] }));
|
|
25
23
|
};
|
|
26
24
|
const div = document.createElement('div');
|
|
27
25
|
document.body.appendChild(div);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookNbformatChange.js","sourceRoot":"","sources":["../../src/examples/NotebookNbformatChange.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NotebookNbformatChange.js","sourceRoot":"","sources":["../../src/examples/NotebookNbformatChange.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,SAAS,MAAM,yCAAyC,CAAC;AAChE,OAAO,SAAS,MAAM,yCAAyC,CAAC;AAEhE,MAAM,WAAW,GAAG,0BAA0B,CAAC;AAE/C,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,OAAO,CAAC,GAAG,CACT,8BAA8B,EAC9B,aAAa,CAAC,SAAS;aACpB,GAAG,CAAC,WAAW,CAAC;YACjB,EAAE,KAAK,EAAE,MAAM,EAAsB,CACxC,CAAC;QACF,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC3E,CAAC,CAAC;IACF,OAAO,CACL,8BACE,KAAC,GAAG,IAAC,OAAO,EAAC,MAAM,YACjB,KAAC,WAAW,cACV,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,cAAc,gCAErD,GACG,GACV,EACN,KAAC,QAAQ,IACP,EAAE,EAAE,WAAW,EACf,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAC,OAAO,EACd,UAAU,EAAE,UAAU,GACtB,IACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAE7B,IAAI,CAAC,MAAM,CACT,KAAC,iBAAiB,cAChB,KAAC,sBAAsB,KAAG,GACR,CACrB,CAAC"}
|
|
@@ -5,15 +5,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
* MIT License
|
|
6
6
|
*/
|
|
7
7
|
import { createRoot } from 'react-dom/client';
|
|
8
|
-
import {
|
|
8
|
+
import { CellSidebarButton } from '../components/notebook/cell/sidebar/CellSidebarButton';
|
|
9
9
|
import { Notebook } from '../components/notebook/Notebook';
|
|
10
|
+
import { JupyterReactTheme } from '../theme/JupyterReactTheme';
|
|
10
11
|
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
11
|
-
import {
|
|
12
|
+
import { CellSidebarExtension } from '../components';
|
|
12
13
|
const NOTEBOOK_ID = 'notebook-id';
|
|
13
14
|
const div = document.createElement('div');
|
|
14
15
|
document.body.appendChild(div);
|
|
15
16
|
const root = createRoot(div);
|
|
16
17
|
const colormode = 'light';
|
|
17
18
|
root.render(_jsx(JupyterReactTheme, { colormode: colormode, children: _jsx(Notebook, { path: "ipywidgets.ipynb", id: NOTEBOOK_ID, height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
18
|
-
,
|
|
19
|
+
, extensions: [new CellSidebarExtension({ factory: CellSidebarButton })], Toolbar: NotebookToolbar }) }));
|
|
19
20
|
//# sourceMappingURL=NotebookNoContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookNoContext.js","sourceRoot":"","sources":["../../src/examples/NotebookNoContext.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"NotebookNoContext.js","sourceRoot":"","sources":["../../src/examples/NotebookNoContext.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAE7B,MAAM,SAAS,GAAG,OAAO,CAAC;AAE1B,IAAI,CAAC,MAAM,CACT,KAAC,iBAAiB,IAAC,SAAS,EAAE,SAAS,YACrC,KAAC,QAAQ,IACP,IAAI,EAAC,kBAAkB,EACvB,EAAE,EAAE,WAAW,EACf,MAAM,EAAC,sBAAsB,CAAC,6BAA6B;UAC3D,UAAU,EAAE,CAAC,IAAI,oBAAoB,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC,EACtE,OAAO,EAAE,eAAe,GACxB,GACgB,CACrB,CAAC"}
|
|
@@ -5,14 +5,15 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
5
5
|
* MIT License
|
|
6
6
|
*/
|
|
7
7
|
import { createRoot } from 'react-dom/client';
|
|
8
|
-
import {
|
|
9
|
-
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
8
|
+
import { CellSidebarExtension } from '../components';
|
|
10
9
|
import { CellSidebarButton } from '../components/notebook/cell/sidebar/CellSidebarButton';
|
|
10
|
+
import { Notebook } from '../components/notebook/Notebook';
|
|
11
11
|
import { JupyterLabCss } from '../theme';
|
|
12
|
+
import { NotebookToolbar } from './../components/notebook/toolbar/NotebookToolbar';
|
|
12
13
|
const NOTEBOOK_ID = 'notebook-id';
|
|
13
14
|
const div = document.createElement('div');
|
|
14
15
|
document.body.appendChild(div);
|
|
15
16
|
const root = createRoot(div);
|
|
16
|
-
root.render(_jsxs(_Fragment, { children: [_jsx(JupyterLabCss, { colormode:
|
|
17
|
-
,
|
|
17
|
+
root.render(_jsxs(_Fragment, { children: [_jsx(JupyterLabCss, { colormode: "dark" }), _jsx(Notebook, { path: "ipywidgets.ipynb", id: NOTEBOOK_ID, height: "calc(100vh - 2.6rem)" // (Height - Toolbar Height).
|
|
18
|
+
, extensions: [new CellSidebarExtension({ factory: CellSidebarButton })], Toolbar: NotebookToolbar })] }));
|
|
18
19
|
//# sourceMappingURL=NotebookNoPrimer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotebookNoPrimer.js","sourceRoot":"","sources":["../../src/examples/NotebookNoPrimer.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"NotebookNoPrimer.js","sourceRoot":"","sources":["../../src/examples/NotebookNoPrimer.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAEnF,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAE7B,IAAI,CAAC,MAAM,CACT,8BACE,KAAC,aAAa,IAAC,SAAS,EAAC,MAAM,GAAG,EAClC,KAAC,QAAQ,IACP,IAAI,EAAC,kBAAkB,EACvB,EAAE,EAAE,WAAW,EACf,MAAM,EAAC,sBAAsB,CAAC,6BAA6B;cAC3D,UAAU,EAAE,CAAC,IAAI,oBAAoB,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC,EACtE,OAAO,EAAE,eAAe,GACxB,IACD,CACJ,CAAC"}
|