@jupyter-notebook/notebook-extension 7.0.0-rc.2 → 7.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.
Files changed (2) hide show
  1. package/lib/index.js +38 -1
  2. package/package.json +9 -9
package/lib/index.js CHANGED
@@ -309,6 +309,42 @@ const notebookToolsWidget = {
309
309
  shell.currentChanged.connect(onChange);
310
310
  },
311
311
  };
312
+ /**
313
+ * A plugin to update the tab icon based on the kernel status.
314
+ */
315
+ const tabIcon = {
316
+ id: '@jupyter-notebook/notebook-extension:tab-icon',
317
+ autoStart: true,
318
+ requires: [INotebookTracker],
319
+ activate: (app, tracker) => {
320
+ // the favicons are provided by Jupyter Server
321
+ const notebookIcon = ' /static/favicons/favicon-notebook.ico';
322
+ const busyIcon = ' /static/favicons/favicon-busy-1.ico';
323
+ const updateBrowserFavicon = (status) => {
324
+ const link = document.querySelector("link[rel*='icon']");
325
+ switch (status) {
326
+ case 'busy':
327
+ link.href = busyIcon;
328
+ break;
329
+ case 'idle':
330
+ link.href = notebookIcon;
331
+ break;
332
+ }
333
+ };
334
+ const onChange = async () => {
335
+ const current = tracker.currentWidget;
336
+ const sessionContext = current === null || current === void 0 ? void 0 : current.sessionContext;
337
+ if (!sessionContext) {
338
+ return;
339
+ }
340
+ sessionContext.statusChanged.connect(() => {
341
+ const status = sessionContext.kernelDisplayStatus;
342
+ updateBrowserFavicon(status);
343
+ });
344
+ };
345
+ tracker.currentChanged.connect(onChange);
346
+ },
347
+ };
312
348
  /**
313
349
  * A plugin that adds a Trusted indicator to the menu area
314
350
  */
@@ -340,8 +376,9 @@ const plugins = [
340
376
  closeTab,
341
377
  kernelLogo,
342
378
  kernelStatus,
343
- scrollOutput,
344
379
  notebookToolsWidget,
380
+ scrollOutput,
381
+ tabIcon,
345
382
  trusted,
346
383
  ];
347
384
  export default plugins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/notebook-extension",
3
- "version": "7.0.0-rc.2",
3
+ "version": "7.0.1",
4
4
  "description": "Jupyter Notebook - Notebook Extension",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -38,14 +38,14 @@
38
38
  "watch": "tsc -b --watch"
39
39
  },
40
40
  "dependencies": {
41
- "@jupyter-notebook/application": "^7.0.0-rc.2",
42
- "@jupyterlab/application": "^4.0.2",
43
- "@jupyterlab/apputils": "^4.1.2",
44
- "@jupyterlab/cells": "^4.0.2",
45
- "@jupyterlab/docmanager": "^4.0.2",
46
- "@jupyterlab/notebook": "^4.0.2",
47
- "@jupyterlab/settingregistry": "^4.0.2",
48
- "@jupyterlab/translation": "^4.0.2",
41
+ "@jupyter-notebook/application": "^7.0.1",
42
+ "@jupyterlab/application": "^4.0.3",
43
+ "@jupyterlab/apputils": "^4.1.3",
44
+ "@jupyterlab/cells": "^4.0.3",
45
+ "@jupyterlab/docmanager": "^4.0.3",
46
+ "@jupyterlab/notebook": "^4.0.3",
47
+ "@jupyterlab/settingregistry": "^4.0.3",
48
+ "@jupyterlab/translation": "^4.0.3",
49
49
  "@lumino/polling": "^2.1.1",
50
50
  "@lumino/widgets": "^2.1.1"
51
51
  },