@jupyterlab/apputils 4.0.0-alpha.2 → 4.0.0-alpha.20
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/clipboard.d.ts +1 -1
- package/lib/dialog.d.ts +73 -4
- package/lib/dialog.js +143 -30
- package/lib/dialog.js.map +1 -1
- package/lib/domutils.js.map +1 -1
- package/lib/index.d.ts +6 -5
- package/lib/index.js +6 -5
- package/lib/index.js.map +1 -1
- package/lib/inputdialog.d.ts +35 -3
- package/lib/inputdialog.js +122 -12
- package/lib/inputdialog.js.map +1 -1
- package/lib/kernelstatuses.d.ts +74 -2
- package/lib/kernelstatuses.js +142 -2
- package/lib/kernelstatuses.js.map +1 -1
- package/lib/mainareawidget.d.ts +9 -0
- package/lib/mainareawidget.js +29 -4
- package/lib/mainareawidget.js.map +1 -1
- package/lib/menufactory.js +14 -15
- package/lib/menufactory.js.map +1 -1
- package/lib/notification.d.ts +336 -0
- package/lib/notification.js +310 -0
- package/lib/notification.js.map +1 -0
- package/lib/runningSessions.d.ts +72 -0
- package/lib/runningSessions.js +119 -0
- package/lib/runningSessions.js.map +1 -0
- package/lib/sanitizer.d.ts +6 -4
- package/lib/sanitizer.js +32 -12
- package/lib/sanitizer.js.map +1 -1
- package/lib/semanticCommand.js +11 -2
- package/lib/semanticCommand.js.map +1 -1
- package/lib/sessioncontext.d.ts +2 -3
- package/lib/sessioncontext.js +46 -27
- package/lib/sessioncontext.js.map +1 -1
- package/lib/testutils.d.ts +5 -0
- package/lib/testutils.js +46 -0
- package/lib/testutils.js.map +1 -0
- package/lib/thememanager.js +13 -4
- package/lib/thememanager.js.map +1 -1
- package/lib/tokens.d.ts +26 -9
- package/lib/tokens.js +1 -6
- package/lib/tokens.js.map +1 -1
- package/lib/toolbar/factory.d.ts +12 -2
- package/lib/toolbar/factory.js +237 -145
- package/lib/toolbar/factory.js.map +1 -1
- package/lib/toolbar/index.js +4 -0
- package/lib/toolbar/index.js.map +1 -1
- package/lib/toolbar/registry.d.ts +11 -0
- package/lib/toolbar/registry.js +20 -3
- package/lib/toolbar/registry.js.map +1 -1
- package/lib/toolbar/widget.d.ts +3 -0
- package/lib/toolbar/widget.js +3 -0
- package/lib/toolbar/widget.js.map +1 -1
- package/lib/widgettracker.d.ts +13 -1
- package/lib/widgettracker.js +29 -2
- package/lib/widgettracker.js.map +1 -1
- package/package.json +30 -30
- package/src/clipboard.ts +107 -0
- package/src/commandlinker.ts +209 -0
- package/src/commandpalette.ts +175 -0
- package/src/dialog.tsx +1133 -0
- package/src/domutils.ts +53 -0
- package/src/index.ts +78 -0
- package/src/inputdialog.ts +551 -0
- package/src/kernelstatuses.tsx +279 -0
- package/src/mainareawidget.ts +362 -0
- package/src/menufactory.ts +201 -0
- package/src/notification.ts +559 -0
- package/src/printing.ts +180 -0
- package/src/runningSessions.tsx +233 -0
- package/src/sanitizer.ts +968 -0
- package/src/semanticCommand.ts +77 -0
- package/src/sessioncontext.tsx +1712 -0
- package/src/testutils.ts +49 -0
- package/src/thememanager.ts +519 -0
- package/src/tokens.ts +372 -0
- package/src/toolbar/factory.ts +422 -0
- package/src/toolbar/index.ts +8 -0
- package/src/toolbar/registry.ts +158 -0
- package/src/toolbar/widget.tsx +243 -0
- package/src/widgettracker.ts +391 -0
- package/src/windowresolver.ts +218 -0
- package/style/base.css +0 -1
- package/style/commandpalette.css +7 -10
- package/style/dialog.css +23 -7
- package/style/index.css +1 -0
- package/style/index.js +1 -0
- package/style/inputdialog.css +5 -0
- package/style/materialcolors.css +8 -21
- package/lib/hoverbox.d.ts +0 -82
- package/lib/hoverbox.js +0 -100
- package/lib/hoverbox.js.map +0 -1
- package/style/hoverbox.css +0 -13
package/lib/thememanager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thememanager.js","sourceRoot":"","sources":["../src/thememanager.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAgB,MA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;IACK,QAAQ,CAAC,MAAW;QAC1B,KAAK,UAAU,CAAC;YACd,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,qBAAqB,CAAC;YAC5C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;YACpB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC5D,CAAC,CAAC;IACL,CAAC;CAmBF;AAuCD;;GAEG;AACH,IAAU,OAAO,CAUhB;AAVD,WAAU,OAAO;IACf;;OAEG;IACH,SAAgB,MAAM,CAAC,MAAc;QACnC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE;YACrC,MAAM,CAAC,KAAK,CAAC,CAAC;SACf;QACD,MAAM,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IALe,cAAM,SAKrB,CAAA;AACH,CAAC,EAVS,OAAO,KAAP,OAAO,QAUhB"}
|
package/lib/tokens.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IChangedArgs } from '@jupyterlab/coreutils';
|
|
2
|
+
import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
|
|
2
3
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
3
4
|
import { Token } from '@lumino/coreutils';
|
|
4
5
|
import { IDisposable } from '@lumino/disposable';
|
|
@@ -35,6 +36,19 @@ export interface ICommandPalette {
|
|
|
35
36
|
*/
|
|
36
37
|
addItem(options: IPaletteItem): IDisposable;
|
|
37
38
|
}
|
|
39
|
+
export declare const IKernelStatusModel: Token<IKernelStatusModel>;
|
|
40
|
+
/**
|
|
41
|
+
* Kernel status indicator model.
|
|
42
|
+
*/
|
|
43
|
+
export interface IKernelStatusModel {
|
|
44
|
+
/**
|
|
45
|
+
* Add a session context provider.
|
|
46
|
+
*
|
|
47
|
+
* A provider will receive the currently active widget and must return the
|
|
48
|
+
* associated session context if it can or null otherwise.
|
|
49
|
+
*/
|
|
50
|
+
addSessionProvider: (provider: (widget: Widget | null) => ISessionContext | null) => void;
|
|
51
|
+
}
|
|
38
52
|
/**
|
|
39
53
|
* An interface for the session context dialogs.
|
|
40
54
|
*/
|
|
@@ -218,15 +232,7 @@ export declare namespace ToolbarRegistry {
|
|
|
218
232
|
/**
|
|
219
233
|
* Interface of item to be inserted in a toolbar
|
|
220
234
|
*/
|
|
221
|
-
interface IToolbarItem {
|
|
222
|
-
/**
|
|
223
|
-
* Unique item name
|
|
224
|
-
*/
|
|
225
|
-
name: string;
|
|
226
|
-
/**
|
|
227
|
-
* Toolbar widget
|
|
228
|
-
*/
|
|
229
|
-
widget: Widget;
|
|
235
|
+
interface IToolbarItem extends IRenderMime.IToolbarItem {
|
|
230
236
|
}
|
|
231
237
|
/**
|
|
232
238
|
* Interface describing a toolbar item widget
|
|
@@ -253,6 +259,15 @@ export declare namespace ToolbarRegistry {
|
|
|
253
259
|
* Toolbar widget registry interface
|
|
254
260
|
*/
|
|
255
261
|
export interface IToolbarWidgetRegistry {
|
|
262
|
+
/**
|
|
263
|
+
* Add a new toolbar item factory
|
|
264
|
+
*
|
|
265
|
+
* @param widgetFactory The widget factory name that creates the toolbar
|
|
266
|
+
* @param toolbarItemName The unique toolbar item
|
|
267
|
+
* @param factory The factory function that receives the widget containing the toolbar and returns the toolbar widget.
|
|
268
|
+
* @returns The previously defined factory
|
|
269
|
+
*/
|
|
270
|
+
addFactory<T extends Widget = Widget>(widgetFactory: string, toolbarItemName: string, factory: (main: T) => Widget): ((main: T) => Widget) | undefined;
|
|
256
271
|
/**
|
|
257
272
|
* Default toolbar item factory
|
|
258
273
|
*/
|
|
@@ -273,6 +288,8 @@ export interface IToolbarWidgetRegistry {
|
|
|
273
288
|
* @param toolbarItemName The unique toolbar item
|
|
274
289
|
* @param factory The factory function that receives the widget containing the toolbar and returns the toolbar widget.
|
|
275
290
|
* @returns The previously defined factory
|
|
291
|
+
*
|
|
292
|
+
* @deprecated since v4 use `addFactory` instead
|
|
276
293
|
*/
|
|
277
294
|
registerFactory<T extends Widget = Widget>(widgetFactory: string, toolbarItemName: string, factory: (main: T) => Widget): ((main: T) => Widget) | undefined;
|
|
278
295
|
}
|
package/lib/tokens.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
import { Token } from '@lumino/coreutils';
|
|
4
|
-
/* tslint:disable */
|
|
5
4
|
/**
|
|
6
5
|
* The command palette token.
|
|
7
6
|
*/
|
|
8
7
|
export const ICommandPalette = new Token('@jupyterlab/apputils:ICommandPalette');
|
|
9
|
-
|
|
8
|
+
export const IKernelStatusModel = new Token('@jupyterlab/apputils:IKernelStatusModel');
|
|
10
9
|
/**
|
|
11
10
|
* The session context dialogs token.
|
|
12
11
|
*/
|
|
13
12
|
export const ISessionContextDialogs = new Token('@jupyterlab/apputils:ISessionContextDialogs');
|
|
14
|
-
/* tslint:enable */
|
|
15
|
-
/* tslint:disable */
|
|
16
13
|
/**
|
|
17
14
|
* The theme manager token.
|
|
18
15
|
*/
|
|
@@ -21,12 +18,10 @@ export const IThemeManager = new Token('@jupyterlab/apputils:IThemeManager');
|
|
|
21
18
|
* The sanitizer token.
|
|
22
19
|
*/
|
|
23
20
|
export const ISanitizer = new Token('@jupyterlab/apputils:ISanitizer');
|
|
24
|
-
/* tslint:disable */
|
|
25
21
|
/**
|
|
26
22
|
* The main menu token.
|
|
27
23
|
*/
|
|
28
24
|
export const ISplashScreen = new Token('@jupyterlab/apputils:ISplashScreen');
|
|
29
|
-
/* tslint:disable */
|
|
30
25
|
/**
|
|
31
26
|
* The default window resolver token.
|
|
32
27
|
*/
|
package/lib/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAK3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM1C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,KAAK,CACtC,sCAAsC,CACvC,CAAC;AA+BF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,KAAK,CACzC,yCAAyC,CAC1C,CAAC;AAsBF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,KAAK,CAC7C,6CAA6C,CAC9C,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,KAAK,CACpC,oCAAoC,CACrC,CAAC;AA0GF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,KAAK,CACjC,iCAAiC,CAClC,CAAC;AAwCF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,KAAK,CACpC,oCAAoC,CACrC,CAAC;AAgBF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,KAAK,CACtC,sCAAsC,CACvC,CAAC;AAyGF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,KAAK,CAC7C,6CAA6C,CAC9C,CAAC"}
|
package/lib/toolbar/factory.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { IObservableList } from '@jupyterlab/observables';
|
|
1
2
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
2
3
|
import { ITranslator } from '@jupyterlab/translation';
|
|
4
|
+
import { Toolbar } from '@jupyterlab/ui-components';
|
|
3
5
|
import { Widget } from '@lumino/widgets';
|
|
4
6
|
import { IToolbarWidgetRegistry, ToolbarRegistry } from '../tokens';
|
|
5
7
|
/**
|
|
@@ -12,6 +14,14 @@ import { IToolbarWidgetRegistry, ToolbarRegistry } from '../tokens';
|
|
|
12
14
|
* @param pluginId Settings plugin id
|
|
13
15
|
* @param translator Translator
|
|
14
16
|
* @param propertyId Toolbar definition key in the settings plugin
|
|
15
|
-
* @returns List of toolbar widgets
|
|
17
|
+
* @returns List of toolbar widgets factory
|
|
16
18
|
*/
|
|
17
|
-
export declare function createToolbarFactory(toolbarRegistry: IToolbarWidgetRegistry, settingsRegistry: ISettingRegistry, factoryName: string, pluginId: string, translator: ITranslator, propertyId?: string): (widget: Widget) => ToolbarRegistry.IToolbarItem
|
|
19
|
+
export declare function createToolbarFactory(toolbarRegistry: IToolbarWidgetRegistry, settingsRegistry: ISettingRegistry, factoryName: string, pluginId: string, translator: ITranslator, propertyId?: string): (widget: Widget) => IObservableList<ToolbarRegistry.IToolbarItem>;
|
|
20
|
+
/**
|
|
21
|
+
* Set the toolbar items of a widget from a factory
|
|
22
|
+
*
|
|
23
|
+
* @param widget Widget with the toolbar to set
|
|
24
|
+
* @param factory Toolbar items factory
|
|
25
|
+
* @param toolbar Separated toolbar if widget is a raw widget
|
|
26
|
+
*/
|
|
27
|
+
export declare function setToolbar(widget: Toolbar.IWidgetToolbar | Widget, factory: (widget: Widget) => IObservableList<ToolbarRegistry.IToolbarItem> | ToolbarRegistry.IToolbarItem[], toolbar?: Toolbar): void;
|
package/lib/toolbar/factory.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Jupyter Development Team.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
1
5
|
import { ObservableList } from '@jupyterlab/observables';
|
|
2
6
|
import { SettingRegistry } from '@jupyterlab/settingregistry';
|
|
3
|
-
import { findIndex
|
|
7
|
+
import { findIndex } from '@lumino/algorithm';
|
|
4
8
|
import { JSONExt } from '@lumino/coreutils';
|
|
5
9
|
import { Dialog, showDialog } from '../dialog';
|
|
6
10
|
/**
|
|
@@ -10,6 +14,7 @@ import { Dialog, showDialog } from '../dialog';
|
|
|
10
14
|
* This will place item just before the white spacer item in the notebook toolbar.
|
|
11
15
|
*/
|
|
12
16
|
const DEFAULT_TOOLBAR_ITEM_RANK = 50;
|
|
17
|
+
const TOOLBAR_KEY = 'jupyter.lab.toolbars';
|
|
13
18
|
/**
|
|
14
19
|
* Display warning when the toolbar definition have been modified.
|
|
15
20
|
*
|
|
@@ -29,8 +34,11 @@ async function displayInformation(trans) {
|
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
36
|
/**
|
|
32
|
-
*
|
|
37
|
+
* Set the toolbar definition by accumulating all settings definition.
|
|
38
|
+
*
|
|
39
|
+
* The list will be populated only with the enabled items.
|
|
33
40
|
*
|
|
41
|
+
* @param toolbarItems Observable list to populate
|
|
34
42
|
* @param registry Application settings registry
|
|
35
43
|
* @param factoryName Widget factory name that needs a toolbar
|
|
36
44
|
* @param pluginId Settings plugin id
|
|
@@ -38,129 +46,142 @@ async function displayInformation(trans) {
|
|
|
38
46
|
* @param propertyId Property holding the toolbar definition in the settings; default 'toolbar'
|
|
39
47
|
* @returns List of toolbar items
|
|
40
48
|
*/
|
|
41
|
-
async function
|
|
49
|
+
async function setToolbarItems(toolbarItems, registry, factoryName, pluginId, translator, propertyId = 'toolbar') {
|
|
42
50
|
var _a;
|
|
43
51
|
const trans = translator.load('jupyterlab');
|
|
44
|
-
let canonical;
|
|
52
|
+
let canonical = null;
|
|
45
53
|
let loaded = {};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const pluginDefaults = Object.keys(registry.plugins)
|
|
56
|
-
.map(plugin => {
|
|
57
|
-
var _a, _b;
|
|
58
|
-
const items = (_b = ((_a = registry.plugins[plugin].schema['jupyter.lab.toolbars']) !== null && _a !== void 0 ? _a : {})[factoryName]) !== null && _b !== void 0 ? _b : [];
|
|
59
|
-
loaded[plugin] = items;
|
|
60
|
-
return items;
|
|
61
|
-
})
|
|
62
|
-
.concat([(_b = ((_a = schema['jupyter.lab.toolbars']) !== null && _a !== void 0 ? _a : {})[factoryName]) !== null && _b !== void 0 ? _b : []])
|
|
63
|
-
.reduceRight((acc, val) => SettingRegistry.reconcileToolbarItems(acc, val, true), []);
|
|
64
|
-
// Apply default value as last step to take into account overrides.json
|
|
65
|
-
// The standard default being [] as the plugin must use `jupyter.lab.toolbars.<factory>`
|
|
66
|
-
// to define their default value.
|
|
67
|
-
schema.properties[propertyId].default = SettingRegistry.reconcileToolbarItems(pluginDefaults, schema.properties[propertyId].default, true)
|
|
68
|
-
// flatten one level
|
|
69
|
-
.sort((a, b) => {
|
|
54
|
+
let listenPlugin = true;
|
|
55
|
+
try {
|
|
56
|
+
/**
|
|
57
|
+
* Populate the plugin's schema defaults.
|
|
58
|
+
*
|
|
59
|
+
* We keep track of disabled entries in case the plugin is loaded
|
|
60
|
+
* after the toolbar initialization.
|
|
61
|
+
*/
|
|
62
|
+
function populate(schema) {
|
|
70
63
|
var _a, _b;
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
loaded = {};
|
|
65
|
+
const pluginDefaults = Object.keys(registry.plugins)
|
|
66
|
+
// Filter out the current plugin (will be listed when reloading)
|
|
67
|
+
// because we control its addition after the mapping step
|
|
68
|
+
.filter(plugin => plugin !== pluginId)
|
|
69
|
+
.map(plugin => {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
const items = (_b = ((_a = registry.plugins[plugin].schema[TOOLBAR_KEY]) !== null && _a !== void 0 ? _a : {})[factoryName]) !== null && _b !== void 0 ? _b : [];
|
|
72
|
+
loaded[plugin] = items;
|
|
73
|
+
return items;
|
|
74
|
+
})
|
|
75
|
+
.concat([(_b = ((_a = schema[TOOLBAR_KEY]) !== null && _a !== void 0 ? _a : {})[factoryName]) !== null && _b !== void 0 ? _b : []])
|
|
76
|
+
.reduceRight((acc, val) => SettingRegistry.reconcileToolbarItems(acc, val, true), []);
|
|
77
|
+
// Apply default value as last step to take into account overrides.json
|
|
78
|
+
// The standard toolbars default is [] as the plugin must use
|
|
79
|
+
// `jupyter.lab.toolbars.<factory>` to define its default value.
|
|
80
|
+
schema.properties[propertyId].default =
|
|
81
|
+
SettingRegistry.reconcileToolbarItems(pluginDefaults, schema.properties[propertyId].default, true).sort((a, b) => {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return ((_a = a.rank) !== null && _a !== void 0 ? _a : DEFAULT_TOOLBAR_ITEM_RANK) -
|
|
84
|
+
((_b = b.rank) !== null && _b !== void 0 ? _b : DEFAULT_TOOLBAR_ITEM_RANK);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// Transform the plugin object to return different schema than the default.
|
|
88
|
+
registry.transform(pluginId, {
|
|
89
|
+
compose: plugin => {
|
|
90
|
+
var _a, _b, _c, _d, _e;
|
|
91
|
+
// Only override the canonical schema the first time.
|
|
92
|
+
if (!canonical) {
|
|
93
|
+
canonical = JSONExt.deepCopy(plugin.schema);
|
|
94
|
+
populate(canonical);
|
|
95
|
+
}
|
|
96
|
+
const defaults = (_c = ((_b = ((_a = canonical.properties) !== null && _a !== void 0 ? _a : {})[propertyId]) !== null && _b !== void 0 ? _b : {}).default) !== null && _c !== void 0 ? _c : [];
|
|
97
|
+
// Initialize the settings
|
|
98
|
+
const user = plugin.data.user;
|
|
99
|
+
const composite = plugin.data.composite;
|
|
100
|
+
// Overrides the value with using the aggregated default for the toolbar property
|
|
101
|
+
user[propertyId] =
|
|
102
|
+
(_d = plugin.data.user[propertyId]) !== null && _d !== void 0 ? _d : [];
|
|
103
|
+
composite[propertyId] = ((_e = SettingRegistry.reconcileToolbarItems(defaults, user[propertyId], false)) !== null && _e !== void 0 ? _e : []).sort((a, b) => {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
return ((_a = a.rank) !== null && _a !== void 0 ? _a : DEFAULT_TOOLBAR_ITEM_RANK) -
|
|
106
|
+
((_b = b.rank) !== null && _b !== void 0 ? _b : DEFAULT_TOOLBAR_ITEM_RANK);
|
|
107
|
+
});
|
|
108
|
+
plugin.data = { composite, user };
|
|
109
|
+
return plugin;
|
|
110
|
+
},
|
|
111
|
+
fetch: plugin => {
|
|
112
|
+
// Only override the canonical schema the first time.
|
|
113
|
+
if (!canonical) {
|
|
114
|
+
canonical = JSONExt.deepCopy(plugin.schema);
|
|
115
|
+
populate(canonical);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
data: plugin.data,
|
|
119
|
+
id: plugin.id,
|
|
120
|
+
raw: plugin.raw,
|
|
121
|
+
schema: canonical,
|
|
122
|
+
version: plugin.version
|
|
123
|
+
};
|
|
124
|
+
}
|
|
73
125
|
});
|
|
74
126
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (!canonical) {
|
|
81
|
-
canonical = JSONExt.deepCopy(plugin.schema);
|
|
82
|
-
populate(canonical);
|
|
83
|
-
}
|
|
84
|
-
const defaults = (_c = ((_b = ((_a = canonical.properties) !== null && _a !== void 0 ? _a : {})[propertyId]) !== null && _b !== void 0 ? _b : {}).default) !== null && _c !== void 0 ? _c : [];
|
|
85
|
-
// Initialize the settings
|
|
86
|
-
const user = plugin.data.user;
|
|
87
|
-
const composite = plugin.data.composite;
|
|
88
|
-
// Overrides the value with using the aggregated default for the toolbar property
|
|
89
|
-
user[propertyId] =
|
|
90
|
-
(_d = plugin.data.user[propertyId]) !== null && _d !== void 0 ? _d : [];
|
|
91
|
-
composite[propertyId] =
|
|
92
|
-
(_e = SettingRegistry.reconcileToolbarItems(defaults, user[propertyId], false)) !== null && _e !== void 0 ? _e : [];
|
|
93
|
-
plugin.data = { composite, user };
|
|
94
|
-
return plugin;
|
|
95
|
-
},
|
|
96
|
-
fetch: plugin => {
|
|
97
|
-
// Only override the canonical schema the first time.
|
|
98
|
-
if (!canonical) {
|
|
99
|
-
canonical = JSONExt.deepCopy(plugin.schema);
|
|
100
|
-
populate(canonical);
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
data: plugin.data,
|
|
104
|
-
id: plugin.id,
|
|
105
|
-
raw: plugin.raw,
|
|
106
|
-
schema: canonical,
|
|
107
|
-
version: plugin.version
|
|
108
|
-
};
|
|
127
|
+
catch (error) {
|
|
128
|
+
if (error.name === 'TransformError') {
|
|
129
|
+
// Assume the existing transformer is the toolbar builder transformer
|
|
130
|
+
// from another factory set up.
|
|
131
|
+
listenPlugin = false;
|
|
109
132
|
}
|
|
110
|
-
|
|
133
|
+
else {
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
111
137
|
// Repopulate the canonical variable after the setting registry has
|
|
112
138
|
// preloaded all initial plugins.
|
|
113
|
-
canonical = null;
|
|
114
139
|
const settings = await registry.load(pluginId);
|
|
115
|
-
const toolbarItems = new ObservableList({
|
|
116
|
-
values: (_a = JSONExt.deepCopy(settings.composite[propertyId])) !== null && _a !== void 0 ? _a : [],
|
|
117
|
-
itemCmp: (a, b) => JSONExt.deepEqual(a, b)
|
|
118
|
-
});
|
|
119
140
|
// React to customization by the user
|
|
120
141
|
settings.changed.connect(() => {
|
|
121
142
|
var _a;
|
|
122
|
-
// As extension may change the toolbar through API,
|
|
123
|
-
// prompt the user to reload if the toolbar definition has been updated.
|
|
124
143
|
const newItems = (_a = settings.composite[propertyId]) !== null && _a !== void 0 ? _a : [];
|
|
125
|
-
|
|
126
|
-
void displayInformation(trans);
|
|
127
|
-
}
|
|
144
|
+
transferSettings(newItems);
|
|
128
145
|
});
|
|
129
|
-
|
|
146
|
+
const transferSettings = (newItems) => {
|
|
147
|
+
// This is not optimal but safer because a toolbar item with the same
|
|
148
|
+
// name cannot be inserted (it will be a no-op). But that could happen
|
|
149
|
+
// if the settings are changing the items order.
|
|
150
|
+
toolbarItems.clear();
|
|
151
|
+
toolbarItems.pushAll(newItems.filter(item => !item.disabled));
|
|
152
|
+
};
|
|
153
|
+
// Initialize the toolbar
|
|
154
|
+
transferSettings((_a = settings.composite[propertyId]) !== null && _a !== void 0 ? _a : []);
|
|
155
|
+
// React to plugin changes if no other transformer exists, otherwise bail.
|
|
156
|
+
if (!listenPlugin) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
130
159
|
registry.pluginChanged.connect(async (sender, plugin) => {
|
|
131
|
-
var _a, _b, _c
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
if (plugin
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (index < 0) {
|
|
153
|
-
toolbarItems.push(item);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
toolbarItems.set(index, item);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
160
|
+
var _a, _b, _c;
|
|
161
|
+
// Since the plugin storing the toolbar definition is transformed above,
|
|
162
|
+
// if it has changed, it means that a request to reload was triggered.
|
|
163
|
+
// Hence the toolbar definitions from the other plugins have been
|
|
164
|
+
// automatically reset during the transform step.
|
|
165
|
+
if (plugin === pluginId) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// If a plugin changed its toolbar items
|
|
169
|
+
const oldItems = (_a = loaded[plugin]) !== null && _a !== void 0 ? _a : [];
|
|
170
|
+
const newItems = (_c = ((_b = registry.plugins[plugin].schema[TOOLBAR_KEY]) !== null && _b !== void 0 ? _b : {})[factoryName]) !== null && _c !== void 0 ? _c : [];
|
|
171
|
+
if (!JSONExt.deepEqual(oldItems, newItems)) {
|
|
172
|
+
if (loaded[plugin]) {
|
|
173
|
+
// The plugin has changed, request the user to reload the UI
|
|
174
|
+
await displayInformation(trans);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
if (newItems.length > 0) {
|
|
178
|
+
canonical = null;
|
|
179
|
+
// This will trigger a settings.changed signal that will update the items
|
|
180
|
+
await registry.reload(pluginId);
|
|
159
181
|
}
|
|
160
182
|
}
|
|
161
183
|
}
|
|
162
184
|
});
|
|
163
|
-
return toolbarItems;
|
|
164
185
|
}
|
|
165
186
|
/**
|
|
166
187
|
* Create the toolbar factory for a given container widget based
|
|
@@ -172,51 +193,122 @@ async function getToolbarItems(registry, factoryName, pluginId, translator, prop
|
|
|
172
193
|
* @param pluginId Settings plugin id
|
|
173
194
|
* @param translator Translator
|
|
174
195
|
* @param propertyId Toolbar definition key in the settings plugin
|
|
175
|
-
* @returns List of toolbar widgets
|
|
196
|
+
* @returns List of toolbar widgets factory
|
|
176
197
|
*/
|
|
177
198
|
export function createToolbarFactory(toolbarRegistry, settingsRegistry, factoryName, pluginId, translator, propertyId = 'toolbar') {
|
|
178
|
-
const items =
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
switch (change.type) {
|
|
182
|
-
case 'move':
|
|
183
|
-
break;
|
|
184
|
-
case 'add':
|
|
185
|
-
case 'remove':
|
|
186
|
-
case 'set':
|
|
187
|
-
items.length = 0;
|
|
188
|
-
items.push(...toArray(list)
|
|
189
|
-
.filter(item => !item.disabled)
|
|
190
|
-
.sort((a, b) => {
|
|
191
|
-
var _a, _b;
|
|
192
|
-
return ((_a = a.rank) !== null && _a !== void 0 ? _a : DEFAULT_TOOLBAR_ITEM_RANK) -
|
|
193
|
-
((_b = b.rank) !== null && _b !== void 0 ? _b : DEFAULT_TOOLBAR_ITEM_RANK);
|
|
194
|
-
}));
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
};
|
|
199
|
+
const items = new ObservableList({
|
|
200
|
+
itemCmp: (a, b) => JSONExt.deepEqual(a, b)
|
|
201
|
+
});
|
|
198
202
|
// Get toolbar definition from the settings
|
|
199
|
-
|
|
200
|
-
.then(candidates => {
|
|
201
|
-
rawItems = candidates;
|
|
202
|
-
rawItems.changed.connect(transfer);
|
|
203
|
-
// Force initialization of items
|
|
204
|
-
transfer(rawItems, {
|
|
205
|
-
type: 'add',
|
|
206
|
-
newIndex: 0,
|
|
207
|
-
newValues: [],
|
|
208
|
-
oldIndex: 0,
|
|
209
|
-
oldValues: []
|
|
210
|
-
});
|
|
211
|
-
})
|
|
212
|
-
.catch(reason => {
|
|
203
|
+
setToolbarItems(items, settingsRegistry, factoryName, pluginId, translator, propertyId).catch(reason => {
|
|
213
204
|
console.error(`Failed to load toolbar items for factory ${factoryName} from ${pluginId}`, reason);
|
|
214
205
|
});
|
|
215
|
-
return (widget) =>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
206
|
+
return (widget) => {
|
|
207
|
+
const updateToolbar = (list, change) => {
|
|
208
|
+
switch (change.type) {
|
|
209
|
+
case 'move':
|
|
210
|
+
toolbar.move(change.oldIndex, change.newIndex);
|
|
211
|
+
break;
|
|
212
|
+
case 'add':
|
|
213
|
+
change.newValues.forEach(item => toolbar.push({
|
|
214
|
+
name: item.name,
|
|
215
|
+
widget: toolbarRegistry.createWidget(factoryName, widget, item)
|
|
216
|
+
}));
|
|
217
|
+
break;
|
|
218
|
+
case 'remove':
|
|
219
|
+
change.oldValues.forEach(() => toolbar.remove(change.oldIndex));
|
|
220
|
+
break;
|
|
221
|
+
case 'set':
|
|
222
|
+
change.newValues.forEach(item => toolbar.set(change.newIndex, {
|
|
223
|
+
name: item.name,
|
|
224
|
+
widget: toolbarRegistry.createWidget(factoryName, widget, item)
|
|
225
|
+
}));
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
219
228
|
};
|
|
220
|
-
|
|
229
|
+
const toolbar = new ObservableList({
|
|
230
|
+
values: Array.from(items).map(item => {
|
|
231
|
+
return {
|
|
232
|
+
name: item.name,
|
|
233
|
+
widget: toolbarRegistry.createWidget(factoryName, widget, item)
|
|
234
|
+
};
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
|
+
items.changed.connect(updateToolbar);
|
|
238
|
+
widget.disposed.connect(() => {
|
|
239
|
+
items.changed.disconnect(updateToolbar);
|
|
240
|
+
});
|
|
241
|
+
return toolbar;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Set the toolbar items of a widget from a factory
|
|
246
|
+
*
|
|
247
|
+
* @param widget Widget with the toolbar to set
|
|
248
|
+
* @param factory Toolbar items factory
|
|
249
|
+
* @param toolbar Separated toolbar if widget is a raw widget
|
|
250
|
+
*/
|
|
251
|
+
export function setToolbar(widget, factory, toolbar) {
|
|
252
|
+
var _a;
|
|
253
|
+
// @ts-expect-error Widget has no toolbar
|
|
254
|
+
if (!widget.toolbar && !toolbar) {
|
|
255
|
+
console.log(`Widget ${widget.id} has no 'toolbar' and no explicit toolbar was provided.`);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
// @ts-expect-error Widget has no toolbar
|
|
259
|
+
const toolbar_ = (_a = widget.toolbar) !== null && _a !== void 0 ? _a : toolbar;
|
|
260
|
+
const items = factory(widget);
|
|
261
|
+
if (Array.isArray(items)) {
|
|
262
|
+
items.forEach(({ name, widget: item }) => {
|
|
263
|
+
toolbar_.addItem(name, item);
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
const updateToolbar = (list, changes) => {
|
|
268
|
+
switch (changes.type) {
|
|
269
|
+
case 'add':
|
|
270
|
+
changes.newValues.forEach((item, index) => {
|
|
271
|
+
toolbar_.insertItem(changes.newIndex + index, item.name, item.widget);
|
|
272
|
+
});
|
|
273
|
+
break;
|
|
274
|
+
case 'move':
|
|
275
|
+
changes.oldValues.forEach(item => {
|
|
276
|
+
item.widget.parent = null;
|
|
277
|
+
});
|
|
278
|
+
changes.newValues.forEach((item, index) => {
|
|
279
|
+
toolbar_.insertItem(changes.newIndex + index, item.name, item.widget);
|
|
280
|
+
});
|
|
281
|
+
break;
|
|
282
|
+
case 'remove':
|
|
283
|
+
changes.oldValues.forEach(item => {
|
|
284
|
+
item.widget.parent = null;
|
|
285
|
+
});
|
|
286
|
+
break;
|
|
287
|
+
case 'set':
|
|
288
|
+
changes.oldValues.forEach(item => {
|
|
289
|
+
item.widget.parent = null;
|
|
290
|
+
});
|
|
291
|
+
changes.newValues.forEach((item, index) => {
|
|
292
|
+
const existingIndex = findIndex(toolbar_.names(), name => item.name === name);
|
|
293
|
+
if (existingIndex >= 0) {
|
|
294
|
+
Array.from(toolbar_.children())[existingIndex].parent = null;
|
|
295
|
+
}
|
|
296
|
+
toolbar_.insertItem(changes.newIndex + index, item.name, item.widget);
|
|
297
|
+
});
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
updateToolbar(items, {
|
|
302
|
+
newIndex: 0,
|
|
303
|
+
newValues: Array.from(items),
|
|
304
|
+
oldIndex: 0,
|
|
305
|
+
oldValues: [],
|
|
306
|
+
type: 'add'
|
|
307
|
+
});
|
|
308
|
+
items.changed.connect(updateToolbar);
|
|
309
|
+
widget.disposed.connect(() => {
|
|
310
|
+
items.changed.disconnect(updateToolbar);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
221
313
|
}
|
|
222
314
|
//# sourceMappingURL=factory.js.map
|