@datalayer/jupyter-react 2.0.7 → 2.0.9

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 (54) hide show
  1. package/lib/components/jupyterlab/JupyterLabApp.js +3 -0
  2. package/lib/components/jupyterlab/JupyterLabApp.js.map +1 -1
  3. package/lib/components/jupyterlab/JupyterLabAppAdapter.d.ts +3 -0
  4. package/lib/components/jupyterlab/JupyterLabAppAdapter.js +284 -19
  5. package/lib/components/jupyterlab/JupyterLabAppAdapter.js.map +1 -1
  6. package/lib/components/jupyterlab/JupyterLabAppCss.js +5 -2
  7. package/lib/components/jupyterlab/JupyterLabAppCss.js.map +1 -1
  8. package/lib/components/kernel/KernelIndicator.d.ts +22 -25
  9. package/lib/components/kernel/KernelIndicator.js +330 -88
  10. package/lib/components/kernel/KernelIndicator.js.map +1 -1
  11. package/lib/components/kernel/KernelIndicatorState.d.ts +32 -0
  12. package/lib/components/kernel/KernelIndicatorState.js +156 -0
  13. package/lib/components/kernel/KernelIndicatorState.js.map +1 -0
  14. package/lib/components/kernel/index.d.ts +1 -0
  15. package/lib/components/kernel/index.js +1 -0
  16. package/lib/components/kernel/index.js.map +1 -1
  17. package/lib/components/notebook/NotebookBase.js +9 -5
  18. package/lib/components/notebook/NotebookBase.js.map +1 -1
  19. package/lib/components/notebook/marked/marked.js +79 -2
  20. package/lib/components/notebook/marked/marked.js.map +1 -1
  21. package/lib/components/terminal/Terminal.js +7 -0
  22. package/lib/components/terminal/Terminal.js.map +1 -1
  23. package/lib/examples/Examples.js +2 -0
  24. package/lib/examples/Examples.js.map +1 -1
  25. package/lib/examples/JupyterLabApp.js +15 -1
  26. package/lib/examples/JupyterLabApp.js.map +1 -1
  27. package/lib/examples/NotebookPrimerThemeExample.d.ts +1 -0
  28. package/lib/examples/NotebookPrimerThemeExample.js +42 -0
  29. package/lib/examples/NotebookPrimerThemeExample.js.map +1 -0
  30. package/lib/examples/notebooks/NotebookExample1.ipynb.json +9 -0
  31. package/lib/jupyter/JupyterConfig.js +0 -2
  32. package/lib/jupyter/JupyterConfig.js.map +1 -1
  33. package/lib/jupyter/kernel/KernelState.d.ts +1 -1
  34. package/lib/shims/json5.d.ts +7 -0
  35. package/lib/shims/json5.js +42 -0
  36. package/lib/shims/json5.js.map +1 -0
  37. package/lib/shims/url.d.ts +18 -0
  38. package/lib/shims/url.js +44 -0
  39. package/lib/shims/url.js.map +1 -0
  40. package/lib/theme/JupyterLabCss.d.ts +1 -0
  41. package/lib/theme/JupyterLabCss.js +15 -11
  42. package/lib/theme/JupyterLabCss.js.map +1 -1
  43. package/lib/theme/JupyterLabCssImports.d.ts +9 -8
  44. package/lib/theme/JupyterLabCssImports.js +9 -8
  45. package/lib/theme/JupyterLabCssImports.js.map +1 -1
  46. package/lib/theme/JupyterReactTheme.js +51 -20
  47. package/lib/theme/JupyterReactTheme.js.map +1 -1
  48. package/lib/theme/index.d.ts +1 -0
  49. package/lib/theme/index.js +1 -0
  50. package/lib/theme/index.js.map +1 -1
  51. package/lib/theme/usePrimerThemeBridge.d.ts +17 -0
  52. package/lib/theme/usePrimerThemeBridge.js +34 -0
  53. package/lib/theme/usePrimerThemeBridge.js.map +1 -0
  54. package/package.json +4 -2
@@ -8,6 +8,7 @@ import { memo, useState, useEffect, useMemo, useRef } from 'react';
8
8
  import { Box } from '@primer/react';
9
9
  import { PageConfig } from '@jupyterlab/coreutils';
10
10
  import { useJupyter } from '../../jupyter/JupyterUse.js';
11
+ import { useJupyterReactStore } from '../../state/index.js';
11
12
  import { JupyterLabAppCorePlugins } from './JupyterLabAppPlugins.js';
12
13
  import JupyterLabAppAdapter from './JupyterLabAppAdapter.js';
13
14
  import JupyterLabAppCss from './JupyterLabAppCss.js';
@@ -23,6 +24,7 @@ const JupyterLabAppComponent = (props) => {
23
24
  serviceManager: propsServiceManager,
24
25
  startDefaultKernel,
25
26
  });
27
+ const setJupyterLabAdapter = useJupyterReactStore(state => state.setJupyterLabAdapter);
26
28
  const defaultMimeExtensionPromises = useMemo(() => mimeRendererPromises ?? JupyterLabAppCorePlugins().mimeExtensionPromises, [mimeRendererPromises]);
27
29
  const defaultExtensionPromises = useMemo(() => pluginPromises ?? JupyterLabAppCorePlugins().extensionPromises, [pluginPromises]);
28
30
  const ref = useRef(null);
@@ -58,6 +60,7 @@ const JupyterLabAppComponent = (props) => {
58
60
  ...restProps,
59
61
  });
60
62
  adapter.ready.then(() => {
63
+ setJupyterLabAdapter(adapter);
61
64
  onJupyterLab(adapter);
62
65
  if (pluginId && PluginType && onPlugin) {
63
66
  const plugin = adapter.service(pluginId);
@@ -1 +1 @@
1
- {"version":3,"file":"JupyterLabApp.js","sourceRoot":"","sources":["../../../src/components/jupyterlab/JupyterLabApp.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,yEAAyE;AACxE,UAAkB,CAAC,uBAAuB;IACzC,UAAU,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC;AAC7C,MAAc,CAAC,uBAAuB;IACrC,UAAU,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC;AAyB9C,MAAM,sBAAsB,GAAG,CAAC,KAAyB,EAAE,EAAE;IAC3D,MAAM,EACJ,UAAU,EACV,OAAO,GAAG,KAAK,EACf,eAAe,GAAG,EAAE,EACpB,QAAQ,GAAG,KAAK,EACh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AAC,CAAC;YACH,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;gBACtB,oBAAoB,CAAC,OAAO,CAAC,CAAC;gBAC9B,YAAY,CAAC,OAAQ,CAAC,CAAC;gBACvB,IAAI,QAAQ,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;oBACvC,MAAM,MAAM,GAAG,OAAQ,CAAC,OAAO,CAAC,QAAQ,CAAsB,CAAC;oBAC/D,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC,CAAC,CAAC;YACH,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;YAC7B,UAAU,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC,CAAC;IACzC,OAAO,CACL,4BACE,MAAC,GAAG,IACF,EAAE,EAAE;gBACF,gBAAgB,EAAE;oBAChB,QAAQ,EAAE,QAAe;oBACzB,MAAM,EAAE,MAAa;oBACrB,KAAK,EAAE,KAAY;oBACnB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;iBACvC;aACF,aAED,KAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,GAAI,EAClC,cAAK,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,GAAI,IACzB,GACL,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAE1D,eAAe,aAAa,CAAC"}
@@ -19,7 +19,10 @@ export declare class JupyterLabAppAdapter {
19
19
  private _plugins;
20
20
  private _ready;
21
21
  private _readyResolve;
22
+ private normalizeJupyterModule;
23
+ private normalizeKernelSpecResources;
22
24
  constructor(props: JupyterLabAppAdapterProps, jupyterlab?: JupyterLab);
25
+ private waitForShellAttachment;
23
26
  private load;
24
27
  static create(jupyterLab: JupyterLab): JupyterLabAppAdapter;
25
28
  get jupyterLab(): JupyterLab;
@@ -4,13 +4,50 @@
4
4
  * MIT License
5
5
  */
6
6
  import { BoxPanel } from '@lumino/widgets';
7
- import { JupyterLab, LabShell, } from '@jupyterlab/application';
7
+ import { JupyterLab, LabShell, ILayoutRestorer, IRouter, } from '@jupyterlab/application';
8
+ import { IThemeManager, IWindowResolver } from '@jupyterlab/apputils';
9
+ import { PageConfig } from '@jupyterlab/coreutils';
8
10
  export class JupyterLabAppAdapter {
9
11
  _jupyterLab;
10
12
  _shell;
11
13
  _plugins;
12
14
  _ready;
13
15
  _readyResolve;
16
+ normalizeJupyterModule(mod) {
17
+ if (mod &&
18
+ typeof mod === 'object' &&
19
+ typeof mod.hasOwnProperty !== 'function') {
20
+ const normalized = { ...mod };
21
+ if ('default' in normalized && !('__esModule' in normalized)) {
22
+ normalized.__esModule = true;
23
+ }
24
+ return normalized;
25
+ }
26
+ return mod;
27
+ }
28
+ normalizeKernelSpecResources(specs, serviceManager) {
29
+ if (!specs?.kernelspecs) {
30
+ return;
31
+ }
32
+ const baseUrl = serviceManager.serverSettings.baseUrl;
33
+ if (!baseUrl) {
34
+ return;
35
+ }
36
+ Object.values(specs.kernelspecs).forEach((spec) => {
37
+ if (!spec?.resources) {
38
+ return;
39
+ }
40
+ Object.entries(spec.resources).forEach(([resourceName, resourceUrl]) => {
41
+ if (typeof resourceUrl !== 'string' || !resourceUrl) {
42
+ return;
43
+ }
44
+ if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(resourceUrl)) {
45
+ return;
46
+ }
47
+ spec.resources[resourceName] = new URL(resourceUrl, baseUrl).toString();
48
+ });
49
+ });
50
+ }
14
51
  constructor(props, jupyterlab) {
15
52
  if (jupyterlab) {
16
53
  this._jupyterLab = jupyterlab;
@@ -26,16 +63,51 @@ export class JupyterLabAppAdapter {
26
63
  });
27
64
  this.load(props);
28
65
  }
66
+ async waitForShellAttachment(timeoutMs = 10000) {
67
+ const shell = this._jupyterLab.shell;
68
+ if (shell.isAttached) {
69
+ return;
70
+ }
71
+ await new Promise(resolve => {
72
+ const deadline = Date.now() + timeoutMs;
73
+ const check = () => {
74
+ if (shell.isAttached) {
75
+ resolve();
76
+ return;
77
+ }
78
+ if (Date.now() >= deadline) {
79
+ resolve();
80
+ return;
81
+ }
82
+ window.requestAnimationFrame(check);
83
+ };
84
+ check();
85
+ });
86
+ }
29
87
  async load(props) {
30
88
  const { disabledPlugins = [], hostId, plugins: extensions = [], mimeRenderers: mimeExtensions = [], nosplash, pluginPromises: extensionPromises = [], mimeRendererPromises: mimeExtensionPromises = [], devMode, serviceManager, } = props;
31
89
  const mimeExtensionResolved = await Promise.all(mimeExtensionPromises);
32
90
  mimeExtensions.push(...mimeExtensionResolved);
91
+ const normalizedMimeExtensions = mimeExtensions.map(mod => this.normalizeJupyterModule(mod));
92
+ const browserBaseUrl = new URL('.', window.location.href).toString();
93
+ const embeddedPaths = {
94
+ urls: {
95
+ ...JupyterLab.defaultPaths.urls,
96
+ // In embedded mode, JupyterLab must route against the host page
97
+ // origin, not the remote Jupyter Server base URL.
98
+ base: browserBaseUrl,
99
+ },
100
+ directories: {
101
+ ...JupyterLab.defaultPaths.directories,
102
+ },
103
+ };
33
104
  this._shell = new LabShell();
34
105
  this._jupyterLab = new JupyterLab({
35
106
  shell: this._shell,
36
- mimeExtensions,
107
+ mimeExtensions: normalizedMimeExtensions,
37
108
  devMode,
38
109
  serviceManager,
110
+ paths: embeddedPaths,
39
111
  disabled: {
40
112
  matches: [],
41
113
  patterns: [],
@@ -45,8 +117,202 @@ export class JupyterLabAppAdapter {
45
117
  matches: [],
46
118
  },
47
119
  });
120
+ // Some Jupyter servers return kernelspec icon resources as root-relative
121
+ // paths (e.g. `/api/jupyter-server/kernelspecs/...`). In embedded dev
122
+ // mode that resolves against localhost and causes 404s. Normalize those
123
+ // URLs to the configured Jupyter server origin.
124
+ this.normalizeKernelSpecResources(serviceManager.kernelspecs.specs, serviceManager);
125
+ serviceManager.kernelspecs.specsChanged.connect((_, specs) => {
126
+ this.normalizeKernelSpecResources(specs, serviceManager);
127
+ });
128
+ this._plugins = this._jupyterLab['pluginRegistry']['_plugins'];
48
129
  const extensionResolved = await Promise.all(extensionPromises);
49
- disabledPlugins.push('@jupyterlab/notebook-extension:language-server', '@jupyterlab/notebook-extension:update-raw-mimetype', '@jupyterlab/fileeditor-extension:language-server', '@jupyterlab/apputils-extension:sessionDialogs');
130
+ disabledPlugins.push('@jupyterlab/notebook-extension:language-server', '@jupyterlab/notebook-extension:update-raw-mimetype', '@jupyterlab/fileeditor-extension:language-server', '@jupyterlab/apputils-extension:sessionDialogs',
131
+ // The `resolver` plugin coordinates multi-tab workspace conflicts via a
132
+ // BroadcastChannel beacon. On rejection it tries to recover with
133
+ // `router.navigate(url, { hard: true })` where `url` is built from
134
+ // `paths.urls.base` (the Jupyter Server URL). When the embedding app
135
+ // is served from a different origin than the Jupyter Server (the
136
+ // common case for jupyter-react), `pushState` throws `SecurityError`
137
+ // and the plugin returns a deliberately never-resolving promise to
138
+ // gate `IWindowResolver` consumers. That hangs the boot chain — the
139
+ // splash overlay in particular is never disposed because ThemeManager
140
+ // can't complete its load. Embedded JupyterLab has no notion of
141
+ // multi-tab workspace conflicts, so the plugin is meaningless here.
142
+ // We replace it with a no-op `IWindowResolver` provider below.
143
+ '@jupyterlab/apputils-extension:resolver');
144
+ // Replacement for the disabled `resolver` plugin: provide a stub
145
+ // `IWindowResolver` so dependents (e.g. `application-extension:main`)
146
+ // can activate. The window name is irrelevant in an embedded context.
147
+ const resolverStub = {
148
+ id: '@datalayer/jupyter-react:window-resolver',
149
+ description: 'No-op IWindowResolver for embedded JupyterLab.',
150
+ autoStart: true,
151
+ provides: IWindowResolver,
152
+ activate: () => ({
153
+ // The interface only requires `name`. Use the configured workspace
154
+ // (or the default) without going through BroadcastChannel-based
155
+ // resolution, which is meaningless in an embedded context.
156
+ name: PageConfig.getOption('workspace') || PageConfig.defaultWorkspace,
157
+ }),
158
+ };
159
+ // Work around a ThemeManager startup race where repeated `_loadSettings`
160
+ // calls while a previous theme load is still outstanding can trigger a
161
+ // second `_loadTheme`, detach the first `<link>`, and leave the first
162
+ // promise pending forever. In that state `_current` stays null and splash
163
+ // disposal never runs.
164
+ const themeLoadGuard = {
165
+ id: '@datalayer/jupyter-react:theme-load-guard',
166
+ description: 'Prevent ThemeManager loadCSS deadlocks in embedded mode.',
167
+ autoStart: true,
168
+ requires: [IThemeManager],
169
+ activate: (_app, themeManager) => {
170
+ const tm = themeManager;
171
+ if (tm.__datalayerThemeLoadGuardPatched) {
172
+ return;
173
+ }
174
+ const CANCELED_THEME_LOAD = '[jupyter-react] canceled detached theme load';
175
+ const previousLoadCSS = typeof tm.loadCSS === 'function' ? tm.loadCSS.bind(tm) : null;
176
+ const previousOnError = typeof tm._onError === 'function' ? tm._onError.bind(tm) : null;
177
+ if (!previousLoadCSS) {
178
+ return;
179
+ }
180
+ if (previousOnError) {
181
+ tm._onError = (reason) => {
182
+ const message = String(reason ?? '');
183
+ if (message.includes(CANCELED_THEME_LOAD)) {
184
+ return;
185
+ }
186
+ previousOnError(reason);
187
+ };
188
+ }
189
+ tm.loadCSS = (path) => {
190
+ const basePromise = previousLoadCSS(path);
191
+ const link = tm._links?.[tm._links.length - 1];
192
+ if (!link) {
193
+ return basePromise;
194
+ }
195
+ const detachedGuard = new Promise((_resolve, reject) => {
196
+ let detachedAt = 0;
197
+ const clear = () => {
198
+ window.clearInterval(intervalHandle);
199
+ window.clearTimeout(timeoutHandle);
200
+ };
201
+ const finish = () => {
202
+ clear();
203
+ };
204
+ const cancel = () => {
205
+ clear();
206
+ reject(new Error(`${CANCELED_THEME_LOAD}: ${link.href}`));
207
+ };
208
+ const intervalHandle = window.setInterval(() => {
209
+ if (link.isConnected) {
210
+ detachedAt = 0;
211
+ return;
212
+ }
213
+ if (!detachedAt) {
214
+ detachedAt = Date.now();
215
+ }
216
+ const replacementConnected = (tm._links || []).some((candidate) => candidate !== link &&
217
+ candidate.href === link.href &&
218
+ candidate.isConnected);
219
+ // If the original link was detached and a replacement is now
220
+ // connected (or it remains detached for a short grace period),
221
+ // cancel this stale load so `_loadTheme` cannot apply an
222
+ // out-of-date theme when users switch quickly.
223
+ if (replacementConnected || Date.now() - detachedAt > 500) {
224
+ cancel();
225
+ }
226
+ }, 50);
227
+ const timeoutHandle = window.setTimeout(finish, 15000);
228
+ basePromise.finally(finish);
229
+ });
230
+ return Promise.race([basePromise, detachedGuard]);
231
+ };
232
+ tm.__datalayerThemeLoadGuardPatched = true;
233
+ },
234
+ };
235
+ // In embedded mode, persisted tracker restoration can replay stale
236
+ // workspace entries (editors, mime documents, cloned outputs, notebooks,
237
+ // etc.) and leave `app.restored` pending indefinitely. Keep the shell
238
+ // layout restorer service available, but skip tracker replay entirely.
239
+ const notebookRestoreGuard = {
240
+ id: '@datalayer/jupyter-react:notebook-restore-guard',
241
+ description: 'Disable tracker restoration replay in embedded JupyterLab mode.',
242
+ autoStart: true,
243
+ requires: [ILayoutRestorer],
244
+ activate: (_app, restorer) => {
245
+ const lr = restorer;
246
+ if (lr.__datalayerNotebookRestoreGuardPatched) {
247
+ return;
248
+ }
249
+ const previousRestore = typeof lr.restore === 'function' ? lr.restore.bind(lr) : null;
250
+ if (!previousRestore) {
251
+ return;
252
+ }
253
+ lr.restore = (..._args) => Promise.resolve();
254
+ lr.__datalayerNotebookRestoreGuardPatched = true;
255
+ },
256
+ };
257
+ // In embedded mode, the application main plugin can try to sync browser
258
+ // location to Jupyter Server workspace URLs (e.g.
259
+ // `/api/jupyter-server/lab/workspaces/...`). That hijacks the host page
260
+ // URL and can keep the loading UX in a bad state. Keep routing behavior
261
+ // for in-app commands, but suppress these workspace URL rewrites.
262
+ const routerNavigateGuard = {
263
+ id: '@datalayer/jupyter-react:router-navigate-guard',
264
+ description: 'Prevent embedded URL rewrite to Jupyter workspace paths.',
265
+ autoStart: true,
266
+ requires: [IRouter],
267
+ activate: (_app, router) => {
268
+ const r = router;
269
+ if (r.__datalayerRouterNavigateGuardPatched) {
270
+ return;
271
+ }
272
+ const previousNavigate = typeof r.navigate === 'function' ? r.navigate.bind(r) : null;
273
+ if (!previousNavigate) {
274
+ return;
275
+ }
276
+ r.navigate = (path, options) => {
277
+ if (typeof path === 'string' &&
278
+ (path.startsWith('/api/jupyter-server/lab/workspaces') ||
279
+ path.startsWith('/lab/workspaces'))) {
280
+ return;
281
+ }
282
+ return previousNavigate(path, options);
283
+ };
284
+ r.__datalayerRouterNavigateGuardPatched = true;
285
+ },
286
+ };
287
+ extensions.push(resolverStub);
288
+ extensions.push(themeLoadGuard);
289
+ extensions.push(notebookRestoreGuard);
290
+ extensions.push(routerNavigateGuard);
291
+ // Disable the splash plugin entirely when `nosplash` is requested.
292
+ //
293
+ // We must filter the plugin BEFORE `registerPluginModules` rather than
294
+ // calling `app.deregisterPlugin(splashId, true)` or passing the id via
295
+ // `ignorePlugins` to `app.start({...})`:
296
+ //
297
+ // - Lumino's `PluginRegistry.deregisterPlugin` only removes the plugin
298
+ // from `_plugins` and leaves the `_services` token map intact. The
299
+ // `themes` plugin declares `optional: [ISplashScreen]`, so during its
300
+ // activation Lumino resolves the token, finds the dangling id, then
301
+ // crashes accessing `plugin.activated` on `undefined`. The themes
302
+ // plugin then fails to activate, which in turn breaks the dependent
303
+ // `themes-palette-menu` plugin and removes the Settings → Theme menu.
304
+ // See `jupyterlab-lumino/packages/coreutils/src/plugins.ts`
305
+ // (`deregisterPlugin` and `resolveOptionalService`).
306
+ // - `ignorePlugins` only excludes the plugin from the startup activation
307
+ // pass; Lumino still lazy-activates it when `themes` resolves the
308
+ // optional `ISplashScreen` service, so the splash is shown anyway.
309
+ //
310
+ // Filtering before registration leaves both maps empty for the splash
311
+ // token, so optional resolution cleanly returns `null` and `themes`
312
+ // activates with `splash = null`.
313
+ if (nosplash) {
314
+ disabledPlugins.push('@jupyterlab/apputils-extension:splash');
315
+ }
50
316
  const disabledPluginsSet = new Set(disabledPlugins);
51
317
  extensionResolved.forEach(ext => {
52
318
  if (Array.isArray(ext.default)) {
@@ -62,28 +328,23 @@ export class JupyterLabAppAdapter {
62
328
  }
63
329
  }
64
330
  });
65
- this._jupyterLab.registerPluginModules(extensions);
66
- if (nosplash) {
67
- this._jupyterLab.deregisterPlugin('@jupyterlab/apputils-extension:splash', true);
68
- }
331
+ const normalizedExtensions = extensions.map(mod => this.normalizeJupyterModule(mod));
332
+ this._jupyterLab.registerPluginModules(normalizedExtensions);
69
333
  /*
70
334
  if (collaborative) {
71
335
  this._jupyterLab.deregisterPlugin("@jupyterlab/filebrowser-extension:default-file-browser", true);
72
336
  }
73
337
  */
74
- this._jupyterLab
75
- .start({
338
+ const startPromise = this._jupyterLab.start({
76
339
  hostID: hostId,
77
340
  bubblingKeydown: true, // TODO Check this prop.
78
- startPlugins: [], // How is this used in JupyterLab core?
79
- ignorePlugins: [], // How is this used in JupyterLab core?
80
- })
81
- .then(() => {
82
- // this._plugins = (this._jupyterLab as any)['_plugins'];
83
- // this._readyResolve();
341
+ startPlugins: [],
342
+ ignorePlugins: [],
84
343
  });
85
- this._jupyterLab.restored.then(() => {
86
- this._plugins = this._jupyterLab['_plugins'];
344
+ Promise.all([startPromise, this._jupyterLab.started]).then(async () => {
345
+ await this.waitForShellAttachment();
346
+ await new Promise(resolve => window.requestAnimationFrame(() => resolve()));
347
+ this._plugins = this._jupyterLab['pluginRegistry']['_plugins'];
87
348
  this._readyResolve();
88
349
  });
89
350
  }
@@ -124,10 +385,14 @@ export class JupyterLabAppAdapter {
124
385
  return this.shell._tracker;
125
386
  }
126
387
  plugin(id) {
127
- return this._plugins.get(id);
388
+ const plugins = this._plugins ||
389
+ this._jupyterLab?.['pluginRegistry']?.['_plugins'];
390
+ return plugins?.get(id);
128
391
  }
129
392
  service(id) {
130
- return this._plugins.get(id)?.service;
393
+ const plugins = this._plugins ||
394
+ this._jupyterLab?.['pluginRegistry']?.['_plugins'];
395
+ return plugins?.get(id)?.service;
131
396
  }
132
397
  async notebook(path) {
133
398
  await this.commands.execute('apputils:reset');
@@ -1 +1 @@
1
- {"version":3,"file":"JupyterLabAppAdapter.js","sourceRoot":"","sources":["../../../src/components/jupyterlab/JupyterLabAppAdapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAwB,MAAM,iBAAiB,CAAC;AACjE,OAAO,EACL,UAAU,EAGV,QAAQ,GACT,MAAM,yBAAyB,CAAC;AAkBjC,MAAM,OAAO,oBAAoB;IACvB,WAAW,CAAa;IACxB,MAAM,CAAW;IACjB,QAAQ,CAAU;IAClB,MAAM,CAAgB;IACtB,aAAa,CAAa;IAElC,YAAY,KAAgC,EAAE,UAAuB;QACnE,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;gBACvC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;YAC/B,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,QAAQ,GAAI,IAAI,CAAC,WAAmB,CAAC,gBAAgB,CAAC,CAAC,UAAU,CAAC,CAAC;YACxE,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;YACvC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,IAAI,CAAC,KAAgC;QACjD,MAAM,EACJ,eAAe,GAAG,EAAE,EACpB,MAAM,EACN,OAAO,EAAE,UAAU,GAAG,EAAE,EACxB,aAAa,EAAE,cAAc,GAAG,EAAE,EAClC,QAAQ,EACR,cAAc,EAAE,iBAAiB,GAAG,EAAE,EACtC,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CAAC;QAClC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACrC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"JupyterLabAppAdapter.js","sourceRoot":"","sources":["../../../src/components/jupyterlab/JupyterLabAppAdapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAwB,MAAM,iBAAiB,CAAC;AACjE,OAAO,EACL,UAAU,EAGV,QAAQ,EACR,eAAe,EACf,OAAO,GACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAkBnD,MAAM,OAAO,oBAAoB;IACvB,WAAW,CAAa;IACxB,MAAM,CAAW;IACjB,QAAQ,CAAU;IAClB,MAAM,CAAgB;IACtB,aAAa,CAAa;IAE1B,sBAAsB,CAAI,GAAM;QACtC,IACE,GAAG;YACH,OAAO,GAAG,KAAK,QAAQ;YACvB,OAAQ,GAAW,CAAC,cAAc,KAAK,UAAU,EACjD,CAAC;YACD,MAAM,UAAU,GAAG,EAAE,GAAI,GAA+B,EAGvD,CAAC;YACF,IAAI,SAAS,IAAI,UAAU,IAAI,CAAC,CAAC,YAAY,IAAI,UAAU,CAAC,EAAE,CAAC;gBAC7D,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC;YAC/B,CAAC;YACD,OAAO,UAAe,CAAC;QACzB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAEO,4BAA4B,CAClC,KAAU,EACV,cAAuC;QAEvC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QACD,MAAM,OAAO,GAAG,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC;QACtD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAA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AO,CAAC,EAAU;QAChB,MAAM,OAAO,GACX,IAAI,CAAC,QAAQ;YACX,IAAI,CAAC,WAAmB,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,CAE7C,CAAC;QACjB,OAAO,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAC9C,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE;YACpE,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC5B,CAAC,CAAkB,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAChC,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;QAC1C,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;QACrB,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAClC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACrC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAED,eAAe,oBAAoB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /*
3
3
  * Copyright (c) 2021-2023 Datalayer, Inc.
4
4
  *
@@ -40,7 +40,10 @@ export const JupyterLabAppCss = ({ theme = 'light' }) => {
40
40
  }
41
41
  }
42
42
  }, [theme]);
43
- return _jsx("div", { id: "dla-JupyterLabAppCss-id" });
43
+ return (_jsxs(_Fragment, { children: [_jsx("div", { id: "dla-JupyterLabAppCss-id" }), _jsx("style", { children: `#jupyterlab-splash {
44
+ top: 0;
45
+ left: 0;
46
+ }` })] }));
44
47
  };
45
48
  export default JupyterLabAppCss;
46
49
  //# sourceMappingURL=JupyterLabAppCss.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JupyterLabAppCss.js","sourceRoot":"","sources":["../../../src/components/jupyterlab/JupyterLabAppCss.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,kDAAkD,CAAC;AAC1D,OAAO,+CAA+C,CAAC;AACvD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,iDAAiD,CAAC;AACzD,OAAO,gDAAgD,CAAC;AACxD,OAAO,8CAA8C,CAAC;AACtD,OAAO,iDAAiD,CAAC;AACzD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,iDAAiD,CAAC;AACzD,OAAO,iDAAiD,CAAC;AACzD,OAAO,2CAA2C,CAAC;AACnD,OAAO,+CAA+C,CAAC;AACvD,OAAO,0CAA0C,CAAC;AAClD,OAAO,+CAA+C,CAAC;AACvD,OAAO,+CAA+C,CAAC;AACvD,OAAO,iDAAiD,CAAC;AACzD,OAAO,gDAAgD,CAAC;AACxD,OAAO,gDAAgD,CAAC;AACxD,OAAO,0CAA0C,CAAC;AAClD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oDAAoD,CAAC;AAM5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,EAAS,EAAE,EAAE;IAC7D,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,KAAK,EAAE,CAAC;YACd,KAAK,OAAO,CAAC,CAAC,CAAC;gBACb,+DAA+D;gBAC/D,MAAM;YACR,CAAC;YACD,KAAK,MAAM,CAAC,CAAC,CAAC;gBACZ,8DAA8D;gBAC9D,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,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E,cAAK,EAAE,EAAC,yBAAyB,GAAO,EACxC,0BACG;;;EAGP,GACY,IACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,32 +1,29 @@
1
- import { ReactElement } from 'react';
2
- import { KernelMessage } from '@jupyterlab/services';
3
- import { ConnectionStatus, IKernelConnection } from '@jupyterlab/services/lib/kernel/kernel';
1
+ import { IKernelConnection } from '@jupyterlab/services/lib/kernel/kernel';
4
2
  import { Environment } from '../environment/Environment';
5
- export type ExecutionState = 'connecting' | 'connected-unknown' | 'connected-starting' | 'connected-idle' | 'connected-busy' | 'connected-terminating' | 'connected-restarting' | 'connected-autorestarting' | 'connected-dead' | 'disconnected' | 'disconnecting' | 'undefined';
6
- /**
7
- * The valid kernel connection states.
8
- *
9
- * #### Notes
10
- * The status states are:
11
- * * `connected`: The kernel connection is live.
12
- * * `connecting`: The kernel connection is not live, but we are attempting
13
- * to reconnect to the kernel.
14
- * * `disconnected`: The kernel connection is permanently down, we will not
15
- * try to reconnect.
16
- *
17
- * When a kernel connection is `connected`, the kernel status should be
18
- * valid. When a kernel connection is either `connecting` or `disconnected`,
19
- * the kernel status will be `unknown` unless the kernel status was `dead`,
20
- * in which case it stays `dead`.
21
- *
22
- * Status = 'unknown' | 'starting' | 'idle' | 'busy' | 'terminating' | 'restarting' | 'autorestarting' | 'dead';
23
- */
24
- export declare const KERNEL_STATES: Map<ExecutionState, ReactElement>;
25
- export declare const toKernelState: (connectionStatus: ConnectionStatus, status: KernelMessage.Status) => ExecutionState;
3
+ import { type ExecutionState } from './KernelIndicatorState';
4
+ export type KernelIndicatorPosition = 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw';
26
5
  export type KernelIndicatorProps = {
27
6
  label?: string;
7
+ overlayTitle?: string;
28
8
  kernel?: IKernelConnection | null;
29
9
  env?: Environment;
10
+ state?: ExecutionState;
11
+ environmentName?: string;
12
+ memory?: string;
13
+ cpu?: string;
14
+ gpu?: string;
15
+ /**
16
+ * Position of the details overlay relative to the indicator trigger.
17
+ * Follows the same direction model as the Primer Tooltip.
18
+ * Defaults to 's' (below, centered).
19
+ */
20
+ position?: KernelIndicatorPosition;
21
+ /**
22
+ * When true (default), the trigger renders with a 1px border and a
23
+ * `canvas.default` background. Set to false to render a borderless,
24
+ * transparent trigger (useful when embedding in headers/toolbars).
25
+ */
26
+ bordered?: boolean;
30
27
  };
31
- export declare const KernelIndicator: (props: KernelIndicatorProps) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const KernelIndicator: ({ label, overlayTitle, kernel, env, state, environmentName, memory, cpu, gpu, position, bordered, }: KernelIndicatorProps) => import("react/jsx-runtime").JSX.Element;
32
29
  export default KernelIndicator;