@jupyter-notebook/lab-extension 7.0.0-alpha.8 → 7.0.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/index.js +20 -20
- package/package.json +13 -12
package/lib/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { ILabShell } from '@jupyterlab/application';
|
|
3
|
+
import { ILabShell, } from '@jupyterlab/application';
|
|
4
4
|
import { ICommandPalette, IToolbarWidgetRegistry } from '@jupyterlab/apputils';
|
|
5
5
|
import { PageConfig } from '@jupyterlab/coreutils';
|
|
6
6
|
import { INotebookTracker } from '@jupyterlab/notebook';
|
|
7
7
|
import { ITranslator } from '@jupyterlab/translation';
|
|
8
8
|
import { Menu, MenuBar } from '@lumino/widgets';
|
|
9
9
|
import { INotebookShell } from '@jupyter-notebook/application';
|
|
10
|
+
import { caretDownIcon } from '@jupyterlab/ui-components';
|
|
10
11
|
/**
|
|
11
12
|
* The command IDs used by the application plugin.
|
|
12
13
|
*/
|
|
@@ -28,28 +29,27 @@ var CommandIDs;
|
|
|
28
29
|
/**
|
|
29
30
|
* A plugin to add custom toolbar items to the notebook page
|
|
30
31
|
*/
|
|
31
|
-
const
|
|
32
|
+
const interfaceSwitcher = {
|
|
32
33
|
id: '@jupyter-notebook/lab-extension:interface-switcher',
|
|
33
34
|
autoStart: true,
|
|
34
|
-
requires: [ITranslator],
|
|
35
|
+
requires: [ITranslator, INotebookTracker],
|
|
35
36
|
optional: [
|
|
36
|
-
INotebookTracker,
|
|
37
37
|
ICommandPalette,
|
|
38
38
|
INotebookShell,
|
|
39
39
|
ILabShell,
|
|
40
|
-
IToolbarWidgetRegistry
|
|
40
|
+
IToolbarWidgetRegistry,
|
|
41
41
|
],
|
|
42
42
|
activate: (app, translator, notebookTracker, palette, notebookShell, labShell, toolbarRegistry) => {
|
|
43
|
-
if (!notebookTracker) {
|
|
44
|
-
// to prevent showing the toolbar button in non-notebook pages
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
43
|
const { commands, shell } = app;
|
|
48
44
|
const baseUrl = PageConfig.getBaseUrl();
|
|
49
45
|
const trans = translator.load('notebook');
|
|
50
|
-
const
|
|
46
|
+
const overflowOptions = {
|
|
47
|
+
overflowMenuOptions: { isVisible: false },
|
|
48
|
+
};
|
|
49
|
+
const menubar = new MenuBar(overflowOptions);
|
|
51
50
|
const switcher = new Menu({ commands });
|
|
52
51
|
switcher.title.label = trans.__('Interface');
|
|
52
|
+
switcher.title.icon = caretDownIcon;
|
|
53
53
|
menubar.addMenu(switcher);
|
|
54
54
|
const isEnabled = () => {
|
|
55
55
|
return (notebookTracker.currentWidget !== null &&
|
|
@@ -58,7 +58,7 @@ const launchButtons = {
|
|
|
58
58
|
const addInterface = (option) => {
|
|
59
59
|
const { command, commandLabel, urlPrefix } = option;
|
|
60
60
|
commands.addCommand(command, {
|
|
61
|
-
label: args => (args.noLabel ? '' : commandLabel),
|
|
61
|
+
label: (args) => (args.noLabel ? '' : commandLabel),
|
|
62
62
|
caption: commandLabel,
|
|
63
63
|
execute: () => {
|
|
64
64
|
const current = notebookTracker.currentWidget;
|
|
@@ -67,7 +67,7 @@ const launchButtons = {
|
|
|
67
67
|
}
|
|
68
68
|
window.open(`${urlPrefix}${current.context.path}`);
|
|
69
69
|
},
|
|
70
|
-
isEnabled
|
|
70
|
+
isEnabled,
|
|
71
71
|
});
|
|
72
72
|
if (palette) {
|
|
73
73
|
palette.addItem({ command, category: 'Other' });
|
|
@@ -79,7 +79,7 @@ const launchButtons = {
|
|
|
79
79
|
command: CommandIDs.openNotebook,
|
|
80
80
|
commandLabel: trans.__('Open With %1', 'Jupyter Notebook'),
|
|
81
81
|
buttonLabel: 'openNotebook',
|
|
82
|
-
urlPrefix: `${baseUrl}tree
|
|
82
|
+
urlPrefix: `${baseUrl}tree/`,
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
if (!labShell) {
|
|
@@ -87,18 +87,18 @@ const launchButtons = {
|
|
|
87
87
|
command: CommandIDs.openLab,
|
|
88
88
|
commandLabel: trans.__('Open With %1', 'JupyterLab'),
|
|
89
89
|
buttonLabel: 'openLab',
|
|
90
|
-
urlPrefix: `${baseUrl}doc/tree
|
|
90
|
+
urlPrefix: `${baseUrl}doc/tree/`,
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
if (toolbarRegistry) {
|
|
94
|
-
toolbarRegistry.addFactory('Notebook', 'interfaceSwitcher', panel => {
|
|
95
|
-
const menubar = new MenuBar();
|
|
94
|
+
toolbarRegistry.addFactory('Notebook', 'interfaceSwitcher', (panel) => {
|
|
95
|
+
const menubar = new MenuBar(overflowOptions);
|
|
96
96
|
menubar.addMenu(switcher);
|
|
97
97
|
menubar.addClass('jp-InterfaceSwitcher');
|
|
98
98
|
return menubar;
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
}
|
|
101
|
+
},
|
|
102
102
|
};
|
|
103
103
|
/**
|
|
104
104
|
* A plugin to add a command to open the Jupyter Notebook Tree.
|
|
@@ -116,18 +116,18 @@ const launchNotebookTree = {
|
|
|
116
116
|
label: trans.__('Launch Jupyter Notebook File Browser'),
|
|
117
117
|
execute: () => {
|
|
118
118
|
window.open(PageConfig.getBaseUrl() + 'tree');
|
|
119
|
-
}
|
|
119
|
+
},
|
|
120
120
|
});
|
|
121
121
|
if (palette) {
|
|
122
122
|
palette.addItem({ command: CommandIDs.launchNotebookTree, category });
|
|
123
123
|
}
|
|
124
|
-
}
|
|
124
|
+
},
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
127
|
* Export the plugins as default.
|
|
128
128
|
*/
|
|
129
129
|
const plugins = [
|
|
130
130
|
launchNotebookTree,
|
|
131
|
-
|
|
131
|
+
interfaceSwitcher,
|
|
132
132
|
];
|
|
133
133
|
export default plugins;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/lab-extension",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.0",
|
|
4
4
|
"description": "Jupyter Notebook - Lab Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -43,20 +43,21 @@
|
|
|
43
43
|
"watch:src": "tsc -w"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@jupyter-notebook/application": "^7.0.0-
|
|
47
|
-
"@jupyterlab/application": "^4.0.0-
|
|
48
|
-
"@jupyterlab/apputils": "^4.0.0-
|
|
49
|
-
"@jupyterlab/coreutils": "^6.0.0-
|
|
50
|
-
"@jupyterlab/docregistry": "^4.0.0-
|
|
51
|
-
"@jupyterlab/notebook": "^4.0.0-
|
|
52
|
-
"@jupyterlab/translation": "^4.0.0-
|
|
53
|
-
"@
|
|
54
|
-
"@lumino/
|
|
46
|
+
"@jupyter-notebook/application": "^7.0.0-beta.0",
|
|
47
|
+
"@jupyterlab/application": "^4.0.0-beta.0",
|
|
48
|
+
"@jupyterlab/apputils": "^4.0.0-beta.0",
|
|
49
|
+
"@jupyterlab/coreutils": "^6.0.0-beta.0",
|
|
50
|
+
"@jupyterlab/docregistry": "^4.0.0-beta.0",
|
|
51
|
+
"@jupyterlab/notebook": "^4.0.0-beta.0",
|
|
52
|
+
"@jupyterlab/translation": "^4.0.0-beta.0",
|
|
53
|
+
"@jupyterlab/ui-components": "^4.0.0-beta.0",
|
|
54
|
+
"@lumino/commands": "^2.0.1",
|
|
55
|
+
"@lumino/disposable": "^2.0.0"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@jupyterlab/builder": "^4.0.0-
|
|
58
|
+
"@jupyterlab/builder": "^4.0.0-beta.0",
|
|
58
59
|
"rimraf": "^3.0.2",
|
|
59
|
-
"typescript": "~
|
|
60
|
+
"typescript": "~5.0.2"
|
|
60
61
|
},
|
|
61
62
|
"publishConfig": {
|
|
62
63
|
"access": "public"
|