@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,288 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { FastDomNode } from '../../../../base/browser/fastDomNode.js';
3
+ import { Emitter } from '../../../../base/common/event.js';
4
+ import { Disposable, MutableDisposable, DisposableStore } from '../../../../base/common/lifecycle.js';
5
+ import { generateUuid } from '../../../../base/common/uuid.js';
6
+ import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
7
+ import { ILayoutService } from '../../../../platform/layout/browser/layoutService.js';
8
+ import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED, IWebviewService } from './webview.js';
9
+ let OverlayWebview = class OverlayWebview extends Disposable {
10
+ constructor(initInfo, _layoutService, _webviewService, _baseContextKeyService) {
11
+ super();
12
+ this._layoutService = _layoutService;
13
+ this._webviewService = _webviewService;
14
+ this._baseContextKeyService = _baseContextKeyService;
15
+ this._isFirstLoad = true;
16
+ this._firstLoadPendingMessages = ( new Set());
17
+ this._webview = this._register(( new MutableDisposable()));
18
+ this._webviewEvents = this._register(( new DisposableStore()));
19
+ this._html = '';
20
+ this._initialScrollProgress = 0;
21
+ this._state = undefined;
22
+ this._owner = undefined;
23
+ this._scopedContextKeyService = this._register(( new MutableDisposable()));
24
+ this._shouldShowFindWidgetOnRestore = false;
25
+ this._isDisposed = false;
26
+ this._onDidDispose = this._register(( new Emitter()));
27
+ this.onDidDispose = this._onDidDispose.event;
28
+ this._onDidFocus = this._register(( new Emitter()));
29
+ this.onDidFocus = this._onDidFocus.event;
30
+ this._onDidBlur = this._register(( new Emitter()));
31
+ this.onDidBlur = this._onDidBlur.event;
32
+ this._onDidClickLink = this._register(( new Emitter()));
33
+ this.onDidClickLink = this._onDidClickLink.event;
34
+ this._onDidReload = this._register(( new Emitter()));
35
+ this.onDidReload = this._onDidReload.event;
36
+ this._onDidScroll = this._register(( new Emitter()));
37
+ this.onDidScroll = this._onDidScroll.event;
38
+ this._onDidUpdateState = this._register(( new Emitter()));
39
+ this.onDidUpdateState = this._onDidUpdateState.event;
40
+ this._onMessage = this._register(( new Emitter()));
41
+ this.onMessage = this._onMessage.event;
42
+ this._onMissingCsp = this._register(( new Emitter()));
43
+ this.onMissingCsp = this._onMissingCsp.event;
44
+ this._onDidWheel = this._register(( new Emitter()));
45
+ this.onDidWheel = this._onDidWheel.event;
46
+ this._onFatalError = this._register(( new Emitter()));
47
+ this.onFatalError = this._onFatalError.event;
48
+ this.providedViewType = initInfo.providedViewType;
49
+ this.origin = initInfo.origin ?? generateUuid();
50
+ this._title = initInfo.title;
51
+ this._extension = initInfo.extension;
52
+ this._options = initInfo.options;
53
+ this._contentOptions = initInfo.contentOptions;
54
+ }
55
+ get isFocused() {
56
+ return !!this._webview.value?.isFocused;
57
+ }
58
+ dispose() {
59
+ this._isDisposed = true;
60
+ this._container?.domNode.remove();
61
+ this._container = undefined;
62
+ for (const msg of this._firstLoadPendingMessages) {
63
+ msg.resolve(false);
64
+ }
65
+ this._firstLoadPendingMessages.clear();
66
+ this._onDidDispose.fire();
67
+ super.dispose();
68
+ }
69
+ get container() {
70
+ if (this._isDisposed) {
71
+ throw new Error(`OverlayWebview has been disposed`);
72
+ }
73
+ if (!this._container) {
74
+ const node = document.createElement('div');
75
+ node.style.position = 'absolute';
76
+ node.style.overflow = 'hidden';
77
+ this._container = ( new FastDomNode(node));
78
+ this._container.setVisibility('hidden');
79
+ this._layoutService.mainContainer.appendChild(node);
80
+ }
81
+ return this._container.domNode;
82
+ }
83
+ claim(owner, scopedContextKeyService) {
84
+ if (this._isDisposed) {
85
+ return;
86
+ }
87
+ const oldOwner = this._owner;
88
+ this._owner = owner;
89
+ this._show();
90
+ if (oldOwner !== owner) {
91
+ const contextKeyService = (scopedContextKeyService || this._baseContextKeyService);
92
+ this._scopedContextKeyService.clear();
93
+ this._scopedContextKeyService.value = contextKeyService.createScoped(this.container);
94
+ const wasFindVisible = this._findWidgetVisible?.get();
95
+ this._findWidgetVisible?.reset();
96
+ this._findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(contextKeyService);
97
+ this._findWidgetVisible.set(!!wasFindVisible);
98
+ this._findWidgetEnabled?.reset();
99
+ this._findWidgetEnabled = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED.bindTo(contextKeyService);
100
+ this._findWidgetEnabled.set(!!this.options.enableFindWidget);
101
+ this._webview.value?.setContextKeyService(this._scopedContextKeyService.value);
102
+ }
103
+ }
104
+ release(owner) {
105
+ if (this._owner !== owner) {
106
+ return;
107
+ }
108
+ this._scopedContextKeyService.clear();
109
+ this._owner = undefined;
110
+ if (this._container) {
111
+ this._container.setVisibility('hidden');
112
+ }
113
+ if (this._options.retainContextWhenHidden) {
114
+ this._shouldShowFindWidgetOnRestore = !!this._findWidgetVisible?.get();
115
+ this.hideFind(false);
116
+ }
117
+ else {
118
+ this._webview.clear();
119
+ this._webviewEvents.clear();
120
+ }
121
+ }
122
+ layoutWebviewOverElement(element, dimension, clippingContainer) {
123
+ if (!this._container || !this._container.domNode.parentElement) {
124
+ return;
125
+ }
126
+ const frameRect = element.getBoundingClientRect();
127
+ const containerRect = this._container.domNode.parentElement.getBoundingClientRect();
128
+ const parentBorderTop = (containerRect.height - this._container.domNode.parentElement.clientHeight) / 2.0;
129
+ const parentBorderLeft = (containerRect.width - this._container.domNode.parentElement.clientWidth) / 2.0;
130
+ this._container.setTop(frameRect.top - containerRect.top - parentBorderTop);
131
+ this._container.setLeft(frameRect.left - containerRect.left - parentBorderLeft);
132
+ this._container.setWidth(dimension ? dimension.width : frameRect.width);
133
+ this._container.setHeight(dimension ? dimension.height : frameRect.height);
134
+ if (clippingContainer) {
135
+ const { top, left, right, bottom } = computeClippingRect(frameRect, clippingContainer);
136
+ this._container.domNode.style.clipPath = `polygon(${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px)`;
137
+ }
138
+ }
139
+ _show() {
140
+ if (this._isDisposed) {
141
+ throw new Error('OverlayWebview is disposed');
142
+ }
143
+ if (!this._webview.value) {
144
+ const webview = this._webviewService.createWebviewElement({
145
+ providedViewType: this.providedViewType,
146
+ origin: this.origin,
147
+ title: this._title,
148
+ options: this._options,
149
+ contentOptions: this._contentOptions,
150
+ extension: this.extension,
151
+ });
152
+ this._webview.value = webview;
153
+ webview.state = this._state;
154
+ if (this._scopedContextKeyService.value) {
155
+ this._webview.value.setContextKeyService(this._scopedContextKeyService.value);
156
+ }
157
+ if (this._html) {
158
+ webview.setHtml(this._html);
159
+ }
160
+ if (this._options.tryRestoreScrollPosition) {
161
+ webview.initialScrollProgress = this._initialScrollProgress;
162
+ }
163
+ this._findWidgetEnabled?.set(!!this.options.enableFindWidget);
164
+ webview.mountTo(this.container);
165
+ this._webviewEvents.clear();
166
+ this._webviewEvents.add(webview.onDidFocus(() => { this._onDidFocus.fire(); }));
167
+ this._webviewEvents.add(webview.onDidBlur(() => { this._onDidBlur.fire(); }));
168
+ this._webviewEvents.add(webview.onDidClickLink(x => { this._onDidClickLink.fire(x); }));
169
+ this._webviewEvents.add(webview.onMessage(x => { this._onMessage.fire(x); }));
170
+ this._webviewEvents.add(webview.onMissingCsp(x => { this._onMissingCsp.fire(x); }));
171
+ this._webviewEvents.add(webview.onDidWheel(x => { this._onDidWheel.fire(x); }));
172
+ this._webviewEvents.add(webview.onDidReload(() => { this._onDidReload.fire(); }));
173
+ this._webviewEvents.add(webview.onFatalError(x => { this._onFatalError.fire(x); }));
174
+ this._webviewEvents.add(webview.onDidScroll(x => {
175
+ this._initialScrollProgress = x.scrollYPercentage;
176
+ this._onDidScroll.fire(x);
177
+ }));
178
+ this._webviewEvents.add(webview.onDidUpdateState(state => {
179
+ this._state = state;
180
+ this._onDidUpdateState.fire(state);
181
+ }));
182
+ if (this._isFirstLoad) {
183
+ this._firstLoadPendingMessages.forEach(async (msg) => {
184
+ msg.resolve(await webview.postMessage(msg.message, msg.transfer));
185
+ });
186
+ }
187
+ this._isFirstLoad = false;
188
+ this._firstLoadPendingMessages.clear();
189
+ }
190
+ if (this.options.retainContextWhenHidden && this._shouldShowFindWidgetOnRestore) {
191
+ this.showFind(false);
192
+ this._shouldShowFindWidgetOnRestore = false;
193
+ }
194
+ this._container?.setVisibility('visible');
195
+ }
196
+ setHtml(html) {
197
+ this._html = html;
198
+ this._withWebview(webview => webview.setHtml(html));
199
+ }
200
+ setTitle(title) {
201
+ this._title = title;
202
+ this._withWebview(webview => webview.setTitle(title));
203
+ }
204
+ get initialScrollProgress() { return this._initialScrollProgress; }
205
+ set initialScrollProgress(value) {
206
+ this._initialScrollProgress = value;
207
+ this._withWebview(webview => webview.initialScrollProgress = value);
208
+ }
209
+ get state() { return this._state; }
210
+ set state(value) {
211
+ this._state = value;
212
+ this._withWebview(webview => webview.state = value);
213
+ }
214
+ get extension() { return this._extension; }
215
+ set extension(value) {
216
+ this._extension = value;
217
+ this._withWebview(webview => webview.extension = value);
218
+ }
219
+ get options() { return this._options; }
220
+ set options(value) { this._options = { customClasses: this._options.customClasses, ...value }; }
221
+ get contentOptions() { return this._contentOptions; }
222
+ set contentOptions(value) {
223
+ this._contentOptions = value;
224
+ this._withWebview(webview => webview.contentOptions = value);
225
+ }
226
+ set localResourcesRoot(resources) {
227
+ this._withWebview(webview => webview.localResourcesRoot = resources);
228
+ }
229
+ async postMessage(message, transfer) {
230
+ if (this._webview.value) {
231
+ return this._webview.value.postMessage(message, transfer);
232
+ }
233
+ if (this._isFirstLoad) {
234
+ let resolve;
235
+ const p = ( new Promise(r => resolve = r));
236
+ this._firstLoadPendingMessages.add({ message, transfer, resolve: resolve });
237
+ return p;
238
+ }
239
+ return false;
240
+ }
241
+ focus() { this._webview.value?.focus(); }
242
+ reload() { this._webview.value?.reload(); }
243
+ selectAll() { this._webview.value?.selectAll(); }
244
+ copy() { this._webview.value?.copy(); }
245
+ paste() { this._webview.value?.paste(); }
246
+ cut() { this._webview.value?.cut(); }
247
+ undo() { this._webview.value?.undo(); }
248
+ redo() { this._webview.value?.redo(); }
249
+ showFind(animated = true) {
250
+ if (this._webview.value) {
251
+ this._webview.value.showFind(animated);
252
+ this._findWidgetVisible?.set(true);
253
+ }
254
+ }
255
+ hideFind(animated = true) {
256
+ this._findWidgetVisible?.reset();
257
+ this._webview.value?.hideFind(animated);
258
+ }
259
+ runFindAction(previous) { this._webview.value?.runFindAction(previous); }
260
+ _withWebview(f) {
261
+ if (this._webview.value) {
262
+ f(this._webview.value);
263
+ }
264
+ }
265
+ windowDidDragStart() {
266
+ this._webview.value?.windowDidDragStart();
267
+ }
268
+ windowDidDragEnd() {
269
+ this._webview.value?.windowDidDragEnd();
270
+ }
271
+ setContextKeyService(contextKeyService) {
272
+ this._webview.value?.setContextKeyService(contextKeyService);
273
+ }
274
+ };
275
+ OverlayWebview = ( __decorate([
276
+ ( __param(1, ILayoutService)),
277
+ ( __param(2, IWebviewService)),
278
+ ( __param(3, IContextKeyService))
279
+ ], OverlayWebview));
280
+ function computeClippingRect(frameRect, clipper) {
281
+ const rootRect = clipper.getBoundingClientRect();
282
+ const top = Math.max(rootRect.top - frameRect.top, 0);
283
+ const right = Math.max(frameRect.width - (frameRect.right - rootRect.right), 0);
284
+ const bottom = Math.max(frameRect.height - (frameRect.bottom - rootRect.bottom), 0);
285
+ const left = Math.max(rootRect.left - frameRect.left, 0);
286
+ return { top, right, bottom, left };
287
+ }
288
+ export { OverlayWebview };
@@ -0,0 +1,94 @@
1
+ import { isUNC } from '../../../../base/common/extpath.js';
2
+ import { Schemas } from '../../../../base/common/network.js';
3
+ import { normalize, sep } from '../../../../base/common/path.js';
4
+ import { URI } from '../../../../base/common/uri.js';
5
+ import { FileOperationError } from '../../../../platform/files/common/files.js';
6
+ import { getWebviewContentMimeType } from '../../../../platform/webview/common/mimeTypes.js';
7
+ var WebviewResourceResponse;
8
+ ( (function(WebviewResourceResponse) {
9
+ let Type;
10
+ ( (function(Type) {
11
+ Type[Type["Success"] = 0] = "Success";
12
+ Type[Type["Failed"] = 1] = "Failed";
13
+ Type[Type["AccessDenied"] = 2] = "AccessDenied";
14
+ Type[Type["NotModified"] = 3] = "NotModified";
15
+ })(Type = WebviewResourceResponse.Type || (WebviewResourceResponse.Type = {})));
16
+ class StreamSuccess {
17
+ constructor(stream, etag, mtime, mimeType) {
18
+ this.stream = stream;
19
+ this.etag = etag;
20
+ this.mtime = mtime;
21
+ this.mimeType = mimeType;
22
+ this.type = Type.Success;
23
+ }
24
+ }
25
+ WebviewResourceResponse.StreamSuccess = StreamSuccess;
26
+ WebviewResourceResponse.Failed = { type: Type.Failed };
27
+ WebviewResourceResponse.AccessDenied = { type: Type.AccessDenied };
28
+ class NotModified {
29
+ constructor(mimeType, mtime) {
30
+ this.mimeType = mimeType;
31
+ this.mtime = mtime;
32
+ this.type = Type.NotModified;
33
+ }
34
+ }
35
+ WebviewResourceResponse.NotModified = NotModified;
36
+ })(WebviewResourceResponse || (WebviewResourceResponse = {})));
37
+ async function loadLocalResource(requestUri, options, fileService, logService, token) {
38
+ logService.debug(`loadLocalResource - begin. requestUri=${requestUri}`);
39
+ const resourceToLoad = getResourceToLoad(requestUri, options.roots);
40
+ logService.debug(`loadLocalResource - found resource to load. requestUri=${requestUri}, resourceToLoad=${resourceToLoad}`);
41
+ if (!resourceToLoad) {
42
+ return WebviewResourceResponse.AccessDenied;
43
+ }
44
+ const mime = getWebviewContentMimeType(requestUri);
45
+ try {
46
+ const result = await fileService.readFileStream(resourceToLoad, { etag: options.ifNoneMatch }, token);
47
+ return new WebviewResourceResponse.StreamSuccess(result.value, result.etag, result.mtime, mime);
48
+ }
49
+ catch (err) {
50
+ if (err instanceof FileOperationError) {
51
+ const result = err.fileOperationResult;
52
+ if (result === 2 ) {
53
+ return new WebviewResourceResponse.NotModified(mime, err.options?.mtime);
54
+ }
55
+ }
56
+ logService.debug(`loadLocalResource - Error using fileReader. requestUri=${requestUri}`);
57
+ console.log(err);
58
+ return WebviewResourceResponse.Failed;
59
+ }
60
+ }
61
+ function getResourceToLoad(requestUri, roots) {
62
+ for (const root of roots) {
63
+ if (containsResource(root, requestUri)) {
64
+ return normalizeResourcePath(requestUri);
65
+ }
66
+ }
67
+ return undefined;
68
+ }
69
+ function containsResource(root, resource) {
70
+ if (root.scheme !== resource.scheme) {
71
+ return false;
72
+ }
73
+ let resourceFsPath = normalize(resource.fsPath);
74
+ let rootPath = normalize(root.fsPath + (root.fsPath.endsWith(sep) ? '' : sep));
75
+ if (isUNC(root.fsPath) && isUNC(resource.fsPath)) {
76
+ rootPath = rootPath.toLowerCase();
77
+ resourceFsPath = resourceFsPath.toLowerCase();
78
+ }
79
+ return resourceFsPath.startsWith(rootPath);
80
+ }
81
+ function normalizeResourcePath(resource) {
82
+ if (resource.scheme === Schemas.vscodeRemote) {
83
+ return ( URI.from({
84
+ scheme: Schemas.vscodeRemote,
85
+ authority: resource.authority,
86
+ path: '/vscode-resource',
87
+ query: JSON.stringify({
88
+ requestResourcePath: resource.path
89
+ })
90
+ }));
91
+ }
92
+ return resource;
93
+ }
94
+ export { WebviewResourceResponse, loadLocalResource };
@@ -0,0 +1,86 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Emitter } from '../../../../base/common/event.js';
3
+ import { Disposable } from '../../../../base/common/lifecycle.js';
4
+ import { EDITOR_FONT_DEFAULTS } from '../../../../editor/common/config/editorOptions.js';
5
+ import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
6
+ import { getColorRegistry } from '../../../../platform/theme/common/colorRegistry.js';
7
+ import { ColorScheme } from '../../../../platform/theme/common/theme.js';
8
+ import { IWorkbenchThemeService } from '../../../services/themes/common/workbenchThemeService.js';
9
+ import { DEFAULT_FONT_FAMILY } from '../../../browser/style.js';
10
+ let WebviewThemeDataProvider = class WebviewThemeDataProvider extends Disposable {
11
+ constructor(_themeService, _configurationService) {
12
+ super();
13
+ this._themeService = _themeService;
14
+ this._configurationService = _configurationService;
15
+ this._cachedWebViewThemeData = undefined;
16
+ this._onThemeDataChanged = this._register(( new Emitter()));
17
+ this.onThemeDataChanged = this._onThemeDataChanged.event;
18
+ this._register(this._themeService.onDidColorThemeChange(() => {
19
+ this._reset();
20
+ }));
21
+ const webviewConfigurationKeys = ['editor.fontFamily', 'editor.fontWeight', 'editor.fontSize'];
22
+ this._register(this._configurationService.onDidChangeConfiguration(e => {
23
+ if (( webviewConfigurationKeys.some(key => e.affectsConfiguration(key)))) {
24
+ this._reset();
25
+ }
26
+ }));
27
+ }
28
+ getTheme() {
29
+ return this._themeService.getColorTheme();
30
+ }
31
+ getWebviewThemeData() {
32
+ if (!this._cachedWebViewThemeData) {
33
+ const configuration = this._configurationService.getValue('editor');
34
+ const editorFontFamily = configuration.fontFamily || EDITOR_FONT_DEFAULTS.fontFamily;
35
+ const editorFontWeight = configuration.fontWeight || EDITOR_FONT_DEFAULTS.fontWeight;
36
+ const editorFontSize = configuration.fontSize || EDITOR_FONT_DEFAULTS.fontSize;
37
+ const theme = this._themeService.getColorTheme();
38
+ const exportedColors = getColorRegistry().getColors().reduce((colors, entry) => {
39
+ const color = theme.getColor(entry.id);
40
+ if (color) {
41
+ colors['vscode-' + entry.id.replace('.', '-')] = ( color.toString());
42
+ }
43
+ return colors;
44
+ }, {});
45
+ const styles = {
46
+ 'vscode-font-family': DEFAULT_FONT_FAMILY,
47
+ 'vscode-font-weight': 'normal',
48
+ 'vscode-font-size': '13px',
49
+ 'vscode-editor-font-family': editorFontFamily,
50
+ 'vscode-editor-font-weight': editorFontWeight,
51
+ 'vscode-editor-font-size': editorFontSize + 'px',
52
+ ...exportedColors
53
+ };
54
+ const activeTheme = ApiThemeClassName.fromTheme(theme);
55
+ this._cachedWebViewThemeData = { styles, activeTheme, themeLabel: theme.label, themeId: theme.settingsId };
56
+ }
57
+ return this._cachedWebViewThemeData;
58
+ }
59
+ _reset() {
60
+ this._cachedWebViewThemeData = undefined;
61
+ this._onThemeDataChanged.fire();
62
+ }
63
+ };
64
+ WebviewThemeDataProvider = ( __decorate([
65
+ ( __param(0, IWorkbenchThemeService)),
66
+ ( __param(1, IConfigurationService))
67
+ ], WebviewThemeDataProvider));
68
+ var ApiThemeClassName;
69
+ ( (function(ApiThemeClassName) {
70
+ ApiThemeClassName["light"] = "vscode-light";
71
+ ApiThemeClassName["dark"] = "vscode-dark";
72
+ ApiThemeClassName["highContrast"] = "vscode-high-contrast";
73
+ ApiThemeClassName["highContrastLight"] = "vscode-high-contrast-light";
74
+ })(ApiThemeClassName || (ApiThemeClassName = {})));
75
+ ( (function(ApiThemeClassName) {
76
+ function fromTheme(theme) {
77
+ switch (theme.type) {
78
+ case ColorScheme.LIGHT: return ApiThemeClassName.light;
79
+ case ColorScheme.DARK: return ApiThemeClassName.dark;
80
+ case ColorScheme.HIGH_CONTRAST_DARK: return ApiThemeClassName.highContrast;
81
+ case ColorScheme.HIGH_CONTRAST_LIGHT: return ApiThemeClassName.highContrastLight;
82
+ }
83
+ }
84
+ ApiThemeClassName.fromTheme = fromTheme;
85
+ })(ApiThemeClassName || (ApiThemeClassName = {})));
86
+ export { WebviewThemeDataProvider };
@@ -0,0 +1,77 @@
1
+ import { getActiveElement } from '../../../../base/browser/dom.js';
2
+ import { UndoCommand, RedoCommand, SelectAllCommand } from '../../../../editor/browser/editorExtensions.js';
3
+ import { CutAction, CopyAction, PasteAction } from '../../../../editor/contrib/clipboard/browser/clipboard.js';
4
+ import { localizeWithPath } from '../../../../nls.js';
5
+ import { MenuRegistry, MenuId } from '../../../../platform/actions/common/actions.js';
6
+ import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
7
+ import { IWebviewService } from './webview.js';
8
+ import { WebviewInput } from '../../webviewPanel/browser/webviewEditorInput.js';
9
+ import { IEditorService } from '../../../services/editor/common/editorService.js';
10
+ const PRIORITY = 100;
11
+ function overrideCommandForWebview(command, f) {
12
+ command?.addImplementation(PRIORITY, 'webview', accessor => {
13
+ const webviewService = accessor.get(IWebviewService);
14
+ const webview = webviewService.activeWebview;
15
+ if (webview?.isFocused) {
16
+ f(webview);
17
+ return true;
18
+ }
19
+ if (getActiveElement()?.classList.contains('action-menu-item')) {
20
+ const editorService = accessor.get(IEditorService);
21
+ if (editorService.activeEditor instanceof WebviewInput) {
22
+ f(editorService.activeEditor.webview);
23
+ return true;
24
+ }
25
+ }
26
+ return false;
27
+ });
28
+ }
29
+ overrideCommandForWebview(UndoCommand, webview => webview.undo());
30
+ overrideCommandForWebview(RedoCommand, webview => webview.redo());
31
+ overrideCommandForWebview(SelectAllCommand, webview => webview.selectAll());
32
+ overrideCommandForWebview(CopyAction, webview => webview.copy());
33
+ overrideCommandForWebview(PasteAction, webview => webview.paste());
34
+ overrideCommandForWebview(CutAction, webview => webview.cut());
35
+ const PreventDefaultContextMenuItemsContextKeyName = 'preventDefaultContextMenuItems';
36
+ if (CutAction) {
37
+ MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
38
+ command: {
39
+ id: CutAction.id,
40
+ title: ( localizeWithPath('vs/workbench/contrib/webview/browser/webview.contribution', 'cut', "Cut")),
41
+ },
42
+ group: '5_cutcopypaste',
43
+ order: 1,
44
+ when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
45
+ });
46
+ }
47
+ if (CopyAction) {
48
+ MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
49
+ command: {
50
+ id: CopyAction.id,
51
+ title: ( localizeWithPath(
52
+ 'vs/workbench/contrib/webview/browser/webview.contribution',
53
+ 'copy',
54
+ "Copy"
55
+ )),
56
+ },
57
+ group: '5_cutcopypaste',
58
+ order: 2,
59
+ when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
60
+ });
61
+ }
62
+ if (PasteAction) {
63
+ MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
64
+ command: {
65
+ id: PasteAction.id,
66
+ title: ( localizeWithPath(
67
+ 'vs/workbench/contrib/webview/browser/webview.contribution',
68
+ 'paste',
69
+ "Paste"
70
+ )),
71
+ },
72
+ group: '5_cutcopypaste',
73
+ order: 3,
74
+ when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
75
+ });
76
+ }
77
+ export { PreventDefaultContextMenuItemsContextKeyName };