@datalayer/jupyter-react 0.19.3 → 0.19.4
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/lib/components/console/Console.js +5 -5
- package/lib/components/console/Console.js.map +1 -1
- package/lib/components/notebook/BaseNotebook.d.ts +148 -0
- package/lib/components/notebook/BaseNotebook.js +717 -0
- package/lib/components/notebook/BaseNotebook.js.map +1 -0
- package/lib/components/notebook/Notebook.d.ts +15 -14
- package/lib/components/notebook/Notebook.js +143 -55
- package/lib/components/notebook/Notebook.js.map +1 -1
- package/lib/components/notebook/NotebookAdapter.js +2 -2
- package/lib/components/notebook/NotebookAdapter.js.map +1 -1
- package/lib/components/notebook/NotebookCommands.d.ts +14 -4
- package/lib/components/notebook/NotebookCommands.js +213 -149
- package/lib/components/notebook/NotebookCommands.js.map +1 -1
- package/lib/components/notebook/NotebookState.js +6 -6
- package/lib/components/notebook/NotebookState.js.map +1 -1
- package/lib/components/notebook/SimpleNotebook.d.ts +34 -0
- package/lib/components/notebook/SimpleNotebook.js +84 -0
- package/lib/components/notebook/SimpleNotebook.js.map +1 -0
- package/lib/components/notebook/content/JupyterReactContentFactory.js +2 -1
- package/lib/components/notebook/content/JupyterReactContentFactory.js.map +1 -1
- package/lib/components/notebook/index.d.ts +2 -0
- package/lib/components/notebook/index.js +2 -0
- package/lib/components/notebook/index.js.map +1 -1
- package/lib/components/output/Output.js +1 -1
- package/lib/components/output/Output.js.map +1 -1
- package/lib/components/output/OutputAdapter.js +2 -2
- package/lib/components/output/OutputAdapter.js.map +1 -1
- package/lib/components/utils/Loader.d.ts +4 -0
- package/lib/components/utils/Loader.js +23 -0
- package/lib/components/utils/Loader.js.map +1 -0
- package/lib/components/utils/SpinnerCentered.d.ts +2 -1
- package/lib/components/utils/SpinnerCentered.js +2 -2
- package/lib/components/utils/SpinnerCentered.js.map +1 -1
- package/lib/components/utils/index.d.ts +1 -0
- package/lib/components/utils/index.js +1 -0
- package/lib/components/utils/index.js.map +1 -1
- package/lib/examples/CellLite.js +2 -2
- package/lib/examples/CellLite.js.map +1 -1
- package/lib/examples/ConsoleLite.js +2 -2
- package/lib/examples/ConsoleLite.js.map +1 -1
- package/lib/examples/KernelExecute.js +1 -1
- package/lib/examples/KernelExecute.js.map +1 -1
- package/lib/examples/KernelExecutor.js +1 -1
- package/lib/examples/KernelExecutor.js.map +1 -1
- package/lib/examples/Kernels.js +1 -1
- package/lib/examples/Kernels.js.map +1 -1
- package/lib/examples/NotebookCellSidebar.js +1 -1
- package/lib/examples/NotebookCellSidebar.js.map +1 -1
- package/lib/examples/NotebookCellToolbar.js +1 -1
- package/lib/examples/NotebookCellToolbar.js.map +1 -1
- package/lib/examples/NotebookColormode.js +1 -1
- package/lib/examples/NotebookColormode.js.map +1 -1
- package/lib/examples/NotebookLite.js +1 -1
- package/lib/examples/NotebookLite.js.map +1 -1
- package/lib/examples/NotebookReadonly.js +1 -1
- package/lib/examples/NotebookReadonly.js.map +1 -1
- package/lib/examples/NotebookSimple.d.ts +1 -0
- package/lib/examples/NotebookSimple.js +36 -0
- package/lib/examples/NotebookSimple.js.map +1 -0
- package/lib/examples/Output.js +3 -3
- package/lib/examples/Output.js.map +1 -1
- package/lib/examples/OutputWithMonitoring.js +1 -1
- package/lib/examples/OutputWithMonitoring.js.map +1 -1
- package/lib/examples/Outputs.js +3 -3
- package/lib/examples/Outputs.js.map +1 -1
- package/lib/examples/extensions/celltoolbar/CellToolbarExtension.d.ts +1 -1
- package/lib/examples/extensions/celltoolbar/CellToolbarExtension.js +6 -2
- package/lib/examples/extensions/celltoolbar/CellToolbarExtension.js.map +1 -1
- package/lib/examples/extensions/exectime/ExecTimeExtension.d.ts +1 -1
- package/lib/examples/extensions/exectime/ExecTimeExtension.js +1 -1
- package/lib/examples/extensions/exectime/ExecTimeExtension.js.map +1 -1
- package/lib/examples/notebooks/Lite.ipynb.json +146 -0
- package/lib/examples/toolbars/NotebookToolbarAutoSave.js +3 -3
- package/lib/examples/toolbars/NotebookToolbarAutoSave.js.map +1 -1
- package/lib/jupyter/JupyterContext.d.ts +0 -11
- package/lib/jupyter/JupyterContext.js +0 -2
- package/lib/jupyter/JupyterContext.js.map +1 -1
- package/lib/jupyter/collaboration/DatalayerCollaboration.d.ts +7 -2
- package/lib/jupyter/collaboration/DatalayerCollaboration.js +24 -1
- package/lib/jupyter/collaboration/DatalayerCollaboration.js.map +1 -1
- package/lib/jupyter/collaboration/JupyterCollaboration.d.ts +2 -2
- package/lib/jupyter/collaboration/JupyterCollaboration.js +3 -3
- package/lib/jupyter/collaboration/JupyterCollaboration.js.map +1 -1
- package/lib/utils/Utils.d.ts +6 -0
- package/lib/utils/Utils.js +9 -1
- package/lib/utils/Utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,20 +11,20 @@ import ConsoleAdapter from './ConsoleAdapter';
|
|
|
11
11
|
import useConsoleStore from './ConsoleState';
|
|
12
12
|
import './Console.css';
|
|
13
13
|
export const Console = (options) => {
|
|
14
|
-
const { defaultKernel,
|
|
14
|
+
const { defaultKernel, serviceManager } = useJupyter();
|
|
15
15
|
const [adapter, setAdapter] = useState();
|
|
16
|
-
const
|
|
16
|
+
const store = useConsoleStore();
|
|
17
17
|
useEffect(() => {
|
|
18
|
-
if (serviceManager
|
|
18
|
+
if (serviceManager) {
|
|
19
19
|
const adapter = new ConsoleAdapter({
|
|
20
20
|
kernel: defaultKernel,
|
|
21
21
|
serviceManager,
|
|
22
22
|
code: options.code,
|
|
23
23
|
});
|
|
24
24
|
setAdapter(adapter);
|
|
25
|
-
|
|
25
|
+
store.setAdapter(adapter);
|
|
26
26
|
}
|
|
27
|
-
}, [defaultKernel,
|
|
27
|
+
}, [defaultKernel, serviceManager]);
|
|
28
28
|
return adapter ? (_jsx(Lumino, { children: adapter.panel })) : (_jsx(_Fragment, { children: "Loading Jupyter Console..." }));
|
|
29
29
|
};
|
|
30
30
|
export default Console;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Console.js","sourceRoot":"","sources":["../../../src/components/console/Console.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,eAAe,MAAM,gBAAgB,CAAC;AAE7C,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAgC,EAAE,EAAE;IAC1D,MAAM,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"Console.js","sourceRoot":"","sources":["../../../src/components/console/Console.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,eAAe,MAAM,gBAAgB,CAAC;AAE7C,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAgC,EAAE,EAAE;IAC1D,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE,CAAC;IACvD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAkB,CAAC;IACzD,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,cAAc,EAAE;YAClB,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC;gBACjC,MAAM,EAAE,aAAa;gBACrB,cAAc;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC,CAAC;YACH,UAAU,CAAC,OAAO,CAAC,CAAC;YACpB,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;SAC3B;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC,CAAC,CAAC,CACf,KAAC,MAAM,cAAE,OAAO,CAAC,KAAK,GAAU,CACjC,CAAC,CAAC,CAAC,CACF,2DAA+B,CAChC,CAAC;AACJ,CAAC,CAAC;AAcF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { INotebookContent } from '@jupyterlab/nbformat';
|
|
3
|
+
import { NotebookModel } from '@jupyterlab/notebook';
|
|
4
|
+
import type { Kernel, ServerConnection, ServiceManager } from '@jupyterlab/services';
|
|
5
|
+
import { CommandRegistry } from '@lumino/commands';
|
|
6
|
+
import type { OnSessionConnection } from '../../state';
|
|
7
|
+
import { type ICellSidebarProps } from './cell';
|
|
8
|
+
import type { DatalayerNotebookExtension } from './Notebook';
|
|
9
|
+
/**
|
|
10
|
+
* Base notebook component properties
|
|
11
|
+
*/
|
|
12
|
+
export interface IBaseNotebookProps {
|
|
13
|
+
CellSidebar?: (props: ICellSidebarProps) => JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Custom command registry.
|
|
16
|
+
*
|
|
17
|
+
* Note:
|
|
18
|
+
* Providing it allows to command the component from an higher level.
|
|
19
|
+
*/
|
|
20
|
+
commandRegistry?: CommandRegistry;
|
|
21
|
+
/**
|
|
22
|
+
* Notebook ID
|
|
23
|
+
*/
|
|
24
|
+
id?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Notebook extensions
|
|
27
|
+
*/
|
|
28
|
+
extensions?: DatalayerNotebookExtension[];
|
|
29
|
+
/**
|
|
30
|
+
* Kernel ID to connect to
|
|
31
|
+
*/
|
|
32
|
+
kernelId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Service manager
|
|
35
|
+
*/
|
|
36
|
+
serviceManager: ServiceManager.IManager;
|
|
37
|
+
/**
|
|
38
|
+
* Notebook content model
|
|
39
|
+
*/
|
|
40
|
+
model: NotebookModel;
|
|
41
|
+
/**
|
|
42
|
+
* Whether nbgrader mode is activated or not.
|
|
43
|
+
*/
|
|
44
|
+
nbgrader: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Callback on session connection changed
|
|
47
|
+
*/
|
|
48
|
+
onSessionConnectionChanged?: OnSessionConnection;
|
|
49
|
+
/**
|
|
50
|
+
* Notebook path
|
|
51
|
+
*
|
|
52
|
+
* Set this only if you use Jupyter Server to fetch
|
|
53
|
+
* and save the content.
|
|
54
|
+
*/
|
|
55
|
+
path?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Base notebook component
|
|
59
|
+
*
|
|
60
|
+
* The notebook model and kernel lifecycle is not handled by
|
|
61
|
+
* this component.
|
|
62
|
+
*/
|
|
63
|
+
export declare function BaseNotebook(props: IBaseNotebookProps): JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* Get the kernel ID to connect to.
|
|
66
|
+
*
|
|
67
|
+
* Steps:
|
|
68
|
+
* - Check the requested kernel ID exists
|
|
69
|
+
* - If no kernel found, start a new one if required
|
|
70
|
+
*/
|
|
71
|
+
export declare function useKernelId(options: {
|
|
72
|
+
/**
|
|
73
|
+
* Kernels manager
|
|
74
|
+
*/
|
|
75
|
+
kernels: Kernel.IManager;
|
|
76
|
+
/**
|
|
77
|
+
* Kernel ID to connect to
|
|
78
|
+
*
|
|
79
|
+
* If the kernel does not exist and {@link startDefaultKernel} is `true`,
|
|
80
|
+
* another kernel will be started.
|
|
81
|
+
*/
|
|
82
|
+
requestedKernelId?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Whether or not to start a default kernel.
|
|
85
|
+
*
|
|
86
|
+
* Default: false
|
|
87
|
+
*/
|
|
88
|
+
startDefaultKernel?: boolean;
|
|
89
|
+
}): string | undefined;
|
|
90
|
+
export type CollaborationServer = {
|
|
91
|
+
/**
|
|
92
|
+
* Base server URL
|
|
93
|
+
*/
|
|
94
|
+
baseURL: string;
|
|
95
|
+
/**
|
|
96
|
+
* Notebook room name to connect to.
|
|
97
|
+
*/
|
|
98
|
+
roomName: string;
|
|
99
|
+
/**
|
|
100
|
+
* JWT token
|
|
101
|
+
*/
|
|
102
|
+
token: string;
|
|
103
|
+
/**
|
|
104
|
+
* Server type
|
|
105
|
+
*/
|
|
106
|
+
type: 'datalayer';
|
|
107
|
+
} | {
|
|
108
|
+
/**
|
|
109
|
+
* Notebook path
|
|
110
|
+
*/
|
|
111
|
+
path: string;
|
|
112
|
+
/**
|
|
113
|
+
* Jupyter server settings
|
|
114
|
+
*/
|
|
115
|
+
serverSettings: ServerConnection.ISettings;
|
|
116
|
+
/**
|
|
117
|
+
* Server type
|
|
118
|
+
*/
|
|
119
|
+
type: 'jupyter';
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Hook to handle a notebook model.
|
|
123
|
+
*
|
|
124
|
+
* The notebook content may come from 3 sources:
|
|
125
|
+
* - {@link nbformat}: The notebook content
|
|
126
|
+
* - {@link url}: A URL to fetch the notebook content from
|
|
127
|
+
* - {@link collaborationServer}: Parameters to connect to a collaboration server
|
|
128
|
+
*/
|
|
129
|
+
export declare function useNotebookModel(options: {
|
|
130
|
+
/**
|
|
131
|
+
* Collaboration server providing the document rooms
|
|
132
|
+
*/
|
|
133
|
+
collaborationServer?: CollaborationServer;
|
|
134
|
+
/**
|
|
135
|
+
* Notebook content.
|
|
136
|
+
*/
|
|
137
|
+
nbformat?: INotebookContent;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the model is read-only or not.
|
|
140
|
+
*
|
|
141
|
+
* Default: false
|
|
142
|
+
*/
|
|
143
|
+
readonly?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* URL to fetch the notebook content from.
|
|
146
|
+
*/
|
|
147
|
+
url?: string;
|
|
148
|
+
}): NotebookModel | null;
|