@theia/core 1.18.0 → 1.19.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/README.md +3 -2
- package/lib/browser/about-dialog.d.ts.map +1 -1
- package/lib/browser/about-dialog.js +1 -1
- package/lib/browser/about-dialog.js.map +1 -1
- package/lib/browser/authentication-service.d.ts.map +1 -1
- package/lib/browser/authentication-service.js +1 -1
- package/lib/browser/authentication-service.js.map +1 -1
- package/lib/browser/common-frontend-contribution.d.ts +6 -0
- package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/common-frontend-contribution.js +122 -118
- package/lib/browser/common-frontend-contribution.js.map +1 -1
- package/lib/browser/core-preferences.d.ts +1 -0
- package/lib/browser/core-preferences.d.ts.map +1 -1
- package/lib/browser/core-preferences.js +25 -18
- package/lib/browser/core-preferences.js.map +1 -1
- package/lib/browser/dialogs.d.ts +6 -0
- package/lib/browser/dialogs.d.ts.map +1 -1
- package/lib/browser/dialogs.js +10 -3
- package/lib/browser/dialogs.js.map +1 -1
- package/lib/browser/frontend-application-module.d.ts.map +1 -1
- package/lib/browser/frontend-application-module.js +3 -0
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/frontend-application.d.ts +6 -0
- package/lib/browser/frontend-application.d.ts.map +1 -1
- package/lib/browser/frontend-application.js +13 -0
- package/lib/browser/frontend-application.js.map +1 -1
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +1 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js +16 -11
- package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js.map +1 -1
- package/lib/browser/menu/browser-context-menu-renderer.d.ts +1 -1
- package/lib/browser/menu/browser-context-menu-renderer.d.ts.map +1 -1
- package/lib/browser/menu/browser-menu-plugin.d.ts +3 -0
- package/lib/browser/menu/browser-menu-plugin.d.ts.map +1 -1
- package/lib/browser/menu/browser-menu-plugin.js +24 -4
- package/lib/browser/menu/browser-menu-plugin.js.map +1 -1
- package/lib/browser/nls-loader.d.ts +17 -0
- package/lib/browser/nls-loader.d.ts.map +1 -0
- package/lib/browser/nls-loader.js +29 -0
- package/lib/browser/nls-loader.js.map +1 -0
- package/lib/browser/progress-status-bar-item.d.ts +1 -2
- package/lib/browser/progress-status-bar-item.d.ts.map +1 -1
- package/lib/browser/progress-status-bar-item.js.map +1 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.js +2 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.js.map +1 -1
- package/lib/browser/quick-input/quick-command-service.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-command-service.js +2 -2
- package/lib/browser/quick-input/quick-command-service.js.map +1 -1
- package/lib/browser/quick-input/quick-view-service.d.ts +1 -2
- package/lib/browser/quick-input/quick-view-service.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-view-service.js.map +1 -1
- package/lib/browser/shell/application-shell.d.ts +3 -1
- package/lib/browser/shell/application-shell.d.ts.map +1 -1
- package/lib/browser/shell/application-shell.js +1 -2
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/shell/shell-layout-restorer.d.ts.map +1 -1
- package/lib/browser/shell/shell-layout-restorer.js +5 -3
- package/lib/browser/shell/shell-layout-restorer.js.map +1 -1
- package/lib/browser/shell/tab-bar-decorator.d.ts +1 -1
- package/lib/browser/shell/tab-bar-decorator.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-decorator.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar.js +2 -1
- package/lib/browser/shell/tab-bar-toolbar.js.map +1 -1
- package/lib/browser/shell/tab-bars.d.ts +14 -1
- package/lib/browser/shell/tab-bars.d.ts.map +1 -1
- package/lib/browser/shell/tab-bars.js +99 -7
- package/lib/browser/shell/tab-bars.js.map +1 -1
- package/lib/browser/tooltip-service.d.ts +52 -0
- package/lib/browser/tooltip-service.d.ts.map +1 -0
- package/lib/browser/tooltip-service.js +89 -0
- package/lib/browser/tooltip-service.js.map +1 -0
- package/lib/browser/tree/tree-model.d.ts.map +1 -1
- package/lib/browser/view-container.d.ts +55 -14
- package/lib/browser/view-container.d.ts.map +1 -1
- package/lib/browser/view-container.js +284 -66
- package/lib/browser/view-container.js.map +1 -1
- package/lib/browser/window/default-window-service.js +2 -2
- package/lib/browser/window/default-window-service.js.map +1 -1
- package/lib/browser/window/window-service.d.ts +1 -7
- package/lib/browser/window/window-service.d.ts.map +1 -1
- package/lib/browser/window/window-service.js +1 -5
- package/lib/browser/window/window-service.js.map +1 -1
- package/lib/browser/window-contribution.d.ts.map +1 -1
- package/lib/browser/window-contribution.js +2 -2
- package/lib/browser/window-contribution.js.map +1 -1
- package/lib/common/command.d.ts.map +1 -1
- package/lib/common/command.js +1 -2
- package/lib/common/command.js.map +1 -1
- package/lib/common/i18n/localization.d.ts +5 -0
- package/lib/common/i18n/localization.d.ts.map +1 -1
- package/lib/common/i18n/localization.js +43 -1
- package/lib/common/i18n/localization.js.map +1 -1
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -0
- package/lib/common/index.js.map +1 -1
- package/lib/{browser → common}/nls.d.ts +3 -2
- package/lib/common/nls.d.ts.map +1 -0
- package/lib/common/nls.js +29 -0
- package/lib/common/nls.js.map +1 -0
- package/lib/common/window.d.ts +29 -0
- package/lib/common/window.d.ts.map +1 -0
- package/lib/common/window.js +23 -0
- package/lib/common/window.js.map +1 -0
- package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts +9 -5
- package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-context-menu-renderer.js +40 -15
- package/lib/electron-browser/menu/electron-context-menu-renderer.js.map +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +5 -8
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.js +10 -17
- package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.d.ts +15 -7
- package/lib/electron-browser/menu/electron-menu-contribution.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.js +112 -42
- package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
- package/lib/electron-browser/window/electron-window-preferences.d.ts +1 -0
- package/lib/electron-browser/window/electron-window-preferences.d.ts.map +1 -1
- package/lib/electron-browser/window/electron-window-preferences.js +12 -1
- package/lib/electron-browser/window/electron-window-preferences.js.map +1 -1
- package/lib/electron-browser/window/electron-window-service.d.ts +1 -1
- package/lib/electron-browser/window/electron-window-service.d.ts.map +1 -1
- package/lib/electron-common/electron-main-window-service.d.ts +1 -1
- package/lib/electron-common/electron-main-window-service.d.ts.map +1 -1
- package/lib/electron-common/electron-main-window-service.js.map +1 -1
- package/lib/electron-common/messaging/electron-messages.d.ts +20 -0
- package/lib/electron-common/messaging/electron-messages.d.ts.map +1 -0
- package/lib/electron-common/messaging/electron-messages.js +23 -0
- package/lib/electron-common/messaging/electron-messages.js.map +1 -0
- package/lib/electron-main/electron-main-application.d.ts +6 -0
- package/lib/electron-main/electron-main-application.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application.js +80 -24
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-main/electron-main-window-service-impl.d.ts +1 -1
- package/lib/electron-main/electron-main-window-service-impl.d.ts.map +1 -1
- package/lib/electron-main/electron-main-window-service-impl.js.map +1 -1
- package/lib/electron-main/messaging/electron-messaging-contribution.d.ts +1 -1
- package/lib/electron-main/messaging/electron-messaging-contribution.d.ts.map +1 -1
- package/lib/electron-main/messaging/electron-messaging-contribution.js +1 -2
- package/lib/electron-main/messaging/electron-messaging-contribution.js.map +1 -1
- package/package.json +6 -4
- package/shared/@theia/application-package/lib/api.d.ts +1 -0
- package/shared/@theia/application-package/lib/api.js +1 -0
- package/src/browser/about-dialog.tsx +2 -2
- package/src/browser/authentication-service.ts +1 -2
- package/src/browser/common-frontend-contribution.ts +99 -95
- package/src/browser/core-preferences.ts +28 -18
- package/src/browser/dialogs.ts +10 -3
- package/src/browser/frontend-application-module.ts +4 -0
- package/src/browser/frontend-application.ts +13 -0
- package/src/browser/index.ts +1 -0
- package/src/browser/keyboard/browser-keyboard-frontend-contribution.ts +16 -11
- package/src/browser/menu/browser-context-menu-renderer.ts +1 -1
- package/src/browser/menu/browser-menu-plugin.ts +25 -5
- package/src/browser/nls-loader.ts +26 -0
- package/src/browser/progress-status-bar-item.ts +1 -2
- package/src/browser/quick-input/quick-command-frontend-contribution.ts +2 -2
- package/src/browser/quick-input/quick-command-service.ts +2 -2
- package/src/browser/quick-input/quick-view-service.ts +1 -2
- package/src/browser/shell/application-shell.ts +4 -3
- package/src/browser/shell/shell-layout-restorer.ts +4 -3
- package/src/browser/shell/tab-bar-decorator.ts +1 -1
- package/src/browser/shell/tab-bar-toolbar.tsx +3 -1
- package/src/browser/shell/tab-bars.ts +103 -8
- package/src/browser/style/index.css +5 -0
- package/src/browser/style/sidepanel.css +8 -2
- package/src/browser/style/tabs.css +30 -0
- package/src/browser/style/tooltip.css +28 -0
- package/src/browser/style/view-container.css +9 -9
- package/src/browser/tooltip-service.tsx +98 -0
- package/src/browser/tree/tree-model.ts +1 -1
- package/src/browser/view-container.ts +312 -80
- package/src/browser/window/default-window-service.ts +1 -1
- package/src/browser/window/window-service.ts +1 -9
- package/src/browser/window-contribution.ts +2 -2
- package/src/common/command.ts +1 -2
- package/src/common/i18n/localization.ts +44 -0
- package/src/common/index.ts +1 -0
- package/src/common/nls.ts +30 -0
- package/src/common/window.ts +30 -0
- package/src/electron-browser/menu/electron-context-menu-renderer.ts +38 -16
- package/src/electron-browser/menu/electron-main-menu-factory.ts +10 -15
- package/src/electron-browser/menu/electron-menu-contribution.ts +129 -39
- package/src/electron-browser/menu/electron-menu-style.css +84 -0
- package/src/electron-browser/window/electron-window-preferences.ts +13 -1
- package/src/electron-browser/window/electron-window-service.ts +1 -1
- package/src/electron-common/electron-main-window-service.ts +1 -2
- package/src/electron-common/messaging/electron-messages.ts +20 -0
- package/src/electron-main/electron-main-application.ts +85 -21
- package/src/electron-main/electron-main-window-service-impl.ts +1 -2
- package/src/electron-main/messaging/electron-messaging-contribution.ts +1 -2
- package/lib/browser/nls.d.ts.map +0 -1
- package/lib/browser/nls.js +0 -64
- package/lib/browser/nls.js.map +0 -1
- package/src/browser/nls.ts +0 -65
|
@@ -38,10 +38,15 @@ const theia_dock_panel_1 = require("./shell/theia-dock-panel");
|
|
|
38
38
|
const frontend_application_state_1 = require("./frontend-application-state");
|
|
39
39
|
const context_menu_renderer_1 = require("./context-menu-renderer");
|
|
40
40
|
const browser_1 = require("./browser");
|
|
41
|
-
const widget_manager_1 = require("./widget-manager");
|
|
42
41
|
const tab_bar_toolbar_1 = require("./shell/tab-bar-toolbar");
|
|
42
|
+
const common_1 = require("../common");
|
|
43
|
+
const widget_manager_1 = require("./widget-manager");
|
|
43
44
|
const keys_1 = require("./keys");
|
|
44
45
|
const progress_bar_factory_1 = require("./progress-bar-factory");
|
|
46
|
+
const dragdrop_1 = require("@phosphor/dragdrop");
|
|
47
|
+
const coreutils_1 = require("@phosphor/coreutils");
|
|
48
|
+
const domutils_1 = require("@phosphor/domutils");
|
|
49
|
+
const tab_bar_decorator_1 = require("./shell/tab-bar-decorator");
|
|
45
50
|
let ViewContainerIdentifier = class ViewContainerIdentifier {
|
|
46
51
|
};
|
|
47
52
|
ViewContainerIdentifier = __decorate([
|
|
@@ -63,12 +68,17 @@ var DescriptionWidget;
|
|
|
63
68
|
let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.BaseWidget {
|
|
64
69
|
constructor() {
|
|
65
70
|
super(...arguments);
|
|
71
|
+
/**
|
|
72
|
+
* Disable dragging parts from/to this view container.
|
|
73
|
+
*/
|
|
74
|
+
this.disableDNDBetweenContainers = false;
|
|
66
75
|
this.onDidChangeTrackableWidgetsEmitter = new event_1.Emitter();
|
|
67
76
|
this.onDidChangeTrackableWidgets = this.onDidChangeTrackableWidgetsEmitter.event;
|
|
68
77
|
this.toDisposeOnCurrentPart = new disposable_1.DisposableCollection();
|
|
69
78
|
this.toDisposeOnUpdateTitle = new disposable_1.DisposableCollection();
|
|
70
79
|
this._tabBarDelegate = this;
|
|
71
80
|
this.toRemoveWidgets = new Map();
|
|
81
|
+
this.toDisposeOnDragEnd = new disposable_1.DisposableCollection();
|
|
72
82
|
}
|
|
73
83
|
init() {
|
|
74
84
|
this.id = this.options.id;
|
|
@@ -116,7 +126,8 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
116
126
|
commandId: this.globalHideCommandId,
|
|
117
127
|
label: 'Hide'
|
|
118
128
|
}),
|
|
119
|
-
this.onDidChangeTrackableWidgetsEmitter
|
|
129
|
+
this.onDidChangeTrackableWidgetsEmitter,
|
|
130
|
+
this.onDidChangeTrackableWidgets(() => this.decoratorService.fireDidChangeDecorations())
|
|
120
131
|
]);
|
|
121
132
|
if (this.options.progressLocationId) {
|
|
122
133
|
this.toDispose.push(this.progressBarFactory({ container: this.node, insertMode: 'prepend', locationId: this.options.progressLocationId }));
|
|
@@ -156,28 +167,48 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
156
167
|
this.toDisposeOnUpdateTitle.dispose();
|
|
157
168
|
this.toDispose.push(this.toDisposeOnUpdateTitle);
|
|
158
169
|
this.updateTabBarDelegate();
|
|
159
|
-
|
|
160
|
-
if (
|
|
170
|
+
let title = Object.assign({}, this.titleOptions);
|
|
171
|
+
if (common_1.isEmpty(title)) {
|
|
161
172
|
return;
|
|
162
173
|
}
|
|
163
174
|
const allParts = this.getParts();
|
|
164
175
|
const visibleParts = allParts.filter(part => !part.isHidden);
|
|
165
176
|
this.title.label = title.label;
|
|
166
|
-
|
|
177
|
+
// If there's only one visible part - inline it's title into the container title except in case the part
|
|
178
|
+
// isn't originally belongs to this container but there are other **original** hidden parts.
|
|
179
|
+
if (visibleParts.length === 1 && (visibleParts[0].originalContainerId === this.id || !this.findOriginalPart())) {
|
|
167
180
|
const part = visibleParts[0];
|
|
168
181
|
this.toDisposeOnUpdateTitle.push(part.onTitleChanged(() => this.updateTitle()));
|
|
169
182
|
const partLabel = part.wrapped.title.label;
|
|
183
|
+
// Change the container title if it contains only one part that originally belongs to another container.
|
|
184
|
+
if (allParts.length === 1 && part.originalContainerId !== this.id && !this.isCurrentTitle(part.originalContainerTitle)) {
|
|
185
|
+
title = Object.assign({}, part.originalContainerTitle);
|
|
186
|
+
this.setTitleOptions(title);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
170
189
|
if (partLabel) {
|
|
171
|
-
this.title.label
|
|
190
|
+
if (this.title.label && this.title.label !== partLabel) {
|
|
191
|
+
this.title.label += ': ' + partLabel;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.title.label = partLabel;
|
|
195
|
+
}
|
|
172
196
|
}
|
|
173
197
|
part.collapsed = false;
|
|
174
198
|
part.hideTitle();
|
|
175
199
|
}
|
|
176
200
|
else {
|
|
177
201
|
visibleParts.forEach(part => part.showTitle());
|
|
202
|
+
// If at least one part originally belongs to this container the title should return to its original value.
|
|
203
|
+
const originalPart = this.findOriginalPart();
|
|
204
|
+
if (originalPart && !this.isCurrentTitle(originalPart.originalContainerTitle)) {
|
|
205
|
+
title = Object.assign({}, originalPart.originalContainerTitle);
|
|
206
|
+
this.setTitleOptions(title);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
178
209
|
}
|
|
179
210
|
this.updateToolbarItems(allParts);
|
|
180
|
-
const caption = title.caption || title.label;
|
|
211
|
+
const caption = (title === null || title === void 0 ? void 0 : title.caption) || (title === null || title === void 0 ? void 0 : title.label);
|
|
181
212
|
if (caption) {
|
|
182
213
|
this.title.caption = caption;
|
|
183
214
|
if (visibleParts.length === 1) {
|
|
@@ -221,6 +252,14 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
221
252
|
this.toDisposeOnUpdateTitle.push(this.toolbarRegistry.registerItem(Object.assign(Object.assign({}, options), { id: newId, command: newId })));
|
|
222
253
|
}
|
|
223
254
|
}
|
|
255
|
+
findOriginalPart() {
|
|
256
|
+
return this.getParts().find(part => part.originalContainerId === this.id);
|
|
257
|
+
}
|
|
258
|
+
isCurrentTitle(titleOptions) {
|
|
259
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
260
|
+
return (!!titleOptions && !!this.titleOptions && Object.keys(titleOptions).every(key => titleOptions[key] === this.titleOptions[key]))
|
|
261
|
+
|| (!titleOptions && !this.titleOptions);
|
|
262
|
+
}
|
|
224
263
|
findPartForAnchor(anchor) {
|
|
225
264
|
const element = document.elementFromPoint(anchor.x, anchor.y);
|
|
226
265
|
if (element instanceof Element) {
|
|
@@ -231,21 +270,27 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
231
270
|
}
|
|
232
271
|
return undefined;
|
|
233
272
|
}
|
|
234
|
-
|
|
273
|
+
createPartId(widget) {
|
|
274
|
+
const description = this.widgetManager.getDescription(widget);
|
|
275
|
+
return widget.id || JSON.stringify(description);
|
|
276
|
+
}
|
|
277
|
+
addWidget(widget, options, originalContainerId, originalContainerTitle) {
|
|
235
278
|
const existing = this.toRemoveWidgets.get(widget.id);
|
|
236
279
|
if (existing) {
|
|
237
280
|
return existing;
|
|
238
281
|
}
|
|
282
|
+
const partId = this.createPartId(widget);
|
|
283
|
+
const newPart = this.createPart(widget, partId, originalContainerId || this.id, originalContainerTitle || this.titleOptions, options);
|
|
284
|
+
return this.attachNewPart(newPart);
|
|
285
|
+
}
|
|
286
|
+
attachNewPart(newPart, insertIndex) {
|
|
239
287
|
const toRemoveWidget = new disposable_1.DisposableCollection();
|
|
240
288
|
this.toDispose.push(toRemoveWidget);
|
|
241
|
-
this.toRemoveWidgets.set(
|
|
242
|
-
toRemoveWidget.push(disposable_1.Disposable.create(() => this.toRemoveWidgets.delete(
|
|
243
|
-
const description = this.widgetManager.getDescription(widget);
|
|
244
|
-
const partId = description ? JSON.stringify(description) : widget.id;
|
|
245
|
-
const newPart = this.createPart(widget, partId, options);
|
|
289
|
+
this.toRemoveWidgets.set(newPart.wrapped.id, toRemoveWidget);
|
|
290
|
+
toRemoveWidget.push(disposable_1.Disposable.create(() => this.toRemoveWidgets.delete(newPart.wrapped.id)));
|
|
246
291
|
this.registerPart(newPart);
|
|
247
|
-
if (newPart.options && newPart.options.order !== undefined) {
|
|
248
|
-
const index = this.getParts().findIndex(part => part.options.order === undefined || part.options.order > newPart.options.order);
|
|
292
|
+
if (insertIndex !== undefined || (newPart.options && newPart.options.order !== undefined)) {
|
|
293
|
+
const index = insertIndex !== null && insertIndex !== void 0 ? insertIndex : this.getParts().findIndex(part => part.options.order === undefined || part.options.order > newPart.options.order);
|
|
249
294
|
if (index >= 0) {
|
|
250
295
|
this.containerLayout.insertWidget(index, newPart);
|
|
251
296
|
}
|
|
@@ -262,10 +307,12 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
262
307
|
this.update();
|
|
263
308
|
this.fireDidChangeTrackableWidgets();
|
|
264
309
|
toRemoveWidget.pushAll([
|
|
265
|
-
newPart,
|
|
266
310
|
disposable_1.Disposable.create(() => {
|
|
311
|
+
if (newPart.currentViewContainerId === this.id) {
|
|
312
|
+
newPart.dispose();
|
|
313
|
+
}
|
|
267
314
|
this.unregisterPart(newPart);
|
|
268
|
-
if (!newPart.isDisposed) {
|
|
315
|
+
if (!newPart.isDisposed && this.getPartIndex(newPart.id) > -1) {
|
|
269
316
|
this.containerLayout.removeWidget(newPart);
|
|
270
317
|
}
|
|
271
318
|
if (!this.isDisposed) {
|
|
@@ -297,8 +344,8 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
297
344
|
newPart.disposed.connect(() => toRemoveWidget.dispose());
|
|
298
345
|
return toRemoveWidget;
|
|
299
346
|
}
|
|
300
|
-
createPart(widget, partId, options) {
|
|
301
|
-
return new ViewContainerPart(widget, partId, this.id, this.toolbarRegistry, this.toolbarFactory, options);
|
|
347
|
+
createPart(widget, partId, originalContainerId, originalContainerTitle, options) {
|
|
348
|
+
return new ViewContainerPart(widget, partId, this.id, originalContainerId, originalContainerTitle, this.toolbarRegistry, this.toolbarFactory, options);
|
|
302
349
|
}
|
|
303
350
|
removeWidget(widget) {
|
|
304
351
|
const disposable = this.toRemoveWidgets.get(widget.id);
|
|
@@ -311,6 +358,12 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
311
358
|
getParts() {
|
|
312
359
|
return this.containerLayout.widgets;
|
|
313
360
|
}
|
|
361
|
+
getPartIndex(partId) {
|
|
362
|
+
if (partId) {
|
|
363
|
+
return this.getParts().findIndex(part => part.id === partId);
|
|
364
|
+
}
|
|
365
|
+
return -1;
|
|
366
|
+
}
|
|
314
367
|
getPartFor(widget) {
|
|
315
368
|
return this.getParts().find(p => p.wrapped.id === widget.id);
|
|
316
369
|
}
|
|
@@ -347,7 +400,9 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
347
400
|
partId: part.partId,
|
|
348
401
|
collapsed: part.collapsed,
|
|
349
402
|
hidden: part.isHidden,
|
|
350
|
-
relativeSize: size && availableSize ? size / availableSize : undefined
|
|
403
|
+
relativeSize: size && availableSize ? size / availableSize : undefined,
|
|
404
|
+
originalContainerId: part.originalContainerId,
|
|
405
|
+
originalContainerTitle: part.originalContainerTitle
|
|
351
406
|
};
|
|
352
407
|
});
|
|
353
408
|
return { parts: partStates, title: this.titleOptions };
|
|
@@ -361,14 +416,14 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
361
416
|
// restore widgets
|
|
362
417
|
for (const part of state.parts) {
|
|
363
418
|
if (part.widget) {
|
|
364
|
-
this.addWidget(part.widget);
|
|
419
|
+
this.addWidget(part.widget, undefined, part.originalContainerId, part.originalContainerTitle || {});
|
|
365
420
|
}
|
|
366
421
|
}
|
|
367
422
|
const partStates = state.parts.filter(partState => algorithm_1.some(this.containerLayout.iter(), p => p.partId === partState.partId));
|
|
368
423
|
// Reorder the parts according to the stored state
|
|
369
424
|
for (let index = 0; index < partStates.length; index++) {
|
|
370
425
|
const partState = partStates[index];
|
|
371
|
-
const currentIndex = this.getParts().findIndex(
|
|
426
|
+
const currentIndex = this.getParts().findIndex(part => part.partId === partState.partId);
|
|
372
427
|
if (currentIndex > index) {
|
|
373
428
|
this.containerLayout.moveWidget(currentIndex, index, this.getParts()[currentIndex]);
|
|
374
429
|
}
|
|
@@ -477,6 +532,7 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
477
532
|
return undefined;
|
|
478
533
|
}
|
|
479
534
|
this.updateCurrentPart(part);
|
|
535
|
+
part.collapsed = false;
|
|
480
536
|
return part.wrapped;
|
|
481
537
|
}
|
|
482
538
|
revealWidget(id) {
|
|
@@ -516,54 +572,165 @@ let ViewContainer = ViewContainer_1 = class ViewContainer extends widgets_1.Base
|
|
|
516
572
|
}
|
|
517
573
|
onAfterShow(msg) {
|
|
518
574
|
super.onAfterShow(msg);
|
|
575
|
+
this.updateTitle();
|
|
519
576
|
this.lastVisibleState = undefined;
|
|
520
577
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
578
|
+
onBeforeAttach(msg) {
|
|
579
|
+
super.onBeforeAttach(msg);
|
|
580
|
+
this.node.addEventListener('p-dragenter', this, true);
|
|
581
|
+
this.node.addEventListener('p-dragover', this, true);
|
|
582
|
+
this.node.addEventListener('p-dragleave', this, true);
|
|
583
|
+
this.node.addEventListener('p-drop', this, true);
|
|
584
|
+
}
|
|
585
|
+
onAfterDetach(msg) {
|
|
586
|
+
super.onAfterDetach(msg);
|
|
587
|
+
this.node.removeEventListener('p-dragenter', this, true);
|
|
588
|
+
this.node.removeEventListener('p-dragover', this, true);
|
|
589
|
+
this.node.removeEventListener('p-dragleave', this, true);
|
|
590
|
+
this.node.removeEventListener('p-drop', this, true);
|
|
591
|
+
}
|
|
592
|
+
handleEvent(event) {
|
|
593
|
+
switch (event.type) {
|
|
594
|
+
case 'p-dragenter':
|
|
595
|
+
this.handleDragEnter(event);
|
|
596
|
+
break;
|
|
597
|
+
case 'p-dragover':
|
|
598
|
+
this.handleDragOver(event);
|
|
599
|
+
break;
|
|
600
|
+
case 'p-dragleave':
|
|
601
|
+
this.handleDragLeave(event);
|
|
602
|
+
break;
|
|
603
|
+
case 'p-drop':
|
|
604
|
+
this.handleDrop(event);
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
handleDragEnter(event) {
|
|
609
|
+
if (event.mimeData.hasData('application/vnd.phosphor.view-container-factory')) {
|
|
527
610
|
event.preventDefault();
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
611
|
+
event.stopPropagation();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
handleDragOver(event) {
|
|
615
|
+
var _a;
|
|
616
|
+
const factory = event.mimeData.getData('application/vnd.phosphor.view-container-factory');
|
|
617
|
+
const widget = factory && factory();
|
|
618
|
+
if (!(widget instanceof ViewContainerPart)) {
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
event.preventDefault();
|
|
622
|
+
event.stopPropagation();
|
|
623
|
+
const sameContainers = this.id === widget.currentViewContainerId;
|
|
624
|
+
const targetPart = algorithm_1.ArrayExt.findFirstValue(this.getParts(), (p => domutils_1.ElementExt.hitTest(p.node, event.clientX, event.clientY)));
|
|
625
|
+
if (!targetPart && sameContainers) {
|
|
626
|
+
event.dropAction = 'none';
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (targetPart) {
|
|
630
|
+
// add overlay class style to the `targetPart` node.
|
|
631
|
+
targetPart.node.classList.add('drop-target');
|
|
632
|
+
this.toDisposeOnDragEnd.push(disposable_1.Disposable.create(() => targetPart.node.classList.remove('drop-target')));
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
// show panel overlay.
|
|
636
|
+
const dockPanel = this.getDockPanel();
|
|
637
|
+
if (dockPanel) {
|
|
638
|
+
dockPanel.overlay.show({ top: 0, bottom: 0, right: 0, left: 0 });
|
|
639
|
+
this.toDisposeOnDragEnd.push(disposable_1.Disposable.create(() => dockPanel.overlay.hide(100)));
|
|
531
640
|
}
|
|
532
|
-
}
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
|
|
641
|
+
}
|
|
642
|
+
const isDraggingOutsideDisabled = this.disableDNDBetweenContainers || ((_a = widget.viewContainer) === null || _a === void 0 ? void 0 : _a.disableDNDBetweenContainers)
|
|
643
|
+
|| widget.options.disableDraggingToOtherContainers;
|
|
644
|
+
if (isDraggingOutsideDisabled && !sameContainers) {
|
|
645
|
+
const { target } = event;
|
|
646
|
+
if (target instanceof HTMLElement) {
|
|
647
|
+
target.classList.add('theia-cursor-no-drop');
|
|
648
|
+
this.toDisposeOnDragEnd.push(disposable_1.Disposable.create(() => {
|
|
649
|
+
target.classList.remove('theia-cursor-no-drop');
|
|
650
|
+
}));
|
|
536
651
|
}
|
|
652
|
+
event.dropAction = 'none';
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
;
|
|
656
|
+
event.dropAction = event.proposedAction;
|
|
657
|
+
}
|
|
658
|
+
;
|
|
659
|
+
handleDragLeave(event) {
|
|
660
|
+
this.toDisposeOnDragEnd.dispose();
|
|
661
|
+
if (event.mimeData.hasData('application/vnd.phosphor.view-container-factory')) {
|
|
537
662
|
event.preventDefault();
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
663
|
+
event.stopPropagation();
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
;
|
|
667
|
+
handleDrop(event) {
|
|
668
|
+
this.toDisposeOnDragEnd.dispose();
|
|
669
|
+
const factory = event.mimeData.getData('application/vnd.phosphor.view-container-factory');
|
|
670
|
+
const draggedPart = factory && factory();
|
|
671
|
+
if (!(draggedPart instanceof ViewContainerPart)) {
|
|
672
|
+
event.dropAction = 'none';
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
event.preventDefault();
|
|
676
|
+
event.stopPropagation();
|
|
677
|
+
const parts = this.getParts();
|
|
678
|
+
const toIndex = algorithm_1.ArrayExt.findFirstIndex(parts, part => domutils_1.ElementExt.hitTest(part.node, event.clientX, event.clientY));
|
|
679
|
+
if (draggedPart.currentViewContainerId !== this.id) {
|
|
680
|
+
this.attachNewPart(draggedPart, toIndex > -1 ? toIndex + 1 : toIndex);
|
|
681
|
+
draggedPart.onPartMoved(this);
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
this.moveBefore(draggedPart.id, parts[toIndex].id);
|
|
685
|
+
}
|
|
686
|
+
event.dropAction = event.proposedAction;
|
|
687
|
+
}
|
|
688
|
+
registerDND(part) {
|
|
689
|
+
part.headerElement.draggable = true;
|
|
690
|
+
return new disposable_1.DisposableCollection(widgets_1.addEventListener(part.headerElement, 'dragstart', event => {
|
|
691
|
+
event.preventDefault();
|
|
692
|
+
const mimeData = new coreutils_1.MimeData();
|
|
693
|
+
mimeData.setData('application/vnd.phosphor.view-container-factory', () => part);
|
|
694
|
+
const clonedHeader = part.headerElement.cloneNode(true);
|
|
695
|
+
clonedHeader.style.width = part.node.style.width;
|
|
696
|
+
clonedHeader.style.opacity = '0.6';
|
|
697
|
+
const drag = new dragdrop_1.Drag({
|
|
698
|
+
mimeData,
|
|
699
|
+
dragImage: clonedHeader,
|
|
700
|
+
proposedAction: 'move',
|
|
701
|
+
supportedActions: 'move'
|
|
702
|
+
});
|
|
703
|
+
part.node.classList.add('p-mod-hidden');
|
|
704
|
+
drag.start(event.clientX, event.clientY).then(dropAction => {
|
|
705
|
+
// The promise is resolved when the drag has ended
|
|
706
|
+
if (dropAction === 'move' && part.currentViewContainerId !== this.id) {
|
|
707
|
+
this.removeWidget(part.wrapped);
|
|
708
|
+
this.lastVisibleState = this.doStoreState();
|
|
562
709
|
}
|
|
563
|
-
|
|
564
|
-
}
|
|
710
|
+
});
|
|
711
|
+
setTimeout(() => { part.node.classList.remove('p-mod-hidden'); }, 0);
|
|
565
712
|
}, false));
|
|
566
713
|
}
|
|
714
|
+
getDockPanel() {
|
|
715
|
+
let panel;
|
|
716
|
+
let parent = this.parent;
|
|
717
|
+
while (!panel && parent) {
|
|
718
|
+
if (this.isSideDockPanel(parent)) {
|
|
719
|
+
panel = parent;
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
parent = parent.parent;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return panel;
|
|
726
|
+
}
|
|
727
|
+
isSideDockPanel(widget) {
|
|
728
|
+
const { leftPanelHandler, rightPanelHandler } = this.shell;
|
|
729
|
+
if (widget instanceof widgets_1.DockPanel && (widget.id === rightPanelHandler.dockPanel.id || widget.id === leftPanelHandler.dockPanel.id)) {
|
|
730
|
+
return true;
|
|
731
|
+
}
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
567
734
|
};
|
|
568
735
|
__decorate([
|
|
569
736
|
inversify_1.inject(frontend_application_state_1.FrontendApplicationStateService),
|
|
@@ -605,6 +772,14 @@ __decorate([
|
|
|
605
772
|
inversify_1.inject(progress_bar_factory_1.ProgressBarFactory),
|
|
606
773
|
__metadata("design:type", Function)
|
|
607
774
|
], ViewContainer.prototype, "progressBarFactory", void 0);
|
|
775
|
+
__decorate([
|
|
776
|
+
inversify_1.inject(shell_1.ApplicationShell),
|
|
777
|
+
__metadata("design:type", shell_1.ApplicationShell)
|
|
778
|
+
], ViewContainer.prototype, "shell", void 0);
|
|
779
|
+
__decorate([
|
|
780
|
+
inversify_1.inject(tab_bar_decorator_1.TabBarDecoratorService),
|
|
781
|
+
__metadata("design:type", tab_bar_decorator_1.TabBarDecoratorService)
|
|
782
|
+
], ViewContainer.prototype, "decoratorService", void 0);
|
|
608
783
|
__decorate([
|
|
609
784
|
inversify_1.postConstruct(),
|
|
610
785
|
__metadata("design:type", Function),
|
|
@@ -631,11 +806,14 @@ exports.ViewContainer = ViewContainer;
|
|
|
631
806
|
* title, toolbar, and collapse / expand handle.
|
|
632
807
|
*/
|
|
633
808
|
class ViewContainerPart extends widgets_1.BaseWidget {
|
|
634
|
-
constructor(wrapped, partId,
|
|
809
|
+
constructor(wrapped, partId, currentContainerId, originalContainerId, originalContainerTitle, toolbarRegistry, toolbarFactory, options = {}) {
|
|
635
810
|
var _a;
|
|
636
811
|
super();
|
|
637
812
|
this.wrapped = wrapped;
|
|
638
813
|
this.partId = partId;
|
|
814
|
+
this.currentContainerId = currentContainerId;
|
|
815
|
+
this.originalContainerId = originalContainerId;
|
|
816
|
+
this.originalContainerTitle = originalContainerTitle;
|
|
639
817
|
this.toolbarRegistry = toolbarRegistry;
|
|
640
818
|
this.toolbarFactory = toolbarFactory;
|
|
641
819
|
this.options = options;
|
|
@@ -649,12 +827,14 @@ class ViewContainerPart extends widgets_1.BaseWidget {
|
|
|
649
827
|
this.onTitleChanged = this.onTitleChangedEmitter.event;
|
|
650
828
|
this.onDidFocusEmitter = new event_1.Emitter();
|
|
651
829
|
this.onDidFocus = this.onDidFocusEmitter.event;
|
|
830
|
+
this.onPartMovedEmitter = new event_1.Emitter();
|
|
831
|
+
this.onDidMove = this.onPartMovedEmitter.event;
|
|
652
832
|
this.onDidChangeDescriptionEmitter = new event_1.Emitter();
|
|
653
833
|
this.onDidChangeDescription = this.onDidChangeDescriptionEmitter.event;
|
|
654
834
|
this.toShowHeader = new disposable_1.DisposableCollection();
|
|
655
835
|
wrapped.parent = this;
|
|
656
836
|
wrapped.disposed.connect(() => this.dispose());
|
|
657
|
-
this.id = `${
|
|
837
|
+
this.id = `${originalContainerId}--${wrapped.id}`;
|
|
658
838
|
this.addClass('part');
|
|
659
839
|
const fireTitleChanged = () => this.onTitleChangedEmitter.fire(undefined);
|
|
660
840
|
this.wrapped.title.changed.connect(fireTitleChanged);
|
|
@@ -691,6 +871,15 @@ class ViewContainerPart extends widgets_1.BaseWidget {
|
|
|
691
871
|
this.hide();
|
|
692
872
|
}
|
|
693
873
|
}
|
|
874
|
+
get viewContainer() {
|
|
875
|
+
return this.parent ? this.parent.parent : undefined;
|
|
876
|
+
}
|
|
877
|
+
get currentViewContainerId() {
|
|
878
|
+
return this.currentContainerId;
|
|
879
|
+
}
|
|
880
|
+
get headerElement() {
|
|
881
|
+
return this.header;
|
|
882
|
+
}
|
|
694
883
|
get collapsed() {
|
|
695
884
|
return this._collapsed;
|
|
696
885
|
}
|
|
@@ -718,6 +907,10 @@ class ViewContainerPart extends widgets_1.BaseWidget {
|
|
|
718
907
|
this.update();
|
|
719
908
|
this.collapsedEmitter.fire(collapsed);
|
|
720
909
|
}
|
|
910
|
+
onPartMoved(newContainer) {
|
|
911
|
+
this.currentContainerId = newContainer.id;
|
|
912
|
+
this.onPartMovedEmitter.fire(newContainer);
|
|
913
|
+
}
|
|
721
914
|
setHidden(hidden) {
|
|
722
915
|
if (!this.canHide) {
|
|
723
916
|
return;
|
|
@@ -787,7 +980,7 @@ class ViewContainerPart extends widgets_1.BaseWidget {
|
|
|
787
980
|
const disposable = new disposable_1.DisposableCollection();
|
|
788
981
|
const header = document.createElement('div');
|
|
789
982
|
header.tabIndex = 0;
|
|
790
|
-
header.classList.add('theia-header', 'header');
|
|
983
|
+
header.classList.add('theia-header', 'header', 'theia-view-container-part-header');
|
|
791
984
|
disposable.push(widgets_1.addEventListener(header, 'click', event => {
|
|
792
985
|
if (this.toolbar && this.toolbar.shouldHandleMouseEvent(event)) {
|
|
793
986
|
return;
|
|
@@ -807,7 +1000,16 @@ class ViewContainerPart extends widgets_1.BaseWidget {
|
|
|
807
1000
|
title.classList.add('label', 'noselect');
|
|
808
1001
|
const description = document.createElement('span');
|
|
809
1002
|
description.classList.add('description');
|
|
810
|
-
const updateTitle = () =>
|
|
1003
|
+
const updateTitle = () => {
|
|
1004
|
+
var _a;
|
|
1005
|
+
if (this.currentContainerId !== this.originalContainerId && ((_a = this.originalContainerTitle) === null || _a === void 0 ? void 0 : _a.label)) {
|
|
1006
|
+
// Creating a title in format: <original_container_title>: <part_title>.
|
|
1007
|
+
title.innerText = this.originalContainerTitle.label + ': ' + this.wrapped.title.label;
|
|
1008
|
+
}
|
|
1009
|
+
else {
|
|
1010
|
+
title.innerText = this.wrapped.title.label;
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
811
1013
|
const updateCaption = () => title.title = this.wrapped.title.caption || this.wrapped.title.label;
|
|
812
1014
|
const updateDescription = () => {
|
|
813
1015
|
description.innerText = DescriptionWidget.is(this.wrapped) && !this.collapsed && this.wrapped.description || '';
|
|
@@ -818,8 +1020,9 @@ class ViewContainerPart extends widgets_1.BaseWidget {
|
|
|
818
1020
|
disposable.pushAll([
|
|
819
1021
|
this.onTitleChanged(updateTitle),
|
|
820
1022
|
this.onTitleChanged(updateCaption),
|
|
1023
|
+
this.onDidMove(updateTitle),
|
|
821
1024
|
this.onDidChangeDescription(updateDescription),
|
|
822
|
-
this.onCollapsed(updateDescription)
|
|
1025
|
+
this.onCollapsed(updateDescription)
|
|
823
1026
|
]);
|
|
824
1027
|
header.appendChild(title);
|
|
825
1028
|
header.appendChild(description);
|
|
@@ -929,9 +1132,24 @@ class ViewContainerLayout extends widgets_1.SplitLayout {
|
|
|
929
1132
|
get widgets() {
|
|
930
1133
|
return algorithm_1.toArray(this.iter());
|
|
931
1134
|
}
|
|
1135
|
+
attachWidget(index, widget) {
|
|
1136
|
+
var _a;
|
|
1137
|
+
super.attachWidget(index, widget);
|
|
1138
|
+
if (index > -1 && this.parent && this.parent.node.contains((_a = this.widgets[index + 1]) === null || _a === void 0 ? void 0 : _a.node)) {
|
|
1139
|
+
// Set the correct attach index to the DOM elements.
|
|
1140
|
+
const ref = this.widgets[index + 1].node;
|
|
1141
|
+
this.parent.node.insertBefore(widget.node, ref);
|
|
1142
|
+
this.parent.node.insertBefore(this.handles[index], ref);
|
|
1143
|
+
this.parent.fit();
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
932
1146
|
moveWidget(fromIndex, toIndex, widget) {
|
|
933
1147
|
const ref = this.widgets[toIndex < fromIndex ? toIndex : toIndex + 1];
|
|
934
1148
|
super.moveWidget(fromIndex, toIndex, widget);
|
|
1149
|
+
// Keep the order of `_widgets` array just as done before (by `super`) for the `_items` array -
|
|
1150
|
+
// to prevent later bugs relying on index.
|
|
1151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1152
|
+
algorithm_1.ArrayExt.move(this._widgets, fromIndex, toIndex);
|
|
935
1153
|
if (ref) {
|
|
936
1154
|
this.parent.node.insertBefore(this.handles[toIndex], ref.node);
|
|
937
1155
|
}
|