@jupyter-notebook/application 7.7.0-alpha.0 → 7.7.0-alpha.2
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 +28 -1
- package/lib/app.js +32 -4
- package/lib/panelhandler.d.ts +1 -1
- package/lib/panelhandler.js +1 -1
- package/lib/shell.d.ts +10 -0
- package/lib/shell.js +38 -3
- package/package.json +7 -7
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():
|
|
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
|
-
|
|
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.
|
package/lib/panelhandler.d.ts
CHANGED
|
@@ -189,7 +189,7 @@ type SidePanelPaletteOption = {
|
|
|
189
189
|
* ### Notes
|
|
190
190
|
* That command required 3 args :
|
|
191
191
|
* side: 'left' | 'right', the area to toggle
|
|
192
|
-
* title: string,
|
|
192
|
+
* title: string, title of the widget
|
|
193
193
|
* id: string, id of the widget to activate
|
|
194
194
|
*/
|
|
195
195
|
command: string;
|
package/lib/panelhandler.js
CHANGED
package/lib/shell.d.ts
CHANGED
|
@@ -168,6 +168,14 @@ export declare class NotebookShell extends Widget implements JupyterFrontEnd.ISh
|
|
|
168
168
|
* Handle a change on the down panel widgets
|
|
169
169
|
*/
|
|
170
170
|
private _onTabPanelChanged;
|
|
171
|
+
/**
|
|
172
|
+
* Show the down panel, restoring its previous relative size.
|
|
173
|
+
*/
|
|
174
|
+
private _showDownPanel;
|
|
175
|
+
/**
|
|
176
|
+
* Hide the down panel, saving its relative size to restore it later.
|
|
177
|
+
*/
|
|
178
|
+
private _hideDownPanel;
|
|
171
179
|
private _topWrapper;
|
|
172
180
|
private _topHandler;
|
|
173
181
|
private _menuWrapper;
|
|
@@ -178,7 +186,9 @@ export declare class NotebookShell extends Widget implements JupyterFrontEnd.ISh
|
|
|
178
186
|
private _spacer_bottom;
|
|
179
187
|
private _skipLinkWidgetHandler;
|
|
180
188
|
private _main;
|
|
189
|
+
private _vsplitPanel;
|
|
181
190
|
private _downPanel;
|
|
191
|
+
private _lastDownAreaSize;
|
|
182
192
|
private _translator;
|
|
183
193
|
private _currentChanged;
|
|
184
194
|
private _mainWidgetLoaded;
|
package/lib/shell.js
CHANGED
|
@@ -7,6 +7,10 @@ import { Signal } from '@lumino/signaling';
|
|
|
7
7
|
import { BoxLayout, Panel, SplitPanel, Widget, } from '@lumino/widgets';
|
|
8
8
|
import { PanelHandler, SidePanelHandler } from './panelhandler';
|
|
9
9
|
import { TabPanelSvg } from '@jupyterlab/ui-components';
|
|
10
|
+
/**
|
|
11
|
+
* The default relative size of the down area when it is expanded.
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_DOWN_AREA_SIZE = 0.25;
|
|
10
14
|
/**
|
|
11
15
|
* The Jupyter Notebook application shell token.
|
|
12
16
|
*/
|
|
@@ -21,6 +25,7 @@ const DEFAULT_RANK = 900;
|
|
|
21
25
|
export class NotebookShell extends Widget {
|
|
22
26
|
constructor() {
|
|
23
27
|
super();
|
|
28
|
+
this._lastDownAreaSize = DEFAULT_DOWN_AREA_SIZE;
|
|
24
29
|
this._translator = nullTranslator;
|
|
25
30
|
this._currentChanged = new Signal(this);
|
|
26
31
|
this._mainWidgetLoaded = new PromiseDelegate();
|
|
@@ -73,6 +78,7 @@ export class NotebookShell extends Widget {
|
|
|
73
78
|
middlePanel.addWidget(this._spacer_bottom);
|
|
74
79
|
middlePanel.layout = middleLayout;
|
|
75
80
|
const vsplitPanel = new SplitPanel();
|
|
81
|
+
this._vsplitPanel = vsplitPanel;
|
|
76
82
|
vsplitPanel.id = 'jp-main-vsplit-panel';
|
|
77
83
|
vsplitPanel.spacing = 1;
|
|
78
84
|
vsplitPanel.orientation = 'vertical';
|
|
@@ -82,6 +88,7 @@ export class NotebookShell extends Widget {
|
|
|
82
88
|
});
|
|
83
89
|
this._downPanel = downPanel;
|
|
84
90
|
this._downPanel.id = 'jp-down-stack';
|
|
91
|
+
SplitPanel.setStretch(downPanel, 0);
|
|
85
92
|
// TODO: Consider storing this as an attribute this._hsplitPanel if saving/restoring layout needed
|
|
86
93
|
const hsplitPanel = new SplitPanel();
|
|
87
94
|
hsplitPanel.id = 'main-split-panel';
|
|
@@ -204,8 +211,14 @@ export class NotebookShell extends Widget {
|
|
|
204
211
|
this.expandRight(id);
|
|
205
212
|
}
|
|
206
213
|
else if (area === 'down') {
|
|
207
|
-
this._downPanel.
|
|
208
|
-
|
|
214
|
+
const tabIndex = this._downPanel.tabBar.titles.findIndex((title) => title.owner.id === id);
|
|
215
|
+
if (tabIndex >= 0) {
|
|
216
|
+
this._downPanel.currentIndex = tabIndex;
|
|
217
|
+
if (this._downPanel.isHidden) {
|
|
218
|
+
this._showDownPanel();
|
|
219
|
+
}
|
|
220
|
+
widget.activate();
|
|
221
|
+
}
|
|
209
222
|
}
|
|
210
223
|
else {
|
|
211
224
|
widget.activate();
|
|
@@ -417,9 +430,31 @@ export class NotebookShell extends Widget {
|
|
|
417
430
|
*/
|
|
418
431
|
_onTabPanelChanged() {
|
|
419
432
|
if (this._downPanel.stackedPanel.widgets.length === 0) {
|
|
420
|
-
this.
|
|
433
|
+
this._hideDownPanel();
|
|
421
434
|
}
|
|
422
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Show the down panel, restoring its previous relative size.
|
|
438
|
+
*/
|
|
439
|
+
_showDownPanel(size = this._lastDownAreaSize) {
|
|
440
|
+
const downSize = size > 0.0 ? size : DEFAULT_DOWN_AREA_SIZE;
|
|
441
|
+
this._lastDownAreaSize = downSize;
|
|
442
|
+
this._vsplitPanel.setRelativeSizes([
|
|
443
|
+
Math.max(1.0 - downSize, 0.0),
|
|
444
|
+
downSize,
|
|
445
|
+
]);
|
|
446
|
+
this._downPanel.show();
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Hide the down panel, saving its relative size to restore it later.
|
|
450
|
+
*/
|
|
451
|
+
_hideDownPanel() {
|
|
452
|
+
const size = this._vsplitPanel.relativeSizes()[1];
|
|
453
|
+
if (size > 0.0) {
|
|
454
|
+
this._lastDownAreaSize = size;
|
|
455
|
+
}
|
|
456
|
+
this._downPanel.hide();
|
|
457
|
+
}
|
|
423
458
|
}
|
|
424
459
|
export var Private;
|
|
425
460
|
(function (Private) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/application",
|
|
3
|
-
"version": "7.7.0-alpha.
|
|
3
|
+
"version": "7.7.0-alpha.2",
|
|
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.
|
|
46
|
-
"@jupyterlab/coreutils": "~6.7.0-alpha.
|
|
47
|
-
"@jupyterlab/docregistry": "~4.7.0-alpha.
|
|
48
|
-
"@jupyterlab/rendermime-interfaces": "~3.15.0-alpha.
|
|
49
|
-
"@jupyterlab/ui-components": "~4.7.0-alpha.
|
|
45
|
+
"@jupyterlab/application": "~4.7.0-alpha.2",
|
|
46
|
+
"@jupyterlab/coreutils": "~6.7.0-alpha.2",
|
|
47
|
+
"@jupyterlab/docregistry": "~4.7.0-alpha.2",
|
|
48
|
+
"@jupyterlab/rendermime-interfaces": "~3.15.0-alpha.2",
|
|
49
|
+
"@jupyterlab/ui-components": "~4.7.0-alpha.2",
|
|
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.
|
|
60
|
+
"@jupyterlab/testutils": "~4.7.0-alpha.2",
|
|
61
61
|
"@types/jest": "^29.2.5",
|
|
62
62
|
"jest": "^29.3.1",
|
|
63
63
|
"rimraf": "^3.0.2",
|