@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.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/index.d.ts +11 -9
- package/index.js +8 -6
- package/package.json +11 -11
- package/tools/views.d.ts +102 -0
- package/tools/views.js +253 -0
- package/views.d.ts +4 -99
- package/views.js +52 -280
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
- package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
- package/vscode/src/vs/base/common/codicons.d.ts +0 -579
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
- package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
|
@@ -1,605 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
-
import { toAction } from 'vscode/vscode/vs/base/common/actions';
|
|
4
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
-
import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
6
|
-
import { CompositeOverflowActivityAction, CompositeActionViewItem, CompositeOverflowActivityActionViewItem } from 'vscode/vscode/vs/workbench/browser/parts/compositeBarActions';
|
|
7
|
-
import { $, addDisposableListener, EventType, getWindow, isAncestor, EventHelper } from 'vscode/vscode/vs/base/browser/dom';
|
|
8
|
-
import { StandardMouseEvent } from 'vscode/vscode/vs/base/browser/mouseEvent';
|
|
9
|
-
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
10
|
-
import { Widget } from 'vscode/vscode/vs/base/browser/ui/widget';
|
|
11
|
-
import { isUndefinedOrNull } from 'vscode/vscode/vs/base/common/types';
|
|
12
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
13
|
-
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
14
|
-
import { CompositeDragAndDropObserver, toggleDropEffect } from 'vscode/vscode/vs/workbench/browser/dnd';
|
|
15
|
-
import { Gesture, EventType as EventType$1 } from 'vscode/vscode/vs/base/browser/touch';
|
|
16
|
-
|
|
17
|
-
class CompositeDragAndDrop {
|
|
18
|
-
constructor(viewDescriptorService, targetContainerLocation, openComposite, moveComposite, getItems) {
|
|
19
|
-
this.viewDescriptorService = viewDescriptorService;
|
|
20
|
-
this.targetContainerLocation = targetContainerLocation;
|
|
21
|
-
this.openComposite = openComposite;
|
|
22
|
-
this.moveComposite = moveComposite;
|
|
23
|
-
this.getItems = getItems;
|
|
24
|
-
}
|
|
25
|
-
drop(data, targetCompositeId, originalEvent, before) {
|
|
26
|
-
const dragData = data.getData();
|
|
27
|
-
if (dragData.type === 'composite') {
|
|
28
|
-
const currentContainer = this.viewDescriptorService.getViewContainerById(dragData.id);
|
|
29
|
-
const currentLocation = this.viewDescriptorService.getViewContainerLocation(currentContainer);
|
|
30
|
-
if (currentLocation === this.targetContainerLocation) {
|
|
31
|
-
if (targetCompositeId) {
|
|
32
|
-
this.moveComposite(dragData.id, targetCompositeId, before);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.viewDescriptorService.moveViewContainerToLocation(currentContainer, this.targetContainerLocation, this.getTargetIndex(targetCompositeId, before), 'dnd');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (dragData.type === 'view') {
|
|
40
|
-
const viewToMove = this.viewDescriptorService.getViewDescriptorById(dragData.id);
|
|
41
|
-
if (viewToMove && viewToMove.canMoveView) {
|
|
42
|
-
this.viewDescriptorService.moveViewToLocation(viewToMove, this.targetContainerLocation, 'dnd');
|
|
43
|
-
const newContainer = this.viewDescriptorService.getViewContainerByViewId(viewToMove.id);
|
|
44
|
-
if (targetCompositeId) {
|
|
45
|
-
this.moveComposite(newContainer.id, targetCompositeId, before);
|
|
46
|
-
}
|
|
47
|
-
this.openComposite(newContainer.id, true).then(composite => {
|
|
48
|
-
composite?.openView(viewToMove.id, true);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
onDragEnter(data, targetCompositeId, originalEvent) {
|
|
54
|
-
return this.canDrop(data, targetCompositeId);
|
|
55
|
-
}
|
|
56
|
-
onDragOver(data, targetCompositeId, originalEvent) {
|
|
57
|
-
return this.canDrop(data, targetCompositeId);
|
|
58
|
-
}
|
|
59
|
-
getTargetIndex(targetId, before2d) {
|
|
60
|
-
if (!targetId) {
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
const items = this.getItems();
|
|
64
|
-
const before = this.targetContainerLocation === 1 ? before2d?.horizontallyBefore : before2d?.verticallyBefore;
|
|
65
|
-
return items.filter(item => item.visible).findIndex(item => item.id === targetId) + (before ? 0 : 1);
|
|
66
|
-
}
|
|
67
|
-
canDrop(data, targetCompositeId) {
|
|
68
|
-
const dragData = data.getData();
|
|
69
|
-
if (dragData.type === 'composite') {
|
|
70
|
-
const currentContainer = this.viewDescriptorService.getViewContainerById(dragData.id);
|
|
71
|
-
const currentLocation = this.viewDescriptorService.getViewContainerLocation(currentContainer);
|
|
72
|
-
if (currentLocation === this.targetContainerLocation) {
|
|
73
|
-
return dragData.id !== targetCompositeId;
|
|
74
|
-
}
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
const viewDescriptor = this.viewDescriptorService.getViewDescriptorById(dragData.id);
|
|
79
|
-
if (!viewDescriptor || !viewDescriptor.canMoveView) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
let CompositeBar = class CompositeBar extends Widget {
|
|
87
|
-
constructor(items, options, instantiationService, contextMenuService, viewDescriptorService) {
|
|
88
|
-
super();
|
|
89
|
-
this.options = options;
|
|
90
|
-
this.instantiationService = instantiationService;
|
|
91
|
-
this.contextMenuService = contextMenuService;
|
|
92
|
-
this.viewDescriptorService = viewDescriptorService;
|
|
93
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
94
|
-
this.onDidChange = this._onDidChange.event;
|
|
95
|
-
this.model = ( new CompositeBarModel(items, options));
|
|
96
|
-
this.visibleComposites = [];
|
|
97
|
-
this.compositeSizeInBar = ( new Map());
|
|
98
|
-
this.computeSizes(this.model.visibleItems);
|
|
99
|
-
}
|
|
100
|
-
getCompositeBarItems() {
|
|
101
|
-
return [...this.model.items];
|
|
102
|
-
}
|
|
103
|
-
setCompositeBarItems(items) {
|
|
104
|
-
this.model.setItems(items);
|
|
105
|
-
this.updateCompositeSwitcher();
|
|
106
|
-
}
|
|
107
|
-
getPinnedComposites() {
|
|
108
|
-
return this.model.pinnedItems;
|
|
109
|
-
}
|
|
110
|
-
getVisibleComposites() {
|
|
111
|
-
return this.model.visibleItems;
|
|
112
|
-
}
|
|
113
|
-
create(parent) {
|
|
114
|
-
const actionBarDiv = parent.appendChild($('.composite-bar'));
|
|
115
|
-
this.compositeSwitcherBar = this._register(( new ActionBar(actionBarDiv, {
|
|
116
|
-
actionViewItemProvider: action => {
|
|
117
|
-
if (action instanceof CompositeOverflowActivityAction) {
|
|
118
|
-
return this.compositeOverflowActionViewItem;
|
|
119
|
-
}
|
|
120
|
-
const item = this.model.findItem(action.id);
|
|
121
|
-
return item && this.instantiationService.createInstance(CompositeActionViewItem, { draggable: true, colors: this.options.colors, icon: this.options.icon, hoverOptions: this.options.activityHoverOptions, compact: this.options.compact }, action, item.pinnedAction, item.toggleBadgeAction, compositeId => this.options.getContextMenuActionsForComposite(compositeId), () => this.getContextMenuActions(), this.options.dndHandler, this);
|
|
122
|
-
},
|
|
123
|
-
orientation: this.options.orientation,
|
|
124
|
-
ariaLabel: ( localizeWithPath(
|
|
125
|
-
'vs/workbench/browser/parts/compositeBar',
|
|
126
|
-
'activityBarAriaLabel',
|
|
127
|
-
"Active View Switcher"
|
|
128
|
-
)),
|
|
129
|
-
ariaRole: 'tablist',
|
|
130
|
-
animated: false,
|
|
131
|
-
preventLoopNavigation: this.options.preventLoopNavigation,
|
|
132
|
-
triggerKeys: { keyDown: true }
|
|
133
|
-
})));
|
|
134
|
-
this._register(addDisposableListener(parent, EventType.CONTEXT_MENU, e => this.showContextMenu(getWindow(parent), e)));
|
|
135
|
-
this._register(Gesture.addTarget(parent));
|
|
136
|
-
this._register(addDisposableListener(parent, EventType$1.Contextmenu, e => this.showContextMenu(getWindow(parent), e)));
|
|
137
|
-
let insertDropBefore = undefined;
|
|
138
|
-
this._register(CompositeDragAndDropObserver.INSTANCE.registerTarget(parent, {
|
|
139
|
-
onDragOver: (e) => {
|
|
140
|
-
const visibleItems = this.getVisibleComposites();
|
|
141
|
-
if (!visibleItems.length || (e.eventData.target && isAncestor(e.eventData.target, actionBarDiv))) {
|
|
142
|
-
insertDropBefore = this.updateFromDragging(parent, false, false, true);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const insertAtFront = this.insertAtFront(actionBarDiv, e.eventData);
|
|
146
|
-
const target = insertAtFront ? visibleItems[0] : visibleItems[visibleItems.length - 1];
|
|
147
|
-
const validDropTarget = this.options.dndHandler.onDragOver(e.dragAndDropData, target.id, e.eventData);
|
|
148
|
-
toggleDropEffect(e.eventData.dataTransfer, 'move', validDropTarget);
|
|
149
|
-
insertDropBefore = this.updateFromDragging(parent, validDropTarget, insertAtFront, true);
|
|
150
|
-
},
|
|
151
|
-
onDragLeave: (e) => {
|
|
152
|
-
insertDropBefore = this.updateFromDragging(parent, false, false, false);
|
|
153
|
-
},
|
|
154
|
-
onDragEnd: (e) => {
|
|
155
|
-
insertDropBefore = this.updateFromDragging(parent, false, false, false);
|
|
156
|
-
},
|
|
157
|
-
onDrop: (e) => {
|
|
158
|
-
const visibleItems = this.getVisibleComposites();
|
|
159
|
-
if (visibleItems.length) {
|
|
160
|
-
const target = this.insertAtFront(actionBarDiv, e.eventData) ? visibleItems[0] : visibleItems[visibleItems.length - 1];
|
|
161
|
-
this.options.dndHandler.drop(e.dragAndDropData, target.id, e.eventData, insertDropBefore);
|
|
162
|
-
}
|
|
163
|
-
insertDropBefore = this.updateFromDragging(parent, false, false, false);
|
|
164
|
-
}
|
|
165
|
-
}));
|
|
166
|
-
return actionBarDiv;
|
|
167
|
-
}
|
|
168
|
-
insertAtFront(element, event) {
|
|
169
|
-
const rect = element.getBoundingClientRect();
|
|
170
|
-
const posX = event.clientX;
|
|
171
|
-
const posY = event.clientY;
|
|
172
|
-
switch (this.options.orientation) {
|
|
173
|
-
case 0 :
|
|
174
|
-
return posX < rect.left;
|
|
175
|
-
case 1 :
|
|
176
|
-
return posY < rect.top;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
updateFromDragging(element, showFeedback, front, isDragging) {
|
|
180
|
-
element.classList.toggle('dragged-over', isDragging);
|
|
181
|
-
element.classList.toggle('dragged-over-head', showFeedback && front);
|
|
182
|
-
element.classList.toggle('dragged-over-tail', showFeedback && !front);
|
|
183
|
-
if (!showFeedback) {
|
|
184
|
-
return undefined;
|
|
185
|
-
}
|
|
186
|
-
return { verticallyBefore: front, horizontallyBefore: front };
|
|
187
|
-
}
|
|
188
|
-
focus(index) {
|
|
189
|
-
this.compositeSwitcherBar?.focus(index);
|
|
190
|
-
}
|
|
191
|
-
recomputeSizes() {
|
|
192
|
-
this.computeSizes(this.model.visibleItems);
|
|
193
|
-
this.updateCompositeSwitcher();
|
|
194
|
-
}
|
|
195
|
-
layout(dimension) {
|
|
196
|
-
this.dimension = dimension;
|
|
197
|
-
if (dimension.height === 0 || dimension.width === 0) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
if (this.compositeSizeInBar.size === 0) {
|
|
201
|
-
this.computeSizes(this.model.visibleItems);
|
|
202
|
-
}
|
|
203
|
-
this.updateCompositeSwitcher();
|
|
204
|
-
}
|
|
205
|
-
addComposite({ id, name, order, requestedIndex }) {
|
|
206
|
-
if (this.model.add(id, name, order, requestedIndex)) {
|
|
207
|
-
this.computeSizes([this.model.findItem(id)]);
|
|
208
|
-
this.updateCompositeSwitcher();
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
removeComposite(id) {
|
|
212
|
-
if (this.isPinned(id)) {
|
|
213
|
-
this.unpin(id);
|
|
214
|
-
}
|
|
215
|
-
if (this.model.remove(id)) {
|
|
216
|
-
this.updateCompositeSwitcher();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
hideComposite(id) {
|
|
220
|
-
if (this.model.hide(id)) {
|
|
221
|
-
this.resetActiveComposite(id);
|
|
222
|
-
this.updateCompositeSwitcher();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
activateComposite(id) {
|
|
226
|
-
const previousActiveItem = this.model.activeItem;
|
|
227
|
-
if (this.model.activate(id)) {
|
|
228
|
-
if (this.visibleComposites.indexOf(id) === -1 || (!!this.model.activeItem && !this.model.activeItem.pinned) || (previousActiveItem && !previousActiveItem.pinned)) {
|
|
229
|
-
this.updateCompositeSwitcher();
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
deactivateComposite(id) {
|
|
234
|
-
const previousActiveItem = this.model.activeItem;
|
|
235
|
-
if (this.model.deactivate()) {
|
|
236
|
-
if (previousActiveItem && !previousActiveItem.pinned) {
|
|
237
|
-
this.updateCompositeSwitcher();
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
async pin(compositeId, open) {
|
|
242
|
-
if (this.model.setPinned(compositeId, true)) {
|
|
243
|
-
this.updateCompositeSwitcher();
|
|
244
|
-
if (open) {
|
|
245
|
-
await this.options.openComposite(compositeId);
|
|
246
|
-
this.activateComposite(compositeId);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
unpin(compositeId) {
|
|
251
|
-
if (this.model.setPinned(compositeId, false)) {
|
|
252
|
-
this.updateCompositeSwitcher();
|
|
253
|
-
this.resetActiveComposite(compositeId);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
areBadgesEnabled(compositeId) {
|
|
257
|
-
return this.viewDescriptorService.getViewContainerBadgeEnablementState(compositeId);
|
|
258
|
-
}
|
|
259
|
-
toggleBadgeEnablement(compositeId) {
|
|
260
|
-
this.viewDescriptorService.setViewContainerBadgeEnablementState(compositeId, !this.areBadgesEnabled(compositeId));
|
|
261
|
-
this.updateCompositeSwitcher();
|
|
262
|
-
const item = this.model.findItem(compositeId);
|
|
263
|
-
if (item) {
|
|
264
|
-
item.activityAction.activity = item.activityAction.activity;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
resetActiveComposite(compositeId) {
|
|
268
|
-
const defaultCompositeId = this.options.getDefaultCompositeId();
|
|
269
|
-
if (!this.model.activeItem || this.model.activeItem.id !== compositeId) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
this.deactivateComposite(compositeId);
|
|
273
|
-
if (defaultCompositeId && defaultCompositeId !== compositeId && this.isPinned(defaultCompositeId)) {
|
|
274
|
-
this.options.openComposite(defaultCompositeId, true);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
this.options.openComposite(this.visibleComposites.filter(cid => cid !== compositeId)[0]);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
isPinned(compositeId) {
|
|
281
|
-
const item = this.model.findItem(compositeId);
|
|
282
|
-
return item?.pinned;
|
|
283
|
-
}
|
|
284
|
-
move(compositeId, toCompositeId, before) {
|
|
285
|
-
if (before !== undefined) {
|
|
286
|
-
const fromIndex = this.model.items.findIndex(c => c.id === compositeId);
|
|
287
|
-
let toIndex = this.model.items.findIndex(c => c.id === toCompositeId);
|
|
288
|
-
if (fromIndex >= 0 && toIndex >= 0) {
|
|
289
|
-
if (!before && fromIndex > toIndex) {
|
|
290
|
-
toIndex++;
|
|
291
|
-
}
|
|
292
|
-
if (before && fromIndex < toIndex) {
|
|
293
|
-
toIndex--;
|
|
294
|
-
}
|
|
295
|
-
if (toIndex < this.model.items.length && toIndex >= 0 && toIndex !== fromIndex) {
|
|
296
|
-
if (this.model.move(this.model.items[fromIndex].id, this.model.items[toIndex].id)) {
|
|
297
|
-
setTimeout(() => this.updateCompositeSwitcher(), 0);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
if (this.model.move(compositeId, toCompositeId)) {
|
|
304
|
-
setTimeout(() => this.updateCompositeSwitcher(), 0);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
getAction(compositeId) {
|
|
309
|
-
const item = this.model.findItem(compositeId);
|
|
310
|
-
return item?.activityAction;
|
|
311
|
-
}
|
|
312
|
-
computeSizes(items) {
|
|
313
|
-
const size = this.options.compositeSize;
|
|
314
|
-
if (size) {
|
|
315
|
-
items.forEach(composite => this.compositeSizeInBar.set(composite.id, size));
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
const compositeSwitcherBar = this.compositeSwitcherBar;
|
|
319
|
-
if (compositeSwitcherBar && this.dimension && this.dimension.height !== 0 && this.dimension.width !== 0) {
|
|
320
|
-
const currentItemsLength = compositeSwitcherBar.viewItems.length;
|
|
321
|
-
compositeSwitcherBar.push(( items.map(composite => composite.activityAction)));
|
|
322
|
-
items.forEach((composite, index) => this.compositeSizeInBar.set(composite.id, this.options.orientation === 1
|
|
323
|
-
? compositeSwitcherBar.getHeight(currentItemsLength + index)
|
|
324
|
-
: compositeSwitcherBar.getWidth(currentItemsLength + index)));
|
|
325
|
-
items.forEach(() => compositeSwitcherBar.pull(compositeSwitcherBar.viewItems.length - 1));
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
updateCompositeSwitcher() {
|
|
330
|
-
const compositeSwitcherBar = this.compositeSwitcherBar;
|
|
331
|
-
if (!compositeSwitcherBar || !this.dimension) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
let compositesToShow = ( this.model.visibleItems.filter(item => item.pinned
|
|
335
|
-
|| (this.model.activeItem && this.model.activeItem.id === item.id) ).map(item => item.id));
|
|
336
|
-
let maxVisible = compositesToShow.length;
|
|
337
|
-
const totalComposites = compositesToShow.length;
|
|
338
|
-
let size = 0;
|
|
339
|
-
const limit = this.options.orientation === 1 ? this.dimension.height : this.dimension.width;
|
|
340
|
-
for (let i = 0; i < compositesToShow.length; i++) {
|
|
341
|
-
const compositeSize = this.compositeSizeInBar.get(compositesToShow[i]);
|
|
342
|
-
if (size + compositeSize > limit) {
|
|
343
|
-
maxVisible = i;
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
size += compositeSize;
|
|
347
|
-
}
|
|
348
|
-
if (totalComposites > maxVisible) {
|
|
349
|
-
compositesToShow = compositesToShow.slice(0, maxVisible);
|
|
350
|
-
}
|
|
351
|
-
if (this.model.activeItem && compositesToShow.every(compositeId => !!this.model.activeItem && compositeId !== this.model.activeItem.id)) {
|
|
352
|
-
size += this.compositeSizeInBar.get(this.model.activeItem.id);
|
|
353
|
-
compositesToShow.push(this.model.activeItem.id);
|
|
354
|
-
}
|
|
355
|
-
while (size > limit && compositesToShow.length) {
|
|
356
|
-
const removedComposite = compositesToShow.length > 1 ? compositesToShow.splice(compositesToShow.length - 2, 1)[0] : compositesToShow.pop();
|
|
357
|
-
size -= this.compositeSizeInBar.get(removedComposite);
|
|
358
|
-
}
|
|
359
|
-
if (totalComposites > compositesToShow.length) {
|
|
360
|
-
size += this.options.overflowActionSize;
|
|
361
|
-
}
|
|
362
|
-
while (size > limit && compositesToShow.length) {
|
|
363
|
-
const removedComposite = compositesToShow.length > 1 && compositesToShow[compositesToShow.length - 1] === this.model.activeItem?.id ?
|
|
364
|
-
compositesToShow.splice(compositesToShow.length - 2, 1)[0] : compositesToShow.pop();
|
|
365
|
-
size -= this.compositeSizeInBar.get(removedComposite);
|
|
366
|
-
}
|
|
367
|
-
if (totalComposites === compositesToShow.length && this.compositeOverflowAction) {
|
|
368
|
-
compositeSwitcherBar.pull(compositeSwitcherBar.length() - 1);
|
|
369
|
-
this.compositeOverflowAction.dispose();
|
|
370
|
-
this.compositeOverflowAction = undefined;
|
|
371
|
-
this.compositeOverflowActionViewItem?.dispose();
|
|
372
|
-
this.compositeOverflowActionViewItem = undefined;
|
|
373
|
-
}
|
|
374
|
-
const compositesToRemove = [];
|
|
375
|
-
this.visibleComposites.forEach((compositeId, index) => {
|
|
376
|
-
if (!compositesToShow.includes(compositeId)) {
|
|
377
|
-
compositesToRemove.push(index);
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
compositesToRemove.reverse().forEach(index => {
|
|
381
|
-
compositeSwitcherBar.pull(index);
|
|
382
|
-
this.visibleComposites.splice(index, 1);
|
|
383
|
-
});
|
|
384
|
-
compositesToShow.forEach((compositeId, newIndex) => {
|
|
385
|
-
const currentIndex = this.visibleComposites.indexOf(compositeId);
|
|
386
|
-
if (newIndex !== currentIndex) {
|
|
387
|
-
if (currentIndex !== -1) {
|
|
388
|
-
compositeSwitcherBar.pull(currentIndex);
|
|
389
|
-
this.visibleComposites.splice(currentIndex, 1);
|
|
390
|
-
}
|
|
391
|
-
compositeSwitcherBar.push(this.model.findItem(compositeId).activityAction, { label: true, icon: this.options.icon, index: newIndex });
|
|
392
|
-
this.visibleComposites.splice(newIndex, 0, compositeId);
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
if (totalComposites > compositesToShow.length && !this.compositeOverflowAction) {
|
|
396
|
-
this.compositeOverflowAction = this._register(this.instantiationService.createInstance(CompositeOverflowActivityAction, () => {
|
|
397
|
-
this.compositeOverflowActionViewItem?.showMenu();
|
|
398
|
-
}));
|
|
399
|
-
this.compositeOverflowActionViewItem = this._register(this.instantiationService.createInstance(CompositeOverflowActivityActionViewItem, this.compositeOverflowAction, () => this.getOverflowingComposites(), () => this.model.activeItem ? this.model.activeItem.id : undefined, compositeId => {
|
|
400
|
-
const item = this.model.findItem(compositeId);
|
|
401
|
-
return item?.activity[0]?.badge;
|
|
402
|
-
}, this.options.getOnCompositeClickAction, this.options.colors, this.options.activityHoverOptions));
|
|
403
|
-
compositeSwitcherBar.push(this.compositeOverflowAction, { label: false, icon: true });
|
|
404
|
-
}
|
|
405
|
-
this._onDidChange.fire();
|
|
406
|
-
}
|
|
407
|
-
getOverflowingComposites() {
|
|
408
|
-
let overflowingIds = ( this.model.visibleItems.filter(item => item.pinned).map(item => item.id));
|
|
409
|
-
if (this.model.activeItem && !this.model.activeItem.pinned) {
|
|
410
|
-
overflowingIds.push(this.model.activeItem.id);
|
|
411
|
-
}
|
|
412
|
-
overflowingIds = overflowingIds.filter(compositeId => !this.visibleComposites.includes(compositeId));
|
|
413
|
-
return ( this.model.visibleItems.filter(c => overflowingIds.includes(c.id)).map(
|
|
414
|
-
item => { return { id: item.id, name: this.getAction(item.id)?.label || item.name }; }
|
|
415
|
-
));
|
|
416
|
-
}
|
|
417
|
-
showContextMenu(targetWindow, e) {
|
|
418
|
-
EventHelper.stop(e, true);
|
|
419
|
-
const event = ( new StandardMouseEvent(targetWindow, e));
|
|
420
|
-
this.contextMenuService.showContextMenu({
|
|
421
|
-
getAnchor: () => event,
|
|
422
|
-
getActions: () => this.getContextMenuActions(e)
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
getContextMenuActions(e) {
|
|
426
|
-
const actions = ( this.model.visibleItems
|
|
427
|
-
.map(({ id, name, activityAction }) => (toAction({
|
|
428
|
-
id,
|
|
429
|
-
label: this.getAction(id).label || name || id,
|
|
430
|
-
checked: this.isPinned(id),
|
|
431
|
-
enabled: activityAction.enabled,
|
|
432
|
-
run: () => {
|
|
433
|
-
if (this.isPinned(id)) {
|
|
434
|
-
this.unpin(id);
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
this.pin(id, true);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}))));
|
|
441
|
-
return actions;
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
CompositeBar = ( __decorate([
|
|
445
|
-
( __param(2, IInstantiationService)),
|
|
446
|
-
( __param(3, IContextMenuService)),
|
|
447
|
-
( __param(4, IViewDescriptorService))
|
|
448
|
-
], CompositeBar));
|
|
449
|
-
class CompositeBarModel {
|
|
450
|
-
get items() { return this._items; }
|
|
451
|
-
constructor(items, options) {
|
|
452
|
-
this._items = [];
|
|
453
|
-
this.options = options;
|
|
454
|
-
this.setItems(items);
|
|
455
|
-
}
|
|
456
|
-
setItems(items) {
|
|
457
|
-
this._items = [];
|
|
458
|
-
this._items = ( items
|
|
459
|
-
.map(
|
|
460
|
-
i => this.createCompositeBarItem(i.id, i.name, i.order, i.pinned, i.visible)
|
|
461
|
-
));
|
|
462
|
-
}
|
|
463
|
-
get visibleItems() {
|
|
464
|
-
return this.items.filter(item => item.visible);
|
|
465
|
-
}
|
|
466
|
-
get pinnedItems() {
|
|
467
|
-
return this.items.filter(item => item.visible && item.pinned);
|
|
468
|
-
}
|
|
469
|
-
createCompositeBarItem(id, name, order, pinned, visible) {
|
|
470
|
-
const options = this.options;
|
|
471
|
-
return {
|
|
472
|
-
id, name, pinned, order, visible,
|
|
473
|
-
activity: [],
|
|
474
|
-
get activityAction() {
|
|
475
|
-
return options.getActivityAction(id);
|
|
476
|
-
},
|
|
477
|
-
get pinnedAction() {
|
|
478
|
-
return options.getCompositePinnedAction(id);
|
|
479
|
-
},
|
|
480
|
-
get toggleBadgeAction() {
|
|
481
|
-
return options.getCompositeBadgeAction(id);
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
add(id, name, order, requestedIndex) {
|
|
486
|
-
const item = this.findItem(id);
|
|
487
|
-
if (item) {
|
|
488
|
-
let changed = false;
|
|
489
|
-
item.name = name;
|
|
490
|
-
if (!isUndefinedOrNull(order)) {
|
|
491
|
-
changed = item.order !== order;
|
|
492
|
-
item.order = order;
|
|
493
|
-
}
|
|
494
|
-
if (!item.visible) {
|
|
495
|
-
item.visible = true;
|
|
496
|
-
changed = true;
|
|
497
|
-
}
|
|
498
|
-
return changed;
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
501
|
-
const item = this.createCompositeBarItem(id, name, order, true, true);
|
|
502
|
-
if (!isUndefinedOrNull(requestedIndex)) {
|
|
503
|
-
let index = 0;
|
|
504
|
-
let rIndex = requestedIndex;
|
|
505
|
-
while (rIndex > 0 && index < this.items.length) {
|
|
506
|
-
if (this.items[index++].visible) {
|
|
507
|
-
rIndex--;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
this.items.splice(index, 0, item);
|
|
511
|
-
}
|
|
512
|
-
else if (isUndefinedOrNull(order)) {
|
|
513
|
-
this.items.push(item);
|
|
514
|
-
}
|
|
515
|
-
else {
|
|
516
|
-
let index = 0;
|
|
517
|
-
while (index < this.items.length && typeof this.items[index].order === 'number' && this.items[index].order < order) {
|
|
518
|
-
index++;
|
|
519
|
-
}
|
|
520
|
-
this.items.splice(index, 0, item);
|
|
521
|
-
}
|
|
522
|
-
return true;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
remove(id) {
|
|
526
|
-
for (let index = 0; index < this.items.length; index++) {
|
|
527
|
-
if (this.items[index].id === id) {
|
|
528
|
-
this.items.splice(index, 1);
|
|
529
|
-
return true;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
return false;
|
|
533
|
-
}
|
|
534
|
-
hide(id) {
|
|
535
|
-
for (const item of this.items) {
|
|
536
|
-
if (item.id === id) {
|
|
537
|
-
if (item.visible) {
|
|
538
|
-
item.visible = false;
|
|
539
|
-
return true;
|
|
540
|
-
}
|
|
541
|
-
return false;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
return false;
|
|
545
|
-
}
|
|
546
|
-
move(compositeId, toCompositeId) {
|
|
547
|
-
const fromIndex = this.findIndex(compositeId);
|
|
548
|
-
const toIndex = this.findIndex(toCompositeId);
|
|
549
|
-
if (fromIndex === -1 || toIndex === -1) {
|
|
550
|
-
return false;
|
|
551
|
-
}
|
|
552
|
-
const sourceItem = this.items.splice(fromIndex, 1)[0];
|
|
553
|
-
this.items.splice(toIndex, 0, sourceItem);
|
|
554
|
-
sourceItem.pinned = true;
|
|
555
|
-
return true;
|
|
556
|
-
}
|
|
557
|
-
setPinned(id, pinned) {
|
|
558
|
-
for (const item of this.items) {
|
|
559
|
-
if (item.id === id) {
|
|
560
|
-
if (item.pinned !== pinned) {
|
|
561
|
-
item.pinned = pinned;
|
|
562
|
-
return true;
|
|
563
|
-
}
|
|
564
|
-
return false;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
return false;
|
|
568
|
-
}
|
|
569
|
-
activate(id) {
|
|
570
|
-
if (!this.activeItem || this.activeItem.id !== id) {
|
|
571
|
-
if (this.activeItem) {
|
|
572
|
-
this.deactivate();
|
|
573
|
-
}
|
|
574
|
-
for (const item of this.items) {
|
|
575
|
-
if (item.id === id) {
|
|
576
|
-
this.activeItem = item;
|
|
577
|
-
this.activeItem.activityAction.activate();
|
|
578
|
-
return true;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
return false;
|
|
583
|
-
}
|
|
584
|
-
deactivate() {
|
|
585
|
-
if (this.activeItem) {
|
|
586
|
-
this.activeItem.activityAction.deactivate();
|
|
587
|
-
this.activeItem = undefined;
|
|
588
|
-
return true;
|
|
589
|
-
}
|
|
590
|
-
return false;
|
|
591
|
-
}
|
|
592
|
-
findItem(id) {
|
|
593
|
-
return this.items.filter(item => item.id === id)[0];
|
|
594
|
-
}
|
|
595
|
-
findIndex(id) {
|
|
596
|
-
for (let index = 0; index < this.items.length; index++) {
|
|
597
|
-
if (this.items[index].id === id) {
|
|
598
|
-
return index;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
return -1;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
export { CompositeBar, CompositeDragAndDrop };
|