@codingame/monaco-vscode-views-service-override 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 (107) hide show
  1. package/index.d.ts +11 -9
  2. package/index.js +8 -6
  3. package/package.json +11 -11
  4. package/tools/views.d.ts +102 -0
  5. package/tools/views.js +253 -0
  6. package/views.d.ts +4 -99
  7. package/views.js +52 -280
  8. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  9. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
  10. package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
  11. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
  12. package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
  13. package/vscode/src/vs/base/common/codicons.d.ts +0 -579
  14. package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
  15. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
  16. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
  17. package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
  18. package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
  19. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
  20. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
  21. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
  22. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
  23. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
  24. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
  25. package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
  26. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
  27. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
  28. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
  29. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
  30. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
  31. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
  32. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
  33. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
  34. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
  35. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
  36. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
  37. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
  38. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
  39. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
  40. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
  41. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
  42. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
  43. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
  44. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
  45. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
  46. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
  47. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
  48. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
  49. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
  50. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
  51. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
  52. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
  53. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
  54. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
  55. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
  56. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
  57. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
  58. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
  59. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
  60. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
  61. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
  62. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
  63. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
  64. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
  65. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
  66. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
  67. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
  68. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
  69. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
  70. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
  71. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
  72. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
  73. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
  74. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
  75. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
  76. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
  77. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
  78. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
  79. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
  80. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
  81. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
  82. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
  83. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
  84. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
  85. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
  86. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
  87. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
  88. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
  89. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
  90. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
  91. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
  92. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
  93. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
  94. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
  95. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
  96. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
  97. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
  98. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
  99. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
  100. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
  101. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
  102. package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
  103. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
  104. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
  105. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
  106. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
  107. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
@@ -1,133 +0,0 @@
1
- import { TypeHierarchyModel } from 'vscode/vscode/vs/workbench/contrib/typeHierarchy/common/typeHierarchy';
2
- import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
3
- import { createMatches } from 'vscode/vscode/vs/base/common/filters';
4
- import { IconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabel';
5
- import { SymbolKinds } from 'vscode/vscode/vs/editor/common/languages';
6
- import { compare } from 'vscode/vscode/vs/base/common/strings';
7
- import { Range } from 'vscode/vscode/vs/editor/common/core/range';
8
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
9
- import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
10
-
11
- class Type {
12
- constructor(item, model, parent) {
13
- this.item = item;
14
- this.model = model;
15
- this.parent = parent;
16
- }
17
- static compare(a, b) {
18
- let res = compare(( a.item.uri.toString()), ( b.item.uri.toString()));
19
- if (res === 0) {
20
- res = Range.compareRangesUsingStarts(a.item.range, b.item.range);
21
- }
22
- return res;
23
- }
24
- }
25
- class DataSource {
26
- constructor(getDirection) {
27
- this.getDirection = getDirection;
28
- }
29
- hasChildren() {
30
- return true;
31
- }
32
- async getChildren(element) {
33
- if (element instanceof TypeHierarchyModel) {
34
- return ( element.roots.map(root => ( new Type(root, element, undefined))));
35
- }
36
- const { model, item } = element;
37
- if (this.getDirection() === "supertypes" ) {
38
- return ( (await model.provideSupertypes(item, CancellationToken.None)).map(item => {
39
- return ( new Type(item, model, element));
40
- }));
41
- }
42
- else {
43
- return ( (await model.provideSubtypes(item, CancellationToken.None)).map(item => {
44
- return ( new Type(item, model, element));
45
- }));
46
- }
47
- }
48
- }
49
- class Sorter {
50
- compare(element, otherElement) {
51
- return Type.compare(element, otherElement);
52
- }
53
- }
54
- class IdentityProvider {
55
- constructor(getDirection) {
56
- this.getDirection = getDirection;
57
- }
58
- getId(element) {
59
- let res = this.getDirection() + JSON.stringify(element.item.uri) + JSON.stringify(element.item.range);
60
- if (element.parent) {
61
- res += this.getId(element.parent);
62
- }
63
- return res;
64
- }
65
- }
66
- class TypeRenderingTemplate {
67
- constructor(icon, label) {
68
- this.icon = icon;
69
- this.label = label;
70
- }
71
- }
72
- class TypeRenderer {
73
- constructor() {
74
- this.templateId = TypeRenderer.id;
75
- }
76
- static { this.id = 'TypeRenderer'; }
77
- renderTemplate(container) {
78
- container.classList.add('typehierarchy-element');
79
- const icon = document.createElement('div');
80
- container.appendChild(icon);
81
- const label = ( new IconLabel(container, { supportHighlights: true }));
82
- return ( new TypeRenderingTemplate(icon, label));
83
- }
84
- renderElement(node, _index, template) {
85
- const { element, filterData } = node;
86
- const deprecated = element.item.tags?.includes(1 );
87
- template.icon.classList.add('inline', ...ThemeIcon.asClassNameArray(SymbolKinds.toIcon(element.item.kind)));
88
- template.label.setLabel(element.item.name, element.item.detail, { labelEscapeNewLines: true, matches: createMatches(filterData), strikethrough: deprecated });
89
- }
90
- disposeTemplate(template) {
91
- template.label.dispose();
92
- }
93
- }
94
- class VirtualDelegate {
95
- getHeight(_element) {
96
- return 22;
97
- }
98
- getTemplateId(_element) {
99
- return TypeRenderer.id;
100
- }
101
- }
102
- class AccessibilityProvider {
103
- constructor(getDirection) {
104
- this.getDirection = getDirection;
105
- }
106
- getWidgetAriaLabel() {
107
- return ( localizeWithPath(
108
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree',
109
- 'tree.aria',
110
- "Type Hierarchy"
111
- ));
112
- }
113
- getAriaLabel(element) {
114
- if (this.getDirection() === "supertypes" ) {
115
- return ( localizeWithPath(
116
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree',
117
- 'supertypes',
118
- "supertypes of {0}",
119
- element.item.name
120
- ));
121
- }
122
- else {
123
- return ( localizeWithPath(
124
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree',
125
- 'subtypes',
126
- "subtypes of {0}",
127
- element.item.name
128
- ));
129
- }
130
- }
131
- }
132
-
133
- export { AccessibilityProvider, DataSource, IdentityProvider, Sorter, Type, TypeRenderer, VirtualDelegate };
@@ -1,290 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { FastDomNode } from 'vscode/vscode/vs/base/browser/fastDomNode';
3
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
4
- import { Disposable, MutableDisposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
6
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
- import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService';
8
- import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED, IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
9
-
10
- let OverlayWebview = class OverlayWebview extends Disposable {
11
- constructor(initInfo, _layoutService, _webviewService, _baseContextKeyService) {
12
- super();
13
- this._layoutService = _layoutService;
14
- this._webviewService = _webviewService;
15
- this._baseContextKeyService = _baseContextKeyService;
16
- this._isFirstLoad = true;
17
- this._firstLoadPendingMessages = ( new Set());
18
- this._webview = this._register(( new MutableDisposable()));
19
- this._webviewEvents = this._register(( new DisposableStore()));
20
- this._html = '';
21
- this._initialScrollProgress = 0;
22
- this._state = undefined;
23
- this._owner = undefined;
24
- this._scopedContextKeyService = this._register(( new MutableDisposable()));
25
- this._shouldShowFindWidgetOnRestore = false;
26
- this._isDisposed = false;
27
- this._onDidDispose = this._register(( new Emitter()));
28
- this.onDidDispose = this._onDidDispose.event;
29
- this._onDidFocus = this._register(( new Emitter()));
30
- this.onDidFocus = this._onDidFocus.event;
31
- this._onDidBlur = this._register(( new Emitter()));
32
- this.onDidBlur = this._onDidBlur.event;
33
- this._onDidClickLink = this._register(( new Emitter()));
34
- this.onDidClickLink = this._onDidClickLink.event;
35
- this._onDidReload = this._register(( new Emitter()));
36
- this.onDidReload = this._onDidReload.event;
37
- this._onDidScroll = this._register(( new Emitter()));
38
- this.onDidScroll = this._onDidScroll.event;
39
- this._onDidUpdateState = this._register(( new Emitter()));
40
- this.onDidUpdateState = this._onDidUpdateState.event;
41
- this._onMessage = this._register(( new Emitter()));
42
- this.onMessage = this._onMessage.event;
43
- this._onMissingCsp = this._register(( new Emitter()));
44
- this.onMissingCsp = this._onMissingCsp.event;
45
- this._onDidWheel = this._register(( new Emitter()));
46
- this.onDidWheel = this._onDidWheel.event;
47
- this._onFatalError = this._register(( new Emitter()));
48
- this.onFatalError = this._onFatalError.event;
49
- this.providedViewType = initInfo.providedViewType;
50
- this.origin = initInfo.origin ?? generateUuid();
51
- this._title = initInfo.title;
52
- this._extension = initInfo.extension;
53
- this._options = initInfo.options;
54
- this._contentOptions = initInfo.contentOptions;
55
- }
56
- get isFocused() {
57
- return !!this._webview.value?.isFocused;
58
- }
59
- dispose() {
60
- this._isDisposed = true;
61
- this._container?.domNode.remove();
62
- this._container = undefined;
63
- for (const msg of this._firstLoadPendingMessages) {
64
- msg.resolve(false);
65
- }
66
- this._firstLoadPendingMessages.clear();
67
- this._onDidDispose.fire();
68
- super.dispose();
69
- }
70
- get container() {
71
- if (this._isDisposed) {
72
- throw new Error(`OverlayWebview has been disposed`);
73
- }
74
- if (!this._container) {
75
- const node = document.createElement('div');
76
- node.style.position = 'absolute';
77
- node.style.overflow = 'hidden';
78
- this._container = ( new FastDomNode(node));
79
- this._container.setVisibility('hidden');
80
- this._layoutService.mainContainer.appendChild(node);
81
- }
82
- return this._container.domNode;
83
- }
84
- claim(owner, scopedContextKeyService) {
85
- if (this._isDisposed) {
86
- return;
87
- }
88
- const oldOwner = this._owner;
89
- this._owner = owner;
90
- this._show();
91
- if (oldOwner !== owner) {
92
- const contextKeyService = (scopedContextKeyService || this._baseContextKeyService);
93
- this._scopedContextKeyService.clear();
94
- this._scopedContextKeyService.value = contextKeyService.createScoped(this.container);
95
- const wasFindVisible = this._findWidgetVisible?.get();
96
- this._findWidgetVisible?.reset();
97
- this._findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(contextKeyService);
98
- this._findWidgetVisible.set(!!wasFindVisible);
99
- this._findWidgetEnabled?.reset();
100
- this._findWidgetEnabled = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED.bindTo(contextKeyService);
101
- this._findWidgetEnabled.set(!!this.options.enableFindWidget);
102
- this._webview.value?.setContextKeyService(this._scopedContextKeyService.value);
103
- }
104
- }
105
- release(owner) {
106
- if (this._owner !== owner) {
107
- return;
108
- }
109
- this._scopedContextKeyService.clear();
110
- this._owner = undefined;
111
- if (this._container) {
112
- this._container.setVisibility('hidden');
113
- }
114
- if (this._options.retainContextWhenHidden) {
115
- this._shouldShowFindWidgetOnRestore = !!this._findWidgetVisible?.get();
116
- this.hideFind(false);
117
- }
118
- else {
119
- this._webview.clear();
120
- this._webviewEvents.clear();
121
- }
122
- }
123
- layoutWebviewOverElement(element, dimension, clippingContainer) {
124
- if (!this._container || !this._container.domNode.parentElement) {
125
- return;
126
- }
127
- const frameRect = element.getBoundingClientRect();
128
- const containerRect = this._container.domNode.parentElement.getBoundingClientRect();
129
- const parentBorderTop = (containerRect.height - this._container.domNode.parentElement.clientHeight) / 2.0;
130
- const parentBorderLeft = (containerRect.width - this._container.domNode.parentElement.clientWidth) / 2.0;
131
- this._container.setTop(frameRect.top - containerRect.top - parentBorderTop);
132
- this._container.setLeft(frameRect.left - containerRect.left - parentBorderLeft);
133
- this._container.setWidth(dimension ? dimension.width : frameRect.width);
134
- this._container.setHeight(dimension ? dimension.height : frameRect.height);
135
- if (clippingContainer) {
136
- const { top, left, right, bottom } = computeClippingRect(frameRect, clippingContainer);
137
- this._container.domNode.style.clipPath = `polygon(${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px)`;
138
- }
139
- }
140
- _show() {
141
- if (this._isDisposed) {
142
- throw new Error('OverlayWebview is disposed');
143
- }
144
- if (!this._webview.value) {
145
- const webview = this._webviewService.createWebviewElement({
146
- providedViewType: this.providedViewType,
147
- origin: this.origin,
148
- title: this._title,
149
- options: this._options,
150
- contentOptions: this._contentOptions,
151
- extension: this.extension,
152
- });
153
- this._webview.value = webview;
154
- webview.state = this._state;
155
- if (this._scopedContextKeyService.value) {
156
- this._webview.value.setContextKeyService(this._scopedContextKeyService.value);
157
- }
158
- if (this._html) {
159
- webview.setHtml(this._html);
160
- }
161
- if (this._options.tryRestoreScrollPosition) {
162
- webview.initialScrollProgress = this._initialScrollProgress;
163
- }
164
- this._findWidgetEnabled?.set(!!this.options.enableFindWidget);
165
- webview.mountTo(this.container);
166
- this._webviewEvents.clear();
167
- this._webviewEvents.add(webview.onDidFocus(() => { this._onDidFocus.fire(); }));
168
- this._webviewEvents.add(webview.onDidBlur(() => { this._onDidBlur.fire(); }));
169
- this._webviewEvents.add(webview.onDidClickLink(x => { this._onDidClickLink.fire(x); }));
170
- this._webviewEvents.add(webview.onMessage(x => { this._onMessage.fire(x); }));
171
- this._webviewEvents.add(webview.onMissingCsp(x => { this._onMissingCsp.fire(x); }));
172
- this._webviewEvents.add(webview.onDidWheel(x => { this._onDidWheel.fire(x); }));
173
- this._webviewEvents.add(webview.onDidReload(() => { this._onDidReload.fire(); }));
174
- this._webviewEvents.add(webview.onFatalError(x => { this._onFatalError.fire(x); }));
175
- this._webviewEvents.add(webview.onDidScroll(x => {
176
- this._initialScrollProgress = x.scrollYPercentage;
177
- this._onDidScroll.fire(x);
178
- }));
179
- this._webviewEvents.add(webview.onDidUpdateState(state => {
180
- this._state = state;
181
- this._onDidUpdateState.fire(state);
182
- }));
183
- if (this._isFirstLoad) {
184
- this._firstLoadPendingMessages.forEach(async (msg) => {
185
- msg.resolve(await webview.postMessage(msg.message, msg.transfer));
186
- });
187
- }
188
- this._isFirstLoad = false;
189
- this._firstLoadPendingMessages.clear();
190
- }
191
- if (this.options.retainContextWhenHidden && this._shouldShowFindWidgetOnRestore) {
192
- this.showFind(false);
193
- this._shouldShowFindWidgetOnRestore = false;
194
- }
195
- this._container?.setVisibility('visible');
196
- }
197
- setHtml(html) {
198
- this._html = html;
199
- this._withWebview(webview => webview.setHtml(html));
200
- }
201
- setTitle(title) {
202
- this._title = title;
203
- this._withWebview(webview => webview.setTitle(title));
204
- }
205
- get initialScrollProgress() { return this._initialScrollProgress; }
206
- set initialScrollProgress(value) {
207
- this._initialScrollProgress = value;
208
- this._withWebview(webview => webview.initialScrollProgress = value);
209
- }
210
- get state() { return this._state; }
211
- set state(value) {
212
- this._state = value;
213
- this._withWebview(webview => webview.state = value);
214
- }
215
- get extension() { return this._extension; }
216
- set extension(value) {
217
- this._extension = value;
218
- this._withWebview(webview => webview.extension = value);
219
- }
220
- get options() { return this._options; }
221
- set options(value) { this._options = { customClasses: this._options.customClasses, ...value }; }
222
- get contentOptions() { return this._contentOptions; }
223
- set contentOptions(value) {
224
- this._contentOptions = value;
225
- this._withWebview(webview => webview.contentOptions = value);
226
- }
227
- set localResourcesRoot(resources) {
228
- this._withWebview(webview => webview.localResourcesRoot = resources);
229
- }
230
- async postMessage(message, transfer) {
231
- if (this._webview.value) {
232
- return this._webview.value.postMessage(message, transfer);
233
- }
234
- if (this._isFirstLoad) {
235
- let resolve;
236
- const p = ( new Promise(r => resolve = r));
237
- this._firstLoadPendingMessages.add({ message, transfer, resolve: resolve });
238
- return p;
239
- }
240
- return false;
241
- }
242
- focus() { this._webview.value?.focus(); }
243
- reload() { this._webview.value?.reload(); }
244
- selectAll() { this._webview.value?.selectAll(); }
245
- copy() { this._webview.value?.copy(); }
246
- paste() { this._webview.value?.paste(); }
247
- cut() { this._webview.value?.cut(); }
248
- undo() { this._webview.value?.undo(); }
249
- redo() { this._webview.value?.redo(); }
250
- showFind(animated = true) {
251
- if (this._webview.value) {
252
- this._webview.value.showFind(animated);
253
- this._findWidgetVisible?.set(true);
254
- }
255
- }
256
- hideFind(animated = true) {
257
- this._findWidgetVisible?.reset();
258
- this._webview.value?.hideFind(animated);
259
- }
260
- runFindAction(previous) { this._webview.value?.runFindAction(previous); }
261
- _withWebview(f) {
262
- if (this._webview.value) {
263
- f(this._webview.value);
264
- }
265
- }
266
- windowDidDragStart() {
267
- this._webview.value?.windowDidDragStart();
268
- }
269
- windowDidDragEnd() {
270
- this._webview.value?.windowDidDragEnd();
271
- }
272
- setContextKeyService(contextKeyService) {
273
- this._webview.value?.setContextKeyService(contextKeyService);
274
- }
275
- };
276
- OverlayWebview = ( __decorate([
277
- ( __param(1, ILayoutService)),
278
- ( __param(2, IWebviewService)),
279
- ( __param(3, IContextKeyService))
280
- ], OverlayWebview));
281
- function computeClippingRect(frameRect, clipper) {
282
- const rootRect = clipper.getBoundingClientRect();
283
- const top = Math.max(rootRect.top - frameRect.top, 0);
284
- const right = Math.max(frameRect.width - (frameRect.right - rootRect.right), 0);
285
- const bottom = Math.max(frameRect.height - (frameRect.bottom - rootRect.bottom), 0);
286
- const left = Math.max(rootRect.left - frameRect.left, 0);
287
- return { top, right, bottom, left };
288
- }
289
-
290
- export { OverlayWebview };
@@ -1,96 +0,0 @@
1
- import { isUNC } from 'vscode/vscode/vs/base/common/extpath';
2
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
3
- import { normalize, sep } from 'vscode/vscode/vs/base/common/path';
4
- import { URI } from 'vscode/vscode/vs/base/common/uri';
5
- import { FileOperationError } from 'vscode/vscode/vs/platform/files/common/files';
6
- import { getWebviewContentMimeType } from '../../../../platform/webview/common/mimeTypes.js';
7
-
8
- var WebviewResourceResponse;
9
- ( (function(WebviewResourceResponse) {
10
- let Type;
11
- ( (function(Type) {
12
- Type[Type["Success"] = 0] = "Success";
13
- Type[Type["Failed"] = 1] = "Failed";
14
- Type[Type["AccessDenied"] = 2] = "AccessDenied";
15
- Type[Type["NotModified"] = 3] = "NotModified";
16
- })(Type = WebviewResourceResponse.Type || (WebviewResourceResponse.Type = {})));
17
- class StreamSuccess {
18
- constructor(stream, etag, mtime, mimeType) {
19
- this.stream = stream;
20
- this.etag = etag;
21
- this.mtime = mtime;
22
- this.mimeType = mimeType;
23
- this.type = Type.Success;
24
- }
25
- }
26
- WebviewResourceResponse.StreamSuccess = StreamSuccess;
27
- WebviewResourceResponse.Failed = { type: Type.Failed };
28
- WebviewResourceResponse.AccessDenied = { type: Type.AccessDenied };
29
- class NotModified {
30
- constructor(mimeType, mtime) {
31
- this.mimeType = mimeType;
32
- this.mtime = mtime;
33
- this.type = Type.NotModified;
34
- }
35
- }
36
- WebviewResourceResponse.NotModified = NotModified;
37
- })(WebviewResourceResponse || (WebviewResourceResponse = {})));
38
- async function loadLocalResource(requestUri, options, fileService, logService, token) {
39
- logService.debug(`loadLocalResource - begin. requestUri=${requestUri}`);
40
- const resourceToLoad = getResourceToLoad(requestUri, options.roots);
41
- logService.debug(`loadLocalResource - found resource to load. requestUri=${requestUri}, resourceToLoad=${resourceToLoad}`);
42
- if (!resourceToLoad) {
43
- return WebviewResourceResponse.AccessDenied;
44
- }
45
- const mime = getWebviewContentMimeType(requestUri);
46
- try {
47
- const result = await fileService.readFileStream(resourceToLoad, { etag: options.ifNoneMatch }, token);
48
- return new WebviewResourceResponse.StreamSuccess(result.value, result.etag, result.mtime, mime);
49
- }
50
- catch (err) {
51
- if (err instanceof FileOperationError) {
52
- const result = err.fileOperationResult;
53
- if (result === 2 ) {
54
- return new WebviewResourceResponse.NotModified(mime, err.options?.mtime);
55
- }
56
- }
57
- logService.debug(`loadLocalResource - Error using fileReader. requestUri=${requestUri}`);
58
- console.log(err);
59
- return WebviewResourceResponse.Failed;
60
- }
61
- }
62
- function getResourceToLoad(requestUri, roots) {
63
- for (const root of roots) {
64
- if (containsResource(root, requestUri)) {
65
- return normalizeResourcePath(requestUri);
66
- }
67
- }
68
- return undefined;
69
- }
70
- function containsResource(root, resource) {
71
- if (root.scheme !== resource.scheme) {
72
- return false;
73
- }
74
- let resourceFsPath = normalize(resource.fsPath);
75
- let rootPath = normalize(root.fsPath + (root.fsPath.endsWith(sep) ? '' : sep));
76
- if (isUNC(root.fsPath) && isUNC(resource.fsPath)) {
77
- rootPath = rootPath.toLowerCase();
78
- resourceFsPath = resourceFsPath.toLowerCase();
79
- }
80
- return resourceFsPath.startsWith(rootPath);
81
- }
82
- function normalizeResourcePath(resource) {
83
- if (resource.scheme === Schemas.vscodeRemote) {
84
- return ( URI.from({
85
- scheme: Schemas.vscodeRemote,
86
- authority: resource.authority,
87
- path: '/vscode-resource',
88
- query: JSON.stringify({
89
- requestResourcePath: resource.path
90
- })
91
- }));
92
- }
93
- return resource;
94
- }
95
-
96
- export { WebviewResourceResponse, loadLocalResource };
@@ -1,88 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
3
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
- import { EDITOR_FONT_DEFAULTS } from 'vscode/vscode/vs/editor/common/config/editorOptions';
5
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
6
- import { getColorRegistry } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
7
- import { ColorScheme } from 'vscode/vscode/vs/platform/theme/common/theme';
8
- import { IWorkbenchThemeService } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
9
- import { DEFAULT_FONT_FAMILY } from 'vscode/vscode/vs/workbench/browser/style';
10
-
11
- let WebviewThemeDataProvider = class WebviewThemeDataProvider extends Disposable {
12
- constructor(_themeService, _configurationService) {
13
- super();
14
- this._themeService = _themeService;
15
- this._configurationService = _configurationService;
16
- this._cachedWebViewThemeData = undefined;
17
- this._onThemeDataChanged = this._register(( new Emitter()));
18
- this.onThemeDataChanged = this._onThemeDataChanged.event;
19
- this._register(this._themeService.onDidColorThemeChange(() => {
20
- this._reset();
21
- }));
22
- const webviewConfigurationKeys = ['editor.fontFamily', 'editor.fontWeight', 'editor.fontSize'];
23
- this._register(this._configurationService.onDidChangeConfiguration(e => {
24
- if (( webviewConfigurationKeys.some(key => e.affectsConfiguration(key)))) {
25
- this._reset();
26
- }
27
- }));
28
- }
29
- getTheme() {
30
- return this._themeService.getColorTheme();
31
- }
32
- getWebviewThemeData() {
33
- if (!this._cachedWebViewThemeData) {
34
- const configuration = this._configurationService.getValue('editor');
35
- const editorFontFamily = configuration.fontFamily || EDITOR_FONT_DEFAULTS.fontFamily;
36
- const editorFontWeight = configuration.fontWeight || EDITOR_FONT_DEFAULTS.fontWeight;
37
- const editorFontSize = configuration.fontSize || EDITOR_FONT_DEFAULTS.fontSize;
38
- const theme = this._themeService.getColorTheme();
39
- const exportedColors = getColorRegistry().getColors().reduce((colors, entry) => {
40
- const color = theme.getColor(entry.id);
41
- if (color) {
42
- colors['vscode-' + entry.id.replace('.', '-')] = ( color.toString());
43
- }
44
- return colors;
45
- }, {});
46
- const styles = {
47
- 'vscode-font-family': DEFAULT_FONT_FAMILY,
48
- 'vscode-font-weight': 'normal',
49
- 'vscode-font-size': '13px',
50
- 'vscode-editor-font-family': editorFontFamily,
51
- 'vscode-editor-font-weight': editorFontWeight,
52
- 'vscode-editor-font-size': editorFontSize + 'px',
53
- ...exportedColors
54
- };
55
- const activeTheme = ApiThemeClassName.fromTheme(theme);
56
- this._cachedWebViewThemeData = { styles, activeTheme, themeLabel: theme.label, themeId: theme.settingsId };
57
- }
58
- return this._cachedWebViewThemeData;
59
- }
60
- _reset() {
61
- this._cachedWebViewThemeData = undefined;
62
- this._onThemeDataChanged.fire();
63
- }
64
- };
65
- WebviewThemeDataProvider = ( __decorate([
66
- ( __param(0, IWorkbenchThemeService)),
67
- ( __param(1, IConfigurationService))
68
- ], WebviewThemeDataProvider));
69
- var ApiThemeClassName;
70
- ( (function(ApiThemeClassName) {
71
- ApiThemeClassName["light"] = "vscode-light";
72
- ApiThemeClassName["dark"] = "vscode-dark";
73
- ApiThemeClassName["highContrast"] = "vscode-high-contrast";
74
- ApiThemeClassName["highContrastLight"] = "vscode-high-contrast-light";
75
- })(ApiThemeClassName || (ApiThemeClassName = {})));
76
- ( (function(ApiThemeClassName) {
77
- function fromTheme(theme) {
78
- switch (theme.type) {
79
- case ColorScheme.LIGHT: return ApiThemeClassName.light;
80
- case ColorScheme.DARK: return ApiThemeClassName.dark;
81
- case ColorScheme.HIGH_CONTRAST_DARK: return ApiThemeClassName.highContrast;
82
- case ColorScheme.HIGH_CONTRAST_LIGHT: return ApiThemeClassName.highContrastLight;
83
- }
84
- }
85
- ApiThemeClassName.fromTheme = fromTheme;
86
- })(ApiThemeClassName || (ApiThemeClassName = {})));
87
-
88
- export { WebviewThemeDataProvider };
@@ -1,79 +0,0 @@
1
- import { getActiveElement } from 'vscode/vscode/vs/base/browser/dom';
2
- import { UndoCommand, RedoCommand, SelectAllCommand } from 'vscode/vscode/vs/editor/browser/editorExtensions';
3
- import { CutAction, CopyAction, PasteAction } from 'vscode/vscode/vs/editor/contrib/clipboard/browser/clipboard';
4
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
5
- import { MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
6
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
- import { IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
8
- import { WebviewInput } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
9
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
10
-
11
- const PRIORITY = 100;
12
- function overrideCommandForWebview(command, f) {
13
- command?.addImplementation(PRIORITY, 'webview', accessor => {
14
- const webviewService = accessor.get(IWebviewService);
15
- const webview = webviewService.activeWebview;
16
- if (webview?.isFocused) {
17
- f(webview);
18
- return true;
19
- }
20
- if (getActiveElement()?.classList.contains('action-menu-item')) {
21
- const editorService = accessor.get(IEditorService);
22
- if (editorService.activeEditor instanceof WebviewInput) {
23
- f(editorService.activeEditor.webview);
24
- return true;
25
- }
26
- }
27
- return false;
28
- });
29
- }
30
- overrideCommandForWebview(UndoCommand, webview => webview.undo());
31
- overrideCommandForWebview(RedoCommand, webview => webview.redo());
32
- overrideCommandForWebview(SelectAllCommand, webview => webview.selectAll());
33
- overrideCommandForWebview(CopyAction, webview => webview.copy());
34
- overrideCommandForWebview(PasteAction, webview => webview.paste());
35
- overrideCommandForWebview(CutAction, webview => webview.cut());
36
- const PreventDefaultContextMenuItemsContextKeyName = 'preventDefaultContextMenuItems';
37
- if (CutAction) {
38
- MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
39
- command: {
40
- id: CutAction.id,
41
- title: ( localizeWithPath('vs/workbench/contrib/webview/browser/webview.contribution', 'cut', "Cut")),
42
- },
43
- group: '5_cutcopypaste',
44
- order: 1,
45
- when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
46
- });
47
- }
48
- if (CopyAction) {
49
- MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
50
- command: {
51
- id: CopyAction.id,
52
- title: ( localizeWithPath(
53
- 'vs/workbench/contrib/webview/browser/webview.contribution',
54
- 'copy',
55
- "Copy"
56
- )),
57
- },
58
- group: '5_cutcopypaste',
59
- order: 2,
60
- when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
61
- });
62
- }
63
- if (PasteAction) {
64
- MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
65
- command: {
66
- id: PasteAction.id,
67
- title: ( localizeWithPath(
68
- 'vs/workbench/contrib/webview/browser/webview.contribution',
69
- 'paste',
70
- "Paste"
71
- )),
72
- },
73
- group: '5_cutcopypaste',
74
- order: 3,
75
- when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
76
- });
77
- }
78
-
79
- export { PreventDefaultContextMenuItemsContextKeyName };