@jupyter-notebook/application 7.7.0-alpha.1 → 7.7.0-beta.0

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/app.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { JupyterLab, JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application';
2
2
  import { LabStatus } from '@jupyterlab/application/lib/status';
3
3
  import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
4
+ import { ISignal } from '@lumino/signaling';
4
5
  import { INotebookShell } from './shell';
5
6
  /**
6
7
  * App is the main application class. It is instantiated once and shared.
@@ -35,7 +36,7 @@ export declare class NotebookApp extends JupyterFrontEnd<INotebookShell> {
35
36
  /**
36
37
  * The NotebookApp application information dictionary.
37
38
  */
38
- get info(): JupyterLab.IInfo;
39
+ get info(): NotebookApp.IAppInfo;
39
40
  /**
40
41
  * The JupyterLab application paths dictionary.
41
42
  */
@@ -58,7 +59,12 @@ export declare class NotebookApp extends JupyterFrontEnd<INotebookShell> {
58
59
  * @param mods - The plugin modules to register.
59
60
  */
60
61
  registerPluginModules(mods: NotebookApp.IPluginModule[]): void;
62
+ /**
63
+ * Add the announced plugins to the available plugins.
64
+ */
65
+ private _onAvailablePluginsAdded;
61
66
  private _info;
67
+ private _availablePluginsChanged;
62
68
  private _formatter;
63
69
  }
64
70
  /**
@@ -69,6 +75,11 @@ export declare namespace NotebookApp {
69
75
  * The instantiation options for an App application.
70
76
  */
71
77
  interface IOptions extends JupyterFrontEnd.IOptions<INotebookShell>, Partial<IInfo> {
78
+ /**
79
+ * A signal announcing plugins discovered after startup, such as those of
80
+ * the disabled federated extensions; they are appended to `info`.
81
+ */
82
+ availablePluginsAdded?: ISignal<unknown, JupyterLab.IPluginInfo[]>;
72
83
  }
73
84
  /**
74
85
  * The information about a Jupyter Notebook application.
@@ -82,6 +93,22 @@ export declare namespace NotebookApp {
82
93
  * The information about available plugins.
83
94
  */
84
95
  readonly availablePlugins: JupyterLab.IPluginInfo[];
96
+ /**
97
+ * The collection of disabled extension patterns and matched extensions.
98
+ */
99
+ readonly disabled: {
100
+ patterns: string[];
101
+ matches: string[];
102
+ };
103
+ }
104
+ /**
105
+ * The application information, with its change signal.
106
+ */
107
+ interface IAppInfo extends JupyterLab.IInfo {
108
+ /**
109
+ * A signal emitted when `availablePlugins` changes.
110
+ */
111
+ readonly availablePluginsChanged: ISignal<JupyterLab.IInfo, void>;
85
112
  }
86
113
  /**
87
114
  * The interface for a module that exports a plugin or plugins as
package/lib/app.js CHANGED
@@ -6,6 +6,7 @@ import { createRendermimePlugins } from '@jupyterlab/application/lib/mimerendere
6
6
  import { LabStatus } from '@jupyterlab/application/lib/status';
7
7
  import { PageConfig } from '@jupyterlab/coreutils';
8
8
  import { Throttler } from '@lumino/polling';
9
+ import { Signal } from '@lumino/signaling';
9
10
  import { NotebookShell } from './shell';
10
11
  /**
11
12
  * App is the main application class. It is instantiated once and shared.
@@ -17,7 +18,7 @@ export class NotebookApp extends JupyterFrontEnd {
17
18
  * @param options The instantiation options for an application.
18
19
  */
19
20
  constructor(options = { shell: new NotebookShell() }) {
20
- var _a, _b;
21
+ var _a, _b, _c;
21
22
  super({ ...options, shell: (_a = options.shell) !== null && _a !== void 0 ? _a : new NotebookShell() });
22
23
  /**
23
24
  * The name of the application.
@@ -35,7 +36,6 @@ export class NotebookApp extends JupyterFrontEnd {
35
36
  * The version of the application.
36
37
  */
37
38
  this.version = (_b = PageConfig.getOption('appVersion')) !== null && _b !== void 0 ? _b : 'unknown';
38
- this._info = JupyterLab.defaultInfo;
39
39
  this._formatter = new Throttler(() => {
40
40
  Private.setFormat(this);
41
41
  }, 250);
@@ -53,8 +53,19 @@ export class NotebookApp extends JupyterFrontEnd {
53
53
  }
54
54
  return acc;
55
55
  }, {});
56
- // Populate application info.
57
- this._info = { ...JupyterLab.defaultInfo, ...info };
56
+ // Populate application info with own lists, as the plugins announced after
57
+ // startup are appended in place.
58
+ const appInfo = {
59
+ ...JupyterLab.defaultInfo,
60
+ availablePlugins: [],
61
+ disabled: { patterns: [], matches: [] },
62
+ ...info,
63
+ };
64
+ this._availablePluginsChanged = new Signal(appInfo);
65
+ this._info = Object.assign(appInfo, {
66
+ availablePluginsChanged: this._availablePluginsChanged,
67
+ });
68
+ (_c = options.availablePluginsAdded) === null || _c === void 0 ? void 0 : _c.connect(this._onAvailablePluginsAdded, this);
58
69
  this.restored = this.shell.restored;
59
70
  this.restored.then(() => this._formatter.invoke());
60
71
  }
@@ -139,6 +150,23 @@ export class NotebookApp extends JupyterFrontEnd {
139
150
  this.registerPluginModule(mod);
140
151
  });
141
152
  }
153
+ /**
154
+ * Add the announced plugins to the available plugins.
155
+ */
156
+ _onAvailablePluginsAdded(sender, plugins) {
157
+ if (plugins.length === 0) {
158
+ return;
159
+ }
160
+ const disabled = new Set(this._info.disabled.matches);
161
+ for (const plugin of plugins) {
162
+ this._info.availablePlugins.push(plugin);
163
+ if (!plugin.enabled && !disabled.has(plugin.id)) {
164
+ this._info.disabled.matches.push(plugin.id);
165
+ disabled.add(plugin.id);
166
+ }
167
+ }
168
+ this._availablePluginsChanged.emit();
169
+ }
142
170
  }
143
171
  /**
144
172
  * A namespace for module-private functionality.
@@ -159,6 +159,7 @@ export declare class SidePanelPalette {
159
159
  removeItem(widget: Readonly<Widget>, area: 'left' | 'right'): void;
160
160
  private _command;
161
161
  private _commandPalette;
162
+ private _translator;
162
163
  private _items;
163
164
  }
164
165
  type SidePanelPaletteItem = {
@@ -189,10 +190,14 @@ type SidePanelPaletteOption = {
189
190
  * ### Notes
190
191
  * That command required 3 args :
191
192
  * side: 'left' | 'right', the area to toggle
192
- * title: string, label of the command
193
+ * title: string, title of the widget
193
194
  * id: string, id of the widget to activate
194
195
  */
195
196
  command: string;
197
+ /**
198
+ * The application language translator.
199
+ */
200
+ translator?: ITranslator;
196
201
  };
197
202
  /**
198
203
  * A namespace for private module data.
@@ -260,9 +260,11 @@ export class SidePanelPalette {
260
260
  * Construct a new side panel palette.
261
261
  */
262
262
  constructor(options) {
263
+ var _a;
263
264
  this._items = [];
264
265
  this._commandPalette = options.commandPalette;
265
266
  this._command = options.command;
267
+ this._translator = (_a = options.translator) !== null && _a !== void 0 ? _a : nullTranslator;
266
268
  }
267
269
  /**
268
270
  * Get a command palette item from the widget id and the area.
@@ -280,12 +282,13 @@ export class SidePanelPalette {
280
282
  return;
281
283
  }
282
284
  // Add a new item in command palette.
285
+ const trans = this._translator.load('notebook');
283
286
  const disposableDelegate = this._commandPalette.addItem({
284
287
  command: this._command,
285
- category: 'View',
288
+ category: trans.__('View'),
286
289
  args: {
287
290
  side: area,
288
- title: `Show ${widget.title.caption}`,
291
+ title: widget.title.caption,
289
292
  id: widget.id,
290
293
  },
291
294
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/application",
3
- "version": "7.7.0-alpha.1",
3
+ "version": "7.7.0-beta.0",
4
4
  "description": "Jupyter Notebook - Application",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -42,11 +42,11 @@
42
42
  "watch": "tsc -b --watch"
43
43
  },
44
44
  "dependencies": {
45
- "@jupyterlab/application": "~4.7.0-alpha.1",
46
- "@jupyterlab/coreutils": "~6.7.0-alpha.1",
47
- "@jupyterlab/docregistry": "~4.7.0-alpha.1",
48
- "@jupyterlab/rendermime-interfaces": "~3.15.0-alpha.1",
49
- "@jupyterlab/ui-components": "~4.7.0-alpha.1",
45
+ "@jupyterlab/application": "~4.7.0-beta.0",
46
+ "@jupyterlab/coreutils": "~6.7.0-beta.0",
47
+ "@jupyterlab/docregistry": "~4.7.0-beta.0",
48
+ "@jupyterlab/rendermime-interfaces": "~3.15.0-beta.0",
49
+ "@jupyterlab/ui-components": "~4.7.0-beta.0",
50
50
  "@lumino/algorithm": "^2.0.4",
51
51
  "@lumino/coreutils": "^2.2.2",
52
52
  "@lumino/messaging": "^2.0.4",
@@ -57,7 +57,7 @@
57
57
  "devDependencies": {
58
58
  "@babel/core": "^7.29.6",
59
59
  "@babel/preset-env": "^7.12.1",
60
- "@jupyterlab/testutils": "~4.7.0-alpha.1",
60
+ "@jupyterlab/testutils": "~4.7.0-beta.0",
61
61
  "@types/jest": "^29.2.5",
62
62
  "jest": "^29.3.1",
63
63
  "rimraf": "^3.0.2",