@jupyter-notebook/help-extension 7.0.0-alpha.1 → 7.0.0-alpha.11
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.d.ts +2 -5
- package/lib/index.js +79 -43
- package/package.json +10 -9
- package/schema/open.json +28 -0
- package/style/base.css +17 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { showDialog, Dialog } from '@jupyterlab/apputils';
|
|
3
|
+
import { showDialog, Dialog, ICommandPalette } from '@jupyterlab/apputils';
|
|
4
4
|
import { IMainMenu } from '@jupyterlab/mainmenu';
|
|
5
5
|
import { ITranslator } from '@jupyterlab/translation';
|
|
6
6
|
import { jupyterIcon } from '@jupyter-notebook/ui-components';
|
|
@@ -28,16 +28,13 @@ var CommandIDs;
|
|
|
28
28
|
CommandIDs.about = 'help:about';
|
|
29
29
|
})(CommandIDs || (CommandIDs = {}));
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* A plugin to open the about section with resources.
|
|
32
32
|
*/
|
|
33
|
-
const
|
|
34
|
-
id: '@jupyter-notebook/help-extension:
|
|
33
|
+
const open = {
|
|
34
|
+
id: '@jupyter-notebook/help-extension:open',
|
|
35
35
|
autoStart: true,
|
|
36
|
-
|
|
37
|
-
optional: [IMainMenu],
|
|
38
|
-
activate: (app, translator, menu) => {
|
|
36
|
+
activate: (app) => {
|
|
39
37
|
const { commands } = app;
|
|
40
|
-
const trans = translator.load('notebook');
|
|
41
38
|
commands.addCommand(CommandIDs.open, {
|
|
42
39
|
label: args => args['text'],
|
|
43
40
|
execute: args => {
|
|
@@ -45,34 +42,20 @@ const plugin = {
|
|
|
45
42
|
window.open(url);
|
|
46
43
|
}
|
|
47
44
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
React.createElement("td", null,
|
|
63
|
-
React.createElement("pre", null, binding.keys.join(', ')))))))));
|
|
64
|
-
return showDialog({
|
|
65
|
-
title,
|
|
66
|
-
body,
|
|
67
|
-
buttons: [
|
|
68
|
-
Dialog.createButton({
|
|
69
|
-
label: trans.__('Dismiss'),
|
|
70
|
-
className: 'jp-AboutNotebook-about-button jp-mod-reject jp-mod-styled'
|
|
71
|
-
})
|
|
72
|
-
]
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Plugin to add a command to show an About Jupyter Notebook and Markdown Reference.
|
|
49
|
+
*/
|
|
50
|
+
const about = {
|
|
51
|
+
id: '@jupyter-notebook/help-extension:about',
|
|
52
|
+
autoStart: true,
|
|
53
|
+
requires: [ITranslator],
|
|
54
|
+
optional: [IMainMenu, ICommandPalette],
|
|
55
|
+
activate: (app, translator, menu, palette) => {
|
|
56
|
+
const { commands } = app;
|
|
57
|
+
const trans = translator.load('notebook');
|
|
58
|
+
const category = trans.__('Help');
|
|
76
59
|
commands.addCommand(CommandIDs.about, {
|
|
77
60
|
label: trans.__('About %1', app.name),
|
|
78
61
|
execute: () => {
|
|
@@ -80,13 +63,18 @@ const plugin = {
|
|
|
80
63
|
React.createElement("span", { className: "jp-AboutNotebook-header" },
|
|
81
64
|
React.createElement(jupyterIcon.react, { width: "196px", height: "auto" }))));
|
|
82
65
|
const notebookURL = 'https://github.com/jupyter/notebook';
|
|
83
|
-
const
|
|
66
|
+
const contributorURL = 'https://github.com/jupyter/notebook/pulse';
|
|
67
|
+
const aboutJupyter = trans.__('JUPYTER NOTEBOOK ON GITHUB');
|
|
68
|
+
const contributorList = trans.__('CONTRIBUTOR LIST');
|
|
84
69
|
const externalLinks = (React.createElement("span", null,
|
|
85
|
-
React.createElement("a", { href: notebookURL, target: "_blank", rel: "noopener noreferrer", className: "jp-Button-flat jp-AboutNotebook-about-externalLinks" },
|
|
70
|
+
React.createElement("a", { href: notebookURL, target: "_blank", rel: "noopener noreferrer", className: "jp-Button-flat jp-AboutNotebook-about-externalLinks" }, aboutJupyter),
|
|
71
|
+
React.createElement("a", { href: contributorURL, target: "_blank", rel: "noopener noreferrer", className: "jp-Button-flat jp-AboutNotebook-about-externalLinks" }, contributorList)));
|
|
86
72
|
const version = trans.__('Version: %1', app.version);
|
|
73
|
+
const copyright = trans.__('© 2021-2023 Jupyter Notebook Contributors');
|
|
87
74
|
const body = (React.createElement(React.Fragment, null,
|
|
88
|
-
React.createElement("span", { className: "jp-AboutNotebook-
|
|
89
|
-
React.createElement("div", null, externalLinks)
|
|
75
|
+
React.createElement("span", { className: "jp-AboutNotebook-version" }, version),
|
|
76
|
+
React.createElement("div", null, externalLinks),
|
|
77
|
+
React.createElement("span", { className: "jp-AboutNotebook-about-copyright" }, copyright)));
|
|
90
78
|
const dialog = new Dialog({
|
|
91
79
|
title,
|
|
92
80
|
body,
|
|
@@ -101,14 +89,62 @@ const plugin = {
|
|
|
101
89
|
void dialog.launch();
|
|
102
90
|
}
|
|
103
91
|
});
|
|
92
|
+
if (palette) {
|
|
93
|
+
palette.addItem({ command: CommandIDs.about, category });
|
|
94
|
+
}
|
|
104
95
|
const resourcesGroup = RESOURCES.map(args => ({
|
|
105
96
|
args,
|
|
106
97
|
command: CommandIDs.open
|
|
107
98
|
}));
|
|
108
99
|
if (menu) {
|
|
109
|
-
menu.helpMenu.addGroup(
|
|
110
|
-
|
|
100
|
+
menu.helpMenu.addGroup(resourcesGroup, 30);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* A plugin to add a command to display Keyboard Shortcuts.
|
|
106
|
+
*/
|
|
107
|
+
const shortcuts = {
|
|
108
|
+
id: '@jupyter-notebook/help-extension:shortcuts',
|
|
109
|
+
autoStart: true,
|
|
110
|
+
requires: [ITranslator],
|
|
111
|
+
optional: [ICommandPalette],
|
|
112
|
+
activate: (app, translator, palette) => {
|
|
113
|
+
const { commands } = app;
|
|
114
|
+
const trans = translator.load('notebook');
|
|
115
|
+
const category = trans.__('Help');
|
|
116
|
+
commands.addCommand(CommandIDs.shortcuts, {
|
|
117
|
+
label: trans.__('Keyboard Shortcuts'),
|
|
118
|
+
execute: () => {
|
|
119
|
+
const title = (React.createElement("span", { className: "jp-AboutNotebook-about-header" },
|
|
120
|
+
React.createElement("div", { className: "jp-AboutNotebook-about-header-info" }, trans.__('Keyboard Shortcuts'))));
|
|
121
|
+
const body = (React.createElement("table", { className: "jp-AboutNotebook-shortcuts" },
|
|
122
|
+
React.createElement("thead", null,
|
|
123
|
+
React.createElement("tr", null,
|
|
124
|
+
React.createElement("th", null, trans.__('Name')),
|
|
125
|
+
React.createElement("th", null, trans.__('Shortcut')))),
|
|
126
|
+
React.createElement("tbody", null, commands.keyBindings
|
|
127
|
+
.filter(binding => commands.isEnabled(binding.command))
|
|
128
|
+
.map((binding, i) => (React.createElement("tr", { key: i },
|
|
129
|
+
React.createElement("td", null, commands.label(binding.command)),
|
|
130
|
+
React.createElement("td", null,
|
|
131
|
+
React.createElement("pre", null, binding.keys.join(', ')))))))));
|
|
132
|
+
return showDialog({
|
|
133
|
+
title,
|
|
134
|
+
body,
|
|
135
|
+
buttons: [
|
|
136
|
+
Dialog.createButton({
|
|
137
|
+
label: trans.__('Dismiss'),
|
|
138
|
+
className: 'jp-AboutNotebook-about-button jp-mod-reject jp-mod-styled'
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
if (palette) {
|
|
145
|
+
palette.addItem({ command: CommandIDs.shortcuts, category });
|
|
111
146
|
}
|
|
112
147
|
}
|
|
113
148
|
};
|
|
114
|
-
|
|
149
|
+
const plugins = [open, shortcuts, about];
|
|
150
|
+
export default plugins;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/help-extension",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.11",
|
|
4
4
|
"description": "Jupyter Notebook - Help Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -39,21 +39,22 @@
|
|
|
39
39
|
"watch": "tsc -b --watch"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@jupyter-notebook/ui-components": "^7.0.0-alpha.
|
|
43
|
-
"@jupyterlab/application": "^4.0.0-alpha.
|
|
44
|
-
"@jupyterlab/apputils": "^4.0.0-alpha.
|
|
45
|
-
"@jupyterlab/mainmenu": "^4.0.0-alpha.
|
|
46
|
-
"@jupyterlab/translation": "^4.0.0-alpha.
|
|
42
|
+
"@jupyter-notebook/ui-components": "^7.0.0-alpha.11",
|
|
43
|
+
"@jupyterlab/application": "^4.0.0-alpha.17",
|
|
44
|
+
"@jupyterlab/apputils": "^4.0.0-alpha.17",
|
|
45
|
+
"@jupyterlab/mainmenu": "^4.0.0-alpha.17",
|
|
46
|
+
"@jupyterlab/translation": "^4.0.0-alpha.17"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"rimraf": "
|
|
50
|
-
"typescript": "~4.
|
|
49
|
+
"rimraf": "^3.0.2",
|
|
50
|
+
"typescript": "~4.9.3"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"jupyterlab": {
|
|
56
|
-
"extension": true
|
|
56
|
+
"extension": true,
|
|
57
|
+
"schemaDir": "schema"
|
|
57
58
|
},
|
|
58
59
|
"styleModule": "style/index.js"
|
|
59
60
|
}
|
package/schema/open.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Jupyter Notebook Help Menu Entries",
|
|
3
|
+
"description": "Jupyter Notebook Help Menu Entries",
|
|
4
|
+
"jupyter.lab.menus": {
|
|
5
|
+
"main": [
|
|
6
|
+
{
|
|
7
|
+
"id": "jp-mainmenu-help",
|
|
8
|
+
"items": [
|
|
9
|
+
{
|
|
10
|
+
"command": "help:about",
|
|
11
|
+
"rank": 0
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"type": "separator",
|
|
15
|
+
"rank": 1
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"command": "help:shortcuts",
|
|
19
|
+
"rank": 20
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"properties": {},
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"type": "object"
|
|
28
|
+
}
|
package/style/base.css
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.jp-AboutNotebook .jp-Dialog-header {
|
|
2
2
|
justify-content: center;
|
|
3
|
+
padding: 0;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
6
|
.jp-AboutNotebook-header {
|
|
@@ -13,12 +14,23 @@
|
|
|
13
14
|
margin-left: 16px;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
.jp-AboutNotebook-version {
|
|
18
|
+
color: var(--jp-ui-font-color1);
|
|
19
|
+
font-size: var(--jp-ui-font-size1);
|
|
20
|
+
padding: var(--jp-flat-button-padding);
|
|
21
|
+
font-weight: 400;
|
|
22
|
+
letter-spacing: 0.4px;
|
|
23
|
+
line-height: 1.12;
|
|
24
|
+
min-width: 360px;
|
|
25
|
+
text-align: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
.jp-AboutNotebook-body {
|
|
17
29
|
display: flex;
|
|
18
30
|
font-size: var(--jp-ui-font-size2);
|
|
19
31
|
padding: var(--jp-flat-button-padding);
|
|
20
32
|
color: var(--jp-ui-font-color1);
|
|
21
|
-
text-align:
|
|
33
|
+
text-align: center;
|
|
22
34
|
flex-direction: column;
|
|
23
35
|
min-width: 360px;
|
|
24
36
|
overflow: hidden;
|
|
@@ -37,6 +49,10 @@
|
|
|
37
49
|
color: var(--jp-warn-color0);
|
|
38
50
|
}
|
|
39
51
|
|
|
52
|
+
.jp-AboutNotebook-about-copyright {
|
|
53
|
+
padding-top: 25px;
|
|
54
|
+
}
|
|
55
|
+
|
|
40
56
|
.jp-AboutNotebook-shortcuts {
|
|
41
57
|
padding: 10px;
|
|
42
58
|
}
|