@jupyter-notebook/help-extension 7.0.0-alpha.10 → 7.0.0-alpha.12

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 CHANGED
@@ -1,6 +1,3 @@
1
1
  import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
- /**
3
- * The help plugin.
4
- */
5
- declare const plugin: JupyterFrontEndPlugin<void>;
6
- export default plugin;
2
+ declare const plugins: JupyterFrontEndPlugin<any>[];
3
+ export default plugins;
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
- * The help plugin.
31
+ * A plugin to open the about section with resources.
32
32
  */
33
- const plugin = {
34
- id: '@jupyter-notebook/help-extension:plugin',
33
+ const open = {
34
+ id: '@jupyter-notebook/help-extension:open',
35
35
  autoStart: true,
36
- requires: [ITranslator],
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
- 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
- }
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: () => {
@@ -106,6 +89,9 @@ const plugin = {
106
89
  void dialog.launch();
107
90
  }
108
91
  });
92
+ if (palette) {
93
+ palette.addItem({ command: CommandIDs.about, category });
94
+ }
109
95
  const resourcesGroup = RESOURCES.map(args => ({
110
96
  args,
111
97
  command: CommandIDs.open
@@ -115,4 +101,50 @@ const plugin = {
115
101
  }
116
102
  }
117
103
  };
118
- export default plugin;
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 });
146
+ }
147
+ }
148
+ };
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.10",
3
+ "version": "7.0.0-alpha.12",
4
4
  "description": "Jupyter Notebook - Help Extension",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -39,13 +39,16 @@
39
39
  "watch": "tsc -b --watch"
40
40
  },
41
41
  "dependencies": {
42
- "@jupyter-notebook/ui-components": "^7.0.0-alpha.10",
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"
42
+ "@jupyter-notebook/ui-components": "^7.0.0-alpha.12",
43
+ "@jupyterlab/application": "^4.0.0-alpha.18",
44
+ "@jupyterlab/apputils": "^4.0.0-alpha.18",
45
+ "@jupyterlab/mainmenu": "^4.0.0-alpha.18",
46
+ "@jupyterlab/translation": "^4.0.0-alpha.18",
47
+ "react": "^18.2.0",
48
+ "react-dom": "^18.2.0"
47
49
  },
48
50
  "devDependencies": {
51
+ "@types/react": "^18.0.27",
49
52
  "rimraf": "^3.0.2",
50
53
  "typescript": "~4.9.3"
51
54
  },
File without changes