@codingame/monaco-vscode-api 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/README.md +2 -0
- package/contributions.js +1 -0
- package/extensions.d.ts +6 -3
- package/extensions.js +18 -7
- package/lifecycle.js +11 -3
- package/missing-services.js +55 -10
- package/monaco.js +7 -3
- package/package.json +8 -8
- package/service-override/tools/views.d.ts +98 -0
- package/service-override/tools/views.js +249 -0
- package/services.d.ts +4 -2
- package/services.js +11 -9
- package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
- package/vscode/src/vs/base/browser/dom.js +18 -1
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
- package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
- package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
- package/vscode/src/vs/base/common/async.js +46 -2
- package/vscode/src/vs/base/common/codicons.d.ts +579 -0
- package/vscode/src/vs/base/common/event.js +11 -2
- package/vscode/src/vs/base/common/keybindingParser.js +87 -0
- package/vscode/src/vs/base/common/network.js +1 -2
- package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
- package/vscode/src/vs/base/common/platform.js +2 -1
- package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
- package/vscode/src/vs/platform/log/browser/log.js +24 -0
- package/vscode/src/vs/platform/product/common/product.js +1 -2
- package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
- package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
- package/vscode/src/vs/workbench/browser/window.js +239 -5
- package/vscode/src/vs/workbench/common/configuration.js +11 -1
- package/vscode/src/vs/workbench/common/theme.js +3 -3
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
- package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
- package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
- package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
- package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
- package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
- package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
- package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
import { tail2, equals } from '../../../common/arrays.js';
|
|
2
|
+
import { Disposable } from '../../../common/lifecycle.js';
|
|
3
|
+
import './gridview.css.js';
|
|
4
|
+
import { GridView, orthogonal } from './gridview.js';
|
|
5
|
+
import { Sizing as Sizing$1 } from '../splitview/splitview.js';
|
|
6
|
+
function oppositeDirection(direction) {
|
|
7
|
+
switch (direction) {
|
|
8
|
+
case 0 : return 1 ;
|
|
9
|
+
case 1 : return 0 ;
|
|
10
|
+
case 2 : return 3 ;
|
|
11
|
+
case 3 : return 2 ;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function isGridBranchNode(node) {
|
|
15
|
+
return !!node.children;
|
|
16
|
+
}
|
|
17
|
+
function getGridNode(node, location) {
|
|
18
|
+
if (location.length === 0) {
|
|
19
|
+
return node;
|
|
20
|
+
}
|
|
21
|
+
if (!isGridBranchNode(node)) {
|
|
22
|
+
throw new Error('Invalid location');
|
|
23
|
+
}
|
|
24
|
+
const [index, ...rest] = location;
|
|
25
|
+
return getGridNode(node.children[index], rest);
|
|
26
|
+
}
|
|
27
|
+
function intersects(one, other) {
|
|
28
|
+
return !(one.start >= other.end || other.start >= one.end);
|
|
29
|
+
}
|
|
30
|
+
function getBoxBoundary(box, direction) {
|
|
31
|
+
const orientation = getDirectionOrientation(direction);
|
|
32
|
+
const offset = direction === 0 ? box.top :
|
|
33
|
+
direction === 3 ? box.left + box.width :
|
|
34
|
+
direction === 1 ? box.top + box.height :
|
|
35
|
+
box.left;
|
|
36
|
+
const range = {
|
|
37
|
+
start: orientation === 1 ? box.top : box.left,
|
|
38
|
+
end: orientation === 1 ? box.top + box.height : box.left + box.width
|
|
39
|
+
};
|
|
40
|
+
return { offset, range };
|
|
41
|
+
}
|
|
42
|
+
function findAdjacentBoxLeafNodes(boxNode, direction, boundary) {
|
|
43
|
+
const result = [];
|
|
44
|
+
function _(boxNode, direction, boundary) {
|
|
45
|
+
if (isGridBranchNode(boxNode)) {
|
|
46
|
+
for (const child of boxNode.children) {
|
|
47
|
+
_(child, direction, boundary);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const { offset, range } = getBoxBoundary(boxNode.box, direction);
|
|
52
|
+
if (offset === boundary.offset && intersects(range, boundary.range)) {
|
|
53
|
+
result.push(boxNode);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_(boxNode, direction, boundary);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
function getLocationOrientation(rootOrientation, location) {
|
|
61
|
+
return location.length % 2 === 0 ? orthogonal(rootOrientation) : rootOrientation;
|
|
62
|
+
}
|
|
63
|
+
function getDirectionOrientation(direction) {
|
|
64
|
+
return direction === 0 || direction === 1 ? 0 : 1 ;
|
|
65
|
+
}
|
|
66
|
+
function getRelativeLocation(rootOrientation, location, direction) {
|
|
67
|
+
const orientation = getLocationOrientation(rootOrientation, location);
|
|
68
|
+
const directionOrientation = getDirectionOrientation(direction);
|
|
69
|
+
if (orientation === directionOrientation) {
|
|
70
|
+
let [rest, index] = tail2(location);
|
|
71
|
+
if (direction === 3 || direction === 1 ) {
|
|
72
|
+
index += 1;
|
|
73
|
+
}
|
|
74
|
+
return [...rest, index];
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const index = ((direction === 3 || direction === 1) ) ? 1 : 0;
|
|
78
|
+
return [...location, index];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function indexInParent(element) {
|
|
82
|
+
const parentElement = element.parentElement;
|
|
83
|
+
if (!parentElement) {
|
|
84
|
+
throw new Error('Invalid grid element');
|
|
85
|
+
}
|
|
86
|
+
let el = parentElement.firstElementChild;
|
|
87
|
+
let index = 0;
|
|
88
|
+
while (el !== element && el !== parentElement.lastElementChild && el) {
|
|
89
|
+
el = el.nextElementSibling;
|
|
90
|
+
index++;
|
|
91
|
+
}
|
|
92
|
+
return index;
|
|
93
|
+
}
|
|
94
|
+
function getGridLocation(element) {
|
|
95
|
+
const parentElement = element.parentElement;
|
|
96
|
+
if (!parentElement) {
|
|
97
|
+
throw new Error('Invalid grid element');
|
|
98
|
+
}
|
|
99
|
+
if (/\bmonaco-grid-view\b/.test(parentElement.className)) {
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
const index = indexInParent(parentElement);
|
|
103
|
+
const ancestor = parentElement.parentElement.parentElement.parentElement.parentElement;
|
|
104
|
+
return [...getGridLocation(ancestor), index];
|
|
105
|
+
}
|
|
106
|
+
var Sizing;
|
|
107
|
+
( (function(Sizing) {
|
|
108
|
+
Sizing.Distribute = { type: 'distribute' };
|
|
109
|
+
Sizing.Split = { type: 'split' };
|
|
110
|
+
Sizing.Auto = { type: 'auto' };
|
|
111
|
+
function Invisible(cachedVisibleSize) { return { type: 'invisible', cachedVisibleSize }; }
|
|
112
|
+
Sizing.Invisible = Invisible;
|
|
113
|
+
})(Sizing || (Sizing = {})));
|
|
114
|
+
class Grid extends Disposable {
|
|
115
|
+
get orientation() { return this.gridview.orientation; }
|
|
116
|
+
set orientation(orientation) { this.gridview.orientation = orientation; }
|
|
117
|
+
get width() { return this.gridview.width; }
|
|
118
|
+
get height() { return this.gridview.height; }
|
|
119
|
+
get minimumWidth() { return this.gridview.minimumWidth; }
|
|
120
|
+
get minimumHeight() { return this.gridview.minimumHeight; }
|
|
121
|
+
get maximumWidth() { return this.gridview.maximumWidth; }
|
|
122
|
+
get maximumHeight() { return this.gridview.maximumHeight; }
|
|
123
|
+
get boundarySashes() { return this.gridview.boundarySashes; }
|
|
124
|
+
set boundarySashes(boundarySashes) { this.gridview.boundarySashes = boundarySashes; }
|
|
125
|
+
set edgeSnapping(edgeSnapping) { this.gridview.edgeSnapping = edgeSnapping; }
|
|
126
|
+
get element() { return this.gridview.element; }
|
|
127
|
+
constructor(view, options = {}) {
|
|
128
|
+
super();
|
|
129
|
+
this.views = ( new Map());
|
|
130
|
+
this.didLayout = false;
|
|
131
|
+
if (view instanceof GridView) {
|
|
132
|
+
this.gridview = view;
|
|
133
|
+
this.gridview.getViewMap(this.views);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
this.gridview = ( new GridView(options));
|
|
137
|
+
}
|
|
138
|
+
this._register(this.gridview);
|
|
139
|
+
this._register(this.gridview.onDidSashReset(this.onDidSashReset, this));
|
|
140
|
+
if (!(view instanceof GridView)) {
|
|
141
|
+
this._addView(view, 0, [0]);
|
|
142
|
+
}
|
|
143
|
+
this.onDidChange = this.gridview.onDidChange;
|
|
144
|
+
this.onDidScroll = this.gridview.onDidScroll;
|
|
145
|
+
this.onDidChangeViewMaximized = this.gridview.onDidChangeViewMaximized;
|
|
146
|
+
}
|
|
147
|
+
style(styles) {
|
|
148
|
+
this.gridview.style(styles);
|
|
149
|
+
}
|
|
150
|
+
layout(width, height, top = 0, left = 0) {
|
|
151
|
+
this.gridview.layout(width, height, top, left);
|
|
152
|
+
this.didLayout = true;
|
|
153
|
+
}
|
|
154
|
+
addView(newView, size, referenceView, direction) {
|
|
155
|
+
if (( this.views.has(newView))) {
|
|
156
|
+
throw new Error('Can\'t add same view twice');
|
|
157
|
+
}
|
|
158
|
+
const orientation = getDirectionOrientation(direction);
|
|
159
|
+
if (this.views.size === 1 && this.orientation !== orientation) {
|
|
160
|
+
this.orientation = orientation;
|
|
161
|
+
}
|
|
162
|
+
const referenceLocation = this.getViewLocation(referenceView);
|
|
163
|
+
const location = getRelativeLocation(this.gridview.orientation, referenceLocation, direction);
|
|
164
|
+
let viewSize;
|
|
165
|
+
if (typeof size === 'number') {
|
|
166
|
+
viewSize = size;
|
|
167
|
+
}
|
|
168
|
+
else if (size.type === 'split') {
|
|
169
|
+
const [, index] = tail2(referenceLocation);
|
|
170
|
+
viewSize = Sizing$1.Split(index);
|
|
171
|
+
}
|
|
172
|
+
else if (size.type === 'distribute') {
|
|
173
|
+
viewSize = Sizing$1.Distribute;
|
|
174
|
+
}
|
|
175
|
+
else if (size.type === 'auto') {
|
|
176
|
+
const [, index] = tail2(referenceLocation);
|
|
177
|
+
viewSize = Sizing$1.Auto(index);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
viewSize = size;
|
|
181
|
+
}
|
|
182
|
+
this._addView(newView, viewSize, location);
|
|
183
|
+
}
|
|
184
|
+
addViewAt(newView, size, location) {
|
|
185
|
+
if (( this.views.has(newView))) {
|
|
186
|
+
throw new Error('Can\'t add same view twice');
|
|
187
|
+
}
|
|
188
|
+
let viewSize;
|
|
189
|
+
if (typeof size === 'number') {
|
|
190
|
+
viewSize = size;
|
|
191
|
+
}
|
|
192
|
+
else if (size.type === 'distribute') {
|
|
193
|
+
viewSize = Sizing$1.Distribute;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
viewSize = size;
|
|
197
|
+
}
|
|
198
|
+
this._addView(newView, viewSize, location);
|
|
199
|
+
}
|
|
200
|
+
_addView(newView, size, location) {
|
|
201
|
+
this.views.set(newView, newView.element);
|
|
202
|
+
this.gridview.addView(newView, size, location);
|
|
203
|
+
}
|
|
204
|
+
removeView(view, sizing) {
|
|
205
|
+
if (this.views.size === 1) {
|
|
206
|
+
throw new Error('Can\'t remove last view');
|
|
207
|
+
}
|
|
208
|
+
const location = this.getViewLocation(view);
|
|
209
|
+
let gridViewSizing;
|
|
210
|
+
if (sizing?.type === 'distribute') {
|
|
211
|
+
gridViewSizing = Sizing$1.Distribute;
|
|
212
|
+
}
|
|
213
|
+
else if (sizing?.type === 'auto') {
|
|
214
|
+
const index = location[location.length - 1];
|
|
215
|
+
gridViewSizing = Sizing$1.Auto(index === 0 ? 1 : index - 1);
|
|
216
|
+
}
|
|
217
|
+
this.gridview.removeView(location, gridViewSizing);
|
|
218
|
+
this.views.delete(view);
|
|
219
|
+
}
|
|
220
|
+
moveView(view, sizing, referenceView, direction) {
|
|
221
|
+
const sourceLocation = this.getViewLocation(view);
|
|
222
|
+
const [sourceParentLocation, from] = tail2(sourceLocation);
|
|
223
|
+
const referenceLocation = this.getViewLocation(referenceView);
|
|
224
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, direction);
|
|
225
|
+
const [targetParentLocation, to] = tail2(targetLocation);
|
|
226
|
+
if (equals(sourceParentLocation, targetParentLocation)) {
|
|
227
|
+
this.gridview.moveView(sourceParentLocation, from, to);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
this.removeView(view, typeof sizing === 'number' ? undefined : sizing);
|
|
231
|
+
this.addView(view, sizing, referenceView, direction);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
moveViewTo(view, location) {
|
|
235
|
+
const sourceLocation = this.getViewLocation(view);
|
|
236
|
+
const [sourceParentLocation, from] = tail2(sourceLocation);
|
|
237
|
+
const [targetParentLocation, to] = tail2(location);
|
|
238
|
+
if (equals(sourceParentLocation, targetParentLocation)) {
|
|
239
|
+
this.gridview.moveView(sourceParentLocation, from, to);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
const size = this.getViewSize(view);
|
|
243
|
+
const orientation = getLocationOrientation(this.gridview.orientation, sourceLocation);
|
|
244
|
+
const cachedViewSize = this.getViewCachedVisibleSize(view);
|
|
245
|
+
const sizing = typeof cachedViewSize === 'undefined'
|
|
246
|
+
? (orientation === 1 ? size.width : size.height)
|
|
247
|
+
: Sizing.Invisible(cachedViewSize);
|
|
248
|
+
this.removeView(view);
|
|
249
|
+
this.addViewAt(view, sizing, location);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
swapViews(from, to) {
|
|
253
|
+
const fromLocation = this.getViewLocation(from);
|
|
254
|
+
const toLocation = this.getViewLocation(to);
|
|
255
|
+
return this.gridview.swapViews(fromLocation, toLocation);
|
|
256
|
+
}
|
|
257
|
+
resizeView(view, size) {
|
|
258
|
+
const location = this.getViewLocation(view);
|
|
259
|
+
return this.gridview.resizeView(location, size);
|
|
260
|
+
}
|
|
261
|
+
isViewExpanded(view) {
|
|
262
|
+
const location = this.getViewLocation(view);
|
|
263
|
+
return this.gridview.isViewExpanded(location);
|
|
264
|
+
}
|
|
265
|
+
isViewMaximized(view) {
|
|
266
|
+
const location = this.getViewLocation(view);
|
|
267
|
+
return this.gridview.isViewMaximized(location);
|
|
268
|
+
}
|
|
269
|
+
hasMaximizedView() {
|
|
270
|
+
return this.gridview.hasMaximizedView();
|
|
271
|
+
}
|
|
272
|
+
getViewSize(view) {
|
|
273
|
+
if (!view) {
|
|
274
|
+
return this.gridview.getViewSize();
|
|
275
|
+
}
|
|
276
|
+
const location = this.getViewLocation(view);
|
|
277
|
+
return this.gridview.getViewSize(location);
|
|
278
|
+
}
|
|
279
|
+
getViewCachedVisibleSize(view) {
|
|
280
|
+
const location = this.getViewLocation(view);
|
|
281
|
+
return this.gridview.getViewCachedVisibleSize(location);
|
|
282
|
+
}
|
|
283
|
+
maximizeView(view) {
|
|
284
|
+
if (this.views.size < 2) {
|
|
285
|
+
throw new Error('At least two views are required to maximize a view');
|
|
286
|
+
}
|
|
287
|
+
const location = this.getViewLocation(view);
|
|
288
|
+
this.gridview.maximizeView(location);
|
|
289
|
+
}
|
|
290
|
+
exitMaximizedView() {
|
|
291
|
+
this.gridview.exitMaximizedView();
|
|
292
|
+
}
|
|
293
|
+
expandView(view) {
|
|
294
|
+
const location = this.getViewLocation(view);
|
|
295
|
+
this.gridview.expandView(location);
|
|
296
|
+
}
|
|
297
|
+
distributeViewSizes() {
|
|
298
|
+
this.gridview.distributeViewSizes();
|
|
299
|
+
}
|
|
300
|
+
isViewVisible(view) {
|
|
301
|
+
const location = this.getViewLocation(view);
|
|
302
|
+
return this.gridview.isViewVisible(location);
|
|
303
|
+
}
|
|
304
|
+
setViewVisible(view, visible) {
|
|
305
|
+
const location = this.getViewLocation(view);
|
|
306
|
+
this.gridview.setViewVisible(location, visible);
|
|
307
|
+
}
|
|
308
|
+
getViews() {
|
|
309
|
+
return this.gridview.getView();
|
|
310
|
+
}
|
|
311
|
+
getNeighborViews(view, direction, wrap = false) {
|
|
312
|
+
if (!this.didLayout) {
|
|
313
|
+
throw new Error('Can\'t call getNeighborViews before first layout');
|
|
314
|
+
}
|
|
315
|
+
const location = this.getViewLocation(view);
|
|
316
|
+
const root = this.getViews();
|
|
317
|
+
const node = getGridNode(root, location);
|
|
318
|
+
let boundary = getBoxBoundary(node.box, direction);
|
|
319
|
+
if (wrap) {
|
|
320
|
+
if (direction === 0 && node.box.top === 0) {
|
|
321
|
+
boundary = { offset: root.box.top + root.box.height, range: boundary.range };
|
|
322
|
+
}
|
|
323
|
+
else if (direction === 3 && node.box.left + node.box.width === root.box.width) {
|
|
324
|
+
boundary = { offset: 0, range: boundary.range };
|
|
325
|
+
}
|
|
326
|
+
else if (direction === 1 && node.box.top + node.box.height === root.box.height) {
|
|
327
|
+
boundary = { offset: 0, range: boundary.range };
|
|
328
|
+
}
|
|
329
|
+
else if (direction === 2 && node.box.left === 0) {
|
|
330
|
+
boundary = { offset: root.box.left + root.box.width, range: boundary.range };
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return ( findAdjacentBoxLeafNodes(root, oppositeDirection(direction), boundary)
|
|
334
|
+
.map(node => node.view));
|
|
335
|
+
}
|
|
336
|
+
getViewLocation(view) {
|
|
337
|
+
const element = this.views.get(view);
|
|
338
|
+
if (!element) {
|
|
339
|
+
throw new Error('View not found');
|
|
340
|
+
}
|
|
341
|
+
return getGridLocation(element);
|
|
342
|
+
}
|
|
343
|
+
onDidSashReset(location) {
|
|
344
|
+
const resizeToPreferredSize = (location) => {
|
|
345
|
+
const node = this.gridview.getView(location);
|
|
346
|
+
if (isGridBranchNode(node)) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
const direction = getLocationOrientation(this.orientation, location);
|
|
350
|
+
const size = direction === 1 ? node.view.preferredWidth : node.view.preferredHeight;
|
|
351
|
+
if (typeof size !== 'number') {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
const viewSize = direction === 1 ? { width: Math.round(size) } : { height: Math.round(size) };
|
|
355
|
+
this.gridview.resizeView(location, viewSize);
|
|
356
|
+
return true;
|
|
357
|
+
};
|
|
358
|
+
if (resizeToPreferredSize(location)) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const [parentLocation, index] = tail2(location);
|
|
362
|
+
if (resizeToPreferredSize([...parentLocation, index + 1])) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
this.gridview.distributeViewSizes(parentLocation);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
class SerializableGrid extends Grid {
|
|
369
|
+
constructor() {
|
|
370
|
+
super(...arguments);
|
|
371
|
+
this.initialLayoutContext = true;
|
|
372
|
+
}
|
|
373
|
+
static serializeNode(node, orientation) {
|
|
374
|
+
const size = orientation === 0 ? node.box.width : node.box.height;
|
|
375
|
+
if (!isGridBranchNode(node)) {
|
|
376
|
+
const serializedLeafNode = { type: 'leaf', data: node.view.toJSON(), size };
|
|
377
|
+
if (typeof node.cachedVisibleSize === 'number') {
|
|
378
|
+
serializedLeafNode.size = node.cachedVisibleSize;
|
|
379
|
+
serializedLeafNode.visible = false;
|
|
380
|
+
}
|
|
381
|
+
else if (node.maximized) {
|
|
382
|
+
serializedLeafNode.maximized = true;
|
|
383
|
+
}
|
|
384
|
+
return serializedLeafNode;
|
|
385
|
+
}
|
|
386
|
+
const data = ( node.children.map(c => SerializableGrid.serializeNode(c, orthogonal(orientation))));
|
|
387
|
+
if (( data.some(c => c.visible !== false))) {
|
|
388
|
+
return { type: 'branch', data: data, size };
|
|
389
|
+
}
|
|
390
|
+
return { type: 'branch', data: data, size, visible: false };
|
|
391
|
+
}
|
|
392
|
+
static deserialize(json, deserializer, options = {}) {
|
|
393
|
+
if (typeof json.orientation !== 'number') {
|
|
394
|
+
throw new Error('Invalid JSON: \'orientation\' property must be a number.');
|
|
395
|
+
}
|
|
396
|
+
else if (typeof json.width !== 'number') {
|
|
397
|
+
throw new Error('Invalid JSON: \'width\' property must be a number.');
|
|
398
|
+
}
|
|
399
|
+
else if (typeof json.height !== 'number') {
|
|
400
|
+
throw new Error('Invalid JSON: \'height\' property must be a number.');
|
|
401
|
+
}
|
|
402
|
+
const gridview = GridView.deserialize(json, deserializer, options);
|
|
403
|
+
const result = ( new SerializableGrid(gridview, options));
|
|
404
|
+
return result;
|
|
405
|
+
}
|
|
406
|
+
static from(gridDescriptor, options = {}) {
|
|
407
|
+
return SerializableGrid.deserialize(createSerializedGrid(gridDescriptor), { fromJSON: view => view }, options);
|
|
408
|
+
}
|
|
409
|
+
serialize() {
|
|
410
|
+
return {
|
|
411
|
+
root: SerializableGrid.serializeNode(this.getViews(), this.orientation),
|
|
412
|
+
orientation: this.orientation,
|
|
413
|
+
width: this.width,
|
|
414
|
+
height: this.height
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
layout(width, height, top = 0, left = 0) {
|
|
418
|
+
super.layout(width, height, top, left);
|
|
419
|
+
if (this.initialLayoutContext) {
|
|
420
|
+
this.initialLayoutContext = false;
|
|
421
|
+
this.gridview.trySet2x2();
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function isGridBranchNodeDescriptor(nodeDescriptor) {
|
|
426
|
+
return !!nodeDescriptor.groups;
|
|
427
|
+
}
|
|
428
|
+
function sanitizeGridNodeDescriptor(nodeDescriptor, rootNode) {
|
|
429
|
+
if (!rootNode && nodeDescriptor.groups && nodeDescriptor.groups.length <= 1) {
|
|
430
|
+
nodeDescriptor.groups = undefined;
|
|
431
|
+
}
|
|
432
|
+
if (!isGridBranchNodeDescriptor(nodeDescriptor)) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
let totalDefinedSize = 0;
|
|
436
|
+
let totalDefinedSizeCount = 0;
|
|
437
|
+
for (const child of nodeDescriptor.groups) {
|
|
438
|
+
sanitizeGridNodeDescriptor(child, false);
|
|
439
|
+
if (child.size) {
|
|
440
|
+
totalDefinedSize += child.size;
|
|
441
|
+
totalDefinedSizeCount++;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
const totalUndefinedSize = totalDefinedSizeCount > 0 ? totalDefinedSize : 1;
|
|
445
|
+
const totalUndefinedSizeCount = nodeDescriptor.groups.length - totalDefinedSizeCount;
|
|
446
|
+
const eachUndefinedSize = totalUndefinedSize / totalUndefinedSizeCount;
|
|
447
|
+
for (const child of nodeDescriptor.groups) {
|
|
448
|
+
if (!child.size) {
|
|
449
|
+
child.size = eachUndefinedSize;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
function createSerializedNode(nodeDescriptor) {
|
|
454
|
+
if (isGridBranchNodeDescriptor(nodeDescriptor)) {
|
|
455
|
+
return { type: 'branch', data: ( nodeDescriptor.groups.map(c => createSerializedNode(c))), size: nodeDescriptor.size };
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
return { type: 'leaf', data: nodeDescriptor.data, size: nodeDescriptor.size };
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function getDimensions(node, orientation) {
|
|
462
|
+
if (node.type === 'branch') {
|
|
463
|
+
const childrenDimensions = ( node.data.map(c => getDimensions(c, orthogonal(orientation))));
|
|
464
|
+
if (orientation === 0 ) {
|
|
465
|
+
const width = node.size || (childrenDimensions.length === 0 ? undefined : Math.max(...( childrenDimensions.map(d => d.width || 0))));
|
|
466
|
+
const height = childrenDimensions.length === 0 ? undefined : childrenDimensions.reduce((r, d) => r + (d.height || 0), 0);
|
|
467
|
+
return { width, height };
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
const width = childrenDimensions.length === 0 ? undefined : childrenDimensions.reduce((r, d) => r + (d.width || 0), 0);
|
|
471
|
+
const height = node.size || (childrenDimensions.length === 0 ? undefined : Math.max(...( childrenDimensions.map(d => d.height || 0))));
|
|
472
|
+
return { width, height };
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
const width = orientation === 0 ? node.size : undefined;
|
|
477
|
+
const height = orientation === 0 ? undefined : node.size;
|
|
478
|
+
return { width, height };
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
function createSerializedGrid(gridDescriptor) {
|
|
482
|
+
sanitizeGridNodeDescriptor(gridDescriptor, true);
|
|
483
|
+
const root = createSerializedNode(gridDescriptor);
|
|
484
|
+
const { width, height } = getDimensions(root, gridDescriptor.orientation);
|
|
485
|
+
return {
|
|
486
|
+
root,
|
|
487
|
+
orientation: gridDescriptor.orientation,
|
|
488
|
+
width: width || 1,
|
|
489
|
+
height: height || 1
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
export { Grid, SerializableGrid, Sizing, createSerializedGrid, getRelativeLocation, isGridBranchNode, orthogonal, sanitizeGridNodeDescriptor };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import n from '../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
var css = ".monaco-grid-view{overflow:hidden;position:relative}.monaco-grid-branch-node,.monaco-grid-view{height:100%;width:100%}";
|
|
3
|
+
n(css,{});
|
|
4
|
+
export { css, css as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IBoundarySashes } from '../sash/sash.js';
|
|
2
2
|
export { Orientation } from '../sash/sash.js';
|
|
3
3
|
import { LayoutPriority } from '../splitview/splitview.js';
|
|
4
|
+
export { Sizing } from '../splitview/splitview.js';
|
|
4
5
|
import { Event } from '../../../common/event.js';
|
|
5
6
|
|
|
6
7
|
interface IViewSize {
|