@codingame/monaco-vscode-api 1.69.24 → 1.76.0-next.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 +1 -3
- package/dist/_.contribution.js +3 -3
- package/dist/api.js +63 -31
- package/dist/async.js +9 -9
- package/dist/configuration.d.ts +109 -21
- package/dist/configuration.js +47 -217
- package/dist/{workspace.js → contextkey.js} +26 -47
- package/dist/dialogs.js +498 -426
- package/dist/extHost.js +1884 -908
- package/dist/files.js +65 -63
- package/dist/keybindings.d.ts +24 -18
- package/dist/keybindings.js +475 -404
- package/dist/languageConfiguration.js +5 -5
- package/dist/languageService.js +11 -3
- package/dist/languages.d.ts +24 -7
- package/dist/languages.js +1 -1
- package/dist/layout.js +104 -166
- package/dist/missing-services.js +230 -77
- package/dist/modelEditor.d.ts +1 -5
- package/dist/modelEditor.js +32 -17
- package/dist/monaco.d.ts +303 -713
- package/dist/monaco.js +2 -2
- package/dist/notifications.js +95 -235
- package/dist/polyfill.js +1901 -1630
- package/dist/services.d.ts +8908 -8467
- package/dist/services.js +1 -1
- package/dist/services2.js +293 -113
- package/dist/snippets.d.ts +24 -7
- package/dist/snippets.js +11 -9
- package/dist/textmate.d.ts +114 -20
- package/dist/textmate.js +825 -453
- package/dist/theme.js +13 -14
- package/dist/tokenClassification.d.ts +24 -7
- package/dist/tokenClassification.js +1 -1
- package/dist/tokenClassificationRegistry.js +1 -1
- package/dist/tools.js +104 -28
- package/package.json +9 -16
- package/dist/messages.d.ts +0 -10
- package/dist/messages.js +0 -11
- package/dist/types.js +0 -46
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { _ as __decorate, a as __param } from './
|
|
1
|
+
import { p as parse, g as getNodeType } from './polyfill.js';
|
|
2
|
+
import { f as ITextMateTokenizationService, c as IExtensionService } from './missing-services.js';
|
|
3
|
+
import { _ as __decorate, a as __param } from './contextkey.js';
|
|
4
4
|
import { g as getParseErrorMessage } from './jsonErrorMessages.js';
|
|
5
5
|
import { r as registerExtensionFile, g as getServiceOverride$1, I as IExtensionResourceLoaderService } from './files.js';
|
|
6
6
|
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
@@ -14,7 +14,7 @@ import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jso
|
|
|
14
14
|
import { IndentAction } from 'monaco-editor/esm/vs/editor/common/languages/languageConfiguration.js';
|
|
15
15
|
import { o as onServicesInitialized } from './tools.js';
|
|
16
16
|
import { S as Services } from './services2.js';
|
|
17
|
-
import {
|
|
17
|
+
import { bj as DEFAULT_EXTENSION } from './extHost.js';
|
|
18
18
|
import { joinPath } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
19
19
|
function isStringArr(something) {
|
|
20
20
|
if (!Array.isArray(something)) {
|
|
@@ -408,7 +408,7 @@ let LanguageConfigurationFileHandler = class LanguageConfigurationFileHandler ex
|
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
410
|
LanguageConfigurationFileHandler = ( __decorate([
|
|
411
|
-
( __param(0,
|
|
411
|
+
( __param(0, ITextMateTokenizationService)),
|
|
412
412
|
( __param(1, ILanguageService)),
|
|
413
413
|
( __param(2, IExtensionResourceLoaderService)),
|
|
414
414
|
( __param(3, IExtensionService)),
|
package/dist/languageService.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as __decorate, a as __param } from './
|
|
2
|
-
import {
|
|
1
|
+
import { _ as __decorate, a as __param } from './contextkey.js';
|
|
2
|
+
import { c as IExtensionService } from './missing-services.js';
|
|
3
3
|
import { E as ExtensionsRegistry } from './tools.js';
|
|
4
4
|
import { O as FILES_ASSOCIATIONS_CONFIG } from './services2.js';
|
|
5
5
|
import { parse } from 'monaco-editor/esm/vs/base/common/glob.js';
|
|
@@ -168,6 +168,13 @@ const languagesExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
},
|
|
172
|
+
activationEventsGenerator: (languageContributions, result) => {
|
|
173
|
+
for (const languageContribution of languageContributions) {
|
|
174
|
+
if (languageContribution.id) {
|
|
175
|
+
result.push(`onLanguage:${languageContribution.id}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
171
178
|
}
|
|
172
179
|
}));
|
|
173
180
|
let WorkbenchLanguageService = class WorkbenchLanguageService extends LanguageService {
|
|
@@ -225,6 +232,7 @@ let WorkbenchLanguageService = class WorkbenchLanguageService extends LanguageSe
|
|
|
225
232
|
});
|
|
226
233
|
this.onDidEncounterLanguage((languageId) => {
|
|
227
234
|
this._extensionService.activateByEvent(`onLanguage:${languageId}`);
|
|
235
|
+
this._extensionService.activateByEvent(`onLanguage`);
|
|
228
236
|
});
|
|
229
237
|
}
|
|
230
238
|
updateMime() {
|
|
@@ -234,7 +242,7 @@ let WorkbenchLanguageService = class WorkbenchLanguageService extends LanguageSe
|
|
|
234
242
|
( Object.keys(configuration.files.associations)).forEach(pattern => {
|
|
235
243
|
const langId = configuration.files.associations[pattern];
|
|
236
244
|
if (typeof langId !== 'string') {
|
|
237
|
-
this.logService.warn(`
|
|
245
|
+
this.logService.warn(`Ignoring configured 'files.associations' for '${pattern}' because its type is not a string but '${typeof langId}'`);
|
|
238
246
|
return;
|
|
239
247
|
}
|
|
240
248
|
const mimeType = this.getMimeType(langId) || `text/x-${langId}`;
|
package/dist/languages.d.ts
CHANGED
|
@@ -150,17 +150,28 @@ interface UriComponents {
|
|
|
150
150
|
fragment: string;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
interface ILocalizedString {
|
|
154
|
+
/**
|
|
155
|
+
* The localized value of the string.
|
|
156
|
+
*/
|
|
157
|
+
value: string;
|
|
158
|
+
/**
|
|
159
|
+
* The original (non localized value of the string)
|
|
160
|
+
*/
|
|
161
|
+
original: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
153
164
|
/**
|
|
154
165
|
* Type of extension.
|
|
155
166
|
*
|
|
156
167
|
* **NOTE**: This is defined in `platform/environment` because it can appear as a CLI argument.
|
|
157
168
|
*/
|
|
158
|
-
|
|
169
|
+
type ExtensionKind = 'ui' | 'workspace' | 'web';
|
|
159
170
|
|
|
160
171
|
interface ICommand {
|
|
161
172
|
command: string;
|
|
162
|
-
title: string;
|
|
163
|
-
category?: string;
|
|
173
|
+
title: string | ILocalizedString;
|
|
174
|
+
category?: string | ILocalizedString;
|
|
164
175
|
}
|
|
165
176
|
interface IConfigurationProperty {
|
|
166
177
|
description: string;
|
|
@@ -282,6 +293,7 @@ interface IWalkthroughStep {
|
|
|
282
293
|
interface IWalkthrough {
|
|
283
294
|
readonly id: string;
|
|
284
295
|
readonly title: string;
|
|
296
|
+
readonly icon?: string;
|
|
285
297
|
readonly description: string;
|
|
286
298
|
readonly steps: IWalkthroughStep[];
|
|
287
299
|
readonly featuredFor: string[] | undefined;
|
|
@@ -351,8 +363,8 @@ interface IExtensionCapabilities {
|
|
|
351
363
|
readonly virtualWorkspaces?: ExtensionVirtualWorkspaceSupport;
|
|
352
364
|
readonly untrustedWorkspaces?: ExtensionUntrustedWorkspaceSupport;
|
|
353
365
|
}
|
|
354
|
-
|
|
355
|
-
|
|
366
|
+
type LimitedWorkspaceSupportType = 'limited';
|
|
367
|
+
type ExtensionUntrustedWorkspaceSupport = {
|
|
356
368
|
supported: true;
|
|
357
369
|
} | {
|
|
358
370
|
supported: false;
|
|
@@ -362,7 +374,7 @@ declare type ExtensionUntrustedWorkspaceSupport = {
|
|
|
362
374
|
description: string;
|
|
363
375
|
restrictedConfigurations?: string[];
|
|
364
376
|
};
|
|
365
|
-
|
|
377
|
+
type ExtensionVirtualWorkspaceSupport = boolean | {
|
|
366
378
|
supported: true;
|
|
367
379
|
} | {
|
|
368
380
|
supported: false | LimitedWorkspaceSupportType;
|
|
@@ -379,6 +391,8 @@ interface IRelaxedExtensionManifest {
|
|
|
379
391
|
description?: string;
|
|
380
392
|
main?: string;
|
|
381
393
|
browser?: string;
|
|
394
|
+
preview?: boolean;
|
|
395
|
+
l10n?: string;
|
|
382
396
|
icon?: string;
|
|
383
397
|
categories?: string[];
|
|
384
398
|
keywords?: string[];
|
|
@@ -451,8 +465,11 @@ interface IRelaxedExtensionDescription extends IRelaxedExtensionManifest {
|
|
|
451
465
|
isUserBuiltin: boolean;
|
|
452
466
|
isUnderDevelopment: boolean;
|
|
453
467
|
extensionLocation: URI;
|
|
468
|
+
browserNlsBundleUris?: {
|
|
469
|
+
[language: string]: URI;
|
|
470
|
+
};
|
|
454
471
|
}
|
|
455
|
-
|
|
472
|
+
type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
|
|
456
473
|
|
|
457
474
|
type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
|
|
458
475
|
|
package/dist/languages.js
CHANGED
|
@@ -2,7 +2,7 @@ import './polyfill.js';
|
|
|
2
2
|
import './missing-services.js';
|
|
3
3
|
import { g as getExtensionPoint, a as ExtensionMessageCollector, c as consoleExtensionMessageHandler } from './tools.js';
|
|
4
4
|
import { W as WorkbenchLanguageService } from './languageService.js';
|
|
5
|
-
import {
|
|
5
|
+
import { bj as DEFAULT_EXTENSION } from './extHost.js';
|
|
6
6
|
import { S as Services } from './services2.js';
|
|
7
7
|
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
8
8
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
package/dist/layout.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
1
|
+
import { E as Emitter } from './contextkey.js';
|
|
2
|
+
import { n } from './polyfill.js';
|
|
4
3
|
import { addDisposableListener, EventType, EventHelper, trackFocus, reset, getClientArea } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
5
|
-
import { mixin } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
6
|
-
import { Gesture, EventType as EventType$1 } from 'monaco-editor/esm/vs/base/browser/touch.js';
|
|
7
4
|
import { renderLabelWithIcons } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js';
|
|
8
|
-
import {
|
|
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';
|
|
9
8
|
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
10
9
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
10
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
11
11
|
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
12
|
-
import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
13
|
-
import './polyfill.js';
|
|
14
12
|
import './missing-services.js';
|
|
15
13
|
import { I as IWorkbenchLayoutService } from './layoutService.js';
|
|
16
14
|
import { o as onServicesInitialized } from './tools.js';
|
|
@@ -18,97 +16,31 @@ import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/lay
|
|
|
18
16
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
19
17
|
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
20
18
|
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
const styles = Object.create(null);
|
|
24
|
-
for (const key in styleMap) {
|
|
25
|
-
const value = styleMap[key];
|
|
26
|
-
if (value) {
|
|
27
|
-
styles[key] = resolveColorValue(value, theme);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return styles;
|
|
31
|
-
}
|
|
32
|
-
function attachStyler(themeService, styleMap, widgetOrCallback) {
|
|
33
|
-
function applyStyles() {
|
|
34
|
-
const styles = computeStyles(themeService.getColorTheme(), styleMap);
|
|
35
|
-
if (typeof widgetOrCallback === 'function') {
|
|
36
|
-
widgetOrCallback(styles);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
widgetOrCallback.style(styles);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
applyStyles();
|
|
43
|
-
return themeService.onDidColorThemeChange(applyStyles);
|
|
44
|
-
}
|
|
45
|
-
function attachButtonStyler(widget, themeService, style) {
|
|
46
|
-
return attachStyler(themeService, {
|
|
47
|
-
buttonForeground: style?.buttonForeground || buttonForeground,
|
|
48
|
-
buttonSeparator: style?.buttonSeparator || buttonSeparator,
|
|
49
|
-
buttonBackground: style?.buttonBackground || buttonBackground,
|
|
50
|
-
buttonHoverBackground: style?.buttonHoverBackground || buttonHoverBackground,
|
|
51
|
-
buttonSecondaryForeground: style?.buttonSecondaryForeground || buttonSecondaryForeground,
|
|
52
|
-
buttonSecondaryBackground: style?.buttonSecondaryBackground || buttonSecondaryBackground,
|
|
53
|
-
buttonSecondaryHoverBackground: style?.buttonSecondaryHoverBackground || buttonSecondaryHoverBackground,
|
|
54
|
-
buttonBorder: style?.buttonBorder || buttonBorder,
|
|
55
|
-
}, widget);
|
|
56
|
-
}
|
|
57
|
-
function attachProgressBarStyler(widget, themeService, style) {
|
|
58
|
-
return attachStyler(themeService, {
|
|
59
|
-
progressBarBackground: style?.progressBarBackground || progressBarBackground
|
|
60
|
-
}, widget);
|
|
61
|
-
}
|
|
62
|
-
const defaultDialogStyles = {
|
|
63
|
-
dialogBackground: editorWidgetBackground,
|
|
64
|
-
dialogForeground: editorWidgetForeground,
|
|
65
|
-
dialogShadow: widgetShadow,
|
|
66
|
-
dialogBorder: contrastBorder,
|
|
67
|
-
buttonForeground: buttonForeground,
|
|
68
|
-
buttonSeparator: buttonSeparator,
|
|
69
|
-
buttonBackground: buttonBackground,
|
|
70
|
-
buttonSecondaryBackground: buttonSecondaryBackground,
|
|
71
|
-
buttonSecondaryForeground: buttonSecondaryForeground,
|
|
72
|
-
buttonSecondaryHoverBackground: buttonSecondaryHoverBackground,
|
|
73
|
-
buttonHoverBackground: buttonHoverBackground,
|
|
74
|
-
buttonBorder: buttonBorder,
|
|
75
|
-
checkboxBorder: checkboxBorder,
|
|
76
|
-
checkboxBackground: checkboxBackground,
|
|
77
|
-
checkboxForeground: checkboxForeground,
|
|
78
|
-
errorIconForeground: problemsErrorIconForeground,
|
|
79
|
-
warningIconForeground: problemsWarningIconForeground,
|
|
80
|
-
infoIconForeground: problemsInfoIconForeground,
|
|
81
|
-
inputBackground: inputBackground,
|
|
82
|
-
inputForeground: inputForeground,
|
|
83
|
-
inputBorder: inputBorder,
|
|
84
|
-
textLinkForeground: textLinkForeground
|
|
85
|
-
};
|
|
86
|
-
function attachDialogStyler(widget, themeService, style) {
|
|
87
|
-
return attachStyler(themeService, { ...defaultDialogStyles, ...style }, widget);
|
|
88
|
-
}
|
|
89
|
-
const defaultOptions = {
|
|
90
|
-
buttonBackground: ( (Color.fromHex('#0E639C'))),
|
|
91
|
-
buttonHoverBackground: ( (Color.fromHex('#006BB3'))),
|
|
92
|
-
buttonSeparator: Color.white,
|
|
93
|
-
buttonForeground: Color.white
|
|
94
|
-
};
|
|
19
|
+
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}";
|
|
20
|
+
n(css,{});
|
|
95
21
|
class Button extends Disposable {
|
|
22
|
+
get onDidClick() { return this._onDidClick.event; }
|
|
96
23
|
constructor(container, options) {
|
|
97
24
|
super();
|
|
98
25
|
this._onDidClick = this._register(( (new Emitter())));
|
|
99
|
-
this.options = options
|
|
100
|
-
mixin(this.options, defaultOptions, false);
|
|
101
|
-
this.buttonForeground = this.options.buttonForeground;
|
|
102
|
-
this.buttonBackground = this.options.buttonBackground;
|
|
103
|
-
this.buttonHoverBackground = this.options.buttonHoverBackground;
|
|
104
|
-
this.buttonSecondaryForeground = this.options.buttonSecondaryForeground;
|
|
105
|
-
this.buttonSecondaryBackground = this.options.buttonSecondaryBackground;
|
|
106
|
-
this.buttonSecondaryHoverBackground = this.options.buttonSecondaryHoverBackground;
|
|
107
|
-
this.buttonBorder = this.options.buttonBorder;
|
|
26
|
+
this.options = options;
|
|
108
27
|
this._element = document.createElement('a');
|
|
109
28
|
this._element.classList.add('monaco-button');
|
|
110
29
|
this._element.tabIndex = 0;
|
|
111
30
|
this._element.setAttribute('role', 'button');
|
|
31
|
+
const background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;
|
|
32
|
+
const foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground;
|
|
33
|
+
this._element.style.color = foreground || '';
|
|
34
|
+
this._element.style.backgroundColor = background || '';
|
|
35
|
+
if (options.supportShortLabel) {
|
|
36
|
+
this._labelShortElement = document.createElement('div');
|
|
37
|
+
this._labelShortElement.classList.add('monaco-button-label-short');
|
|
38
|
+
this._element.appendChild(this._labelShortElement);
|
|
39
|
+
this._labelElement = document.createElement('div');
|
|
40
|
+
this._labelElement.classList.add('monaco-button-label');
|
|
41
|
+
this._element.appendChild(this._labelElement);
|
|
42
|
+
this._element.classList.add('monaco-text-button-with-short-label');
|
|
43
|
+
}
|
|
112
44
|
container.appendChild(this._element);
|
|
113
45
|
this._register(Gesture.addTarget(this._element));
|
|
114
46
|
[EventType.CLICK, EventType$1.Tap].forEach(eventType => {
|
|
@@ -137,61 +69,48 @@ class Button extends Disposable {
|
|
|
137
69
|
}));
|
|
138
70
|
this._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {
|
|
139
71
|
if (!this._element.classList.contains('disabled')) {
|
|
140
|
-
this.
|
|
72
|
+
this.updateBackground(true);
|
|
141
73
|
}
|
|
142
74
|
}));
|
|
143
75
|
this._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {
|
|
144
|
-
this.
|
|
76
|
+
this.updateBackground(false);
|
|
145
77
|
}));
|
|
146
78
|
this.focusTracker = this._register(trackFocus(this._element));
|
|
147
79
|
this._register(this.focusTracker.onDidFocus(() => { if (this.enabled) {
|
|
148
|
-
this.
|
|
80
|
+
this.updateBackground(true);
|
|
149
81
|
} }));
|
|
150
82
|
this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) {
|
|
151
|
-
this.
|
|
83
|
+
this.updateBackground(false);
|
|
152
84
|
} }));
|
|
153
|
-
this.applyStyles();
|
|
154
85
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
let
|
|
86
|
+
getContentElements(content) {
|
|
87
|
+
const elements = [];
|
|
88
|
+
for (let segment of renderLabelWithIcons(content)) {
|
|
89
|
+
if (typeof (segment) === 'string') {
|
|
90
|
+
segment = segment.trim();
|
|
91
|
+
if (segment === '') {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const node = document.createElement('span');
|
|
95
|
+
node.textContent = segment;
|
|
96
|
+
elements.push(node);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
elements.push(segment);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return elements;
|
|
103
|
+
}
|
|
104
|
+
updateBackground(hover) {
|
|
105
|
+
let background;
|
|
158
106
|
if (this.options.secondary) {
|
|
159
|
-
|
|
107
|
+
background = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;
|
|
160
108
|
}
|
|
161
109
|
else {
|
|
162
|
-
|
|
110
|
+
background = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;
|
|
163
111
|
}
|
|
164
|
-
if (
|
|
165
|
-
this._element.style.backgroundColor = hoverBackground;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
style(styles) {
|
|
169
|
-
this.buttonForeground = styles.buttonForeground;
|
|
170
|
-
this.buttonBackground = styles.buttonBackground;
|
|
171
|
-
this.buttonHoverBackground = styles.buttonHoverBackground;
|
|
172
|
-
this.buttonSecondaryForeground = styles.buttonSecondaryForeground;
|
|
173
|
-
this.buttonSecondaryBackground = styles.buttonSecondaryBackground;
|
|
174
|
-
this.buttonSecondaryHoverBackground = styles.buttonSecondaryHoverBackground;
|
|
175
|
-
this.buttonBorder = styles.buttonBorder;
|
|
176
|
-
this.applyStyles();
|
|
177
|
-
}
|
|
178
|
-
applyStyles() {
|
|
179
|
-
if (this._element) {
|
|
180
|
-
let background, foreground;
|
|
181
|
-
if (this.options.secondary) {
|
|
182
|
-
foreground = this.buttonSecondaryForeground ? ( (this.buttonSecondaryForeground.toString())) : '';
|
|
183
|
-
background = this.buttonSecondaryBackground ? ( (this.buttonSecondaryBackground.toString())) : '';
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
foreground = this.buttonForeground ? ( (this.buttonForeground.toString())) : '';
|
|
187
|
-
background = this.buttonBackground ? ( (this.buttonBackground.toString())) : '';
|
|
188
|
-
}
|
|
189
|
-
const border = this.buttonBorder ? ( (this.buttonBorder.toString())) : '';
|
|
190
|
-
this._element.style.color = foreground;
|
|
112
|
+
if (background) {
|
|
191
113
|
this._element.style.backgroundColor = background;
|
|
192
|
-
this._element.style.borderWidth = border ? '1px' : '';
|
|
193
|
-
this._element.style.borderStyle = border ? 'solid' : '';
|
|
194
|
-
this._element.style.borderColor = border;
|
|
195
114
|
}
|
|
196
115
|
}
|
|
197
116
|
get element() {
|
|
@@ -199,11 +118,12 @@ class Button extends Disposable {
|
|
|
199
118
|
}
|
|
200
119
|
set label(value) {
|
|
201
120
|
this._element.classList.add('monaco-text-button');
|
|
121
|
+
const labelElement = this.options.supportShortLabel ? this._labelElement : this._element;
|
|
202
122
|
if (this.options.supportIcons) {
|
|
203
|
-
reset(
|
|
123
|
+
reset(labelElement, ...this.getContentElements(value));
|
|
204
124
|
}
|
|
205
125
|
else {
|
|
206
|
-
|
|
126
|
+
labelElement.textContent = value;
|
|
207
127
|
}
|
|
208
128
|
if (typeof this.options.title === 'string') {
|
|
209
129
|
this._element.title = this.options.title;
|
|
@@ -212,8 +132,19 @@ class Button extends Disposable {
|
|
|
212
132
|
this._element.title = value;
|
|
213
133
|
}
|
|
214
134
|
}
|
|
135
|
+
set labelShort(value) {
|
|
136
|
+
if (!this.options.supportShortLabel || !this._labelShortElement) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (this.options.supportIcons) {
|
|
140
|
+
reset(this._labelShortElement, ...this.getContentElements(value));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this._labelShortElement.textContent = value;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
215
146
|
set icon(icon) {
|
|
216
|
-
this._element.classList.add(...
|
|
147
|
+
this._element.classList.add(...ThemeIcon.asClassNameArray(icon));
|
|
217
148
|
}
|
|
218
149
|
set enabled(value) {
|
|
219
150
|
if (value) {
|
|
@@ -258,6 +189,14 @@ class ButtonWithDropdown extends Disposable {
|
|
|
258
189
|
this.separator = document.createElement('div');
|
|
259
190
|
this.separatorContainer.appendChild(this.separator);
|
|
260
191
|
this.element.appendChild(this.separatorContainer);
|
|
192
|
+
const border = options.buttonBorder;
|
|
193
|
+
if (border) {
|
|
194
|
+
this.separatorContainer.style.borderTop = '1px solid ' + border;
|
|
195
|
+
this.separatorContainer.style.borderBottom = '1px solid ' + border;
|
|
196
|
+
}
|
|
197
|
+
const buttonBackground = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;
|
|
198
|
+
this.separatorContainer.style.backgroundColor = buttonBackground ?? '';
|
|
199
|
+
this.separator.style.backgroundColor = options.buttonSeparator ?? '';
|
|
261
200
|
this.dropdownButton = this._register(( (new Button(this.element, { ...options, title: false, supportIcons: true }))));
|
|
262
201
|
this.dropdownButton.element.title = ( (localize("button dropdown more actions", 'More Actions...')));
|
|
263
202
|
this.dropdownButton.element.setAttribute('aria-haspopup', 'true');
|
|
@@ -289,19 +228,6 @@ class ButtonWithDropdown extends Disposable {
|
|
|
289
228
|
get enabled() {
|
|
290
229
|
return this.button.enabled;
|
|
291
230
|
}
|
|
292
|
-
style(styles) {
|
|
293
|
-
this.button.style(styles);
|
|
294
|
-
this.dropdownButton.style(styles);
|
|
295
|
-
const border = styles.buttonBorder ? ( (styles.buttonBorder.toString())) : '';
|
|
296
|
-
this.separatorContainer.style.borderTopWidth = border ? '1px' : '';
|
|
297
|
-
this.separatorContainer.style.borderTopStyle = border ? 'solid' : '';
|
|
298
|
-
this.separatorContainer.style.borderTopColor = border;
|
|
299
|
-
this.separatorContainer.style.borderBottomWidth = border ? '1px' : '';
|
|
300
|
-
this.separatorContainer.style.borderBottomStyle = border ? 'solid' : '';
|
|
301
|
-
this.separatorContainer.style.borderBottomColor = border;
|
|
302
|
-
this.separatorContainer.style.backgroundColor = styles.buttonBackground?.toString() ?? '';
|
|
303
|
-
this.separator.style.backgroundColor = styles.buttonSeparator?.toString() ?? '';
|
|
304
|
-
}
|
|
305
231
|
focus() {
|
|
306
232
|
this.button.focus();
|
|
307
233
|
}
|
|
@@ -309,31 +235,43 @@ class ButtonWithDropdown extends Disposable {
|
|
|
309
235
|
return this.button.hasFocus() || this.dropdownButton.hasFocus();
|
|
310
236
|
}
|
|
311
237
|
}
|
|
312
|
-
class ButtonWithDescription
|
|
238
|
+
class ButtonWithDescription {
|
|
313
239
|
constructor(container, options) {
|
|
314
|
-
|
|
240
|
+
this.options = options;
|
|
241
|
+
this._element = document.createElement('div');
|
|
315
242
|
this._element.classList.add('monaco-description-button');
|
|
316
|
-
this.
|
|
317
|
-
this._labelElement.classList.add('monaco-button-label');
|
|
318
|
-
this._element.appendChild(this._labelElement);
|
|
243
|
+
this._button = ( (new Button(this._element, options)));
|
|
319
244
|
this._descriptionElement = document.createElement('div');
|
|
320
245
|
this._descriptionElement.classList.add('monaco-button-description');
|
|
321
246
|
this._element.appendChild(this._descriptionElement);
|
|
247
|
+
container.appendChild(this._element);
|
|
248
|
+
}
|
|
249
|
+
get onDidClick() {
|
|
250
|
+
return this._button.onDidClick;
|
|
251
|
+
}
|
|
252
|
+
get element() {
|
|
253
|
+
return this._element;
|
|
322
254
|
}
|
|
323
255
|
set label(value) {
|
|
324
|
-
this.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
256
|
+
this._button.label = value;
|
|
257
|
+
}
|
|
258
|
+
set icon(icon) {
|
|
259
|
+
this._button.icon = icon;
|
|
260
|
+
}
|
|
261
|
+
get enabled() {
|
|
262
|
+
return this._button.enabled;
|
|
263
|
+
}
|
|
264
|
+
set enabled(enabled) {
|
|
265
|
+
this._button.enabled = enabled;
|
|
266
|
+
}
|
|
267
|
+
focus() {
|
|
268
|
+
this._button.focus();
|
|
269
|
+
}
|
|
270
|
+
hasFocus() {
|
|
271
|
+
return this._button.hasFocus();
|
|
272
|
+
}
|
|
273
|
+
dispose() {
|
|
274
|
+
this._button.dispose();
|
|
337
275
|
}
|
|
338
276
|
set description(value) {
|
|
339
277
|
if (this.options.supportIcons) {
|
|
@@ -426,4 +364,4 @@ function getServiceOverride(container = document.body) {
|
|
|
426
364
|
[( IWorkbenchLayoutService.toString())]: new SyncDescriptor(LayoutService, [container])
|
|
427
365
|
};
|
|
428
366
|
}
|
|
429
|
-
export { ButtonBar as B,
|
|
367
|
+
export { ButtonBar as B, ButtonWithDescription as a, getServiceOverride as g };
|