@datalayer/jupyter-react 0.8.2 → 0.9.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/LICENSE +1 -1
- package/lib/app/App.js +1 -1
- package/lib/app/JupyterReact.js +1 -1
- package/lib/app/tabs/AboutTab.js +2 -2
- package/lib/app/tabs/AboutTab.js.map +1 -1
- package/lib/app/tabs/ComponentsTab.js +2 -2
- package/lib/app/tabs/ComponentsTab.js.map +1 -1
- package/lib/app/tabs/components/CellComponent.js +4 -4
- package/lib/app/tabs/components/CellComponent.js.map +1 -1
- package/lib/app/tabs/components/FileBrowserComponent.js +1 -1
- package/lib/app/tabs/components/IPyWidgetsComponent.js +1 -1
- package/lib/app/tabs/components/NotebookComponent.js +3 -3
- package/lib/app/tabs/components/NotebookComponent.js.map +1 -1
- package/lib/app/tabs/components/ViewerComponent.js +3 -3
- package/lib/app/tabs/components/ViewerComponent.js.map +1 -1
- package/lib/components/button/Button.js +1 -1
- package/lib/components/cell/Cell.d.ts +6 -0
- package/lib/components/cell/Cell.js +5 -9
- package/lib/components/cell/Cell.js.map +1 -1
- package/lib/components/cell/CellAdapter.js +3 -3
- package/lib/components/cell/CellAdapter.js.map +1 -1
- package/lib/components/cell/CellCommands.js +2 -2
- package/lib/components/cell/CellRedux.js +1 -1
- package/lib/components/cell/CellZustand.js +1 -1
- package/lib/components/codemirror/CodeMirrorEditor.js +2 -3
- package/lib/components/codemirror/CodeMirrorEditor.js.map +1 -1
- package/lib/components/codemirror/CodeMirrorOutputToolbar.js +2 -2
- package/lib/components/codemirror/CodeMirrorOutputToolbar.js.map +1 -1
- package/lib/components/codemirror/CodeMirrorTheme.js +1 -1
- package/lib/components/commands/Commands.js +2 -2
- package/lib/components/commands/Commands.js.map +1 -1
- package/lib/components/commands/CommandsAdapter.css +1 -1
- package/lib/components/commands/CommandsAdapter.js +1 -1
- package/lib/components/commands/CommandsState.js +1 -1
- package/lib/components/console/Console.css +1 -1
- package/lib/components/console/Console.d.ts +12 -1
- package/lib/components/console/Console.js +12 -8
- package/lib/components/console/Console.js.map +1 -1
- package/lib/components/console/ConsoleAdapter.d.ts +23 -2
- package/lib/components/console/ConsoleAdapter.js +28 -14
- package/lib/components/console/ConsoleAdapter.js.map +1 -1
- package/lib/components/console/ConsoleRedux.js +1 -1
- package/lib/components/console/ConsoleZustand.js +1 -1
- package/lib/components/dialog/Dialog.js +2 -2
- package/lib/components/dialog/Dialog.js.map +1 -1
- package/lib/components/dialog/DialogAdapter.js +1 -1
- package/lib/components/filebrowser/FileBrowser.js +1 -1
- package/lib/components/filemanager/FileManagerJupyterLab.js +2 -2
- package/lib/components/filemanager/FileManagerJupyterLab.js.map +1 -1
- package/lib/components/filemanager/FileManagerState.js +1 -1
- package/lib/components/filemanager/lab/FileManagerAdapter.css +1 -1
- package/lib/components/filemanager/lab/FileManagerAdapter.js +1 -1
- package/lib/components/jupyterlab/JupyterLabApp.d.ts +2 -2
- package/lib/components/jupyterlab/JupyterLabApp.js +1 -1
- package/lib/components/jupyterlab/JupyterLabAppAdapter.js +1 -1
- package/lib/components/jupyterlab/JupyterLabAppCss.d.ts +2 -2
- package/lib/components/jupyterlab/JupyterLabAppCss.js +1 -1
- package/lib/components/jupyterlab/JupyterLabAppPlugins.js +1 -1
- package/lib/components/kernel/KernelActionMenu.d.ts +8 -0
- package/lib/components/kernel/KernelActionMenu.js +21 -0
- package/lib/components/kernel/KernelActionMenu.js.map +1 -0
- package/lib/components/kernel/KernelInspector.d.ts +6 -0
- package/lib/components/kernel/KernelInspector.js +31 -0
- package/lib/components/kernel/KernelInspector.js.map +1 -0
- package/lib/components/kernel/KernelLauncher.d.ts +2 -0
- package/lib/components/kernel/KernelLauncher.js +11 -0
- package/lib/components/kernel/KernelLauncher.js.map +1 -0
- package/lib/components/kernel/KernelLogs.d.ts +2 -0
- package/lib/components/kernel/KernelLogs.js +11 -0
- package/lib/components/kernel/KernelLogs.js.map +1 -0
- package/lib/components/kernel/KernelProgressBar.d.ts +2 -0
- package/lib/components/kernel/KernelProgressBar.js +26 -0
- package/lib/components/kernel/KernelProgressBar.js.map +1 -0
- package/lib/components/kernel/KernelSelector.d.ts +8 -0
- package/lib/components/kernel/KernelSelector.js +40 -0
- package/lib/components/kernel/KernelSelector.js.map +1 -0
- package/lib/components/kernel/KernelStatus.d.ts +27 -0
- package/lib/components/kernel/KernelStatus.js +67 -0
- package/lib/components/kernel/KernelStatus.js.map +1 -0
- package/lib/components/kernel/KernelUsage.d.ts +6 -0
- package/lib/components/kernel/KernelUsage.js +100 -0
- package/lib/components/kernel/KernelUsage.js.map +1 -0
- package/lib/components/kernel/KernelVariables.d.ts +6 -0
- package/lib/components/kernel/KernelVariables.js +23 -0
- package/lib/components/kernel/KernelVariables.js.map +1 -0
- package/lib/components/kernel/Kernels.d.ts +2 -0
- package/lib/components/kernel/Kernels.js +88 -0
- package/lib/components/kernel/Kernels.js.map +1 -0
- package/lib/components/kernel/index.d.ts +10 -0
- package/lib/components/kernel/index.js +16 -0
- package/lib/components/kernel/index.js.map +1 -0
- package/lib/components/kernel/inspector/kernelinspector.css +68 -0
- package/lib/components/kernel/inspector/model.d.ts +56 -0
- package/lib/components/kernel/inspector/model.js +201 -0
- package/lib/components/kernel/inspector/model.js.map +1 -0
- package/lib/components/kernel/inspector/widget.d.ts +40 -0
- package/lib/components/kernel/inspector/widget.js +190 -0
- package/lib/components/kernel/inspector/widget.js.map +1 -0
- package/lib/components/kernel/variables/handler.d.ts +86 -0
- package/lib/components/kernel/variables/handler.js +262 -0
- package/lib/components/kernel/variables/handler.js.map +1 -0
- package/lib/components/kernel/variables/inspectorscripts.d.ts +20 -0
- package/lib/components/kernel/variables/inspectorscripts.js +349 -0
- package/lib/components/kernel/variables/inspectorscripts.js.map +1 -0
- package/lib/components/kernel/variables/kernelconnector.d.ts +37 -0
- package/lib/components/kernel/variables/kernelconnector.js +76 -0
- package/lib/components/kernel/variables/kernelconnector.js.map +1 -0
- package/lib/components/kernel/variables/manager.d.ts +26 -0
- package/lib/components/kernel/variables/manager.js +70 -0
- package/lib/components/kernel/variables/manager.js.map +1 -0
- package/lib/components/kernel/variables/tokens.d.ts +48 -0
- package/lib/components/kernel/variables/tokens.js +7 -0
- package/lib/components/kernel/variables/tokens.js.map +1 -0
- package/lib/components/kernel/variables/variablesinspector.css +110 -0
- package/lib/components/kernel/variables/variablesinspector.d.ts +5 -0
- package/lib/components/kernel/variables/variablesinspector.js +85 -0
- package/lib/components/kernel/variables/variablesinspector.js.map +1 -0
- package/lib/components/kernel/variables/widget.d.ts +33 -0
- package/lib/components/kernel/variables/widget.js +391 -0
- package/lib/components/kernel/variables/widget.js.map +1 -0
- package/lib/{jupyter → components}/lumino/Lumino.js +1 -1
- package/lib/components/lumino/Lumino.js.map +1 -0
- package/lib/{jupyter → components}/lumino/LuminoBox.js +1 -1
- package/lib/components/lumino/LuminoBox.js.map +1 -0
- package/lib/{jupyter → components}/lumino/LuminoDetached.js +1 -1
- package/lib/components/lumino/LuminoDetached.js.map +1 -0
- package/lib/{jupyter → components}/lumino/LuminoObservable.js +1 -1
- package/lib/components/lumino/LuminoObservable.js.map +1 -0
- package/lib/components/lumino/LuminoRedux.js +7 -0
- package/lib/components/lumino/LuminoRedux.js.map +1 -0
- package/lib/{jupyter → components}/lumino/ReactPortalWidget.js +1 -1
- package/lib/components/lumino/ReactPortalWidget.js.map +1 -0
- package/lib/components/notebook/Notebook.css +1 -1
- package/lib/components/notebook/Notebook.js +12 -8
- package/lib/components/notebook/Notebook.js.map +1 -1
- package/lib/components/notebook/NotebookAdapter.d.ts +3 -1
- package/lib/components/notebook/NotebookAdapter.js +92 -61
- package/lib/components/notebook/NotebookAdapter.js.map +1 -1
- package/lib/components/notebook/NotebookCommands.d.ts +23 -21
- package/lib/components/notebook/NotebookCommands.js +52 -27
- package/lib/components/notebook/NotebookCommands.js.map +1 -1
- package/lib/components/notebook/NotebookRedux.js +1 -1
- package/lib/components/notebook/NotebookZustand.js +1 -1
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.js +2 -2
- package/lib/components/notebook/cell/metadata/CellMetadataEditor.js.map +1 -1
- package/lib/components/notebook/cell/metadata/NbGraderCells.js +11 -11
- package/lib/components/notebook/cell/prompt/Countdown.js +2 -2
- package/lib/components/notebook/cell/prompt/Countdown.js.map +1 -1
- package/lib/components/notebook/cell/prompt/CountdownInputPrompt.js +1 -1
- package/lib/components/notebook/cell/prompt/CountdownOutputPrompt.js +1 -1
- package/lib/components/notebook/cell/prompt/CountdownOutputPrompt.js.map +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebar.js +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.js +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarRun.js +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarWidget.d.ts +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 +1 -1
- package/lib/components/notebook/marked/marked.js +2 -2
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js +1 -1
- package/lib/components/output/Output.css +1 -1
- package/lib/components/output/Output.d.ts +13 -10
- package/lib/components/output/Output.js +34 -59
- package/lib/components/output/Output.js.map +1 -1
- package/lib/components/output/OutputAdapter.d.ts +3 -3
- package/lib/components/output/OutputAdapter.js +19 -17
- 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 +1 -1
- package/lib/components/output/OutputRenderer.js +26 -2
- package/lib/components/output/OutputRenderer.js.map +1 -1
- package/lib/components/output/OutputZustand.d.ts +5 -0
- package/lib/components/output/OutputZustand.js +6 -1
- package/lib/components/output/OutputZustand.js.map +1 -1
- package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsAttached.js +2 -2
- package/lib/components/output/ipywidgets/IPyWidgetsAttached.js.map +1 -0
- package/lib/{jupyter → components/output}/ipywidgets/IPyWidgetsViewManager.js +8 -7
- 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 -1
- package/lib/components/settings/SettingsAdapter.js +1 -1
- package/lib/components/settings/SettingsRedux.js +1 -1
- package/lib/components/settings/SettingsZustand.js +1 -1
- package/lib/components/terminal/Terminal.d.ts +5 -1
- package/lib/components/terminal/Terminal.js +3 -3
- package/lib/components/terminal/Terminal.js.map +1 -1
- package/lib/components/terminal/TerminalAdapter.js +13 -4
- package/lib/components/terminal/TerminalAdapter.js.map +1 -1
- package/lib/components/terminal/TerminalRedux.js +1 -1
- package/lib/components/terminal/TerminalZustand.js +1 -1
- package/lib/components/textinput/TextInput.js +1 -1
- package/lib/components/viewer/Viewer.d.ts +2 -1
- package/lib/components/viewer/Viewer.js +17 -4
- package/lib/components/viewer/Viewer.js.map +1 -1
- package/lib/components/viewer/input/CodemirrorView.js +1 -1
- package/lib/components/viewer/input/CodemirrorViewer.js +3 -3
- package/lib/components/viewer/input/CodemirrorViewer.js.map +1 -1
- package/lib/components/viewer/input/InputViewer.js +2 -5
- package/lib/components/viewer/input/InputViewer.js.map +1 -1
- package/lib/components/viewer/output/OutputAdapter.js +3 -3
- package/lib/components/viewer/output/OutputAdapter.js.map +1 -1
- package/lib/components/viewer/output/OutputViewer.js +1 -1
- package/lib/components/viewer/output/OutputViewer.js.map +1 -1
- package/lib/examples/All.js +6 -5
- package/lib/examples/All.js.map +1 -1
- package/lib/examples/Bokeh.js +1 -1
- package/lib/examples/Bqplot.js +8 -2
- package/lib/examples/Bqplot.js.map +1 -1
- package/lib/examples/Cell.js +1 -1
- package/lib/examples/CellLite.js +16 -0
- package/lib/examples/CellLite.js.map +1 -0
- package/lib/examples/Cells.js +1 -1
- package/lib/examples/Console.js +2 -2
- package/lib/examples/Console.js.map +1 -1
- package/lib/examples/ConsoleLite.js +4 -2
- package/lib/examples/ConsoleLite.js.map +1 -1
- package/lib/examples/Dashboard.js +1 -1
- package/lib/examples/Deno.js +18 -0
- package/lib/examples/Deno.js.map +1 -0
- package/lib/examples/FileBrowser.js +1 -1
- package/lib/examples/GeoJson.js +1 -1
- package/lib/examples/IPyLeaflet.js +8 -2
- package/lib/examples/IPyLeaflet.js.map +1 -1
- package/lib/examples/IPyReact.js +8 -4
- package/lib/examples/IPyReact.js.map +1 -1
- package/lib/examples/IPyWidgets.js +1 -1
- package/lib/examples/IPyWidgetsWithState.js +1 -1
- package/lib/examples/JupyterLabApp.js +2 -2
- package/lib/examples/JupyterLabHeadlessApp.js +3 -3
- package/lib/examples/JupyterLabHeadlessApp.js.map +1 -1
- package/lib/examples/KernelExecResult.d.ts +1 -0
- package/lib/examples/KernelExecResult.js +40 -0
- package/lib/examples/KernelExecResult.js.map +1 -0
- package/lib/examples/KernelExecutor.js +55 -0
- package/lib/examples/KernelExecutor.js.map +1 -0
- package/lib/examples/Kernels.d.ts +1 -0
- package/lib/examples/Kernels.js +78 -0
- package/lib/examples/Kernels.js.map +1 -0
- package/lib/examples/Lumino.js +2 -2
- package/lib/examples/Lumino.js.map +1 -1
- package/lib/examples/Matplotlib.js +12 -8
- package/lib/examples/Matplotlib.js.map +1 -1
- package/lib/examples/Notebook.js +11 -6
- package/lib/examples/Notebook.js.map +1 -1
- package/lib/examples/NotebookCellSidebar.js +10 -6
- package/lib/examples/NotebookCellSidebar.js.map +1 -1
- package/lib/examples/NotebookColorMode.js +47 -0
- package/lib/examples/NotebookColorMode.js.map +1 -0
- package/lib/examples/NotebookExternalContent.js +10 -6
- package/lib/examples/NotebookExternalContent.js.map +1 -1
- package/lib/examples/NotebookInit.js +9 -5
- package/lib/examples/NotebookInit.js.map +1 -1
- package/lib/examples/NotebookInjectableReduxStore.js +1 -1
- package/lib/examples/NotebookKernelChange.js +5 -4
- package/lib/examples/NotebookKernelChange.js.map +1 -1
- package/lib/examples/NotebookLite.d.ts +1 -0
- package/lib/examples/NotebookLite.js +20 -0
- package/lib/examples/NotebookLite.js.map +1 -0
- package/lib/examples/NotebookNbFormat.d.ts +1 -0
- package/lib/examples/{NotebookModel.js → NotebookNbFormat.js} +12 -8
- package/lib/examples/NotebookNbFormat.js.map +1 -0
- package/lib/examples/NotebookNbFormatChange.d.ts +1 -0
- package/lib/examples/{NotebookModelChange.js → NotebookNbFormatChange.js} +13 -9
- package/lib/examples/NotebookNbFormatChange.js.map +1 -0
- package/lib/examples/NotebookPath.js +10 -6
- package/lib/examples/NotebookPath.js.map +1 -1
- package/lib/examples/NotebookPathChange.js +10 -6
- package/lib/examples/NotebookPathChange.js.map +1 -1
- package/lib/examples/NotebookSkeleton.d.ts +1 -0
- package/lib/examples/NotebookSkeleton.js +28 -0
- package/lib/examples/NotebookSkeleton.js.map +1 -0
- package/lib/examples/NotebookTheme.d.ts +1 -0
- package/lib/examples/NotebookTheme.js +48 -0
- package/lib/examples/NotebookTheme.js.map +1 -0
- package/lib/examples/NotebookUnmount.js +6 -5
- package/lib/examples/NotebookUnmount.js.map +1 -1
- package/lib/examples/ObservableHQ.d.ts +1 -0
- package/lib/examples/ObservableHQ.js +18 -0
- package/lib/examples/ObservableHQ.js.map +1 -0
- package/lib/examples/Output.js +4 -4
- package/lib/examples/Output.js.map +1 -1
- package/lib/examples/OutputIPyWidgets.js +1 -1
- package/lib/examples/Outputs.js +3 -3
- package/lib/examples/Outputs.js.map +1 -1
- package/lib/examples/Panel.js +1 -1
- package/lib/examples/Plotly.js +1 -1
- package/lib/examples/RunningSessions.js +3 -3
- package/lib/examples/RunningSessions.js.map +1 -1
- package/lib/examples/Terminal.js +2 -2
- package/lib/examples/Terminal.js.map +1 -1
- package/lib/examples/Vega.js +1 -1
- package/lib/examples/Viewer.js +7 -69
- package/lib/examples/Viewer.js.map +1 -1
- package/lib/examples/lumino/LuminoWidget.d.ts +1 -1
- package/lib/examples/lumino/LuminoWidget.js +5 -5
- package/lib/examples/lumino/LuminoWidget.js.map +1 -1
- package/lib/examples/notebooks/OutputIPyWidgetsExample.js +1 -1
- package/lib/examples/sidebars/CellSidebarSource.js +1 -1
- package/lib/examples/state/ExampleReduxState.js +1 -1
- package/lib/examples/toolbars/NotebookToolbar.js +8 -5
- package/lib/examples/toolbars/NotebookToolbar.js.map +1 -1
- package/lib/examples/toolbars/NotebookToolbarAutoSave.js +2 -2
- package/lib/examples/toolbars/NotebookToolbarAutoSave.js.map +1 -1
- package/lib/examples/toolbars/NotebookToolbarStatus.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +33 -24
- package/lib/index.js +54 -37
- package/lib/index.js.map +1 -1
- package/lib/jupyter/Jupyter.d.ts +7 -26
- package/lib/jupyter/Jupyter.js +24 -19
- package/lib/jupyter/Jupyter.js.map +1 -1
- package/lib/jupyter/JupyterAuthError.js +1 -1
- package/lib/jupyter/JupyterConfig.js +2 -2
- package/lib/jupyter/JupyterConfig.js.map +1 -1
- package/lib/jupyter/JupyterContext.d.ts +117 -24
- package/lib/jupyter/JupyterContext.js +116 -101
- package/lib/jupyter/JupyterContext.js.map +1 -1
- package/lib/jupyter/JupyterHandlers.js +1 -1
- package/lib/jupyter/ipywidgets/{lab → cache}/semvercache.d.ts +3 -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 +34 -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 +4 -4
- package/lib/jupyter/ipywidgets/lab/manager.js +21 -9
- package/lib/jupyter/ipywidgets/lab/manager.js.map +1 -1
- package/lib/jupyter/ipywidgets/lab/output.js +1 -1
- package/lib/jupyter/ipywidgets/lab/plugin.d.ts +6 -5
- package/lib/jupyter/ipywidgets/lab/plugin.js +44 -42
- package/lib/jupyter/ipywidgets/lab/plugin.js.map +1 -1
- 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.js +181 -170
- package/lib/jupyter/ipywidgets/plotly/Figure.js.map +1 -1
- package/lib/jupyter/ipywidgets/plotly/JupyterlabPlugin.js +1 -1
- 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 +69 -17
- package/lib/jupyter/kernel/Kernel.js +68 -42
- package/lib/jupyter/kernel/Kernel.js.map +1 -1
- package/lib/jupyter/kernel/KernelExecutor.d.ts +38 -0
- package/lib/jupyter/kernel/KernelExecutor.js +149 -0
- package/lib/jupyter/kernel/KernelExecutor.js.map +1 -0
- package/lib/jupyter/kernel/index.d.ts +2 -0
- package/lib/jupyter/kernel/index.js +8 -0
- package/lib/jupyter/kernel/index.js.map +1 -0
- package/lib/jupyter/lab/JupyterLabColorMode.d.ts +1 -0
- package/lib/jupyter/lab/JupyterLabColorMode.js +7 -0
- package/lib/jupyter/lab/JupyterLabColorMode.js.map +1 -0
- package/lib/jupyter/lab/JupyterLabCss.d.ts +6 -3
- package/lib/jupyter/lab/JupyterLabCss.js +53 -25
- 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/__tests__/datalayer.spec.js +1 -1
- package/lib/jupyter/lab/index.d.ts +2 -2
- package/lib/jupyter/lab/index.js +2 -3
- package/lib/jupyter/lab/index.js.map +1 -1
- package/lib/jupyter/lab/notebook/content/CountdownContentFactory.d.ts +3 -8
- package/lib/jupyter/lab/notebook/content/CountdownContentFactory.js +7 -13
- package/lib/jupyter/lab/notebook/content/CountdownContentFactory.js.map +1 -1
- package/lib/jupyter/lab/notebook/content/plugin.js +3 -3
- package/lib/jupyter/lab/notebook/content/plugin.js.map +1 -1
- package/lib/jupyter/lab/notebook/index.js +1 -1
- package/lib/jupyter/lite/LiteServer.d.ts +11 -2
- package/lib/jupyter/lite/LiteServer.js +42 -67
- package/lib/jupyter/lite/LiteServer.js.map +1 -1
- package/lib/jupyter/renderers/index.js +1 -1
- package/lib/jupyter/renderers/plotly/PlotlyRenderer.js +5 -5
- 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/theme.d.ts +2 -2
- package/lib/jupyter/theme.js +16 -15
- package/lib/jupyter/theme.js.map +1 -1
- package/lib/state/index.js +1 -1
- package/lib/state/redux/InitState.js +1 -1
- package/lib/state/redux/State.js +1 -1
- package/lib/state/redux/Store.js +1 -1
- package/lib/utils/Utils.d.ts +3 -2
- package/lib/utils/Utils.js +46 -2
- package/lib/utils/Utils.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -0
- package/package.json +170 -86
- package/style/base.css +1 -1
- package/style/index.css +1 -1
- package/style/index.js +1 -1
- package/lib/examples/NotebookModel.js.map +0 -1
- package/lib/examples/NotebookModelChange.js.map +0 -1
- package/lib/examples/NotebookThemed.js +0 -52
- package/lib/examples/NotebookThemed.js.map +0 -1
- package/lib/examples/ViewerFile.js +0 -19
- package/lib/examples/ViewerFile.js.map +0 -1
- package/lib/jupyter/ipywidgets/IPyWidgetsAttached.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/ipywidgets/manager/IPyWidgetsClassicManager.d.ts +0 -19
- package/lib/jupyter/ipywidgets/manager/IPyWidgetsClassicManager.js +0 -85
- package/lib/jupyter/ipywidgets/manager/IPyWidgetsClassicManager.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/lab/JupyterLabTheme.d.ts +0 -1
- package/lib/jupyter/lab/JupyterLabTheme.js +0 -7
- package/lib/jupyter/lab/JupyterLabTheme.js.map +0 -1
- package/lib/jupyter/lumino/Lumino.js.map +0 -1
- package/lib/jupyter/lumino/LuminoBox.js.map +0 -1
- package/lib/jupyter/lumino/LuminoDetached.js.map +0 -1
- package/lib/jupyter/lumino/LuminoObservable.js.map +0 -1
- package/lib/jupyter/lumino/LuminoRedux.js +0 -7
- package/lib/jupyter/lumino/LuminoRedux.js.map +0 -1
- package/lib/jupyter/lumino/ReactPortalWidget.js.map +0 -1
- /package/lib/{jupyter → components}/lumino/Lumino.d.ts +0 -0
- /package/lib/{jupyter → components}/lumino/LuminoBox.d.ts +0 -0
- /package/lib/{jupyter → components}/lumino/LuminoDetached.d.ts +0 -0
- /package/lib/{jupyter → components}/lumino/LuminoObservable.d.ts +0 -0
- /package/lib/{jupyter → components}/lumino/LuminoRedux.d.ts +0 -0
- /package/lib/{jupyter → components}/lumino/ReactPortalWidget.d.ts +0 -0
- /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 → CellLite.d.ts} +0 -0
- /package/lib/examples/{NotebookModelChange.d.ts → Deno.d.ts} +0 -0
- /package/lib/examples/{NotebookThemed.d.ts → KernelExecutor.d.ts} +0 -0
- /package/lib/examples/{ViewerFile.d.ts → NotebookColorMode.d.ts} +0 -0
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
8
|
+
/* eslint-disable prefer-rest-params */
|
|
9
|
+
/* eslint-disable no-var */
|
|
10
|
+
/* eslint-disable no-prototype-builtins */
|
|
6
11
|
import { DOMWidgetModel, DOMWidgetView, } from '@jupyter-widgets/base';
|
|
7
12
|
import _ from 'lodash';
|
|
8
13
|
import Plotly from 'plotly.js';
|
|
9
14
|
import { MODULE_NAME, MODULE_VERSION } from './Version';
|
|
10
|
-
// @ts-
|
|
15
|
+
// @ts-expect-error unknown global PlotlyConfig
|
|
11
16
|
window.PlotlyConfig = { MathJaxConfig: 'local' };
|
|
12
17
|
const semver_range = '^' + MODULE_VERSION;
|
|
13
18
|
// Model
|
|
@@ -397,7 +402,7 @@ class FigureModel extends DOMWidgetModel {
|
|
|
397
402
|
*/
|
|
398
403
|
_normalize_trace_indexes(trace_indexes) {
|
|
399
404
|
if (trace_indexes === null || trace_indexes === undefined) {
|
|
400
|
-
|
|
405
|
+
const numTraces = this.get('_data').length;
|
|
401
406
|
trace_indexes = _.range(numTraces);
|
|
402
407
|
}
|
|
403
408
|
if (!Array.isArray(trace_indexes)) {
|
|
@@ -424,11 +429,11 @@ class FigureModel extends DOMWidgetModel {
|
|
|
424
429
|
do_addTraces() {
|
|
425
430
|
// add trace to plot
|
|
426
431
|
/** @type {Py2JsAddTracesMsg} */
|
|
427
|
-
|
|
432
|
+
const msgData = this.get('_py2js_addTraces');
|
|
428
433
|
if (msgData !== null) {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
_.forEach(newTraces,
|
|
434
|
+
const currentTraces = this.get('_data');
|
|
435
|
+
const newTraces = msgData.trace_data;
|
|
436
|
+
_.forEach(newTraces, newTrace => {
|
|
432
437
|
currentTraces.push(newTrace);
|
|
433
438
|
});
|
|
434
439
|
}
|
|
@@ -439,16 +444,16 @@ class FigureModel extends DOMWidgetModel {
|
|
|
439
444
|
do_deleteTraces() {
|
|
440
445
|
// remove traces from plot
|
|
441
446
|
/** @type {Py2JsDeleteTracesMsg} */
|
|
442
|
-
|
|
447
|
+
const msgData = this.get('_py2js_deleteTraces');
|
|
443
448
|
if (msgData !== null) {
|
|
444
|
-
|
|
445
|
-
|
|
449
|
+
const delete_inds = msgData.delete_inds;
|
|
450
|
+
const tracesData = this.get('_data');
|
|
446
451
|
// Remove del inds in reverse order so indexes remain valid
|
|
447
452
|
// throughout loop
|
|
448
453
|
delete_inds
|
|
449
454
|
.slice()
|
|
450
455
|
.reverse()
|
|
451
|
-
.forEach(
|
|
456
|
+
.forEach(del_ind => {
|
|
452
457
|
tracesData.splice(del_ind, 1);
|
|
453
458
|
});
|
|
454
459
|
}
|
|
@@ -458,11 +463,11 @@ class FigureModel extends DOMWidgetModel {
|
|
|
458
463
|
*/
|
|
459
464
|
do_moveTraces() {
|
|
460
465
|
/** @type {Py2JsMoveTracesMsg} */
|
|
461
|
-
|
|
466
|
+
const msgData = this.get('_py2js_moveTraces');
|
|
462
467
|
if (msgData !== null) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
468
|
+
const tracesData = this.get('_data');
|
|
469
|
+
const currentInds = msgData.current_trace_inds;
|
|
470
|
+
const newInds = msgData.new_trace_inds;
|
|
466
471
|
performMoveTracesLike(tracesData, currentInds, newInds);
|
|
467
472
|
}
|
|
468
473
|
}
|
|
@@ -471,10 +476,10 @@ class FigureModel extends DOMWidgetModel {
|
|
|
471
476
|
*/
|
|
472
477
|
do_restyle() {
|
|
473
478
|
/** @type {Py2JsRestyleMsg} */
|
|
474
|
-
|
|
479
|
+
const msgData = this.get('_py2js_restyle');
|
|
475
480
|
if (msgData !== null) {
|
|
476
|
-
|
|
477
|
-
|
|
481
|
+
const restyleData = msgData.restyle_data;
|
|
482
|
+
const restyleTraces = this._normalize_trace_indexes(msgData.restyle_traces);
|
|
478
483
|
performRestyleLike(this.get('_data'), restyleData, restyleTraces);
|
|
479
484
|
}
|
|
480
485
|
}
|
|
@@ -483,7 +488,7 @@ class FigureModel extends DOMWidgetModel {
|
|
|
483
488
|
*/
|
|
484
489
|
do_relayout() {
|
|
485
490
|
/** @type {Py2JsRelayoutMsg} */
|
|
486
|
-
|
|
491
|
+
const msgData = this.get('_py2js_relayout');
|
|
487
492
|
if (msgData !== null) {
|
|
488
493
|
performRelayoutLike(this.get('_layout'), msgData.relayout_data);
|
|
489
494
|
}
|
|
@@ -493,11 +498,11 @@ class FigureModel extends DOMWidgetModel {
|
|
|
493
498
|
*/
|
|
494
499
|
do_update() {
|
|
495
500
|
/** @type {Py2JsUpdateMsg} */
|
|
496
|
-
|
|
501
|
+
const msgData = this.get('_py2js_update');
|
|
497
502
|
if (msgData !== null) {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
503
|
+
const style = msgData.style_data;
|
|
504
|
+
const layout = msgData.layout_data;
|
|
505
|
+
const styleTraces = this._normalize_trace_indexes(msgData.style_traces);
|
|
501
506
|
performRestyleLike(this.get('_data'), style, styleTraces);
|
|
502
507
|
performRelayoutLike(this.get('_layout'), layout);
|
|
503
508
|
}
|
|
@@ -507,15 +512,15 @@ class FigureModel extends DOMWidgetModel {
|
|
|
507
512
|
*/
|
|
508
513
|
do_animate() {
|
|
509
514
|
/** @type {Py2JsAnimateMsg} */
|
|
510
|
-
|
|
515
|
+
const msgData = this.get('_py2js_animate');
|
|
511
516
|
if (msgData !== null) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
for (
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
517
|
+
const styles = msgData.style_data;
|
|
518
|
+
const layout = msgData.layout_data;
|
|
519
|
+
const trace_indexes = this._normalize_trace_indexes(msgData.style_traces);
|
|
520
|
+
for (let i = 0; i < styles.length; i++) {
|
|
521
|
+
const style = styles[i];
|
|
522
|
+
const trace_index = trace_indexes[i];
|
|
523
|
+
const trace = this.get('_data')[trace_index];
|
|
519
524
|
performRelayoutLike(trace, style);
|
|
520
525
|
}
|
|
521
526
|
performRelayoutLike(this.get('_layout'), layout);
|
|
@@ -526,10 +531,10 @@ class FigureModel extends DOMWidgetModel {
|
|
|
526
531
|
*/
|
|
527
532
|
do_removeLayoutProps() {
|
|
528
533
|
/** @type {Py2JsRemoveLayoutPropsMsg} */
|
|
529
|
-
|
|
534
|
+
const msgData = this.get('_py2js_removeLayoutProps');
|
|
530
535
|
if (msgData !== null) {
|
|
531
|
-
|
|
532
|
-
|
|
536
|
+
const keyPaths = msgData.remove_props;
|
|
537
|
+
const layout = this.get('_layout');
|
|
533
538
|
performRemoveProps(layout, keyPaths);
|
|
534
539
|
}
|
|
535
540
|
}
|
|
@@ -538,11 +543,11 @@ class FigureModel extends DOMWidgetModel {
|
|
|
538
543
|
*/
|
|
539
544
|
do_removeTraceProps() {
|
|
540
545
|
/** @type {Py2JsRemoveTracePropsMsg} */
|
|
541
|
-
|
|
546
|
+
const msgData = this.get('_py2js_removeTraceProps');
|
|
542
547
|
if (msgData !== null) {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
548
|
+
const keyPaths = msgData.remove_props;
|
|
549
|
+
const traceIndex = msgData.remove_trace;
|
|
550
|
+
const trace = this.get('_data')[traceIndex];
|
|
546
551
|
performRemoveProps(trace, keyPaths);
|
|
547
552
|
}
|
|
548
553
|
}
|
|
@@ -643,7 +648,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
643
648
|
* is never displayed in a notebook output cell
|
|
644
649
|
*/
|
|
645
650
|
perform_render() {
|
|
646
|
-
|
|
651
|
+
const that = this;
|
|
647
652
|
// Wire up message property callbacks
|
|
648
653
|
// ----------------------------------
|
|
649
654
|
// Python -> JS event properties
|
|
@@ -661,8 +666,8 @@ export class FigureView extends DOMWidgetView {
|
|
|
661
666
|
}
|
|
662
667
|
// Get message ids
|
|
663
668
|
// ---------------------
|
|
664
|
-
|
|
665
|
-
|
|
669
|
+
const layout_edit_id = this.model.get('_last_layout_edit_id');
|
|
670
|
+
const trace_edit_id = this.model.get('_last_trace_edit_id');
|
|
666
671
|
// Set view UID
|
|
667
672
|
// ------------
|
|
668
673
|
this.viewID = randstr();
|
|
@@ -670,10 +675,10 @@ export class FigureView extends DOMWidgetView {
|
|
|
670
675
|
// ---------------------------
|
|
671
676
|
// We must clone the model's data and layout properties so that
|
|
672
677
|
// the model is not directly mutated by the Plotly.js library.
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
Plotly.newPlot(that.el, initialTraces, initialLayout, config).then(
|
|
678
|
+
const initialTraces = _.cloneDeep(this.model.get('_data'));
|
|
679
|
+
const initialLayout = _.cloneDeep(this.model.get('_layout'));
|
|
680
|
+
const config = this.model.get('_config');
|
|
681
|
+
Plotly.newPlot(that.el, initialTraces, initialLayout, config).then(() => {
|
|
677
682
|
// ### Send trace deltas ###
|
|
678
683
|
// We create an array of deltas corresponding to the new
|
|
679
684
|
// traces.
|
|
@@ -681,40 +686,40 @@ export class FigureView extends DOMWidgetView {
|
|
|
681
686
|
// ### Send layout delta ###
|
|
682
687
|
that._sendLayoutDelta(layout_edit_id);
|
|
683
688
|
// Wire up plotly event callbacks
|
|
684
|
-
that.el.on('plotly_restyle',
|
|
689
|
+
that.el.on('plotly_restyle', (update) => {
|
|
685
690
|
that.handle_plotly_restyle(update);
|
|
686
691
|
});
|
|
687
|
-
that.el.on('plotly_relayout',
|
|
692
|
+
that.el.on('plotly_relayout', (update) => {
|
|
688
693
|
that.handle_plotly_relayout(update);
|
|
689
694
|
});
|
|
690
695
|
/*
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
that.el.on('plotly_click',
|
|
696
|
+
(<Plotly.PlotlyHTMLElement>that.el).on("plotly_update", function (update: any) {
|
|
697
|
+
that.handle_plotly_update(update);
|
|
698
|
+
});
|
|
699
|
+
*/
|
|
700
|
+
that.el.on('plotly_click', (update) => {
|
|
696
701
|
that.handle_plotly_click(update);
|
|
697
702
|
});
|
|
698
|
-
that.el.on('plotly_hover',
|
|
703
|
+
that.el.on('plotly_hover', (update) => {
|
|
699
704
|
that.handle_plotly_hover(update);
|
|
700
705
|
});
|
|
701
|
-
that.el.on('plotly_unhover',
|
|
706
|
+
that.el.on('plotly_unhover', (update) => {
|
|
702
707
|
that.handle_plotly_unhover(update);
|
|
703
708
|
});
|
|
704
|
-
that.el.on('plotly_selected',
|
|
709
|
+
that.el.on('plotly_selected', (update) => {
|
|
705
710
|
that.handle_plotly_selected(update);
|
|
706
711
|
});
|
|
707
712
|
/*
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
713
|
+
(<Plotly.PlotlyHTMLElement>that.el).on("plotly_deselect", function (update: any) {
|
|
714
|
+
that.handle_plotly_deselect(update);
|
|
715
|
+
});
|
|
716
|
+
(<Plotly.PlotlyHTMLElement>that.el).on("plotly_doubleclick", function (update: any) {
|
|
717
|
+
that.handle_plotly_doubleclick(update);
|
|
718
|
+
});
|
|
719
|
+
*/
|
|
715
720
|
// Emit event indicating that the widget has finished
|
|
716
721
|
// rendering
|
|
717
|
-
|
|
722
|
+
const event = new CustomEvent('plotlywidget-after-render', {
|
|
718
723
|
detail: { element: that.el, viewID: that.viewID },
|
|
719
724
|
});
|
|
720
725
|
// Dispatch/Trigger/Fire the event
|
|
@@ -726,7 +731,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
726
731
|
*/
|
|
727
732
|
processLuminoMessage(msg) {
|
|
728
733
|
super.processLuminoMessage.apply(this, arguments);
|
|
729
|
-
|
|
734
|
+
const that = this;
|
|
730
735
|
switch (msg.type) {
|
|
731
736
|
case 'before-attach':
|
|
732
737
|
// Render an initial empty figure. This establishes with
|
|
@@ -742,7 +747,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
742
747
|
xaxis: axisHidden,
|
|
743
748
|
yaxis: axisHidden,
|
|
744
749
|
});
|
|
745
|
-
window.addEventListener('resize',
|
|
750
|
+
window.addEventListener('resize', () => {
|
|
746
751
|
that.autosizeFigure();
|
|
747
752
|
});
|
|
748
753
|
break;
|
|
@@ -757,12 +762,12 @@ export class FigureView extends DOMWidgetView {
|
|
|
757
762
|
}
|
|
758
763
|
}
|
|
759
764
|
autosizeFigure() {
|
|
760
|
-
|
|
761
|
-
|
|
765
|
+
const that = this;
|
|
766
|
+
const layout = that.model.get('_layout');
|
|
762
767
|
if (_.isNil(layout) || _.isNil(layout.width)) {
|
|
763
768
|
// @ts-ignore
|
|
764
|
-
Plotly.Plots.resize(that.el).then(
|
|
765
|
-
|
|
769
|
+
Plotly.Plots.resize(that.el).then(() => {
|
|
770
|
+
const layout_edit_id = that.model.get('_last_layout_edit_id');
|
|
766
771
|
that._sendLayoutDelta(layout_edit_id);
|
|
767
772
|
});
|
|
768
773
|
}
|
|
@@ -810,20 +815,21 @@ export class FigureView extends DOMWidgetView {
|
|
|
810
815
|
* @returns {null|Points}
|
|
811
816
|
*/
|
|
812
817
|
buildPointsObject(data) {
|
|
813
|
-
|
|
818
|
+
let pointsObject;
|
|
814
819
|
if (data.hasOwnProperty('points')) {
|
|
815
820
|
// Most cartesian plots
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
821
|
+
const pointObjects = data['points'];
|
|
822
|
+
const numPoints = pointObjects.length;
|
|
823
|
+
let hasNestedPointObjects = true;
|
|
819
824
|
for (let i = 0; i < numPoints; i++) {
|
|
820
825
|
hasNestedPointObjects =
|
|
821
826
|
hasNestedPointObjects &&
|
|
822
827
|
pointObjects[i].hasOwnProperty('pointNumbers');
|
|
823
|
-
if (!hasNestedPointObjects)
|
|
828
|
+
if (!hasNestedPointObjects) {
|
|
824
829
|
break;
|
|
830
|
+
}
|
|
825
831
|
}
|
|
826
|
-
|
|
832
|
+
let numPointNumbers = numPoints;
|
|
827
833
|
if (hasNestedPointObjects) {
|
|
828
834
|
numPointNumbers = 0;
|
|
829
835
|
for (let i = 0; i < numPoints; i++) {
|
|
@@ -837,7 +843,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
837
843
|
ys: new Array(numPointNumbers),
|
|
838
844
|
};
|
|
839
845
|
if (hasNestedPointObjects) {
|
|
840
|
-
|
|
846
|
+
let flatPointIndex = 0;
|
|
841
847
|
for (var p = 0; p < numPoints; p++) {
|
|
842
848
|
for (let i = 0; i < pointObjects[p]['pointNumbers'].length; i++, flatPointIndex++) {
|
|
843
849
|
pointsObject['point_indexes'][flatPointIndex] =
|
|
@@ -855,11 +861,12 @@ export class FigureView extends DOMWidgetView {
|
|
|
855
861
|
single_trace &&
|
|
856
862
|
pointsObject['trace_indexes'][i - 1] ===
|
|
857
863
|
pointsObject['trace_indexes'][i];
|
|
858
|
-
if (!single_trace)
|
|
864
|
+
if (!single_trace) {
|
|
859
865
|
break;
|
|
866
|
+
}
|
|
860
867
|
}
|
|
861
868
|
if (single_trace) {
|
|
862
|
-
pointsObject['point_indexes'].sort(
|
|
869
|
+
pointsObject['point_indexes'].sort((a, b) => {
|
|
863
870
|
return a - b;
|
|
864
871
|
});
|
|
865
872
|
}
|
|
@@ -873,7 +880,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
873
880
|
}
|
|
874
881
|
}
|
|
875
882
|
// Add z if present
|
|
876
|
-
|
|
883
|
+
const hasZ = pointObjects[0] !== undefined && pointObjects[0].hasOwnProperty('z');
|
|
877
884
|
if (hasZ) {
|
|
878
885
|
pointsObject['zs'] = new Array(numPoints);
|
|
879
886
|
for (p = 0; p < numPoints; p++) {
|
|
@@ -893,13 +900,13 @@ export class FigureView extends DOMWidgetView {
|
|
|
893
900
|
* @returns {null|InputDeviceState}
|
|
894
901
|
*/
|
|
895
902
|
buildInputDeviceStateObject(data) {
|
|
896
|
-
|
|
903
|
+
const event = data['event'];
|
|
897
904
|
if (event === undefined) {
|
|
898
905
|
return null;
|
|
899
906
|
}
|
|
900
907
|
else {
|
|
901
908
|
/** @type {InputDeviceState} */
|
|
902
|
-
|
|
909
|
+
const inputDeviceState = {
|
|
903
910
|
// Keyboard modifiers
|
|
904
911
|
alt: event['altKey'],
|
|
905
912
|
ctrl: event['ctrlKey'],
|
|
@@ -919,7 +926,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
919
926
|
* @returns {null|Selector}
|
|
920
927
|
*/
|
|
921
928
|
buildSelectorObject(data) {
|
|
922
|
-
|
|
929
|
+
let selectorObject;
|
|
923
930
|
if (data.hasOwnProperty('range')) {
|
|
924
931
|
// Box selection
|
|
925
932
|
selectorObject = {
|
|
@@ -959,11 +966,11 @@ export class FigureView extends DOMWidgetView {
|
|
|
959
966
|
return;
|
|
960
967
|
}
|
|
961
968
|
// Unpack data
|
|
962
|
-
|
|
963
|
-
|
|
969
|
+
const styleData = data[0];
|
|
970
|
+
const styleTraces = data[1];
|
|
964
971
|
// Construct restyle message to send to the Python side
|
|
965
972
|
/** @type {Js2PyRestyleMsg} */
|
|
966
|
-
|
|
973
|
+
const restyleMsg = {
|
|
967
974
|
style_data: styleData,
|
|
968
975
|
style_traces: styleTraces,
|
|
969
976
|
source_view_id: this.viewID,
|
|
@@ -985,7 +992,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
985
992
|
return;
|
|
986
993
|
}
|
|
987
994
|
/** @type {Js2PyRelayoutMsg} */
|
|
988
|
-
|
|
995
|
+
const relayoutMsg = {
|
|
989
996
|
relayout_data: data,
|
|
990
997
|
source_view_id: this.viewID,
|
|
991
998
|
};
|
|
@@ -1006,7 +1013,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
1006
1013
|
return;
|
|
1007
1014
|
}
|
|
1008
1015
|
/** @type {Js2PyUpdateMsg} */
|
|
1009
|
-
|
|
1016
|
+
const updateMsg = {
|
|
1010
1017
|
style_data: data['data'][0],
|
|
1011
1018
|
style_traces: data['data'][1],
|
|
1012
1019
|
layout_data: data['layout'],
|
|
@@ -1071,7 +1078,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
1071
1078
|
return;
|
|
1072
1079
|
}
|
|
1073
1080
|
/** @type {Js2PyPointsCallbackMsg} */
|
|
1074
|
-
|
|
1081
|
+
const pointsMsg = {
|
|
1075
1082
|
event_type: event_type,
|
|
1076
1083
|
points: this.buildPointsObject(data),
|
|
1077
1084
|
device_state: this.buildInputDeviceStateObject(data),
|
|
@@ -1092,14 +1099,14 @@ export class FigureView extends DOMWidgetView {
|
|
|
1092
1099
|
*/
|
|
1093
1100
|
do_addTraces() {
|
|
1094
1101
|
/** @type {Py2JsAddTracesMsg} */
|
|
1095
|
-
|
|
1102
|
+
const msgData = this.model.get('_py2js_addTraces');
|
|
1096
1103
|
if (msgData !== null) {
|
|
1097
|
-
|
|
1098
|
-
Plotly.addTraces(this.el, msgData.trace_data).then(
|
|
1104
|
+
const that = this;
|
|
1105
|
+
Plotly.addTraces(this.el, msgData.trace_data).then(() => {
|
|
1099
1106
|
// ### Send trace deltas ###
|
|
1100
1107
|
that._sendTraceDeltas(msgData.trace_edit_id);
|
|
1101
1108
|
// ### Send layout delta ###
|
|
1102
|
-
|
|
1109
|
+
const layout_edit_id = msgData.layout_edit_id;
|
|
1103
1110
|
that._sendLayoutDelta(layout_edit_id);
|
|
1104
1111
|
});
|
|
1105
1112
|
}
|
|
@@ -1109,16 +1116,16 @@ export class FigureView extends DOMWidgetView {
|
|
|
1109
1116
|
*/
|
|
1110
1117
|
do_deleteTraces() {
|
|
1111
1118
|
/** @type {Py2JsDeleteTracesMsg} */
|
|
1112
|
-
|
|
1119
|
+
const msgData = this.model.get('_py2js_deleteTraces');
|
|
1113
1120
|
if (msgData !== null) {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
Plotly.deleteTraces(this.el, delete_inds).then(
|
|
1121
|
+
const delete_inds = msgData.delete_inds;
|
|
1122
|
+
const that = this;
|
|
1123
|
+
Plotly.deleteTraces(this.el, delete_inds).then(() => {
|
|
1117
1124
|
// ### Send trace deltas ###
|
|
1118
|
-
|
|
1125
|
+
const trace_edit_id = msgData.trace_edit_id;
|
|
1119
1126
|
that._sendTraceDeltas(trace_edit_id);
|
|
1120
1127
|
// ### Send layout delta ###
|
|
1121
|
-
|
|
1128
|
+
const layout_edit_id = msgData.layout_edit_id;
|
|
1122
1129
|
that._sendLayoutDelta(layout_edit_id);
|
|
1123
1130
|
});
|
|
1124
1131
|
}
|
|
@@ -1128,14 +1135,14 @@ export class FigureView extends DOMWidgetView {
|
|
|
1128
1135
|
*/
|
|
1129
1136
|
do_moveTraces() {
|
|
1130
1137
|
/** @type {Py2JsMoveTracesMsg} */
|
|
1131
|
-
|
|
1138
|
+
const msgData = this.model.get('_py2js_moveTraces');
|
|
1132
1139
|
if (msgData !== null) {
|
|
1133
1140
|
// Unpack message
|
|
1134
|
-
|
|
1135
|
-
|
|
1141
|
+
const currentInds = msgData.current_trace_inds;
|
|
1142
|
+
const newInds = msgData.new_trace_inds;
|
|
1136
1143
|
// Check if the new trace indexes are actually different than
|
|
1137
1144
|
// the current indexes
|
|
1138
|
-
|
|
1145
|
+
const inds_equal = _.isEqual(currentInds, newInds);
|
|
1139
1146
|
if (!inds_equal) {
|
|
1140
1147
|
Plotly.moveTraces(this.el, currentInds, newInds);
|
|
1141
1148
|
}
|
|
@@ -1146,10 +1153,10 @@ export class FigureView extends DOMWidgetView {
|
|
|
1146
1153
|
*/
|
|
1147
1154
|
do_restyle() {
|
|
1148
1155
|
/** @type {Py2JsRestyleMsg} */
|
|
1149
|
-
|
|
1156
|
+
const msgData = this.model.get('_py2js_restyle');
|
|
1150
1157
|
if (msgData !== null) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1158
|
+
const restyleData = msgData.restyle_data;
|
|
1159
|
+
const traceIndexes = this.model._normalize_trace_indexes(msgData.restyle_traces);
|
|
1153
1160
|
restyleData['_doNotReportToPy'] = true;
|
|
1154
1161
|
Plotly.restyle(this.el, restyleData, traceIndexes);
|
|
1155
1162
|
// ### Send trace deltas ###
|
|
@@ -1157,7 +1164,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
1157
1164
|
// traces.
|
|
1158
1165
|
this._sendTraceDeltas(msgData.trace_edit_id);
|
|
1159
1166
|
// ### Send layout delta ###
|
|
1160
|
-
|
|
1167
|
+
const layout_edit_id = msgData.layout_edit_id;
|
|
1161
1168
|
this._sendLayoutDelta(layout_edit_id);
|
|
1162
1169
|
}
|
|
1163
1170
|
}
|
|
@@ -1166,15 +1173,15 @@ export class FigureView extends DOMWidgetView {
|
|
|
1166
1173
|
*/
|
|
1167
1174
|
do_relayout() {
|
|
1168
1175
|
/** @type {Py2JsRelayoutMsg} */
|
|
1169
|
-
|
|
1176
|
+
const msgData = this.model.get('_py2js_relayout');
|
|
1170
1177
|
if (msgData !== null) {
|
|
1171
1178
|
if (msgData.source_view_id !== this.viewID) {
|
|
1172
|
-
|
|
1179
|
+
const relayoutData = msgData.relayout_data;
|
|
1173
1180
|
relayoutData['_doNotReportToPy'] = true;
|
|
1174
1181
|
Plotly.relayout(this.el, msgData.relayout_data);
|
|
1175
1182
|
}
|
|
1176
1183
|
// ### Send layout delta ###
|
|
1177
|
-
|
|
1184
|
+
const layout_edit_id = msgData.layout_edit_id;
|
|
1178
1185
|
this._sendLayoutDelta(layout_edit_id);
|
|
1179
1186
|
}
|
|
1180
1187
|
}
|
|
@@ -1183,11 +1190,11 @@ export class FigureView extends DOMWidgetView {
|
|
|
1183
1190
|
*/
|
|
1184
1191
|
do_update() {
|
|
1185
1192
|
/** @type {Py2JsUpdateMsg} */
|
|
1186
|
-
|
|
1193
|
+
const msgData = this.model.get('_py2js_update');
|
|
1187
1194
|
if (msgData !== null) {
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1195
|
+
const style = msgData.style_data || {};
|
|
1196
|
+
const layout = msgData.layout_data || {};
|
|
1197
|
+
const traceIndexes = this.model._normalize_trace_indexes(msgData.style_traces);
|
|
1191
1198
|
style['_doNotReportToPy'] = true;
|
|
1192
1199
|
Plotly.update(this.el, style, layout, traceIndexes);
|
|
1193
1200
|
// ### Send trace deltas ###
|
|
@@ -1195,7 +1202,7 @@ export class FigureView extends DOMWidgetView {
|
|
|
1195
1202
|
// traces.
|
|
1196
1203
|
this._sendTraceDeltas(msgData.trace_edit_id);
|
|
1197
1204
|
// ### Send layout delta ###
|
|
1198
|
-
|
|
1205
|
+
const layout_edit_id = msgData.layout_edit_id;
|
|
1199
1206
|
this._sendLayoutDelta(layout_edit_id);
|
|
1200
1207
|
}
|
|
1201
1208
|
}
|
|
@@ -1204,29 +1211,29 @@ export class FigureView extends DOMWidgetView {
|
|
|
1204
1211
|
*/
|
|
1205
1212
|
do_animate() {
|
|
1206
1213
|
/** @type {Py2JsAnimateMsg} */
|
|
1207
|
-
|
|
1214
|
+
const msgData = this.model.get('_py2js_animate');
|
|
1208
1215
|
if (msgData !== null) {
|
|
1209
1216
|
// Unpack params
|
|
1210
1217
|
// var animationData = msgData[0];
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1218
|
+
const animationOpts = msgData.animation_opts;
|
|
1219
|
+
const styles = msgData.style_data;
|
|
1220
|
+
const layout = msgData.layout_data;
|
|
1221
|
+
const traceIndexes = this.model._normalize_trace_indexes(msgData.style_traces);
|
|
1222
|
+
const animationData = {
|
|
1216
1223
|
data: styles,
|
|
1217
1224
|
layout: layout,
|
|
1218
1225
|
traces: traceIndexes,
|
|
1219
1226
|
};
|
|
1220
1227
|
animationData['_doNotReportToPy'] = true;
|
|
1221
|
-
|
|
1228
|
+
const that = this;
|
|
1222
1229
|
// @ts-ignore
|
|
1223
|
-
Plotly.animate(this.el, animationData, animationOpts).then(
|
|
1230
|
+
Plotly.animate(this.el, animationData, animationOpts).then(() => {
|
|
1224
1231
|
// ### Send trace deltas ###
|
|
1225
1232
|
// We create an array of deltas corresponding to the
|
|
1226
1233
|
// animated traces.
|
|
1227
1234
|
that._sendTraceDeltas(msgData.trace_edit_id);
|
|
1228
1235
|
// ### Send layout delta ###
|
|
1229
|
-
|
|
1236
|
+
const layout_edit_id = msgData.layout_edit_id;
|
|
1230
1237
|
that._sendLayoutDelta(layout_edit_id);
|
|
1231
1238
|
});
|
|
1232
1239
|
}
|
|
@@ -1241,9 +1248,9 @@ export class FigureView extends DOMWidgetView {
|
|
|
1241
1248
|
*/
|
|
1242
1249
|
_sendLayoutDelta(layout_edit_id) {
|
|
1243
1250
|
// ### Handle layout delta ###
|
|
1244
|
-
|
|
1251
|
+
const layout_delta = createDeltaObject(this.getFullLayout(), this.model.get('_layout'));
|
|
1245
1252
|
/** @type{Js2PyLayoutDeltaMsg} */
|
|
1246
|
-
|
|
1253
|
+
const layoutDeltaMsg = {
|
|
1247
1254
|
layout_delta: layout_delta,
|
|
1248
1255
|
layout_edit_id: layout_edit_id,
|
|
1249
1256
|
};
|
|
@@ -1259,16 +1266,16 @@ export class FigureView extends DOMWidgetView {
|
|
|
1259
1266
|
* @private
|
|
1260
1267
|
*/
|
|
1261
1268
|
_sendTraceDeltas(trace_edit_id) {
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
for (
|
|
1267
|
-
|
|
1269
|
+
const trace_data = this.model.get('_data');
|
|
1270
|
+
const traceIndexes = _.range(trace_data.length);
|
|
1271
|
+
const trace_deltas = new Array(traceIndexes.length);
|
|
1272
|
+
const fullData = this.getFullData();
|
|
1273
|
+
for (let i = 0; i < traceIndexes.length; i++) {
|
|
1274
|
+
const traceInd = traceIndexes[i];
|
|
1268
1275
|
trace_deltas[i] = createDeltaObject(fullData[traceInd], trace_data[traceInd]);
|
|
1269
1276
|
}
|
|
1270
1277
|
/** @type{Js2PyTraceDeltasMsg} */
|
|
1271
|
-
|
|
1278
|
+
const traceDeltasMsg = {
|
|
1272
1279
|
trace_deltas: trace_deltas,
|
|
1273
1280
|
trace_edit_id: trace_edit_id,
|
|
1274
1281
|
};
|
|
@@ -1292,7 +1299,7 @@ const numpy_dtype_to_typedarray_type = {
|
|
|
1292
1299
|
float64: Float64Array,
|
|
1293
1300
|
};
|
|
1294
1301
|
function serializeTypedArray(v) {
|
|
1295
|
-
|
|
1302
|
+
let numpyType;
|
|
1296
1303
|
if (v instanceof Int8Array) {
|
|
1297
1304
|
numpyType = 'int8';
|
|
1298
1305
|
}
|
|
@@ -1321,7 +1328,7 @@ function serializeTypedArray(v) {
|
|
|
1321
1328
|
// Don't understand it, return as is
|
|
1322
1329
|
return v;
|
|
1323
1330
|
}
|
|
1324
|
-
|
|
1331
|
+
const res = {
|
|
1325
1332
|
dtype: numpyType,
|
|
1326
1333
|
shape: [v.length],
|
|
1327
1334
|
value: v.buffer,
|
|
@@ -1332,21 +1339,21 @@ function serializeTypedArray(v) {
|
|
|
1332
1339
|
* ipywidget JavaScript -> Python serializer
|
|
1333
1340
|
*/
|
|
1334
1341
|
function js2py_serializer(v, widgetManager) {
|
|
1335
|
-
|
|
1342
|
+
let res;
|
|
1336
1343
|
if (_.isTypedArray(v)) {
|
|
1337
1344
|
res = serializeTypedArray(v);
|
|
1338
1345
|
}
|
|
1339
1346
|
else if (Array.isArray(v)) {
|
|
1340
1347
|
// Serialize array elements recursively
|
|
1341
1348
|
res = new Array(v.length);
|
|
1342
|
-
for (
|
|
1349
|
+
for (let i = 0; i < v.length; i++) {
|
|
1343
1350
|
res[i] = js2py_serializer(v[i]);
|
|
1344
1351
|
}
|
|
1345
1352
|
}
|
|
1346
1353
|
else if (_.isPlainObject(v)) {
|
|
1347
1354
|
// Serialize object properties recursively
|
|
1348
1355
|
res = {};
|
|
1349
|
-
for (
|
|
1356
|
+
for (const p in v) {
|
|
1350
1357
|
if (v.hasOwnProperty(p)) {
|
|
1351
1358
|
res[p] = js2py_serializer(v[p]);
|
|
1352
1359
|
}
|
|
@@ -1368,11 +1375,11 @@ function js2py_serializer(v, widgetManager) {
|
|
|
1368
1375
|
* ipywidget Python -> Javascript deserializer
|
|
1369
1376
|
*/
|
|
1370
1377
|
function py2js_deserializer(v, widgetManager) {
|
|
1371
|
-
|
|
1378
|
+
let res;
|
|
1372
1379
|
if (Array.isArray(v)) {
|
|
1373
1380
|
// Deserialize array elements recursively
|
|
1374
1381
|
res = new Array(v.length);
|
|
1375
|
-
for (
|
|
1382
|
+
for (let i = 0; i < v.length; i++) {
|
|
1376
1383
|
res[i] = py2js_deserializer(v[i]);
|
|
1377
1384
|
}
|
|
1378
1385
|
}
|
|
@@ -1387,14 +1394,14 @@ function py2js_deserializer(v, widgetManager) {
|
|
|
1387
1394
|
// This was renamed `value` in 3.2 to work around a naming conflict
|
|
1388
1395
|
// when saving widget state to a notebook.
|
|
1389
1396
|
// @ts-ignore
|
|
1390
|
-
|
|
1391
|
-
|
|
1397
|
+
const typedarray_type = numpy_dtype_to_typedarray_type[v.dtype];
|
|
1398
|
+
const buffer = _.has(v, 'value') ? v.value.buffer : v.buffer.buffer;
|
|
1392
1399
|
res = new typedarray_type(buffer);
|
|
1393
1400
|
}
|
|
1394
1401
|
else {
|
|
1395
1402
|
// Deserialize object properties recursively
|
|
1396
1403
|
res = {};
|
|
1397
|
-
for (
|
|
1404
|
+
for (const p in v) {
|
|
1398
1405
|
if (v.hasOwnProperty(p)) {
|
|
1399
1406
|
res[p] = py2js_deserializer(v[p]);
|
|
1400
1407
|
}
|
|
@@ -1463,12 +1470,12 @@ function fullMergeCustomizer(objValue, srcValue, key) {
|
|
|
1463
1470
|
*/
|
|
1464
1471
|
function performRelayoutLike(parentObj, relayoutData) {
|
|
1465
1472
|
// Perform a relayout style operation on a given parent object
|
|
1466
|
-
for (
|
|
1473
|
+
for (const rawKey in relayoutData) {
|
|
1467
1474
|
if (!relayoutData.hasOwnProperty(rawKey)) {
|
|
1468
1475
|
continue;
|
|
1469
1476
|
}
|
|
1470
1477
|
// Extract value for this key
|
|
1471
|
-
|
|
1478
|
+
const relayoutVal = relayoutData[rawKey];
|
|
1472
1479
|
// Set property value
|
|
1473
1480
|
if (relayoutVal === null) {
|
|
1474
1481
|
_.unset(parentObj, rawKey);
|
|
@@ -1504,22 +1511,22 @@ function performRelayoutLike(parentObj, relayoutData) {
|
|
|
1504
1511
|
*/
|
|
1505
1512
|
function performRestyleLike(parentArray, restyleData, restyleTraces) {
|
|
1506
1513
|
// Loop over the properties of restyleData
|
|
1507
|
-
for (
|
|
1514
|
+
for (const rawKey in restyleData) {
|
|
1508
1515
|
if (!restyleData.hasOwnProperty(rawKey)) {
|
|
1509
1516
|
continue;
|
|
1510
1517
|
}
|
|
1511
1518
|
// Extract value for property and normalize into a value list
|
|
1512
|
-
|
|
1519
|
+
let valArray = restyleData[rawKey];
|
|
1513
1520
|
if (!Array.isArray(valArray)) {
|
|
1514
1521
|
valArray = [valArray];
|
|
1515
1522
|
}
|
|
1516
1523
|
// Loop over the indexes of the traces being restyled
|
|
1517
|
-
for (
|
|
1524
|
+
for (let i = 0; i < restyleTraces.length; i++) {
|
|
1518
1525
|
// Get trace object
|
|
1519
|
-
|
|
1520
|
-
|
|
1526
|
+
const traceInd = restyleTraces[i];
|
|
1527
|
+
const trace = parentArray[traceInd];
|
|
1521
1528
|
// Extract value for this trace
|
|
1522
|
-
|
|
1529
|
+
const singleVal = valArray[i % valArray.length];
|
|
1523
1530
|
// Set property value
|
|
1524
1531
|
if (singleVal === null) {
|
|
1525
1532
|
_.unset(trace, rawKey);
|
|
@@ -1551,14 +1558,14 @@ function performRestyleLike(parentArray, restyleData, restyleTraces) {
|
|
|
1551
1558
|
*/
|
|
1552
1559
|
function performMoveTracesLike(parentArray, currentInds, newInds) {
|
|
1553
1560
|
// ### Remove by currentInds in reverse order ###
|
|
1554
|
-
|
|
1555
|
-
for (
|
|
1561
|
+
let movingTracesData = [];
|
|
1562
|
+
for (let ci = currentInds.length - 1; ci >= 0; ci--) {
|
|
1556
1563
|
// Insert moving parentArray at beginning of the list
|
|
1557
1564
|
movingTracesData.splice(0, 0, parentArray[currentInds[ci]]);
|
|
1558
1565
|
parentArray.splice(currentInds[ci], 1);
|
|
1559
1566
|
}
|
|
1560
1567
|
// ### Sort newInds and movingTracesData by newInds ###
|
|
1561
|
-
|
|
1568
|
+
const newIndexSortedArrays = _(newInds)
|
|
1562
1569
|
.zip(movingTracesData)
|
|
1563
1570
|
.sortBy(0)
|
|
1564
1571
|
.unzip()
|
|
@@ -1566,7 +1573,7 @@ function performMoveTracesLike(parentArray, currentInds, newInds) {
|
|
|
1566
1573
|
newInds = newIndexSortedArrays[0];
|
|
1567
1574
|
movingTracesData = newIndexSortedArrays[1];
|
|
1568
1575
|
// ### Insert by newInds in forward order ###
|
|
1569
|
-
for (
|
|
1576
|
+
for (let ni = 0; ni < newInds.length; ni++) {
|
|
1570
1577
|
parentArray.splice(newInds[ni], 0, movingTracesData[ni]);
|
|
1571
1578
|
}
|
|
1572
1579
|
}
|
|
@@ -1590,8 +1597,8 @@ function performMoveTracesLike(parentArray, currentInds, newInds) {
|
|
|
1590
1597
|
*
|
|
1591
1598
|
*/
|
|
1592
1599
|
function performRemoveProps(parentObj, keyPaths) {
|
|
1593
|
-
for (
|
|
1594
|
-
|
|
1600
|
+
for (let i = 0; i < keyPaths.length; i++) {
|
|
1601
|
+
const keyPath = keyPaths[i];
|
|
1595
1602
|
_.unset(parentObj, keyPath);
|
|
1596
1603
|
}
|
|
1597
1604
|
}
|
|
@@ -1625,7 +1632,7 @@ function performRemoveProps(parentObj, keyPaths) {
|
|
|
1625
1632
|
*/
|
|
1626
1633
|
function createDeltaObject(fullObj, removeObj) {
|
|
1627
1634
|
// Initialize result as object or array
|
|
1628
|
-
|
|
1635
|
+
let res;
|
|
1629
1636
|
if (Array.isArray(fullObj)) {
|
|
1630
1637
|
res = new Array(fullObj.length);
|
|
1631
1638
|
}
|
|
@@ -1637,7 +1644,7 @@ function createDeltaObject(fullObj, removeObj) {
|
|
|
1637
1644
|
removeObj = {};
|
|
1638
1645
|
}
|
|
1639
1646
|
// Iterate over object properties or array indices
|
|
1640
|
-
for (
|
|
1647
|
+
for (const p in fullObj) {
|
|
1641
1648
|
if (p[0] !== '_' && // Don't consider private properties
|
|
1642
1649
|
fullObj.hasOwnProperty(p) && // Exclude parent properties
|
|
1643
1650
|
fullObj[p] !== null // Exclude cases where fullObj doesn't
|
|
@@ -1651,14 +1658,14 @@ function createDeltaObject(fullObj, removeObj) {
|
|
|
1651
1658
|
// Let uids through
|
|
1652
1659
|
// property has non-null value in fullObj that doesn't
|
|
1653
1660
|
// match the value in removeObj
|
|
1654
|
-
|
|
1661
|
+
const fullVal = fullObj[p];
|
|
1655
1662
|
if (removeObj.hasOwnProperty(p) && typeof fullVal === 'object') {
|
|
1656
1663
|
// Recurse over object properties
|
|
1657
1664
|
if (Array.isArray(fullVal)) {
|
|
1658
1665
|
if (fullVal.length > 0 && typeof fullVal[0] === 'object') {
|
|
1659
1666
|
// We have an object array
|
|
1660
1667
|
res[p] = new Array(fullVal.length);
|
|
1661
|
-
for (
|
|
1668
|
+
for (let i = 0; i < fullVal.length; i++) {
|
|
1662
1669
|
if (!Array.isArray(removeObj[p]) || removeObj[p].length <= i) {
|
|
1663
1670
|
res[p][i] = fullVal[i];
|
|
1664
1671
|
}
|
|
@@ -1674,7 +1681,7 @@ function createDeltaObject(fullObj, removeObj) {
|
|
|
1674
1681
|
}
|
|
1675
1682
|
else {
|
|
1676
1683
|
// object
|
|
1677
|
-
|
|
1684
|
+
const full_obj = createDeltaObject(fullVal, removeObj[p]);
|
|
1678
1685
|
if (Object.keys(full_obj).length > 0) {
|
|
1679
1686
|
// new object is not empty
|
|
1680
1687
|
res[p] = full_obj;
|
|
@@ -1698,19 +1705,22 @@ function createDeltaObject(fullObj, removeObj) {
|
|
|
1698
1705
|
return res;
|
|
1699
1706
|
}
|
|
1700
1707
|
function randstr(existing, bits, base, _recursion) {
|
|
1701
|
-
if (!base)
|
|
1708
|
+
if (!base) {
|
|
1702
1709
|
base = 16;
|
|
1703
|
-
|
|
1710
|
+
}
|
|
1711
|
+
if (bits === undefined) {
|
|
1704
1712
|
bits = 24;
|
|
1705
|
-
|
|
1713
|
+
}
|
|
1714
|
+
if (bits <= 0) {
|
|
1706
1715
|
return '0';
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1716
|
+
}
|
|
1717
|
+
let digits = Math.log(Math.pow(2, bits)) / Math.log(base);
|
|
1718
|
+
let res = '';
|
|
1719
|
+
let i, b, x;
|
|
1710
1720
|
for (i = 2; digits === Infinity; i *= 2) {
|
|
1711
1721
|
digits = (Math.log(Math.pow(2, bits / i)) / Math.log(base)) * i;
|
|
1712
1722
|
}
|
|
1713
|
-
|
|
1723
|
+
const rem = digits - Math.floor(digits);
|
|
1714
1724
|
for (i = 0; i < Math.floor(digits); i++) {
|
|
1715
1725
|
x = Math.floor(Math.random() * base).toString(base);
|
|
1716
1726
|
res = x + res;
|
|
@@ -1720,7 +1730,7 @@ function randstr(existing, bits, base, _recursion) {
|
|
|
1720
1730
|
x = Math.floor(Math.random() * b).toString(base);
|
|
1721
1731
|
res = x + res;
|
|
1722
1732
|
}
|
|
1723
|
-
|
|
1733
|
+
const parsed = parseInt(res, base);
|
|
1724
1734
|
if ((existing && existing[res]) ||
|
|
1725
1735
|
(parsed !== Infinity && parsed >= Math.pow(2, bits))) {
|
|
1726
1736
|
if (_recursion > 10) {
|
|
@@ -1729,7 +1739,8 @@ function randstr(existing, bits, base, _recursion) {
|
|
|
1729
1739
|
}
|
|
1730
1740
|
return randstr(existing, bits, base, (_recursion || 0) + 1);
|
|
1731
1741
|
}
|
|
1732
|
-
else
|
|
1742
|
+
else {
|
|
1733
1743
|
return res;
|
|
1744
|
+
}
|
|
1734
1745
|
}
|
|
1735
1746
|
//# sourceMappingURL=Figure.js.map
|