@datalayer/jupyter-react 1.1.8 → 1.2.0
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 +74 -1
- package/lib/app/tabs/components/CellComponent.js +4 -2
- package/lib/app/tabs/components/CellComponent.js.map +1 -1
- package/lib/app/tabs/components/NotebookComponent.js +2 -2
- package/lib/app/tabs/components/NotebookComponent.js.map +1 -1
- package/lib/app/tabs/components/ViewerComponent.js +1 -1
- package/lib/app/tabs/components/ViewerComponent.js.map +1 -1
- package/lib/components/cell/Cell.d.ts +5 -8
- package/lib/components/cell/Cell.js +6 -22
- package/lib/components/cell/Cell.js.map +1 -1
- package/lib/components/cell/CellAdapter.d.ts +1 -3
- package/lib/components/cell/CellAdapter.js +5 -17
- package/lib/components/cell/CellAdapter.js.map +1 -1
- package/lib/components/codemirror/CodeMirrorOutputToolbar.d.ts +2 -2
- package/lib/components/codemirror/CodeMirrorOutputToolbar.js.map +1 -1
- package/lib/components/console/ConsoleAdapter.d.ts +1 -1
- package/lib/components/console/ConsoleAdapter.js +1 -1
- package/lib/components/console/ConsoleAdapter.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabApp.d.ts +16 -19
- package/lib/components/jupyterlab/JupyterLabApp.js +27 -21
- package/lib/components/jupyterlab/JupyterLabApp.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabAppAdapter.d.ts +4 -4
- package/lib/components/jupyterlab/JupyterLabAppAdapter.js +1 -1
- package/lib/components/jupyterlab/JupyterLabAppAdapter.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabAppCss.d.ts +1 -4
- package/lib/components/jupyterlab/JupyterLabAppCss.js +1 -5
- package/lib/components/jupyterlab/JupyterLabAppCss.js.map +1 -1
- package/lib/components/kernel/KernelActionMenu.d.ts +2 -2
- package/lib/components/kernel/KernelActionMenu.js.map +1 -1
- package/lib/components/kernel/KernelDetective.d.ts +1 -1
- package/lib/components/kernel/{Kernelndicator.d.ts → KernelIndicator.d.ts} +2 -1
- package/lib/components/kernel/{Kernelndicator.js → KernelIndicator.js} +13 -5
- package/lib/components/kernel/KernelIndicator.js.map +1 -0
- package/lib/components/kernel/KernelInspector.d.ts +2 -2
- package/lib/components/kernel/KernelInspector.js.map +1 -1
- package/lib/components/kernel/KernelSelector.d.ts +2 -2
- package/lib/components/kernel/KernelSelector.js.map +1 -1
- package/lib/components/kernel/KernelUsage.d.ts +2 -2
- package/lib/components/kernel/KernelUsage.js.map +1 -1
- package/lib/components/kernel/KernelVariables.d.ts +2 -2
- package/lib/components/kernel/KernelVariables.js.map +1 -1
- package/lib/components/kernel/index.d.ts +1 -1
- package/lib/components/kernel/index.js +1 -1
- package/lib/components/kernel/index.js.map +1 -1
- package/lib/components/kernel/variables/kernelconnector.d.ts +2 -2
- package/lib/components/kernel/variables/kernelconnector.js +2 -2
- package/lib/components/kernel/variables/widget.d.ts +4 -2
- package/lib/components/kernel/variables/widget.js.map +1 -1
- package/lib/components/lumino/Lumino.d.ts +1 -1
- package/lib/components/lumino/LuminoBox.d.ts +3 -9
- package/lib/components/lumino/LuminoBox.js +1 -6
- package/lib/components/lumino/LuminoBox.js.map +1 -1
- package/lib/components/lumino/ReactPortalWidget.d.ts +1 -2
- package/lib/components/notebook/Notebook.d.ts +4 -6
- package/lib/components/notebook/Notebook.js +11 -26
- package/lib/components/notebook/Notebook.js.map +1 -1
- package/lib/components/notebook/Notebook2.d.ts +6 -2
- package/lib/components/notebook/Notebook2.js +3 -2
- package/lib/components/notebook/Notebook2.js.map +1 -1
- package/lib/components/notebook/Notebook2Adapter.d.ts +189 -0
- package/lib/components/notebook/Notebook2Adapter.js +554 -10
- package/lib/components/notebook/Notebook2Adapter.js.map +1 -1
- package/lib/components/notebook/Notebook2Base.d.ts +15 -9
- package/lib/components/notebook/Notebook2Base.js +89 -50
- package/lib/components/notebook/Notebook2Base.js.map +1 -1
- package/lib/components/notebook/Notebook2State.d.ts +35 -8
- package/lib/components/notebook/Notebook2State.js +74 -45
- package/lib/components/notebook/Notebook2State.js.map +1 -1
- package/lib/components/notebook/NotebookAdapter.d.ts +1 -0
- package/lib/components/notebook/NotebookAdapter.js +13 -8
- package/lib/components/notebook/NotebookAdapter.js.map +1 -1
- package/lib/components/notebook/NotebookCommands.d.ts +25 -2
- package/lib/components/notebook/NotebookCommands.js +89 -10
- package/lib/components/notebook/NotebookCommands.js.map +1 -1
- package/lib/components/notebook/NotebookState.d.ts +11 -11
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.js +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarExtension.d.ts +2 -4
- package/lib/components/notebook/cell/sidebar/CellSidebarExtension.js +1 -3
- package/lib/components/notebook/cell/sidebar/CellSidebarExtension.js.map +1 -1
- package/lib/components/notebook/index.d.ts +1 -0
- package/lib/components/notebook/index.js +1 -0
- package/lib/components/notebook/index.js.map +1 -1
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.d.ts +28 -1
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js +15 -1
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js.map +1 -1
- package/lib/components/output/Output.d.ts +11 -13
- package/lib/components/output/Output.js +19 -30
- package/lib/components/output/Output.js.map +1 -1
- package/lib/components/output/OutputIPyWidgets.d.ts +2 -2
- package/lib/components/output/OutputIPyWidgets.js.map +1 -1
- package/lib/components/output/OutputRenderer.d.ts +2 -2
- package/lib/components/output/OutputRenderer.js.map +1 -1
- package/lib/components/terminal/Terminal.d.ts +1 -4
- package/lib/components/terminal/Terminal.js +5 -8
- package/lib/components/terminal/Terminal.js.map +1 -1
- package/lib/components/viewer/Viewer.d.ts +1 -1
- package/lib/components/viewer/output/OutputViewer.d.ts +3 -6
- package/lib/components/viewer/output/OutputViewer.js +1 -5
- package/lib/components/viewer/output/OutputViewer.js.map +1 -1
- package/lib/examples/Bokeh.js +2 -2
- package/lib/examples/Bokeh.js.map +1 -1
- package/lib/examples/Bqplot.js +2 -2
- package/lib/examples/Bqplot.js.map +1 -1
- package/lib/examples/Cell.js +4 -4
- package/lib/examples/Cell.js.map +1 -1
- package/lib/examples/CellLite.js +16 -4
- package/lib/examples/CellLite.js.map +1 -1
- package/lib/examples/Cells.js +9 -6
- package/lib/examples/Cells.js.map +1 -1
- package/lib/examples/CellsExecute.js +13 -9
- package/lib/examples/CellsExecute.js.map +1 -1
- package/lib/examples/Console.js +2 -2
- package/lib/examples/Console.js.map +1 -1
- package/lib/examples/ConsoleLite.js +3 -3
- package/lib/examples/ConsoleLite.js.map +1 -1
- package/lib/examples/Dashboard.js +2 -2
- package/lib/examples/Dashboard.js.map +1 -1
- package/lib/examples/Deno.js +2 -2
- package/lib/examples/Deno.js.map +1 -1
- package/lib/examples/Examples.d.ts +23 -0
- package/lib/examples/Examples.js +342 -0
- package/lib/examples/Examples.js.map +1 -0
- package/lib/examples/FileBrowser.js +2 -2
- package/lib/examples/FileBrowser.js.map +1 -1
- package/lib/examples/GeoJson.js +2 -2
- package/lib/examples/GeoJson.js.map +1 -1
- package/lib/examples/IPyLeaflet.js +3 -3
- package/lib/examples/IPyLeaflet.js.map +1 -1
- package/lib/examples/IPyReact.js +3 -3
- package/lib/examples/IPyReact.js.map +1 -1
- package/lib/examples/IPyWidgets.js +3 -3
- package/lib/examples/IPyWidgets.js.map +1 -1
- package/lib/examples/IPyWidgetsState.js +3 -3
- package/lib/examples/IPyWidgetsState.js.map +1 -1
- package/lib/examples/JupyterContext.js +2 -2
- package/lib/examples/JupyterContext.js.map +1 -1
- package/lib/examples/JupyterLabAppHeadless.js +2 -2
- package/lib/examples/JupyterLabAppHeadless.js.map +1 -1
- package/lib/examples/JupyterLabAppHeadlessServerless.js +2 -2
- package/lib/examples/JupyterLabAppHeadlessServerless.js.map +1 -1
- package/lib/examples/JupyterLabAppServerless.js +2 -2
- package/lib/examples/JupyterLabAppServerless.js.map +1 -1
- package/lib/examples/JupyterLabAppServiceManager.js +2 -2
- package/lib/examples/JupyterLabAppServiceManager.js.map +1 -1
- package/lib/examples/JupyterLabTheme.js +2 -2
- package/lib/examples/JupyterLabTheme.js.map +1 -1
- package/lib/examples/KernelExecute.d.ts +1 -1
- package/lib/examples/KernelExecute.js +9 -11
- package/lib/examples/KernelExecute.js.map +1 -1
- package/lib/examples/KernelExecuteLite.d.ts +1 -0
- package/lib/examples/KernelExecuteLite.js +51 -0
- package/lib/examples/KernelExecuteLite.js.map +1 -0
- package/lib/examples/KernelExecutor.js +10 -9
- package/lib/examples/KernelExecutor.js.map +1 -1
- package/lib/examples/KernelExecutorLite.js +63 -0
- package/lib/examples/KernelExecutorLite.js.map +1 -0
- package/lib/examples/Kernels.js +6 -5
- package/lib/examples/Kernels.js.map +1 -1
- package/lib/examples/Lumino.js +2 -2
- package/lib/examples/Lumino.js.map +1 -1
- package/lib/examples/Matplotlib.js +10 -6
- package/lib/examples/Matplotlib.js.map +1 -1
- package/lib/examples/Notebook.js +3 -2
- package/lib/examples/Notebook.js.map +1 -1
- package/lib/examples/Notebook2.js +9 -6
- package/lib/examples/Notebook2.js.map +1 -1
- package/lib/examples/Notebook2Actions.js +8 -6
- package/lib/examples/Notebook2Actions.js.map +1 -1
- package/lib/examples/Notebook2Collaborative.js +2 -2
- package/lib/examples/Notebook2Collaborative.js.map +1 -1
- package/lib/examples/Notebook2Lite.js +19 -14
- package/lib/examples/Notebook2Lite.js.map +1 -1
- package/lib/examples/NotebookCellSidebar.js +3 -3
- package/lib/examples/NotebookCellSidebar.js.map +1 -1
- package/lib/examples/NotebookCellToolbar.js +4 -4
- package/lib/examples/NotebookCellToolbar.js.map +1 -1
- package/lib/examples/NotebookCollaborative.js +2 -2
- package/lib/examples/NotebookCollaborative.js.map +1 -1
- package/lib/examples/NotebookColormode.js +15 -10
- package/lib/examples/NotebookColormode.js.map +1 -1
- package/lib/examples/NotebookExtension.js +4 -4
- package/lib/examples/NotebookExtension.js.map +1 -1
- package/lib/examples/NotebookExternalContent.js +18 -13
- package/lib/examples/NotebookExternalContent.js.map +1 -1
- package/lib/examples/NotebookInit.js +10 -9
- package/lib/examples/NotebookInit.js.map +1 -1
- package/lib/examples/NotebookKernel.js +4 -4
- package/lib/examples/NotebookKernel.js.map +1 -1
- package/lib/examples/NotebookKernelChange.js +2 -2
- package/lib/examples/NotebookKernelChange.js.map +1 -1
- package/lib/examples/NotebookLess.js +4 -4
- package/lib/examples/NotebookLess.js.map +1 -1
- package/lib/examples/NotebookLite.js +10 -6
- package/lib/examples/NotebookLite.js.map +1 -1
- package/lib/examples/NotebookLiteContext.js +10 -5
- package/lib/examples/NotebookLiteContext.js.map +1 -1
- package/lib/examples/NotebookLocalServer.js +3 -3
- package/lib/examples/NotebookLocalServer.js.map +1 -1
- package/lib/examples/NotebookNbformat.js +7 -5
- package/lib/examples/NotebookNbformat.js.map +1 -1
- package/lib/examples/NotebookNbformatChange.js +12 -6
- package/lib/examples/NotebookNbformatChange.js.map +1 -1
- package/lib/examples/NotebookNoContext.js +4 -3
- package/lib/examples/NotebookNoContext.js.map +1 -1
- package/lib/examples/NotebookNoPrimer.js +3 -2
- package/lib/examples/NotebookNoPrimer.js.map +1 -1
- package/lib/examples/NotebookOnSessionConnection.js +5 -5
- package/lib/examples/NotebookOnSessionConnection.js.map +1 -1
- package/lib/examples/NotebookPath.js +2 -2
- package/lib/examples/NotebookPath.js.map +1 -1
- package/lib/examples/NotebookPathChange.js +5 -4
- package/lib/examples/NotebookPathChange.js.map +1 -1
- package/lib/examples/NotebookReadonly.js +4 -4
- package/lib/examples/NotebookReadonly.js.map +1 -1
- package/lib/examples/NotebookServiceManager.js +4 -4
- package/lib/examples/NotebookServiceManager.js.map +1 -1
- package/lib/examples/NotebookSkeleton.js +3 -2
- package/lib/examples/NotebookSkeleton.js.map +1 -1
- package/lib/examples/NotebookTOC.d.ts +1 -0
- package/lib/examples/{NotebookToc.js → NotebookTOC.js} +12 -6
- package/lib/examples/NotebookTOC.js.map +1 -0
- package/lib/examples/NotebookTheme.js +10 -5
- package/lib/examples/NotebookTheme.js.map +1 -1
- package/lib/examples/NotebookThemeColormode.js +4 -4
- package/lib/examples/NotebookThemeColormode.js.map +1 -1
- package/lib/examples/NotebookURL.js +3 -2
- package/lib/examples/NotebookURL.js.map +1 -1
- package/lib/examples/NotebookUnmount.js +13 -7
- package/lib/examples/NotebookUnmount.js.map +1 -1
- package/lib/examples/ObservableHQ.js +2 -2
- package/lib/examples/ObservableHQ.js.map +1 -1
- package/lib/examples/OutputIPyWidgets.js +3 -3
- package/lib/examples/OutputIPyWidgets.js.map +1 -1
- package/lib/examples/OutputWithMonitoring.js +3 -2
- package/lib/examples/OutputWithMonitoring.js.map +1 -1
- package/lib/examples/Outputs.js +8 -8
- package/lib/examples/Outputs.js.map +1 -1
- package/lib/examples/OutputsIpynb.js +4 -4
- package/lib/examples/OutputsIpynb.js.map +1 -1
- package/lib/examples/Panel.js +2 -2
- package/lib/examples/Panel.js.map +1 -1
- package/lib/examples/Plotly.js +2 -2
- package/lib/examples/Plotly.js.map +1 -1
- package/lib/examples/PyGWalker.js +4 -4
- package/lib/examples/PyGWalker.js.map +1 -1
- package/lib/examples/Terminal.js +4 -3
- package/lib/examples/Terminal.js.map +1 -1
- package/lib/examples/Vega.js +2 -2
- package/lib/examples/Vega.js.map +1 -1
- package/lib/examples/Viewer.js +5 -4
- package/lib/examples/Viewer.js.map +1 -1
- package/lib/examples/extensions/celltoolbar/CellToolbarComponent.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/jupyter/Jupyter.d.ts +1 -74
- package/lib/jupyter/Jupyter.js +2 -9
- package/lib/jupyter/Jupyter.js.map +1 -1
- package/lib/jupyter/JupyterConfig.js +7 -5
- package/lib/jupyter/JupyterConfig.js.map +1 -1
- package/lib/jupyter/JupyterContext.d.ts +2 -2
- package/lib/jupyter/collaboration/ICollaborationProvider.js.map +1 -1
- package/lib/jupyter/ipywidgets/classic/htmlmanager.d.ts +6 -0
- package/lib/jupyter/ipywidgets/classic/htmlmanager.js +8 -0
- package/lib/jupyter/ipywidgets/classic/htmlmanager.js.map +1 -1
- package/lib/jupyter/ipywidgets/lab/manager.d.ts +6 -0
- package/lib/jupyter/ipywidgets/lab/manager.js +8 -0
- package/lib/jupyter/ipywidgets/lab/manager.js.map +1 -1
- package/lib/jupyter/ipywidgets/libembed-amd.d.ts +1 -1
- package/lib/jupyter/ipywidgets/libembed-amd.js +1 -1
- package/lib/jupyter/kernel/Kernel.js +21 -15
- package/lib/jupyter/kernel/Kernel.js.map +1 -1
- package/lib/jupyter/kernel/KernelState.d.ts +1 -1
- package/lib/jupyter/lite/Lite.d.ts +1 -1
- package/lib/jupyter/lite/LiteServer.d.ts +2 -2
- package/lib/jupyter/lite/LiteServer.js +21 -6
- package/lib/jupyter/lite/LiteServer.js.map +1 -1
- package/lib/jupyter/lite/contents/broadcast.d.ts +27 -0
- package/lib/jupyter/lite/contents/broadcast.js +60 -0
- package/lib/jupyter/lite/contents/broadcast.js.map +1 -0
- package/lib/jupyter/lite/contents/contents.d.ts +228 -0
- package/lib/jupyter/lite/contents/contents.js +774 -0
- package/lib/jupyter/lite/contents/contents.js.map +1 -0
- package/lib/jupyter/lite/contents/drivecontents.d.ts +92 -0
- package/lib/jupyter/lite/contents/drivecontents.js +133 -0
- package/lib/jupyter/lite/contents/drivecontents.js.map +1 -0
- package/lib/jupyter/lite/contents/drivefs.d.ts +193 -0
- package/lib/jupyter/lite/contents/drivefs.js +432 -0
- package/lib/jupyter/lite/contents/drivefs.js.map +1 -0
- package/lib/jupyter/lite/contents/emscripten.d.ts +89 -0
- package/lib/jupyter/lite/contents/emscripten.js +11 -0
- package/lib/jupyter/lite/contents/emscripten.js.map +1 -0
- package/lib/jupyter/lite/contents/index.d.ts +6 -0
- package/lib/jupyter/lite/contents/index.js +9 -0
- package/lib/jupyter/lite/contents/index.js.map +1 -0
- package/lib/jupyter/lite/contents/tokens.d.ts +136 -0
- package/lib/jupyter/lite/contents/tokens.js +66 -0
- package/lib/jupyter/lite/contents/tokens.js.map +1 -0
- package/lib/jupyter/lite/kernel/index.d.ts +4 -0
- package/lib/jupyter/lite/kernel/index.js +7 -0
- package/lib/jupyter/lite/kernel/index.js.map +1 -0
- package/lib/jupyter/lite/kernel/kernel.d.ts +245 -0
- package/lib/jupyter/lite/kernel/kernel.js +453 -0
- package/lib/jupyter/lite/kernel/kernel.js.map +1 -0
- package/lib/jupyter/lite/kernel/kernels.d.ts +85 -0
- package/lib/jupyter/lite/kernel/kernels.js +218 -0
- package/lib/jupyter/lite/kernel/kernels.js.map +1 -0
- package/lib/jupyter/lite/kernel/kernelspecs.d.ts +53 -0
- package/lib/jupyter/lite/kernel/kernelspecs.js +50 -0
- package/lib/jupyter/lite/kernel/kernelspecs.js.map +1 -0
- package/lib/jupyter/lite/kernel/tokens.d.ts +171 -0
- package/lib/jupyter/lite/kernel/tokens.js +16 -0
- package/lib/jupyter/lite/kernel/tokens.js.map +1 -0
- package/lib/jupyter/lite/licenses/index.d.ts +2 -0
- package/lib/jupyter/lite/licenses/index.js +5 -0
- package/lib/jupyter/lite/licenses/index.js.map +1 -0
- package/lib/jupyter/lite/licenses/licenses.d.ts +35 -0
- package/lib/jupyter/lite/licenses/licenses.js +95 -0
- package/lib/jupyter/lite/licenses/licenses.js.map +1 -0
- package/lib/jupyter/lite/licenses/tokens.d.ts +74 -0
- package/lib/jupyter/lite/licenses/tokens.js +13 -0
- package/lib/jupyter/lite/licenses/tokens.js.map +1 -0
- package/lib/jupyter/lite/localforage/index.d.ts +2 -0
- package/lib/jupyter/lite/localforage/index.js +5 -0
- package/lib/jupyter/lite/localforage/index.js.map +1 -0
- package/lib/jupyter/lite/localforage/memory.d.ts +5 -0
- package/lib/jupyter/lite/localforage/memory.js +10 -0
- package/lib/jupyter/lite/localforage/memory.js.map +1 -0
- package/lib/jupyter/lite/localforage/tokens.d.ts +12 -0
- package/lib/jupyter/lite/localforage/tokens.js +8 -0
- package/lib/jupyter/lite/localforage/tokens.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/_pypi.d.ts +18 -0
- package/lib/jupyter/lite/pyodide-kernel/_pypi.js +45 -0
- package/lib/jupyter/lite/pyodide-kernel/_pypi.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/coincident.worker.d.ts +15 -0
- package/lib/jupyter/lite/pyodide-kernel/coincident.worker.js +63 -0
- package/lib/jupyter/lite/pyodide-kernel/coincident.worker.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/comlink.worker.d.ts +9 -0
- package/lib/jupyter/lite/pyodide-kernel/comlink.worker.js +50 -0
- package/lib/jupyter/lite/pyodide-kernel/comlink.worker.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/index.d.ts +6 -0
- package/lib/jupyter/lite/pyodide-kernel/index.js +9 -0
- package/lib/jupyter/lite/pyodide-kernel/index.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/kernel.d.ts +157 -0
- package/lib/jupyter/lite/pyodide-kernel/kernel.js +294 -0
- package/lib/jupyter/lite/pyodide-kernel/kernel.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/pypi/all-local.json +128 -0
- package/lib/jupyter/lite/pyodide-kernel/pypi/all.json +128 -0
- package/lib/jupyter/lite/pyodide-kernel/schema/piplite.v0.schema.json +113 -0
- package/lib/jupyter/lite/pyodide-kernel/tokens.d.ts +82 -0
- package/lib/jupyter/lite/pyodide-kernel/tokens.js +8 -0
- package/lib/jupyter/lite/pyodide-kernel/tokens.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/worker.d.ts +138 -0
- package/lib/jupyter/lite/pyodide-kernel/worker.js +426 -0
- package/lib/jupyter/lite/pyodide-kernel/worker.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel-extension/index.d.ts +4 -0
- package/lib/jupyter/lite/pyodide-kernel-extension/index.js +88 -0
- package/lib/jupyter/lite/pyodide-kernel-extension/index.js.map +1 -0
- package/lib/jupyter/lite/server/app.d.ts +87 -0
- package/lib/jupyter/lite/server/app.js +157 -0
- package/lib/jupyter/lite/server/app.js.map +1 -0
- package/lib/jupyter/lite/server/index.d.ts +4 -0
- package/lib/jupyter/lite/server/index.js +7 -0
- package/lib/jupyter/lite/server/index.js.map +1 -0
- package/lib/jupyter/lite/server/router.d.ts +99 -0
- package/lib/jupyter/lite/server/router.js +109 -0
- package/lib/jupyter/lite/server/router.js.map +1 -0
- package/lib/jupyter/lite/server/service-manager.d.ts +21 -0
- package/lib/jupyter/lite/server/service-manager.js +102 -0
- package/lib/jupyter/lite/server/service-manager.js.map +1 -0
- package/lib/jupyter/lite/server/service-worker.d.ts +58 -0
- package/lib/jupyter/lite/server/service-worker.js +145 -0
- package/lib/jupyter/lite/server/service-worker.js.map +1 -0
- package/lib/jupyter/lite/server/status.d.ts +18 -0
- package/lib/jupyter/lite/server/status.js +21 -0
- package/lib/jupyter/lite/server/status.js.map +1 -0
- package/lib/jupyter/lite/server/tokens.d.ts +38 -0
- package/lib/jupyter/lite/server/tokens.js +8 -0
- package/lib/jupyter/lite/server/tokens.js.map +1 -0
- package/lib/jupyter/lite/server-extension/index.d.ts +3 -0
- package/lib/jupyter/lite/server-extension/index.js +500 -0
- package/lib/jupyter/lite/server-extension/index.js.map +1 -0
- package/lib/jupyter/lite/session/index.d.ts +2 -0
- package/lib/jupyter/lite/session/index.js +5 -0
- package/lib/jupyter/lite/session/index.js.map +1 -0
- package/lib/jupyter/lite/session/sessions.d.ts +68 -0
- package/lib/jupyter/lite/session/sessions.js +185 -0
- package/lib/jupyter/lite/session/sessions.js.map +1 -0
- package/lib/jupyter/lite/session/tokens.d.ts +40 -0
- package/lib/jupyter/lite/session/tokens.js +6 -0
- package/lib/jupyter/lite/session/tokens.js.map +1 -0
- package/lib/jupyter/lite/settings/index.d.ts +2 -0
- package/lib/jupyter/lite/settings/index.js +5 -0
- package/lib/jupyter/lite/settings/index.js.map +1 -0
- package/lib/jupyter/lite/settings/settings.d.ts +75 -0
- package/lib/jupyter/lite/settings/settings.js +155 -0
- package/lib/jupyter/lite/settings/settings.js.map +1 -0
- package/lib/jupyter/lite/settings/tokens.d.ts +65 -0
- package/lib/jupyter/lite/settings/tokens.js +6 -0
- package/lib/jupyter/lite/settings/tokens.js.map +1 -0
- package/lib/jupyter/lite/translation/index.d.ts +2 -0
- package/lib/jupyter/lite/translation/index.js +5 -0
- package/lib/jupyter/lite/translation/index.js.map +1 -0
- package/lib/jupyter/lite/translation/tokens.d.ts +17 -0
- package/lib/jupyter/lite/translation/tokens.js +6 -0
- package/lib/jupyter/lite/translation/tokens.js.map +1 -0
- package/lib/jupyter/lite/translation/translation.d.ts +13 -0
- package/lib/jupyter/lite/translation/translation.js +52 -0
- package/lib/jupyter/lite/translation/translation.js.map +1 -0
- package/lib/jupyter/lite/types/index.d.ts +1 -0
- package/lib/jupyter/lite/types/index.js +4 -0
- package/lib/jupyter/lite/types/index.js.map +1 -0
- package/lib/jupyter/lite/types/tokens.d.ts +27 -0
- package/lib/jupyter/lite/types/tokens.js +4 -0
- package/lib/jupyter/lite/types/tokens.js.map +1 -0
- package/lib/jupyter/services/ServiceManagerLite.js +15 -6
- package/lib/jupyter/services/ServiceManagerLite.js.map +1 -1
- package/lib/state/JupyterReactState.js +7 -8
- package/lib/state/JupyterReactState.js.map +1 -1
- package/lib/theme/JupyterLabCss.d.ts +1 -1
- package/lib/theme/JupyterLabCss.js +4 -2
- package/lib/theme/JupyterLabCss.js.map +1 -1
- package/lib/theme/JupyterReactTheme.d.ts +1 -1
- package/lib/tools/__tests__/operationRunner.test.d.ts +1 -0
- package/lib/tools/__tests__/operationRunner.test.js +193 -0
- package/lib/tools/__tests__/operationRunner.test.js.map +1 -0
- package/lib/tools/core/executor.d.ts +46 -0
- package/lib/tools/core/executor.js +55 -0
- package/lib/tools/core/executor.js.map +1 -0
- package/lib/tools/core/formatter.d.ts +20 -0
- package/lib/tools/core/formatter.js +41 -0
- package/lib/tools/core/formatter.js.map +1 -0
- package/lib/tools/core/index.d.ts +18 -0
- package/lib/tools/core/index.js +24 -0
- package/lib/tools/core/index.js.map +1 -0
- package/lib/tools/core/interfaces.d.ts +38 -0
- package/lib/tools/core/interfaces.js +7 -0
- package/lib/tools/core/interfaces.js.map +1 -0
- package/lib/tools/core/operationRunner.d.ts +27 -0
- package/lib/tools/core/operationRunner.js +33 -0
- package/lib/tools/core/operationRunner.js.map +1 -0
- package/lib/tools/core/schema.d.ts +47 -0
- package/lib/tools/core/schema.js +7 -0
- package/lib/tools/core/schema.js.map +1 -0
- package/lib/tools/core/types.d.ts +36 -0
- package/lib/tools/core/types.js +7 -0
- package/lib/tools/core/types.js.map +1 -0
- package/lib/tools/core/zodUtils.d.ts +56 -0
- package/lib/tools/core/zodUtils.js +179 -0
- package/lib/tools/core/zodUtils.js.map +1 -0
- package/lib/tools/definitions/deleteCell.d.ts +7 -0
- package/lib/tools/definitions/deleteCell.js +25 -0
- package/lib/tools/definitions/deleteCell.js.map +1 -0
- package/lib/tools/definitions/executeCode.d.ts +7 -0
- package/lib/tools/definitions/executeCode.js +33 -0
- package/lib/tools/definitions/executeCode.js.map +1 -0
- package/lib/tools/definitions/index.d.ts +12 -0
- package/lib/tools/definitions/index.js +18 -0
- package/lib/tools/definitions/index.js.map +1 -0
- package/lib/tools/definitions/insertCell.d.ts +7 -0
- package/lib/tools/definitions/insertCell.js +24 -0
- package/lib/tools/definitions/insertCell.js.map +1 -0
- package/lib/tools/definitions/readAllCells.d.ts +7 -0
- package/lib/tools/definitions/readAllCells.js +24 -0
- package/lib/tools/definitions/readAllCells.js.map +1 -0
- package/lib/tools/definitions/readCell.d.ts +7 -0
- package/lib/tools/definitions/readCell.js +24 -0
- package/lib/tools/definitions/readCell.js.map +1 -0
- package/lib/tools/definitions/runCell.d.ts +7 -0
- package/lib/tools/definitions/runCell.js +31 -0
- package/lib/tools/definitions/runCell.js.map +1 -0
- package/lib/tools/definitions/updateCell.d.ts +7 -0
- package/lib/tools/definitions/updateCell.js +24 -0
- package/lib/tools/definitions/updateCell.js.map +1 -0
- package/lib/tools/index.d.ts +20 -0
- package/lib/tools/index.js +62 -0
- package/lib/tools/index.js.map +1 -0
- package/lib/tools/operations/deleteCell.d.ts +49 -0
- package/lib/tools/operations/deleteCell.js +103 -0
- package/lib/tools/operations/deleteCell.js.map +1 -0
- package/lib/tools/operations/executeCode.d.ts +33 -0
- package/lib/tools/operations/executeCode.js +45 -0
- package/lib/tools/operations/executeCode.js.map +1 -0
- package/lib/tools/operations/insertCell.d.ts +27 -0
- package/lib/tools/operations/insertCell.js +56 -0
- package/lib/tools/operations/insertCell.js.map +1 -0
- package/lib/tools/operations/readAllCells.d.ts +21 -0
- package/lib/tools/operations/readAllCells.js +45 -0
- package/lib/tools/operations/readAllCells.js.map +1 -0
- package/lib/tools/operations/readCell.d.ts +39 -0
- package/lib/tools/operations/readCell.js +90 -0
- package/lib/tools/operations/readCell.js.map +1 -0
- package/lib/tools/operations/runCell.d.ts +24 -0
- package/lib/tools/operations/runCell.js +124 -0
- package/lib/tools/operations/runCell.js.map +1 -0
- package/lib/tools/operations/updateCell.d.ts +27 -0
- package/lib/tools/operations/updateCell.js +53 -0
- package/lib/tools/operations/updateCell.js.map +1 -0
- package/lib/tools/schemas/deleteCell.d.ts +20 -0
- package/lib/tools/schemas/deleteCell.js +24 -0
- package/lib/tools/schemas/deleteCell.js.map +1 -0
- package/lib/tools/schemas/executeCode.d.ts +19 -0
- package/lib/tools/schemas/executeCode.js +28 -0
- package/lib/tools/schemas/executeCode.js.map +1 -0
- package/lib/tools/schemas/index.d.ts +12 -0
- package/lib/tools/schemas/index.js +18 -0
- package/lib/tools/schemas/index.js.map +1 -0
- package/lib/tools/schemas/insertCell.d.ts +24 -0
- package/lib/tools/schemas/insertCell.js +29 -0
- package/lib/tools/schemas/insertCell.js.map +1 -0
- package/lib/tools/schemas/readAllCells.d.ts +19 -0
- package/lib/tools/schemas/readAllCells.js +18 -0
- package/lib/tools/schemas/readAllCells.js.map +1 -0
- package/lib/tools/schemas/readCell.d.ts +19 -0
- package/lib/tools/schemas/readCell.js +24 -0
- package/lib/tools/schemas/readCell.js.map +1 -0
- package/lib/tools/schemas/runCell.d.ts +21 -0
- package/lib/tools/schemas/runCell.js +39 -0
- package/lib/tools/schemas/runCell.js.map +1 -0
- package/lib/tools/schemas/updateCell.d.ts +19 -0
- package/lib/tools/schemas/updateCell.js +21 -0
- package/lib/tools/schemas/updateCell.js.map +1 -0
- package/package.json +40 -28
- package/schema/kernel.v0.schema.json +42 -0
- package/style/icons/pyodide.svg +17 -0
- package/lib/components/kernel/Kernelndicator.js.map +0 -1
- package/lib/examples/NotebookToc.js.map +0 -1
- /package/lib/examples/{NotebookToc.d.ts → KernelExecutorLite.d.ts} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { PromiseDelegate } from '@lumino/coreutils';
|
|
2
|
+
import { Signal } from '@lumino/signaling';
|
|
3
|
+
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
|
|
4
|
+
const VERSION = PageConfig.getOption('appVersion');
|
|
5
|
+
const SW_PING_ENDPOINT = '/api/service-worker-heartbeat';
|
|
6
|
+
export class ServiceWorkerManager {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
/*
|
|
9
|
+
const workerUrl =
|
|
10
|
+
options?.workerUrl ?? URLExt.join(PageConfig.getBaseUrl(), WORKER_NAME);
|
|
11
|
+
const fullWorkerUrl = new URL(workerUrl, window.location.href);
|
|
12
|
+
const enableCache = PageConfig.getOption('enableServiceWorkerCache') || 'false';
|
|
13
|
+
fullWorkerUrl.searchParams.set('enableCache', enableCache);
|
|
14
|
+
void this.initialize(fullWorkerUrl.href).catch(console.warn);
|
|
15
|
+
*/
|
|
16
|
+
const workerUrl = URLExt.join(PageConfig.getOption('serviceWorkerUrl'));
|
|
17
|
+
const fullWorkerUrl = new URL(workerUrl);
|
|
18
|
+
fullWorkerUrl.searchParams.set('enableCache', 'true');
|
|
19
|
+
void this.initialize(fullWorkerUrl.href).catch(console.warn);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A signal emitted when the registration changes.
|
|
23
|
+
*/
|
|
24
|
+
get registrationChanged() {
|
|
25
|
+
return this._registrationChanged;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether the ServiceWorker is enabled or not.
|
|
29
|
+
*/
|
|
30
|
+
get enabled() {
|
|
31
|
+
return this._registration !== null;
|
|
32
|
+
}
|
|
33
|
+
get ready() {
|
|
34
|
+
return this._ready.promise;
|
|
35
|
+
}
|
|
36
|
+
unregisterOldServiceWorkers = async (scriptURL) => {
|
|
37
|
+
const versionKey = `${scriptURL}-version`;
|
|
38
|
+
// Check if we have an installed version. If we do, compare it to the current version
|
|
39
|
+
// and unregister all service workers if they are different.
|
|
40
|
+
const installedVersion = localStorage.getItem(versionKey);
|
|
41
|
+
if ((installedVersion && installedVersion !== VERSION) ||
|
|
42
|
+
!installedVersion) {
|
|
43
|
+
// eslint-disable-next-line no-console
|
|
44
|
+
console.info('New version, unregistering existing service workers.');
|
|
45
|
+
const registrations = await navigator.serviceWorker.getRegistrations();
|
|
46
|
+
await Promise.all(registrations.map(registration => registration.unregister()));
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
console.info('All existing service workers have been unregistered.');
|
|
49
|
+
}
|
|
50
|
+
localStorage.setItem(versionKey, VERSION);
|
|
51
|
+
};
|
|
52
|
+
async initialize(workerUrl) {
|
|
53
|
+
const { serviceWorker } = navigator;
|
|
54
|
+
let registration = null;
|
|
55
|
+
if (!serviceWorker) {
|
|
56
|
+
console.warn('ServiceWorkers not supported in this browser');
|
|
57
|
+
}
|
|
58
|
+
else if (serviceWorker.controller) {
|
|
59
|
+
const scriptURL = serviceWorker.controller.scriptURL;
|
|
60
|
+
await this.unregisterOldServiceWorkers(scriptURL);
|
|
61
|
+
registration = (await serviceWorker.getRegistration(scriptURL)) || null;
|
|
62
|
+
// eslint-disable-next-line no-console
|
|
63
|
+
console.info('JupyterLite ServiceWorker was already registered');
|
|
64
|
+
}
|
|
65
|
+
if (!registration && serviceWorker) {
|
|
66
|
+
try {
|
|
67
|
+
// eslint-disable-next-line no-console
|
|
68
|
+
console.info('Registering new JupyterLite ServiceWorker', workerUrl);
|
|
69
|
+
registration = await serviceWorker.register(workerUrl);
|
|
70
|
+
// eslint-disable-next-line no-console
|
|
71
|
+
console.info('JupyterLite ServiceWorker was sucessfully registered');
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
console.warn(err);
|
|
75
|
+
console.warn(`JupyterLite ServiceWorker registration unexpectedly failed: ${err}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
this._setRegistration(registration);
|
|
79
|
+
if (!registration) {
|
|
80
|
+
this._ready.reject(void 0);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this._ready.resolve(void 0);
|
|
84
|
+
setTimeout(this._pingServiceWorker, 20000);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
_pingServiceWorker = async () => {
|
|
88
|
+
const response = await fetch(SW_PING_ENDPOINT);
|
|
89
|
+
const text = await response.text();
|
|
90
|
+
if (text === 'ok') {
|
|
91
|
+
setTimeout(this._pingServiceWorker, 20000);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
_setRegistration(registration) {
|
|
95
|
+
this._registration = registration;
|
|
96
|
+
this._registrationChanged.emit(this._registration);
|
|
97
|
+
}
|
|
98
|
+
_registration = null;
|
|
99
|
+
_registrationChanged = new Signal(this);
|
|
100
|
+
_ready = new PromiseDelegate();
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=service-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-manager.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/server/service-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU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AC,IAAI,CACV,+DAA+D,GAAG,EAAE,CACrE,CAAC;YACJ,CAAC;QACH,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAEpC,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5B,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACO,kBAAkB,GAAG,KAAK,IAAmB,EAAE;QACrD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC,CAAC;IACM,gBAAgB,CAAC,YAA8C;QACrE,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACrD,CAAC;IAEO,aAAa,GAAqC,IAAI,CAAC;IACvD,oBAAoB,GAAG,IAAI,MAAM,CAGvC,IAAI,CAAC,CAAC;IACA,MAAM,GAAG,IAAI,eAAe,EAAQ,CAAC;CAC9C"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The name of the cache
|
|
3
|
+
*/
|
|
4
|
+
declare const CACHE = "precache";
|
|
5
|
+
/**
|
|
6
|
+
* Communication channel for drive access
|
|
7
|
+
*/
|
|
8
|
+
declare const broadcast: BroadcastChannel;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to enable the cache
|
|
11
|
+
*/
|
|
12
|
+
declare let enableCache: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Handle installation with the cache
|
|
15
|
+
*/
|
|
16
|
+
declare function onInstall(event: ExtendableEvent): void;
|
|
17
|
+
/**
|
|
18
|
+
* Handle activation.
|
|
19
|
+
*/
|
|
20
|
+
declare function onActivate(event: ExtendableEvent): void;
|
|
21
|
+
/**
|
|
22
|
+
* Handle fetching a single resource.
|
|
23
|
+
*/
|
|
24
|
+
declare function onFetch(event: FetchEvent): Promise<void>;
|
|
25
|
+
/** Get a cached response, and update cache. */
|
|
26
|
+
declare function maybeFromCache(event: FetchEvent): Promise<Response>;
|
|
27
|
+
/**
|
|
28
|
+
* Restore a response from the cache based on the request.
|
|
29
|
+
*/
|
|
30
|
+
declare function fromCache(request: Request): Promise<Response | null>;
|
|
31
|
+
/**
|
|
32
|
+
* This is where we call the server to get the newest version of the
|
|
33
|
+
* file to use the next time we show view
|
|
34
|
+
*/
|
|
35
|
+
declare function refetch(request: Request): Promise<Response>;
|
|
36
|
+
/**
|
|
37
|
+
* Whether a given URL should be broadcast
|
|
38
|
+
*/
|
|
39
|
+
declare function shouldBroadcast(url: URL): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the fallback behavior should be used
|
|
42
|
+
*/
|
|
43
|
+
declare function shouldDrop(request: Request, url: URL): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Forward request to main using the broadcast channel
|
|
46
|
+
*/
|
|
47
|
+
declare function broadcastOne(request: Request): Promise<Response>;
|
|
48
|
+
declare function openCache(): Promise<Cache>;
|
|
49
|
+
/**
|
|
50
|
+
* Cache a request/response pair.
|
|
51
|
+
*/
|
|
52
|
+
declare function updateCache(request: Request, response: Response): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Add all to the cache
|
|
55
|
+
*
|
|
56
|
+
* this is where we should (try to) add all relevant files
|
|
57
|
+
*/
|
|
58
|
+
declare function cacheAll(): Promise<void>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/// <reference lib="webworker" />
|
|
2
|
+
/**
|
|
3
|
+
* The name of the cache
|
|
4
|
+
*/
|
|
5
|
+
const CACHE = 'precache';
|
|
6
|
+
/**
|
|
7
|
+
* Communication channel for drive access
|
|
8
|
+
*/
|
|
9
|
+
const broadcast = new BroadcastChannel('/api/drive.v1');
|
|
10
|
+
/**
|
|
11
|
+
* Whether to enable the cache
|
|
12
|
+
*/
|
|
13
|
+
let enableCache = false;
|
|
14
|
+
/**
|
|
15
|
+
* Install event listeners
|
|
16
|
+
*/
|
|
17
|
+
self.addEventListener('install', onInstall);
|
|
18
|
+
self.addEventListener('activate', onActivate);
|
|
19
|
+
self.addEventListener('fetch', onFetch);
|
|
20
|
+
// Event handlers
|
|
21
|
+
/**
|
|
22
|
+
* Handle installation with the cache
|
|
23
|
+
*/
|
|
24
|
+
function onInstall(event) {
|
|
25
|
+
void self.skipWaiting();
|
|
26
|
+
event.waitUntil(cacheAll());
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Handle activation.
|
|
30
|
+
*/
|
|
31
|
+
function onActivate(event) {
|
|
32
|
+
// check if we should enable the cache
|
|
33
|
+
const searchParams = new URL(location.href).searchParams;
|
|
34
|
+
enableCache = searchParams.get('enableCache') === 'true';
|
|
35
|
+
event.waitUntil(self.clients.claim());
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Handle fetching a single resource.
|
|
39
|
+
*/
|
|
40
|
+
async function onFetch(event) {
|
|
41
|
+
const { request } = event;
|
|
42
|
+
const url = new URL(event.request.url);
|
|
43
|
+
if (url.pathname === '/api/service-worker-heartbeat') {
|
|
44
|
+
event.respondWith(new Response('ok'));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
let responsePromise = null;
|
|
48
|
+
if (shouldBroadcast(url)) {
|
|
49
|
+
responsePromise = broadcastOne(request);
|
|
50
|
+
}
|
|
51
|
+
else if (!shouldDrop(request, url)) {
|
|
52
|
+
responsePromise = maybeFromCache(event);
|
|
53
|
+
}
|
|
54
|
+
if (responsePromise) {
|
|
55
|
+
event.respondWith(responsePromise);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// utilities
|
|
59
|
+
/** Get a cached response, and update cache. */
|
|
60
|
+
async function maybeFromCache(event) {
|
|
61
|
+
const { request } = event;
|
|
62
|
+
if (!enableCache) {
|
|
63
|
+
return await fetch(request);
|
|
64
|
+
}
|
|
65
|
+
let response = await fromCache(request);
|
|
66
|
+
if (response) {
|
|
67
|
+
event.waitUntil(refetch(request));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
response = await fetch(request);
|
|
71
|
+
event.waitUntil(updateCache(request, response.clone()));
|
|
72
|
+
}
|
|
73
|
+
return response;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Restore a response from the cache based on the request.
|
|
77
|
+
*/
|
|
78
|
+
async function fromCache(request) {
|
|
79
|
+
const cache = await openCache();
|
|
80
|
+
const response = await cache.match(request);
|
|
81
|
+
if (!response || response.status === 404) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return response;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* This is where we call the server to get the newest version of the
|
|
88
|
+
* file to use the next time we show view
|
|
89
|
+
*/
|
|
90
|
+
async function refetch(request) {
|
|
91
|
+
const fromServer = await fetch(request);
|
|
92
|
+
await updateCache(request, fromServer);
|
|
93
|
+
return fromServer;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Whether a given URL should be broadcast
|
|
97
|
+
*/
|
|
98
|
+
function shouldBroadcast(url) {
|
|
99
|
+
return url.origin === location.origin && url.pathname.includes('/api/drive');
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Whether the fallback behavior should be used
|
|
103
|
+
*/
|
|
104
|
+
function shouldDrop(request, url) {
|
|
105
|
+
return (request.method !== 'GET' ||
|
|
106
|
+
url.origin.match(/^http/) === null ||
|
|
107
|
+
url.pathname.includes('/api/'));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Forward request to main using the broadcast channel
|
|
111
|
+
*/
|
|
112
|
+
async function broadcastOne(request) {
|
|
113
|
+
const promise = new Promise(resolve => {
|
|
114
|
+
broadcast.onmessage = event => {
|
|
115
|
+
resolve(new Response(JSON.stringify(event.data)));
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
const message = await request.json();
|
|
119
|
+
// Mark message as being for broadcast.ts
|
|
120
|
+
// This makes sure we won't get problems with messages
|
|
121
|
+
// across tabs with multiple notebook tabs open
|
|
122
|
+
message.receiver = 'broadcast.ts';
|
|
123
|
+
broadcast.postMessage(message);
|
|
124
|
+
return await promise;
|
|
125
|
+
}
|
|
126
|
+
async function openCache() {
|
|
127
|
+
return await caches.open(CACHE);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Cache a request/response pair.
|
|
131
|
+
*/
|
|
132
|
+
async function updateCache(request, response) {
|
|
133
|
+
const cache = await openCache();
|
|
134
|
+
return cache.put(request, response);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Add all to the cache
|
|
138
|
+
*
|
|
139
|
+
* this is where we should (try to) add all relevant files
|
|
140
|
+
*/
|
|
141
|
+
async function cacheAll() {
|
|
142
|
+
const cache = await openCache();
|
|
143
|
+
return await cache.addAll([]);
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=service-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-worker.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/server/service-worker.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC;;GAEG;AACH,MAAM,KAAK,GAAG,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAAC;AAExD;;GAEG;AACH,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;GAEG;AACF,IA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AAE,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,QAAQ;IACrB,MAAM,KAAK,GAAG,MAAM,SAAS,EAAE,CAAC;IAChC,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class to handle requests to /api/status
|
|
3
|
+
*/
|
|
4
|
+
export declare class Status {
|
|
5
|
+
/**
|
|
6
|
+
* Get the status
|
|
7
|
+
*/
|
|
8
|
+
get(): any;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A namespace for Status statics.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace Status {
|
|
14
|
+
/**
|
|
15
|
+
* The url for the status service.
|
|
16
|
+
*/
|
|
17
|
+
const STATUS_SERVICE_URL = "/api/status";
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class to handle requests to /api/status
|
|
3
|
+
*/
|
|
4
|
+
export class Status {
|
|
5
|
+
/**
|
|
6
|
+
* Get the status
|
|
7
|
+
*/
|
|
8
|
+
get() {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A namespace for Status statics.
|
|
14
|
+
*/
|
|
15
|
+
(function (Status) {
|
|
16
|
+
/**
|
|
17
|
+
* The url for the status service.
|
|
18
|
+
*/
|
|
19
|
+
Status.STATUS_SERVICE_URL = '/api/status';
|
|
20
|
+
})(Status || (Status = {}));
|
|
21
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/server/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,MAAM;IACjB;;OAEG;IACH,GAAG;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED;;GAEG;AACH,WAAiB,MAAM;IACrB;;OAEG;IACU,yBAAkB,GAAG,aAAa,CAAC;AAClD,CAAC,EALgB,MAAM,KAAN,MAAM,QAKtB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Token } from '@lumino/coreutils';
|
|
2
|
+
import { ISignal } from '@lumino/signaling';
|
|
3
|
+
/**
|
|
4
|
+
* The token for the ServiceWorker.
|
|
5
|
+
*/
|
|
6
|
+
export declare const IServiceWorkerManager: Token<IServiceWorkerManager>;
|
|
7
|
+
/**
|
|
8
|
+
* The interface for the ServiceWorkerRegistration.
|
|
9
|
+
*/
|
|
10
|
+
export interface IServiceWorkerManager {
|
|
11
|
+
/**
|
|
12
|
+
* Signal fired when the registration changed.
|
|
13
|
+
*/
|
|
14
|
+
readonly registrationChanged: ISignal<IServiceWorkerManager, ServiceWorkerRegistration | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the ServiceWorker is enabled or not.
|
|
17
|
+
*/
|
|
18
|
+
readonly enabled: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* A Promise that resolves when the ServiceWorker is registered, or rejects if it cannot
|
|
21
|
+
*/
|
|
22
|
+
ready: Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A namespace for `ServiceWorkerManager` class.
|
|
26
|
+
*/
|
|
27
|
+
export declare namespace IServiceWorkerManager {
|
|
28
|
+
/**
|
|
29
|
+
* An options object for initializing a worker manager.
|
|
30
|
+
*/
|
|
31
|
+
interface IOptions {
|
|
32
|
+
/**
|
|
33
|
+
* URL to load the worker file. Default to "{baseURL}/service-worker.js"
|
|
34
|
+
*/
|
|
35
|
+
workerUrl?: string;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export declare const WORKER_NAME: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Token } from '@lumino/coreutils';
|
|
2
|
+
import SW_URL from './service-worker?text';
|
|
3
|
+
/**
|
|
4
|
+
* The token for the ServiceWorker.
|
|
5
|
+
*/
|
|
6
|
+
export const IServiceWorkerManager = new Token('@jupyterlite/server-extension:IServiceWorkerManager');
|
|
7
|
+
export const WORKER_NAME = `${SW_URL}`.split('/').slice(-1)[0];
|
|
8
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/server/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,KAAK,CAC5C,qDAAqD,CACtD,CAAC;AAwCF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
|