@jupyterlite/application-extension 0.6.0-alpha.9 → 0.6.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/clear-data-dialog.d.ts +63 -0
- package/lib/clear-data-dialog.js +80 -0
- package/lib/clear-data-dialog.js.map +1 -0
- package/lib/index.js +82 -30
- package/lib/index.js.map +1 -1
- package/package.json +16 -19
- package/schema/clear-browser-data.json +27 -0
- package/schema/share-file.json +16 -0
- package/src/clear-data-dialog.tsx +217 -0
- package/src/index.tsx +111 -32
- package/style/base.css +68 -0
- package/style/index.css +0 -2
- package/style/index.js +0 -2
- package/lib/pluginmanager.d.ts +0 -20
- package/lib/pluginmanager.js +0 -126
- package/lib/pluginmanager.js.map +0 -1
- package/src/pluginmanager.ts +0 -157
package/src/pluginmanager.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Jupyter Development Team.
|
|
2
|
-
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
JupyterFrontEnd,
|
|
6
|
-
JupyterFrontEndPlugin,
|
|
7
|
-
JupyterLab,
|
|
8
|
-
} from '@jupyterlab/application';
|
|
9
|
-
import { ICommandPalette, MainAreaWidget, WidgetTracker } from '@jupyterlab/apputils';
|
|
10
|
-
import {
|
|
11
|
-
IEntry,
|
|
12
|
-
IPluginManager,
|
|
13
|
-
PluginListModel,
|
|
14
|
-
Plugins,
|
|
15
|
-
} from '@jupyterlab/pluginmanager';
|
|
16
|
-
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
17
|
-
import { extensionIcon } from '@jupyterlab/ui-components';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The command IDs used by the plugin manager plugin.
|
|
21
|
-
*/
|
|
22
|
-
namespace CommandIDs {
|
|
23
|
-
export const open = 'plugin-manager:open';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Custom PluginModel for use in JupyterLite
|
|
28
|
-
*/
|
|
29
|
-
export class LitePluginListModel extends PluginListModel {
|
|
30
|
-
/**
|
|
31
|
-
* Create a new PluginListModel.
|
|
32
|
-
*/
|
|
33
|
-
constructor(options: PluginListModel.IOptions) {
|
|
34
|
-
super(options);
|
|
35
|
-
this._availablePlugins = options.pluginData.availablePlugins.map((plugin) => {
|
|
36
|
-
let tokenLabel = plugin.provides ? plugin.provides.name.split(':')[1] : undefined;
|
|
37
|
-
if (plugin.provides && !tokenLabel) {
|
|
38
|
-
tokenLabel = plugin.provides.name;
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
...plugin,
|
|
42
|
-
tokenLabel,
|
|
43
|
-
// keep all plugins locked and enabled for now until there is
|
|
44
|
-
// a way to enable/disable plugins in JupyterLite
|
|
45
|
-
locked: true,
|
|
46
|
-
enabled: true,
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get available(): ReadonlyArray<IEntry> {
|
|
52
|
-
return this._availablePlugins;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async refresh(): Promise<void> {
|
|
56
|
-
// no-op
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async enable(entry: IEntry): Promise<void> {
|
|
60
|
-
// no-op
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async disable(entry: IEntry): Promise<void> {
|
|
64
|
-
// no-op
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
private _availablePlugins: IEntry[];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* A plugin for managing status of other plugins.
|
|
72
|
-
*/
|
|
73
|
-
export const pluginManagerPlugin: JupyterFrontEndPlugin<IPluginManager> = {
|
|
74
|
-
id: '@jupyterlite/application-extension:plugin-manager',
|
|
75
|
-
description: 'Plugin manager viewer',
|
|
76
|
-
autoStart: true,
|
|
77
|
-
optional: [ITranslator, ICommandPalette],
|
|
78
|
-
provides: IPluginManager,
|
|
79
|
-
activate: (
|
|
80
|
-
app: JupyterFrontEnd,
|
|
81
|
-
translator: ITranslator | null,
|
|
82
|
-
palette: ICommandPalette | null,
|
|
83
|
-
): IPluginManager => {
|
|
84
|
-
if (!(app instanceof JupyterLab)) {
|
|
85
|
-
// only activate in JupyterLab
|
|
86
|
-
// TODO: require JupyterLab.IInfo instead when the upstream PR is merged and released?
|
|
87
|
-
// https://github.com/jupyterlab/jupyterlab/pull/17367
|
|
88
|
-
return {
|
|
89
|
-
open: async () => {
|
|
90
|
-
// eslint-disable-next-line no-console
|
|
91
|
-
console.info('Plugin manager viewer is only available in JupyterLab');
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const { commands, serviceManager, shell } = app;
|
|
97
|
-
|
|
98
|
-
translator = translator ?? nullTranslator;
|
|
99
|
-
const trans = translator.load('jupyterlab');
|
|
100
|
-
|
|
101
|
-
const category = trans.__('Plugin Manager');
|
|
102
|
-
const widgetLabel = trans.__('Advanced Plugin Manager');
|
|
103
|
-
|
|
104
|
-
const namespace = 'plugin-manager';
|
|
105
|
-
const tracker = new WidgetTracker<MainAreaWidget<Plugins>>({
|
|
106
|
-
namespace: namespace,
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const availablePlugins = app.info.availablePlugins;
|
|
110
|
-
|
|
111
|
-
function createWidget(args?: PluginListModel.IConfigurableState) {
|
|
112
|
-
const model = new LitePluginListModel({
|
|
113
|
-
...args,
|
|
114
|
-
pluginData: {
|
|
115
|
-
availablePlugins,
|
|
116
|
-
},
|
|
117
|
-
serverSettings: serviceManager.serverSettings,
|
|
118
|
-
extraLockedPlugins: [pluginManagerPlugin.id],
|
|
119
|
-
translator: translator ?? nullTranslator,
|
|
120
|
-
});
|
|
121
|
-
const content = new Plugins({
|
|
122
|
-
model,
|
|
123
|
-
translator: translator ?? nullTranslator,
|
|
124
|
-
});
|
|
125
|
-
content.title.label = widgetLabel;
|
|
126
|
-
content.title.icon = extensionIcon;
|
|
127
|
-
content.title.caption = trans.__('Plugin Manager');
|
|
128
|
-
const main = new MainAreaWidget({ content, reveal: model.ready });
|
|
129
|
-
return main;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
commands.addCommand(CommandIDs.open, {
|
|
133
|
-
label: widgetLabel,
|
|
134
|
-
execute: (args) => {
|
|
135
|
-
const main = createWidget(args);
|
|
136
|
-
shell.add(main, 'main', { type: 'Plugins' });
|
|
137
|
-
|
|
138
|
-
// add to tracker so it can be restored, and update when choices change
|
|
139
|
-
void tracker.add(main);
|
|
140
|
-
main.content.model.trackerDataChanged.connect(() => {
|
|
141
|
-
void tracker.save(main);
|
|
142
|
-
});
|
|
143
|
-
return main;
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
if (palette) {
|
|
148
|
-
palette.addItem({ command: CommandIDs.open, category });
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
open: () => {
|
|
153
|
-
return app.commands.execute(CommandIDs.open);
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
|
-
};
|