@codingame/monaco-vscode-api 2.1.4 → 2.2.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +24 -0
  2. package/contributions.js +1 -0
  3. package/extensions.d.ts +7 -3
  4. package/extensions.js +28 -8
  5. package/lifecycle.js +11 -3
  6. package/localExtensionHost.js +13 -10
  7. package/missing-services.js +55 -10
  8. package/monaco.js +7 -3
  9. package/package.json +8 -8
  10. package/service-override/tools/views.d.ts +98 -0
  11. package/service-override/tools/views.js +249 -0
  12. package/services.d.ts +4 -2
  13. package/services.js +11 -9
  14. package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
  15. package/vscode/src/vs/base/browser/dom.js +18 -1
  16. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
  17. package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
  18. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
  19. package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
  20. package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
  21. package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
  22. package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
  23. package/vscode/src/vs/base/common/async.js +46 -2
  24. package/vscode/src/vs/base/common/codicons.d.ts +579 -0
  25. package/vscode/src/vs/base/common/event.js +11 -2
  26. package/vscode/src/vs/base/common/keybindingParser.js +87 -0
  27. package/vscode/src/vs/base/common/network.js +1 -2
  28. package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
  29. package/vscode/src/vs/base/common/platform.js +2 -1
  30. package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
  31. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
  32. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
  33. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
  34. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
  35. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
  36. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
  37. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
  38. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
  39. package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
  40. package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
  41. package/vscode/src/vs/platform/log/browser/log.js +24 -0
  42. package/vscode/src/vs/platform/product/common/product.js +1 -2
  43. package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
  44. package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
  45. package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
  46. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
  47. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
  48. package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
  49. package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
  50. package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
  51. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
  52. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
  53. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
  54. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
  55. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
  56. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
  57. package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
  58. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
  59. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
  60. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
  61. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
  62. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
  63. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
  64. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
  65. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
  66. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
  67. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
  68. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
  69. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
  70. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
  71. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
  72. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
  73. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
  74. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
  75. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
  76. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
  77. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
  78. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
  79. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
  80. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
  81. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
  82. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
  83. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
  84. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
  85. package/vscode/src/vs/workbench/browser/window.js +239 -5
  86. package/vscode/src/vs/workbench/common/configuration.js +11 -1
  87. package/vscode/src/vs/workbench/common/theme.js +3 -3
  88. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
  89. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
  90. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
  91. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
  92. package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
  93. package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
  94. package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
  95. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
  96. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
  97. package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
  98. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
  99. package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
  100. package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
  101. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
  102. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
  103. package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
  104. package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
  105. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
  106. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
  107. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
  108. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
  109. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
  110. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
  111. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
  112. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
  113. package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
  114. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
  115. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
  116. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
  117. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
  118. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
  119. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
  120. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
  121. package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +10 -10
  122. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
  123. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
  124. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
  125. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
  126. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
  127. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
  128. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
  129. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
  130. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
  131. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
  132. package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
  133. package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
  134. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
  135. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
  136. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
  137. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
  138. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
  139. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
  140. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
  141. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
  142. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
  143. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
  144. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
  145. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
  146. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
  147. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
  148. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
  149. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
  150. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
  151. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
  152. package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
  154. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
  155. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
  156. package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
  157. package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
  158. package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +2 -2
  159. package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
  160. package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
  161. package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
  162. package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
  163. package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
  164. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
  165. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
  166. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
  167. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
  168. package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
  169. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
  170. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
  171. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
  172. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
  173. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
  174. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
  175. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
  176. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
  177. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
  178. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
  179. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
  180. package/vscode/src/vs/workbench/contrib/workspace/common/workspace.js +16 -0
  181. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
  182. package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
  183. package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
  184. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
  185. package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
  186. package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
  187. package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
  188. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
  189. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
  190. package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
  191. package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
  192. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
  193. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
  194. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
@@ -0,0 +1,249 @@
1
+ import { __decorate, __param } from '../../external/tslib/tslib.es6.js';
2
+ import { SyncDescriptor } from '../../vscode/src/vs/platform/instantiation/common/descriptors.js';
3
+ import { Extensions } from '../../vscode/src/vs/workbench/common/views.js';
4
+ export { ViewContainerLocation } from '../../vscode/src/vs/workbench/common/views.js';
5
+ import { MutableDisposable, DisposableStore } from '../../vscode/src/vs/base/common/lifecycle.js';
6
+ import { size, $, append } from '../../vscode/src/vs/base/browser/dom.js';
7
+ import { ViewPane } from '../../vscode/src/vs/workbench/browser/parts/views/viewPane.js';
8
+ import { Registry } from '../../vscode/src/vs/platform/registry/common/platform.js';
9
+ import { ViewPaneContainer } from '../../vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.js';
10
+ import { URI } from '../../vscode/src/vs/base/common/uri.js';
11
+ import { Codicon } from '../../vscode/src/vs/base/common/codicons.js';
12
+ import { IEditorResolverService } from '../../vscode/src/vs/workbench/services/editor/common/editorResolverService.js';
13
+ export { RegisteredEditorPriority } from '../../vscode/src/vs/workbench/services/editor/common/editorResolverService.js';
14
+ import { EditorInput } from '../../vscode/src/vs/workbench/common/editor/editorInput.js';
15
+ import { EditorExtensions } from '../../vscode/src/vs/workbench/common/editor.js';
16
+ export { EditorInputCapabilities } from '../../vscode/src/vs/workbench/common/editor.js';
17
+ import { registerAction2, Action2, MenuId } from '../../vscode/src/vs/platform/actions/common/actions.js';
18
+ import { Categories } from '../../vscode/src/vs/platform/action/common/actionCommonCategories.js';
19
+ import { ContextKeyExpr } from '../../vscode/src/vs/platform/contextkey/common/contextkey.js';
20
+ import { BaseActionViewItem } from '../../vscode/src/vs/base/browser/ui/actionbar/actionViewItems.js';
21
+ import { EditorPaneDescriptor } from '../../vscode/src/vs/workbench/browser/editor.js';
22
+ import { EditorPane } from '../../vscode/src/vs/workbench/browser/parts/editor/editorPane.js';
23
+ import { ITelemetryService } from '../../vscode/src/vs/platform/telemetry/common/telemetry.js';
24
+ import { IStorageService } from '../../vscode/src/vs/platform/storage/common/storage.js';
25
+ import { IThemeService } from '../../vscode/src/vs/platform/theme/common/themeService.js';
26
+ import { DomScrollableElement } from '../../vscode/src/vs/base/browser/ui/scrollbar/scrollableElement.js';
27
+ import { assertAllDefined, assertIsDefined } from '../../vscode/src/vs/base/common/types.js';
28
+ export { ConfirmResult } from '../../override/vs/platform/dialogs/common/dialogs.js';
29
+ import { IWorkbenchLayoutService } from '../../vscode/src/vs/workbench/services/layout/browser/layoutService.js';
30
+ export { Parts } from '../../vscode/src/vs/workbench/services/layout/browser/layoutService.js';
31
+ import { StandaloneServices } from '../../vscode/src/vs/editor/standalone/browser/standaloneServices.js';
32
+ import { withReadyServices } from '../../services.js';
33
+ let SimpleEditorPane = class SimpleEditorPane extends EditorPane {
34
+ constructor(id, telemetryService, themeService, storageService) {
35
+ super(id, telemetryService, themeService, storageService);
36
+ this.inputDisposable = this._register(new MutableDisposable());
37
+ }
38
+ createEditor(parent) {
39
+ this.container = this.initialize();
40
+ this.scrollbar = this._register(new DomScrollableElement(this.container, { horizontal: 1 , vertical: 1 }));
41
+ parent.appendChild(this.scrollbar.getDomNode());
42
+ }
43
+ async setInput(input, editorOptions, context, token) {
44
+ await super.setInput(input, editorOptions, context, token);
45
+ if (token.isCancellationRequested) {
46
+ return;
47
+ }
48
+ this.inputDisposable.value = await this.renderInput?.(input, editorOptions, context, token);
49
+ }
50
+ layout(dimension) {
51
+ const [container, scrollbar] = assertAllDefined(this.container, this.scrollbar);
52
+ size(container, dimension.width, dimension.height);
53
+ scrollbar.scanDomNode();
54
+ }
55
+ focus() {
56
+ const container = assertIsDefined(this.container);
57
+ container.focus();
58
+ }
59
+ clearInput() {
60
+ this.inputDisposable.clear();
61
+ super.clearInput();
62
+ }
63
+ };
64
+ SimpleEditorPane = __decorate([
65
+ ( __param(1, ITelemetryService)),
66
+ ( __param(2, IThemeService)),
67
+ ( __param(3, IStorageService))
68
+ ], SimpleEditorPane);
69
+ class SimpleEditorInput extends EditorInput {
70
+ constructor(resource, closeHandler) {
71
+ super();
72
+ this.closeHandler = closeHandler;
73
+ this.dirty = false;
74
+ this._capabilities = 0;
75
+ this.resource = resource;
76
+ }
77
+ get capabilities() {
78
+ return this._capabilities;
79
+ }
80
+ addCapability(capability) {
81
+ this._capabilities |= capability;
82
+ this._onDidChangeCapabilities.fire();
83
+ }
84
+ removeCapability(capability) {
85
+ this._capabilities &= ~capability;
86
+ this._onDidChangeCapabilities.fire();
87
+ }
88
+ get editorId() {
89
+ return this.typeId;
90
+ }
91
+ setName(name) {
92
+ this.name = name;
93
+ this._onDidChangeLabel.fire();
94
+ }
95
+ setTitle(title) {
96
+ this.title = title;
97
+ this._onDidChangeLabel.fire();
98
+ }
99
+ setDescription(description) {
100
+ this.description = description;
101
+ this._onDidChangeLabel.fire();
102
+ }
103
+ getLabelValue(label, verbosity) {
104
+ if (typeof label === 'string') {
105
+ return label;
106
+ }
107
+ switch (verbosity) {
108
+ case 0 :
109
+ return label.short;
110
+ case 2 :
111
+ return label.long;
112
+ case 1 :
113
+ default:
114
+ return label.medium;
115
+ }
116
+ }
117
+ getName() {
118
+ return this.name ?? 'Unnamed';
119
+ }
120
+ getTitle(verbosity) {
121
+ return this.getLabelValue(this.title ?? this.getName(), verbosity);
122
+ }
123
+ getDescription(verbosity) {
124
+ return this.getLabelValue(this.description ?? this.getName(), verbosity);
125
+ }
126
+ isDirty() {
127
+ return this.dirty;
128
+ }
129
+ setDirty(dirty) {
130
+ this.dirty = dirty;
131
+ this._onDidChangeDirty.fire();
132
+ }
133
+ }
134
+ function registerEditorPane(typeId, name, ctor, inputCtors) {
135
+ return ( Registry.as(EditorExtensions.EditorPane)).registerEditorPane(EditorPaneDescriptor.create(ctor, typeId, name), ( inputCtors.map(ctor => new SyncDescriptor(ctor))));
136
+ }
137
+ function registerEditor(globPattern, editorInfo, editorOptions, factory) {
138
+ return withReadyServices((servicesAccessor) => {
139
+ const resolverService = servicesAccessor.get(IEditorResolverService);
140
+ return resolverService.registerEditor(globPattern, editorInfo, editorOptions, factory);
141
+ });
142
+ }
143
+ function registerEditorSerializer(editorTypeId, ctor) {
144
+ return ( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(editorTypeId, ctor);
145
+ }
146
+ function registerCustomView(options) {
147
+ const iconUrl = options.icon != null ? ( URI.parse(options.icon)) : undefined;
148
+ const viewContainer = options.viewContainer ?? ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
149
+ id: options.id,
150
+ title: { value: options.name, original: options.name },
151
+ order: options.order,
152
+ ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [options.id, { mergeViewWithContainerWhenSingleView: true }]),
153
+ hideIfEmpty: true,
154
+ icon: iconUrl
155
+ }, options.location, {
156
+ isDefault: options.default
157
+ });
158
+ const views = [{
159
+ id: options.id,
160
+ name: {
161
+ value: options.name,
162
+ original: options.name
163
+ },
164
+ ctorDescriptor: new SyncDescriptor(class extends ViewPane {
165
+ renderBody(container) {
166
+ super.renderBody(container);
167
+ this.content = $('.view-pane-content');
168
+ this.content.style.display = 'flex';
169
+ this.content.style.alignItems = 'stretch';
170
+ append(container, this.content);
171
+ this._register(options.renderBody(this.content));
172
+ }
173
+ getActionViewItem(action, actionOptions) {
174
+ const customAction = (options.actions ?? []).find(customAction => customAction.id === action.id);
175
+ if (customAction?.render != null) {
176
+ return new (class extends BaseActionViewItem {
177
+ constructor() {
178
+ super(null, action);
179
+ this.render = customAction.render;
180
+ }
181
+ })();
182
+ }
183
+ return super.getActionViewItem(action, actionOptions);
184
+ }
185
+ layoutBody(height, width) {
186
+ this.content.style.height = `${height}px`;
187
+ this.content.style.width = `${width}px`;
188
+ }
189
+ }),
190
+ canMoveView: options.canMoveView ?? true,
191
+ canToggleVisibility: options.canToggleVisibility ?? false,
192
+ hideByDefault: options.hideByDefault ?? false,
193
+ collapsed: options.collapsed ?? false,
194
+ order: options.order,
195
+ containerIcon: iconUrl
196
+ }];
197
+ ( Registry.as(Extensions.ViewsRegistry)).registerViews(views, viewContainer);
198
+ const disposableCollection = new DisposableStore();
199
+ disposableCollection.add({
200
+ dispose() {
201
+ ( Registry.as(Extensions.ViewsRegistry)).deregisterViews(views, viewContainer);
202
+ if (options.viewContainer == null) {
203
+ ( Registry.as(Extensions.ViewContainersRegistry)).deregisterViewContainer(viewContainer);
204
+ }
205
+ }
206
+ });
207
+ for (const action of options.actions ?? []) {
208
+ disposableCollection.add(registerAction2(class extends Action2 {
209
+ constructor() {
210
+ super({
211
+ id: action.id,
212
+ title: { value: action.title, original: action.title },
213
+ category: Categories.View,
214
+ menu: [{
215
+ id: MenuId.ViewTitle,
216
+ when: ( ContextKeyExpr.equals('view', options.id)),
217
+ group: 'navigation',
218
+ order: action.order
219
+ }, {
220
+ id: MenuId.CommandPalette
221
+ }],
222
+ tooltip: action.tooltip,
223
+ icon: action.icon != null ? Codicon[action.icon] : undefined
224
+ });
225
+ this.run = action.run ?? (async () => { });
226
+ }
227
+ }));
228
+ }
229
+ return disposableCollection;
230
+ }
231
+ function isPartVisibile(part) {
232
+ return StandaloneServices.get(IWorkbenchLayoutService).isVisible(part, window);
233
+ }
234
+ function setPartVisibility(part, visible) {
235
+ StandaloneServices.get(IWorkbenchLayoutService).setPartHidden(!visible, part, window);
236
+ }
237
+ const onDidChangePanelPosition = (listener) => {
238
+ return StandaloneServices.get(IWorkbenchLayoutService).onDidChangePanelPosition(listener);
239
+ };
240
+ function getPanelPosition() {
241
+ return StandaloneServices.get(IWorkbenchLayoutService).getPanelPosition();
242
+ }
243
+ const onDidChangeSideBarPosition = (listener) => {
244
+ return StandaloneServices.get(IWorkbenchLayoutService).onDidChangeSideBarPosition(listener);
245
+ };
246
+ function getSideBarPosition() {
247
+ return StandaloneServices.get(IWorkbenchLayoutService).getSideBarPosition();
248
+ }
249
+ export { EditorInput, EditorPane, SimpleEditorInput, SimpleEditorPane, getPanelPosition, getSideBarPosition, isPartVisibile, onDidChangePanelPosition, onDidChangeSideBarPosition, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, setPartVisibility };
package/services.d.ts CHANGED
@@ -34,6 +34,7 @@ import { IEditorOverrideServices } from './vscode/src/vs/editor/standalone/brows
34
34
  export { StandaloneServices } from './vscode/src/vs/editor/standalone/browser/standaloneServices.js';
35
35
  export { IProductService } from './vscode/src/vs/platform/product/common/productService.js';
36
36
  import { IWorkbenchConstructionOptions } from './vscode/src/vs/workbench/browser/web.api.js';
37
+ import { IProductConfiguration } from './vscode/src/vs/base/common/product.js';
37
38
  export { SyncDescriptor } from './vscode/src/vs/platform/instantiation/common/descriptors.js';
38
39
  export { IBulkEditService } from './vscode/src/vs/editor/browser/services/bulkEditService.js';
39
40
  export { IFileService } from './vscode/src/vs/platform/files/common/files.js';
@@ -69,6 +70,7 @@ export { IRemoteSocketFactoryService } from './vscode/src/vs/platform/remote/com
69
70
  export { ITerminalInstanceService, ITerminalService } from './vscode/src/vs/workbench/contrib/terminal/browser/terminal.js';
70
71
  export { IFilesConfigurationService } from './vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js';
71
72
  export { ILabelService } from './vscode/src/vs/platform/label/common/label.js';
73
+ export { IWorkbenchLayoutService } from './vscode/src/vs/workbench/services/layout/browser/layoutService.js';
72
74
  export { IActivityService, IBadge } from './vscode/src/vs/workbench/services/activity/common/activity.js';
73
75
  export { IHoverService } from './vscode/src/vs/platform/hover/browser/hover.js';
74
76
  export { IExplorerService } from './vscode/src/vs/workbench/contrib/files/browser/files.js';
@@ -76,7 +78,7 @@ export { IStatusbarService } from './vscode/src/vs/workbench/services/statusbar/
76
78
  export { ITitleService } from './vscode/src/vs/workbench/services/title/browser/titleService.js';
77
79
  export { IBannerService } from './vscode/src/vs/workbench/services/banner/browser/bannerService.js';
78
80
 
79
- declare function initialize(overrides: IEditorOverrideServices, container?: HTMLElement, configuration?: IWorkbenchConstructionOptions): Promise<void>;
81
+ declare function initialize(overrides: IEditorOverrideServices, container?: HTMLElement, configuration?: IWorkbenchConstructionOptions, productConfiguration?: Partial<IProductConfiguration>): Promise<void>;
80
82
  declare function getService<T>(identifier: ServiceIdentifier<T>): Promise<T>;
81
83
  declare function createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(ctor: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): Promise<R>;
82
84
  declare function createInstanceSync<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(ctor: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;
@@ -85,4 +87,4 @@ declare function createInstanceSync<Ctor extends new (...args: any[]) => any, R
85
87
  */
86
88
  declare function withReadyServices(callback: (serviceAccessor: ServicesAccessor) => IDisposable): IDisposable;
87
89
 
88
- export { IWorkbenchConstructionOptions, createInstance, createInstanceSync, getService, initialize, withReadyServices };
90
+ export { IEditorOverrideServices, IWorkbenchConstructionOptions, createInstance, createInstanceSync, getService, initialize, withReadyServices };
package/services.js CHANGED
@@ -69,11 +69,11 @@ import { IProductService } from './vscode/src/vs/platform/product/common/product
69
69
  import { DisposableStore } from './vscode/src/vs/base/common/lifecycle.js';
70
70
  import { initialize as initialize$1 } from './workbench.js';
71
71
  import { checkServicesNotInitialized, startup, waitServicesReady, checkServicesReady, serviceInitializedBarrier, serviceInitializedEmitter } from './lifecycle.js';
72
- import getServiceOverride$4 from '@codingame/monaco-vscode-quickaccess-service-override';
73
- import getServiceOverride$1$2 from '@codingame/monaco-vscode-files-service-override';
72
+ import getServiceOverride$2$1 from '@codingame/monaco-vscode-quickaccess-service-override';
73
+ import getServiceOverride$1$1 from '@codingame/monaco-vscode-files-service-override';
74
74
  import getServiceOverride$2 from '@codingame/monaco-vscode-extensions-service-override';
75
- import getServiceOverride$1$1 from '@codingame/monaco-vscode-environment-service-override';
76
- import getServiceOverride$1 from '@codingame/monaco-vscode-layout-service-override';
75
+ import getServiceOverride$1 from '@codingame/monaco-vscode-environment-service-override';
76
+ import getServiceOverride from '@codingame/monaco-vscode-layout-service-override';
77
77
  import getServiceOverride$5 from '@codingame/monaco-vscode-host-service-override';
78
78
  import getServiceOverride$6 from '@codingame/monaco-vscode-base-service-override';
79
79
  export { SyncDescriptor } from './vscode/src/vs/platform/instantiation/common/descriptors.js';
@@ -131,6 +131,7 @@ export { IRemoteSocketFactoryService } from './vscode/src/vs/platform/remote/com
131
131
  export { ITerminalInstanceService, ITerminalService } from './vscode/src/vs/workbench/contrib/terminal/browser/terminal.js';
132
132
  export { IFilesConfigurationService } from './vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js';
133
133
  export { ILabelService } from './vscode/src/vs/platform/label/common/label.js';
134
+ export { IWorkbenchLayoutService } from './vscode/src/vs/workbench/services/layout/browser/layoutService.js';
134
135
  export { IActivityService } from './vscode/src/vs/workbench/services/activity/common/activity.js';
135
136
  export { IHoverService } from './vscode/src/vs/platform/hover/browser/hover.js';
136
137
  export { IExplorerService } from './vscode/src/vs/workbench/contrib/files/browser/files.js';
@@ -139,7 +140,7 @@ export { ITitleService } from './vscode/src/vs/workbench/services/title/browser/
139
140
  export { IBannerService } from './vscode/src/vs/workbench/services/banner/browser/bannerService.js';
140
141
  export { IWorkspaceTrustEnablementService, IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from './vscode/src/vs/platform/workspace/common/workspaceTrust.js';
141
142
  export { IDialogService, IFileDialogService } from './vscode/src/vs/platform/dialogs/common/dialogs.js';
142
- async function initialize(overrides, container = document.body, configuration = {}) {
143
+ async function initialize(overrides, container = document.body, configuration = {}, productConfiguration = {}) {
143
144
  checkServicesNotInitialized();
144
145
  initialize$1(container, configuration);
145
146
  const instantiationService = StandaloneServices.initialize({
@@ -155,13 +156,14 @@ async function initialize(overrides, container = document.body, configuration =
155
156
  reportIssueUrl: 'https://github.com/microsoft/vscode/issues/new',
156
157
  licenseName: 'MIT',
157
158
  licenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt',
158
- serverApplicationName: 'code-server-oss'
159
+ serverApplicationName: 'code-server-oss',
160
+ ...productConfiguration
159
161
  }, configuration.productConfiguration ?? {}),
162
+ ...getServiceOverride(),
160
163
  ...getServiceOverride$1(),
161
- ...getServiceOverride$1$1(),
162
164
  ...getServiceOverride$2(),
163
- ...getServiceOverride$1$2(),
164
- ...getServiceOverride$4(),
165
+ ...getServiceOverride$1$1(),
166
+ ...getServiceOverride$2$1(),
165
167
  ...getServiceOverride$5(),
166
168
  ...getServiceOverride$6(),
167
169
  ...overrides
@@ -0,0 +1,60 @@
1
+ async function requestUsbDevice(options) {
2
+ const usb = navigator.usb;
3
+ if (!usb) {
4
+ return undefined;
5
+ }
6
+ const device = await usb.requestDevice({ filters: options?.filters ?? [] });
7
+ if (!device) {
8
+ return undefined;
9
+ }
10
+ return {
11
+ deviceClass: device.deviceClass,
12
+ deviceProtocol: device.deviceProtocol,
13
+ deviceSubclass: device.deviceSubclass,
14
+ deviceVersionMajor: device.deviceVersionMajor,
15
+ deviceVersionMinor: device.deviceVersionMinor,
16
+ deviceVersionSubminor: device.deviceVersionSubminor,
17
+ manufacturerName: device.manufacturerName,
18
+ productId: device.productId,
19
+ productName: device.productName,
20
+ serialNumber: device.serialNumber,
21
+ usbVersionMajor: device.usbVersionMajor,
22
+ usbVersionMinor: device.usbVersionMinor,
23
+ usbVersionSubminor: device.usbVersionSubminor,
24
+ vendorId: device.vendorId,
25
+ };
26
+ }
27
+ async function requestSerialPort(options) {
28
+ const serial = navigator.serial;
29
+ if (!serial) {
30
+ return undefined;
31
+ }
32
+ const port = await serial.requestPort({ filters: options?.filters ?? [] });
33
+ if (!port) {
34
+ return undefined;
35
+ }
36
+ const info = port.getInfo();
37
+ return {
38
+ usbVendorId: info.usbVendorId,
39
+ usbProductId: info.usbProductId
40
+ };
41
+ }
42
+ async function requestHidDevice(options) {
43
+ const hid = navigator.hid;
44
+ if (!hid) {
45
+ return undefined;
46
+ }
47
+ const devices = await hid.requestDevice({ filters: options?.filters ?? [] });
48
+ if (!devices.length) {
49
+ return undefined;
50
+ }
51
+ const device = devices[0];
52
+ return {
53
+ opened: device.opened,
54
+ vendorId: device.vendorId,
55
+ productId: device.productId,
56
+ productName: device.productName,
57
+ collections: device.collections
58
+ };
59
+ }
60
+ export { requestHidDevice, requestSerialPort, requestUsbDevice };
@@ -1048,6 +1048,23 @@ function computeScreenAwareSize(window, cssPx) {
1048
1048
  function windowOpenNoOpener(url) {
1049
1049
  mainWindow.open(url, '_blank', 'noopener');
1050
1050
  }
1051
+ const popupWidth = 780, popupHeight = 640;
1052
+ function windowOpenPopup(url) {
1053
+ const left = Math.floor(mainWindow.screenLeft + mainWindow.innerWidth / 2 - popupWidth / 2);
1054
+ const top = Math.floor(mainWindow.screenTop + mainWindow.innerHeight / 2 - popupHeight / 2);
1055
+ mainWindow.open(url, '_blank', `width=${popupWidth},height=${popupHeight},top=${top},left=${left}`);
1056
+ }
1057
+ function windowOpenWithSuccess(url, noOpener = true) {
1058
+ const newTab = mainWindow.open();
1059
+ if (newTab) {
1060
+ if (noOpener) {
1061
+ newTab.opener = null;
1062
+ }
1063
+ newTab.location.href = url;
1064
+ return true;
1065
+ }
1066
+ return false;
1067
+ }
1051
1068
  function animate(targetWindow, fn) {
1052
1069
  const step = () => {
1053
1070
  fn();
@@ -1538,4 +1555,4 @@ function trackAttributes(from, to, filter) {
1538
1555
  }));
1539
1556
  return disposables;
1540
1557
  }
1541
- export { $, DetectedFullscreenMode, Dimension, DragAndDropObserver, EventHelper, EventType, ModifierKeyEmitter, Namespace, WindowIdleValue, WindowIntervalTimer, addDisposableGenericMouseDownListener, addDisposableGenericMouseUpListener, addDisposableListener, addDisposableThrottledListener, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, addStandardDisposableListener, after, animate, append, asCSSPropertyValue, asCSSUrl, asCssValueWithDefault, basicMarkupHtmlTags, clearNode, cloneGlobalStylesheets, computeScreenAwareSize, copyAttributes, createCSSRule, createLinkElement, createMetaElement, createStyleSheet, createStyleSheet2, detectFullscreen, disposableWindowInterval, finalHandler, findParentWithClass, focusWindow, getActiveDocument, getActiveElement, getActiveWindow, getClientArea, getComputedStyle, getContentHeight, getContentWidth, getDocument, getDomNodePagePosition, getDomNodeZoomLevel, getLargestChildWidth, getShadowRoot, getTopLeftOffset, getTotalHeight, getTotalScrollWidth, getTotalWidth, getWindow, getWindowById, getWindowId, getWindows, getWindowsCount, h, hasParentWithClass, hasWindow, hide, hookDomPurifyHrefAndSrcSanitizer, isActiveDocument, isActiveElement, isAncestor, isAncestorOfActiveElement, isAncestorUsingFlowTo, isDragEvent, isEventLike, isGlobalStylesheet, isInShadowDOM, isKeyboardEvent, isMouseEvent, isPointerEvent, isShadowRoot, join, measure, modify, multibyteAwareBtoa, onDidRegisterWindow, onDidUnregisterWindow, onWillUnregisterWindow, position, prepend, registerWindow, removeCSSRulesContainingSelector, reset, restoreParentsScrollTop, runAtThisOrScheduleAtNextAnimationFrame, runWhenWindowIdle, safeInnerHtml, saveParentsScrollTop, scheduleAtNextAnimationFrame, setParentFlowTo, setVisibility, sharedMutationObserver, show, size, trackAttributes, trackFocus, triggerDownload, triggerUpload, windowOpenNoOpener };
1558
+ export { $, DetectedFullscreenMode, Dimension, DragAndDropObserver, EventHelper, EventType, ModifierKeyEmitter, Namespace, WindowIdleValue, WindowIntervalTimer, addDisposableGenericMouseDownListener, addDisposableGenericMouseUpListener, addDisposableListener, addDisposableThrottledListener, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, addStandardDisposableListener, after, animate, append, asCSSPropertyValue, asCSSUrl, asCssValueWithDefault, basicMarkupHtmlTags, clearNode, cloneGlobalStylesheets, computeScreenAwareSize, copyAttributes, createCSSRule, createLinkElement, createMetaElement, createStyleSheet, createStyleSheet2, detectFullscreen, disposableWindowInterval, finalHandler, findParentWithClass, focusWindow, getActiveDocument, getActiveElement, getActiveWindow, getClientArea, getComputedStyle, getContentHeight, getContentWidth, getDocument, getDomNodePagePosition, getDomNodeZoomLevel, getLargestChildWidth, getShadowRoot, getTopLeftOffset, getTotalHeight, getTotalScrollWidth, getTotalWidth, getWindow, getWindowById, getWindowId, getWindows, getWindowsCount, h, hasParentWithClass, hasWindow, hide, hookDomPurifyHrefAndSrcSanitizer, isActiveDocument, isActiveElement, isAncestor, isAncestorOfActiveElement, isAncestorUsingFlowTo, isDragEvent, isEventLike, isGlobalStylesheet, isInShadowDOM, isKeyboardEvent, isMouseEvent, isPointerEvent, isShadowRoot, join, measure, modify, multibyteAwareBtoa, onDidRegisterWindow, onDidUnregisterWindow, onWillUnregisterWindow, position, prepend, registerWindow, removeCSSRulesContainingSelector, reset, restoreParentsScrollTop, runAtThisOrScheduleAtNextAnimationFrame, runWhenWindowIdle, safeInnerHtml, saveParentsScrollTop, scheduleAtNextAnimationFrame, setParentFlowTo, setVisibility, sharedMutationObserver, show, size, trackAttributes, trackFocus, triggerDownload, triggerUpload, windowOpenNoOpener, windowOpenPopup, windowOpenWithSuccess };
@@ -0,0 +1,178 @@
1
+ import { $ } from '../../dom.js';
2
+ import { SplitView } from '../splitview/splitview.js';
3
+ import { Event } from '../../../common/event.js';
4
+ import { DisposableStore } from '../../../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 }, centeredLayoutFixedWidth = false) {
36
+ this.container = container;
37
+ this.view = view;
38
+ this.state = state;
39
+ this.centeredLayoutFixedWidth = centeredLayoutFixedWidth;
40
+ this.lastLayoutPosition = { width: 0, height: 0, left: 0, top: 0 };
41
+ this.didLayout = false;
42
+ this.splitViewDisposables = ( new DisposableStore());
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 };