@datalayer/jupyter-react 0.8.1 → 0.8.3
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/LICENSE +1 -1
- package/README.md +3 -1
- package/lib/app/App.js +1 -1
- package/lib/app/App.js.map +1 -1
- package/lib/app/JupyterReact.js +8 -2
- package/lib/app/JupyterReact.js.map +1 -1
- package/lib/app/tabs/AboutTab.js +2 -5
- package/lib/app/tabs/AboutTab.js.map +1 -1
- package/lib/app/tabs/ComponentsTab.js +4 -4
- package/lib/app/tabs/ComponentsTab.js.map +1 -1
- package/lib/app/tabs/components/CellComponent.js +1 -1
- package/lib/app/tabs/components/CellComponent.js.map +1 -1
- package/lib/app/tabs/components/FileBrowserComponent.js +1 -1
- package/lib/app/tabs/components/FileBrowserComponent.js.map +1 -1
- package/lib/app/tabs/components/IPyWidgetsComponent.js +2 -2
- package/lib/app/tabs/components/IPyWidgetsComponent.js.map +1 -1
- package/lib/app/tabs/components/NotebookComponent.js +1 -1
- package/lib/app/tabs/components/NotebookComponent.js.map +1 -1
- package/lib/app/tabs/components/ViewerComponent.js +2 -2
- package/lib/app/tabs/components/ViewerComponent.js.map +1 -1
- package/lib/components/button/Button.d.ts +7 -0
- package/lib/components/button/Button.js +43 -0
- package/lib/components/button/Button.js.map +1 -0
- package/lib/components/cell/Cell.js +52 -33
- package/lib/components/cell/Cell.js.map +1 -1
- package/lib/components/cell/CellAdapter.d.ts +1 -0
- package/lib/components/cell/CellAdapter.js +57 -42
- package/lib/components/cell/CellAdapter.js.map +1 -1
- package/lib/components/cell/CellCommands.d.ts +2 -2
- package/lib/components/cell/CellCommands.js +10 -10
- package/lib/components/cell/CellCommands.js.map +1 -1
- package/lib/components/cell/CellRedux.d.ts +1 -1
- package/lib/components/cell/CellRedux.js +4 -4
- package/lib/components/cell/CellRedux.js.map +1 -1
- package/lib/components/cell/CellZustand.js +1 -1
- package/lib/components/codemirror/CodeMirrorEditor.js +8 -10
- package/lib/components/codemirror/CodeMirrorEditor.js.map +1 -1
- package/lib/components/codemirror/CodeMirrorOutputToolbar.js +20 -6
- package/lib/components/codemirror/CodeMirrorOutputToolbar.js.map +1 -1
- package/lib/components/codemirror/CodeMirrorTheme.d.ts +1 -1
- package/lib/components/codemirror/CodeMirrorTheme.js +12 -12
- package/lib/components/codemirror/CodeMirrorTheme.js.map +1 -1
- package/lib/components/commands/Commands.js +1 -1
- package/lib/components/commands/Commands.js.map +1 -1
- package/lib/components/commands/CommandsAdapter.css +1 -1
- package/lib/components/commands/CommandsAdapter.js +2 -2
- package/lib/components/commands/CommandsAdapter.js.map +1 -1
- package/lib/components/commands/CommandsState.js +7 -8
- package/lib/components/commands/CommandsState.js.map +1 -1
- package/lib/components/console/Console.css +1 -1
- package/lib/components/console/Console.js +2 -6
- package/lib/components/console/Console.js.map +1 -1
- package/lib/components/console/ConsoleAdapter.d.ts +1 -1
- package/lib/components/console/ConsoleAdapter.js +15 -15
- package/lib/components/console/ConsoleAdapter.js.map +1 -1
- package/lib/components/console/ConsoleRedux.js +6 -7
- package/lib/components/console/ConsoleRedux.js.map +1 -1
- package/lib/components/console/ConsoleZustand.js +1 -1
- package/lib/components/dialog/Dialog.js +1 -1
- package/lib/components/dialog/Dialog.js.map +1 -1
- package/lib/components/dialog/DialogAdapter.js +2 -5
- package/lib/components/dialog/DialogAdapter.js.map +1 -1
- package/lib/components/filebrowser/FileBrowser.js +3 -3
- package/lib/components/filebrowser/FileBrowser.js.map +1 -1
- package/lib/components/filemanager/FileManagerJupyterLab.js +4 -6
- package/lib/components/filemanager/FileManagerJupyterLab.js.map +1 -1
- package/lib/components/filemanager/FileManagerState.js +6 -7
- package/lib/components/filemanager/FileManagerState.js.map +1 -1
- package/lib/components/filemanager/lab/FileManagerAdapter.css +1 -1
- package/lib/components/filemanager/lab/FileManagerAdapter.js +29 -29
- package/lib/components/filemanager/lab/FileManagerAdapter.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabApp.d.ts +3 -3
- package/lib/components/jupyterlab/JupyterLabApp.js +19 -15
- package/lib/components/jupyterlab/JupyterLabApp.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabAppAdapter.d.ts +3 -3
- package/lib/components/jupyterlab/JupyterLabAppAdapter.js +5 -4
- package/lib/components/jupyterlab/JupyterLabAppAdapter.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabAppCss.d.ts +2 -2
- package/lib/components/jupyterlab/JupyterLabAppCss.js +2 -2
- package/lib/components/jupyterlab/JupyterLabAppCss.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabAppPlugins.js +2 -3
- package/lib/components/jupyterlab/JupyterLabAppPlugins.js.map +1 -1
- package/lib/components/notebook/Notebook.css +1 -1
- package/lib/components/notebook/Notebook.d.ts +1 -1
- package/lib/components/notebook/Notebook.js +19 -13
- package/lib/components/notebook/Notebook.js.map +1 -1
- package/lib/components/notebook/NotebookAdapter.d.ts +2 -2
- package/lib/components/notebook/NotebookAdapter.js +114 -91
- package/lib/components/notebook/NotebookAdapter.js.map +1 -1
- package/lib/components/notebook/NotebookCommands.d.ts +2 -3
- package/lib/components/notebook/NotebookCommands.js +123 -119
- package/lib/components/notebook/NotebookCommands.js.map +1 -1
- package/lib/components/notebook/NotebookRedux.d.ts +8 -8
- package/lib/components/notebook/NotebookRedux.js +44 -24
- package/lib/components/notebook/NotebookRedux.js.map +1 -1
- package/lib/components/notebook/NotebookZustand.js +1 -1
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.d.ts +1 -1
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.js +46 -47
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.js.map +1 -1
- package/lib/components/notebook/cell/metadata/NbGraderCells.d.ts +1 -1
- 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/prompt/Countdown.js +3 -3
- package/lib/components/notebook/cell/prompt/Countdown.js.map +1 -1
- package/lib/components/notebook/cell/prompt/CountdownInputPrompt.js +5 -5
- package/lib/components/notebook/cell/prompt/CountdownInputPrompt.js.map +1 -1
- package/lib/components/notebook/cell/prompt/CountdownOutputPrompt.js +4 -4
- package/lib/components/notebook/cell/prompt/CountdownOutputPrompt.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebar.js +51 -40
- package/lib/components/notebook/cell/sidebar/CellSidebar.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.js +16 -15
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarRun.js +13 -16
- package/lib/components/notebook/cell/sidebar/CellSidebarRun.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarWidget.js +2 -2
- package/lib/components/notebook/cell/sidebar/CellSidebarWidget.js.map +1 -1
- package/lib/components/notebook/content/JupyterReactContentFactory.js +3 -4
- package/lib/components/notebook/content/JupyterReactContentFactory.js.map +1 -1
- package/lib/components/notebook/marked/marked.js +3 -3
- package/lib/components/notebook/marked/marked.js.map +1 -1
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.d.ts +1 -1
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js +2 -2
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js.map +1 -1
- package/lib/components/output/Output.css +1 -1
- package/lib/components/output/Output.d.ts +3 -1
- package/lib/components/output/Output.js +49 -50
- package/lib/components/output/Output.js.map +1 -1
- package/lib/components/output/OutputAdapter.d.ts +3 -3
- package/lib/components/output/OutputAdapter.js +17 -14
- package/lib/components/output/OutputAdapter.js.map +1 -1
- package/lib/components/output/OutputIPyWidgets.css +1 -1
- package/lib/components/output/OutputIPyWidgets.js +2 -2
- package/lib/components/output/OutputIPyWidgets.js.map +1 -1
- package/lib/components/output/OutputRedux.js +4 -4
- package/lib/components/output/OutputRedux.js.map +1 -1
- package/lib/components/output/OutputRenderer.js +38 -19
- package/lib/components/output/OutputRenderer.js.map +1 -1
- package/lib/components/output/OutputZustand.js +1 -1
- package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsAttached.js +1 -1
- package/lib/components/output/ipywidgets/IPyWidgetsAttached.js.map +1 -0
- package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsViewManager.js +1 -1
- package/lib/components/output/ipywidgets/IPyWidgetsViewManager.js.map +1 -0
- package/lib/components/settings/Settings.js +2 -2
- package/lib/components/settings/Settings.js.map +1 -1
- package/lib/components/settings/SettingsAdapter.css +1 -2
- package/lib/components/settings/SettingsAdapter.js +1 -1
- package/lib/components/settings/SettingsAdapter.js.map +1 -1
- package/lib/components/settings/SettingsRedux.js +6 -7
- package/lib/components/settings/SettingsRedux.js.map +1 -1
- package/lib/components/settings/SettingsZustand.js +1 -1
- package/lib/components/terminal/Terminal.d.ts +1 -1
- package/lib/components/terminal/Terminal.js +9 -13
- package/lib/components/terminal/Terminal.js.map +1 -1
- package/lib/components/terminal/TerminalAdapter.js +5 -5
- package/lib/components/terminal/TerminalAdapter.js.map +1 -1
- package/lib/components/terminal/TerminalRedux.d.ts +1 -1
- package/lib/components/terminal/TerminalRedux.js +5 -6
- package/lib/components/terminal/TerminalRedux.js.map +1 -1
- package/lib/components/terminal/TerminalZustand.js +1 -1
- package/lib/components/textinput/TextInput.d.ts +7 -0
- package/lib/components/textinput/TextInput.js +23 -0
- package/lib/components/textinput/TextInput.js.map +1 -0
- package/lib/components/viewer/Viewer.js +1 -1
- package/lib/components/viewer/Viewer.js.map +1 -1
- package/lib/components/viewer/input/CodemirrorView.d.ts +1 -1
- package/lib/components/viewer/input/CodemirrorView.js +10 -13
- package/lib/components/viewer/input/CodemirrorView.js.map +1 -1
- package/lib/components/viewer/input/CodemirrorViewer.js +6 -6
- package/lib/components/viewer/input/CodemirrorViewer.js.map +1 -1
- package/lib/components/viewer/input/InputViewer.js +21 -19
- package/lib/components/viewer/input/InputViewer.js.map +1 -1
- package/lib/components/viewer/output/OutputAdapter.js +4 -3
- package/lib/components/viewer/output/OutputAdapter.js.map +1 -1
- package/lib/components/viewer/output/OutputViewer.js.map +1 -1
- package/lib/examples/All.js +24 -23
- package/lib/examples/All.js.map +1 -1
- package/lib/examples/Bokeh.js +4 -4
- package/lib/examples/Bokeh.js.map +1 -1
- package/lib/examples/Bqplot.js +4 -6
- package/lib/examples/Bqplot.js.map +1 -1
- package/lib/examples/Cell.js +1 -1
- package/lib/examples/Cell.js.map +1 -1
- package/lib/examples/Cells.js +1 -1
- package/lib/examples/Cells.js.map +1 -1
- package/lib/examples/Console.js +1 -1
- package/lib/examples/Console.js.map +1 -1
- package/lib/examples/ConsoleLite.js +1 -1
- package/lib/examples/ConsoleLite.js.map +1 -1
- package/lib/examples/Dashboard.js +5 -5
- package/lib/examples/Dashboard.js.map +1 -1
- package/lib/examples/FileBrowser.js +2 -2
- package/lib/examples/FileBrowser.js.map +1 -1
- package/lib/examples/GeoJson.js +4 -6
- package/lib/examples/GeoJson.js.map +1 -1
- package/lib/examples/IPyLeaflet.js +5 -5
- package/lib/examples/IPyLeaflet.js.map +1 -1
- package/lib/examples/IPyReact.js +5 -5
- package/lib/examples/IPyReact.js.map +1 -1
- package/lib/examples/IPyWidgets.js +5 -5
- package/lib/examples/IPyWidgets.js.map +1 -1
- package/lib/examples/IPyWidgetsWithState.js +19 -0
- package/lib/examples/IPyWidgetsWithState.js.map +1 -0
- package/lib/examples/JupyterLabApp.js +7 -7
- package/lib/examples/JupyterLabApp.js.map +1 -1
- package/lib/examples/JupyterLabHeadlessApp.js +14 -20
- package/lib/examples/JupyterLabHeadlessApp.js.map +1 -1
- package/lib/examples/KernelExecutor.js +45 -0
- package/lib/examples/KernelExecutor.js.map +1 -0
- package/lib/examples/Lumino.js +2 -2
- package/lib/examples/Lumino.js.map +1 -1
- package/lib/examples/Matplotlib.js +11 -7
- package/lib/examples/Matplotlib.js.map +1 -1
- package/lib/examples/Notebook.js +13 -8
- package/lib/examples/Notebook.js.map +1 -1
- package/lib/examples/NotebookCellSidebar.js +8 -8
- package/lib/examples/NotebookCellSidebar.js.map +1 -1
- package/lib/examples/NotebookColorMode.d.ts +1 -0
- package/lib/examples/NotebookColorMode.js +41 -0
- package/lib/examples/NotebookColorMode.js.map +1 -0
- package/lib/examples/NotebookExternalContent.js +16 -19
- package/lib/examples/NotebookExternalContent.js.map +1 -1
- package/lib/examples/NotebookInit.js +11 -14
- package/lib/examples/NotebookInit.js.map +1 -1
- package/lib/examples/NotebookInjectableReduxStore.js +9 -9
- package/lib/examples/NotebookInjectableReduxStore.js.map +1 -1
- package/lib/examples/NotebookKernelChange.js +4 -4
- package/lib/examples/NotebookKernelChange.js.map +1 -1
- package/lib/examples/NotebookModelChange.js +9 -9
- package/lib/examples/NotebookModelChange.js.map +1 -1
- package/lib/examples/NotebookNbFormat.d.ts +1 -0
- package/lib/examples/NotebookNbFormat.js +23 -0
- package/lib/examples/NotebookNbFormat.js.map +1 -0
- package/lib/examples/NotebookPath.js +7 -7
- package/lib/examples/NotebookPath.js.map +1 -1
- package/lib/examples/NotebookPathChange.js +7 -7
- package/lib/examples/NotebookPathChange.js.map +1 -1
- package/lib/examples/NotebookTheme.d.ts +1 -0
- package/lib/examples/NotebookTheme.js +41 -0
- package/lib/examples/NotebookTheme.js.map +1 -0
- package/lib/examples/NotebookUnmount.js +9 -12
- package/lib/examples/NotebookUnmount.js.map +1 -1
- package/lib/examples/Output.js +11 -13
- package/lib/examples/Output.js.map +1 -1
- package/lib/examples/OutputIPyWidgets.js +1 -1
- package/lib/examples/OutputIPyWidgets.js.map +1 -1
- package/lib/examples/Outputs.js +4 -5
- package/lib/examples/Outputs.js.map +1 -1
- package/lib/examples/Panel.js +4 -4
- package/lib/examples/Panel.js.map +1 -1
- package/lib/examples/Plotly.js +4 -4
- package/lib/examples/Plotly.js.map +1 -1
- package/lib/examples/RunningSessions.js +4 -5
- package/lib/examples/RunningSessions.js.map +1 -1
- package/lib/examples/Terminal.js +3 -3
- package/lib/examples/Terminal.js.map +1 -1
- package/lib/examples/Vega.js +4 -6
- package/lib/examples/Vega.js.map +1 -1
- package/lib/examples/Viewer.js +20 -20
- package/lib/examples/Viewer.js.map +1 -1
- package/lib/examples/ViewerFile.js +1 -1
- package/lib/examples/ViewerFile.js.map +1 -1
- package/lib/examples/lumino/LuminoWidget.d.ts +1 -1
- package/lib/examples/lumino/LuminoWidget.js +3 -8
- package/lib/examples/lumino/LuminoWidget.js.map +1 -1
- package/lib/examples/notebooks/DashboardExample.exclude.json +96 -379
- package/lib/examples/notebooks/{IPyWidgetsExample1.ipynb.json → IPyWidgetsExample.ipynb.json} +8 -17
- package/lib/examples/notebooks/IPyWidgetsExampleWithState.ipynb.json +88 -0
- package/lib/examples/notebooks/IPyWidgetsOutputMatplotlib.exclude.d.ts +4 -4
- package/lib/examples/notebooks/IPyWidgetsOutputMatplotlib.exclude.js +53 -81
- package/lib/examples/notebooks/IPyWidgetsOutputMatplotlib.exclude.js.map +1 -1
- package/lib/examples/notebooks/Matplotlib.ipynb.json +20 -52
- package/lib/examples/notebooks/NotebookExample1.ipynb.json +4 -12
- package/lib/examples/notebooks/NotebookExample2.ipynb.json +2 -6
- package/lib/examples/notebooks/OutputIPyWidgetsExample.d.ts +7 -7
- package/lib/examples/notebooks/OutputIPyWidgetsExample.js +134 -134
- package/lib/examples/notebooks/OutputIPyWidgetsExample.js.map +1 -1
- package/lib/examples/sidebars/CellSidebarSource.js +54 -41
- package/lib/examples/sidebars/CellSidebarSource.js.map +1 -1
- package/lib/examples/state/ExampleReduxState.js +5 -6
- package/lib/examples/state/ExampleReduxState.js.map +1 -1
- package/lib/examples/toolbars/NotebookToolbar.js +16 -8
- package/lib/examples/toolbars/NotebookToolbar.js.map +1 -1
- package/lib/examples/toolbars/NotebookToolbarAutoSave.js +14 -14
- package/lib/examples/toolbars/NotebookToolbarAutoSave.js.map +1 -1
- package/lib/examples/toolbars/NotebookToolbarStatus.js +2 -2
- package/lib/examples/toolbars/NotebookToolbarStatus.js.map +1 -1
- package/lib/index.css +1 -2
- package/lib/index.d.ts +7 -4
- package/lib/index.js +10 -5
- package/lib/index.js.map +1 -1
- package/lib/jupyter/Jupyter.d.ts +1068 -3
- package/lib/jupyter/Jupyter.js +11 -9
- package/lib/jupyter/Jupyter.js.map +1 -1
- package/lib/jupyter/JupyterAuthError.js +1 -1
- package/lib/jupyter/JupyterConfig.js +27 -10
- package/lib/jupyter/JupyterConfig.js.map +1 -1
- package/lib/jupyter/JupyterContext.d.ts +2 -4
- package/lib/jupyter/JupyterContext.js +27 -23
- package/lib/jupyter/JupyterContext.js.map +1 -1
- package/lib/jupyter/JupyterHandlers.js +1 -1
- package/lib/jupyter/JupyterHandlers.js.map +1 -1
- package/lib/jupyter/ipywidgets/{lab → cache}/semvercache.js +3 -1
- package/lib/jupyter/ipywidgets/cache/semvercache.js.map +1 -0
- package/lib/jupyter/ipywidgets/classic/IPyWidgetsClassicManager.d.ts +32 -0
- package/lib/jupyter/ipywidgets/classic/IPyWidgetsClassicManager.js +185 -0
- package/lib/jupyter/ipywidgets/classic/IPyWidgetsClassicManager.js.map +1 -0
- package/lib/jupyter/ipywidgets/lab/manager.d.ts +13 -12
- package/lib/jupyter/ipywidgets/lab/manager.js +50 -33
- package/lib/jupyter/ipywidgets/lab/manager.js.map +1 -1
- package/lib/jupyter/ipywidgets/lab/output.d.ts +4 -4
- package/lib/jupyter/ipywidgets/lab/output.js +8 -8
- package/lib/jupyter/ipywidgets/lab/output.js.map +1 -1
- package/lib/jupyter/ipywidgets/lab/plugin.d.ts +10 -8
- package/lib/jupyter/ipywidgets/lab/plugin.js +70 -55
- package/lib/jupyter/ipywidgets/lab/plugin.js.map +1 -1
- package/lib/jupyter/ipywidgets/lab/renderer.d.ts +3 -3
- package/lib/jupyter/ipywidgets/lab/renderer.js +1 -1
- package/lib/jupyter/ipywidgets/lab/renderer.js.map +1 -1
- package/lib/jupyter/ipywidgets/plotly/Figure.d.ts +2 -2
- package/lib/jupyter/ipywidgets/plotly/Figure.js +172 -169
- package/lib/jupyter/ipywidgets/plotly/Figure.js.map +1 -1
- package/lib/jupyter/ipywidgets/plotly/JupyterlabPlugin.d.ts +1 -1
- package/lib/jupyter/ipywidgets/plotly/JupyterlabPlugin.js +3 -3
- package/lib/jupyter/ipywidgets/plotly/Version.js +1 -1
- package/lib/jupyter/ipywidgets/plotly/index.js +1 -1
- package/lib/jupyter/kernel/Kernel.d.ts +2 -0
- package/lib/jupyter/kernel/Kernel.js +19 -11
- package/lib/jupyter/kernel/Kernel.js.map +1 -1
- package/lib/jupyter/kernel/KernelExecutor.d.ts +28 -0
- package/lib/jupyter/kernel/KernelExecutor.js +115 -0
- package/lib/jupyter/kernel/KernelExecutor.js.map +1 -0
- package/lib/jupyter/lab/JupyterLabCss.d.ts +2 -2
- package/lib/jupyter/lab/JupyterLabCss.js +19 -19
- package/lib/jupyter/lab/JupyterLabCss.js.map +1 -1
- package/lib/jupyter/lab/JupyterLabCssImports.d.ts +16 -16
- package/lib/jupyter/lab/JupyterLabCssImports.js +17 -17
- package/lib/jupyter/lab/JupyterLabCssImports.js.map +1 -1
- package/lib/jupyter/lab/JupyterLabTheme.d.ts +1 -1
- package/lib/jupyter/lab/JupyterLabTheme.js +1 -1
- package/lib/jupyter/lab/__tests__/datalayer.spec.js +1 -1
- package/lib/jupyter/lab/index.js +8 -10
- package/lib/jupyter/lab/index.js.map +1 -1
- package/lib/jupyter/lab/notebook/content/CountdownContentFactory.js +1 -1
- package/lib/jupyter/lab/notebook/content/CountdownContentFactory.js.map +1 -1
- package/lib/jupyter/lab/notebook/content/plugin.js +2 -2
- package/lib/jupyter/lab/notebook/content/plugin.js.map +1 -1
- package/lib/jupyter/lab/notebook/index.js +1 -1
- package/lib/jupyter/lab/widget.js.map +1 -1
- package/lib/jupyter/lite/LiteServer.js +16 -16
- package/lib/jupyter/lite/LiteServer.js.map +1 -1
- package/lib/jupyter/lumino/Lumino.js +3 -3
- package/lib/jupyter/lumino/Lumino.js.map +1 -1
- package/lib/jupyter/lumino/LuminoBox.js +3 -3
- package/lib/jupyter/lumino/LuminoBox.js.map +1 -1
- package/lib/jupyter/lumino/LuminoDetached.js +1 -1
- package/lib/jupyter/lumino/LuminoObservable.d.ts +2 -2
- package/lib/jupyter/lumino/LuminoObservable.js +3 -3
- package/lib/jupyter/lumino/LuminoObservable.js.map +1 -1
- package/lib/jupyter/lumino/LuminoRedux.js +1 -1
- package/lib/jupyter/lumino/ReactPortalWidget.js +1 -1
- package/lib/jupyter/lumino/ReactPortalWidget.js.map +1 -1
- package/lib/jupyter/renderers/index.js +1 -1
- package/lib/jupyter/renderers/plotly/PlotlyRenderer.d.ts +4 -4
- package/lib/jupyter/renderers/plotly/PlotlyRenderer.js +38 -38
- package/lib/jupyter/renderers/plotly/PlotlyRenderer.js.map +1 -1
- package/lib/jupyter/renderers/plotly/plotly.css +1 -1
- package/lib/jupyter/services/Services.js +1 -1
- package/lib/jupyter/services/Services.js.map +1 -1
- package/lib/jupyter/theme.d.ts +7 -1034
- package/lib/jupyter/theme.js +586 -38
- package/lib/jupyter/theme.js.map +1 -1
- package/lib/state/index.js +1 -1
- package/lib/state/redux/InitState.js +5 -6
- package/lib/state/redux/InitState.js.map +1 -1
- package/lib/state/redux/State.d.ts +5 -5
- package/lib/state/redux/State.js +8 -8
- package/lib/state/redux/State.js.map +1 -1
- package/lib/state/redux/Store.d.ts +1 -1
- package/lib/state/redux/Store.js +4 -4
- package/lib/state/redux/Store.js.map +1 -1
- package/lib/utils/Utils.js +5 -5
- package/lib/utils/Utils.js.map +1 -1
- package/package.json +33 -18
- package/style/base.css +1 -2
- package/style/index.css +1 -1
- package/style/index.js +1 -1
- package/lib/examples/NotebookModel.js +0 -23
- package/lib/examples/NotebookModel.js.map +0 -1
- package/lib/examples/NotebookThemed.js +0 -52
- package/lib/examples/NotebookThemed.js.map +0 -1
- package/lib/jupyter/ipywidgets/IPyWidgetsAttached.js.map +0 -1
- package/lib/jupyter/ipywidgets/IPyWidgetsManager.d.ts +0 -19
- package/lib/jupyter/ipywidgets/IPyWidgetsManager.js +0 -82
- package/lib/jupyter/ipywidgets/IPyWidgetsManager.js.map +0 -1
- package/lib/jupyter/ipywidgets/IPyWidgetsViewManager.js.map +0 -1
- package/lib/jupyter/ipywidgets/lab/semvercache.js.map +0 -1
- package/lib/jupyter/kernel/KernelModel.d.ts +0 -18
- package/lib/jupyter/kernel/KernelModel.js +0 -57
- package/lib/jupyter/kernel/KernelModel.js.map +0 -1
- /package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsAttached.d.ts +0 -0
- /package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsViewManager.d.ts +0 -0
- /package/lib/examples/{NotebookModel.d.ts → IPyWidgetsWithState.d.ts} +0 -0
- /package/lib/examples/{NotebookThemed.d.ts → KernelExecutor.d.ts} +0 -0
- /package/lib/jupyter/ipywidgets/{lab → cache}/semvercache.d.ts +0 -0
package/lib/jupyter/Jupyter.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
6
6
|
*/
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
|
-
import { ThemeProvider, BaseStyles, Box } from
|
|
8
|
+
import { ThemeProvider, BaseStyles, Box, theme as primerTheme } from '@primer/react';
|
|
9
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
10
10
|
import { JupyterContextProvider } from './JupyterContext';
|
|
11
|
-
import JupyterLabCss from './lab/JupyterLabCss';
|
|
12
|
-
import { getJupyterServerHttpUrl, getJupyterServerWsUrl, loadJupyterConfig } from './JupyterConfig';
|
|
13
11
|
import defaultInjectableStore from '../state/redux/Store';
|
|
14
|
-
import
|
|
12
|
+
import JupyterLabCss from './lab/JupyterLabCss';
|
|
13
|
+
import { getJupyterServerHttpUrl, getJupyterServerWsUrl, loadJupyterConfig, } from './JupyterConfig';
|
|
15
14
|
/**
|
|
16
15
|
* The component to be used as fallback in case of error.
|
|
17
16
|
*/
|
|
18
17
|
const ErrorFallback = ({ error, resetErrorBoundary }) => {
|
|
19
|
-
return (_jsxs("div", { role: "alert", children: [_jsx("p", { children: "Oops, something went wrong." }), _jsx("pre", { children: error.message }), _jsx("div", { style: { visibility:
|
|
18
|
+
return (_jsxs("div", { role: "alert", children: [_jsx("p", { children: "Oops, something went wrong." }), _jsx("pre", { children: error.message }), _jsx("div", { style: { visibility: 'hidden' }, children: _jsx("button", { onClick: resetErrorBoundary, children: "Try again" }) })] }));
|
|
20
19
|
};
|
|
21
20
|
/**
|
|
22
21
|
* The Jupyter context. This handles the needed initialization
|
|
@@ -24,20 +23,23 @@ const ErrorFallback = ({ error, resetErrorBoundary }) => {
|
|
|
24
23
|
* are available.
|
|
25
24
|
*/
|
|
26
25
|
export const Jupyter = (props) => {
|
|
27
|
-
const {
|
|
26
|
+
const { children, collaborative, colorMode, defaultKernelName, disableCssLoading, injectableStore, lite, startDefaultKernel, theme, useRunningKernelId, useRunningKernelIndex, } = props;
|
|
28
27
|
const config = useMemo(() => {
|
|
29
28
|
return loadJupyterConfig(props);
|
|
30
29
|
}, [props]);
|
|
31
|
-
return (_jsx(ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: () => {
|
|
30
|
+
return (_jsx(ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: () => {
|
|
31
|
+
console.log('Error Boundary reset has been invoked...');
|
|
32
|
+
}, children: _jsx(ThemeProvider, { theme: theme ?? primerTheme, colorMode: colorMode === 'light' ? 'day' : 'night', dayScheme: "light", nightScheme: "dark", children: _jsx(BaseStyles, { children: _jsxs(Box, { color: "fg.default", bg: "canvas.default", children: [!config.insideJupyterLab && !disableCssLoading && (_jsx(JupyterLabCss, { colorMode: colorMode })), _jsx(JupyterContextProvider, { baseUrl: getJupyterServerHttpUrl(), collaborative: collaborative, defaultKernelName: defaultKernelName, disableCssLoading: disableCssLoading, injectableStore: injectableStore || defaultInjectableStore, lite: lite, startDefaultKernel: startDefaultKernel, useRunningKernelId: useRunningKernelId, useRunningKernelIndex: useRunningKernelIndex ?? -1, variant: "default", wsUrl: getJupyterServerWsUrl(), children: children })] }) }) }) }));
|
|
32
33
|
};
|
|
33
34
|
Jupyter.defaultProps = {
|
|
34
35
|
collaborative: false,
|
|
36
|
+
colorMode: 'light',
|
|
35
37
|
defaultKernelName: 'python',
|
|
36
38
|
disableCssLoading: false,
|
|
37
39
|
lite: false,
|
|
38
40
|
startDefaultKernel: true,
|
|
39
41
|
terminals: false,
|
|
40
|
-
theme:
|
|
42
|
+
theme: primerTheme,
|
|
41
43
|
useRunningKernelIndex: -1,
|
|
42
44
|
};
|
|
43
45
|
export default Jupyter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Jupyter.js","sourceRoot":"","sources":["../../src/jupyter/Jupyter.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Jupyter.js","sourceRoot":"","sources":["../../src/jupyter/Jupyter.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAErF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,sBAA2C,MAAM,sBAAsB,CAAC;AAC/E,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,i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D,KAAC,aAAa,IAAC,SAAS,EAAE,SAAS,GAAI,CACxC,EACD,KAAC,sBAAsB,IACrB,OAAO,EAAE,uBAAuB,EAAE,EAClC,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,eAAe,IAAI,sBAAsB,EAC1D,IAAI,EAAE,IAAI,EACV,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,EACtC,qBAAqB,EAAE,qBAAqB,IAAI,CAAC,CAAC,EAClD,OAAO,EAAC,SAAS,EACjB,KAAK,EAAE,qBAAqB,EAAE,YAE7B,QAAQ,GACc,IACrB,GACK,GACC,GACF,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,CAAC,YAAY,GAAG;IACrB,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,OAAO;IAClB,iBAAiB,EAAE,QAAQ;IAC3B,iBAAiB,EAAE,KAAK;IACxB,IAAI,EAAE,KAAK;IACX,kBAAkB,EAAE,IAAI;IACxB,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,WAAW;IAClB,qBAAqB,EAAE,CAAC,CAAC;CAC1B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
@@ -49,12 +49,19 @@ export const getJupyterToken = () => config.jupyterToken;
|
|
|
49
49
|
* host HTML page.
|
|
50
50
|
*/
|
|
51
51
|
export const loadJupyterConfig = (props) => {
|
|
52
|
-
const { lite, jupyterServerHttpUrl, jupyterServerWsUrl, collaborative, terminals, jupyterToken } = props;
|
|
52
|
+
const { lite, jupyterServerHttpUrl, jupyterServerWsUrl, collaborative, terminals, jupyterToken, } = props;
|
|
53
53
|
const datalayerConfigData = document.getElementById('datalayer-config-data');
|
|
54
54
|
if (datalayerConfigData) {
|
|
55
55
|
config = JSON.parse(datalayerConfigData.textContent || '');
|
|
56
|
-
setJupyterServerHttpUrl(jupyterServerHttpUrl ??
|
|
57
|
-
|
|
56
|
+
setJupyterServerHttpUrl(jupyterServerHttpUrl ??
|
|
57
|
+
config.jupyterServerHttpUrl ??
|
|
58
|
+
location.protocol + '//' + location.host + '/api/jupyter');
|
|
59
|
+
setJupyterServerWsUrl(jupyterServerWsUrl ??
|
|
60
|
+
config.jupyterServerWsUrl ??
|
|
61
|
+
location.protocol.replace('http', 'ws') +
|
|
62
|
+
'//' +
|
|
63
|
+
location.host +
|
|
64
|
+
'/api/jupyter');
|
|
58
65
|
setJupyterToken(jupyterToken ?? config.jupyterToken ?? '');
|
|
59
66
|
}
|
|
60
67
|
else {
|
|
@@ -62,21 +69,31 @@ export const loadJupyterConfig = (props) => {
|
|
|
62
69
|
const jupyterConfigData = document.getElementById('jupyter-config-data');
|
|
63
70
|
if (jupyterConfigData) {
|
|
64
71
|
const jupyterConfig = JSON.parse(jupyterConfigData.textContent || '');
|
|
65
|
-
setJupyterServerHttpUrl(jupyterServerHttpUrl ??
|
|
66
|
-
|
|
72
|
+
setJupyterServerHttpUrl(jupyterServerHttpUrl ??
|
|
73
|
+
location.protocol + '//' + location.host + jupyterConfig.baseUrl);
|
|
74
|
+
setJupyterServerWsUrl(jupyterServerWsUrl ?? location.protocol === 'https'
|
|
75
|
+
? 'wss://' + location.host
|
|
76
|
+
: 'ws://' + location.host + jupyterConfig.baseUrl);
|
|
67
77
|
setJupyterToken(jupyterToken ?? jupyterConfig.token);
|
|
68
78
|
config.insideJupyterLab = jupyterConfig.appName === 'JupyterLab';
|
|
69
79
|
}
|
|
70
80
|
else {
|
|
71
81
|
// No Datalayer and no JupyterLab Config.
|
|
72
|
-
setJupyterServerHttpUrl(jupyterServerHttpUrl ??
|
|
73
|
-
|
|
82
|
+
setJupyterServerHttpUrl(jupyterServerHttpUrl ??
|
|
83
|
+
location.protocol + '//' + location.host + '/api/jupyter');
|
|
84
|
+
setJupyterServerWsUrl(jupyterServerWsUrl ??
|
|
85
|
+
location.protocol.replace('http', 'ws') +
|
|
86
|
+
'//' +
|
|
87
|
+
location.host +
|
|
88
|
+
'/api/jupyter');
|
|
74
89
|
setJupyterToken(jupyterToken ?? '');
|
|
75
90
|
}
|
|
76
91
|
}
|
|
77
92
|
if (lite) {
|
|
78
93
|
setJupyterServerHttpUrl(location.protocol + '//' + location.host);
|
|
79
|
-
setJupyterServerWsUrl(location.protocol ===
|
|
94
|
+
setJupyterServerWsUrl(location.protocol === 'https'
|
|
95
|
+
? 'wss://' + location.host
|
|
96
|
+
: 'ws://' + location.host);
|
|
80
97
|
}
|
|
81
98
|
PageConfig.setOption('baseUrl', getJupyterServerHttpUrl());
|
|
82
99
|
PageConfig.setOption('wsUrl', getJupyterServerWsUrl());
|
|
@@ -90,7 +107,7 @@ export const loadJupyterConfig = (props) => {
|
|
|
90
107
|
// PageConfig.getOption('hubPrefix')
|
|
91
108
|
// PageConfig.getOption('hubUser')
|
|
92
109
|
// PageConfig.getOption('hubServerName')
|
|
93
|
-
config.insideJupyterHub = PageConfig.getOption('hubHost') !==
|
|
110
|
+
config.insideJupyterHub = PageConfig.getOption('hubHost') !== '';
|
|
94
111
|
return config;
|
|
95
112
|
};
|
|
96
113
|
//# sourceMappingURL=JupyterConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JupyterConfig.js","sourceRoot":"","sources":["../../src/jupyter/JupyterConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAcnD;;GAEG;AACH,IAAI,MAAM,GAAmB;IAC3B,oBAAoB,EAAE,EAAE;IACxB,kBAAkB,EAAE,EAAE;IACtB,YAAY,EAAE,EAAE;IAChB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;CACxB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AyB,CAAC,CAAC;IACjE,mCAAmC;IACnC,qCAAqC;IACrC,mCAAmC;IACnC,yCAAyC;IACzC,MAAM,CAAC,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACjE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { ServiceManager, ServerConnection, KernelManager } from '@jupyterlab/services';
|
|
3
3
|
import { InjectableStore } from '../state/redux/Store';
|
|
4
4
|
import Kernel from './kernel/Kernel';
|
|
5
|
-
|
|
6
|
-
/**
|
|
5
|
+
/**Fré
|
|
7
6
|
* The type for the Jupyter context.
|
|
8
7
|
*/
|
|
9
8
|
export type JupyterContextType = {
|
|
@@ -47,7 +46,6 @@ type JupyterContextProps = {
|
|
|
47
46
|
injectableStore: InjectableStore;
|
|
48
47
|
lite?: boolean;
|
|
49
48
|
startDefaultKernel: boolean;
|
|
50
|
-
theme: JupyterLabTheme;
|
|
51
49
|
useRunningKernelId?: string;
|
|
52
50
|
useRunningKernelIndex: number;
|
|
53
51
|
variant: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
6
6
|
*/
|
|
7
|
-
import { useState, useEffect, useContext, createContext } from
|
|
8
|
-
import { Provider as ReduxProvider } from
|
|
9
|
-
import { ServiceManager, ServerConnection } from '@jupyterlab/services';
|
|
7
|
+
import { useState, useEffect, useContext, createContext } from 'react';
|
|
8
|
+
import { Provider as ReduxProvider } from 'react-redux';
|
|
9
|
+
import { ServiceManager, ServerConnection, } from '@jupyterlab/services';
|
|
10
10
|
import { getJupyterServerHttpUrl, getJupyterToken } from './JupyterConfig';
|
|
11
11
|
import { requestAPI } from './JupyterHandlers';
|
|
12
12
|
import { startLiteServer } from './../jupyter/lite/LiteServer';
|
|
@@ -18,7 +18,7 @@ export const JupyterContext = createContext(undefined);
|
|
|
18
18
|
export const useJupyter = () => {
|
|
19
19
|
const context = useContext(JupyterContext);
|
|
20
20
|
if (!context)
|
|
21
|
-
throw new Error(
|
|
21
|
+
throw new Error('useContext must be inside a provider with a value.');
|
|
22
22
|
return context;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
@@ -34,7 +34,8 @@ const JupyterProvider = JupyterContext.Provider;
|
|
|
34
34
|
* with the Jupyter server.
|
|
35
35
|
*/
|
|
36
36
|
export const ensureJupyterAuth = (serverSettings) => {
|
|
37
|
-
return requestAPI(serverSettings, 'api', '')
|
|
37
|
+
return requestAPI(serverSettings, 'api', '')
|
|
38
|
+
.then(data => {
|
|
38
39
|
return true;
|
|
39
40
|
})
|
|
40
41
|
.catch(reason => {
|
|
@@ -61,14 +62,14 @@ export const createServerSettings = (baseUrl, wsUrl) => {
|
|
|
61
62
|
credentials: 'include',
|
|
62
63
|
cache: 'no-cache',
|
|
63
64
|
// headers,
|
|
64
|
-
}
|
|
65
|
+
},
|
|
65
66
|
});
|
|
66
67
|
};
|
|
67
68
|
/**
|
|
68
69
|
* The Jupyter context provider.
|
|
69
70
|
*/
|
|
70
|
-
export const JupyterContextProvider =
|
|
71
|
-
const {
|
|
71
|
+
export const JupyterContextProvider = props => {
|
|
72
|
+
const { baseUrl, children, collaborative, defaultKernelName, disableCssLoading, injectableStore, lite, startDefaultKernel, useRunningKernelId, useRunningKernelIndex, variant, wsUrl, } = props;
|
|
72
73
|
const [_, setVariant] = useState('default');
|
|
73
74
|
const [serverSettings] = useState(createServerSettings(baseUrl ?? '', wsUrl ?? ''));
|
|
74
75
|
const [serviceManager, setServiceManager] = useState();
|
|
@@ -78,20 +79,21 @@ export const JupyterContextProvider = (props) => {
|
|
|
78
79
|
if (lite) {
|
|
79
80
|
startLiteServer().then((serviceManager) => {
|
|
80
81
|
setServiceManager(serviceManager);
|
|
81
|
-
const kernelManager = serviceManager.sessions
|
|
82
|
+
const kernelManager = serviceManager.sessions
|
|
83
|
+
._kernelManager;
|
|
82
84
|
setKernelManager(kernelManager);
|
|
83
85
|
kernelManager.ready.then(() => {
|
|
84
|
-
console.log('Kernel Manager is
|
|
86
|
+
console.log('Kernel Manager is Ready', kernelManager);
|
|
85
87
|
if (startDefaultKernel) {
|
|
86
88
|
const kernel = new Kernel({
|
|
87
89
|
kernelManager,
|
|
88
90
|
kernelName: defaultKernelName,
|
|
89
91
|
kernelSpecName: defaultKernelName,
|
|
90
|
-
kernelType:
|
|
92
|
+
kernelType: 'notebook',
|
|
91
93
|
serverSettings,
|
|
92
94
|
});
|
|
93
95
|
kernel.ready.then(() => {
|
|
94
|
-
console.log('Lite Kernel is
|
|
96
|
+
console.log('Lite Kernel is Ready', kernel.toString());
|
|
95
97
|
setKernel(kernel);
|
|
96
98
|
});
|
|
97
99
|
}
|
|
@@ -106,17 +108,19 @@ export const JupyterContextProvider = (props) => {
|
|
|
106
108
|
window.location.replace(loginUrl);
|
|
107
109
|
}
|
|
108
110
|
if (useRunningKernelId && useRunningKernelIndex > -1) {
|
|
109
|
-
throw new Error(
|
|
111
|
+
throw new Error('You can not ask for useRunningKernelId and useRunningKernelIndex at the same time.');
|
|
110
112
|
}
|
|
111
|
-
if (startDefaultKernel &&
|
|
112
|
-
|
|
113
|
+
if (startDefaultKernel &&
|
|
114
|
+
(useRunningKernelId || useRunningKernelIndex > -1)) {
|
|
115
|
+
throw new Error('You can not ask for startDefaultKernel and (useRunningKernelId or useRunningKernelIndex) at the same time.');
|
|
113
116
|
}
|
|
114
117
|
const serviceManager = new ServiceManager({ serverSettings });
|
|
115
118
|
setServiceManager(serviceManager);
|
|
116
|
-
const kernelManager = serviceManager.sessions
|
|
119
|
+
const kernelManager = serviceManager.sessions
|
|
120
|
+
._kernelManager;
|
|
117
121
|
setKernelManager(kernelManager);
|
|
118
122
|
kernelManager.ready.then(() => {
|
|
119
|
-
console.log('
|
|
123
|
+
console.log('Kernel Manager is Ready.');
|
|
120
124
|
/*
|
|
121
125
|
const running = kernelManager.running();
|
|
122
126
|
let kernel = running.next();
|
|
@@ -138,7 +142,7 @@ export const JupyterContextProvider = (props) => {
|
|
|
138
142
|
kernelName: defaultKernelName,
|
|
139
143
|
kernelSpecName: defaultKernelName,
|
|
140
144
|
kernelModel: kernel.value,
|
|
141
|
-
kernelType:
|
|
145
|
+
kernelType: 'notebook',
|
|
142
146
|
serverSettings,
|
|
143
147
|
}));
|
|
144
148
|
break;
|
|
@@ -148,16 +152,16 @@ export const JupyterContextProvider = (props) => {
|
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
else if (startDefaultKernel) {
|
|
151
|
-
console.log('Starting Kernel', defaultKernelName);
|
|
155
|
+
console.log('Starting Kernel Name:', defaultKernelName);
|
|
152
156
|
const defaultKernel = new Kernel({
|
|
153
157
|
kernelManager,
|
|
154
158
|
kernelName: defaultKernelName,
|
|
155
159
|
kernelSpecName: defaultKernelName,
|
|
156
|
-
kernelType:
|
|
160
|
+
kernelType: 'notebook',
|
|
157
161
|
serverSettings,
|
|
158
162
|
});
|
|
159
163
|
defaultKernel.ready.then(() => {
|
|
160
|
-
console.log(
|
|
164
|
+
console.log('Kernel is Ready', defaultKernel);
|
|
161
165
|
setKernel(defaultKernel);
|
|
162
166
|
});
|
|
163
167
|
}
|
|
@@ -165,7 +169,7 @@ export const JupyterContextProvider = (props) => {
|
|
|
165
169
|
});
|
|
166
170
|
}
|
|
167
171
|
setVariant(variant);
|
|
168
|
-
}, [lite, variant
|
|
172
|
+
}, [lite, variant]);
|
|
169
173
|
return (_jsx(ReduxProvider, { store: injectableStore, children: _jsx(JupyterProvider, { value: {
|
|
170
174
|
baseUrl,
|
|
171
175
|
collaborative,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JupyterContext.js","sourceRoot":"","sources":["../../src/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AC,2BAA2B,EAAE,QAAQ,CAAC,CAAC;SACrD;KACF;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;QAChB,MAAM,IAAI,gBAAgB,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;KAC1E;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
|
+
// Copyright (c) Jupyter Development Team.
|
|
7
|
+
// Distributed under the terms of the Modified BSD License.
|
|
6
8
|
import { maxSatisfying } from 'semver';
|
|
7
9
|
/**
|
|
8
10
|
* A cache using semver ranges to retrieve values.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semvercache.js","sourceRoot":"","sources":["../../../../src/jupyter/ipywidgets/cache/semvercache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB,GAAG,CAAC,GAAW,EAAE,OAAe,EAAE,MAAS;QACzC,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACxC;QACD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;YAClC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;SACpC;aAAM;YACL,qEAAqE;YACrE,OAAO,CAAC,IAAI,CAAC,WAAW,OAAO,WAAW,GAAG,sBAAsB,CAAC,CAAC;SACtE;IACH,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,MAAc;QAC7B,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;YACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAClC,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;YAC1D,IAAI,IAAI,KAAK,IAAI,EAAE;gBACjB,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;aACvB;SACF;IACH,CAAC;IAED,cAAc,CAAC,GAAW;QACxB,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;YACtB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACzB;IACH,CAAC;IAEO,MAAM,GAAgD,MAAM,CAAC,MAAM,CACzE,IAAI,CACL,CAAC;CAEH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Kernel } from '@jupyterlab/services';
|
|
2
|
+
import { DOMWidgetView, IWidgetRegistryData, ICallbacks, WidgetModel, WidgetView } from '@jupyter-widgets/base';
|
|
3
|
+
import { HTMLManager } from '@jupyter-widgets/html-manager';
|
|
4
|
+
import { BundledIPyWidgets, ExternalIPyWidgets } from '../../../components/notebook/Notebook';
|
|
5
|
+
/**
|
|
6
|
+
* The class is responsible for the classic IPyWidget rendering.
|
|
7
|
+
*/
|
|
8
|
+
export declare class IPyWidgetsClassicManager extends HTMLManager {
|
|
9
|
+
_kernelConnection: Kernel.IKernelConnection | null;
|
|
10
|
+
private _commRegistration;
|
|
11
|
+
private _onError;
|
|
12
|
+
private _registry;
|
|
13
|
+
constructor(options?: {
|
|
14
|
+
loader?: (moduleName: string, moduleVersion: string) => Promise<any>;
|
|
15
|
+
});
|
|
16
|
+
registerWithKernel(kernelConnection: Kernel.IKernelConnection | null): void;
|
|
17
|
+
private _handleCommOpen;
|
|
18
|
+
private _getRegistry;
|
|
19
|
+
get onError(): any;
|
|
20
|
+
display_view(view: Promise<DOMWidgetView> | DOMWidgetView, el: HTMLElement): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Load a class and return a promise to the loaded object.
|
|
23
|
+
*/
|
|
24
|
+
protected loadClass(className: string, moduleName: string, moduleVersion: string): Promise<typeof WidgetModel | typeof WidgetView>;
|
|
25
|
+
callbacks(view: WidgetView): ICallbacks;
|
|
26
|
+
_create_comm(target_name: any, model_id: string, data?: any, metadata?: any, buffers?: ArrayBuffer[] | ArrayBufferView[]): Promise<any>;
|
|
27
|
+
_get_comm_info(): Promise<{}>;
|
|
28
|
+
loadBundledIPyWidgets: (ipywidgets: BundledIPyWidgets[]) => void;
|
|
29
|
+
loadExternalIPyWidgets(ipywidgets: ExternalIPyWidgets[]): void;
|
|
30
|
+
register(data: IWidgetRegistryData): void;
|
|
31
|
+
}
|
|
32
|
+
export default IPyWidgetsClassicManager;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
// Copyright (c) Jupyter Development Team.
|
|
7
|
+
// Distributed under the terms of the Modified BSD License.
|
|
8
|
+
import { Widget } from '@lumino/widgets';
|
|
9
|
+
import { shims } from '@jupyter-widgets/base/lib/services-shim';
|
|
10
|
+
import { valid } from 'semver';
|
|
11
|
+
import { requireLoader, HTMLManager } from '@jupyter-widgets/html-manager';
|
|
12
|
+
import { SemVerCache } from '../cache/semvercache';
|
|
13
|
+
import { MODULE_NAME, MODULE_VERSION } from './../plotly/Version';
|
|
14
|
+
// import * as outputWidgets from '@jupyter-widgets/jupyterlab-manager/lib/output';
|
|
15
|
+
import * as base from '@jupyter-widgets/base';
|
|
16
|
+
import * as controls from '@jupyter-widgets/controls';
|
|
17
|
+
import * as output from '@jupyter-widgets/output';
|
|
18
|
+
// Exposing @jupyter-widgets/base and @jupyter-widgets/controls as AMD modules for custom widget bundles that depend on it.
|
|
19
|
+
if (typeof window !== 'undefined' &&
|
|
20
|
+
typeof window.define !== 'undefined') {
|
|
21
|
+
window.define('@jupyter-widgets/base', base);
|
|
22
|
+
window.define('@jupyter-widgets/controls', controls);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The class is responsible for the classic IPyWidget rendering.
|
|
26
|
+
*/
|
|
27
|
+
export class IPyWidgetsClassicManager extends HTMLManager {
|
|
28
|
+
_kernelConnection;
|
|
29
|
+
_commRegistration;
|
|
30
|
+
_onError;
|
|
31
|
+
_registry;
|
|
32
|
+
constructor(options) {
|
|
33
|
+
super(options);
|
|
34
|
+
window.define('@jupyter-widgets/base', base);
|
|
35
|
+
window.define('@jupyter-widgets/controls', controls);
|
|
36
|
+
this._registry = new SemVerCache();
|
|
37
|
+
this.register({
|
|
38
|
+
name: '@jupyter-widgets/base',
|
|
39
|
+
version: base.JUPYTER_WIDGETS_VERSION,
|
|
40
|
+
exports: () => import('@jupyter-widgets/base'),
|
|
41
|
+
});
|
|
42
|
+
this.register({
|
|
43
|
+
name: '@jupyter-widgets/controls',
|
|
44
|
+
version: controls.JUPYTER_CONTROLS_VERSION,
|
|
45
|
+
exports: () => import('@jupyter-widgets/controls'),
|
|
46
|
+
});
|
|
47
|
+
this.register({
|
|
48
|
+
name: '@jupyter-widgets/output',
|
|
49
|
+
version: output.OUTPUT_WIDGET_VERSION,
|
|
50
|
+
exports: () => import('@jupyter-widgets/output'),
|
|
51
|
+
});
|
|
52
|
+
this.register({
|
|
53
|
+
name: MODULE_NAME,
|
|
54
|
+
version: MODULE_VERSION,
|
|
55
|
+
exports: () => import('./../plotly/index'),
|
|
56
|
+
});
|
|
57
|
+
this.register = this.register.bind(this);
|
|
58
|
+
this.registerWithKernel = this.registerWithKernel.bind(this);
|
|
59
|
+
this._getRegistry = this._getRegistry.bind(this);
|
|
60
|
+
this._handleCommOpen = this._handleCommOpen.bind(this);
|
|
61
|
+
}
|
|
62
|
+
registerWithKernel(kernelConnection) {
|
|
63
|
+
this._kernelConnection = kernelConnection;
|
|
64
|
+
if (this._commRegistration) {
|
|
65
|
+
this._commRegistration.dispose();
|
|
66
|
+
}
|
|
67
|
+
if (kernelConnection) {
|
|
68
|
+
kernelConnection.registerCommTarget(this.comm_target_name, this._handleCommOpen);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async _handleCommOpen(comm, message) {
|
|
72
|
+
const classicComm = new shims.services.Comm(comm);
|
|
73
|
+
await this.handle_comm_open(classicComm, message);
|
|
74
|
+
}
|
|
75
|
+
;
|
|
76
|
+
_getRegistry() {
|
|
77
|
+
return this._registry;
|
|
78
|
+
}
|
|
79
|
+
get onError() {
|
|
80
|
+
return this._onError;
|
|
81
|
+
}
|
|
82
|
+
display_view(view, el) {
|
|
83
|
+
return Promise.resolve(view).then(view => {
|
|
84
|
+
Widget.attach(view.luminoWidget, el);
|
|
85
|
+
view.on('remove', function () {
|
|
86
|
+
console.log('The IPyWidgets view is removed', view);
|
|
87
|
+
});
|
|
88
|
+
// return view;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Load a class and return a promise to the loaded object.
|
|
93
|
+
*/
|
|
94
|
+
async loadClass(className, moduleName, moduleVersion) {
|
|
95
|
+
// Special-case the Jupyter base and controls packages. If we have just a
|
|
96
|
+
// plain version, with no indication of the compatible range, prepend a ^ to
|
|
97
|
+
// get all compatible versions. We may eventually apply this logic to all
|
|
98
|
+
// widget modules. See issues #2006 and #2017 for more discussion.
|
|
99
|
+
if ((moduleName === '@jupyter-widgets/base' ||
|
|
100
|
+
moduleName === '@jupyter-widgets/controls') &&
|
|
101
|
+
valid(moduleVersion)) {
|
|
102
|
+
moduleVersion = `^${moduleVersion}`;
|
|
103
|
+
}
|
|
104
|
+
let allVersions = this._getRegistry().getAllVersions(moduleName);
|
|
105
|
+
const semanticVersion = moduleVersion.split('.').length === 2 ?
|
|
106
|
+
moduleVersion + '.0'
|
|
107
|
+
:
|
|
108
|
+
moduleVersion;
|
|
109
|
+
if (!allVersions) {
|
|
110
|
+
const module = await requireLoader(moduleName, semanticVersion);
|
|
111
|
+
const widgetRegistryData = {
|
|
112
|
+
name: moduleName,
|
|
113
|
+
version: semanticVersion.replaceAll('^', ''),
|
|
114
|
+
exports: { ...module }
|
|
115
|
+
};
|
|
116
|
+
this.register(widgetRegistryData);
|
|
117
|
+
allVersions = this._getRegistry().getAllVersions(moduleName);
|
|
118
|
+
if (!allVersions) {
|
|
119
|
+
throw new Error(`No version of module ${moduleName} is registered`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const mod = this._getRegistry().get(moduleName, semanticVersion);
|
|
123
|
+
if (!mod) {
|
|
124
|
+
const registeredVersionList = Object.keys(allVersions);
|
|
125
|
+
throw new Error(`Module ${moduleName}, version ${semanticVersion} is not registered, however, \
|
|
126
|
+
${registeredVersionList.join(',')} ${registeredVersionList.length > 1 ? 'are' : 'is'}`);
|
|
127
|
+
}
|
|
128
|
+
let module;
|
|
129
|
+
if (typeof mod === 'function') {
|
|
130
|
+
module = await mod();
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
module = await mod;
|
|
134
|
+
}
|
|
135
|
+
const cls = module[className];
|
|
136
|
+
if (!cls) {
|
|
137
|
+
throw new Error(`Class ${className} not found in module ${moduleName}`);
|
|
138
|
+
}
|
|
139
|
+
return cls;
|
|
140
|
+
}
|
|
141
|
+
callbacks(view) {
|
|
142
|
+
const baseCallbacks = super.callbacks(view);
|
|
143
|
+
return Object.assign({}, baseCallbacks, {
|
|
144
|
+
iopub: { output: (msg) => this._onError.emit(msg) },
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
_create_comm(target_name, model_id, data, metadata, buffers) {
|
|
148
|
+
const comm = this._kernelConnection?.createComm(target_name, model_id);
|
|
149
|
+
if (data || metadata) {
|
|
150
|
+
comm?.open(data, metadata);
|
|
151
|
+
}
|
|
152
|
+
return Promise.resolve(new shims.services.Comm(comm));
|
|
153
|
+
}
|
|
154
|
+
_get_comm_info() {
|
|
155
|
+
return this._kernelConnection.requestCommInfo({
|
|
156
|
+
target_name: this.comm_target_name,
|
|
157
|
+
}).then((reply) => reply.content.comms);
|
|
158
|
+
}
|
|
159
|
+
loadBundledIPyWidgets = (ipywidgets) => {
|
|
160
|
+
const loadIPyWidget = (name, version, module) => {
|
|
161
|
+
requireLoader(name, version).then(module => {
|
|
162
|
+
//
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
ipywidgets.forEach(ipywidget => {
|
|
166
|
+
loadIPyWidget(ipywidget.name, ipywidget.version, ipywidget.module);
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
loadExternalIPyWidgets(ipywidgets) {
|
|
170
|
+
const loadIPyWidget = (name, version) => {
|
|
171
|
+
requireLoader(name, version).then(module => {
|
|
172
|
+
//
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
ipywidgets.forEach(ipywidget => {
|
|
176
|
+
loadIPyWidget(ipywidget.name, ipywidget.version);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
;
|
|
180
|
+
register(data) {
|
|
181
|
+
this._getRegistry().set(data.name, data.version, data.exports);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
export default IPyWidgetsClassicManager;
|
|
185
|
+
//# sourceMappingURL=IPyWidgetsClassicManager.js.map
|