@datalayer/jupyter-react 0.0.1
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 +21 -0
- package/README.md +56 -0
- package/lib/examples/Example.d.ts +1 -0
- package/lib/examples/Example.js +8 -0
- package/lib/examples/Example.js.map +1 -0
- package/lib/examples/MuiSetup.d.ts +5 -0
- package/lib/examples/MuiSetup.js +13 -0
- package/lib/examples/MuiSetup.js.map +1 -0
- package/lib/examples/bootstrap/All.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/All.bootstrap.js +84 -0
- package/lib/examples/bootstrap/All.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/Cell.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/Cell.bootstrap.js +12 -0
- package/lib/examples/bootstrap/Cell.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/FileBrowser.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/FileBrowser.bootstrap.js +10 -0
- package/lib/examples/bootstrap/FileBrowser.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/Gallery.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/Gallery.bootstrap.js +18 -0
- package/lib/examples/bootstrap/Gallery.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/IPyWidgets.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/IPyWidgets.bootstrap.js +12 -0
- package/lib/examples/bootstrap/IPyWidgets.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/Lumino.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/Lumino.bootstrap.js +11 -0
- package/lib/examples/bootstrap/Lumino.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/Notebook.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/Notebook.bootstrap.js +22 -0
- package/lib/examples/bootstrap/Notebook.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/NotebookCustom.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/NotebookCustom.bootstrap.js +7 -0
- package/lib/examples/bootstrap/NotebookCustom.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/Outputs.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/Outputs.bootstrap.js +154 -0
- package/lib/examples/bootstrap/Outputs.bootstrap.js.map +1 -0
- package/lib/examples/bootstrap/Terminal.bootstrap.d.ts +1 -0
- package/lib/examples/bootstrap/Terminal.bootstrap.js +13 -0
- package/lib/examples/bootstrap/Terminal.bootstrap.js.map +1 -0
- package/lib/examples/controls/CellControl.d.ts +3 -0
- package/lib/examples/controls/CellControl.js +15 -0
- package/lib/examples/controls/CellControl.js.map +1 -0
- package/lib/examples/controls/CommandsControl.d.ts +3 -0
- package/lib/examples/controls/CommandsControl.js +12 -0
- package/lib/examples/controls/CommandsControl.js.map +1 -0
- package/lib/examples/controls/ConsoleControl.d.ts +3 -0
- package/lib/examples/controls/ConsoleControl.js +12 -0
- package/lib/examples/controls/ConsoleControl.js.map +1 -0
- package/lib/examples/controls/DialogControl.d.ts +2 -0
- package/lib/examples/controls/DialogControl.js +7 -0
- package/lib/examples/controls/DialogControl.js.map +1 -0
- package/lib/examples/controls/FileBrowserControl.d.ts +3 -0
- package/lib/examples/controls/FileBrowserControl.js +12 -0
- package/lib/examples/controls/FileBrowserControl.js.map +1 -0
- package/lib/examples/controls/InitControl.d.ts +2 -0
- package/lib/examples/controls/InitControl.js +7 -0
- package/lib/examples/controls/InitControl.js.map +1 -0
- package/lib/examples/controls/NotebookControl.d.ts +3 -0
- package/lib/examples/controls/NotebookControl.js +16 -0
- package/lib/examples/controls/NotebookControl.js.map +1 -0
- package/lib/examples/controls/OutputControl.d.ts +3 -0
- package/lib/examples/controls/OutputControl.js +7 -0
- package/lib/examples/controls/OutputControl.js.map +1 -0
- package/lib/examples/controls/SettingsControl.d.ts +3 -0
- package/lib/examples/controls/SettingsControl.js +12 -0
- package/lib/examples/controls/SettingsControl.js.map +1 -0
- package/lib/examples/controls/SimpleControl.d.ts +2 -0
- package/lib/examples/controls/SimpleControl.js +7 -0
- package/lib/examples/controls/SimpleControl.js.map +1 -0
- package/lib/examples/controls/TerminalControl.d.ts +3 -0
- package/lib/examples/controls/TerminalControl.js +22 -0
- package/lib/examples/controls/TerminalControl.js.map +1 -0
- package/lib/examples/examples/cell/CellExample.d.ts +2 -0
- package/lib/examples/examples/cell/CellExample.js +42 -0
- package/lib/examples/examples/cell/CellExample.js.map +1 -0
- package/lib/examples/examples/gallery/GalleryExample.d.ts +2 -0
- package/lib/examples/examples/gallery/GalleryExample.js +154 -0
- package/lib/examples/examples/gallery/GalleryExample.js.map +1 -0
- package/lib/examples/examples/ipywidgets/IpyWidgetsExample.d.ts +4 -0
- package/lib/examples/examples/ipywidgets/IpyWidgetsExample.js +156 -0
- package/lib/examples/examples/ipywidgets/IpyWidgetsExample.js.map +1 -0
- package/lib/examples/examples/lumino/LuminoAdapter.css +34 -0
- package/lib/examples/examples/lumino/LuminoAdapter.d.ts +9 -0
- package/lib/examples/examples/lumino/LuminoAdapter.js +70 -0
- package/lib/examples/examples/lumino/LuminoAdapter.js.map +1 -0
- package/lib/examples/examples/lumino/LuminoExample.d.ts +2 -0
- package/lib/examples/examples/lumino/LuminoExample.js +10 -0
- package/lib/examples/examples/lumino/LuminoExample.js.map +1 -0
- package/lib/examples/examples/notebook/NotebookCustomHeader.d.ts +2 -0
- package/lib/examples/examples/notebook/NotebookCustomHeader.js +39 -0
- package/lib/examples/examples/notebook/NotebookCustomHeader.js.map +1 -0
- package/lib/examples/examples/notebook/NotebookExample.d.ts +1 -0
- package/lib/examples/examples/notebook/NotebookExample.js +24 -0
- package/lib/examples/examples/notebook/NotebookExample.js.map +1 -0
- package/lib/examples/theme/Layers.d.ts +2 -0
- package/lib/examples/theme/Layers.js +15 -0
- package/lib/examples/theme/Layers.js.map +1 -0
- package/lib/examples/theme/Layers.svg +14 -0
- package/lib/examples/theme/muiLightTheme.d.ts +8 -0
- package/lib/examples/theme/muiLightTheme.js +169 -0
- package/lib/examples/theme/muiLightTheme.js.map +1 -0
- package/lib/examples/theme/vintage.project.json +172 -0
- package/lib/examples/theme/westeros.project.json +168 -0
- package/lib/examples/theme/wonderland.project.json +168 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.js +45 -0
- package/lib/index.js.map +1 -0
- package/lib/ipywidgets/IPyWidgetsAttached.d.ts +8 -0
- package/lib/ipywidgets/IPyWidgetsAttached.js +15 -0
- package/lib/ipywidgets/IPyWidgetsAttached.js.map +1 -0
- package/lib/ipywidgets/IPyWidgetsClassicManager.d.ts +18 -0
- package/lib/ipywidgets/IPyWidgetsClassicManager.js +76 -0
- package/lib/ipywidgets/IPyWidgetsClassicManager.js.map +1 -0
- package/lib/ipywidgets/IPyWidgetsJupyterLabPlugin.d.ts +15 -0
- package/lib/ipywidgets/IPyWidgetsJupyterLabPlugin.js +178 -0
- package/lib/ipywidgets/IPyWidgetsJupyterLabPlugin.js.map +1 -0
- package/lib/ipywidgets/IpyWidgetsComponent.d.ts +4 -0
- package/lib/ipywidgets/IpyWidgetsComponent.js +9 -0
- package/lib/ipywidgets/IpyWidgetsComponent.js.map +1 -0
- package/lib/ipywidgets/IpyWidgetsManager.d.ts +11 -0
- package/lib/ipywidgets/IpyWidgetsManager.js +71 -0
- package/lib/ipywidgets/IpyWidgetsManager.js.map +1 -0
- package/lib/ipywidgets/plotly/Figure.d.ts +587 -0
- package/lib/ipywidgets/plotly/Figure.js +1697 -0
- package/lib/ipywidgets/plotly/Figure.js.map +1 -0
- package/lib/ipywidgets/plotly/index.d.ts +2 -0
- package/lib/ipywidgets/plotly/index.js +4 -0
- package/lib/ipywidgets/plotly/index.js.map +1 -0
- package/lib/ipywidgets/plotly/jupyterlab-plugin.d.ts +5 -0
- package/lib/ipywidgets/plotly/jupyterlab-plugin.js +12 -0
- package/lib/ipywidgets/plotly/jupyterlab-plugin.js.map +1 -0
- package/lib/ipywidgets/plotly/version.d.ts +8 -0
- package/lib/ipywidgets/plotly/version.js +16 -0
- package/lib/ipywidgets/plotly/version.js.map +1 -0
- package/lib/jupyter/AuthError.d.ts +7 -0
- package/lib/jupyter/AuthError.js +8 -0
- package/lib/jupyter/AuthError.js.map +1 -0
- package/lib/jupyter/Handlers.d.ts +8 -0
- package/lib/jupyter/Handlers.js +50 -0
- package/lib/jupyter/Handlers.js.map +1 -0
- package/lib/jupyter/Jupyter.d.ts +23 -0
- package/lib/jupyter/Jupyter.js +35 -0
- package/lib/jupyter/Jupyter.js.map +1 -0
- package/lib/jupyter/JupyterConfig.d.ts +37 -0
- package/lib/jupyter/JupyterConfig.js +59 -0
- package/lib/jupyter/JupyterConfig.js.map +1 -0
- package/lib/jupyter/JupyterContext.d.ts +35 -0
- package/lib/jupyter/JupyterContext.js +64 -0
- package/lib/jupyter/JupyterContext.js.map +1 -0
- package/lib/lumino/LuminoAttached.d.ts +9 -0
- package/lib/lumino/LuminoAttached.js +23 -0
- package/lib/lumino/LuminoAttached.js.map +1 -0
- package/lib/lumino/LuminoDetached.d.ts +9 -0
- package/lib/lumino/LuminoDetached.js +13 -0
- package/lib/lumino/LuminoDetached.js.map +1 -0
- package/lib/lumino/LuminoObservable.d.ts +6 -0
- package/lib/lumino/LuminoObservable.js +16 -0
- package/lib/lumino/LuminoObservable.js.map +1 -0
- package/lib/lumino/LuminoReactPortal.d.ts +180 -0
- package/lib/lumino/LuminoReactPortal.js +195 -0
- package/lib/lumino/LuminoReactPortal.js.map +1 -0
- package/lib/lumino/LuminoRedux.d.ts +8 -0
- package/lib/lumino/LuminoRedux.js +2 -0
- package/lib/lumino/LuminoRedux.js.map +1 -0
- package/lib/services/Services.d.ts +17 -0
- package/lib/services/Services.js +41 -0
- package/lib/services/Services.js.map +1 -0
- package/lib/services/kernel/Kernel.d.ts +18 -0
- package/lib/services/kernel/Kernel.js +95 -0
- package/lib/services/kernel/Kernel.js.map +1 -0
- package/lib/services/kernel/KernelModel.d.ts +18 -0
- package/lib/services/kernel/KernelModel.js +52 -0
- package/lib/services/kernel/KernelModel.js.map +1 -0
- package/lib/state/AllState.d.ts +8 -0
- package/lib/state/AllState.js +24 -0
- package/lib/state/AllState.js.map +1 -0
- package/lib/state/InjectableStore.d.ts +9 -0
- package/lib/state/InjectableStore.js +27 -0
- package/lib/state/InjectableStore.js.map +1 -0
- package/lib/state/init/Init.d.ts +3 -0
- package/lib/state/init/Init.js +12 -0
- package/lib/state/init/Init.js.map +1 -0
- package/lib/state/init/InitRedux.d.ts +21 -0
- package/lib/state/init/InitRedux.js +50 -0
- package/lib/state/init/InitRedux.js.map +1 -0
- package/lib/widgets/cell/CellAdapter.css +16 -0
- package/lib/widgets/cell/CellAdapter.d.ts +18 -0
- package/lib/widgets/cell/CellAdapter.js +160 -0
- package/lib/widgets/cell/CellAdapter.js.map +1 -0
- package/lib/widgets/cell/CellLumino.d.ts +9 -0
- package/lib/widgets/cell/CellLumino.js +48 -0
- package/lib/widgets/cell/CellLumino.js.map +1 -0
- package/lib/widgets/cell/CellState.d.ts +22 -0
- package/lib/widgets/cell/CellState.js +79 -0
- package/lib/widgets/cell/CellState.js.map +1 -0
- package/lib/widgets/commands/CommandsAdapter.css +3 -0
- package/lib/widgets/commands/CommandsAdapter.d.ts +9 -0
- package/lib/widgets/commands/CommandsAdapter.js +36 -0
- package/lib/widgets/commands/CommandsAdapter.js.map +1 -0
- package/lib/widgets/commands/CommandsLumino.d.ts +2 -0
- package/lib/widgets/commands/CommandsLumino.js +9 -0
- package/lib/widgets/commands/CommandsLumino.js.map +1 -0
- package/lib/widgets/commands/CommandsState.d.ts +19 -0
- package/lib/widgets/commands/CommandsState.js +50 -0
- package/lib/widgets/commands/CommandsState.js.map +1 -0
- package/lib/widgets/console/ConsoleAdapter.css +4 -0
- package/lib/widgets/console/ConsoleAdapter.d.ts +11 -0
- package/lib/widgets/console/ConsoleAdapter.js +82 -0
- package/lib/widgets/console/ConsoleAdapter.js.map +1 -0
- package/lib/widgets/console/ConsoleLumino.d.ts +2 -0
- package/lib/widgets/console/ConsoleLumino.js +9 -0
- package/lib/widgets/console/ConsoleLumino.js.map +1 -0
- package/lib/widgets/console/ConsoleState.d.ts +19 -0
- package/lib/widgets/console/ConsoleState.js +50 -0
- package/lib/widgets/console/ConsoleState.js.map +1 -0
- package/lib/widgets/dialog/DialogAdapter.css +0 -0
- package/lib/widgets/dialog/DialogAdapter.d.ts +10 -0
- package/lib/widgets/dialog/DialogAdapter.js +19 -0
- package/lib/widgets/dialog/DialogAdapter.js.map +1 -0
- package/lib/widgets/dialog/DialogLumino.d.ts +2 -0
- package/lib/widgets/dialog/DialogLumino.js +13 -0
- package/lib/widgets/dialog/DialogLumino.js.map +1 -0
- package/lib/widgets/editor/CodeMirrorEditor.d.ts +7 -0
- package/lib/widgets/editor/CodeMirrorEditor.js +62 -0
- package/lib/widgets/editor/CodeMirrorEditor.js.map +1 -0
- package/lib/widgets/filebrowser/FileBrowser.d.ts +2 -0
- package/lib/widgets/filebrowser/FileBrowser.js +60 -0
- package/lib/widgets/filebrowser/FileBrowser.js.map +1 -0
- package/lib/widgets/filebrowser/FileBrowserAdapter.css +8 -0
- package/lib/widgets/filebrowser/FileBrowserAdapter.d.ts +13 -0
- package/lib/widgets/filebrowser/FileBrowserAdapter.js +267 -0
- package/lib/widgets/filebrowser/FileBrowserAdapter.js.map +1 -0
- package/lib/widgets/filebrowser/FileBrowserLumino.d.ts +2 -0
- package/lib/widgets/filebrowser/FileBrowserLumino.js +9 -0
- package/lib/widgets/filebrowser/FileBrowserLumino.js.map +1 -0
- package/lib/widgets/filebrowser/FileBrowserState.d.ts +19 -0
- package/lib/widgets/filebrowser/FileBrowserState.js +50 -0
- package/lib/widgets/filebrowser/FileBrowserState.js.map +1 -0
- package/lib/widgets/notebook/NotebookAdapter.css +27 -0
- package/lib/widgets/notebook/NotebookAdapter.d.ts +26 -0
- package/lib/widgets/notebook/NotebookAdapter.js +187 -0
- package/lib/widgets/notebook/NotebookAdapter.js.map +1 -0
- package/lib/widgets/notebook/NotebookCommands.d.ts +7 -0
- package/lib/widgets/notebook/NotebookCommands.js +349 -0
- package/lib/widgets/notebook/NotebookCommands.js.map +1 -0
- package/lib/widgets/notebook/NotebookLumino.d.ts +19 -0
- package/lib/widgets/notebook/NotebookLumino.js +75 -0
- package/lib/widgets/notebook/NotebookLumino.js.map +1 -0
- package/lib/widgets/notebook/NotebookState.d.ts +43 -0
- package/lib/widgets/notebook/NotebookState.js +114 -0
- package/lib/widgets/notebook/NotebookState.js.map +1 -0
- package/lib/widgets/notebook/NotebookToolbar.d.ts +2 -0
- package/lib/widgets/notebook/NotebookToolbar.js +24 -0
- package/lib/widgets/notebook/NotebookToolbar.js.map +1 -0
- package/lib/widgets/notebook/extension/CellSidebar.d.ts +7 -0
- package/lib/widgets/notebook/extension/CellSidebar.js +23 -0
- package/lib/widgets/notebook/extension/CellSidebar.js.map +1 -0
- package/lib/widgets/notebook/extension/CellSidebarDefault.d.ts +2 -0
- package/lib/widgets/notebook/extension/CellSidebarDefault.js +47 -0
- package/lib/widgets/notebook/extension/CellSidebarDefault.js.map +1 -0
- package/lib/widgets/notebook/extension/ContentFactoryWithSidebar.d.ts +14 -0
- package/lib/widgets/notebook/extension/ContentFactoryWithSidebar.js +20 -0
- package/lib/widgets/notebook/extension/ContentFactoryWithSidebar.js.map +1 -0
- package/lib/widgets/notebook/extension/NotebookInputPrompt.d.ts +21 -0
- package/lib/widgets/notebook/extension/NotebookInputPrompt.js +67 -0
- package/lib/widgets/notebook/extension/NotebookInputPrompt.js.map +1 -0
- package/lib/widgets/outputs/OutputAdapter.css +0 -0
- package/lib/widgets/outputs/OutputAdapter.d.ts +21 -0
- package/lib/widgets/outputs/OutputAdapter.js +75 -0
- package/lib/widgets/outputs/OutputAdapter.js.map +1 -0
- package/lib/widgets/outputs/OutputLumino.d.ts +16 -0
- package/lib/widgets/outputs/OutputLumino.js +56 -0
- package/lib/widgets/outputs/OutputLumino.js.map +1 -0
- package/lib/widgets/outputs/OutputState.d.ts +19 -0
- package/lib/widgets/outputs/OutputState.js +50 -0
- package/lib/widgets/outputs/OutputState.js.map +1 -0
- package/lib/widgets/settings/SettingsAdapter.css +0 -0
- package/lib/widgets/settings/SettingsAdapter.d.ts +10 -0
- package/lib/widgets/settings/SettingsAdapter.js +16 -0
- package/lib/widgets/settings/SettingsAdapter.js.map +1 -0
- package/lib/widgets/settings/SettingsLumino.d.ts +2 -0
- package/lib/widgets/settings/SettingsLumino.js +11 -0
- package/lib/widgets/settings/SettingsLumino.js.map +1 -0
- package/lib/widgets/settings/SettingsState.d.ts +19 -0
- package/lib/widgets/settings/SettingsState.js +50 -0
- package/lib/widgets/settings/SettingsState.js.map +1 -0
- package/lib/widgets/terminal/TerminalAdapter.css +3 -0
- package/lib/widgets/terminal/TerminalAdapter.d.ts +13 -0
- package/lib/widgets/terminal/TerminalAdapter.js +28 -0
- package/lib/widgets/terminal/TerminalAdapter.js.map +1 -0
- package/lib/widgets/terminal/TerminalLumino.d.ts +2 -0
- package/lib/widgets/terminal/TerminalLumino.js +17 -0
- package/lib/widgets/terminal/TerminalLumino.js.map +1 -0
- package/lib/widgets/terminal/TerminalState.d.ts +17 -0
- package/lib/widgets/terminal/TerminalState.js +45 -0
- package/lib/widgets/terminal/TerminalState.js.map +1 -0
- package/package.json +163 -0
- package/style/index.css +3 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { IDisposable } from '@lumino/disposable';
|
|
2
|
+
import { Message } from '@lumino/messaging';
|
|
3
|
+
import { ISignal, Signal } from '@lumino/signaling';
|
|
4
|
+
import { Widget } from '@lumino/widgets';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
declare type ReactRenderElement = Array<React.ReactElement<any>> | React.ReactElement<any>;
|
|
7
|
+
/**
|
|
8
|
+
* An abstract class for a Lumino widget which renders a React component as a Portal.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class LuminoReactPortal extends Widget {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new `LuminoReactPortal` that renders a constant element.
|
|
13
|
+
* @param element React element to render.
|
|
14
|
+
*/
|
|
15
|
+
static create(element: ReactRenderElement): LuminoReactPortal;
|
|
16
|
+
/**
|
|
17
|
+
* Called to update the state of the widget.
|
|
18
|
+
*
|
|
19
|
+
* The default implementation of this method triggers
|
|
20
|
+
* VDOM based rendering by calling the `renderDOM` method.
|
|
21
|
+
*/
|
|
22
|
+
protected onUpdateRequest(msg: Message): void;
|
|
23
|
+
/**
|
|
24
|
+
* Called after the widget is attached to the DOM
|
|
25
|
+
*/
|
|
26
|
+
protected onAfterAttach(msg: Message): void;
|
|
27
|
+
/**
|
|
28
|
+
* Called before the widget is detached from the DOM.
|
|
29
|
+
*/
|
|
30
|
+
protected onBeforeDetach(msg: Message): void;
|
|
31
|
+
/**
|
|
32
|
+
* Render the React nodes to the DOM.
|
|
33
|
+
*
|
|
34
|
+
* @returns a promise that resolves when the rendering is done.
|
|
35
|
+
*/
|
|
36
|
+
private renderDOM;
|
|
37
|
+
renderPromise?: Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* An abstract LuminoReactPortal with a model.
|
|
41
|
+
*/
|
|
42
|
+
export declare abstract class VDomRenderer<T extends VDomRenderer.IModel | null = null> extends LuminoReactPortal {
|
|
43
|
+
/**
|
|
44
|
+
* Create a new VDomRenderer
|
|
45
|
+
*/
|
|
46
|
+
constructor(model: T extends null ? void : T);
|
|
47
|
+
/**
|
|
48
|
+
* A signal emitted when the model changes.
|
|
49
|
+
*/
|
|
50
|
+
get modelChanged(): ISignal<this, void>;
|
|
51
|
+
/**
|
|
52
|
+
* Set the model and fire changed signals.
|
|
53
|
+
*/
|
|
54
|
+
set model(newValue: T);
|
|
55
|
+
/**
|
|
56
|
+
* Get the current model.
|
|
57
|
+
*/
|
|
58
|
+
get model(): T;
|
|
59
|
+
/**
|
|
60
|
+
* Dispose this widget.
|
|
61
|
+
*/
|
|
62
|
+
dispose(): void;
|
|
63
|
+
private _model;
|
|
64
|
+
private _modelChanged;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Props for the UseSignal component
|
|
68
|
+
*/
|
|
69
|
+
export interface IUseSignalProps<SENDER, ARGS> {
|
|
70
|
+
/**
|
|
71
|
+
* Phosphor signal to connect to.
|
|
72
|
+
*/
|
|
73
|
+
signal: ISignal<SENDER, ARGS>;
|
|
74
|
+
/**
|
|
75
|
+
* Initial value to use for the sender, used before the signal emits a value.
|
|
76
|
+
* If not provided, initial sender will be undefined
|
|
77
|
+
*/
|
|
78
|
+
initialSender?: SENDER;
|
|
79
|
+
/**
|
|
80
|
+
* Initial value to use for the args, used before the signal emits a value.
|
|
81
|
+
* If not provided, initial args will be undefined.
|
|
82
|
+
*/
|
|
83
|
+
initialArgs?: ARGS;
|
|
84
|
+
/**
|
|
85
|
+
* Function mapping the last signal value or inital values to an element to render.
|
|
86
|
+
*
|
|
87
|
+
* Note: returns `React.ReactNode` as per
|
|
88
|
+
* https://github.com/sw-yx/react-typescript-cheatsheet#higher-order-componentsrender-props
|
|
89
|
+
*/
|
|
90
|
+
children: (sender?: SENDER, args?: ARGS) => React.ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* Given the last signal value, should return whether to update the state or not.
|
|
93
|
+
*
|
|
94
|
+
* The default unconditionally returns `true`, so you only have to override if you want
|
|
95
|
+
* to skip some updates.
|
|
96
|
+
*/
|
|
97
|
+
shouldUpdate?: (sender: SENDER, args: ARGS) => boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* State for the UseSignal component
|
|
101
|
+
*/
|
|
102
|
+
export interface IUseSignalState<SENDER, ARGS> {
|
|
103
|
+
value: [SENDER?, ARGS?];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* UseSignal provides a way to hook up a Phosphor signal to a React element,
|
|
107
|
+
* so that the element is re-rendered every time the signal fires.
|
|
108
|
+
*
|
|
109
|
+
* It is implemented through the "render props" technique, using the `children`
|
|
110
|
+
* prop as a function to render, so that it can be used either as a prop or as a child
|
|
111
|
+
* of this element
|
|
112
|
+
* https://reactjs.org/docs/render-props.html
|
|
113
|
+
*
|
|
114
|
+
*
|
|
115
|
+
* Example as child:
|
|
116
|
+
*
|
|
117
|
+
* ```
|
|
118
|
+
* function LiveButton(isActiveSignal: ISignal<any, boolean>) {
|
|
119
|
+
* return (
|
|
120
|
+
* <UseSignal signal={isActiveSignal} initialArgs={True}>
|
|
121
|
+
* {(_, isActive) => <Button isActive={isActive}>}
|
|
122
|
+
* </UseSignal>
|
|
123
|
+
* )
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* Example as prop:
|
|
128
|
+
*
|
|
129
|
+
* ```
|
|
130
|
+
* function LiveButton(isActiveSignal: ISignal<any, boolean>) {
|
|
131
|
+
* return (
|
|
132
|
+
* <UseSignal
|
|
133
|
+
* signal={isActiveSignal}
|
|
134
|
+
* initialArgs={True}
|
|
135
|
+
* children={(_, isActive) => <Button isActive={isActive}>}
|
|
136
|
+
* />
|
|
137
|
+
* )
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare class UseSignal<SENDER, ARGS> extends React.Component<IUseSignalProps<SENDER, ARGS>, IUseSignalState<SENDER, ARGS>> {
|
|
142
|
+
constructor(props: IUseSignalProps<SENDER, ARGS>);
|
|
143
|
+
componentDidMount(): void;
|
|
144
|
+
componentWillUnmount(): void;
|
|
145
|
+
private slot;
|
|
146
|
+
render(): React.ReactNode;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The namespace for VDomRenderer statics.
|
|
150
|
+
*/
|
|
151
|
+
export declare namespace VDomRenderer {
|
|
152
|
+
/**
|
|
153
|
+
* An interface for a model to be used with vdom rendering.
|
|
154
|
+
*/
|
|
155
|
+
interface IModel extends IDisposable {
|
|
156
|
+
/**
|
|
157
|
+
* A signal emitted when any model state changes.
|
|
158
|
+
*/
|
|
159
|
+
readonly stateChanged: ISignal<this, void>;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Concrete implementation of VDomRenderer model.
|
|
164
|
+
*/
|
|
165
|
+
export declare class VDomModel implements VDomRenderer.IModel {
|
|
166
|
+
/**
|
|
167
|
+
* A signal emitted when any model state changes.
|
|
168
|
+
*/
|
|
169
|
+
readonly stateChanged: Signal<this, void>;
|
|
170
|
+
/**
|
|
171
|
+
* Test whether the model is disposed.
|
|
172
|
+
*/
|
|
173
|
+
get isDisposed(): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Dispose the model.
|
|
176
|
+
*/
|
|
177
|
+
dispose(): void;
|
|
178
|
+
private _isDisposed;
|
|
179
|
+
}
|
|
180
|
+
export {};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import { MessageLoop } from '@lumino/messaging';
|
|
4
|
+
import { Signal } from '@lumino/signaling';
|
|
5
|
+
import { Widget } from '@lumino/widgets';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import * as ReactDOM from 'react-dom';
|
|
8
|
+
/**
|
|
9
|
+
* An abstract class for a Lumino widget which renders a React component as a Portal.
|
|
10
|
+
*/
|
|
11
|
+
export class LuminoReactPortal extends Widget {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new `LuminoReactPortal` that renders a constant element.
|
|
14
|
+
* @param element React element to render.
|
|
15
|
+
*/
|
|
16
|
+
static create(element) {
|
|
17
|
+
return new (class extends LuminoReactPortal {
|
|
18
|
+
render() {
|
|
19
|
+
return element;
|
|
20
|
+
}
|
|
21
|
+
})();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Called to update the state of the widget.
|
|
25
|
+
*
|
|
26
|
+
* The default implementation of this method triggers
|
|
27
|
+
* VDOM based rendering by calling the `renderDOM` method.
|
|
28
|
+
*/
|
|
29
|
+
onUpdateRequest(msg) {
|
|
30
|
+
this.renderPromise = this.renderDOM();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Called after the widget is attached to the DOM
|
|
34
|
+
*/
|
|
35
|
+
onAfterAttach(msg) {
|
|
36
|
+
// Make *sure* the widget is rendered.
|
|
37
|
+
MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Called before the widget is detached from the DOM.
|
|
41
|
+
*/
|
|
42
|
+
onBeforeDetach(msg) {
|
|
43
|
+
// Unmount the component so it can tear down.
|
|
44
|
+
ReactDOM.unmountComponentAtNode(this.node);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Render the React nodes to the DOM.
|
|
48
|
+
*
|
|
49
|
+
* @returns a promise that resolves when the rendering is done.
|
|
50
|
+
*/
|
|
51
|
+
renderDOM() {
|
|
52
|
+
return new Promise(resolve => {
|
|
53
|
+
// no-op
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* An abstract LuminoReactPortal with a model.
|
|
59
|
+
*/
|
|
60
|
+
export class VDomRenderer extends LuminoReactPortal {
|
|
61
|
+
/**
|
|
62
|
+
* Create a new VDomRenderer
|
|
63
|
+
*/
|
|
64
|
+
constructor(model) {
|
|
65
|
+
super();
|
|
66
|
+
this._modelChanged = new Signal(this);
|
|
67
|
+
this.model = (model !== null && model !== void 0 ? model : null);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A signal emitted when the model changes.
|
|
71
|
+
*/
|
|
72
|
+
get modelChanged() {
|
|
73
|
+
return this._modelChanged;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Set the model and fire changed signals.
|
|
77
|
+
*/
|
|
78
|
+
set model(newValue) {
|
|
79
|
+
if (this._model === newValue) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this._model) {
|
|
83
|
+
this._model.stateChanged.disconnect(this.update, this);
|
|
84
|
+
}
|
|
85
|
+
this._model = newValue;
|
|
86
|
+
if (newValue) {
|
|
87
|
+
newValue.stateChanged.connect(this.update, this);
|
|
88
|
+
}
|
|
89
|
+
this.update();
|
|
90
|
+
this._modelChanged.emit(void 0);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get the current model.
|
|
94
|
+
*/
|
|
95
|
+
get model() {
|
|
96
|
+
return this._model;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Dispose this widget.
|
|
100
|
+
*/
|
|
101
|
+
dispose() {
|
|
102
|
+
if (this.isDisposed) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this._model = null;
|
|
106
|
+
super.dispose();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* UseSignal provides a way to hook up a Phosphor signal to a React element,
|
|
111
|
+
* so that the element is re-rendered every time the signal fires.
|
|
112
|
+
*
|
|
113
|
+
* It is implemented through the "render props" technique, using the `children`
|
|
114
|
+
* prop as a function to render, so that it can be used either as a prop or as a child
|
|
115
|
+
* of this element
|
|
116
|
+
* https://reactjs.org/docs/render-props.html
|
|
117
|
+
*
|
|
118
|
+
*
|
|
119
|
+
* Example as child:
|
|
120
|
+
*
|
|
121
|
+
* ```
|
|
122
|
+
* function LiveButton(isActiveSignal: ISignal<any, boolean>) {
|
|
123
|
+
* return (
|
|
124
|
+
* <UseSignal signal={isActiveSignal} initialArgs={True}>
|
|
125
|
+
* {(_, isActive) => <Button isActive={isActive}>}
|
|
126
|
+
* </UseSignal>
|
|
127
|
+
* )
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* Example as prop:
|
|
132
|
+
*
|
|
133
|
+
* ```
|
|
134
|
+
* function LiveButton(isActiveSignal: ISignal<any, boolean>) {
|
|
135
|
+
* return (
|
|
136
|
+
* <UseSignal
|
|
137
|
+
* signal={isActiveSignal}
|
|
138
|
+
* initialArgs={True}
|
|
139
|
+
* children={(_, isActive) => <Button isActive={isActive}>}
|
|
140
|
+
* />
|
|
141
|
+
* )
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export class UseSignal extends React.Component {
|
|
146
|
+
constructor(props) {
|
|
147
|
+
super(props);
|
|
148
|
+
this.slot = (sender, args) => {
|
|
149
|
+
// skip setting new state if we have a shouldUpdate function and it returns false
|
|
150
|
+
if (this.props.shouldUpdate && !this.props.shouldUpdate(sender, args)) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
this.setState({ value: [sender, args] });
|
|
154
|
+
};
|
|
155
|
+
this.state = { value: [this.props.initialSender, this.props.initialArgs] };
|
|
156
|
+
}
|
|
157
|
+
componentDidMount() {
|
|
158
|
+
this.props.signal.connect(this.slot);
|
|
159
|
+
}
|
|
160
|
+
componentWillUnmount() {
|
|
161
|
+
this.props.signal.disconnect(this.slot);
|
|
162
|
+
}
|
|
163
|
+
render() {
|
|
164
|
+
return this.props.children(...this.state.value);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Concrete implementation of VDomRenderer model.
|
|
169
|
+
*/
|
|
170
|
+
export class VDomModel {
|
|
171
|
+
constructor() {
|
|
172
|
+
/**
|
|
173
|
+
* A signal emitted when any model state changes.
|
|
174
|
+
*/
|
|
175
|
+
this.stateChanged = new Signal(this);
|
|
176
|
+
this._isDisposed = false;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Test whether the model is disposed.
|
|
180
|
+
*/
|
|
181
|
+
get isDisposed() {
|
|
182
|
+
return this._isDisposed;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Dispose the model.
|
|
186
|
+
*/
|
|
187
|
+
dispose() {
|
|
188
|
+
if (this.isDisposed) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this._isDisposed = true;
|
|
192
|
+
Signal.clearData(this);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=LuminoReactPortal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LuminoReactPortal.js","sourceRoot":"","sources":["../../src/lumino/LuminoReactPortal.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAAW,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAMtC;;GAEG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,MAAM;IACpD;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,OAA2B;QACvC,OAAO,IAAI,CAAC,KAAM,SAAQ,iBAAiB;YACzC,MAAM;gBACJ,OAAO,OAAO,CAAC;YACjB,CAAC;SACF,CAAC,EAAE,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACO,eAAe,CAAC,GAAY;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACxC,CAAC;IAED;;OAEG;IACO,aAAa,CAAC,GAAY;QAClC,sCAAsC;QACtC,WAAW,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,GAAY;QACnC,6CAA6C;QAC7C,QAAQ,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACK,SAAS;QACf,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YACjC,QAAQ;QACV,CAAC,CAAC,CAAC;IACL,CAAC;CAIF;AAED;;GAEG;AACH,MAAM,OAAgB,YAEpB,SAAQ,iBAAiB;IACzB;;OAEG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+1 @@
|
|
|
1
|
+
{"version":3,"file":"LuminoRedux.js","sourceRoot":"","sources":["../../src/lumino/LuminoRedux.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContentsManager } from '@jupyterlab/services';
|
|
2
|
+
declare class Services {
|
|
3
|
+
private _services;
|
|
4
|
+
constructor();
|
|
5
|
+
kernelspecs(): import("@jupyterlab/services").KernelSpecManager;
|
|
6
|
+
contents(): ContentsManager;
|
|
7
|
+
nbconvert(): import("@jupyterlab/services").NbConvertManager;
|
|
8
|
+
sessions(): import("@jupyterlab/services").SessionManager;
|
|
9
|
+
settings(): import("@jupyterlab/services").SettingManager;
|
|
10
|
+
terminals(): import("@jupyterlab/services").TerminalManager;
|
|
11
|
+
workspaces(): import("@jupyterlab/services").WorkspaceManager;
|
|
12
|
+
builder(): import("@jupyterlab/services/lib/builder").BuildManager;
|
|
13
|
+
serverSettings(): import("@jupyterlab/services").ServerConnection.ISettings;
|
|
14
|
+
refreshKernelspecs(): Promise<void>;
|
|
15
|
+
getKernelspecs(): import("@jupyterlab/services/lib/kernelspec/restapi").ISpecModels | null;
|
|
16
|
+
}
|
|
17
|
+
export default Services;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ServiceManager } from '@jupyterlab/services';
|
|
2
|
+
class Services {
|
|
3
|
+
constructor() {
|
|
4
|
+
this._services = new ServiceManager();
|
|
5
|
+
}
|
|
6
|
+
kernelspecs() {
|
|
7
|
+
return this._services.kernelspecs;
|
|
8
|
+
}
|
|
9
|
+
contents() {
|
|
10
|
+
return this._services.contents;
|
|
11
|
+
}
|
|
12
|
+
nbconvert() {
|
|
13
|
+
return this._services.nbconvert;
|
|
14
|
+
}
|
|
15
|
+
sessions() {
|
|
16
|
+
return this._services.sessions;
|
|
17
|
+
}
|
|
18
|
+
settings() {
|
|
19
|
+
return this._services.settings;
|
|
20
|
+
}
|
|
21
|
+
terminals() {
|
|
22
|
+
return this._services.terminals;
|
|
23
|
+
}
|
|
24
|
+
workspaces() {
|
|
25
|
+
return this._services.workspaces;
|
|
26
|
+
}
|
|
27
|
+
builder() {
|
|
28
|
+
return this._services.builder;
|
|
29
|
+
}
|
|
30
|
+
serverSettings() {
|
|
31
|
+
return this._services.serverSettings;
|
|
32
|
+
}
|
|
33
|
+
refreshKernelspecs() {
|
|
34
|
+
return this.kernelspecs().refreshSpecs();
|
|
35
|
+
}
|
|
36
|
+
getKernelspecs() {
|
|
37
|
+
return this.kernelspecs().specs;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export default Services;
|
|
41
|
+
//# sourceMappingURL=Services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Services.js","sourceRoot":"","sources":["../../src/services/Services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAEvE,MAAM,QAAQ;IAGZ;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;IACxC,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;IACpC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IACjC,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;IAClC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IACjC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IACjC,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;IAClC,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;IACnC,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;IAChC,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;IACvC,CAAC;IAEM,kBAAkB;QACvB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,CAAC;IAC3C,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;IAClC,CAAC;CAEF;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Kernel as JupyterKernel } from '@jupyterlab/services';
|
|
2
|
+
export declare type IKernelProps = {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
wsUrl?: string;
|
|
5
|
+
kernelType?: string;
|
|
6
|
+
eventName?: string;
|
|
7
|
+
};
|
|
8
|
+
declare class Kernel {
|
|
9
|
+
private _kernelPromise;
|
|
10
|
+
private _serverSettings;
|
|
11
|
+
private _kernelType;
|
|
12
|
+
private _eventName;
|
|
13
|
+
constructor(options?: IKernelProps);
|
|
14
|
+
getJupyterKernel(): Promise<JupyterKernel.IKernelConnection>;
|
|
15
|
+
private requestKernel;
|
|
16
|
+
private event;
|
|
17
|
+
}
|
|
18
|
+
export default Kernel;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ServerConnection, KernelManager, SessionManager } from '@jupyterlab/services';
|
|
11
|
+
import { UUID } from '@lumino/coreutils';
|
|
12
|
+
/*
|
|
13
|
+
const headers = new Headers({
|
|
14
|
+
// 'Cookie': 'Test',
|
|
15
|
+
'X-Datalayer': 'Datalayer',
|
|
16
|
+
});
|
|
17
|
+
*/
|
|
18
|
+
class Kernel {
|
|
19
|
+
// private _useStorage: boolean;
|
|
20
|
+
// private _storageKey: string;
|
|
21
|
+
// private _storageExpire: number;
|
|
22
|
+
constructor(options = {}) {
|
|
23
|
+
this._serverSettings = ServerConnection.makeSettings({
|
|
24
|
+
baseUrl: options.baseUrl || (location.protocol + '//' + location.host + "/api/jupyter"),
|
|
25
|
+
wsUrl: options.wsUrl || (location.protocol.replace('http', 'ws') + '//' + location.host + "/api/jupyter"),
|
|
26
|
+
appendToken: true,
|
|
27
|
+
init: {
|
|
28
|
+
credentials: "include",
|
|
29
|
+
mode: 'cors',
|
|
30
|
+
// headers: headers,
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
this._kernelType = options.kernelType || 'python3';
|
|
34
|
+
this._eventName = options.eventName || 'dla-jupyter-output';
|
|
35
|
+
// this._useStorage = options.useStorage == undefined ? true : options.useStorage;
|
|
36
|
+
// this._storageKey = options.storageKey || 'dla-jupyter-output';
|
|
37
|
+
// this._storageExpire = options.storageExpire || 60;
|
|
38
|
+
}
|
|
39
|
+
getJupyterKernel() {
|
|
40
|
+
if (this._kernelPromise) {
|
|
41
|
+
return this._kernelPromise;
|
|
42
|
+
}
|
|
43
|
+
/*
|
|
44
|
+
if (this._useStorage && typeof window !== 'undefined') {
|
|
45
|
+
const stored = window.localStorage.getItem(this._storageKey);
|
|
46
|
+
if (stored) {
|
|
47
|
+
const { settings, timestamp } = JSON.parse(stored);
|
|
48
|
+
if (timestamp && new Date().getTime() < timestamp) {
|
|
49
|
+
this._kernelPromise = this.requestKernel(settings);
|
|
50
|
+
return this._kernelPromise;
|
|
51
|
+
}
|
|
52
|
+
window.localStorage.removeItem(this._storageKey);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
*/
|
|
56
|
+
this._kernelPromise = this.requestKernel();
|
|
57
|
+
return this._kernelPromise;
|
|
58
|
+
}
|
|
59
|
+
requestKernel() {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
/*
|
|
62
|
+
if (this._useStorage && typeof window !== 'undefined') {
|
|
63
|
+
const timestamp = new Date().getTime() + this._storageExpire * 60 * 1000;
|
|
64
|
+
const json = JSON.stringify({this._serverSettings, timestamp});
|
|
65
|
+
window.localStorage.setItem(this._storageKey, json);
|
|
66
|
+
}
|
|
67
|
+
*/
|
|
68
|
+
const kernelManager = new KernelManager({
|
|
69
|
+
serverSettings: this._serverSettings,
|
|
70
|
+
standby: 'never',
|
|
71
|
+
});
|
|
72
|
+
const sessionManager = new SessionManager({
|
|
73
|
+
serverSettings: this._serverSettings,
|
|
74
|
+
kernelManager,
|
|
75
|
+
standby: 'never',
|
|
76
|
+
});
|
|
77
|
+
yield sessionManager.ready;
|
|
78
|
+
const kernelId = UUID.uuid4();
|
|
79
|
+
const session = yield sessionManager.startNew({
|
|
80
|
+
path: kernelId,
|
|
81
|
+
name: kernelId,
|
|
82
|
+
type: this._kernelType,
|
|
83
|
+
});
|
|
84
|
+
yield session.kernel.info;
|
|
85
|
+
this.event('ready', session.kernel.info);
|
|
86
|
+
return session.kernel;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
event(status, data) {
|
|
90
|
+
const ev = new CustomEvent(this._eventName, { detail: { status, data } });
|
|
91
|
+
document.dispatchEvent(ev);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export default Kernel;
|
|
95
|
+
//# sourceMappingURL=Kernel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kernel.js","sourceRoot":"","sources":["../../../src/services/kernel/Kernel.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAA2B,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB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G,IAAI,cAAc,CAAC;gBACxC,cAAc,EAAE,IAAI,CAAC,eAAe;gBACpC,aAAa;gBACb,OAAO,EAAE,OAAO;aACjB,CAAC,CAAC;YACH,MAAM,cAAc,CAAC,KAAK,CAAC;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;gBAC5C,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,IAAI,CAAC,WAAW;aACvB,CAAC,CAAC;YACH,MAAM,OAAO,CAAC,MAAO,CAAC,IAAI,CAAC;YAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,MAAO,CAAC,IAAI,CAAC,CAAC;YAC1C,OAAO,OAAO,CAAC,MAAO,CAAC;QACzB,CAAC;KAAA;IAEO,KAAK,CAAC,MAAc,EAAE,IAAS;QACrC,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,EAAC,MAAM,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,EAAC,CAAC,CAAC;QACtE,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CAEF;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ISessionContext } from '@jupyterlab/apputils';
|
|
2
|
+
import { IOutput } from '@jupyterlab/nbformat';
|
|
3
|
+
import { Kernel, KernelMessage } from '@jupyterlab/services';
|
|
4
|
+
import { ISignal } from '@lumino/signaling';
|
|
5
|
+
declare class KernelModel {
|
|
6
|
+
constructor(session: ISessionContext);
|
|
7
|
+
get future(): Kernel.IFuture<KernelMessage.IExecuteRequestMsg, KernelMessage.IExecuteReplyMsg> | null;
|
|
8
|
+
set future(value: Kernel.IFuture<KernelMessage.IExecuteRequestMsg, KernelMessage.IExecuteReplyMsg> | null);
|
|
9
|
+
get output(): IOutput | null;
|
|
10
|
+
get stateChanged(): ISignal<KernelModel, void>;
|
|
11
|
+
execute(code: string): void;
|
|
12
|
+
private _onIOPub;
|
|
13
|
+
private _future;
|
|
14
|
+
private _output;
|
|
15
|
+
private _sessionContext;
|
|
16
|
+
private _stateChanged;
|
|
17
|
+
}
|
|
18
|
+
export default KernelModel;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Signal } from '@lumino/signaling';
|
|
2
|
+
class KernelModel {
|
|
3
|
+
constructor(session) {
|
|
4
|
+
this._onIOPub = (msg) => {
|
|
5
|
+
const msgType = msg.header.msg_type;
|
|
6
|
+
switch (msgType) {
|
|
7
|
+
case 'execute_result':
|
|
8
|
+
break;
|
|
9
|
+
case 'display_data':
|
|
10
|
+
break;
|
|
11
|
+
case 'update_display_data':
|
|
12
|
+
this._output = msg.content;
|
|
13
|
+
this._stateChanged.emit();
|
|
14
|
+
break;
|
|
15
|
+
default:
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
};
|
|
20
|
+
this._future = null;
|
|
21
|
+
this._output = null;
|
|
22
|
+
this._stateChanged = new Signal(this);
|
|
23
|
+
this._sessionContext = session;
|
|
24
|
+
}
|
|
25
|
+
get future() {
|
|
26
|
+
return this._future;
|
|
27
|
+
}
|
|
28
|
+
set future(value) {
|
|
29
|
+
this._future = value;
|
|
30
|
+
if (!value) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
value.onIOPub = this._onIOPub;
|
|
34
|
+
}
|
|
35
|
+
get output() {
|
|
36
|
+
return this._output;
|
|
37
|
+
}
|
|
38
|
+
get stateChanged() {
|
|
39
|
+
return this._stateChanged;
|
|
40
|
+
}
|
|
41
|
+
execute(code) {
|
|
42
|
+
var _a, _b, _c;
|
|
43
|
+
if (!this._sessionContext || !((_a = this._sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.future = (_c = (_b = this._sessionContext.session) === null || _b === void 0 ? void 0 : _b.kernel) === null || _c === void 0 ? void 0 : _c.requestExecute({
|
|
47
|
+
code
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export default KernelModel;
|
|
52
|
+
//# sourceMappingURL=KernelModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KernelModel.js","sourceRoot":"","sources":["../../../src/services/kernel/KernelModel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW;IACf,YAAY,OAAwB;QAyC5B,aAAQ,GAAG,CAAC,GAAgC,EAAQ,EAAE;YAC5D,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC;YACpC,QAAQ,OAAO,EAAE;gBACf,KAAK,gBAAgB;oBACnB,MAAM;gBACR,KAAK,cAAc;oBACjB,MAAM;gBACR,KAAK,qBAAqB;oBACxB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAkB,CAAC;oBACtC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;oBAC1B,MAAM;gBACR;oBACE,MAAM;aACT;YACD,OAAO;QACT,CAAC,CAAC;QAEM,YAAO,GAGJ,IAAI,CAAC;QACR,YAAO,GAAmB,IAAI,CAAC;QAE/B,kBAAa,GAAG,IAAI,MAAM,CAAoB,IAAI,CAAC,CAAC;QA/D1D,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;IACjC,CAAC;IAED,IAAI,MAAM;QAIR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,MAAM,CACR,KAGQ;QAER,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,OAAO,CAAC,IAAY;;QAClB,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,eAAe,CAAC,OAAO,0CAAE,MAAM,CAAA,EAAE;YAClE,OAAO;SACR;QACD,IAAI,CAAC,MAAM,GAAG,MAAA,MAAA,IAAI,CAAC,eAAe,CAAC,OAAO,0CAAE,MAAM,0CAAE,cAAc,CAAC;YACjE,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CA0BF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnyAction } from "typescript-fsa";
|
|
2
|
+
import { IInitState } from "./init/InitRedux";
|
|
3
|
+
export interface IState {
|
|
4
|
+
counter: IInitState;
|
|
5
|
+
}
|
|
6
|
+
export declare const initialState: IState;
|
|
7
|
+
export declare const epics: import("redux-observable").Epic<AnyAction, AnyAction, any, any>;
|
|
8
|
+
export declare const reducers: import("redux").Reducer<import("redux").CombinedState<IState>, import("redux").AnyAction>;
|