@jupyter-notebook/application-extension 7.0.0-alpha.16 → 7.0.0-alpha.17
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/index.js +47 -57
- package/package.json +17 -17
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { ILabStatus, IRouter, ITreePathUpdater, JupyterFrontEnd } from '@jupyterlab/application';
|
|
4
|
-
import {
|
|
3
|
+
import { ILabStatus, IRouter, ITreePathUpdater, JupyterFrontEnd, } from '@jupyterlab/application';
|
|
4
|
+
import { DOMUtils, ICommandPalette, IToolbarWidgetRegistry, } from '@jupyterlab/apputils';
|
|
5
5
|
import { ConsolePanel } from '@jupyterlab/console';
|
|
6
6
|
import { PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils';
|
|
7
7
|
import { IDocumentManager, renameDialog } from '@jupyterlab/docmanager';
|
|
@@ -9,10 +9,10 @@ import { DocumentWidget } from '@jupyterlab/docregistry';
|
|
|
9
9
|
import { IMainMenu } from '@jupyterlab/mainmenu';
|
|
10
10
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
11
11
|
import { ITranslator } from '@jupyterlab/translation';
|
|
12
|
-
import { NotebookApp, NotebookShell, INotebookShell, SidePanelPalette } from '@jupyter-notebook/application';
|
|
12
|
+
import { NotebookApp, NotebookShell, INotebookShell, SidePanelPalette, } from '@jupyter-notebook/application';
|
|
13
13
|
import { jupyterIcon } from '@jupyter-notebook/ui-components';
|
|
14
14
|
import { PromiseDelegate } from '@lumino/coreutils';
|
|
15
|
-
import { DisposableDelegate, DisposableSet } from '@lumino/disposable';
|
|
15
|
+
import { DisposableDelegate, DisposableSet, } from '@lumino/disposable';
|
|
16
16
|
import { Menu, Widget } from '@lumino/widgets';
|
|
17
17
|
/**
|
|
18
18
|
* A regular expression to match path to notebooks and documents
|
|
@@ -69,12 +69,12 @@ const dirty = {
|
|
|
69
69
|
}
|
|
70
70
|
const trans = translator.load('notebook');
|
|
71
71
|
const message = trans.__('Are you sure you want to exit Jupyter Notebook?\n\nAny unsaved changes will be lost.');
|
|
72
|
-
window.addEventListener('beforeunload', event => {
|
|
72
|
+
window.addEventListener('beforeunload', (event) => {
|
|
73
73
|
if (app.status.isDirty) {
|
|
74
74
|
return (event.returnValue = message);
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
}
|
|
77
|
+
},
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
80
80
|
* The logo plugin.
|
|
@@ -95,11 +95,11 @@ const logo = {
|
|
|
95
95
|
padding: '2px 2px 2px 8px',
|
|
96
96
|
height: '28px',
|
|
97
97
|
width: 'auto',
|
|
98
|
-
cursor: 'pointer'
|
|
98
|
+
cursor: 'pointer',
|
|
99
99
|
});
|
|
100
100
|
logo.id = 'jp-NotebookLogo';
|
|
101
101
|
app.shell.add(logo, 'top', { rank: 0 });
|
|
102
|
-
}
|
|
102
|
+
},
|
|
103
103
|
};
|
|
104
104
|
/**
|
|
105
105
|
* A plugin to open documents in the main area.
|
|
@@ -125,13 +125,13 @@ const opener = {
|
|
|
125
125
|
const factory = (_b = urlParams.get('factory')) !== null && _b !== void 0 ? _b : 'default';
|
|
126
126
|
app.started.then(async () => {
|
|
127
127
|
docManager.open(file, factory, undefined, {
|
|
128
|
-
ref: '_noref'
|
|
128
|
+
ref: '_noref',
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
|
-
}
|
|
131
|
+
},
|
|
132
132
|
});
|
|
133
133
|
router.register({ command, pattern: TREE_PATTERN });
|
|
134
|
-
}
|
|
134
|
+
},
|
|
135
135
|
};
|
|
136
136
|
/**
|
|
137
137
|
* A plugin to customize menus
|
|
@@ -159,7 +159,7 @@ const menus = {
|
|
|
159
159
|
default:
|
|
160
160
|
break;
|
|
161
161
|
}
|
|
162
|
-
}
|
|
162
|
+
},
|
|
163
163
|
};
|
|
164
164
|
/**
|
|
165
165
|
* A plugin to provide a spacer at rank 900 in the menu area
|
|
@@ -172,7 +172,7 @@ const menuSpacer = {
|
|
|
172
172
|
menu.id = DOMUtils.createDomID();
|
|
173
173
|
menu.addClass('jp-NotebookSpacer');
|
|
174
174
|
app.shell.add(menu, 'menu', { rank: 900 });
|
|
175
|
-
}
|
|
175
|
+
},
|
|
176
176
|
};
|
|
177
177
|
/**
|
|
178
178
|
* Add commands to open the tree and running pages.
|
|
@@ -189,7 +189,7 @@ const pages = {
|
|
|
189
189
|
label: trans.__('Open JupyterLab'),
|
|
190
190
|
execute: () => {
|
|
191
191
|
window.open(`${baseUrl}lab`);
|
|
192
|
-
}
|
|
192
|
+
},
|
|
193
193
|
});
|
|
194
194
|
const page = PageConfig.getOption('notebookPage');
|
|
195
195
|
app.commands.addCommand(CommandIDs.openTree, {
|
|
@@ -201,13 +201,13 @@ const pages = {
|
|
|
201
201
|
else {
|
|
202
202
|
window.open(`${baseUrl}tree`);
|
|
203
203
|
}
|
|
204
|
-
}
|
|
204
|
+
},
|
|
205
205
|
});
|
|
206
206
|
if (palette) {
|
|
207
207
|
palette.addItem({ command: CommandIDs.openLab, category: 'View' });
|
|
208
208
|
palette.addItem({ command: CommandIDs.openTree, category: 'View' });
|
|
209
209
|
}
|
|
210
|
-
}
|
|
210
|
+
},
|
|
211
211
|
};
|
|
212
212
|
/**
|
|
213
213
|
* The default paths for a Jupyter Notebook app.
|
|
@@ -221,16 +221,7 @@ const paths = {
|
|
|
221
221
|
throw new Error(`${paths.id} must be activated in Jupyter Notebook.`);
|
|
222
222
|
}
|
|
223
223
|
return app.paths;
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* The default session dialogs plugin
|
|
228
|
-
*/
|
|
229
|
-
const sessionDialogs = {
|
|
230
|
-
id: '@jupyter-notebook/application-extension:session-dialogs',
|
|
231
|
-
provides: ISessionContextDialogs,
|
|
232
|
-
autoStart: true,
|
|
233
|
-
activate: () => sessionContextDialogs
|
|
224
|
+
},
|
|
234
225
|
};
|
|
235
226
|
/**
|
|
236
227
|
* The default Jupyter Notebook application shell.
|
|
@@ -244,7 +235,7 @@ const shell = {
|
|
|
244
235
|
return app.shell;
|
|
245
236
|
},
|
|
246
237
|
autoStart: true,
|
|
247
|
-
provides: INotebookShell
|
|
238
|
+
provides: INotebookShell,
|
|
248
239
|
};
|
|
249
240
|
/**
|
|
250
241
|
* The default JupyterLab application status provider.
|
|
@@ -258,7 +249,7 @@ const status = {
|
|
|
258
249
|
throw new Error(`${status.id} must be activated in Jupyter Notebook.`);
|
|
259
250
|
}
|
|
260
251
|
return app.status;
|
|
261
|
-
}
|
|
252
|
+
},
|
|
262
253
|
};
|
|
263
254
|
/**
|
|
264
255
|
* A plugin to display the document title in the browser tab title
|
|
@@ -292,7 +283,7 @@ const tabTitle = {
|
|
|
292
283
|
};
|
|
293
284
|
shell.currentChanged.connect(setTabTitle);
|
|
294
285
|
setTabTitle();
|
|
295
|
-
}
|
|
286
|
+
},
|
|
296
287
|
};
|
|
297
288
|
/**
|
|
298
289
|
* A plugin to display and rename the title of a file
|
|
@@ -307,7 +298,7 @@ const title = {
|
|
|
307
298
|
const trans = translator.load('notebook');
|
|
308
299
|
const node = document.createElement('div');
|
|
309
300
|
if (toolbarRegistry) {
|
|
310
|
-
toolbarRegistry.addFactory('TopBar', 'widgetTitle', toolbar => {
|
|
301
|
+
toolbarRegistry.addFactory('TopBar', 'widgetTitle', (toolbar) => {
|
|
311
302
|
const widget = new Widget({ node });
|
|
312
303
|
widget.id = 'jp-title';
|
|
313
304
|
return widget;
|
|
@@ -361,9 +352,9 @@ const title = {
|
|
|
361
352
|
}
|
|
362
353
|
const encoded = encodeURIComponent(newPath);
|
|
363
354
|
router.navigate(`/${route}/${encoded}`, {
|
|
364
|
-
skipRouting: true
|
|
355
|
+
skipRouting: true,
|
|
365
356
|
});
|
|
366
|
-
}
|
|
357
|
+
},
|
|
367
358
|
});
|
|
368
359
|
node.onclick = async () => {
|
|
369
360
|
void commands.execute(CommandIDs.rename);
|
|
@@ -371,7 +362,7 @@ const title = {
|
|
|
371
362
|
};
|
|
372
363
|
shell.currentChanged.connect(addTitle);
|
|
373
364
|
void addTitle();
|
|
374
|
-
}
|
|
365
|
+
},
|
|
375
366
|
};
|
|
376
367
|
/**
|
|
377
368
|
* Plugin to toggle the top header visibility.
|
|
@@ -392,7 +383,7 @@ const topVisibility = {
|
|
|
392
383
|
void settingRegistry.set(pluginId, 'visible', top.isVisible);
|
|
393
384
|
}
|
|
394
385
|
},
|
|
395
|
-
isToggled: () => top.isVisible
|
|
386
|
+
isToggled: () => top.isVisible,
|
|
396
387
|
});
|
|
397
388
|
let settingsOverride = false;
|
|
398
389
|
if (settingRegistry) {
|
|
@@ -407,7 +398,7 @@ const topVisibility = {
|
|
|
407
398
|
Promise.all([loadSettings, app.restored])
|
|
408
399
|
.then(([settings]) => {
|
|
409
400
|
updateSettings(settings);
|
|
410
|
-
settings.changed.connect(settings => {
|
|
401
|
+
settings.changed.connect((settings) => {
|
|
411
402
|
updateSettings(settings);
|
|
412
403
|
});
|
|
413
404
|
})
|
|
@@ -432,7 +423,7 @@ const topVisibility = {
|
|
|
432
423
|
// listen on format change (mobile and desktop) to make the view more compact
|
|
433
424
|
app.formatChanged.connect(onChanged);
|
|
434
425
|
},
|
|
435
|
-
autoStart: true
|
|
426
|
+
autoStart: true,
|
|
436
427
|
};
|
|
437
428
|
/**
|
|
438
429
|
* Plugin to toggle the left or right side panel's visibility.
|
|
@@ -450,8 +441,8 @@ const sidePanelVisibility = {
|
|
|
450
441
|
* id, widget ID to activate in the side panel
|
|
451
442
|
*/
|
|
452
443
|
app.commands.addCommand(CommandIDs.togglePanel, {
|
|
453
|
-
label: args => args['title'],
|
|
454
|
-
caption: args => {
|
|
444
|
+
label: (args) => args['title'],
|
|
445
|
+
caption: (args) => {
|
|
455
446
|
// We do not substitute the parameter into the string because the parameter is not
|
|
456
447
|
// localized (e.g., it is always 'left') even though the string is localized.
|
|
457
448
|
if (args['side'] === 'left') {
|
|
@@ -462,7 +453,7 @@ const sidePanelVisibility = {
|
|
|
462
453
|
}
|
|
463
454
|
return trans.__('Show %1 in the sidebar', args['title']);
|
|
464
455
|
},
|
|
465
|
-
execute: args => {
|
|
456
|
+
execute: (args) => {
|
|
466
457
|
var _a, _b;
|
|
467
458
|
switch (args['side']) {
|
|
468
459
|
case 'left':
|
|
@@ -495,7 +486,7 @@ const sidePanelVisibility = {
|
|
|
495
486
|
break;
|
|
496
487
|
}
|
|
497
488
|
},
|
|
498
|
-
isToggled: args => {
|
|
489
|
+
isToggled: (args) => {
|
|
499
490
|
switch (args['side']) {
|
|
500
491
|
case 'left': {
|
|
501
492
|
if (notebookShell.leftCollapsed) {
|
|
@@ -519,11 +510,11 @@ const sidePanelVisibility = {
|
|
|
519
510
|
}
|
|
520
511
|
}
|
|
521
512
|
return false;
|
|
522
|
-
}
|
|
513
|
+
},
|
|
523
514
|
});
|
|
524
515
|
const sidePanelMenu = {
|
|
525
516
|
left: null,
|
|
526
|
-
right: null
|
|
517
|
+
right: null,
|
|
527
518
|
};
|
|
528
519
|
/**
|
|
529
520
|
* The function which adds entries to the View menu for each widget of a side panel.
|
|
@@ -550,8 +541,8 @@ const sidePanelVisibility = {
|
|
|
550
541
|
args: {
|
|
551
542
|
side: area,
|
|
552
543
|
title: `Show ${widget.title.caption}`,
|
|
553
|
-
id: widget.id
|
|
554
|
-
}
|
|
544
|
+
id: widget.id,
|
|
545
|
+
},
|
|
555
546
|
});
|
|
556
547
|
menuToAdd = true;
|
|
557
548
|
}
|
|
@@ -559,7 +550,7 @@ const sidePanelVisibility = {
|
|
|
559
550
|
if (menuToAdd) {
|
|
560
551
|
sidePanelMenu[area] = menu.viewMenu.addItem({
|
|
561
552
|
type: 'submenu',
|
|
562
|
-
submenu: newMenu
|
|
553
|
+
submenu: newMenu,
|
|
563
554
|
});
|
|
564
555
|
}
|
|
565
556
|
};
|
|
@@ -593,12 +584,12 @@ const sidePanelVisibility = {
|
|
|
593
584
|
if (palette) {
|
|
594
585
|
const sidePanelPalette = new SidePanelPalette({
|
|
595
586
|
commandPalette: palette,
|
|
596
|
-
command: CommandIDs.togglePanel
|
|
587
|
+
command: CommandIDs.togglePanel,
|
|
597
588
|
});
|
|
598
|
-
notebookShell.leftHandler.widgets.forEach(widget => {
|
|
589
|
+
notebookShell.leftHandler.widgets.forEach((widget) => {
|
|
599
590
|
sidePanelPalette.addItem(widget, notebookShell.leftHandler.area);
|
|
600
591
|
});
|
|
601
|
-
notebookShell.rightHandler.widgets.forEach(widget => {
|
|
592
|
+
notebookShell.rightHandler.widgets.forEach((widget) => {
|
|
602
593
|
sidePanelPalette.addItem(widget, notebookShell.rightHandler.area);
|
|
603
594
|
});
|
|
604
595
|
// Update menu and palette when widgets are added or removed from side panels.
|
|
@@ -616,7 +607,7 @@ const sidePanelVisibility = {
|
|
|
616
607
|
});
|
|
617
608
|
}
|
|
618
609
|
});
|
|
619
|
-
}
|
|
610
|
+
},
|
|
620
611
|
};
|
|
621
612
|
/**
|
|
622
613
|
* The default tree route resolver plugin.
|
|
@@ -644,7 +635,7 @@ const tree = {
|
|
|
644
635
|
// Clean up artifacts immediately upon routing.
|
|
645
636
|
set.dispose();
|
|
646
637
|
delegate.resolve({ browser, file: PageConfig.getOption('treePath') });
|
|
647
|
-
})
|
|
638
|
+
}),
|
|
648
639
|
}));
|
|
649
640
|
set.add(router.register({ command: CommandIDs.resolveTree, pattern: treePattern }));
|
|
650
641
|
// If a route is handled by the router without the tree command being
|
|
@@ -661,7 +652,7 @@ const tree = {
|
|
|
661
652
|
router.routed.disconnect(listener);
|
|
662
653
|
}));
|
|
663
654
|
return { paths: delegate.promise };
|
|
664
|
-
}
|
|
655
|
+
},
|
|
665
656
|
};
|
|
666
657
|
const treePathUpdater = {
|
|
667
658
|
id: '@jupyter-notebook/application-extension:tree-updater',
|
|
@@ -678,7 +669,7 @@ const treePathUpdater = {
|
|
|
678
669
|
}
|
|
679
670
|
return updateTreePath;
|
|
680
671
|
},
|
|
681
|
-
autoStart: true
|
|
672
|
+
autoStart: true,
|
|
682
673
|
};
|
|
683
674
|
const translator = {
|
|
684
675
|
id: '@jupyter-notebook/application-extension:translator',
|
|
@@ -686,7 +677,7 @@ const translator = {
|
|
|
686
677
|
autoStart: true,
|
|
687
678
|
activate: (app, notebookShell, translator) => {
|
|
688
679
|
notebookShell.translator = translator;
|
|
689
|
-
}
|
|
680
|
+
},
|
|
690
681
|
};
|
|
691
682
|
/**
|
|
692
683
|
* Zen mode plugin
|
|
@@ -722,7 +713,7 @@ const zen = {
|
|
|
722
713
|
document.exitFullscreen();
|
|
723
714
|
toggleOff();
|
|
724
715
|
}
|
|
725
|
-
}
|
|
716
|
+
},
|
|
726
717
|
});
|
|
727
718
|
document.addEventListener('fullscreenchange', () => {
|
|
728
719
|
if (!document.fullscreenElement) {
|
|
@@ -732,7 +723,7 @@ const zen = {
|
|
|
732
723
|
if (palette) {
|
|
733
724
|
palette.addItem({ command: CommandIDs.toggleZen, category: 'Mode' });
|
|
734
725
|
}
|
|
735
|
-
}
|
|
726
|
+
},
|
|
736
727
|
};
|
|
737
728
|
/**
|
|
738
729
|
* Export the plugins as default.
|
|
@@ -745,7 +736,6 @@ const plugins = [
|
|
|
745
736
|
opener,
|
|
746
737
|
pages,
|
|
747
738
|
paths,
|
|
748
|
-
sessionDialogs,
|
|
749
739
|
shell,
|
|
750
740
|
sidePanelVisibility,
|
|
751
741
|
status,
|
|
@@ -755,6 +745,6 @@ const plugins = [
|
|
|
755
745
|
tree,
|
|
756
746
|
treePathUpdater,
|
|
757
747
|
translator,
|
|
758
|
-
zen
|
|
748
|
+
zen,
|
|
759
749
|
];
|
|
760
750
|
export default plugins;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/application-extension",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.17",
|
|
4
4
|
"description": "Jupyter Notebook - Application Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -38,26 +38,26 @@
|
|
|
38
38
|
"watch": "tsc -b --watch"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@jupyter-notebook/application": "^7.0.0-alpha.
|
|
42
|
-
"@jupyter-notebook/ui-components": "^7.0.0-alpha.
|
|
43
|
-
"@jupyterlab/application": "^4.0.0-alpha.
|
|
44
|
-
"@jupyterlab/apputils": "^4.0.0-alpha.
|
|
41
|
+
"@jupyter-notebook/application": "^7.0.0-alpha.17",
|
|
42
|
+
"@jupyter-notebook/ui-components": "^7.0.0-alpha.17",
|
|
43
|
+
"@jupyterlab/application": "^4.0.0-alpha.22",
|
|
44
|
+
"@jupyterlab/apputils": "^4.0.0-alpha.22",
|
|
45
45
|
"@jupyterlab/celltags": "^4.0.0-alpha.20",
|
|
46
|
-
"@jupyterlab/codeeditor": "^4.0.0-alpha.
|
|
47
|
-
"@jupyterlab/console": "^4.0.0-alpha.
|
|
48
|
-
"@jupyterlab/coreutils": "^6.0.0-alpha.
|
|
49
|
-
"@jupyterlab/docmanager": "^4.0.0-alpha.
|
|
50
|
-
"@jupyterlab/docregistry": "^4.0.0-alpha.
|
|
51
|
-
"@jupyterlab/mainmenu": "^4.0.0-alpha.
|
|
52
|
-
"@jupyterlab/settingregistry": "^4.0.0-alpha.
|
|
53
|
-
"@jupyterlab/translation": "^4.0.0-alpha.
|
|
54
|
-
"@lumino/coreutils": "^2.0.0
|
|
55
|
-
"@lumino/disposable": "^2.0.0
|
|
56
|
-
"@lumino/widgets": "^2.0.0
|
|
46
|
+
"@jupyterlab/codeeditor": "^4.0.0-alpha.22",
|
|
47
|
+
"@jupyterlab/console": "^4.0.0-alpha.22",
|
|
48
|
+
"@jupyterlab/coreutils": "^6.0.0-alpha.22",
|
|
49
|
+
"@jupyterlab/docmanager": "^4.0.0-alpha.22",
|
|
50
|
+
"@jupyterlab/docregistry": "^4.0.0-alpha.22",
|
|
51
|
+
"@jupyterlab/mainmenu": "^4.0.0-alpha.22",
|
|
52
|
+
"@jupyterlab/settingregistry": "^4.0.0-alpha.22",
|
|
53
|
+
"@jupyterlab/translation": "^4.0.0-alpha.22",
|
|
54
|
+
"@lumino/coreutils": "^2.0.0",
|
|
55
|
+
"@lumino/disposable": "^2.0.0",
|
|
56
|
+
"@lumino/widgets": "^2.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"rimraf": "^3.0.2",
|
|
60
|
-
"typescript": "5.0.
|
|
60
|
+
"typescript": "~5.0.2"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|