@codingame/monaco-vscode-api 1.76.0 → 1.76.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/api.js +1 -8
- package/dist/assets/break-6b46c048-6b46c048.mp3 +0 -0
- package/dist/assets/break-6b46c048.mp3 +0 -0
- package/dist/assets/diffLineDeleted-26945eb8-26945eb8.mp3 +0 -0
- package/dist/assets/diffLineDeleted-26945eb8.mp3 +0 -0
- package/dist/assets/diffLineInserted-8f202889-8f202889.mp3 +0 -0
- package/dist/assets/diffLineInserted-8f202889.mp3 +0 -0
- package/dist/assets/diffLineModified-fb126694-fb126694.mp3 +0 -0
- package/dist/assets/diffLineModified-fb126694.mp3 +0 -0
- package/dist/assets/error-b93c2a76-b93c2a76.mp3 +0 -0
- package/dist/assets/error-b93c2a76.mp3 +0 -0
- package/dist/assets/foldedAreas-a6b54171-a6b54171.mp3 +0 -0
- package/dist/assets/foldedAreas-a6b54171.mp3 +0 -0
- package/dist/assets/quickFixes-dc7d1e73-dc7d1e73.mp3 +0 -0
- package/dist/assets/quickFixes-dc7d1e73.mp3 +0 -0
- package/dist/assets/taskCompleted-f0dd8e18-f0dd8e18.mp3 +0 -0
- package/dist/assets/taskCompleted-f0dd8e18.mp3 +0 -0
- package/dist/assets/taskFailed-5494702a-5494702a.mp3 +0 -0
- package/dist/assets/taskFailed-5494702a.mp3 +0 -0
- package/dist/assets/terminalBell-ff9df1e1-ff9df1e1.mp3 +0 -0
- package/dist/assets/terminalBell-ff9df1e1.mp3 +0 -0
- package/dist/assets/warning-2687e2e7-2687e2e7.mp3 +0 -0
- package/dist/assets/warning-2687e2e7.mp3 +0 -0
- package/dist/audioCue.d.ts +22 -0
- package/dist/audioCue.js +1147 -0
- package/dist/button.js +325 -0
- package/dist/dialog.web.contribution.js +945 -0
- package/dist/dialogs.js +7 -960
- package/dist/extHost.js +1 -1
- package/dist/files.js +2 -1
- package/dist/layout.js +4 -325
- package/dist/missing-services.js +65 -1
- package/dist/modelEditor.js +21 -3
- package/dist/notifications.js +2 -1
- package/dist/polyfill.js +186 -2
- package/dist/services.d.ts +56 -1
- package/dist/services.js +1 -0
- package/dist/snippets.js +1 -1
- package/dist/textmate.d.ts +1 -1
- package/dist/textmate.js +5 -18
- package/dist/workbenchThemeService.js +1 -1
- package/dist/workspaceContext.js +2 -0
- package/package.json +10 -1
package/dist/button.js
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { E as Emitter } from './contextkey.js';
|
|
2
|
+
import { n } from './polyfill.js';
|
|
3
|
+
import { addDisposableListener, EventType, EventHelper, trackFocus, reset } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
4
|
+
import { renderLabelWithIcons } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js';
|
|
5
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
+
import { Gesture, EventType as EventType$1 } from 'monaco-editor/esm/vs/base/browser/touch.js';
|
|
7
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
8
|
+
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
9
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
10
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
11
|
+
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
12
|
+
var css = ".monaco-text-button{align-items:center;border:1px solid var(--vscode-button-border,transparent);border-radius:2px;box-sizing:border-box;cursor:pointer;display:flex;justify-content:center;line-height:18px;padding:4px;text-align:center;width:100%}.monaco-text-button:focus{outline-offset:2px!important}.monaco-text-button:hover{text-decoration:none!important}.monaco-button.disabled,.monaco-button.disabled:focus{cursor:default;opacity:.4!important}.monaco-text-button .codicon{color:inherit!important;margin:0 .2em}.monaco-text-button.monaco-text-button-with-short-label{flex-direction:row;flex-wrap:wrap;height:28px;overflow:hidden;padding:0 4px}.monaco-text-button.monaco-text-button-with-short-label>.monaco-button-label{flex-basis:100%}.monaco-text-button.monaco-text-button-with-short-label>.monaco-button-label-short{flex-grow:1;overflow:hidden;width:0}.monaco-text-button.monaco-text-button-with-short-label>.monaco-button-label,.monaco-text-button.monaco-text-button-with-short-label>.monaco-button-label-short{align-items:center;display:flex;font-style:inherit;font-weight:400;justify-content:center;padding:4px 0}.monaco-button-dropdown{cursor:pointer;display:flex}.monaco-button-dropdown.disabled{cursor:default}.monaco-button-dropdown>.monaco-button:focus{outline-offset:-1px!important}.monaco-button-dropdown.disabled>.monaco-button-dropdown-separator,.monaco-button-dropdown.disabled>.monaco-button.disabled,.monaco-button-dropdown.disabled>.monaco-button.disabled:focus{opacity:.4!important}.monaco-button-dropdown>.monaco-button.monaco-text-button{border-right-width:0!important}.monaco-button-dropdown .monaco-button-dropdown-separator{cursor:default;padding:4px 0}.monaco-button-dropdown .monaco-button-dropdown-separator>div{height:100%;width:1px}.monaco-button-dropdown>.monaco-button.monaco-dropdown-button{border:1px solid var(--vscode-button-border,transparent);border-left-width:0!important;border-radius:0 2px 2px 0}.monaco-button-dropdown>.monaco-button.monaco-text-button{border-radius:2px 0 0 2px}.monaco-description-button{align-items:center;display:flex;flex-direction:column;margin:4px 5px}.monaco-description-button .monaco-button-description{font-size:11px;font-style:italic;padding:4px 20px}.monaco-description-button .monaco-button-description,.monaco-description-button .monaco-button-label{align-items:center;display:flex;justify-content:center}.monaco-description-button .monaco-button-description>.codicon,.monaco-description-button .monaco-button-label>.codicon{color:inherit!important;margin:0 .2em}";
|
|
13
|
+
n(css,{});
|
|
14
|
+
class Button extends Disposable {
|
|
15
|
+
get onDidClick() { return this._onDidClick.event; }
|
|
16
|
+
constructor(container, options) {
|
|
17
|
+
super();
|
|
18
|
+
this._onDidClick = this._register(( new Emitter()));
|
|
19
|
+
this.options = options;
|
|
20
|
+
this._element = document.createElement('a');
|
|
21
|
+
this._element.classList.add('monaco-button');
|
|
22
|
+
this._element.tabIndex = 0;
|
|
23
|
+
this._element.setAttribute('role', 'button');
|
|
24
|
+
const background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;
|
|
25
|
+
const foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground;
|
|
26
|
+
this._element.style.color = foreground || '';
|
|
27
|
+
this._element.style.backgroundColor = background || '';
|
|
28
|
+
if (options.supportShortLabel) {
|
|
29
|
+
this._labelShortElement = document.createElement('div');
|
|
30
|
+
this._labelShortElement.classList.add('monaco-button-label-short');
|
|
31
|
+
this._element.appendChild(this._labelShortElement);
|
|
32
|
+
this._labelElement = document.createElement('div');
|
|
33
|
+
this._labelElement.classList.add('monaco-button-label');
|
|
34
|
+
this._element.appendChild(this._labelElement);
|
|
35
|
+
this._element.classList.add('monaco-text-button-with-short-label');
|
|
36
|
+
}
|
|
37
|
+
container.appendChild(this._element);
|
|
38
|
+
this._register(Gesture.addTarget(this._element));
|
|
39
|
+
[EventType.CLICK, EventType$1.Tap].forEach(eventType => {
|
|
40
|
+
this._register(addDisposableListener(this._element, eventType, e => {
|
|
41
|
+
if (!this.enabled) {
|
|
42
|
+
EventHelper.stop(e);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this._onDidClick.fire(e);
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
this._register(addDisposableListener(this._element, EventType.KEY_DOWN, e => {
|
|
49
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
50
|
+
let eventHandled = false;
|
|
51
|
+
if (this.enabled && (event.equals(3 ) || event.equals(10 ))) {
|
|
52
|
+
this._onDidClick.fire(e);
|
|
53
|
+
eventHandled = true;
|
|
54
|
+
}
|
|
55
|
+
else if (event.equals(9 )) {
|
|
56
|
+
this._element.blur();
|
|
57
|
+
eventHandled = true;
|
|
58
|
+
}
|
|
59
|
+
if (eventHandled) {
|
|
60
|
+
EventHelper.stop(event, true);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
this._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {
|
|
64
|
+
if (!this._element.classList.contains('disabled')) {
|
|
65
|
+
this.updateBackground(true);
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
68
|
+
this._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {
|
|
69
|
+
this.updateBackground(false);
|
|
70
|
+
}));
|
|
71
|
+
this.focusTracker = this._register(trackFocus(this._element));
|
|
72
|
+
this._register(this.focusTracker.onDidFocus(() => { if (this.enabled) {
|
|
73
|
+
this.updateBackground(true);
|
|
74
|
+
} }));
|
|
75
|
+
this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) {
|
|
76
|
+
this.updateBackground(false);
|
|
77
|
+
} }));
|
|
78
|
+
}
|
|
79
|
+
getContentElements(content) {
|
|
80
|
+
const elements = [];
|
|
81
|
+
for (let segment of renderLabelWithIcons(content)) {
|
|
82
|
+
if (typeof (segment) === 'string') {
|
|
83
|
+
segment = segment.trim();
|
|
84
|
+
if (segment === '') {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const node = document.createElement('span');
|
|
88
|
+
node.textContent = segment;
|
|
89
|
+
elements.push(node);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
elements.push(segment);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return elements;
|
|
96
|
+
}
|
|
97
|
+
updateBackground(hover) {
|
|
98
|
+
let background;
|
|
99
|
+
if (this.options.secondary) {
|
|
100
|
+
background = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
background = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;
|
|
104
|
+
}
|
|
105
|
+
if (background) {
|
|
106
|
+
this._element.style.backgroundColor = background;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
get element() {
|
|
110
|
+
return this._element;
|
|
111
|
+
}
|
|
112
|
+
set label(value) {
|
|
113
|
+
this._element.classList.add('monaco-text-button');
|
|
114
|
+
const labelElement = this.options.supportShortLabel ? this._labelElement : this._element;
|
|
115
|
+
if (this.options.supportIcons) {
|
|
116
|
+
reset(labelElement, ...this.getContentElements(value));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
labelElement.textContent = value;
|
|
120
|
+
}
|
|
121
|
+
if (typeof this.options.title === 'string') {
|
|
122
|
+
this._element.title = this.options.title;
|
|
123
|
+
}
|
|
124
|
+
else if (this.options.title) {
|
|
125
|
+
this._element.title = value;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
set labelShort(value) {
|
|
129
|
+
if (!this.options.supportShortLabel || !this._labelShortElement) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (this.options.supportIcons) {
|
|
133
|
+
reset(this._labelShortElement, ...this.getContentElements(value));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
this._labelShortElement.textContent = value;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
set icon(icon) {
|
|
140
|
+
this._element.classList.add(...ThemeIcon.asClassNameArray(icon));
|
|
141
|
+
}
|
|
142
|
+
set enabled(value) {
|
|
143
|
+
if (value) {
|
|
144
|
+
this._element.classList.remove('disabled');
|
|
145
|
+
this._element.setAttribute('aria-disabled', String(false));
|
|
146
|
+
this._element.tabIndex = 0;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this._element.classList.add('disabled');
|
|
150
|
+
this._element.setAttribute('aria-disabled', String(true));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
get enabled() {
|
|
154
|
+
return !this._element.classList.contains('disabled');
|
|
155
|
+
}
|
|
156
|
+
focus() {
|
|
157
|
+
this._element.focus();
|
|
158
|
+
}
|
|
159
|
+
hasFocus() {
|
|
160
|
+
return this._element === document.activeElement;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
class ButtonWithDropdown extends Disposable {
|
|
164
|
+
constructor(container, options) {
|
|
165
|
+
super();
|
|
166
|
+
this._onDidClick = this._register(( new Emitter()));
|
|
167
|
+
this.onDidClick = this._onDidClick.event;
|
|
168
|
+
this.element = document.createElement('div');
|
|
169
|
+
this.element.classList.add('monaco-button-dropdown');
|
|
170
|
+
container.appendChild(this.element);
|
|
171
|
+
this.button = this._register(( new Button(this.element, options)));
|
|
172
|
+
this._register(this.button.onDidClick(e => this._onDidClick.fire(e)));
|
|
173
|
+
this.action = this._register(( new Action(
|
|
174
|
+
'primaryAction',
|
|
175
|
+
this.button.label,
|
|
176
|
+
undefined,
|
|
177
|
+
true,
|
|
178
|
+
async () => this._onDidClick.fire(undefined)
|
|
179
|
+
)));
|
|
180
|
+
this.separatorContainer = document.createElement('div');
|
|
181
|
+
this.separatorContainer.classList.add('monaco-button-dropdown-separator');
|
|
182
|
+
this.separator = document.createElement('div');
|
|
183
|
+
this.separatorContainer.appendChild(this.separator);
|
|
184
|
+
this.element.appendChild(this.separatorContainer);
|
|
185
|
+
const border = options.buttonBorder;
|
|
186
|
+
if (border) {
|
|
187
|
+
this.separatorContainer.style.borderTop = '1px solid ' + border;
|
|
188
|
+
this.separatorContainer.style.borderBottom = '1px solid ' + border;
|
|
189
|
+
}
|
|
190
|
+
const buttonBackground = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;
|
|
191
|
+
this.separatorContainer.style.backgroundColor = buttonBackground ?? '';
|
|
192
|
+
this.separator.style.backgroundColor = options.buttonSeparator ?? '';
|
|
193
|
+
this.dropdownButton = this._register(( new Button(this.element, { ...options, title: false, supportIcons: true })));
|
|
194
|
+
this.dropdownButton.element.title = ( localize("button dropdown more actions", 'More Actions...'));
|
|
195
|
+
this.dropdownButton.element.setAttribute('aria-haspopup', 'true');
|
|
196
|
+
this.dropdownButton.element.setAttribute('aria-expanded', 'false');
|
|
197
|
+
this.dropdownButton.element.classList.add('monaco-dropdown-button');
|
|
198
|
+
this.dropdownButton.icon = Codicon.dropDownButton;
|
|
199
|
+
this._register(this.dropdownButton.onDidClick(e => {
|
|
200
|
+
options.contextMenuProvider.showContextMenu({
|
|
201
|
+
getAnchor: () => this.dropdownButton.element,
|
|
202
|
+
getActions: () => options.addPrimaryActionToDropdown === false ? [...options.actions] : [this.action, ...options.actions],
|
|
203
|
+
actionRunner: options.actionRunner,
|
|
204
|
+
onHide: () => this.dropdownButton.element.setAttribute('aria-expanded', 'false')
|
|
205
|
+
});
|
|
206
|
+
this.dropdownButton.element.setAttribute('aria-expanded', 'true');
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
set label(value) {
|
|
210
|
+
this.button.label = value;
|
|
211
|
+
this.action.label = value;
|
|
212
|
+
}
|
|
213
|
+
set icon(icon) {
|
|
214
|
+
this.button.icon = icon;
|
|
215
|
+
}
|
|
216
|
+
set enabled(enabled) {
|
|
217
|
+
this.button.enabled = enabled;
|
|
218
|
+
this.dropdownButton.enabled = enabled;
|
|
219
|
+
this.element.classList.toggle('disabled', !enabled);
|
|
220
|
+
}
|
|
221
|
+
get enabled() {
|
|
222
|
+
return this.button.enabled;
|
|
223
|
+
}
|
|
224
|
+
focus() {
|
|
225
|
+
this.button.focus();
|
|
226
|
+
}
|
|
227
|
+
hasFocus() {
|
|
228
|
+
return this.button.hasFocus() || this.dropdownButton.hasFocus();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
class ButtonWithDescription {
|
|
232
|
+
constructor(container, options) {
|
|
233
|
+
this.options = options;
|
|
234
|
+
this._element = document.createElement('div');
|
|
235
|
+
this._element.classList.add('monaco-description-button');
|
|
236
|
+
this._button = ( new Button(this._element, options));
|
|
237
|
+
this._descriptionElement = document.createElement('div');
|
|
238
|
+
this._descriptionElement.classList.add('monaco-button-description');
|
|
239
|
+
this._element.appendChild(this._descriptionElement);
|
|
240
|
+
container.appendChild(this._element);
|
|
241
|
+
}
|
|
242
|
+
get onDidClick() {
|
|
243
|
+
return this._button.onDidClick;
|
|
244
|
+
}
|
|
245
|
+
get element() {
|
|
246
|
+
return this._element;
|
|
247
|
+
}
|
|
248
|
+
set label(value) {
|
|
249
|
+
this._button.label = value;
|
|
250
|
+
}
|
|
251
|
+
set icon(icon) {
|
|
252
|
+
this._button.icon = icon;
|
|
253
|
+
}
|
|
254
|
+
get enabled() {
|
|
255
|
+
return this._button.enabled;
|
|
256
|
+
}
|
|
257
|
+
set enabled(enabled) {
|
|
258
|
+
this._button.enabled = enabled;
|
|
259
|
+
}
|
|
260
|
+
focus() {
|
|
261
|
+
this._button.focus();
|
|
262
|
+
}
|
|
263
|
+
hasFocus() {
|
|
264
|
+
return this._button.hasFocus();
|
|
265
|
+
}
|
|
266
|
+
dispose() {
|
|
267
|
+
this._button.dispose();
|
|
268
|
+
}
|
|
269
|
+
set description(value) {
|
|
270
|
+
if (this.options.supportIcons) {
|
|
271
|
+
reset(this._descriptionElement, ...renderLabelWithIcons(value));
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
this._descriptionElement.textContent = value;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
class ButtonBar extends Disposable {
|
|
279
|
+
constructor(container) {
|
|
280
|
+
super();
|
|
281
|
+
this.container = container;
|
|
282
|
+
this._buttons = [];
|
|
283
|
+
}
|
|
284
|
+
get buttons() {
|
|
285
|
+
return this._buttons;
|
|
286
|
+
}
|
|
287
|
+
addButton(options) {
|
|
288
|
+
const button = this._register(( new Button(this.container, options)));
|
|
289
|
+
this.pushButton(button);
|
|
290
|
+
return button;
|
|
291
|
+
}
|
|
292
|
+
addButtonWithDescription(options) {
|
|
293
|
+
const button = this._register(( new ButtonWithDescription(this.container, options)));
|
|
294
|
+
this.pushButton(button);
|
|
295
|
+
return button;
|
|
296
|
+
}
|
|
297
|
+
addButtonWithDropdown(options) {
|
|
298
|
+
const button = this._register(( new ButtonWithDropdown(this.container, options)));
|
|
299
|
+
this.pushButton(button);
|
|
300
|
+
return button;
|
|
301
|
+
}
|
|
302
|
+
pushButton(button) {
|
|
303
|
+
this._buttons.push(button);
|
|
304
|
+
const index = this._buttons.length - 1;
|
|
305
|
+
this._register(addDisposableListener(button.element, EventType.KEY_DOWN, e => {
|
|
306
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
307
|
+
let eventHandled = true;
|
|
308
|
+
let buttonIndexToFocus;
|
|
309
|
+
if (event.equals(15 )) {
|
|
310
|
+
buttonIndexToFocus = index > 0 ? index - 1 : this._buttons.length - 1;
|
|
311
|
+
}
|
|
312
|
+
else if (event.equals(17 )) {
|
|
313
|
+
buttonIndexToFocus = index === this._buttons.length - 1 ? 0 : index + 1;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
eventHandled = false;
|
|
317
|
+
}
|
|
318
|
+
if (eventHandled && typeof buttonIndexToFocus === 'number') {
|
|
319
|
+
this._buttons[buttonIndexToFocus].focus();
|
|
320
|
+
EventHelper.stop(e, true);
|
|
321
|
+
}
|
|
322
|
+
}));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
export { ButtonBar as B, ButtonWithDescription as a };
|