@jupyterlab/application 4.7.0-alpha.0 → 4.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/dockpanel.d.ts +44 -0
- package/lib/dockpanel.js +174 -36
- package/lib/dockpanel.js.map +1 -1
- package/lib/lab.d.ts +29 -1
- package/lib/lab.js +30 -3
- package/lib/lab.js.map +1 -1
- package/lib/shell.d.ts +12 -12
- package/lib/shell.js +25 -19
- package/lib/shell.js.map +1 -1
- package/lib/utils.js +0 -1
- package/lib/utils.js.map +1 -1
- package/package.json +21 -21
- package/src/dockpanel.ts +182 -37
- package/src/lab.ts +57 -3
- package/src/shell.ts +28 -17
- package/src/utils.ts +2 -3
- package/style/buttons.css +6 -6
package/src/dockpanel.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { DockPanelSvg } from '@jupyterlab/ui-components';
|
|
2
|
+
import type { Message } from '@lumino/messaging';
|
|
2
3
|
import type { Widget } from '@lumino/widgets';
|
|
3
4
|
|
|
4
|
-
const DEFAULT_NODE_THRESHOLD = 1000;
|
|
5
|
-
const DEFAULT_TEXT_LENGTH_THRESHOLD = 25000;
|
|
5
|
+
export const DEFAULT_NODE_THRESHOLD = 1000;
|
|
6
|
+
export const DEFAULT_TEXT_LENGTH_THRESHOLD = 25000;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Milliseconds after the last pointer move before the frozen sizes are
|
|
10
|
+
* re-measured.
|
|
11
|
+
*/
|
|
12
|
+
export const REFRESH_DEBOUNCE = 300;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Milliseconds between re-measures while a drag is held still.
|
|
16
|
+
*/
|
|
17
|
+
export const REFRESH_INTERVAL = 3000;
|
|
6
18
|
|
|
7
19
|
/**
|
|
8
20
|
* A dock panel that freezes heavy panel dimensions during handle drags to
|
|
@@ -20,18 +32,26 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
20
32
|
* not be called directly by user code.
|
|
21
33
|
*/
|
|
22
34
|
override handleEvent(event: Event): void {
|
|
23
|
-
|
|
35
|
+
// A second pointer going down while a drag is in progress must not be
|
|
36
|
+
// mistaken for a new drag which never started, or the flag is cleared and
|
|
37
|
+
// the panels stay frozen for good.
|
|
38
|
+
if (event.type === 'pointerdown' && !this._isResizeDragActive) {
|
|
24
39
|
this._isResizeDragActive = this._isHandlePointerDown(event);
|
|
40
|
+
if (this._isResizeDragActive) {
|
|
41
|
+
this._dragPointerId = (event as PointerEvent).pointerId;
|
|
42
|
+
// Installed here rather than below, so that the listener and the flag
|
|
43
|
+
// are always set together, whether or not the freeze is enabled.
|
|
44
|
+
this._listenForCancel();
|
|
45
|
+
}
|
|
25
46
|
}
|
|
26
47
|
|
|
27
48
|
// Unfreeze before super processes the drag-release events so Lumino
|
|
28
49
|
// measures natural sizes when it finalises the split position.
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
50
|
+
if (
|
|
51
|
+
this._isResizeDragActive &&
|
|
52
|
+
Private.endsDrag(event, this._dragPointerId)
|
|
53
|
+
) {
|
|
54
|
+
this._endDrag();
|
|
35
55
|
}
|
|
36
56
|
|
|
37
57
|
super.handleEvent(event);
|
|
@@ -47,6 +67,55 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
47
67
|
}
|
|
48
68
|
}
|
|
49
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Dispose of the resources held by the panel.
|
|
72
|
+
*/
|
|
73
|
+
override dispose(): void {
|
|
74
|
+
this._endDrag();
|
|
75
|
+
super.dispose();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A message handler invoked on an `'after-detach'` message.
|
|
80
|
+
*
|
|
81
|
+
* #### Notes
|
|
82
|
+
* Lumino ends a handle drag on detach without an event reaching
|
|
83
|
+
* `handleEvent`, so the drag has to be ended here as well.
|
|
84
|
+
*/
|
|
85
|
+
protected override onAfterDetach(msg: Message): void {
|
|
86
|
+
this._endDrag();
|
|
87
|
+
super.onAfterDetach(msg);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Stop the drag and put back everything it froze.
|
|
92
|
+
*/
|
|
93
|
+
private _endDrag(): void {
|
|
94
|
+
this._isResizeDragActive = false;
|
|
95
|
+
this._dragPointerId = -1;
|
|
96
|
+
if (this._cancelListener) {
|
|
97
|
+
this._cancelListener.removeEventListener('pointercancel', this, true);
|
|
98
|
+
this._cancelListener = null;
|
|
99
|
+
}
|
|
100
|
+
this._unfreezeElements();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Listen for the drag being cancelled, which Lumino does not listen for.
|
|
105
|
+
*
|
|
106
|
+
* #### Notes
|
|
107
|
+
* A pen or touch drag taken over by a system gesture ends with
|
|
108
|
+
* `pointercancel` and no `pointerup`, so without this the panels would stay
|
|
109
|
+
* frozen.
|
|
110
|
+
*/
|
|
111
|
+
private _listenForCancel(): void {
|
|
112
|
+
if (this._cancelListener) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this._cancelListener = this.node.ownerDocument;
|
|
116
|
+
this._cancelListener.addEventListener('pointercancel', this, true);
|
|
117
|
+
}
|
|
118
|
+
|
|
50
119
|
private _isHandlePointerDown(event: Event): boolean {
|
|
51
120
|
const pointerEvent = event as PointerEvent;
|
|
52
121
|
if (pointerEvent.button !== 0) {
|
|
@@ -94,17 +163,23 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
94
163
|
|
|
95
164
|
for (const target of targets) {
|
|
96
165
|
const head = target.node;
|
|
97
|
-
const
|
|
166
|
+
const candidates: HTMLElement[] = [head];
|
|
98
167
|
for (let i = 0; i < head.children.length; i++) {
|
|
99
|
-
|
|
168
|
+
candidates.push(head.children[i] as HTMLElement);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Leave the elements whose geometry Lumino owns untouched; freezing
|
|
172
|
+
// those corrupts the layout, see `Private.isLayoutManaged`.
|
|
173
|
+
const elements = candidates.filter(el => !Private.isLayoutManaged(el));
|
|
174
|
+
if (elements.length === 0) {
|
|
175
|
+
continue;
|
|
100
176
|
}
|
|
101
177
|
|
|
102
178
|
// Read all rects before writing to avoid layout thrashing.
|
|
103
179
|
const rects = elements.map(el => el.getBoundingClientRect());
|
|
104
180
|
|
|
105
|
-
const frozenGroup: Private.IFrozenElement[] = elements.map(
|
|
181
|
+
const frozenGroup: Private.IFrozenElement[] = elements.map(el => ({
|
|
106
182
|
element: el,
|
|
107
|
-
isHead: i === 0,
|
|
108
183
|
prevWidth: el.style.width,
|
|
109
184
|
prevMaxWidth: el.style.maxWidth,
|
|
110
185
|
prevHeight: el.style.height,
|
|
@@ -112,14 +187,7 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
112
187
|
}));
|
|
113
188
|
|
|
114
189
|
for (let i = 0; i < frozenGroup.length; i++) {
|
|
115
|
-
|
|
116
|
-
const rect = rects[i];
|
|
117
|
-
el.style.width = `${rect.width}px`;
|
|
118
|
-
el.style.maxWidth = `${rect.width}px`;
|
|
119
|
-
el.style.maxHeight = `${rect.height}px`;
|
|
120
|
-
if (frozenGroup[i].isHead) {
|
|
121
|
-
el.style.height = `${rect.height}px`;
|
|
122
|
-
}
|
|
190
|
+
Private.pinToRect(frozenGroup[i].element, rects[i]);
|
|
123
191
|
}
|
|
124
192
|
this._frozenGroups.push(frozenGroup);
|
|
125
193
|
}
|
|
@@ -127,7 +195,7 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
127
195
|
if (this._frozenGroups.length > 0 && this._intervalId === 0) {
|
|
128
196
|
this._intervalId = window.setInterval(() => {
|
|
129
197
|
this._refreshFrozenElements();
|
|
130
|
-
},
|
|
198
|
+
}, REFRESH_INTERVAL);
|
|
131
199
|
}
|
|
132
200
|
}
|
|
133
201
|
|
|
@@ -141,12 +209,24 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
141
209
|
this._refreshTimerId = window.setTimeout(() => {
|
|
142
210
|
this._refreshTimerId = 0;
|
|
143
211
|
this._refreshFrozenElements();
|
|
144
|
-
},
|
|
212
|
+
}, REFRESH_DEBOUNCE);
|
|
145
213
|
}
|
|
146
214
|
|
|
147
215
|
private _refreshFrozenElements(): void {
|
|
216
|
+
// A refresh spans several frames, and both the interval and the pointer
|
|
217
|
+
// move debounce can start one. Stamp each pass so that a pass started
|
|
218
|
+
// while another is in flight replaces it instead of running alongside it;
|
|
219
|
+
// two passes sharing `_refreshRAFId` would leave one of them impossible
|
|
220
|
+
// to cancel, and it would then re-apply sizes to elements that are no
|
|
221
|
+
// longer frozen.
|
|
222
|
+
this._cancelRefresh();
|
|
223
|
+
const generation = this._refreshGeneration;
|
|
224
|
+
|
|
148
225
|
let g = 0;
|
|
149
226
|
const step = () => {
|
|
227
|
+
if (generation !== this._refreshGeneration) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
150
230
|
if (g >= this._frozenGroups.length) {
|
|
151
231
|
this._refreshRAFId = 0;
|
|
152
232
|
return;
|
|
@@ -162,17 +242,12 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
162
242
|
}
|
|
163
243
|
|
|
164
244
|
this._refreshRAFId = requestAnimationFrame(() => {
|
|
245
|
+
if (generation !== this._refreshGeneration) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
165
248
|
let rects = group.map(entry => entry.element.getBoundingClientRect());
|
|
166
249
|
for (let i = 0; i < group.length; i++) {
|
|
167
|
-
|
|
168
|
-
let rect = rects[i];
|
|
169
|
-
let el = entry.element;
|
|
170
|
-
el.style.width = `${rect.width}px`;
|
|
171
|
-
el.style.maxWidth = `${rect.width}px`;
|
|
172
|
-
el.style.maxHeight = `${rect.height}px`;
|
|
173
|
-
if (entry.isHead) {
|
|
174
|
-
el.style.height = `${rect.height}px`;
|
|
175
|
-
}
|
|
250
|
+
Private.pinToRect(group[i].element, rects[i]);
|
|
176
251
|
}
|
|
177
252
|
g++;
|
|
178
253
|
this._refreshRAFId = requestAnimationFrame(step);
|
|
@@ -182,15 +257,23 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
182
257
|
this._refreshRAFId = requestAnimationFrame(step);
|
|
183
258
|
}
|
|
184
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Stop any refresh pass which is in flight.
|
|
262
|
+
*/
|
|
263
|
+
private _cancelRefresh(): void {
|
|
264
|
+
this._refreshGeneration++;
|
|
265
|
+
if (this._refreshRAFId !== 0) {
|
|
266
|
+
cancelAnimationFrame(this._refreshRAFId);
|
|
267
|
+
this._refreshRAFId = 0;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
185
271
|
private _unfreezeElements(): void {
|
|
186
272
|
if (this._refreshTimerId !== 0) {
|
|
187
273
|
clearTimeout(this._refreshTimerId);
|
|
188
274
|
this._refreshTimerId = 0;
|
|
189
275
|
}
|
|
190
|
-
|
|
191
|
-
cancelAnimationFrame(this._refreshRAFId);
|
|
192
|
-
this._refreshRAFId = 0;
|
|
193
|
-
}
|
|
276
|
+
this._cancelRefresh();
|
|
194
277
|
if (this._intervalId !== 0) {
|
|
195
278
|
clearInterval(this._intervalId);
|
|
196
279
|
this._intervalId = 0;
|
|
@@ -248,17 +331,79 @@ export class OptimizedDockPanelSvg extends DockPanelSvg {
|
|
|
248
331
|
|
|
249
332
|
private _optimizeResize = true;
|
|
250
333
|
private _isResizeDragActive = false;
|
|
334
|
+
private _dragPointerId = -1;
|
|
335
|
+
private _cancelListener: Document | null = null;
|
|
251
336
|
private _frozenGroups: Private.IFrozenElement[][] = [];
|
|
252
337
|
private _refreshTimerId = 0;
|
|
253
338
|
private _refreshRAFId = 0;
|
|
339
|
+
private _refreshGeneration = 0;
|
|
254
340
|
private _intervalId = 0;
|
|
255
341
|
}
|
|
256
342
|
|
|
257
343
|
/** Namespace for OptimizedDockPanelSvg statics */
|
|
258
344
|
namespace Private {
|
|
345
|
+
/**
|
|
346
|
+
* Whether a Lumino layout owns the geometry of the given element.
|
|
347
|
+
*
|
|
348
|
+
* #### Notes
|
|
349
|
+
* Lumino positions widget nodes through `LayoutItem`, which remembers the
|
|
350
|
+
* geometry it last wrote and skips writing `width` or `height` again when
|
|
351
|
+
* the value did not change. Anything else writing those properties leaves
|
|
352
|
+
* the DOM out of step with that record for as long as the layout keeps
|
|
353
|
+
* computing the same size, which pins the widget at a stale size.
|
|
354
|
+
* `LayoutItem.fit()` also reads `max-width` and `max-height` back off the
|
|
355
|
+
* node into the limits it clamps against, so an injected maximum can
|
|
356
|
+
* survive well past the drag which set it. Split handles are written the
|
|
357
|
+
* same way, without going through `LayoutItem`.
|
|
358
|
+
*
|
|
359
|
+
* Both are set up with an inline `position: absolute`, which is what this
|
|
360
|
+
* tests for. Testing for the `lm-Widget` class instead would also skip
|
|
361
|
+
* widget nodes of layouts which never write geometry, such as the outputs
|
|
362
|
+
* of an output area, and leave nothing to freeze. Should Lumino stop
|
|
363
|
+
* setting the position inline, this errs towards freezing less rather than
|
|
364
|
+
* towards corrupting a layout.
|
|
365
|
+
*/
|
|
366
|
+
export function isLayoutManaged(el: HTMLElement): boolean {
|
|
367
|
+
return el.style.position === 'absolute';
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Whether the event ends a handle drag, matching the rules Lumino releases
|
|
372
|
+
* the drag on, plus the cancellation Lumino does not listen for.
|
|
373
|
+
*/
|
|
374
|
+
export function endsDrag(event: Event, dragPointerId: number): boolean {
|
|
375
|
+
switch (event.type) {
|
|
376
|
+
case 'pointerup':
|
|
377
|
+
// Deliberately not matched against `dragPointerId`. Lumino releases
|
|
378
|
+
// on any button 0 release and then drops its document listeners, so
|
|
379
|
+
// matching here would leave the panels frozen with no drag running
|
|
380
|
+
// and no further event able to unfreeze them.
|
|
381
|
+
return (event as PointerEvent).button === 0;
|
|
382
|
+
case 'pointercancel':
|
|
383
|
+
// Matched, because Lumino has no cancel case to keep in step with. An
|
|
384
|
+
// unrelated pointer being cancelled, a palm resting on a touch screen
|
|
385
|
+
// for instance, must not end a drag it was never part of.
|
|
386
|
+
return (event as PointerEvent).pointerId === dragPointerId;
|
|
387
|
+
case 'keydown':
|
|
388
|
+
return (event as KeyboardEvent).keyCode === 27;
|
|
389
|
+
default:
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Hold an element at the size it has now, so that resizing an ancestor does
|
|
396
|
+
* not make the browser lay out its contents again.
|
|
397
|
+
*/
|
|
398
|
+
export function pinToRect(el: HTMLElement, rect: DOMRect): void {
|
|
399
|
+
el.style.width = `${rect.width}px`;
|
|
400
|
+
el.style.maxWidth = `${rect.width}px`;
|
|
401
|
+
el.style.height = `${rect.height}px`;
|
|
402
|
+
el.style.maxHeight = `${rect.height}px`;
|
|
403
|
+
}
|
|
404
|
+
|
|
259
405
|
export interface IFrozenElement {
|
|
260
406
|
element: HTMLElement;
|
|
261
|
-
isHead: boolean;
|
|
262
407
|
prevWidth: string;
|
|
263
408
|
prevMaxWidth: string;
|
|
264
409
|
prevHeight: string;
|
package/src/lab.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type { IRenderMime } from '@jupyterlab/rendermime-interfaces';
|
|
|
8
8
|
import type { IConnectionStatus } from '@jupyterlab/services';
|
|
9
9
|
import { ConnectionStatus, ServiceManager } from '@jupyterlab/services';
|
|
10
10
|
import { PromiseDelegate, Token } from '@lumino/coreutils';
|
|
11
|
+
import type { ISignal } from '@lumino/signaling';
|
|
12
|
+
import { Signal } from '@lumino/signaling';
|
|
11
13
|
import type { JupyterFrontEndPlugin } from './frontend';
|
|
12
14
|
import { JupyterFrontEnd } from './frontend';
|
|
13
15
|
import { createRendermimePlugins } from './mimerenderers';
|
|
@@ -321,6 +323,18 @@ export namespace JupyterLab {
|
|
|
321
323
|
* Application connection status.
|
|
322
324
|
*/
|
|
323
325
|
connectionStatus?: IConnectionStatus;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* A signal announcing plugins which become known only after the
|
|
329
|
+
* application started, for example the plugins of disabled federated
|
|
330
|
+
* extensions, whose modules are loaded once the application is idle.
|
|
331
|
+
*
|
|
332
|
+
* On each emission, the plugins are appended to `info.availablePlugins`,
|
|
333
|
+
* the ids of the disabled ones are added to `info.disabled.matches`, and
|
|
334
|
+
* `info.availablePluginsChanged` is emitted. An emission before the
|
|
335
|
+
* application is constructed is not seen.
|
|
336
|
+
*/
|
|
337
|
+
availablePluginsAdded?: ISignal<unknown, IPluginInfo[]>;
|
|
324
338
|
}
|
|
325
339
|
|
|
326
340
|
/**
|
|
@@ -360,6 +374,13 @@ export namespace JupyterLab {
|
|
|
360
374
|
*/
|
|
361
375
|
readonly availablePlugins: IPluginInfo[];
|
|
362
376
|
|
|
377
|
+
/**
|
|
378
|
+
* A signal emitted when `availablePlugins` changes, for example once the
|
|
379
|
+
* plugins of disabled federated extensions, which are loaded after
|
|
380
|
+
* startup, are known.
|
|
381
|
+
*/
|
|
382
|
+
readonly availablePluginsChanged?: ISignal<IInfo, void>;
|
|
383
|
+
|
|
363
384
|
/**
|
|
364
385
|
* Whether files are cached on the server.
|
|
365
386
|
*/
|
|
@@ -384,12 +405,17 @@ export namespace JupyterLab {
|
|
|
384
405
|
export class Info implements IInfo {
|
|
385
406
|
constructor({
|
|
386
407
|
connectionStatus,
|
|
408
|
+
availablePluginsAdded,
|
|
387
409
|
...options
|
|
388
|
-
}: Partial<IInfo> & {
|
|
410
|
+
}: Partial<IInfo> & {
|
|
411
|
+
connectionStatus?: IConnectionStatus;
|
|
412
|
+
availablePluginsAdded?: ISignal<unknown, IPluginInfo[]>;
|
|
413
|
+
} = {}) {
|
|
389
414
|
this._connectionStatus = connectionStatus ?? new ConnectionStatus();
|
|
390
415
|
|
|
391
|
-
this._availablePlugins =
|
|
392
|
-
|
|
416
|
+
this._availablePlugins = options.availablePlugins ?? [
|
|
417
|
+
...JupyterLab.defaultInfo.availablePlugins
|
|
418
|
+
];
|
|
393
419
|
this._devMode = options.devMode ?? JupyterLab.defaultInfo.devMode;
|
|
394
420
|
this._deferred = JSON.parse(
|
|
395
421
|
JSON.stringify(options.deferred ?? JupyterLab.defaultInfo.deferred)
|
|
@@ -406,6 +432,8 @@ export namespace JupyterLab {
|
|
|
406
432
|
);
|
|
407
433
|
this.isConnected =
|
|
408
434
|
options.isConnected ?? JupyterLab.defaultInfo.isConnected;
|
|
435
|
+
|
|
436
|
+
availablePluginsAdded?.connect(this._onAvailablePluginsAdded, this);
|
|
409
437
|
}
|
|
410
438
|
|
|
411
439
|
/**
|
|
@@ -415,6 +443,13 @@ export namespace JupyterLab {
|
|
|
415
443
|
return this._availablePlugins;
|
|
416
444
|
}
|
|
417
445
|
|
|
446
|
+
/**
|
|
447
|
+
* A signal emitted when `availablePlugins` changes.
|
|
448
|
+
*/
|
|
449
|
+
get availablePluginsChanged(): ISignal<IInfo, void> {
|
|
450
|
+
return this._availablePluginsChanged;
|
|
451
|
+
}
|
|
452
|
+
|
|
418
453
|
/**
|
|
419
454
|
* Whether the application is in dev mode.
|
|
420
455
|
*/
|
|
@@ -467,11 +502,30 @@ export namespace JupyterLab {
|
|
|
467
502
|
return this._mimeExtensions;
|
|
468
503
|
}
|
|
469
504
|
|
|
505
|
+
/**
|
|
506
|
+
* Add the announced plugins to the available plugins.
|
|
507
|
+
*/
|
|
508
|
+
private _onAvailablePluginsAdded(_: unknown, plugins: IPluginInfo[]): void {
|
|
509
|
+
if (plugins.length === 0) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
const disabled = new Set(this._disabled.matches);
|
|
513
|
+
for (const plugin of plugins) {
|
|
514
|
+
this._availablePlugins.push(plugin);
|
|
515
|
+
if (!plugin.enabled && !disabled.has(plugin.id)) {
|
|
516
|
+
this._disabled.matches.push(plugin.id);
|
|
517
|
+
disabled.add(plugin.id);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
this._availablePluginsChanged.emit();
|
|
521
|
+
}
|
|
522
|
+
|
|
470
523
|
private _devMode: boolean;
|
|
471
524
|
private _deferred: { patterns: string[]; matches: string[] };
|
|
472
525
|
private _disabled: { patterns: string[]; matches: string[] };
|
|
473
526
|
private _mimeExtensions: IRenderMime.IExtensionModule[];
|
|
474
527
|
private _availablePlugins: IPluginInfo[];
|
|
528
|
+
private _availablePluginsChanged = new Signal<IInfo, void>(this);
|
|
475
529
|
private _filesCached: boolean;
|
|
476
530
|
private _connectionStatus: IConnectionStatus;
|
|
477
531
|
}
|
package/src/shell.ts
CHANGED
|
@@ -885,7 +885,7 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
885
885
|
* The alpha version of this method only supports activating the "main" area.
|
|
886
886
|
*
|
|
887
887
|
* @alpha
|
|
888
|
-
* @param area Name of area to activate
|
|
888
|
+
* @param area - Name of area to activate
|
|
889
889
|
*/
|
|
890
890
|
activateArea(area: ILabShell.Area = 'main'): void {
|
|
891
891
|
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
@@ -1007,9 +1007,9 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
1007
1007
|
/**
|
|
1008
1008
|
* Add a widget to the JupyterLab shell
|
|
1009
1009
|
*
|
|
1010
|
-
* @param widget Widget
|
|
1011
|
-
* @param area Area
|
|
1012
|
-
* @param options Options
|
|
1010
|
+
* @param widget - Widget
|
|
1011
|
+
* @param area - Area
|
|
1012
|
+
* @param options - Options
|
|
1013
1013
|
*/
|
|
1014
1014
|
add(
|
|
1015
1015
|
widget: Widget,
|
|
@@ -1088,9 +1088,9 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
1088
1088
|
* The new layout is stored in the shell user layout. Callers are
|
|
1089
1089
|
* responsible for persisting it when needed.
|
|
1090
1090
|
*
|
|
1091
|
-
* @param widget Widget to move
|
|
1092
|
-
* @param area New area
|
|
1093
|
-
* @param mode Mode to change
|
|
1091
|
+
* @param widget - Widget to move
|
|
1092
|
+
* @param area - New area
|
|
1093
|
+
* @param mode - Mode to change
|
|
1094
1094
|
* @returns The new user layout
|
|
1095
1095
|
*/
|
|
1096
1096
|
move(
|
|
@@ -1215,7 +1215,7 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
1215
1215
|
/**
|
|
1216
1216
|
* Whether an side tab bar is visible or not.
|
|
1217
1217
|
*
|
|
1218
|
-
* @param side Sidebar of interest
|
|
1218
|
+
* @param side - Sidebar of interest
|
|
1219
1219
|
* @returns Side tab bar visibility
|
|
1220
1220
|
*/
|
|
1221
1221
|
isSideTabBarVisible(side: 'left' | 'right'): boolean {
|
|
@@ -1323,7 +1323,9 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
1323
1323
|
// Rehydrate the down area
|
|
1324
1324
|
if (downArea) {
|
|
1325
1325
|
const { currentWidget, widgets, size } = downArea;
|
|
1326
|
-
const collapsed =
|
|
1326
|
+
const collapsed =
|
|
1327
|
+
downArea.collapsed ??
|
|
1328
|
+
(size === undefined || size === null || size === 0);
|
|
1327
1329
|
|
|
1328
1330
|
const widgetIds = widgets?.map(widget => widget.id) ?? [];
|
|
1329
1331
|
const otherAreaWidgetIds = new Set<string>();
|
|
@@ -1390,12 +1392,18 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
1390
1392
|
}
|
|
1391
1393
|
}
|
|
1392
1394
|
|
|
1393
|
-
if (
|
|
1395
|
+
if (
|
|
1396
|
+
!collapsed &&
|
|
1397
|
+
(widgets?.length ?? 0) > 0 &&
|
|
1398
|
+
size !== undefined &&
|
|
1399
|
+
size !== null &&
|
|
1400
|
+
size > 0.0
|
|
1401
|
+
) {
|
|
1394
1402
|
this._showDownPanel(size);
|
|
1395
1403
|
this._downPanel.currentWidget?.activate();
|
|
1396
1404
|
} else {
|
|
1397
1405
|
this._hideDownPanel();
|
|
1398
|
-
if (size && size > 0.0) {
|
|
1406
|
+
if (size !== undefined && size !== null && size > 0.0) {
|
|
1399
1407
|
// Remember the saved size so a later expand restores the user's
|
|
1400
1408
|
// previous height. `_hideDownPanel` seeds `_lastDownAreaSize`
|
|
1401
1409
|
// from the current splitter, which at cold startup reflects the
|
|
@@ -1493,7 +1501,7 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
1493
1501
|
/**
|
|
1494
1502
|
* Toggle side tab bar visibility
|
|
1495
1503
|
*
|
|
1496
|
-
* @param side Sidebar of interest
|
|
1504
|
+
* @param side - Sidebar of interest
|
|
1497
1505
|
*/
|
|
1498
1506
|
toggleSideTabBarVisibility(side: 'right' | 'left'): void {
|
|
1499
1507
|
if (side === 'right') {
|
|
@@ -1514,7 +1522,7 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
1514
1522
|
/**
|
|
1515
1523
|
* Update the shell configuration.
|
|
1516
1524
|
*
|
|
1517
|
-
* @param config Shell configuration
|
|
1525
|
+
* @param config - Shell configuration
|
|
1518
1526
|
*/
|
|
1519
1527
|
updateConfig(config: Partial<ILabShell.IConfig>): void {
|
|
1520
1528
|
if (config.hiddenMode) {
|
|
@@ -1558,8 +1566,8 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
1558
1566
|
/**
|
|
1559
1567
|
* Move the activity bar of a side area to a new position.
|
|
1560
1568
|
*
|
|
1561
|
-
* @param side The side area to update.
|
|
1562
|
-
* @param position The new position of the activity bar.
|
|
1569
|
+
* @param side - The side area to update.
|
|
1570
|
+
* @param position - The new position of the activity bar.
|
|
1563
1571
|
*/
|
|
1564
1572
|
private _setActivityBarPosition(
|
|
1565
1573
|
side: 'left' | 'right',
|
|
@@ -2427,7 +2435,10 @@ namespace Private {
|
|
|
2427
2435
|
* Dehydrate the side bar data.
|
|
2428
2436
|
*/
|
|
2429
2437
|
dehydrate(): ILabShell.ISideArea {
|
|
2430
|
-
const collapsed =
|
|
2438
|
+
const collapsed =
|
|
2439
|
+
this._position === 'side'
|
|
2440
|
+
? this._sideBar.currentTitle === null
|
|
2441
|
+
: this._isCollapsedByUser;
|
|
2431
2442
|
const widgets = Array.from(this._stackedPanel.widgets);
|
|
2432
2443
|
const currentWidget = widgets[this._sideBar.currentIndex];
|
|
2433
2444
|
const widgetStates: {
|
|
@@ -2440,7 +2451,7 @@ namespace Private {
|
|
|
2440
2451
|
if (w.id && w.content instanceof SplitPanel) {
|
|
2441
2452
|
widgetStates[w.id] = {
|
|
2442
2453
|
sizes: w.content.relativeSizes() as number[],
|
|
2443
|
-
expansionStates: w.content.widgets.map(wi => wi.
|
|
2454
|
+
expansionStates: w.content.widgets.map(wi => !wi.isHidden)
|
|
2444
2455
|
};
|
|
2445
2456
|
}
|
|
2446
2457
|
});
|
package/src/utils.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Jupyter Development Team.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
5
|
|
|
7
6
|
import { SemanticCommand } from '@jupyterlab/apputils';
|
|
8
7
|
import type { TranslationBundle } from '@jupyterlab/translation';
|
|
@@ -199,7 +198,7 @@ export function createSemanticCommand(
|
|
|
199
198
|
commandId => commandId !== null && commands.isEnabled(commandId)
|
|
200
199
|
);
|
|
201
200
|
|
|
202
|
-
let result:
|
|
201
|
+
let result: unknown = null;
|
|
203
202
|
if (toExecute.length > 0) {
|
|
204
203
|
for (const commandId of toExecute) {
|
|
205
204
|
const args = { [SemanticCommand.WIDGET]: widget!.id };
|
|
@@ -219,7 +218,7 @@ export function createSemanticCommand(
|
|
|
219
218
|
|
|
220
219
|
function reduceAttribute(
|
|
221
220
|
attribute: keyof CommandRegistry.ICommandOptions
|
|
222
|
-
):
|
|
221
|
+
): unknown[] {
|
|
223
222
|
const widget = shell.currentWidget;
|
|
224
223
|
const commandIds = commandList.map(cmd =>
|
|
225
224
|
widget !== null ? cmd.getActiveCommandId(widget) : null
|
package/style/buttons.css
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
button.jp-mod-styled.jp-mod-accept {
|
|
39
39
|
background: var(--jp-accept-color-normal, var(--md-blue-500, #2196f3));
|
|
40
40
|
border: 0;
|
|
41
|
-
color: white;
|
|
41
|
+
color: var(--jp-accept-color-foreground, white);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
button.jp-mod-styled.jp-mod-accept:hover {
|
|
@@ -51,14 +51,14 @@ button.jp-mod-styled.jp-mod-accept:active {
|
|
|
51
51
|
|
|
52
52
|
button.jp-mod-styled.jp-mod-accept:focus-visible {
|
|
53
53
|
outline-width: var(--jp-focus-outline-width);
|
|
54
|
-
outline-color: var(--jp-accept-color
|
|
54
|
+
outline-color: var(--jp-accept-outline-color, var(--jp-focus-outline-color));
|
|
55
55
|
outline-style: solid;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
button.jp-mod-styled.jp-mod-reject {
|
|
59
59
|
background: var(--jp-reject-color-normal, var(--md-grey-500, #9e9e9e));
|
|
60
60
|
border: 0;
|
|
61
|
-
color: white;
|
|
61
|
+
color: var(--jp-reject-color-foreground, white);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
button.jp-mod-styled.jp-mod-reject:hover {
|
|
@@ -71,14 +71,14 @@ button.jp-mod-styled.jp-mod-reject:active {
|
|
|
71
71
|
|
|
72
72
|
button.jp-mod-styled.jp-mod-reject:focus-visible {
|
|
73
73
|
outline-width: var(--jp-focus-outline-width);
|
|
74
|
-
outline-color: var(--jp-reject-color
|
|
74
|
+
outline-color: var(--jp-reject-outline-color, var(--md-grey-700, #616161));
|
|
75
75
|
outline-style: solid;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
button.jp-mod-styled.jp-mod-warn {
|
|
79
79
|
background: var(--jp-warn-color-normal, var(--jp-error-color1));
|
|
80
80
|
border: 0;
|
|
81
|
-
color: white;
|
|
81
|
+
color: var(--jp-warn-color-foreground, white);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
button.jp-mod-styled.jp-mod-warn:hover {
|
|
@@ -91,7 +91,7 @@ button.jp-mod-styled.jp-mod-warn:active {
|
|
|
91
91
|
|
|
92
92
|
button.jp-mod-styled.jp-mod-warn:focus-visible {
|
|
93
93
|
outline-width: var(--jp-focus-outline-width);
|
|
94
|
-
outline-color: var(--jp-warn-color
|
|
94
|
+
outline-color: var(--jp-warn-outline-color, var(--md-red-700, #d32f2f));
|
|
95
95
|
outline-style: solid;
|
|
96
96
|
}
|
|
97
97
|
|