@jupyter-notebook/help-extension 7.0.0-alpha.9 → 7.0.0-beta.1
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 +38 -52
- package/package.json +9 -8
- package/schema/{plugin.json → open.json} +0 -4
- package/style/base.css +0 -13
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 {
|
|
3
|
+
import { 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';
|
|
@@ -11,12 +11,12 @@ import * as React from 'react';
|
|
|
11
11
|
const RESOURCES = [
|
|
12
12
|
{
|
|
13
13
|
text: 'About Jupyter',
|
|
14
|
-
url: 'https://jupyter.org'
|
|
14
|
+
url: 'https://jupyter.org',
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
text: 'Markdown Reference',
|
|
18
|
-
url: 'https://commonmark.org/help/'
|
|
19
|
-
}
|
|
18
|
+
url: 'https://commonmark.org/help/',
|
|
19
|
+
},
|
|
20
20
|
];
|
|
21
21
|
/**
|
|
22
22
|
* The command IDs used by the help plugin.
|
|
@@ -24,55 +24,37 @@ const RESOURCES = [
|
|
|
24
24
|
var CommandIDs;
|
|
25
25
|
(function (CommandIDs) {
|
|
26
26
|
CommandIDs.open = 'help:open';
|
|
27
|
-
CommandIDs.shortcuts = 'help:shortcuts';
|
|
28
27
|
CommandIDs.about = 'help:about';
|
|
29
28
|
})(CommandIDs || (CommandIDs = {}));
|
|
30
29
|
/**
|
|
31
|
-
*
|
|
30
|
+
* A plugin to open the about section with resources.
|
|
32
31
|
*/
|
|
33
|
-
const
|
|
34
|
-
id: '@jupyter-notebook/help-extension:
|
|
32
|
+
const open = {
|
|
33
|
+
id: '@jupyter-notebook/help-extension:open',
|
|
35
34
|
autoStart: true,
|
|
36
|
-
|
|
37
|
-
optional: [IMainMenu],
|
|
38
|
-
activate: (app, translator, menu) => {
|
|
35
|
+
activate: (app) => {
|
|
39
36
|
const { commands } = app;
|
|
40
|
-
const trans = translator.load('notebook');
|
|
41
37
|
commands.addCommand(CommandIDs.open, {
|
|
42
|
-
label: args => args['text'],
|
|
43
|
-
execute: args => {
|
|
38
|
+
label: (args) => args['text'],
|
|
39
|
+
execute: (args) => {
|
|
44
40
|
const url = args['url'];
|
|
45
41
|
window.open(url);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
commands.addCommand(CommandIDs.shortcuts, {
|
|
49
|
-
label: trans.__('Keyboard Shortcuts'),
|
|
50
|
-
execute: () => {
|
|
51
|
-
const title = (React.createElement("span", { className: "jp-AboutNotebook-about-header" },
|
|
52
|
-
React.createElement("div", { className: "jp-AboutNotebook-about-header-info" }, trans.__('Keyboard Shortcuts'))));
|
|
53
|
-
const body = (React.createElement("table", { className: "jp-AboutNotebook-shortcuts" },
|
|
54
|
-
React.createElement("thead", null,
|
|
55
|
-
React.createElement("tr", null,
|
|
56
|
-
React.createElement("th", null, trans.__('Name')),
|
|
57
|
-
React.createElement("th", null, trans.__('Shortcut')))),
|
|
58
|
-
React.createElement("tbody", null, commands.keyBindings
|
|
59
|
-
.filter(binding => commands.isEnabled(binding.command))
|
|
60
|
-
.map((binding, i) => (React.createElement("tr", { key: i },
|
|
61
|
-
React.createElement("td", null, commands.label(binding.command)),
|
|
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
|
-
}
|
|
42
|
+
},
|
|
75
43
|
});
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Plugin to add a command to show an About Jupyter Notebook and Markdown Reference.
|
|
48
|
+
*/
|
|
49
|
+
const about = {
|
|
50
|
+
id: '@jupyter-notebook/help-extension:about',
|
|
51
|
+
autoStart: true,
|
|
52
|
+
requires: [ITranslator],
|
|
53
|
+
optional: [IMainMenu, ICommandPalette],
|
|
54
|
+
activate: (app, translator, menu, palette) => {
|
|
55
|
+
const { commands } = app;
|
|
56
|
+
const trans = translator.load('notebook');
|
|
57
|
+
const category = trans.__('Help');
|
|
76
58
|
commands.addCommand(CommandIDs.about, {
|
|
77
59
|
label: trans.__('About %1', app.name),
|
|
78
60
|
execute: () => {
|
|
@@ -87,7 +69,7 @@ const plugin = {
|
|
|
87
69
|
React.createElement("a", { href: notebookURL, target: "_blank", rel: "noopener noreferrer", className: "jp-Button-flat jp-AboutNotebook-about-externalLinks" }, aboutJupyter),
|
|
88
70
|
React.createElement("a", { href: contributorURL, target: "_blank", rel: "noopener noreferrer", className: "jp-Button-flat jp-AboutNotebook-about-externalLinks" }, contributorList)));
|
|
89
71
|
const version = trans.__('Version: %1', app.version);
|
|
90
|
-
const copyright = trans.__('© 2021-
|
|
72
|
+
const copyright = trans.__('© 2021-2023 Jupyter Notebook Contributors');
|
|
91
73
|
const body = (React.createElement(React.Fragment, null,
|
|
92
74
|
React.createElement("span", { className: "jp-AboutNotebook-version" }, version),
|
|
93
75
|
React.createElement("div", null, externalLinks),
|
|
@@ -98,21 +80,25 @@ const plugin = {
|
|
|
98
80
|
buttons: [
|
|
99
81
|
Dialog.createButton({
|
|
100
82
|
label: trans.__('Dismiss'),
|
|
101
|
-
className: 'jp-AboutNotebook-about-button jp-mod-reject jp-mod-styled'
|
|
102
|
-
})
|
|
103
|
-
]
|
|
83
|
+
className: 'jp-AboutNotebook-about-button jp-mod-reject jp-mod-styled',
|
|
84
|
+
}),
|
|
85
|
+
],
|
|
104
86
|
});
|
|
105
87
|
dialog.addClass('jp-AboutNotebook');
|
|
106
88
|
void dialog.launch();
|
|
107
|
-
}
|
|
89
|
+
},
|
|
108
90
|
});
|
|
109
|
-
|
|
91
|
+
if (palette) {
|
|
92
|
+
palette.addItem({ command: CommandIDs.about, category });
|
|
93
|
+
}
|
|
94
|
+
const resourcesGroup = RESOURCES.map((args) => ({
|
|
110
95
|
args,
|
|
111
|
-
command: CommandIDs.open
|
|
96
|
+
command: CommandIDs.open,
|
|
112
97
|
}));
|
|
113
98
|
if (menu) {
|
|
114
99
|
menu.helpMenu.addGroup(resourcesGroup, 30);
|
|
115
100
|
}
|
|
116
|
-
}
|
|
101
|
+
},
|
|
117
102
|
};
|
|
118
|
-
|
|
103
|
+
const plugins = [open, about];
|
|
104
|
+
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-
|
|
3
|
+
"version": "7.0.0-beta.1",
|
|
4
4
|
"description": "Jupyter Notebook - Help Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -35,19 +35,20 @@
|
|
|
35
35
|
"build:prod": "tsc -b",
|
|
36
36
|
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
|
|
37
37
|
"docs": "typedoc src",
|
|
38
|
-
"prepublishOnly": "npm run build",
|
|
39
38
|
"watch": "tsc -b --watch"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@jupyter-notebook/ui-components": "^7.0.0-
|
|
43
|
-
"@jupyterlab/application": "^4.0.0-
|
|
44
|
-
"@jupyterlab/apputils": "^4.0.0-
|
|
45
|
-
"@jupyterlab/mainmenu": "^4.0.0-
|
|
46
|
-
"@jupyterlab/translation": "^4.0.0-
|
|
41
|
+
"@jupyter-notebook/ui-components": "^7.0.0-beta.1",
|
|
42
|
+
"@jupyterlab/application": "^4.0.0-rc.0",
|
|
43
|
+
"@jupyterlab/apputils": "^4.0.0-rc.0",
|
|
44
|
+
"@jupyterlab/mainmenu": "^4.0.0-rc.0",
|
|
45
|
+
"@jupyterlab/translation": "^4.0.0-rc.0",
|
|
46
|
+
"react": "^18.2.0",
|
|
47
|
+
"react-dom": "^18.2.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"rimraf": "^3.0.2",
|
|
50
|
-
"typescript": "~
|
|
51
|
+
"typescript": "~5.0.2"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
package/style/base.css
CHANGED
|
@@ -52,16 +52,3 @@
|
|
|
52
52
|
.jp-AboutNotebook-about-copyright {
|
|
53
53
|
padding-top: 25px;
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
.jp-AboutNotebook-shortcuts {
|
|
57
|
-
padding: 10px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.jp-AboutNotebook-shortcuts pre {
|
|
61
|
-
padding: 5px;
|
|
62
|
-
margin: 0 0 10px;
|
|
63
|
-
background: var(--jp-layout-color2);
|
|
64
|
-
border: 1px solid var(--jp-border-color0);
|
|
65
|
-
border-radius: 2px;
|
|
66
|
-
word-break: break-all;
|
|
67
|
-
}
|