@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.1
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,494 +0,0 @@
|
|
|
1
|
-
import { tail2, equals } from 'vscode/vscode/vs/base/common/arrays';
|
|
2
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import './gridview.css.js';
|
|
4
|
-
import { orthogonal, GridView } from './gridview.js';
|
|
5
|
-
import { Sizing as Sizing$1 } from 'vscode/vscode/vs/base/browser/ui/splitview/splitview';
|
|
6
|
-
|
|
7
|
-
function oppositeDirection(direction) {
|
|
8
|
-
switch (direction) {
|
|
9
|
-
case 0 : return 1 ;
|
|
10
|
-
case 1 : return 0 ;
|
|
11
|
-
case 2 : return 3 ;
|
|
12
|
-
case 3 : return 2 ;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function isGridBranchNode(node) {
|
|
16
|
-
return !!node.children;
|
|
17
|
-
}
|
|
18
|
-
function getGridNode(node, location) {
|
|
19
|
-
if (location.length === 0) {
|
|
20
|
-
return node;
|
|
21
|
-
}
|
|
22
|
-
if (!isGridBranchNode(node)) {
|
|
23
|
-
throw new Error('Invalid location');
|
|
24
|
-
}
|
|
25
|
-
const [index, ...rest] = location;
|
|
26
|
-
return getGridNode(node.children[index], rest);
|
|
27
|
-
}
|
|
28
|
-
function intersects(one, other) {
|
|
29
|
-
return !(one.start >= other.end || other.start >= one.end);
|
|
30
|
-
}
|
|
31
|
-
function getBoxBoundary(box, direction) {
|
|
32
|
-
const orientation = getDirectionOrientation(direction);
|
|
33
|
-
const offset = direction === 0 ? box.top :
|
|
34
|
-
direction === 3 ? box.left + box.width :
|
|
35
|
-
direction === 1 ? box.top + box.height :
|
|
36
|
-
box.left;
|
|
37
|
-
const range = {
|
|
38
|
-
start: orientation === 1 ? box.top : box.left,
|
|
39
|
-
end: orientation === 1 ? box.top + box.height : box.left + box.width
|
|
40
|
-
};
|
|
41
|
-
return { offset, range };
|
|
42
|
-
}
|
|
43
|
-
function findAdjacentBoxLeafNodes(boxNode, direction, boundary) {
|
|
44
|
-
const result = [];
|
|
45
|
-
function _(boxNode, direction, boundary) {
|
|
46
|
-
if (isGridBranchNode(boxNode)) {
|
|
47
|
-
for (const child of boxNode.children) {
|
|
48
|
-
_(child, direction, boundary);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
const { offset, range } = getBoxBoundary(boxNode.box, direction);
|
|
53
|
-
if (offset === boundary.offset && intersects(range, boundary.range)) {
|
|
54
|
-
result.push(boxNode);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
_(boxNode, direction, boundary);
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
function getLocationOrientation(rootOrientation, location) {
|
|
62
|
-
return location.length % 2 === 0 ? orthogonal(rootOrientation) : rootOrientation;
|
|
63
|
-
}
|
|
64
|
-
function getDirectionOrientation(direction) {
|
|
65
|
-
return direction === 0 || direction === 1 ? 0 : 1 ;
|
|
66
|
-
}
|
|
67
|
-
function getRelativeLocation(rootOrientation, location, direction) {
|
|
68
|
-
const orientation = getLocationOrientation(rootOrientation, location);
|
|
69
|
-
const directionOrientation = getDirectionOrientation(direction);
|
|
70
|
-
if (orientation === directionOrientation) {
|
|
71
|
-
let [rest, index] = tail2(location);
|
|
72
|
-
if (direction === 3 || direction === 1 ) {
|
|
73
|
-
index += 1;
|
|
74
|
-
}
|
|
75
|
-
return [...rest, index];
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
const index = ((direction === 3 || direction === 1) ) ? 1 : 0;
|
|
79
|
-
return [...location, index];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function indexInParent(element) {
|
|
83
|
-
const parentElement = element.parentElement;
|
|
84
|
-
if (!parentElement) {
|
|
85
|
-
throw new Error('Invalid grid element');
|
|
86
|
-
}
|
|
87
|
-
let el = parentElement.firstElementChild;
|
|
88
|
-
let index = 0;
|
|
89
|
-
while (el !== element && el !== parentElement.lastElementChild && el) {
|
|
90
|
-
el = el.nextElementSibling;
|
|
91
|
-
index++;
|
|
92
|
-
}
|
|
93
|
-
return index;
|
|
94
|
-
}
|
|
95
|
-
function getGridLocation(element) {
|
|
96
|
-
const parentElement = element.parentElement;
|
|
97
|
-
if (!parentElement) {
|
|
98
|
-
throw new Error('Invalid grid element');
|
|
99
|
-
}
|
|
100
|
-
if (/\bmonaco-grid-view\b/.test(parentElement.className)) {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
const index = indexInParent(parentElement);
|
|
104
|
-
const ancestor = parentElement.parentElement.parentElement.parentElement.parentElement;
|
|
105
|
-
return [...getGridLocation(ancestor), index];
|
|
106
|
-
}
|
|
107
|
-
var Sizing;
|
|
108
|
-
( (function(Sizing) {
|
|
109
|
-
Sizing.Distribute = { type: 'distribute' };
|
|
110
|
-
Sizing.Split = { type: 'split' };
|
|
111
|
-
Sizing.Auto = { type: 'auto' };
|
|
112
|
-
function Invisible(cachedVisibleSize) { return { type: 'invisible', cachedVisibleSize }; }
|
|
113
|
-
Sizing.Invisible = Invisible;
|
|
114
|
-
})(Sizing || (Sizing = {})));
|
|
115
|
-
class Grid extends Disposable {
|
|
116
|
-
get orientation() { return this.gridview.orientation; }
|
|
117
|
-
set orientation(orientation) { this.gridview.orientation = orientation; }
|
|
118
|
-
get width() { return this.gridview.width; }
|
|
119
|
-
get height() { return this.gridview.height; }
|
|
120
|
-
get minimumWidth() { return this.gridview.minimumWidth; }
|
|
121
|
-
get minimumHeight() { return this.gridview.minimumHeight; }
|
|
122
|
-
get maximumWidth() { return this.gridview.maximumWidth; }
|
|
123
|
-
get maximumHeight() { return this.gridview.maximumHeight; }
|
|
124
|
-
get boundarySashes() { return this.gridview.boundarySashes; }
|
|
125
|
-
set boundarySashes(boundarySashes) { this.gridview.boundarySashes = boundarySashes; }
|
|
126
|
-
set edgeSnapping(edgeSnapping) { this.gridview.edgeSnapping = edgeSnapping; }
|
|
127
|
-
get element() { return this.gridview.element; }
|
|
128
|
-
constructor(view, options = {}) {
|
|
129
|
-
super();
|
|
130
|
-
this.views = ( new Map());
|
|
131
|
-
this.didLayout = false;
|
|
132
|
-
if (view instanceof GridView) {
|
|
133
|
-
this.gridview = view;
|
|
134
|
-
this.gridview.getViewMap(this.views);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.gridview = ( new GridView(options));
|
|
138
|
-
}
|
|
139
|
-
this._register(this.gridview);
|
|
140
|
-
this._register(this.gridview.onDidSashReset(this.onDidSashReset, this));
|
|
141
|
-
if (!(view instanceof GridView)) {
|
|
142
|
-
this._addView(view, 0, [0]);
|
|
143
|
-
}
|
|
144
|
-
this.onDidChange = this.gridview.onDidChange;
|
|
145
|
-
this.onDidScroll = this.gridview.onDidScroll;
|
|
146
|
-
this.onDidChangeViewMaximized = this.gridview.onDidChangeViewMaximized;
|
|
147
|
-
}
|
|
148
|
-
style(styles) {
|
|
149
|
-
this.gridview.style(styles);
|
|
150
|
-
}
|
|
151
|
-
layout(width, height, top = 0, left = 0) {
|
|
152
|
-
this.gridview.layout(width, height, top, left);
|
|
153
|
-
this.didLayout = true;
|
|
154
|
-
}
|
|
155
|
-
addView(newView, size, referenceView, direction) {
|
|
156
|
-
if (( this.views.has(newView))) {
|
|
157
|
-
throw new Error('Can\'t add same view twice');
|
|
158
|
-
}
|
|
159
|
-
const orientation = getDirectionOrientation(direction);
|
|
160
|
-
if (this.views.size === 1 && this.orientation !== orientation) {
|
|
161
|
-
this.orientation = orientation;
|
|
162
|
-
}
|
|
163
|
-
const referenceLocation = this.getViewLocation(referenceView);
|
|
164
|
-
const location = getRelativeLocation(this.gridview.orientation, referenceLocation, direction);
|
|
165
|
-
let viewSize;
|
|
166
|
-
if (typeof size === 'number') {
|
|
167
|
-
viewSize = size;
|
|
168
|
-
}
|
|
169
|
-
else if (size.type === 'split') {
|
|
170
|
-
const [, index] = tail2(referenceLocation);
|
|
171
|
-
viewSize = Sizing$1.Split(index);
|
|
172
|
-
}
|
|
173
|
-
else if (size.type === 'distribute') {
|
|
174
|
-
viewSize = Sizing$1.Distribute;
|
|
175
|
-
}
|
|
176
|
-
else if (size.type === 'auto') {
|
|
177
|
-
const [, index] = tail2(referenceLocation);
|
|
178
|
-
viewSize = Sizing$1.Auto(index);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
viewSize = size;
|
|
182
|
-
}
|
|
183
|
-
this._addView(newView, viewSize, location);
|
|
184
|
-
}
|
|
185
|
-
addViewAt(newView, size, location) {
|
|
186
|
-
if (( this.views.has(newView))) {
|
|
187
|
-
throw new Error('Can\'t add same view twice');
|
|
188
|
-
}
|
|
189
|
-
let viewSize;
|
|
190
|
-
if (typeof size === 'number') {
|
|
191
|
-
viewSize = size;
|
|
192
|
-
}
|
|
193
|
-
else if (size.type === 'distribute') {
|
|
194
|
-
viewSize = Sizing$1.Distribute;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
viewSize = size;
|
|
198
|
-
}
|
|
199
|
-
this._addView(newView, viewSize, location);
|
|
200
|
-
}
|
|
201
|
-
_addView(newView, size, location) {
|
|
202
|
-
this.views.set(newView, newView.element);
|
|
203
|
-
this.gridview.addView(newView, size, location);
|
|
204
|
-
}
|
|
205
|
-
removeView(view, sizing) {
|
|
206
|
-
if (this.views.size === 1) {
|
|
207
|
-
throw new Error('Can\'t remove last view');
|
|
208
|
-
}
|
|
209
|
-
const location = this.getViewLocation(view);
|
|
210
|
-
let gridViewSizing;
|
|
211
|
-
if (sizing?.type === 'distribute') {
|
|
212
|
-
gridViewSizing = Sizing$1.Distribute;
|
|
213
|
-
}
|
|
214
|
-
else if (sizing?.type === 'auto') {
|
|
215
|
-
const index = location[location.length - 1];
|
|
216
|
-
gridViewSizing = Sizing$1.Auto(index === 0 ? 1 : index - 1);
|
|
217
|
-
}
|
|
218
|
-
this.gridview.removeView(location, gridViewSizing);
|
|
219
|
-
this.views.delete(view);
|
|
220
|
-
}
|
|
221
|
-
moveView(view, sizing, referenceView, direction) {
|
|
222
|
-
const sourceLocation = this.getViewLocation(view);
|
|
223
|
-
const [sourceParentLocation, from] = tail2(sourceLocation);
|
|
224
|
-
const referenceLocation = this.getViewLocation(referenceView);
|
|
225
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, direction);
|
|
226
|
-
const [targetParentLocation, to] = tail2(targetLocation);
|
|
227
|
-
if (equals(sourceParentLocation, targetParentLocation)) {
|
|
228
|
-
this.gridview.moveView(sourceParentLocation, from, to);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
this.removeView(view, typeof sizing === 'number' ? undefined : sizing);
|
|
232
|
-
this.addView(view, sizing, referenceView, direction);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
moveViewTo(view, location) {
|
|
236
|
-
const sourceLocation = this.getViewLocation(view);
|
|
237
|
-
const [sourceParentLocation, from] = tail2(sourceLocation);
|
|
238
|
-
const [targetParentLocation, to] = tail2(location);
|
|
239
|
-
if (equals(sourceParentLocation, targetParentLocation)) {
|
|
240
|
-
this.gridview.moveView(sourceParentLocation, from, to);
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
const size = this.getViewSize(view);
|
|
244
|
-
const orientation = getLocationOrientation(this.gridview.orientation, sourceLocation);
|
|
245
|
-
const cachedViewSize = this.getViewCachedVisibleSize(view);
|
|
246
|
-
const sizing = typeof cachedViewSize === 'undefined'
|
|
247
|
-
? (orientation === 1 ? size.width : size.height)
|
|
248
|
-
: Sizing.Invisible(cachedViewSize);
|
|
249
|
-
this.removeView(view);
|
|
250
|
-
this.addViewAt(view, sizing, location);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
swapViews(from, to) {
|
|
254
|
-
const fromLocation = this.getViewLocation(from);
|
|
255
|
-
const toLocation = this.getViewLocation(to);
|
|
256
|
-
return this.gridview.swapViews(fromLocation, toLocation);
|
|
257
|
-
}
|
|
258
|
-
resizeView(view, size) {
|
|
259
|
-
const location = this.getViewLocation(view);
|
|
260
|
-
return this.gridview.resizeView(location, size);
|
|
261
|
-
}
|
|
262
|
-
isViewExpanded(view) {
|
|
263
|
-
const location = this.getViewLocation(view);
|
|
264
|
-
return this.gridview.isViewExpanded(location);
|
|
265
|
-
}
|
|
266
|
-
isViewMaximized(view) {
|
|
267
|
-
const location = this.getViewLocation(view);
|
|
268
|
-
return this.gridview.isViewMaximized(location);
|
|
269
|
-
}
|
|
270
|
-
hasMaximizedView() {
|
|
271
|
-
return this.gridview.hasMaximizedView();
|
|
272
|
-
}
|
|
273
|
-
getViewSize(view) {
|
|
274
|
-
if (!view) {
|
|
275
|
-
return this.gridview.getViewSize();
|
|
276
|
-
}
|
|
277
|
-
const location = this.getViewLocation(view);
|
|
278
|
-
return this.gridview.getViewSize(location);
|
|
279
|
-
}
|
|
280
|
-
getViewCachedVisibleSize(view) {
|
|
281
|
-
const location = this.getViewLocation(view);
|
|
282
|
-
return this.gridview.getViewCachedVisibleSize(location);
|
|
283
|
-
}
|
|
284
|
-
maximizeView(view) {
|
|
285
|
-
if (this.views.size < 2) {
|
|
286
|
-
throw new Error('At least two views are required to maximize a view');
|
|
287
|
-
}
|
|
288
|
-
const location = this.getViewLocation(view);
|
|
289
|
-
this.gridview.maximizeView(location);
|
|
290
|
-
}
|
|
291
|
-
exitMaximizedView() {
|
|
292
|
-
this.gridview.exitMaximizedView();
|
|
293
|
-
}
|
|
294
|
-
expandView(view) {
|
|
295
|
-
const location = this.getViewLocation(view);
|
|
296
|
-
this.gridview.expandView(location);
|
|
297
|
-
}
|
|
298
|
-
distributeViewSizes() {
|
|
299
|
-
this.gridview.distributeViewSizes();
|
|
300
|
-
}
|
|
301
|
-
isViewVisible(view) {
|
|
302
|
-
const location = this.getViewLocation(view);
|
|
303
|
-
return this.gridview.isViewVisible(location);
|
|
304
|
-
}
|
|
305
|
-
setViewVisible(view, visible) {
|
|
306
|
-
const location = this.getViewLocation(view);
|
|
307
|
-
this.gridview.setViewVisible(location, visible);
|
|
308
|
-
}
|
|
309
|
-
getViews() {
|
|
310
|
-
return this.gridview.getView();
|
|
311
|
-
}
|
|
312
|
-
getNeighborViews(view, direction, wrap = false) {
|
|
313
|
-
if (!this.didLayout) {
|
|
314
|
-
throw new Error('Can\'t call getNeighborViews before first layout');
|
|
315
|
-
}
|
|
316
|
-
const location = this.getViewLocation(view);
|
|
317
|
-
const root = this.getViews();
|
|
318
|
-
const node = getGridNode(root, location);
|
|
319
|
-
let boundary = getBoxBoundary(node.box, direction);
|
|
320
|
-
if (wrap) {
|
|
321
|
-
if (direction === 0 && node.box.top === 0) {
|
|
322
|
-
boundary = { offset: root.box.top + root.box.height, range: boundary.range };
|
|
323
|
-
}
|
|
324
|
-
else if (direction === 3 && node.box.left + node.box.width === root.box.width) {
|
|
325
|
-
boundary = { offset: 0, range: boundary.range };
|
|
326
|
-
}
|
|
327
|
-
else if (direction === 1 && node.box.top + node.box.height === root.box.height) {
|
|
328
|
-
boundary = { offset: 0, range: boundary.range };
|
|
329
|
-
}
|
|
330
|
-
else if (direction === 2 && node.box.left === 0) {
|
|
331
|
-
boundary = { offset: root.box.left + root.box.width, range: boundary.range };
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return ( findAdjacentBoxLeafNodes(root, oppositeDirection(direction), boundary)
|
|
335
|
-
.map(node => node.view));
|
|
336
|
-
}
|
|
337
|
-
getViewLocation(view) {
|
|
338
|
-
const element = this.views.get(view);
|
|
339
|
-
if (!element) {
|
|
340
|
-
throw new Error('View not found');
|
|
341
|
-
}
|
|
342
|
-
return getGridLocation(element);
|
|
343
|
-
}
|
|
344
|
-
onDidSashReset(location) {
|
|
345
|
-
const resizeToPreferredSize = (location) => {
|
|
346
|
-
const node = this.gridview.getView(location);
|
|
347
|
-
if (isGridBranchNode(node)) {
|
|
348
|
-
return false;
|
|
349
|
-
}
|
|
350
|
-
const direction = getLocationOrientation(this.orientation, location);
|
|
351
|
-
const size = direction === 1 ? node.view.preferredWidth : node.view.preferredHeight;
|
|
352
|
-
if (typeof size !== 'number') {
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
const viewSize = direction === 1 ? { width: Math.round(size) } : { height: Math.round(size) };
|
|
356
|
-
this.gridview.resizeView(location, viewSize);
|
|
357
|
-
return true;
|
|
358
|
-
};
|
|
359
|
-
if (resizeToPreferredSize(location)) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
const [parentLocation, index] = tail2(location);
|
|
363
|
-
if (resizeToPreferredSize([...parentLocation, index + 1])) {
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
this.gridview.distributeViewSizes(parentLocation);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
class SerializableGrid extends Grid {
|
|
370
|
-
constructor() {
|
|
371
|
-
super(...arguments);
|
|
372
|
-
this.initialLayoutContext = true;
|
|
373
|
-
}
|
|
374
|
-
static serializeNode(node, orientation) {
|
|
375
|
-
const size = orientation === 0 ? node.box.width : node.box.height;
|
|
376
|
-
if (!isGridBranchNode(node)) {
|
|
377
|
-
const serializedLeafNode = { type: 'leaf', data: node.view.toJSON(), size };
|
|
378
|
-
if (typeof node.cachedVisibleSize === 'number') {
|
|
379
|
-
serializedLeafNode.size = node.cachedVisibleSize;
|
|
380
|
-
serializedLeafNode.visible = false;
|
|
381
|
-
}
|
|
382
|
-
else if (node.maximized) {
|
|
383
|
-
serializedLeafNode.maximized = true;
|
|
384
|
-
}
|
|
385
|
-
return serializedLeafNode;
|
|
386
|
-
}
|
|
387
|
-
const data = ( node.children.map(c => SerializableGrid.serializeNode(c, orthogonal(orientation))));
|
|
388
|
-
if (( data.some(c => c.visible !== false))) {
|
|
389
|
-
return { type: 'branch', data: data, size };
|
|
390
|
-
}
|
|
391
|
-
return { type: 'branch', data: data, size, visible: false };
|
|
392
|
-
}
|
|
393
|
-
static deserialize(json, deserializer, options = {}) {
|
|
394
|
-
if (typeof json.orientation !== 'number') {
|
|
395
|
-
throw new Error('Invalid JSON: \'orientation\' property must be a number.');
|
|
396
|
-
}
|
|
397
|
-
else if (typeof json.width !== 'number') {
|
|
398
|
-
throw new Error('Invalid JSON: \'width\' property must be a number.');
|
|
399
|
-
}
|
|
400
|
-
else if (typeof json.height !== 'number') {
|
|
401
|
-
throw new Error('Invalid JSON: \'height\' property must be a number.');
|
|
402
|
-
}
|
|
403
|
-
const gridview = GridView.deserialize(json, deserializer, options);
|
|
404
|
-
const result = ( new SerializableGrid(gridview, options));
|
|
405
|
-
return result;
|
|
406
|
-
}
|
|
407
|
-
static from(gridDescriptor, options = {}) {
|
|
408
|
-
return SerializableGrid.deserialize(createSerializedGrid(gridDescriptor), { fromJSON: view => view }, options);
|
|
409
|
-
}
|
|
410
|
-
serialize() {
|
|
411
|
-
return {
|
|
412
|
-
root: SerializableGrid.serializeNode(this.getViews(), this.orientation),
|
|
413
|
-
orientation: this.orientation,
|
|
414
|
-
width: this.width,
|
|
415
|
-
height: this.height
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
layout(width, height, top = 0, left = 0) {
|
|
419
|
-
super.layout(width, height, top, left);
|
|
420
|
-
if (this.initialLayoutContext) {
|
|
421
|
-
this.initialLayoutContext = false;
|
|
422
|
-
this.gridview.trySet2x2();
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
function isGridBranchNodeDescriptor(nodeDescriptor) {
|
|
427
|
-
return !!nodeDescriptor.groups;
|
|
428
|
-
}
|
|
429
|
-
function sanitizeGridNodeDescriptor(nodeDescriptor, rootNode) {
|
|
430
|
-
if (!rootNode && nodeDescriptor.groups && nodeDescriptor.groups.length <= 1) {
|
|
431
|
-
nodeDescriptor.groups = undefined;
|
|
432
|
-
}
|
|
433
|
-
if (!isGridBranchNodeDescriptor(nodeDescriptor)) {
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
let totalDefinedSize = 0;
|
|
437
|
-
let totalDefinedSizeCount = 0;
|
|
438
|
-
for (const child of nodeDescriptor.groups) {
|
|
439
|
-
sanitizeGridNodeDescriptor(child, false);
|
|
440
|
-
if (child.size) {
|
|
441
|
-
totalDefinedSize += child.size;
|
|
442
|
-
totalDefinedSizeCount++;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
const totalUndefinedSize = totalDefinedSizeCount > 0 ? totalDefinedSize : 1;
|
|
446
|
-
const totalUndefinedSizeCount = nodeDescriptor.groups.length - totalDefinedSizeCount;
|
|
447
|
-
const eachUndefinedSize = totalUndefinedSize / totalUndefinedSizeCount;
|
|
448
|
-
for (const child of nodeDescriptor.groups) {
|
|
449
|
-
if (!child.size) {
|
|
450
|
-
child.size = eachUndefinedSize;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
function createSerializedNode(nodeDescriptor) {
|
|
455
|
-
if (isGridBranchNodeDescriptor(nodeDescriptor)) {
|
|
456
|
-
return { type: 'branch', data: ( nodeDescriptor.groups.map(c => createSerializedNode(c))), size: nodeDescriptor.size };
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
return { type: 'leaf', data: nodeDescriptor.data, size: nodeDescriptor.size };
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
function getDimensions(node, orientation) {
|
|
463
|
-
if (node.type === 'branch') {
|
|
464
|
-
const childrenDimensions = ( node.data.map(c => getDimensions(c, orthogonal(orientation))));
|
|
465
|
-
if (orientation === 0 ) {
|
|
466
|
-
const width = node.size || (childrenDimensions.length === 0 ? undefined : Math.max(...( childrenDimensions.map(d => d.width || 0))));
|
|
467
|
-
const height = childrenDimensions.length === 0 ? undefined : childrenDimensions.reduce((r, d) => r + (d.height || 0), 0);
|
|
468
|
-
return { width, height };
|
|
469
|
-
}
|
|
470
|
-
else {
|
|
471
|
-
const width = childrenDimensions.length === 0 ? undefined : childrenDimensions.reduce((r, d) => r + (d.width || 0), 0);
|
|
472
|
-
const height = node.size || (childrenDimensions.length === 0 ? undefined : Math.max(...( childrenDimensions.map(d => d.height || 0))));
|
|
473
|
-
return { width, height };
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
const width = orientation === 0 ? node.size : undefined;
|
|
478
|
-
const height = orientation === 0 ? undefined : node.size;
|
|
479
|
-
return { width, height };
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
function createSerializedGrid(gridDescriptor) {
|
|
483
|
-
sanitizeGridNodeDescriptor(gridDescriptor, true);
|
|
484
|
-
const root = createSerializedNode(gridDescriptor);
|
|
485
|
-
const { width, height } = getDimensions(root, gridDescriptor.orientation);
|
|
486
|
-
return {
|
|
487
|
-
root,
|
|
488
|
-
orientation: gridDescriptor.orientation,
|
|
489
|
-
width: width || 1,
|
|
490
|
-
height: height || 1
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
export { Grid, SerializableGrid, Sizing, createSerializedGrid, getRelativeLocation, isGridBranchNode, orthogonal, sanitizeGridNodeDescriptor };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from '../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
-
|
|
3
|
-
var css = ".monaco-grid-view{overflow:hidden;position:relative}.monaco-grid-branch-node,.monaco-grid-view{height:100%;width:100%}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|