@jupyterlab/pluginmanager-extension 4.1.0-alpha.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @module pluginmanager-extension
4
+ */
5
+ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
6
+ declare const plugins: JupyterFrontEndPlugin<any>[];
7
+ export default plugins;
package/lib/index.js ADDED
@@ -0,0 +1,131 @@
1
+ /* -----------------------------------------------------------------------------
2
+ | Copyright (c) Jupyter Development Team.
3
+ | Distributed under the terms of the Modified BSD License.
4
+ |----------------------------------------------------------------------------*/
5
+ /**
6
+ * @packageDocumentation
7
+ * @module pluginmanager-extension
8
+ */
9
+ import { ILayoutRestorer } from '@jupyterlab/application';
10
+ import { ICommandPalette, MainAreaWidget, WidgetTracker } from '@jupyterlab/apputils';
11
+ import { ITranslator, nullTranslator } from '@jupyterlab/translation';
12
+ import { CommandToolbarButton, extensionIcon, refreshIcon } from '@jupyterlab/ui-components';
13
+ import { IPluginManager, PluginListModel, Plugins } from '@jupyterlab/pluginmanager';
14
+ /**
15
+ * The command IDs used by the pluginmanager plugin.
16
+ */
17
+ var CommandIDs;
18
+ (function (CommandIDs) {
19
+ CommandIDs.open = 'pluginmanager:open';
20
+ CommandIDs.refreshPlugins = 'pluginmanager:refresh';
21
+ })(CommandIDs || (CommandIDs = {}));
22
+ const PLUGIN_ID = '@jupyterlab/pluginmanager-extension:plugin';
23
+ /**
24
+ * A plugin for managing status of other plugins.
25
+ */
26
+ const pluginmanager = {
27
+ id: PLUGIN_ID,
28
+ description: 'Enable or disable individual plugins.',
29
+ autoStart: true,
30
+ requires: [],
31
+ optional: [ITranslator, ICommandPalette, ILayoutRestorer],
32
+ provides: IPluginManager,
33
+ activate: (app, translator, palette, restorer) => {
34
+ const { commands, shell } = app;
35
+ translator = translator !== null && translator !== void 0 ? translator : nullTranslator;
36
+ const trans = translator.load('jupyterlab');
37
+ // Translation strings.
38
+ const category = trans.__('Plugin Manager');
39
+ const widgetLabel = trans.__('Advanced Plugin Manager');
40
+ const refreshPlugins = trans.__('Refresh Plugin List');
41
+ const namespace = 'plugin-manager';
42
+ const tracker = new WidgetTracker({
43
+ namespace: namespace
44
+ });
45
+ /**
46
+ * Create a MainAreaWidget for Plugin Manager.
47
+ */
48
+ function createWidget(args) {
49
+ const model = new PluginListModel({
50
+ ...args,
51
+ pluginData: {
52
+ availablePlugins: app.info.availablePlugins
53
+ },
54
+ serverSettings: app.serviceManager.serverSettings,
55
+ extraLockedPlugins: [
56
+ PLUGIN_ID,
57
+ // UI will not proceed beyond splash without `layout` plugin
58
+ '@jupyterlab/application-extension:layout',
59
+ // State restoration does not work well without resolver,
60
+ // can leave user locked out of the plugin manager
61
+ // (if command palette and menu are disabled too)
62
+ '@jupyterlab/apputils-extension:resolver'
63
+ ],
64
+ translator: translator !== null && translator !== void 0 ? translator : nullTranslator
65
+ });
66
+ const content = new Plugins({
67
+ model,
68
+ translator: translator !== null && translator !== void 0 ? translator : nullTranslator
69
+ });
70
+ content.title.label = widgetLabel;
71
+ content.title.icon = extensionIcon;
72
+ const main = new MainAreaWidget({ content, reveal: model.ready });
73
+ main.toolbar.addItem('refresh-plugins', new CommandToolbarButton({
74
+ id: CommandIDs.refreshPlugins,
75
+ args: { noLabel: true },
76
+ commands
77
+ }));
78
+ return main;
79
+ }
80
+ // Register commands.
81
+ commands.addCommand(CommandIDs.open, {
82
+ label: widgetLabel,
83
+ execute: args => {
84
+ const main = createWidget(args);
85
+ shell.add(main, 'main', { type: 'Plugins' });
86
+ // add to tracker so it can be restored, and update when choices change
87
+ void tracker.add(main);
88
+ main.content.model.trackerDataChanged.connect(() => {
89
+ void tracker.save(main);
90
+ });
91
+ return main;
92
+ }
93
+ });
94
+ commands.addCommand(CommandIDs.refreshPlugins, {
95
+ label: args => (args.noLabel ? '' : refreshPlugins),
96
+ caption: trans.__('Refresh plugins list'),
97
+ icon: refreshIcon,
98
+ execute: async () => {
99
+ var _a;
100
+ return (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.content.model.refresh().catch((reason) => {
101
+ console.error(`Failed to refresh the available plugins list:\n${reason}`);
102
+ });
103
+ }
104
+ });
105
+ if (palette) {
106
+ palette.addItem({ command: CommandIDs.open, category });
107
+ }
108
+ if (restorer) {
109
+ void restorer.restore(tracker, {
110
+ command: CommandIDs.open,
111
+ name: _ => 'plugins',
112
+ args: widget => {
113
+ const { query, isDisclaimed } = widget.content.model;
114
+ const args = {
115
+ query,
116
+ isDisclaimed
117
+ };
118
+ return args;
119
+ }
120
+ });
121
+ }
122
+ return {
123
+ open: () => {
124
+ return app.commands.execute(CommandIDs.open);
125
+ }
126
+ };
127
+ }
128
+ };
129
+ const plugins = [pluginmanager];
130
+ export default plugins;
131
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;GAGG;AACH,OAAO,EACL,eAAe,EAGhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,cAAc,EACd,eAAe,EACf,OAAO,EACR,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,IAAU,UAAU,CAInB;AAJD,WAAU,UAAU;IACL,eAAI,GAAG,oBAAoB,CAAC;IAE5B,yBAAc,GAAG,uBAAuB,CAAC;AACxD,CAAC,EAJS,UAAU,KAAV,UAAU,QAInB;AAED,MAAM,SAAS,GAAG,4CAA4C,CAAC;AAE/D;;GAEG;AACH,MAAM,aAAa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AC;AAE9D,eAAe,OAAO,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@jupyterlab/pluginmanager-extension",
3
+ "version": "4.1.0-alpha.2",
4
+ "description": "Enable/disable plugins from user interface",
5
+ "homepage": "https://github.com/jupyterlab/jupyterlab",
6
+ "bugs": {
7
+ "url": "https://github.com/jupyterlab/jupyterlab/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/jupyterlab/jupyterlab.git"
12
+ },
13
+ "license": "BSD-3-Clause",
14
+ "author": "Project Jupyter",
15
+ "sideEffects": [
16
+ "style/*.css",
17
+ "style/index.js"
18
+ ],
19
+ "main": "lib/index.js",
20
+ "types": "lib/index.d.ts",
21
+ "style": "style/index.css",
22
+ "directories": {
23
+ "lib": "lib/"
24
+ },
25
+ "files": [
26
+ "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
27
+ "schema/*.json",
28
+ "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
29
+ "src/**/*.{ts,tsx}",
30
+ "style/index.js"
31
+ ],
32
+ "scripts": {
33
+ "build": "tsc -b",
34
+ "build:test": "tsc --build tsconfig.test.json",
35
+ "clean": "rimraf lib tsconfig.tsbuildinfo",
36
+ "watch": "tsc -b --watch"
37
+ },
38
+ "dependencies": {
39
+ "@jupyterlab/application": "^4.1.0-alpha.2",
40
+ "@jupyterlab/apputils": "^4.2.0-alpha.2",
41
+ "@jupyterlab/pluginmanager": "^4.1.0-alpha.2",
42
+ "@jupyterlab/translation": "^4.1.0-alpha.2",
43
+ "@jupyterlab/ui-components": "^4.1.0-alpha.2",
44
+ "@lumino/coreutils": "^2.1.2"
45
+ },
46
+ "devDependencies": {
47
+ "rimraf": "~3.0.0",
48
+ "typescript": "~5.0.4"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "jupyterlab": {
54
+ "extension": true
55
+ },
56
+ "styleModule": "style/index.js"
57
+ }
package/src/index.ts ADDED
@@ -0,0 +1,173 @@
1
+ /* -----------------------------------------------------------------------------
2
+ | Copyright (c) Jupyter Development Team.
3
+ | Distributed under the terms of the Modified BSD License.
4
+ |----------------------------------------------------------------------------*/
5
+ /**
6
+ * @packageDocumentation
7
+ * @module pluginmanager-extension
8
+ */
9
+ import {
10
+ ILayoutRestorer,
11
+ JupyterFrontEndPlugin,
12
+ JupyterLab
13
+ } from '@jupyterlab/application';
14
+ import {
15
+ ICommandPalette,
16
+ MainAreaWidget,
17
+ WidgetTracker
18
+ } from '@jupyterlab/apputils';
19
+ import { ITranslator, nullTranslator } from '@jupyterlab/translation';
20
+ import {
21
+ CommandToolbarButton,
22
+ extensionIcon,
23
+ refreshIcon
24
+ } from '@jupyterlab/ui-components';
25
+ import { ReadonlyJSONObject } from '@lumino/coreutils';
26
+ import {
27
+ IPluginManager,
28
+ PluginListModel,
29
+ Plugins
30
+ } from '@jupyterlab/pluginmanager';
31
+
32
+ /**
33
+ * The command IDs used by the pluginmanager plugin.
34
+ */
35
+ namespace CommandIDs {
36
+ export const open = 'pluginmanager:open';
37
+
38
+ export const refreshPlugins = 'pluginmanager:refresh';
39
+ }
40
+
41
+ const PLUGIN_ID = '@jupyterlab/pluginmanager-extension:plugin';
42
+
43
+ /**
44
+ * A plugin for managing status of other plugins.
45
+ */
46
+ const pluginmanager: JupyterFrontEndPlugin<IPluginManager> = {
47
+ id: PLUGIN_ID,
48
+ description: 'Enable or disable individual plugins.',
49
+ autoStart: true,
50
+ requires: [],
51
+ optional: [ITranslator, ICommandPalette, ILayoutRestorer],
52
+ provides: IPluginManager,
53
+ activate: (
54
+ app: JupyterLab,
55
+ translator: ITranslator | null,
56
+ palette: ICommandPalette | null,
57
+ restorer: ILayoutRestorer | null
58
+ ) => {
59
+ const { commands, shell } = app;
60
+ translator = translator ?? nullTranslator;
61
+ const trans = translator.load('jupyterlab');
62
+
63
+ // Translation strings.
64
+ const category = trans.__('Plugin Manager');
65
+ const widgetLabel = trans.__('Advanced Plugin Manager');
66
+ const refreshPlugins = trans.__('Refresh Plugin List');
67
+
68
+ const namespace = 'plugin-manager';
69
+ const tracker = new WidgetTracker<MainAreaWidget<Plugins>>({
70
+ namespace: namespace
71
+ });
72
+
73
+ /**
74
+ * Create a MainAreaWidget for Plugin Manager.
75
+ */
76
+ function createWidget(args?: PluginListModel.IConfigurableState) {
77
+ const model = new PluginListModel({
78
+ ...args,
79
+ pluginData: {
80
+ availablePlugins: app.info.availablePlugins
81
+ },
82
+ serverSettings: app.serviceManager.serverSettings,
83
+ extraLockedPlugins: [
84
+ PLUGIN_ID,
85
+ // UI will not proceed beyond splash without `layout` plugin
86
+ '@jupyterlab/application-extension:layout',
87
+ // State restoration does not work well without resolver,
88
+ // can leave user locked out of the plugin manager
89
+ // (if command palette and menu are disabled too)
90
+ '@jupyterlab/apputils-extension:resolver'
91
+ ],
92
+ translator: translator ?? nullTranslator
93
+ });
94
+ const content = new Plugins({
95
+ model,
96
+ translator: translator ?? nullTranslator
97
+ });
98
+ content.title.label = widgetLabel;
99
+ content.title.icon = extensionIcon;
100
+ const main = new MainAreaWidget({ content, reveal: model.ready });
101
+
102
+ main.toolbar.addItem(
103
+ 'refresh-plugins',
104
+ new CommandToolbarButton({
105
+ id: CommandIDs.refreshPlugins,
106
+ args: { noLabel: true },
107
+ commands
108
+ })
109
+ );
110
+
111
+ return main;
112
+ }
113
+
114
+ // Register commands.
115
+ commands.addCommand(CommandIDs.open, {
116
+ label: widgetLabel,
117
+ execute: args => {
118
+ const main = createWidget(args);
119
+ shell.add(main, 'main', { type: 'Plugins' });
120
+
121
+ // add to tracker so it can be restored, and update when choices change
122
+ void tracker.add(main);
123
+ main.content.model.trackerDataChanged.connect(() => {
124
+ void tracker.save(main);
125
+ });
126
+ return main;
127
+ }
128
+ });
129
+
130
+ commands.addCommand(CommandIDs.refreshPlugins, {
131
+ label: args => (args.noLabel ? '' : refreshPlugins),
132
+ caption: trans.__('Refresh plugins list'),
133
+ icon: refreshIcon,
134
+ execute: async () => {
135
+ return tracker.currentWidget?.content.model
136
+ .refresh()
137
+ .catch((reason: Error) => {
138
+ console.error(
139
+ `Failed to refresh the available plugins list:\n${reason}`
140
+ );
141
+ });
142
+ }
143
+ });
144
+
145
+ if (palette) {
146
+ palette.addItem({ command: CommandIDs.open, category });
147
+ }
148
+
149
+ if (restorer) {
150
+ void restorer.restore(tracker, {
151
+ command: CommandIDs.open,
152
+ name: _ => 'plugins',
153
+ args: widget => {
154
+ const { query, isDisclaimed } = widget.content.model;
155
+ const args: PluginListModel.IConfigurableState = {
156
+ query,
157
+ isDisclaimed
158
+ };
159
+ return args as ReadonlyJSONObject;
160
+ }
161
+ });
162
+ }
163
+ return {
164
+ open: () => {
165
+ return app.commands.execute(CommandIDs.open);
166
+ }
167
+ };
168
+ }
169
+ };
170
+
171
+ const plugins: JupyterFrontEndPlugin<any>[] = [pluginmanager];
172
+
173
+ export default plugins;
@@ -0,0 +1,10 @@
1
+ /*-----------------------------------------------------------------------------
2
+ | Copyright (c) Jupyter Development Team.
3
+ | Distributed under the terms of the Modified BSD License.
4
+ |----------------------------------------------------------------------------*/
5
+
6
+ /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7
+ @import url('~@jupyterlab/ui-components/style/index.css');
8
+ @import url('~@jupyterlab/apputils/style/index.css');
9
+ @import url('~@jupyterlab/application/style/index.css');
10
+ @import url('~@jupyterlab/pluginmanager/style/index.css');
package/style/index.js ADDED
@@ -0,0 +1,10 @@
1
+ /*-----------------------------------------------------------------------------
2
+ | Copyright (c) Jupyter Development Team.
3
+ | Distributed under the terms of the Modified BSD License.
4
+ |----------------------------------------------------------------------------*/
5
+
6
+ /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7
+ import '@jupyterlab/ui-components/style/index.js';
8
+ import '@jupyterlab/apputils/style/index.js';
9
+ import '@jupyterlab/application/style/index.js';
10
+ import '@jupyterlab/pluginmanager/style/index.js';