@codingame/monaco-vscode-api 1.79.0-next.0 → 1.79.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 +7 -5
- package/dist/activity.d.ts +8 -108
- package/dist/api.js +3 -3
- package/dist/colorRegistry.d.ts +2 -2
- package/dist/contextkey.d.ts +2 -2
- package/dist/default-extension.js +23 -0
- package/dist/editor.d.ts +4 -320
- package/dist/editorBrowser.d.ts +327 -10
- package/dist/event.d.ts +1 -1
- package/dist/{extension-tools-d0cfdea1.js → extension-tools-0c4c1ad7.js} +345 -210
- package/dist/extensions.d.ts +3 -4
- package/dist/extensions.d2.ts +1 -1
- package/dist/extensions.js +4 -37
- package/dist/extensionsRegistry.d.ts +1 -1
- package/dist/files.d.ts +2 -2
- package/dist/keybinding.d.ts +1 -1
- package/dist/languageFeatures.d.ts +6 -7
- package/dist/log.d.ts +1 -1
- package/dist/monaco-treemending.js +15 -1
- package/dist/monaco.d.ts +31 -32
- package/dist/monaco.js +62 -6
- package/dist/node_modules/rollup-plugin-styles/dist/runtime/inject-css.js +2 -0
- package/dist/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +4 -0
- package/dist/rollup-extension-directory-plugin.js +1 -2
- package/dist/rollup-vsix-plugin.js +1 -2
- package/dist/service-override/configuration.d.ts +2 -2
- package/dist/service-override/editor.d.ts +13 -0
- package/dist/service-override/{modelEditor.js → editor.js} +6 -62
- package/dist/service-override/files.d.ts +5 -5
- package/dist/service-override/files.js +14 -2
- package/dist/service-override/keybindings.js +3 -79
- package/dist/service-override/layout.js +6 -2
- package/dist/service-override/model.d.ts +7 -0
- package/dist/service-override/model.js +10 -0
- package/dist/service-override/quickaccess.d.ts +7 -0
- package/dist/service-override/quickaccess.js +80 -0
- package/dist/service-override/snippets.js +5 -1
- package/dist/service-override/textmate.js +7 -2
- package/dist/service-override/theme.d.ts +1 -1
- package/dist/service-override/tools/editor.js +73 -0
- package/dist/service-override/views.d.ts +63 -201
- package/dist/service-override/views.js +102 -8
- package/dist/services.d.ts +116 -19
- package/dist/vscode/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
- package/dist/vscode/vs/base/browser/ui/grid/grid.js +452 -0
- package/dist/vscode/vs/base/browser/ui/grid/gridview.css.js +4 -0
- package/dist/vscode/vs/base/browser/ui/grid/gridview.js +999 -0
- package/dist/vscode/vs/base/browser/ui/iconLabel/simpleIconLabel.js +14 -0
- package/dist/vscode/vs/base/browser/ui/menu/menubar.css.js +4 -0
- package/dist/vscode/vs/base/browser/ui/menu/menubar.js +1 -1
- package/dist/vscode/vs/base/browser/ui/splitview/paneview.css.js +4 -0
- package/dist/vscode/vs/base/browser/ui/splitview/paneview.js +1 -1
- package/dist/vscode/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
- package/dist/vscode/vs/platform/extensionManagement/common/extensionStorage.js +1 -1
- package/dist/vscode/vs/platform/product/common/product.js +48 -0
- package/dist/vscode/vs/platform/quickinput/browser/quickPickPin.js +94 -0
- package/dist/vscode/vs/platform/terminal/common/terminal.js +3 -0
- package/dist/vscode/vs/platform/update/common/update.js +11 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadStatusBar.js +68 -0
- package/dist/vscode/vs/workbench/api/common/extHostStatusBar.js +234 -0
- package/dist/vscode/vs/workbench/api/common/extHostTypes.js +6 -1
- package/dist/vscode/vs/workbench/browser/actions/layoutActions.js +20 -17
- package/dist/vscode/vs/workbench/browser/actions/quickAccessActions.js +204 -0
- package/dist/vscode/vs/workbench/browser/dnd.js +27 -2
- package/dist/vscode/vs/workbench/browser/editor.js +94 -0
- package/dist/vscode/vs/workbench/browser/labels.js +23 -2
- package/dist/vscode/vs/workbench/browser/media/part.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/part.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/activitybar/activitybarActions.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/activitybar/activitybarPart.js +3 -3
- package/dist/vscode/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions.js +14 -26
- package/dist/vscode/vs/workbench/browser/parts/compositePart.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/binaryDiffEditor.js +43 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/binaryEditor.js +55 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbs.js +330 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsControl.js +690 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsModel.js +142 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsPicker.js +414 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.contribution.js +800 -6
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.js +56 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editorActions.js +1484 -107
- package/dist/vscode/vs/workbench/browser/parts/editor/editorCommands.js +1121 -4
- package/dist/vscode/vs/workbench/browser/parts/editor/editorDropTarget.js +499 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupView.js +1219 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupWatermark.js +137 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPane.js +242 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPanes.js +297 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPart.js +841 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPlaceholder.js +235 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorQuickAccess.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editorStatus.js +1152 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorWithViewState.js +139 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorsObserver.js +339 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/breadcrumbscontrol.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorgroupview.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorplaceholder.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorquickaccess.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorstatus.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/notabstitlecontrol.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/sidebysideeditor.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/titlecontrol.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/noTabsTitleControl.js +243 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/sideBySideEditor.js +387 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/tabFocus.js +77 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/tabsTitleControl.js +1504 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/textCodeEditor.js +79 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/textDiffEditor.js +304 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/textEditor.js +220 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/textResourceEditor.js +149 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/titleControl.js +284 -0
- package/dist/vscode/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsActions.js +8 -8
- package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsCenter.js +2 -2
- package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsList.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsToasts.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/panel/media/basepanelpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/panel/media/panelpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/panel/panelActions.js +19 -5
- package/dist/vscode/vs/workbench/browser/parts/panel/panelPart.js +2 -2
- package/dist/vscode/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/sidebar/sidebarPart.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/statusbar/media/statusbarpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarActions.js +109 -0
- package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarItem.js +224 -0
- package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarModel.js +251 -0
- package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarPart.js +439 -0
- package/dist/vscode/vs/workbench/browser/parts/titlebar/media/menubarControl.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/titlebar/menubarControl.js +76 -3
- package/dist/vscode/vs/workbench/browser/parts/views/media/paneviewlet.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/views/media/views.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/views/treeView.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/views/viewPane.js +5 -5
- package/dist/vscode/vs/workbench/browser/parts/views/viewPaneContainer.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/views/viewsService.js +4 -4
- package/dist/vscode/vs/workbench/browser/quickaccess.js +6 -2
- package/dist/vscode/vs/workbench/browser/workbench.contribution.js +1108 -0
- package/dist/vscode/vs/workbench/common/contextkeys.js +34 -1
- package/dist/vscode/vs/workbench/common/editor/editorGroupModel.js +674 -0
- package/dist/vscode/vs/workbench/common/editor.js +57 -1
- package/dist/vscode/vs/workbench/common/theme.js +35 -35
- package/dist/vscode/vs/workbench/common/views.js +1 -1
- package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +4 -4
- package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +1 -1
- package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +77 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.js +217 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.js +24 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/breakpointWidget.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debug.contribution.js +30 -4
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugCommands.js +13 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugIcons.js +77 -127
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugToolBar.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugViewlet.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/disassemblyView.js +620 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/exceptionWidget.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugHover.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/repl.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/repl.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/common/debug.js +2 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +71 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/editors/textFileEditor.js +225 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/explorerViewlet.js +5 -4
- package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.contribution.js +270 -4
- package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.js +4 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/fileCommands.js +24 -6
- package/dist/vscode/vs/workbench/contrib/files/browser/fileConstants.js +8 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/files.contribution.js +10 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/media/explorerviewlet.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/views/media/openeditors.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/views/openEditorsView.js +608 -0
- package/dist/vscode/vs/workbench/contrib/files/common/files.js +2 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionInputPart.js +1 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionWidget.js +1 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/media/interactiveSession.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionContextKeys.js +9 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionModel.js +305 -0
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionService.js +6 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionServiceImpl.js +379 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser.js +2 -2
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +33 -1
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +130 -0
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +225 -0
- package/dist/vscode/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/remote/browser/remoteIcons.js +21 -17
- package/dist/vscode/vs/workbench/contrib/remote/browser/tunnelView.js +1 -1
- package/dist/vscode/vs/workbench/contrib/search/browser/anythingQuickAccess.js +757 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/search.contribution.js +428 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +219 -0
- package/dist/vscode/vs/workbench/contrib/search/common/cacheState.js +85 -0
- package/dist/vscode/vs/workbench/contrib/search/common/constants.js +2 -0
- package/dist/vscode/vs/workbench/contrib/search/common/search.js +119 -1
- package/dist/vscode/vs/workbench/contrib/tasks/browser/taskQuickPick.js +385 -0
- package/dist/vscode/vs/workbench/contrib/tasks/browser/tasksQuickAccess.js +108 -0
- package/dist/vscode/vs/workbench/contrib/tasks/common/tasks.js +351 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcon.js +44 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +147 -1
- package/dist/vscode/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +1 -1
- package/dist/vscode/vs/workbench/services/editor/browser/editorDropService.js +3 -0
- package/dist/vscode/vs/workbench/services/editor/browser/editorResolverService.js +619 -0
- package/dist/vscode/vs/workbench/services/editor/browser/editorService.js +720 -0
- package/dist/vscode/vs/workbench/services/editor/common/editorGroupFinder.js +116 -0
- package/dist/vscode/vs/workbench/services/editor/common/editorGroupsService.js +6 -1
- package/dist/vscode/vs/workbench/services/editor/common/editorResolverService.js +34 -1
- package/dist/vscode/vs/workbench/services/history/browser/historyService.js +1451 -0
- package/dist/vscode/vs/workbench/services/hover/browser/hoverService.js +1 -1
- package/dist/vscode/vs/workbench/services/hover/browser/media/hover.css.js +4 -0
- package/dist/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.js +2 -1
- package/dist/vscode/vs/workbench/services/outline/browser/outline.js +3 -0
- package/dist/vscode/vs/workbench/services/progress/browser/progressIndicator.js +72 -1
- package/dist/vscode/vs/workbench/services/quickinput/browser/quickInputService.js +67 -0
- package/dist/vscode/vs/workbench/services/search/common/search.js +2 -112
- package/dist/vscode/vs/workbench/services/semanticSimilarity/common/semanticSimilarityService.js +54 -1
- package/dist/vscode/vs/workbench/services/statusbar/browser/statusbar.js +15 -0
- package/dist/vscode/vs/workbench/services/textMate/browser/worker/textMate.worker.js +90 -0
- package/dist/vscode/vs/workbench/services/textMate/browser/worker/textMateWorkerModel.js +133 -0
- package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.js +110 -3
- package/dist/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.js +1 -1
- package/dist/vscode-services/extHost.js +12 -5
- package/dist/vscode-services/missing-services.js +117 -3
- package/dist/vscode-services/window.js +21 -2
- package/dist/vscode-services/workspace.js +2 -1
- package/dist/workbenchThemeService.d.ts +1 -1
- package/dist/workers/textMate.worker.d.ts +2 -0
- package/dist/workers/textMate.worker.js +3 -0
- package/dist/workspace.d.ts +1 -1
- package/monaco-editor-treemending.patch +784 -784
- package/package.json +42 -22
- package/dist/assets/activityaction.css +0 -224
- package/dist/assets/activitybarpart.css +0 -65
- package/dist/assets/basepanelpart.css +0 -221
- package/dist/assets/breakpointWidget.css +0 -31
- package/dist/assets/callHierarchy.css +0 -62
- package/dist/assets/callStackEditorContribution.css +0 -12
- package/dist/assets/compositepart.css +0 -17
- package/dist/assets/debug.contribution.css +0 -138
- package/dist/assets/debugHover.css +0 -80
- package/dist/assets/debugToolBar.css +0 -49
- package/dist/assets/debugViewlet.css +0 -337
- package/dist/assets/editorquickaccess.css +0 -8
- package/dist/assets/exceptionWidget.css +0 -52
- package/dist/assets/explorerviewlet.css +0 -129
- package/dist/assets/hover.css +0 -127
- package/dist/assets/interactiveSession.css +0 -340
- package/dist/assets/menubar.css +0 -111
- package/dist/assets/menubarControl.css +0 -61
- package/dist/assets/notificationsActions.css +0 -14
- package/dist/assets/notificationsCenter.css +0 -69
- package/dist/assets/notificationsList.css +0 -152
- package/dist/assets/notificationsToasts.css +0 -63
- package/dist/assets/panelpart.css +0 -75
- package/dist/assets/paneview.css +0 -148
- package/dist/assets/paneviewlet.css +0 -79
- package/dist/assets/part.css +0 -109
- package/dist/assets/repl.css +0 -145
- package/dist/assets/sidebarpart.css +0 -61
- package/dist/assets/tunnelView.css +0 -107
- package/dist/assets/typeHierarchy.css +0 -62
- package/dist/assets/views.css +0 -297
- package/dist/override/vs/workbench/browser/parts/editor/textEditor.js +0 -2
- package/dist/override/vs/workbench/contrib/files/browser/views/openEditorsView.js +0 -2
- package/dist/service-override/modelEditor.d.ts +0 -14
- package/dist/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -249
- package/dist/vscode/vs/workbench/contrib/notebook/common/notebookService.js +0 -10
- package/dist/vscode/vs/workbench/services/search/common/searchHelpers.js +0 -72
- package/dist/vscode/vs/workbench/services/search/common/searchService.js +0 -355
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { $ } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
2
|
+
import { SplitView } from 'monaco-editor/esm/vs/base/browser/ui/splitview/splitview.js';
|
|
3
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
+
import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
const defaultState = {
|
|
6
|
+
targetWidth: 900,
|
|
7
|
+
leftMarginRatio: 0.1909,
|
|
8
|
+
rightMarginRatio: 0.1909,
|
|
9
|
+
};
|
|
10
|
+
const distributeSizing = { type: 'distribute' };
|
|
11
|
+
function createEmptyView(background) {
|
|
12
|
+
const element = $('.centered-layout-margin');
|
|
13
|
+
element.style.height = '100%';
|
|
14
|
+
if (background) {
|
|
15
|
+
element.style.backgroundColor = ( background.toString());
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
element,
|
|
19
|
+
layout: () => undefined,
|
|
20
|
+
minimumSize: 60,
|
|
21
|
+
maximumSize: Number.POSITIVE_INFINITY,
|
|
22
|
+
onDidChange: Event.None
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function toSplitViewView(view, getHeight) {
|
|
26
|
+
return {
|
|
27
|
+
element: view.element,
|
|
28
|
+
get maximumSize() { return view.maximumWidth; },
|
|
29
|
+
get minimumSize() { return view.minimumWidth; },
|
|
30
|
+
onDidChange: ( Event.map(view.onDidChange, e => e && e.width)),
|
|
31
|
+
layout: (size, offset, ctx) => view.layout(size, getHeight(), ctx?.top ?? 0, (ctx?.left ?? 0) + offset)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
class CenteredViewLayout {
|
|
35
|
+
constructor(container, view, state = { ...defaultState }) {
|
|
36
|
+
this.container = container;
|
|
37
|
+
this.view = view;
|
|
38
|
+
this.state = state;
|
|
39
|
+
this.lastLayoutPosition = { width: 0, height: 0, left: 0, top: 0 };
|
|
40
|
+
this.didLayout = false;
|
|
41
|
+
this.splitViewDisposables = ( new DisposableStore());
|
|
42
|
+
this.centeredLayoutFixedWidth = true;
|
|
43
|
+
this._boundarySashes = {};
|
|
44
|
+
this.container.appendChild(this.view.element);
|
|
45
|
+
this.container.style.overflow = 'hidden';
|
|
46
|
+
}
|
|
47
|
+
get minimumWidth() { return this.splitView ? this.splitView.minimumSize : this.view.minimumWidth; }
|
|
48
|
+
get maximumWidth() { return this.splitView ? this.splitView.maximumSize : this.view.maximumWidth; }
|
|
49
|
+
get minimumHeight() { return this.view.minimumHeight; }
|
|
50
|
+
get maximumHeight() { return this.view.maximumHeight; }
|
|
51
|
+
get onDidChange() { return this.view.onDidChange; }
|
|
52
|
+
get boundarySashes() { return this._boundarySashes; }
|
|
53
|
+
set boundarySashes(boundarySashes) {
|
|
54
|
+
this._boundarySashes = boundarySashes;
|
|
55
|
+
if (!this.splitView) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.splitView.orthogonalStartSash = boundarySashes.top;
|
|
59
|
+
this.splitView.orthogonalEndSash = boundarySashes.bottom;
|
|
60
|
+
}
|
|
61
|
+
layout(width, height, top, left) {
|
|
62
|
+
this.lastLayoutPosition = { width, height, top, left };
|
|
63
|
+
if (this.splitView) {
|
|
64
|
+
this.splitView.layout(width, this.lastLayoutPosition);
|
|
65
|
+
if (!this.didLayout || this.centeredLayoutFixedWidth) {
|
|
66
|
+
this.resizeSplitViews();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.view.layout(width, height, top, left);
|
|
71
|
+
}
|
|
72
|
+
this.didLayout = true;
|
|
73
|
+
}
|
|
74
|
+
resizeSplitViews() {
|
|
75
|
+
if (!this.splitView) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (this.centeredLayoutFixedWidth) {
|
|
79
|
+
const centerViewWidth = Math.min(this.lastLayoutPosition.width, this.state.targetWidth);
|
|
80
|
+
const marginWidthFloat = (this.lastLayoutPosition.width - centerViewWidth) / 2;
|
|
81
|
+
this.splitView.resizeView(0, Math.floor(marginWidthFloat));
|
|
82
|
+
this.splitView.resizeView(1, centerViewWidth);
|
|
83
|
+
this.splitView.resizeView(2, Math.ceil(marginWidthFloat));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const leftMargin = this.state.leftMarginRatio * this.lastLayoutPosition.width;
|
|
87
|
+
const rightMargin = this.state.rightMarginRatio * this.lastLayoutPosition.width;
|
|
88
|
+
const center = this.lastLayoutPosition.width - leftMargin - rightMargin;
|
|
89
|
+
this.splitView.resizeView(0, leftMargin);
|
|
90
|
+
this.splitView.resizeView(1, center);
|
|
91
|
+
this.splitView.resizeView(2, rightMargin);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
setFixedWidth(option) {
|
|
95
|
+
this.centeredLayoutFixedWidth = option;
|
|
96
|
+
if (!!this.splitView) {
|
|
97
|
+
this.updateState();
|
|
98
|
+
this.resizeSplitViews();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
updateState() {
|
|
102
|
+
if (!!this.splitView) {
|
|
103
|
+
this.state.targetWidth = this.splitView.getViewSize(1);
|
|
104
|
+
this.state.leftMarginRatio = this.splitView.getViewSize(0) / this.lastLayoutPosition.width;
|
|
105
|
+
this.state.rightMarginRatio = this.splitView.getViewSize(2) / this.lastLayoutPosition.width;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
isActive() {
|
|
109
|
+
return !!this.splitView;
|
|
110
|
+
}
|
|
111
|
+
styles(style) {
|
|
112
|
+
this.style = style;
|
|
113
|
+
if (this.splitView && this.emptyViews) {
|
|
114
|
+
this.splitView.style(this.style);
|
|
115
|
+
this.emptyViews[0].element.style.backgroundColor = ( this.style.background.toString());
|
|
116
|
+
this.emptyViews[1].element.style.backgroundColor = ( this.style.background.toString());
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
activate(active) {
|
|
120
|
+
if (active === this.isActive()) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (active) {
|
|
124
|
+
this.container.removeChild(this.view.element);
|
|
125
|
+
this.splitView = ( new SplitView(this.container, {
|
|
126
|
+
inverseAltBehavior: true,
|
|
127
|
+
orientation: 1 ,
|
|
128
|
+
styles: this.style
|
|
129
|
+
}));
|
|
130
|
+
this.splitView.orthogonalStartSash = this.boundarySashes.top;
|
|
131
|
+
this.splitView.orthogonalEndSash = this.boundarySashes.bottom;
|
|
132
|
+
this.splitViewDisposables.add(this.splitView.onDidSashChange(() => {
|
|
133
|
+
if (!!this.splitView) {
|
|
134
|
+
this.updateState();
|
|
135
|
+
}
|
|
136
|
+
}));
|
|
137
|
+
this.splitViewDisposables.add(this.splitView.onDidSashReset(() => {
|
|
138
|
+
this.state = { ...defaultState };
|
|
139
|
+
this.resizeSplitViews();
|
|
140
|
+
}));
|
|
141
|
+
this.splitView.layout(this.lastLayoutPosition.width, this.lastLayoutPosition);
|
|
142
|
+
const backgroundColor = this.style ? this.style.background : undefined;
|
|
143
|
+
this.emptyViews = [createEmptyView(backgroundColor), createEmptyView(backgroundColor)];
|
|
144
|
+
this.splitView.addView(this.emptyViews[0], distributeSizing, 0);
|
|
145
|
+
this.splitView.addView(toSplitViewView(this.view, () => this.lastLayoutPosition.height), distributeSizing, 1);
|
|
146
|
+
this.splitView.addView(this.emptyViews[1], distributeSizing, 2);
|
|
147
|
+
this.resizeSplitViews();
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
if (this.splitView) {
|
|
151
|
+
this.container.removeChild(this.splitView.el);
|
|
152
|
+
}
|
|
153
|
+
this.splitViewDisposables.clear();
|
|
154
|
+
this.splitView?.dispose();
|
|
155
|
+
this.splitView = undefined;
|
|
156
|
+
this.emptyViews = undefined;
|
|
157
|
+
this.container.appendChild(this.view.element);
|
|
158
|
+
this.view.layout(this.lastLayoutPosition.width, this.lastLayoutPosition.height, this.lastLayoutPosition.top, this.lastLayoutPosition.left);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
isDefault(state) {
|
|
162
|
+
if (this.centeredLayoutFixedWidth) {
|
|
163
|
+
return state.targetWidth === defaultState.targetWidth;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return state.leftMarginRatio === defaultState.leftMarginRatio
|
|
167
|
+
&& state.rightMarginRatio === defaultState.rightMarginRatio;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
dispose() {
|
|
171
|
+
this.splitViewDisposables.dispose();
|
|
172
|
+
if (this.splitView) {
|
|
173
|
+
this.splitView.dispose();
|
|
174
|
+
this.splitView = undefined;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export { CenteredViewLayout };
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
import { tail2, equals } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
2
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import './gridview.css.js';
|
|
4
|
+
import { orthogonal, GridView } from './gridview.js';
|
|
5
|
+
import { Sizing as Sizing$1 } from 'monaco-editor/esm/vs/base/browser/ui/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
|
+
function Invisible(cachedVisibleSize) { return { type: 'invisible', cachedVisibleSize }; }
|
|
111
|
+
Sizing.Invisible = Invisible;
|
|
112
|
+
})(Sizing || (Sizing = {})));
|
|
113
|
+
class Grid extends Disposable {
|
|
114
|
+
get orientation() { return this.gridview.orientation; }
|
|
115
|
+
set orientation(orientation) { this.gridview.orientation = orientation; }
|
|
116
|
+
get width() { return this.gridview.width; }
|
|
117
|
+
get height() { return this.gridview.height; }
|
|
118
|
+
get minimumWidth() { return this.gridview.minimumWidth; }
|
|
119
|
+
get minimumHeight() { return this.gridview.minimumHeight; }
|
|
120
|
+
get maximumWidth() { return this.gridview.maximumWidth; }
|
|
121
|
+
get maximumHeight() { return this.gridview.maximumHeight; }
|
|
122
|
+
get boundarySashes() { return this.gridview.boundarySashes; }
|
|
123
|
+
set boundarySashes(boundarySashes) { this.gridview.boundarySashes = boundarySashes; }
|
|
124
|
+
set edgeSnapping(edgeSnapping) { this.gridview.edgeSnapping = edgeSnapping; }
|
|
125
|
+
get element() { return this.gridview.element; }
|
|
126
|
+
constructor(view, options = {}) {
|
|
127
|
+
super();
|
|
128
|
+
this.views = ( new Map());
|
|
129
|
+
this.didLayout = false;
|
|
130
|
+
if (view instanceof GridView) {
|
|
131
|
+
this.gridview = view;
|
|
132
|
+
this.gridview.getViewMap(this.views);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.gridview = ( new GridView(options));
|
|
136
|
+
}
|
|
137
|
+
this._register(this.gridview);
|
|
138
|
+
this._register(this.gridview.onDidSashReset(this.onDidSashReset, this));
|
|
139
|
+
if (!(view instanceof GridView)) {
|
|
140
|
+
this._addView(view, 0, [0]);
|
|
141
|
+
}
|
|
142
|
+
this.onDidChange = this.gridview.onDidChange;
|
|
143
|
+
this.onDidScroll = this.gridview.onDidScroll;
|
|
144
|
+
}
|
|
145
|
+
style(styles) {
|
|
146
|
+
this.gridview.style(styles);
|
|
147
|
+
}
|
|
148
|
+
layout(width, height, top = 0, left = 0) {
|
|
149
|
+
this.gridview.layout(width, height, top, left);
|
|
150
|
+
this.didLayout = true;
|
|
151
|
+
}
|
|
152
|
+
addView(newView, size, referenceView, direction) {
|
|
153
|
+
if (( this.views.has(newView))) {
|
|
154
|
+
throw new Error('Can\'t add same view twice');
|
|
155
|
+
}
|
|
156
|
+
const orientation = getDirectionOrientation(direction);
|
|
157
|
+
if (this.views.size === 1 && this.orientation !== orientation) {
|
|
158
|
+
this.orientation = orientation;
|
|
159
|
+
}
|
|
160
|
+
const referenceLocation = this.getViewLocation(referenceView);
|
|
161
|
+
const location = getRelativeLocation(this.gridview.orientation, referenceLocation, direction);
|
|
162
|
+
let viewSize;
|
|
163
|
+
if (typeof size === 'number') {
|
|
164
|
+
viewSize = size;
|
|
165
|
+
}
|
|
166
|
+
else if (size.type === 'split') {
|
|
167
|
+
const [, index] = tail2(referenceLocation);
|
|
168
|
+
viewSize = Sizing$1.Split(index);
|
|
169
|
+
}
|
|
170
|
+
else if (size.type === 'distribute') {
|
|
171
|
+
viewSize = Sizing$1.Distribute;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
viewSize = size;
|
|
175
|
+
}
|
|
176
|
+
this._addView(newView, viewSize, location);
|
|
177
|
+
}
|
|
178
|
+
addViewAt(newView, size, location) {
|
|
179
|
+
if (( this.views.has(newView))) {
|
|
180
|
+
throw new Error('Can\'t add same view twice');
|
|
181
|
+
}
|
|
182
|
+
let viewSize;
|
|
183
|
+
if (typeof size === 'number') {
|
|
184
|
+
viewSize = size;
|
|
185
|
+
}
|
|
186
|
+
else if (size.type === 'distribute') {
|
|
187
|
+
viewSize = Sizing$1.Distribute;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
viewSize = size;
|
|
191
|
+
}
|
|
192
|
+
this._addView(newView, viewSize, location);
|
|
193
|
+
}
|
|
194
|
+
_addView(newView, size, location) {
|
|
195
|
+
this.views.set(newView, newView.element);
|
|
196
|
+
this.gridview.addView(newView, size, location);
|
|
197
|
+
}
|
|
198
|
+
removeView(view, sizing) {
|
|
199
|
+
if (this.views.size === 1) {
|
|
200
|
+
throw new Error('Can\'t remove last view');
|
|
201
|
+
}
|
|
202
|
+
const location = this.getViewLocation(view);
|
|
203
|
+
this.gridview.removeView(location, (sizing && sizing.type === 'distribute') ? Sizing$1.Distribute : undefined);
|
|
204
|
+
this.views.delete(view);
|
|
205
|
+
}
|
|
206
|
+
moveView(view, sizing, referenceView, direction) {
|
|
207
|
+
const sourceLocation = this.getViewLocation(view);
|
|
208
|
+
const [sourceParentLocation, from] = tail2(sourceLocation);
|
|
209
|
+
const referenceLocation = this.getViewLocation(referenceView);
|
|
210
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, direction);
|
|
211
|
+
const [targetParentLocation, to] = tail2(targetLocation);
|
|
212
|
+
if (equals(sourceParentLocation, targetParentLocation)) {
|
|
213
|
+
this.gridview.moveView(sourceParentLocation, from, to);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.removeView(view, typeof sizing === 'number' ? undefined : sizing);
|
|
217
|
+
this.addView(view, sizing, referenceView, direction);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
moveViewTo(view, location) {
|
|
221
|
+
const sourceLocation = this.getViewLocation(view);
|
|
222
|
+
const [sourceParentLocation, from] = tail2(sourceLocation);
|
|
223
|
+
const [targetParentLocation, to] = tail2(location);
|
|
224
|
+
if (equals(sourceParentLocation, targetParentLocation)) {
|
|
225
|
+
this.gridview.moveView(sourceParentLocation, from, to);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
const size = this.getViewSize(view);
|
|
229
|
+
const orientation = getLocationOrientation(this.gridview.orientation, sourceLocation);
|
|
230
|
+
const cachedViewSize = this.getViewCachedVisibleSize(view);
|
|
231
|
+
const sizing = typeof cachedViewSize === 'undefined'
|
|
232
|
+
? (orientation === 1 ? size.width : size.height)
|
|
233
|
+
: Sizing.Invisible(cachedViewSize);
|
|
234
|
+
this.removeView(view);
|
|
235
|
+
this.addViewAt(view, sizing, location);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
swapViews(from, to) {
|
|
239
|
+
const fromLocation = this.getViewLocation(from);
|
|
240
|
+
const toLocation = this.getViewLocation(to);
|
|
241
|
+
return this.gridview.swapViews(fromLocation, toLocation);
|
|
242
|
+
}
|
|
243
|
+
resizeView(view, size) {
|
|
244
|
+
const location = this.getViewLocation(view);
|
|
245
|
+
return this.gridview.resizeView(location, size);
|
|
246
|
+
}
|
|
247
|
+
isViewSizeMaximized(view) {
|
|
248
|
+
const location = this.getViewLocation(view);
|
|
249
|
+
return this.gridview.isViewSizeMaximized(location);
|
|
250
|
+
}
|
|
251
|
+
getViewSize(view) {
|
|
252
|
+
if (!view) {
|
|
253
|
+
return this.gridview.getViewSize();
|
|
254
|
+
}
|
|
255
|
+
const location = this.getViewLocation(view);
|
|
256
|
+
return this.gridview.getViewSize(location);
|
|
257
|
+
}
|
|
258
|
+
getViewCachedVisibleSize(view) {
|
|
259
|
+
const location = this.getViewLocation(view);
|
|
260
|
+
return this.gridview.getViewCachedVisibleSize(location);
|
|
261
|
+
}
|
|
262
|
+
maximizeViewSize(view) {
|
|
263
|
+
const location = this.getViewLocation(view);
|
|
264
|
+
this.gridview.maximizeViewSize(location);
|
|
265
|
+
}
|
|
266
|
+
distributeViewSizes() {
|
|
267
|
+
this.gridview.distributeViewSizes();
|
|
268
|
+
}
|
|
269
|
+
isViewVisible(view) {
|
|
270
|
+
const location = this.getViewLocation(view);
|
|
271
|
+
return this.gridview.isViewVisible(location);
|
|
272
|
+
}
|
|
273
|
+
setViewVisible(view, visible) {
|
|
274
|
+
const location = this.getViewLocation(view);
|
|
275
|
+
this.gridview.setViewVisible(location, visible);
|
|
276
|
+
}
|
|
277
|
+
getViews() {
|
|
278
|
+
return this.gridview.getView();
|
|
279
|
+
}
|
|
280
|
+
getNeighborViews(view, direction, wrap = false) {
|
|
281
|
+
if (!this.didLayout) {
|
|
282
|
+
throw new Error('Can\'t call getNeighborViews before first layout');
|
|
283
|
+
}
|
|
284
|
+
const location = this.getViewLocation(view);
|
|
285
|
+
const root = this.getViews();
|
|
286
|
+
const node = getGridNode(root, location);
|
|
287
|
+
let boundary = getBoxBoundary(node.box, direction);
|
|
288
|
+
if (wrap) {
|
|
289
|
+
if (direction === 0 && node.box.top === 0) {
|
|
290
|
+
boundary = { offset: root.box.top + root.box.height, range: boundary.range };
|
|
291
|
+
}
|
|
292
|
+
else if (direction === 3 && node.box.left + node.box.width === root.box.width) {
|
|
293
|
+
boundary = { offset: 0, range: boundary.range };
|
|
294
|
+
}
|
|
295
|
+
else if (direction === 1 && node.box.top + node.box.height === root.box.height) {
|
|
296
|
+
boundary = { offset: 0, range: boundary.range };
|
|
297
|
+
}
|
|
298
|
+
else if (direction === 2 && node.box.left === 0) {
|
|
299
|
+
boundary = { offset: root.box.left + root.box.width, range: boundary.range };
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return ( findAdjacentBoxLeafNodes(root, oppositeDirection(direction), boundary)
|
|
303
|
+
.map(node => node.view));
|
|
304
|
+
}
|
|
305
|
+
getViewLocation(view) {
|
|
306
|
+
const element = this.views.get(view);
|
|
307
|
+
if (!element) {
|
|
308
|
+
throw new Error('View not found');
|
|
309
|
+
}
|
|
310
|
+
return getGridLocation(element);
|
|
311
|
+
}
|
|
312
|
+
onDidSashReset(location) {
|
|
313
|
+
const resizeToPreferredSize = (location) => {
|
|
314
|
+
const node = this.gridview.getView(location);
|
|
315
|
+
if (isGridBranchNode(node)) {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
const direction = getLocationOrientation(this.orientation, location);
|
|
319
|
+
const size = direction === 1 ? node.view.preferredWidth : node.view.preferredHeight;
|
|
320
|
+
if (typeof size !== 'number') {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
const viewSize = direction === 1 ? { width: Math.round(size) } : { height: Math.round(size) };
|
|
324
|
+
this.gridview.resizeView(location, viewSize);
|
|
325
|
+
return true;
|
|
326
|
+
};
|
|
327
|
+
if (resizeToPreferredSize(location)) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const [parentLocation, index] = tail2(location);
|
|
331
|
+
if (resizeToPreferredSize([...parentLocation, index + 1])) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
this.gridview.distributeViewSizes(parentLocation);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
class SerializableGrid extends Grid {
|
|
338
|
+
constructor() {
|
|
339
|
+
super(...arguments);
|
|
340
|
+
this.initialLayoutContext = true;
|
|
341
|
+
}
|
|
342
|
+
static serializeNode(node, orientation) {
|
|
343
|
+
const size = orientation === 0 ? node.box.width : node.box.height;
|
|
344
|
+
if (!isGridBranchNode(node)) {
|
|
345
|
+
if (typeof node.cachedVisibleSize === 'number') {
|
|
346
|
+
return { type: 'leaf', data: node.view.toJSON(), size: node.cachedVisibleSize, visible: false };
|
|
347
|
+
}
|
|
348
|
+
return { type: 'leaf', data: node.view.toJSON(), size };
|
|
349
|
+
}
|
|
350
|
+
return { type: 'branch', data: ( node.children.map(c => SerializableGrid.serializeNode(c, orthogonal(orientation)))), size };
|
|
351
|
+
}
|
|
352
|
+
static deserialize(json, deserializer, options = {}) {
|
|
353
|
+
if (typeof json.orientation !== 'number') {
|
|
354
|
+
throw new Error('Invalid JSON: \'orientation\' property must be a number.');
|
|
355
|
+
}
|
|
356
|
+
else if (typeof json.width !== 'number') {
|
|
357
|
+
throw new Error('Invalid JSON: \'width\' property must be a number.');
|
|
358
|
+
}
|
|
359
|
+
else if (typeof json.height !== 'number') {
|
|
360
|
+
throw new Error('Invalid JSON: \'height\' property must be a number.');
|
|
361
|
+
}
|
|
362
|
+
const gridview = GridView.deserialize(json, deserializer, options);
|
|
363
|
+
const result = ( new SerializableGrid(gridview, options));
|
|
364
|
+
return result;
|
|
365
|
+
}
|
|
366
|
+
static from(gridDescriptor, options = {}) {
|
|
367
|
+
return SerializableGrid.deserialize(createSerializedGrid(gridDescriptor), { fromJSON: view => view }, options);
|
|
368
|
+
}
|
|
369
|
+
serialize() {
|
|
370
|
+
return {
|
|
371
|
+
root: SerializableGrid.serializeNode(this.getViews(), this.orientation),
|
|
372
|
+
orientation: this.orientation,
|
|
373
|
+
width: this.width,
|
|
374
|
+
height: this.height
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
layout(width, height, top = 0, left = 0) {
|
|
378
|
+
super.layout(width, height, top, left);
|
|
379
|
+
if (this.initialLayoutContext) {
|
|
380
|
+
this.initialLayoutContext = false;
|
|
381
|
+
this.gridview.trySet2x2();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function isGridBranchNodeDescriptor(nodeDescriptor) {
|
|
386
|
+
return !!nodeDescriptor.groups;
|
|
387
|
+
}
|
|
388
|
+
function sanitizeGridNodeDescriptor(nodeDescriptor, rootNode) {
|
|
389
|
+
if (!rootNode && nodeDescriptor.groups && nodeDescriptor.groups.length <= 1) {
|
|
390
|
+
nodeDescriptor.groups = undefined;
|
|
391
|
+
}
|
|
392
|
+
if (!isGridBranchNodeDescriptor(nodeDescriptor)) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
let totalDefinedSize = 0;
|
|
396
|
+
let totalDefinedSizeCount = 0;
|
|
397
|
+
for (const child of nodeDescriptor.groups) {
|
|
398
|
+
sanitizeGridNodeDescriptor(child, false);
|
|
399
|
+
if (child.size) {
|
|
400
|
+
totalDefinedSize += child.size;
|
|
401
|
+
totalDefinedSizeCount++;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
const totalUndefinedSize = totalDefinedSizeCount > 0 ? totalDefinedSize : 1;
|
|
405
|
+
const totalUndefinedSizeCount = nodeDescriptor.groups.length - totalDefinedSizeCount;
|
|
406
|
+
const eachUndefinedSize = totalUndefinedSize / totalUndefinedSizeCount;
|
|
407
|
+
for (const child of nodeDescriptor.groups) {
|
|
408
|
+
if (!child.size) {
|
|
409
|
+
child.size = eachUndefinedSize;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function createSerializedNode(nodeDescriptor) {
|
|
414
|
+
if (isGridBranchNodeDescriptor(nodeDescriptor)) {
|
|
415
|
+
return { type: 'branch', data: ( nodeDescriptor.groups.map(c => createSerializedNode(c))), size: nodeDescriptor.size };
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
return { type: 'leaf', data: nodeDescriptor.data, size: nodeDescriptor.size };
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function getDimensions(node, orientation) {
|
|
422
|
+
if (node.type === 'branch') {
|
|
423
|
+
const childrenDimensions = ( node.data.map(c => getDimensions(c, orthogonal(orientation))));
|
|
424
|
+
if (orientation === 0 ) {
|
|
425
|
+
const width = node.size || (childrenDimensions.length === 0 ? undefined : Math.max(...( childrenDimensions.map(d => d.width || 0))));
|
|
426
|
+
const height = childrenDimensions.length === 0 ? undefined : childrenDimensions.reduce((r, d) => r + (d.height || 0), 0);
|
|
427
|
+
return { width, height };
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
const width = childrenDimensions.length === 0 ? undefined : childrenDimensions.reduce((r, d) => r + (d.width || 0), 0);
|
|
431
|
+
const height = node.size || (childrenDimensions.length === 0 ? undefined : Math.max(...( childrenDimensions.map(d => d.height || 0))));
|
|
432
|
+
return { width, height };
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
const width = orientation === 0 ? node.size : undefined;
|
|
437
|
+
const height = orientation === 0 ? undefined : node.size;
|
|
438
|
+
return { width, height };
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function createSerializedGrid(gridDescriptor) {
|
|
442
|
+
sanitizeGridNodeDescriptor(gridDescriptor, true);
|
|
443
|
+
const root = createSerializedNode(gridDescriptor);
|
|
444
|
+
const { width, height } = getDimensions(root, gridDescriptor.orientation);
|
|
445
|
+
return {
|
|
446
|
+
root,
|
|
447
|
+
orientation: gridDescriptor.orientation,
|
|
448
|
+
width: width || 1,
|
|
449
|
+
height: height || 1
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
export { Grid, SerializableGrid, Sizing, createSerializedGrid, getRelativeLocation, isGridBranchNode, orthogonal, sanitizeGridNodeDescriptor };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import n from '../../../../../../node_modules/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 };
|