@datalayer/jupyter-react 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -5
- package/lib/app/App.js +1 -1
- package/lib/app/JupyterReact.js +4 -4
- package/lib/app/index.js +1 -1
- package/lib/app/tabs/ComponentsTab.js +5 -5
- package/lib/app/tabs/components/CellComponent.js +2 -2
- package/lib/app/tabs/components/FileBrowserComponent.js +2 -2
- package/lib/app/tabs/components/IPyWidgetsComponent.js +2 -2
- package/lib/app/tabs/components/NotebookComponent.js +4 -4
- package/lib/app/tabs/components/ViewerComponent.js +1 -1
- package/lib/cell.d.ts +7 -0
- package/lib/cell.js +13 -0
- package/lib/cell.js.map +1 -0
- package/lib/components/button/index.js +1 -1
- package/lib/components/cell/Cell.js +13 -8
- package/lib/components/cell/Cell.js.map +1 -1
- package/lib/components/cell/CellAdapter.js +6 -6
- package/lib/components/cell/index.js +4 -4
- package/lib/components/codemirror/CodeMirrorEditor.js +3 -3
- package/lib/components/codemirror/index.js +4 -4
- package/lib/components/commands/Commands.js +2 -2
- package/lib/components/commands/index.js +2 -2
- package/lib/components/console/Console.js +4 -4
- package/lib/components/console/index.js +3 -3
- package/lib/components/dialog/Dialog.js +2 -2
- package/lib/components/dialog/index.js +2 -2
- package/lib/components/environment/index.js +1 -1
- package/lib/components/filebrowser/FileBrowser.js +1 -1
- package/lib/components/filebrowser/index.js +1 -1
- package/lib/components/filemanager/FileManagerJupyterLab.js +3 -3
- package/lib/components/filemanager/index.js +2 -2
- package/lib/components/filemanager/lab/index.js +1 -1
- package/lib/components/index.js +19 -19
- package/lib/components/jupyterlab/JupyterLabApp.js +4 -4
- package/lib/components/jupyterlab/index.js +3 -3
- package/lib/components/kernel/KernelInspector.js +2 -2
- package/lib/components/kernel/KernelSelector.js +1 -1
- package/lib/components/kernel/KernelVariables.js +2 -2
- package/lib/components/kernel/Kernels.js +1 -1
- package/lib/components/kernel/index.js +13 -13
- package/lib/components/kernel/inspector/index.js +2 -2
- package/lib/components/kernel/inspector/widget.js +2 -2
- package/lib/components/kernel/variables/index.js +7 -7
- package/lib/components/kernel/variables/variablesinspector.js +5 -5
- package/lib/components/lumino/Lumino.js +0 -14
- package/lib/components/lumino/Lumino.js.map +1 -1
- package/lib/components/lumino/index.js +5 -5
- package/lib/components/notebook/Notebook.js +2 -13
- package/lib/components/notebook/Notebook.js.map +1 -1
- package/lib/components/notebook/NotebookAdapter.d.ts +32 -0
- package/lib/components/notebook/NotebookAdapter.js +59 -32
- package/lib/components/notebook/NotebookAdapter.js.map +1 -1
- package/lib/components/notebook/NotebookBase.d.ts +14 -12
- package/lib/components/notebook/NotebookBase.js +50 -100
- package/lib/components/notebook/NotebookBase.js.map +1 -1
- package/lib/components/notebook/NotebookState.d.ts +87 -0
- package/lib/components/notebook/NotebookState.js +147 -4
- package/lib/components/notebook/NotebookState.js.map +1 -1
- package/lib/components/notebook/cell/index.js +3 -3
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.js +1 -1
- package/lib/components/notebook/cell/metadata/index.js +2 -2
- package/lib/components/notebook/cell/prompt/CountdownInputPrompt.js +1 -1
- package/lib/components/notebook/cell/prompt/CountdownOutputPrompt.js +1 -1
- package/lib/components/notebook/cell/prompt/index.js +3 -3
- package/lib/components/notebook/cell/sidebar/CellSidebar.js +2 -2
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.js +2 -2
- package/lib/components/notebook/cell/sidebar/CellSidebarExtension.js +2 -2
- package/lib/components/notebook/cell/sidebar/CellSidebarRun.js +2 -2
- package/lib/components/notebook/cell/sidebar/index.js +4 -4
- package/lib/components/notebook/content/JupyterReactContentFactory.js +1 -1
- package/lib/components/notebook/content/index.js +1 -1
- package/lib/components/notebook/index.js +11 -11
- package/lib/components/notebook/marked/index.js +1 -1
- package/lib/components/notebook/model/index.js +1 -1
- package/lib/components/notebook/toolbar/NotebookToolbar.js +4 -8
- package/lib/components/notebook/toolbar/NotebookToolbar.js.map +1 -1
- package/lib/components/notebook/toolbar/index.js +1 -1
- package/lib/components/output/Output.js +8 -8
- package/lib/components/output/OutputAdapter.js +3 -3
- package/lib/components/output/OutputIPyWidgets.js +1 -1
- package/lib/components/output/index.js +6 -6
- package/lib/components/output/ipywidgets/IPyWidgetsAttached.js +1 -1
- package/lib/components/settings/Settings.js +2 -2
- package/lib/components/settings/index.js +2 -2
- package/lib/components/terminal/Terminal.js +4 -4
- package/lib/components/terminal/index.js +3 -3
- package/lib/components/textinput/index.js +1 -1
- package/lib/components/utils/index.js +2 -2
- package/lib/components/viewer/Viewer.js +3 -3
- package/lib/components/viewer/index.js +3 -3
- package/lib/components/viewer/input/CodemirrorViewer.js +2 -2
- package/lib/components/viewer/input/InputViewer.js +4 -4
- package/lib/components/viewer/input/index.js +2 -2
- package/lib/components/viewer/output/OutputViewer.js +2 -2
- package/lib/components/viewer/output/index.js +2 -2
- package/lib/console.d.ts +7 -0
- package/lib/console.js +13 -0
- package/lib/console.js.map +1 -0
- package/lib/core.d.ts +38 -0
- package/lib/core.js +48 -0
- package/lib/core.js.map +1 -0
- package/lib/examples/Bokeh.js +5 -5
- package/lib/examples/Bqplot.js +5 -5
- package/lib/examples/Cell.js +6 -6
- package/lib/examples/CellLite.js +3 -3
- package/lib/examples/Cells.js +3 -3
- package/lib/examples/CellsExecute.js +4 -4
- package/lib/examples/Console.js +2 -2
- package/lib/examples/ConsoleLite.js +2 -2
- package/lib/examples/Dashboard.js +5 -5
- package/lib/examples/Deno.js +5 -5
- package/lib/examples/Examples.js +1 -1
- package/lib/examples/Examples.js.map +1 -1
- package/lib/examples/FileBrowser.js +3 -3
- package/lib/examples/GeoJson.js +6 -6
- package/lib/examples/IPyLeaflet.js +5 -5
- package/lib/examples/IPyReact.js +5 -5
- package/lib/examples/IPyWidgets.js +5 -5
- package/lib/examples/IPyWidgetsState.js +5 -5
- package/lib/examples/JupyterContext.js +17 -17
- package/lib/examples/JupyterContext.js.map +1 -1
- package/lib/examples/JupyterLabApp.js +2 -2
- package/lib/examples/JupyterLabAppHeadless.js +3 -3
- package/lib/examples/JupyterLabAppHeadlessServerless.js +3 -3
- package/lib/examples/JupyterLabAppServerless.js +3 -3
- package/lib/examples/JupyterLabAppServiceManager.js +4 -4
- package/lib/examples/JupyterLabTheme.js +2 -2
- package/lib/examples/KernelExecute.js +3 -3
- package/lib/examples/KernelExecuteLite.js +4 -4
- package/lib/examples/KernelExecutor.js +3 -3
- package/lib/examples/KernelExecutorLite.js +4 -4
- package/lib/examples/Kernels.js +3 -3
- package/lib/examples/Lumino.js +2 -2
- package/lib/examples/Matplotlib.js +5 -5
- package/lib/examples/Notebook.js +4 -4
- package/lib/examples/Notebook.js.map +1 -1
- package/lib/examples/NotebookActions.js +6 -6
- package/lib/examples/NotebookActions.js.map +1 -1
- package/lib/examples/NotebookCellSidebar.js +6 -6
- package/lib/examples/NotebookCellToolbar.js +7 -7
- package/lib/examples/NotebookCollaborative.js +3 -3
- package/lib/examples/NotebookCollaborative.js.map +1 -1
- package/lib/examples/NotebookColormode.js +6 -6
- package/lib/examples/NotebookExtension.js +4 -4
- package/lib/examples/NotebookExternalContent.js +5 -5
- package/lib/examples/NotebookInit.js +13 -19
- package/lib/examples/NotebookInit.js.map +1 -1
- package/lib/examples/NotebookKernel.js +9 -9
- package/lib/examples/NotebookKernel.js.map +1 -1
- package/lib/examples/NotebookKernelChange.js +23 -17
- package/lib/examples/NotebookKernelChange.js.map +1 -1
- package/lib/examples/NotebookLess.js +5 -5
- package/lib/examples/NotebookLite.js +5 -5
- package/lib/examples/NotebookLite.js.map +1 -1
- package/lib/examples/NotebookLocalServer.js +6 -6
- package/lib/examples/NotebookNbformat.js +3 -3
- package/lib/examples/NotebookNbformatChange.js +8 -14
- package/lib/examples/NotebookNbformatChange.js.map +1 -1
- package/lib/examples/NotebookNoContext.js +6 -6
- package/lib/examples/NotebookNoPrimer.js +6 -6
- package/lib/examples/NotebookOnSessionConnection.js +3 -3
- package/lib/examples/NotebookPath.js +6 -6
- package/lib/examples/NotebookPathChange.js +4 -4
- package/lib/examples/NotebookReadonly.js +5 -5
- package/lib/examples/NotebookServiceManager.js +6 -6
- package/lib/examples/NotebookSkeleton.js +6 -6
- package/lib/examples/NotebookTOC.js +7 -7
- package/lib/examples/NotebookTheme.js +5 -5
- package/lib/examples/NotebookThemeColormode.js +4 -4
- package/lib/examples/NotebookURL.js +6 -6
- package/lib/examples/NotebookUnmount.js +5 -5
- package/lib/examples/ObservableHQ.js +5 -5
- package/lib/examples/OutputIPyWidgets.js +3 -3
- package/lib/examples/OutputWithMonitoring.js +5 -5
- package/lib/examples/Outputs.js +8 -8
- package/lib/examples/OutputsIpynb.js +3 -3
- package/lib/examples/Panel.js +6 -6
- package/lib/examples/Plotly.js +5 -5
- package/lib/examples/PyGWalker.js +5 -5
- package/lib/examples/RunningSessions.js +2 -2
- package/lib/examples/Terminal.js +2 -2
- package/lib/examples/Vega.js +6 -6
- package/lib/examples/Viewer.js +2 -2
- package/lib/examples/extensions/cellsidebars/CellSidebarSource.js +3 -3
- package/lib/examples/extensions/cellsidebars/index.js +1 -1
- package/lib/examples/extensions/celltoolbar/CellToolbar.js +1 -1
- package/lib/examples/extensions/celltoolbar/CellToolbarComponent.js +2 -3
- package/lib/examples/extensions/celltoolbar/CellToolbarComponent.js.map +1 -1
- package/lib/examples/extensions/celltoolbar/CellToolbarExtension.js +1 -1
- package/lib/examples/extensions/celltoolbar/CellToolbarWidget.js +1 -1
- package/lib/examples/extensions/celltoolbar/index.js +4 -4
- package/lib/examples/extensions/exectime/ExecTimeExtension.js +1 -1
- package/lib/examples/extensions/exectime/ExecTimeWidget.js +1 -1
- package/lib/examples/extensions/exectime/index.js +3 -3
- package/lib/examples/extensions/index.js +3 -3
- package/lib/examples/extensions/toc/ReactLayoutFactory.js +3 -3
- package/lib/examples/extensions/toc/ReactLayoutFactory.js.map +1 -1
- package/lib/examples/extensions/toc/TocComponent.d.ts +1 -2
- package/lib/examples/extensions/toc/TocComponent.js +29 -40
- package/lib/examples/extensions/toc/TocComponent.js.map +1 -1
- package/lib/examples/extensions/toc/TocExtension.js +1 -1
- package/lib/index.js +7 -7
- package/lib/jupyter/JupyterConfig.js +1 -1
- package/lib/jupyter/JupyterHandlers.js +1 -1
- package/lib/jupyter/JupyterUse.js +1 -1
- package/lib/jupyter/collaboration/CollaborationContext.js +1 -1
- package/lib/jupyter/collaboration/index.js +4 -4
- package/lib/jupyter/collaboration/providers/JupyterCollaborationProvider.js +2 -2
- package/lib/jupyter/collaboration/providers/NoOpCollaborationProvider.js +1 -1
- package/lib/jupyter/collaboration/providers/index.js +2 -2
- package/lib/jupyter/index.js +11 -11
- package/lib/jupyter/ipywidgets/classic/htmlmanager.js +1 -1
- package/lib/jupyter/ipywidgets/classic/index.js +3 -3
- package/lib/jupyter/ipywidgets/classic/manager.js +5 -5
- package/lib/jupyter/ipywidgets/index.js +5 -5
- package/lib/jupyter/ipywidgets/lab/index.js +2 -2
- package/lib/jupyter/ipywidgets/lab/manager.js +3 -3
- package/lib/jupyter/ipywidgets/libembed-amd.js +1 -1
- package/lib/jupyter/ipywidgets/libembed.js +1 -1
- package/lib/jupyter/kernel/Kernel.js +2 -7
- package/lib/jupyter/kernel/Kernel.js.map +1 -1
- package/lib/jupyter/kernel/KernelExecutor.js +3 -5
- package/lib/jupyter/kernel/KernelExecutor.js.map +1 -1
- package/lib/jupyter/kernel/index.js +3 -3
- package/lib/jupyter/lite/LiteServer.js +2 -2
- package/lib/jupyter/lite/contents/broadcast.js +2 -2
- package/lib/jupyter/lite/contents/contents.js +1 -1
- package/lib/jupyter/lite/contents/drivecontents.js +2 -2
- package/lib/jupyter/lite/contents/drivefs.js +1 -1
- package/lib/jupyter/lite/contents/index.js +6 -6
- package/lib/jupyter/lite/index.js +7 -7
- package/lib/jupyter/lite/javascript-kernel/comlink.worker.js +1 -1
- package/lib/jupyter/lite/javascript-kernel/index.js +2 -2
- package/lib/jupyter/lite/javascript-kernel/kernel.js +1 -1
- package/lib/jupyter/lite/javascript-kernel-extension/index.js +2 -2
- package/lib/jupyter/lite/kernel/index.js +4 -4
- package/lib/jupyter/lite/kernel/kernelspecs.js +1 -1
- package/lib/jupyter/lite/licenses/index.js +2 -2
- package/lib/jupyter/lite/licenses/licenses.js +1 -1
- package/lib/jupyter/lite/localforage/index.js +2 -2
- package/lib/jupyter/lite/pyodide-kernel/coincident.worker.js +2 -2
- package/lib/jupyter/lite/pyodide-kernel/comlink.worker.js +2 -2
- package/lib/jupyter/lite/pyodide-kernel/index.js +6 -6
- package/lib/jupyter/lite/pyodide-kernel/kernel.js +3 -3
- package/lib/jupyter/lite/pyodide-kernel-extension/index.js +3 -3
- package/lib/jupyter/lite/server/app.js +1 -1
- package/lib/jupyter/lite/server/index.js +4 -4
- package/lib/jupyter/lite/server-extension/index.js +8 -8
- package/lib/jupyter/lite/session/index.js +2 -2
- package/lib/jupyter/lite/settings/index.js +2 -2
- package/lib/jupyter/lite/translation/index.js +2 -2
- package/lib/jupyter/lite/types/index.js +1 -1
- package/lib/jupyter/renderers/index.js +1 -1
- package/lib/jupyter/renderers/plotly/index.js +1 -1
- package/lib/jupyter/services/ServiceManagerLite.js +1 -1
- package/lib/jupyter/services/index.d.ts +1 -0
- package/lib/jupyter/services/index.js +4 -3
- package/lib/jupyter/services/index.js.map +1 -1
- package/lib/jupyter/services/serviceManagerUtils.d.ts +73 -0
- package/lib/jupyter/services/serviceManagerUtils.js +132 -0
- package/lib/jupyter/services/serviceManagerUtils.js.map +1 -0
- package/lib/jupyter-context.d.ts +13 -0
- package/lib/jupyter-context.js +19 -0
- package/lib/jupyter-context.js.map +1 -0
- package/lib/lazy/JupyterSkeleton.d.ts +27 -0
- package/lib/lazy/JupyterSkeleton.js +32 -0
- package/lib/lazy/JupyterSkeleton.js.map +1 -0
- package/lib/lazy/LazyCell.d.ts +36 -0
- package/lib/lazy/LazyCell.js +46 -0
- package/lib/lazy/LazyCell.js.map +1 -0
- package/lib/lazy/LazyConsole.d.ts +26 -0
- package/lib/lazy/LazyConsole.js +32 -0
- package/lib/lazy/LazyConsole.js.map +1 -0
- package/lib/lazy/LazyNotebook.d.ts +30 -0
- package/lib/lazy/LazyNotebook.js +36 -0
- package/lib/lazy/LazyNotebook.js.map +1 -0
- package/lib/lazy/LazyOutput.d.ts +30 -0
- package/lib/lazy/LazyOutput.js +36 -0
- package/lib/lazy/LazyOutput.js.map +1 -0
- package/lib/lazy/LazyTerminal.d.ts +29 -0
- package/lib/lazy/LazyTerminal.js +35 -0
- package/lib/lazy/LazyTerminal.js.map +1 -0
- package/lib/lazy/LazyViewer.d.ts +29 -0
- package/lib/lazy/LazyViewer.js +35 -0
- package/lib/lazy/LazyViewer.js.map +1 -0
- package/lib/lazy/index.d.ts +21 -0
- package/lib/lazy/index.js +27 -0
- package/lib/lazy/index.js.map +1 -0
- package/lib/lazy-entry.d.ts +37 -0
- package/lib/lazy-entry.js +39 -0
- package/lib/lazy-entry.js.map +1 -0
- package/lib/lite-entry.d.ts +6 -0
- package/lib/lite-entry.js +14 -0
- package/lib/lite-entry.js.map +1 -0
- package/lib/notebook.d.ts +7 -0
- package/lib/notebook.js +13 -0
- package/lib/notebook.js.map +1 -0
- package/lib/output.d.ts +7 -0
- package/lib/output.js +13 -0
- package/lib/output.js.map +1 -0
- package/lib/state/JupyterReactState.js +15 -17
- package/lib/state/JupyterReactState.js.map +1 -1
- package/lib/state/index.js +1 -1
- package/lib/terminal.d.ts +7 -0
- package/lib/terminal.js +13 -0
- package/lib/terminal.js.map +1 -0
- package/lib/theme/JupyterReactTheme.js +3 -3
- package/lib/theme/index.js +6 -6
- package/lib/theme/themes/index.js +1 -1
- package/lib/theme-entry.d.ts +7 -0
- package/lib/theme-entry.js +13 -0
- package/lib/theme-entry.js.map +1 -0
- package/lib/tools/__tests__/operationRunner.test.js +8 -8
- package/lib/tools/core/executor.js +0 -6
- package/lib/tools/core/executor.js.map +1 -1
- package/lib/tools/core/index.d.ts +1 -0
- package/lib/tools/core/index.js +14 -13
- package/lib/tools/core/index.js.map +1 -1
- package/lib/tools/core/operationRunner.js +1 -1
- package/lib/tools/core/zodUtils.js +28 -0
- package/lib/tools/core/zodUtils.js.map +1 -1
- package/lib/tools/definitions/deleteCell.js +2 -2
- package/lib/tools/definitions/executeCode.js +2 -2
- package/lib/tools/definitions/index.js +7 -7
- package/lib/tools/definitions/insertCell.js +2 -2
- package/lib/tools/definitions/readAllCells.js +2 -2
- package/lib/tools/definitions/readCell.js +2 -2
- package/lib/tools/definitions/runCell.js +2 -2
- package/lib/tools/definitions/updateCell.js +2 -2
- package/lib/tools/index.js +16 -16
- package/lib/tools/operations/deleteCell.js +3 -3
- package/lib/tools/operations/executeCode.js +2 -2
- package/lib/tools/operations/insertCell.js +14 -5
- package/lib/tools/operations/insertCell.js.map +1 -1
- package/lib/tools/operations/readAllCells.js +2 -2
- package/lib/tools/operations/readCell.js +1 -1
- package/lib/tools/operations/runCell.js +3 -3
- package/lib/tools/operations/updateCell.js +2 -2
- package/lib/tools/schemas/index.js +7 -7
- package/lib/utils/Utils.js +1 -1
- package/lib/utils/index.js +2 -2
- package/lib/viewer.d.ts +7 -0
- package/lib/viewer.js +13 -0
- package/lib/viewer.js.map +1 -0
- package/package.json +129 -9
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Disable auto-reconnection for all running kernels in a service manager.
|
|
8
|
+
*
|
|
9
|
+
* This function accesses the private `_reconnectLimit` property of each kernel
|
|
10
|
+
* to prevent automatic reconnection attempts when WebSockets close.
|
|
11
|
+
*
|
|
12
|
+
* @param serviceManager - The service manager instance
|
|
13
|
+
* @returns Number of kernels that had reconnection disabled
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Accessing `_reconnectLimit` is necessary because JupyterLab doesn't expose
|
|
17
|
+
* a public API to disable auto-reconnection. This is safe because:
|
|
18
|
+
* 1. We control this package
|
|
19
|
+
* 2. It's for graceful shutdown only
|
|
20
|
+
* 3. Prevents user-facing CORS errors
|
|
21
|
+
*
|
|
22
|
+
* TODO: Propose upstream fix to add kernel.disableReconnect() to @jupyterlab/services
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Disable reconnect, then dispose manually
|
|
27
|
+
* disableKernelReconnect(serviceManager);
|
|
28
|
+
* serviceManager.dispose();
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function disableKernelReconnect(serviceManager) {
|
|
32
|
+
let count = 0;
|
|
33
|
+
const disabledKernelIds = new Set();
|
|
34
|
+
try {
|
|
35
|
+
// CRITICAL: Check BOTH sessions AND kernels!
|
|
36
|
+
// Kernels can exist without sessions (orphaned kernels)
|
|
37
|
+
// 1. Disable reconnect for kernels in sessions
|
|
38
|
+
const sessionManager = serviceManager.sessions;
|
|
39
|
+
if (sessionManager && typeof sessionManager.running === 'function') {
|
|
40
|
+
const runningSessions = Array.from(sessionManager.running());
|
|
41
|
+
for (const session of runningSessions) {
|
|
42
|
+
if (session.kernel && session.kernel.id) {
|
|
43
|
+
// Access private _reconnectLimit property to prevent further auto-reconnect attempts.
|
|
44
|
+
// NOTE: Using -1 here is based on the current JupyterLab KernelConnection implementation.
|
|
45
|
+
// If JupyterLab changes the semantics of _reconnectLimit, this value may need to be updated.
|
|
46
|
+
session.kernel._reconnectLimit = -1;
|
|
47
|
+
disabledKernelIds.add(session.kernel.id);
|
|
48
|
+
count++;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// 2. Disable reconnect for orphaned kernels (not in sessions)
|
|
53
|
+
const kernelManager = serviceManager.kernels;
|
|
54
|
+
if (kernelManager && typeof kernelManager.running === 'function') {
|
|
55
|
+
const runningKernels = Array.from(kernelManager.running());
|
|
56
|
+
for (const kernelModel of runningKernels) {
|
|
57
|
+
// Skip if we already disabled this kernel via session
|
|
58
|
+
if (disabledKernelIds.has(kernelModel.id)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// Access private _kernels map to get actual KernelConnection objects
|
|
62
|
+
// KernelManager.running() returns models, but we need connections to set _reconnectLimit
|
|
63
|
+
try {
|
|
64
|
+
const kernelManagerPrivate = kernelManager;
|
|
65
|
+
const kernelsMap = kernelManagerPrivate._kernelConnections;
|
|
66
|
+
if (kernelsMap) {
|
|
67
|
+
// _kernelConnections is a Set, not a Map
|
|
68
|
+
if (kernelsMap instanceof Set) {
|
|
69
|
+
// Iterate through ALL kernel connections in the Set
|
|
70
|
+
for (const kernelConnection of kernelsMap) {
|
|
71
|
+
if (kernelConnection &&
|
|
72
|
+
kernelConnection._reconnectLimit !== undefined) {
|
|
73
|
+
const connectionId = kernelConnection.id ?? kernelModel.id;
|
|
74
|
+
// Avoid double-disabling / double-counting
|
|
75
|
+
if (!disabledKernelIds.has(connectionId)) {
|
|
76
|
+
kernelConnection._reconnectLimit = -1;
|
|
77
|
+
disabledKernelIds.add(connectionId);
|
|
78
|
+
count++;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (kernelsMap instanceof Map) {
|
|
84
|
+
// Fallback: Keep Map logic in case structure changes
|
|
85
|
+
const kernelConnection = kernelsMap.get(kernelModel.id);
|
|
86
|
+
if (kernelConnection &&
|
|
87
|
+
kernelConnection._reconnectLimit !== undefined) {
|
|
88
|
+
kernelConnection._reconnectLimit = -1;
|
|
89
|
+
disabledKernelIds.add(kernelModel.id);
|
|
90
|
+
count++;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
console.error(`[serviceManagerUtils] Error disabling orphaned kernel ${kernelModel.id}:`, error);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error('[serviceManagerUtils] Error disabling auto-reconnect:', error);
|
|
103
|
+
}
|
|
104
|
+
return count;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Dispose a service manager without auto-reconnection errors.
|
|
108
|
+
*
|
|
109
|
+
* This is a convenience wrapper that:
|
|
110
|
+
* 1. Disables auto-reconnection for all kernels
|
|
111
|
+
* 2. Calls dispose() on the service manager
|
|
112
|
+
*
|
|
113
|
+
* @param serviceManager - The service manager to dispose
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* import { disposeServiceManager } from '@datalayer/jupyter-react';
|
|
118
|
+
*
|
|
119
|
+
* // Instead of:
|
|
120
|
+
* serviceManager.dispose(); // ❌ May cause CORS errors
|
|
121
|
+
*
|
|
122
|
+
* // Use:
|
|
123
|
+
* disposeServiceManager(serviceManager); // ✅ Clean disposal
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export function disposeServiceManager(serviceManager) {
|
|
127
|
+
// Disable auto-reconnect for all kernels
|
|
128
|
+
disableKernelReconnect(serviceManager);
|
|
129
|
+
// Now dispose - WebSocket closes won't trigger auto-reconnect
|
|
130
|
+
serviceManager.dispose();
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=serviceManagerUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceManagerUtils.js","sourceRoot":"","sources":["../../../src/jupyter/services/serviceManagerUtils.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jupyter context entry point
|
|
3
|
+
*
|
|
4
|
+
* This is a separate entry point for tree-shaking.
|
|
5
|
+
* Import from '@datalayer/jupyter-react/jupyter' for smaller bundles.
|
|
6
|
+
*
|
|
7
|
+
* Contains:
|
|
8
|
+
* - Jupyter provider component
|
|
9
|
+
* - useJupyter hook
|
|
10
|
+
* - Kernel management
|
|
11
|
+
* - Jupyter services
|
|
12
|
+
*/
|
|
13
|
+
export * from './jupyter';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Jupyter context entry point
|
|
8
|
+
*
|
|
9
|
+
* This is a separate entry point for tree-shaking.
|
|
10
|
+
* Import from '@datalayer/jupyter-react/jupyter' for smaller bundles.
|
|
11
|
+
*
|
|
12
|
+
* Contains:
|
|
13
|
+
* - Jupyter provider component
|
|
14
|
+
* - useJupyter hook
|
|
15
|
+
* - Kernel management
|
|
16
|
+
* - Jupyter services
|
|
17
|
+
*/
|
|
18
|
+
export * from './jupyter/index.js';
|
|
19
|
+
//# sourceMappingURL=jupyter-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jupyter-context.js","sourceRoot":"","sources":["../src/jupyter-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AAEH,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IJupyterSkeletonProps {
|
|
3
|
+
/**
|
|
4
|
+
* Height of the skeleton loader
|
|
5
|
+
*/
|
|
6
|
+
height?: string | number;
|
|
7
|
+
/**
|
|
8
|
+
* Whether to show the "Loading..." text
|
|
9
|
+
*/
|
|
10
|
+
showText?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Custom loading text
|
|
13
|
+
*/
|
|
14
|
+
text?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Component type being loaded (for accessibility)
|
|
17
|
+
*/
|
|
18
|
+
componentType?: 'cell' | 'notebook' | 'terminal' | 'console' | 'output' | 'viewer';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Skeleton loading component for lazy-loaded Jupyter components.
|
|
22
|
+
*
|
|
23
|
+
* Use this as a fallback in Suspense boundaries when lazy-loading
|
|
24
|
+
* heavy Jupyter components.
|
|
25
|
+
*/
|
|
26
|
+
export declare const JupyterSkeleton: React.FC<IJupyterSkeletonProps>;
|
|
27
|
+
export default JupyterSkeleton;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Spinner } from '@primer/react';
|
|
3
|
+
import { Box } from '@datalayer/primer-addons';
|
|
4
|
+
/**
|
|
5
|
+
* Skeleton loading component for lazy-loaded Jupyter components.
|
|
6
|
+
*
|
|
7
|
+
* Use this as a fallback in Suspense boundaries when lazy-loading
|
|
8
|
+
* heavy Jupyter components.
|
|
9
|
+
*/
|
|
10
|
+
export const JupyterSkeleton = ({ height = '200px', showText = true, text, componentType, }) => {
|
|
11
|
+
const displayText = text ??
|
|
12
|
+
(componentType
|
|
13
|
+
? `Loading Jupyter ${componentType}...`
|
|
14
|
+
: 'Loading Jupyter component...');
|
|
15
|
+
return (_jsxs(Box, { sx: {
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
height,
|
|
21
|
+
gap: 3,
|
|
22
|
+
backgroundColor: 'canvas.subtle',
|
|
23
|
+
borderRadius: 2,
|
|
24
|
+
border: '1px solid',
|
|
25
|
+
borderColor: 'border.muted',
|
|
26
|
+
}, role: "status", "aria-label": displayText, children: [_jsx(Spinner, { size: "large" }), showText && (_jsx(Box, { sx: {
|
|
27
|
+
color: 'fg.muted',
|
|
28
|
+
fontSize: 1,
|
|
29
|
+
}, children: displayText }))] }));
|
|
30
|
+
};
|
|
31
|
+
export default JupyterSkeleton;
|
|
32
|
+
//# sourceMappingURL=JupyterSkeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JupyterSkeleton.js","sourceRoot":"","sources":["../../src/lazy/JupyterSkeleton.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AA2B/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoC,CAAC,EAC/D,MAAM,GAAG,OAAO,EAChB,QAAQ,GAAG,IAAI,EACf,IAAI,EACJ,aAAa,GACd,EAAE,EAAE;IACH,MAAM,WAAW,GACf,IAAI;QACJ,CAAC,aAAa;YACZ,CAAC,CAAC,mBAAmB,aAAa,KAAK;YACvC,CAAC,CAAC,8BAA8B,CAAC,CAAC;IAEtC,OAAO,CACL,MAAC,GAAG,IACF,EAAE,EAAE;YACF,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,MAAM;YACN,GAAG,EAAE,CAAC;YACN,eAAe,EAAE,eAAe;YAChC,YAAY,EAAE,CAAC;YACf,MAAM,EAAE,WAAW;YACnB,WAAW,EAAE,cAAc;SAC5B,EACD,IAAI,EAAC,QAAQ,gBACD,WAAW,aAEvB,KAAC,OAAO,IAAC,IAAI,EAAC,OAAO,GAAG,EACvB,QAAQ,IAAI,CACX,KAAC,GAAG,IACF,EAAE,EAAE;oBACF,KAAK,EAAE,UAAU;oBACjB,QAAQ,EAAE,CAAC;iBACZ,YAEA,WAAW,GACR,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ICellProps } from '../components/cell/Cell';
|
|
3
|
+
export interface ILazyCellProps extends ICellProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom fallback component while loading
|
|
6
|
+
*/
|
|
7
|
+
fallback?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Height of the skeleton loader
|
|
10
|
+
*/
|
|
11
|
+
skeletonHeight?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Lazy-loaded Cell component with built-in Suspense boundary
|
|
15
|
+
*
|
|
16
|
+
* This component automatically provides a loading state while the
|
|
17
|
+
* Cell component is being loaded.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <LazyCell
|
|
22
|
+
* source="print('Hello, World!')"
|
|
23
|
+
* kernel={kernel}
|
|
24
|
+
* autoStart={true}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const LazyCell: React.FC<ILazyCellProps>;
|
|
29
|
+
/**
|
|
30
|
+
* Raw lazy Cell component without Suspense boundary
|
|
31
|
+
*
|
|
32
|
+
* Use this when you want to manage the Suspense boundary yourself,
|
|
33
|
+
* e.g., when loading multiple components together.
|
|
34
|
+
*/
|
|
35
|
+
export declare const LazyCellRaw: React.LazyExoticComponent<({ autoStart, id: providedId, kernel, outputs, showToolbar, source, type, }: ICellProps) => import("react/jsx-runtime").JSX.Element>;
|
|
36
|
+
export default LazyCell;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*/
|
|
7
|
+
import { lazy, Suspense } from 'react';
|
|
8
|
+
import { JupyterSkeleton } from './JupyterSkeleton.js';
|
|
9
|
+
/**
|
|
10
|
+
* Lazy-loaded Cell component
|
|
11
|
+
*
|
|
12
|
+
* This component wraps the Cell component with React.lazy for code splitting.
|
|
13
|
+
* The heavy JupyterLab cell dependencies are only loaded when this component
|
|
14
|
+
* is rendered.
|
|
15
|
+
*/
|
|
16
|
+
const CellImpl = lazy(() => import('../components/cell/Cell').then(module => ({
|
|
17
|
+
default: module.Cell,
|
|
18
|
+
})));
|
|
19
|
+
/**
|
|
20
|
+
* Lazy-loaded Cell component with built-in Suspense boundary
|
|
21
|
+
*
|
|
22
|
+
* This component automatically provides a loading state while the
|
|
23
|
+
* Cell component is being loaded.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <LazyCell
|
|
28
|
+
* source="print('Hello, World!')"
|
|
29
|
+
* kernel={kernel}
|
|
30
|
+
* autoStart={true}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export const LazyCell = ({ fallback, skeletonHeight = '150px', ...cellProps }) => {
|
|
35
|
+
const defaultFallback = (_jsx(JupyterSkeleton, { height: skeletonHeight, componentType: "cell" }));
|
|
36
|
+
return (_jsx(Suspense, { fallback: fallback ?? defaultFallback, children: _jsx(CellImpl, { ...cellProps }) }));
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Raw lazy Cell component without Suspense boundary
|
|
40
|
+
*
|
|
41
|
+
* Use this when you want to manage the Suspense boundary yourself,
|
|
42
|
+
* e.g., when loading multiple components together.
|
|
43
|
+
*/
|
|
44
|
+
export const LazyCellRaw = CellImpl;
|
|
45
|
+
export default LazyCell;
|
|
46
|
+
//# sourceMappingURL=LazyCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyCell.js","sourceRoot":"","sources":["../../src/lazy/LazyCell.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CACzB,MAAM,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAChD,OAAO,EAAE,MAAM,CAAC,IAAI;CACrB,CAAC,CAAC,CACJ,CAAC;AAaF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA6B,CAAC,EACjD,QAAQ,EACR,cAAc,GAAG,OAAO,EACxB,GAAG,SAAS,EACb,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,CACtB,KAAC,eAAe,IAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAC,MAAM,GAAG,CACjE,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAI,eAAe,YAC7C,KAAC,QAAQ,OAAK,SAAS,GAAI,GAClB,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Console as ConsoleNamespace } from '../components/console/Console';
|
|
3
|
+
export interface ILazyConsoleProps extends ConsoleNamespace.IConsoleOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Custom fallback component while loading
|
|
6
|
+
*/
|
|
7
|
+
fallback?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Height of the skeleton loader
|
|
10
|
+
*/
|
|
11
|
+
skeletonHeight?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Lazy-loaded Console component with built-in Suspense boundary
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <LazyConsole code="print('Hello!')" />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const LazyConsole: React.FC<ILazyConsoleProps>;
|
|
22
|
+
/**
|
|
23
|
+
* Raw lazy Console component without Suspense boundary
|
|
24
|
+
*/
|
|
25
|
+
export declare const LazyConsoleRaw: React.LazyExoticComponent<(options: ConsoleNamespace.IConsoleOptions) => import("react/jsx-runtime").JSX.Element>;
|
|
26
|
+
export default LazyConsole;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*/
|
|
7
|
+
import { lazy, Suspense } from 'react';
|
|
8
|
+
import { JupyterSkeleton } from './JupyterSkeleton.js';
|
|
9
|
+
/**
|
|
10
|
+
* Lazy-loaded Console component
|
|
11
|
+
*/
|
|
12
|
+
const ConsoleImpl = lazy(() => import('../components/console/Console').then(module => ({
|
|
13
|
+
default: module.Console,
|
|
14
|
+
})));
|
|
15
|
+
/**
|
|
16
|
+
* Lazy-loaded Console component with built-in Suspense boundary
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <LazyConsole code="print('Hello!')" />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export const LazyConsole = ({ fallback, skeletonHeight = '300px', ...consoleProps }) => {
|
|
24
|
+
const defaultFallback = (_jsx(JupyterSkeleton, { height: skeletonHeight, componentType: "console" }));
|
|
25
|
+
return (_jsx(Suspense, { fallback: fallback ?? defaultFallback, children: _jsx(ConsoleImpl, { ...consoleProps }) }));
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Raw lazy Console component without Suspense boundary
|
|
29
|
+
*/
|
|
30
|
+
export const LazyConsoleRaw = ConsoleImpl;
|
|
31
|
+
export default LazyConsole;
|
|
32
|
+
//# sourceMappingURL=LazyConsole.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyConsole.js","sourceRoot":"","sources":["../../src/lazy/LazyConsole.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAC5B,MAAM,CAAC,+BAA+B,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtD,OAAO,EAAE,MAAM,CAAC,OAAO;CACxB,CAAC,CAAC,CACJ,CAAC;AAaF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgC,CAAC,EACvD,QAAQ,EACR,cAAc,GAAG,OAAO,EACxB,GAAG,YAAY,EAChB,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,CACtB,KAAC,eAAe,IAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAC,SAAS,GAAG,CACpE,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAI,eAAe,YAC7C,KAAC,WAAW,OAAK,YAAY,GAAI,GACxB,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { INotebookProps } from '../components/notebook/Notebook';
|
|
3
|
+
export interface ILazyNotebookProps extends INotebookProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom fallback component while loading
|
|
6
|
+
*/
|
|
7
|
+
fallback?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Height of the skeleton loader
|
|
10
|
+
*/
|
|
11
|
+
skeletonHeight?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Lazy-loaded Notebook component with built-in Suspense boundary
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <LazyNotebook
|
|
19
|
+
* id="my-notebook"
|
|
20
|
+
* serviceManager={serviceManager}
|
|
21
|
+
* nbformat={notebookContent}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const LazyNotebook: React.FC<React.PropsWithChildren<ILazyNotebookProps>>;
|
|
26
|
+
/**
|
|
27
|
+
* Raw lazy Notebook component without Suspense boundary
|
|
28
|
+
*/
|
|
29
|
+
export declare const LazyNotebookRaw: React.LazyExoticComponent<typeof import("..").Notebook>;
|
|
30
|
+
export default LazyNotebook;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*/
|
|
7
|
+
import { lazy, Suspense } from 'react';
|
|
8
|
+
import { JupyterSkeleton } from './JupyterSkeleton.js';
|
|
9
|
+
/**
|
|
10
|
+
* Lazy-loaded Notebook component
|
|
11
|
+
*/
|
|
12
|
+
const NotebookImpl = lazy(() => import('../components/notebook/Notebook').then(module => ({
|
|
13
|
+
default: module.Notebook,
|
|
14
|
+
})));
|
|
15
|
+
/**
|
|
16
|
+
* Lazy-loaded Notebook component with built-in Suspense boundary
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <LazyNotebook
|
|
21
|
+
* id="my-notebook"
|
|
22
|
+
* serviceManager={serviceManager}
|
|
23
|
+
* nbformat={notebookContent}
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export const LazyNotebook = ({ fallback, skeletonHeight = '400px', ...notebookProps }) => {
|
|
28
|
+
const defaultFallback = (_jsx(JupyterSkeleton, { height: skeletonHeight, componentType: "notebook" }));
|
|
29
|
+
return (_jsx(Suspense, { fallback: fallback ?? defaultFallback, children: _jsx(NotebookImpl, { ...notebookProps }) }));
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Raw lazy Notebook component without Suspense boundary
|
|
33
|
+
*/
|
|
34
|
+
export const LazyNotebookRaw = NotebookImpl;
|
|
35
|
+
export default LazyNotebook;
|
|
36
|
+
//# sourceMappingURL=LazyNotebook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyNotebook.js","sourceRoot":"","sources":["../../src/lazy/LazyNotebook.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAC7B,MAAM,CAAC,iCAAiC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC,QAAQ;CACzB,CAAC,CAAC,CACJ,CAAC;AAaF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAErB,CAAC,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,EAAE,GAAG,aAAa,EAAE,EAAE,EAAE;IAC/D,MAAM,eAAe,GAAG,CACtB,KAAC,eAAe,IAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAC,UAAU,GAAG,CACrE,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAI,eAAe,YAC7C,KAAC,YAAY,OAAK,aAAa,GAAI,GAC1B,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IOutputProps } from '../components/output/Output';
|
|
3
|
+
export interface ILazyOutputProps extends IOutputProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom fallback component while loading
|
|
6
|
+
*/
|
|
7
|
+
fallback?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Height of the skeleton loader
|
|
10
|
+
*/
|
|
11
|
+
skeletonHeight?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Lazy-loaded Output component with built-in Suspense boundary
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <LazyOutput
|
|
19
|
+
* code="print('Hello!')"
|
|
20
|
+
* kernel={kernel}
|
|
21
|
+
* autoRun={true}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const LazyOutput: React.FC<ILazyOutputProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Raw lazy Output component without Suspense boundary
|
|
28
|
+
*/
|
|
29
|
+
export declare const LazyOutputRaw: React.LazyExoticComponent<({ adapter: propsAdapter, autoRun, clearTrigger, code, codePre, disableRun, executeTrigger, id: sourceId, insertText, kernel: propsKernel, lumino, model, onExecutionPhaseChanged, outputs: propsOutputs, receipt, showControl, showEditor, showKernelProgressBar, suppressCodeExecutionErrors, toolbarPosition, notifyOnComplete, }: IOutputProps) => import("react/jsx-runtime").JSX.Element>;
|
|
30
|
+
export default LazyOutput;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*/
|
|
7
|
+
import { lazy, Suspense } from 'react';
|
|
8
|
+
import { JupyterSkeleton } from './JupyterSkeleton.js';
|
|
9
|
+
/**
|
|
10
|
+
* Lazy-loaded Output component
|
|
11
|
+
*/
|
|
12
|
+
const OutputImpl = lazy(() => import('../components/output/Output').then(module => ({
|
|
13
|
+
default: module.Output,
|
|
14
|
+
})));
|
|
15
|
+
/**
|
|
16
|
+
* Lazy-loaded Output component with built-in Suspense boundary
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <LazyOutput
|
|
21
|
+
* code="print('Hello!')"
|
|
22
|
+
* kernel={kernel}
|
|
23
|
+
* autoRun={true}
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export const LazyOutput = ({ fallback, skeletonHeight = '100px', ...outputProps }) => {
|
|
28
|
+
const defaultFallback = (_jsx(JupyterSkeleton, { height: skeletonHeight, componentType: "output" }));
|
|
29
|
+
return (_jsx(Suspense, { fallback: fallback ?? defaultFallback, children: _jsx(OutputImpl, { ...outputProps }) }));
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Raw lazy Output component without Suspense boundary
|
|
33
|
+
*/
|
|
34
|
+
export const LazyOutputRaw = OutputImpl;
|
|
35
|
+
export default LazyOutput;
|
|
36
|
+
//# sourceMappingURL=LazyOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyOutput.js","sourceRoot":"","sources":["../../src/lazy/LazyOutput.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAC3B,MAAM,CAAC,6BAA6B,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC,CAAC,CACJ,CAAC;AAaF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,UAAU,GAA+B,CAAC,EACrD,QAAQ,EACR,cAAc,GAAG,OAAO,EACxB,GAAG,WAAW,EACf,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,CACtB,KAAC,eAAe,IAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAC,QAAQ,GAAG,CACnE,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAI,eAAe,YAC7C,KAAC,UAAU,OAAK,WAAW,GAAI,GACtB,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;AAExC,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Terminal as TerminalNamespace } from '../components/terminal/Terminal';
|
|
3
|
+
export interface ILazyTerminalProps extends TerminalNamespace.ITerminalOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Custom fallback component while loading
|
|
6
|
+
*/
|
|
7
|
+
fallback?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Height of the skeleton loader
|
|
10
|
+
*/
|
|
11
|
+
skeletonHeight?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Lazy-loaded Terminal component with built-in Suspense boundary
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <LazyTerminal
|
|
19
|
+
* height="400px"
|
|
20
|
+
* colormode="dark"
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const LazyTerminal: React.FC<ILazyTerminalProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Raw lazy Terminal component without Suspense boundary
|
|
27
|
+
*/
|
|
28
|
+
export declare const LazyTerminalRaw: React.LazyExoticComponent<({ height, colormode, ...rest }: TerminalNamespace.ITerminalOptions) => import("react/jsx-runtime").JSX.Element>;
|
|
29
|
+
export default LazyTerminal;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*/
|
|
7
|
+
import { lazy, Suspense } from 'react';
|
|
8
|
+
import { JupyterSkeleton } from './JupyterSkeleton.js';
|
|
9
|
+
/**
|
|
10
|
+
* Lazy-loaded Terminal component
|
|
11
|
+
*/
|
|
12
|
+
const TerminalImpl = lazy(() => import('../components/terminal/Terminal').then(module => ({
|
|
13
|
+
default: module.Terminal,
|
|
14
|
+
})));
|
|
15
|
+
/**
|
|
16
|
+
* Lazy-loaded Terminal component with built-in Suspense boundary
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <LazyTerminal
|
|
21
|
+
* height="400px"
|
|
22
|
+
* colormode="dark"
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export const LazyTerminal = ({ fallback, skeletonHeight = '300px', ...terminalProps }) => {
|
|
27
|
+
const defaultFallback = (_jsx(JupyterSkeleton, { height: skeletonHeight, componentType: "terminal" }));
|
|
28
|
+
return (_jsx(Suspense, { fallback: fallback ?? defaultFallback, children: _jsx(TerminalImpl, { ...terminalProps }) }));
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Raw lazy Terminal component without Suspense boundary
|
|
32
|
+
*/
|
|
33
|
+
export const LazyTerminalRaw = TerminalImpl;
|
|
34
|
+
export default LazyTerminal;
|
|
35
|
+
//# sourceMappingURL=LazyTerminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyTerminal.js","sourceRoot":"","sources":["../../src/lazy/LazyTerminal.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAC7B,MAAM,CAAC,iCAAiC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC,QAAQ;CACzB,CAAC,CAAC,CACJ,CAAC;AAaF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAiC,CAAC,EACzD,QAAQ,EACR,cAAc,GAAG,OAAO,EACxB,GAAG,aAAa,EACjB,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,CACtB,KAAC,eAAe,IAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAC,UAAU,GAAG,CACrE,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAI,eAAe,YAC7C,KAAC,YAAY,OAAK,aAAa,GAAI,GAC1B,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IViewerProps } from '../components/viewer/Viewer';
|
|
3
|
+
export interface ILazyViewerProps extends IViewerProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom fallback component while loading
|
|
6
|
+
*/
|
|
7
|
+
fallback?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Height of the skeleton loader
|
|
10
|
+
*/
|
|
11
|
+
skeletonHeight?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Lazy-loaded Viewer component with built-in Suspense boundary
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <LazyViewer
|
|
19
|
+
* nbformat={notebookContent}
|
|
20
|
+
* outputs={true}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const LazyViewer: React.FC<ILazyViewerProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Raw lazy Viewer component without Suspense boundary
|
|
27
|
+
*/
|
|
28
|
+
export declare const LazyViewerRaw: React.LazyExoticComponent<(props: IViewerProps) => import("react/jsx-runtime").JSX.Element>;
|
|
29
|
+
export default LazyViewer;
|