@datalayer/jupyter-react 0.0.8 → 0.0.11

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.
Files changed (216) hide show
  1. package/lib/JupyterExample.d.ts +1 -0
  2. package/lib/JupyterExample.js +56 -0
  3. package/lib/JupyterExample.js.map +1 -0
  4. package/lib/JupyterLiteExample.d.ts +1 -0
  5. package/lib/JupyterLiteExample.js +10 -0
  6. package/lib/JupyterLiteExample.js.map +1 -0
  7. package/lib/components/cell/Cell.css +12 -3
  8. package/lib/components/cell/Cell.d.ts +16 -0
  9. package/lib/components/cell/Cell.js +56 -0
  10. package/lib/components/cell/Cell.js.map +1 -0
  11. package/lib/components/cell/CellAdapter.d.ts +15 -0
  12. package/lib/components/cell/CellAdapter.js +133 -0
  13. package/lib/components/cell/CellAdapter.js.map +1 -0
  14. package/lib/components/cell/CellCommands.d.ts +6 -0
  15. package/lib/components/cell/CellCommands.js +38 -0
  16. package/lib/components/cell/CellCommands.js.map +1 -0
  17. package/lib/components/cell/CellState.d.ts +22 -0
  18. package/lib/components/cell/CellState.js +46 -0
  19. package/lib/components/cell/CellState.js.map +1 -0
  20. package/lib/components/codemirror/CodeMirrorEditor.d.ts +14 -0
  21. package/lib/components/codemirror/CodeMirrorEditor.js +110 -0
  22. package/lib/components/codemirror/CodeMirrorEditor.js.map +1 -0
  23. package/lib/components/codemirror/CodeMirrorTheme.d.ts +3 -0
  24. package/lib/components/codemirror/CodeMirrorTheme.js +21 -0
  25. package/lib/components/codemirror/CodeMirrorTheme.js.map +1 -0
  26. package/lib/components/commands/Commands.d.ts +2 -0
  27. package/lib/components/commands/Commands.js +9 -0
  28. package/lib/components/commands/Commands.js.map +1 -0
  29. package/lib/components/commands/CommandsAdapter.d.ts +9 -0
  30. package/lib/components/commands/CommandsAdapter.js +36 -0
  31. package/lib/components/commands/CommandsAdapter.js.map +1 -0
  32. package/lib/components/commands/CommandsState.d.ts +15 -0
  33. package/lib/components/commands/CommandsState.js +30 -0
  34. package/lib/components/commands/CommandsState.js.map +1 -0
  35. package/lib/components/console/{ConsoleAdapter.css → Console.css} +4 -0
  36. package/lib/components/console/Console.d.ts +3 -0
  37. package/lib/components/console/Console.js +15 -0
  38. package/lib/components/console/Console.js.map +1 -0
  39. package/lib/components/console/ConsoleAdapter.d.ts +13 -0
  40. package/lib/components/console/ConsoleAdapter.js +84 -0
  41. package/lib/components/console/ConsoleAdapter.js.map +1 -0
  42. package/lib/components/console/ConsoleState.d.ts +15 -0
  43. package/lib/components/console/ConsoleState.js +30 -0
  44. package/lib/components/console/ConsoleState.js.map +1 -0
  45. package/lib/components/dialog/Dialog.d.ts +2 -0
  46. package/lib/components/dialog/Dialog.js +13 -0
  47. package/lib/components/dialog/Dialog.js.map +1 -0
  48. package/lib/components/dialog/DialogAdapter.d.ts +10 -0
  49. package/lib/components/dialog/DialogAdapter.js +19 -0
  50. package/lib/components/dialog/DialogAdapter.js.map +1 -0
  51. package/lib/components/filebrowser/FileBrowser.d.ts +2 -0
  52. package/lib/components/filebrowser/FileBrowser.js +9 -0
  53. package/lib/components/filebrowser/FileBrowser.js.map +1 -0
  54. package/lib/components/filebrowser/FileBrowserAdapter.d.ts +13 -0
  55. package/lib/components/filebrowser/FileBrowserAdapter.js +267 -0
  56. package/lib/components/filebrowser/FileBrowserAdapter.js.map +1 -0
  57. package/lib/components/filebrowser/FileBrowserState.d.ts +15 -0
  58. package/lib/components/filebrowser/FileBrowserState.js +30 -0
  59. package/lib/components/filebrowser/FileBrowserState.js.map +1 -0
  60. package/lib/components/ipywidgets/IpyWidgetsComponent.d.ts +5 -0
  61. package/lib/components/ipywidgets/IpyWidgetsComponent.js +9 -0
  62. package/lib/components/ipywidgets/IpyWidgetsComponent.js.map +1 -0
  63. package/lib/components/notebook/Notebook.css +2 -26
  64. package/lib/components/notebook/Notebook.d.ts +36 -0
  65. package/lib/components/notebook/Notebook.js +138 -0
  66. package/lib/components/notebook/Notebook.js.map +1 -0
  67. package/lib/components/notebook/NotebookAdapter.d.ts +38 -0
  68. package/lib/components/notebook/NotebookAdapter.js +301 -0
  69. package/lib/components/notebook/NotebookAdapter.js.map +1 -0
  70. package/lib/components/notebook/NotebookCommands.d.ts +43 -0
  71. package/lib/components/notebook/NotebookCommands.js +380 -0
  72. package/lib/components/notebook/NotebookCommands.js.map +1 -0
  73. package/lib/components/notebook/NotebookState.d.ts +69 -0
  74. package/lib/components/notebook/NotebookState.js +184 -0
  75. package/lib/components/notebook/NotebookState.js.map +1 -0
  76. package/lib/components/notebook/cell/metadata/CellMetadataEditor.d.ts +7 -0
  77. package/lib/components/notebook/cell/metadata/CellMetadataEditor.js +43 -0
  78. package/lib/components/notebook/cell/metadata/CellMetadataEditor.js.map +1 -0
  79. package/lib/components/notebook/cell/metadata/NbGraderCells.d.ts +12 -0
  80. package/lib/components/notebook/cell/metadata/NbGraderCells.js +138 -0
  81. package/lib/components/notebook/cell/metadata/NbGraderCells.js.map +1 -0
  82. package/lib/components/notebook/cell/prompt/InputPrompt.d.ts +18 -0
  83. package/lib/components/notebook/cell/prompt/InputPrompt.js +69 -0
  84. package/lib/components/notebook/cell/prompt/InputPrompt.js.map +1 -0
  85. package/lib/components/notebook/cell/sidebar/CellSidebarDefault.d.ts +3 -0
  86. package/lib/components/notebook/cell/sidebar/CellSidebarDefault.js +63 -0
  87. package/lib/components/notebook/cell/sidebar/CellSidebarDefault.js.map +1 -0
  88. package/lib/components/notebook/cell/sidebar/CellSidebarRun.d.ts +3 -0
  89. package/lib/components/notebook/cell/sidebar/CellSidebarRun.js +38 -0
  90. package/lib/components/notebook/cell/sidebar/CellSidebarRun.js.map +1 -0
  91. package/lib/components/notebook/cell/sidebar/base/CellSidebarContentFactory.d.ts +19 -0
  92. package/lib/components/notebook/cell/sidebar/base/CellSidebarContentFactory.js +22 -0
  93. package/lib/components/notebook/cell/sidebar/base/CellSidebarContentFactory.js.map +1 -0
  94. package/lib/components/notebook/cell/sidebar/base/CellSidebarWidget.d.ts +16 -0
  95. package/lib/components/notebook/cell/sidebar/base/CellSidebarWidget.js +25 -0
  96. package/lib/components/notebook/cell/sidebar/base/CellSidebarWidget.js.map +1 -0
  97. package/lib/components/notebook/marked/marked.d.ts +3 -0
  98. package/lib/components/notebook/marked/marked.js +72 -0
  99. package/lib/components/notebook/marked/marked.js.map +1 -0
  100. package/lib/components/notebook/model/CustomNotebookModelFactory.d.ts +9 -0
  101. package/lib/components/notebook/model/CustomNotebookModelFactory.js +14 -0
  102. package/lib/components/notebook/model/CustomNotebookModelFactory.js.map +1 -0
  103. package/lib/components/outputs/Output.css +8 -0
  104. package/lib/components/outputs/Output.d.ts +25 -0
  105. package/lib/components/outputs/Output.js +126 -0
  106. package/lib/components/outputs/Output.js.map +1 -0
  107. package/lib/components/outputs/OutputAdapter.d.ts +19 -0
  108. package/lib/components/outputs/OutputAdapter.js +81 -0
  109. package/lib/components/outputs/OutputAdapter.js.map +1 -0
  110. package/lib/components/outputs/OutputState.d.ts +54 -0
  111. package/lib/components/outputs/OutputState.js +122 -0
  112. package/lib/components/outputs/OutputState.js.map +1 -0
  113. package/lib/components/outputs/OutputToolbar.d.ts +12 -0
  114. package/lib/components/outputs/OutputToolbar.js +42 -0
  115. package/lib/components/outputs/OutputToolbar.js.map +1 -0
  116. package/lib/components/settings/Settings.d.ts +2 -0
  117. package/lib/components/settings/Settings.js +9 -0
  118. package/lib/components/settings/Settings.js.map +1 -0
  119. package/lib/components/settings/SettingsAdapter.d.ts +10 -0
  120. package/lib/components/settings/SettingsAdapter.js +16 -0
  121. package/lib/components/settings/SettingsAdapter.js.map +1 -0
  122. package/lib/components/settings/SettingsState.d.ts +15 -0
  123. package/lib/components/settings/SettingsState.js +30 -0
  124. package/lib/components/settings/SettingsState.js.map +1 -0
  125. package/lib/components/terminal/Terminal.d.ts +2 -0
  126. package/lib/components/terminal/Terminal.js +16 -0
  127. package/lib/components/terminal/Terminal.js.map +1 -0
  128. package/lib/components/terminal/TerminalAdapter.d.ts +13 -0
  129. package/lib/components/terminal/TerminalAdapter.js +28 -0
  130. package/lib/components/terminal/TerminalAdapter.js.map +1 -0
  131. package/lib/components/terminal/TerminalState.d.ts +15 -0
  132. package/lib/components/terminal/TerminalState.js +38 -0
  133. package/lib/components/terminal/TerminalState.js.map +1 -0
  134. package/lib/index.d.ts +43 -0
  135. package/lib/index.js +58 -0
  136. package/lib/index.js.map +1 -0
  137. package/lib/jupyter/Jupyter.d.ts +31 -0
  138. package/lib/jupyter/Jupyter.js +30 -0
  139. package/lib/jupyter/Jupyter.js.map +1 -0
  140. package/lib/jupyter/JupyterAuthError.d.ts +7 -0
  141. package/lib/jupyter/JupyterAuthError.js +8 -0
  142. package/lib/jupyter/JupyterAuthError.js.map +1 -0
  143. package/lib/jupyter/JupyterConfig.d.ts +38 -0
  144. package/lib/jupyter/JupyterConfig.js +83 -0
  145. package/lib/jupyter/JupyterConfig.js.map +1 -0
  146. package/lib/jupyter/JupyterContext.d.ts +39 -0
  147. package/lib/jupyter/JupyterContext.js +89 -0
  148. package/lib/jupyter/JupyterContext.js.map +1 -0
  149. package/lib/jupyter/JupyterHandlers.d.ts +8 -0
  150. package/lib/jupyter/JupyterHandlers.js +50 -0
  151. package/lib/jupyter/JupyterHandlers.js.map +1 -0
  152. package/lib/jupyter/ipywidgets/IPyWidgetsAttached.d.ts +8 -0
  153. package/lib/jupyter/ipywidgets/IPyWidgetsAttached.js +15 -0
  154. package/lib/jupyter/ipywidgets/IPyWidgetsAttached.js.map +1 -0
  155. package/lib/jupyter/ipywidgets/IPyWidgetsClassicManager.d.ts +18 -0
  156. package/lib/jupyter/ipywidgets/IPyWidgetsClassicManager.js +76 -0
  157. package/lib/jupyter/ipywidgets/IPyWidgetsClassicManager.js.map +1 -0
  158. package/lib/jupyter/ipywidgets/IPyWidgetsJupyterLabPlugin.d.ts +15 -0
  159. package/lib/jupyter/ipywidgets/IPyWidgetsJupyterLabPlugin.js +178 -0
  160. package/lib/jupyter/ipywidgets/IPyWidgetsJupyterLabPlugin.js.map +1 -0
  161. package/lib/jupyter/ipywidgets/IpyWidgetsManager.d.ts +11 -0
  162. package/lib/jupyter/ipywidgets/IpyWidgetsManager.js +71 -0
  163. package/lib/jupyter/ipywidgets/IpyWidgetsManager.js.map +1 -0
  164. package/lib/jupyter/ipywidgets/plotly/Figure.d.ts +587 -0
  165. package/lib/jupyter/ipywidgets/plotly/Figure.js +1697 -0
  166. package/lib/jupyter/ipywidgets/plotly/Figure.js.map +1 -0
  167. package/lib/jupyter/ipywidgets/plotly/JupyterlabPlugin.d.ts +5 -0
  168. package/lib/jupyter/ipywidgets/plotly/JupyterlabPlugin.js +12 -0
  169. package/lib/jupyter/ipywidgets/plotly/JupyterlabPlugin.js.map +1 -0
  170. package/lib/jupyter/ipywidgets/plotly/Version.d.ts +8 -0
  171. package/lib/jupyter/ipywidgets/plotly/Version.js +16 -0
  172. package/lib/jupyter/ipywidgets/plotly/Version.js.map +1 -0
  173. package/lib/jupyter/ipywidgets/plotly/index.d.ts +2 -0
  174. package/lib/jupyter/ipywidgets/plotly/index.js +4 -0
  175. package/lib/jupyter/ipywidgets/plotly/index.js.map +1 -0
  176. package/lib/jupyter/lite/LiteServer.d.ts +2 -0
  177. package/lib/jupyter/lite/LiteServer.js +87 -0
  178. package/lib/jupyter/lite/LiteServer.js.map +1 -0
  179. package/lib/jupyter/lumino/LuminoAttached.d.ts +3 -0
  180. package/lib/jupyter/lumino/LuminoAttached.js +21 -0
  181. package/lib/jupyter/lumino/LuminoAttached.js.map +1 -0
  182. package/lib/jupyter/lumino/LuminoDetached.d.ts +9 -0
  183. package/lib/jupyter/lumino/LuminoDetached.js +13 -0
  184. package/lib/jupyter/lumino/LuminoDetached.js.map +1 -0
  185. package/lib/jupyter/lumino/LuminoNotebook.d.ts +5 -0
  186. package/lib/jupyter/lumino/LuminoNotebook.js +28 -0
  187. package/lib/jupyter/lumino/LuminoNotebook.js.map +1 -0
  188. package/lib/jupyter/lumino/LuminoObservable.d.ts +6 -0
  189. package/lib/jupyter/lumino/LuminoObservable.js +16 -0
  190. package/lib/jupyter/lumino/LuminoObservable.js.map +1 -0
  191. package/lib/jupyter/lumino/LuminoReactPortal.d.ts +180 -0
  192. package/lib/jupyter/lumino/LuminoReactPortal.js +195 -0
  193. package/lib/jupyter/lumino/LuminoReactPortal.js.map +1 -0
  194. package/lib/jupyter/lumino/LuminoRedux.d.ts +8 -0
  195. package/lib/jupyter/lumino/LuminoRedux.js +2 -0
  196. package/lib/jupyter/lumino/LuminoRedux.js.map +1 -0
  197. package/lib/jupyter/services/Services.d.ts +16 -0
  198. package/lib/jupyter/services/Services.js +41 -0
  199. package/lib/jupyter/services/Services.js.map +1 -0
  200. package/lib/jupyter/services/kernel/Kernel.d.ts +15 -0
  201. package/lib/jupyter/services/kernel/Kernel.js +65 -0
  202. package/lib/jupyter/services/kernel/Kernel.js.map +1 -0
  203. package/lib/jupyter/services/kernel/KernelModel.d.ts +18 -0
  204. package/lib/jupyter/services/kernel/KernelModel.js +52 -0
  205. package/lib/jupyter/services/kernel/KernelModel.js.map +1 -0
  206. package/lib/state/State.d.ts +14 -0
  207. package/lib/state/State.js +32 -0
  208. package/lib/state/State.js.map +1 -0
  209. package/lib/state/Store.d.ts +6 -0
  210. package/lib/state/Store.js +35 -0
  211. package/lib/state/Store.js.map +1 -0
  212. package/lib/utils/Ids.d.ts +2 -0
  213. package/lib/utils/Ids.js +11 -0
  214. package/lib/utils/Ids.js.map +1 -0
  215. package/package.json +41 -39
  216. package/lib/components/outputs/OutputAdapter.css +0 -3
@@ -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/jupyter/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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AK,CAAC;IAC9B,CAAC;IAnBC;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,OAAO;SACR;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CAGF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A LuminoRedux interface to enforce the usage of
3
+ * the injextRedux method.
4
+ */
5
+ interface LuminoRedux {
6
+ injectRedux: () => void;
7
+ }
8
+ export default LuminoRedux;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=LuminoRedux.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LuminoRedux.js","sourceRoot":"","sources":["../../../src/jupyter/lumino/LuminoRedux.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ declare class Services {
2
+ private _services;
3
+ constructor();
4
+ kernelspecs(): import("@jupyterlab/services/lib/kernelspec/kernelspec").IManager;
5
+ contents(): import("@jupyterlab/services").Contents.IManager;
6
+ nbconvert(): import("@jupyterlab/services").NbConvert.IManager;
7
+ sessions(): import("@jupyterlab/services/lib/session/session").IManager;
8
+ settings(): import("@jupyterlab/services").Setting.IManager;
9
+ terminals(): import("@jupyterlab/services/lib/terminal/terminal").IManager;
10
+ workspaces(): import("@jupyterlab/services").Workspace.IManager;
11
+ builder(): import("@jupyterlab/services").Builder.IManager;
12
+ serverSettings(): import("@jupyterlab/services").ServerConnection.ISettings;
13
+ refreshKernelspecs(): Promise<void>;
14
+ getKernelspecs(): import("@jupyterlab/services/lib/kernelspec/restapi").ISpecModels | null;
15
+ }
16
+ 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/jupyter/services/Services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,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,15 @@
1
+ import { Kernel as JupyterKernel } from '@jupyterlab/services';
2
+ export declare type IKernelProps = {
3
+ baseUrl?: string;
4
+ wsUrl?: string;
5
+ kernelType?: string;
6
+ };
7
+ export declare class Kernel {
8
+ private _serverSettings;
9
+ private _kernelType;
10
+ private _kernel;
11
+ constructor(options?: IKernelProps);
12
+ getJupyterKernel(): Promise<JupyterKernel.IKernelConnection>;
13
+ private requestKernel;
14
+ }
15
+ export default Kernel;
@@ -0,0 +1,65 @@
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
+ 'X-Datalayer': 'Datalayer',
15
+ });
16
+ */
17
+ export class Kernel {
18
+ constructor(options = {}) {
19
+ this._serverSettings = ServerConnection.makeSettings({
20
+ baseUrl: options.baseUrl || (location.protocol + '//' + location.host + "/api/jupyter"),
21
+ wsUrl: options.wsUrl || (location.protocol.replace('http', 'ws') + '//' + location.host + "/api/jupyter"),
22
+ appendToken: true,
23
+ init: {
24
+ credentials: 'include',
25
+ mode: 'cors',
26
+ // headers: headers,
27
+ }
28
+ });
29
+ this._kernelType = options.kernelType || 'python3';
30
+ this._kernel = this.requestKernel();
31
+ }
32
+ getJupyterKernel() {
33
+ /*
34
+ if (this._kernel) {
35
+ return this._kernel;
36
+ }
37
+ this._kernel = this.requestKernel();
38
+ */
39
+ return this._kernel;
40
+ }
41
+ requestKernel() {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const kernelManager = new KernelManager({
44
+ serverSettings: this._serverSettings,
45
+ standby: 'never',
46
+ });
47
+ const sessionManager = new SessionManager({
48
+ serverSettings: this._serverSettings,
49
+ kernelManager,
50
+ standby: 'never',
51
+ });
52
+ yield sessionManager.ready;
53
+ const kernelId = UUID.uuid4();
54
+ const session = yield sessionManager.startNew({
55
+ path: kernelId,
56
+ name: kernelId,
57
+ type: this._kernelType,
58
+ });
59
+ yield session.kernel.info;
60
+ return session.kernel;
61
+ });
62
+ }
63
+ }
64
+ export default Kernel;
65
+ //# sourceMappingURL=Kernel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Kernel.js","sourceRoot":"","sources":["../../../../src/jupyter/services/kernel/Kernel.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAA2B,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAChH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC;;;;EAIE;AACF,MAAM,OAAO,MAAM;IAKjB,YAAmB,UAAwB,EAAE;QAC3C,IAAI,CAAC,eAAe,GAAI,gBAAgB,CAAC,YAAY,CAAC;YACpD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC,IAAI,GAAG,cAAc,CA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import { IOutput } from '@jupyterlab/nbformat';
3
+ import { Kernel, KernelMessage } from '@jupyterlab/services';
4
+ import { ISignal } from '@lumino/signaling';
5
+ export 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
+ export 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/jupyter/services/kernel/KernelModel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,OAAO,WAAW;IACtB,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,14 @@
1
+ import { AnyAction } from "typescript-fsa";
2
+ import { ICellState } from "../components/cell/CellState";
3
+ import { INotebookState } from "../components/notebook/NotebookState";
4
+ import { ITerminalState } from "../components/terminal/TerminalState";
5
+ import { IOutputsState } from "../components/outputs/OutputState";
6
+ export interface IState {
7
+ cell: ICellState;
8
+ outputs: IOutputsState;
9
+ notebook: INotebookState;
10
+ terminal: ITerminalState;
11
+ }
12
+ export declare const initialState: IState;
13
+ export declare const epics: import("redux-observable").Epic<AnyAction, AnyAction, any, any>;
14
+ export declare const reducers: import("redux").Reducer<import("redux").CombinedState<IState>, import("redux").AnyAction>;
@@ -0,0 +1,32 @@
1
+ import { combineReducers } from "redux";
2
+ import { combineEpics } from "redux-observable";
3
+ import { cellInitialState, cellReducer } from "../components/cell/CellState";
4
+ import { notebookInitialState, notebookEpics, notebookReducer } from "../components/notebook/NotebookState";
5
+ import { terminalInitialState, terminalReducer } from "../components/terminal/TerminalState";
6
+ import { outputInitialState, outputReducer } from "../components/outputs/OutputState";
7
+ export const initialState = {
8
+ cell: cellInitialState,
9
+ outputs: outputInitialState,
10
+ notebook: notebookInitialState,
11
+ terminal: terminalInitialState,
12
+ };
13
+ /* Actions
14
+ export type ActionUnion<
15
+ A extends { [asyncActionCreator: string]: (...args: any[]) => any; }
16
+ > = Exclude<ReturnType<A[keyof A]>, (...args: any[]) => Promise<void>>;
17
+
18
+ export type CellAction = ActionUnion<typeof cellActions>;
19
+ export type NotebookAction = ActionUnion<typeof notebookActions>;
20
+
21
+ export type AppAction = CellAction | NotebookAction;
22
+ */
23
+ /* Epics */
24
+ export const epics = combineEpics(notebookEpics);
25
+ /* Reducers */
26
+ export const reducers = combineReducers({
27
+ cell: cellReducer,
28
+ outputs: outputReducer,
29
+ notebook: notebookReducer,
30
+ terminal: terminalReducer,
31
+ });
32
+ //# sourceMappingURL=State.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"State.js","sourceRoot":"","sources":["../../src/state/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAc,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,eAAe,EAAkB,MAAM,sCAAsC,CAAC;AAC5H,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAkB,MAAM,sCAAsC,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAiB,MAAM,mCAAmC,CAAC;AAWrG,MAAM,CAAC,MAAM,YAAY,GAAW;IAClC,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,kBAAkB;IAC3B,QAAQ,EAAE,oBAAoB;IAC9B,QAAQ,EAAE,oBAAoB;CAC/B,CAAA;AAED;;;;;;;;;EASE;AAEF,WAAW;AACX,MAAM,CAAC,MAAM,KAAK,GAAG,YAAY,CAC/B,aAAa,CACd,CAAC;AAEF,cAAc;AACd,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAS;IAC9C,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,eAAe;IACzB,QAAQ,EAAE,eAAe;CAC1B,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare const injectableStore: import("redux").Store<import("redux").EmptyObject & {
2
+ [x: string]: unknown;
3
+ }, never> & {
4
+ dispatch: unknown;
5
+ };
6
+ export default injectableStore;
@@ -0,0 +1,35 @@
1
+ import { applyMiddleware, combineReducers, createStore } from "redux";
2
+ import { createEpicMiddleware } from "redux-observable";
3
+ import { cellReducer } from "../components/cell/CellState";
4
+ import { notebookReducer } from "../components/notebook/NotebookState";
5
+ import { terminalReducer } from "../components/terminal/TerminalState";
6
+ const epicMiddleware = createEpicMiddleware();
7
+ function createReducer(asyncReducers) {
8
+ return combineReducers(Object.assign({ cell: cellReducer, notebook: notebookReducer, terminal: terminalReducer }, asyncReducers));
9
+ }
10
+ function createInjectableStore() {
11
+ const injectableStore = createStore(createReducer({}), applyMiddleware(epicMiddleware));
12
+ injectableStore.asyncReducers = {};
13
+ injectableStore.inject = (key, asyncReducer, epic) => {
14
+ const reducer = injectableStore.asyncReducers[key];
15
+ if (!reducer) {
16
+ if (epic) {
17
+ epicMiddleware.run(epic);
18
+ }
19
+ injectableStore.asyncReducers[key] = asyncReducer;
20
+ const newReducer = createReducer(injectableStore.asyncReducers);
21
+ injectableStore.replaceReducer(newReducer);
22
+ }
23
+ };
24
+ return injectableStore;
25
+ }
26
+ /*
27
+ export const epic$ = new BehaviorSubject(initEpics);
28
+ const rootEpic = (action$: any, state$: any, deps: any) => epic$.pipe(
29
+ mergeMap(epic => epic(action$, state$, deps))
30
+ );
31
+ epicMiddleware.run(rootEpic);
32
+ */
33
+ const injectableStore = createInjectableStore();
34
+ export default injectableStore;
35
+ //# sourceMappingURL=Store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Store.js","sourceRoot":"","sources":["../../src/state/Store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,MAAM,cAAc,GAAG,oBAAoB,EAAgD,CAAC;AAE5F,SAAS,aAAa,CAAS,aAAkB;IAC/C,OAAO,eAAe,iBACpB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,IACtB,aAAa,EAChB,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB;IAC5B,MAAM,eAAe,GAAG,WAAW,CACjC,aAAa,CAAC,EAAE,CAAC,EACjB,eAAe,CAAC,cAAc,CAAC,CAChC,CAAC;IACD,eAAuB,CAAC,aAAa,GAAG,EAAE,CAAC;IAC3C,eAAuB,CAAC,MAAM,GAAG,CAAC,GAAW,EAAE,YAAiB,EAAE,IAAU,EAAE,EAAE;QAC/E,MAAM,OAAO,GAAI,eAAuB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,EAAE;YACZ,IAAI,IAAI,EAAE;gBACR,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aAC1B;YACA,eAAuB,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;YAC3D,MAAM,UAAU,GAAG,aAAa,CAAE,eAAuB,CAAC,aAAa,CAAC,CAAC;YACzE,eAAe,CAAC,cAAc,CAAC,UAAiB,CAAC,CAAC;SACnD;IACH,CAAC,CAAA;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AACD;;;;;;EAME;AACF,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC;AAEhD,eAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const newSourceId: (base: string) => string;
2
+ export declare const newUuid: () => string;
@@ -0,0 +1,11 @@
1
+ import { v4 as uuid_v4 } from 'uuid';
2
+ // const MAX = Number.MAX_SAFE_INTEGER;
3
+ // const MAX = 999999;
4
+ export const newSourceId = (base) => {
5
+ // return base + Math.floor(Math.random() * MAX).toString();
6
+ return base;
7
+ };
8
+ export const newUuid = () => {
9
+ return uuid_v4();
10
+ };
11
+ //# sourceMappingURL=Ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ids.js","sourceRoot":"","sources":["../../src/utils/Ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,OAAO,EAAE,MAAM,MAAM,CAAC;AAErC,uCAAuC;AACvC,sBAAsB;AAEtB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE;IAC5C,6DAA6D;IAC3D,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;IAC1B,OAAO,OAAO,EAAE,CAAC;AACnB,CAAC,CAAA"}