@codingame/monaco-vscode-api 1.69.24 → 1.76.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.
@@ -1,6 +1,6 @@
1
- import { b as parse, g as getNodeType } from './polyfill.js';
2
- import { h as ITextMateService, d as IExtensionService } from './missing-services.js';
3
- import { _ as __decorate, a as __param } from './workspace.js';
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 { be as DEFAULT_EXTENSION } from './extHost.js';
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, ITextMateService)),
411
+ ( __param(0, ITextMateTokenizationService)),
412
412
  ( __param(1, ILanguageService)),
413
413
  ( __param(2, IExtensionResourceLoaderService)),
414
414
  ( __param(3, IExtensionService)),
@@ -1,5 +1,5 @@
1
- import { _ as __decorate, a as __param } from './workspace.js';
2
- import { d as IExtensionService } from './missing-services.js';
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(`Ingnoing configured 'files.associations' for '${pattern}' because its type is not a string but '${typeof langId}'`);
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}`;
@@ -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
- declare type ExtensionKind = 'ui' | 'workspace' | 'web';
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
- declare type LimitedWorkspaceSupportType = 'limited';
355
- declare type ExtensionUntrustedWorkspaceSupport = {
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
- declare type ExtensionVirtualWorkspaceSupport = boolean | {
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
- declare type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
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 { be as DEFAULT_EXTENSION } from './extHost.js';
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 { buttonForeground, buttonSeparator, buttonBackground, buttonHoverBackground, buttonSecondaryForeground, buttonSecondaryBackground, buttonSecondaryHoverBackground, buttonBorder, progressBarBackground, resolveColorValue, editorWidgetBackground, editorWidgetForeground, widgetShadow, contrastBorder, checkboxBorder, checkboxBackground, checkboxForeground, problemsErrorIconForeground, problemsWarningIconForeground, problemsInfoIconForeground, inputBackground, inputForeground, inputBorder, textLinkForeground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
2
- import { E as Emitter } from './workspace.js';
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 { CSSIcon, Codicon } from 'monaco-editor/esm/vs/base/common/codicons.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';
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 e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
22
- function computeStyles(theme, styleMap) {
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 || Object.create(null);
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.setHoverBackground();
72
+ this.updateBackground(true);
141
73
  }
142
74
  }));
143
75
  this._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {
144
- this.applyStyles();
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.setHoverBackground();
80
+ this.updateBackground(true);
149
81
  } }));
150
82
  this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) {
151
- this.applyStyles();
83
+ this.updateBackground(false);
152
84
  } }));
153
- this.applyStyles();
154
85
  }
155
- get onDidClick() { return this._onDidClick.event; }
156
- setHoverBackground() {
157
- let hoverBackground;
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
- hoverBackground = this.buttonSecondaryHoverBackground ? ( (this.buttonSecondaryHoverBackground.toString())) : null;
107
+ background = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;
160
108
  }
161
109
  else {
162
- hoverBackground = this.buttonHoverBackground ? ( (this.buttonHoverBackground.toString())) : null;
110
+ background = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;
163
111
  }
164
- if (hoverBackground) {
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(this._element, ...renderLabelWithIcons(value));
123
+ reset(labelElement, ...this.getContentElements(value));
204
124
  }
205
125
  else {
206
- this._element.textContent = value;
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(...CSSIcon.asClassNameArray(icon));
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 extends Button {
238
+ class ButtonWithDescription {
313
239
  constructor(container, options) {
314
- super(container, options);
240
+ this.options = options;
241
+ this._element = document.createElement('div');
315
242
  this._element.classList.add('monaco-description-button');
316
- this._labelElement = document.createElement('div');
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._element.classList.add('monaco-text-button');
325
- if (this.options.supportIcons) {
326
- reset(this._labelElement, ...renderLabelWithIcons(value));
327
- }
328
- else {
329
- this._labelElement.textContent = value;
330
- }
331
- if (typeof this.options.title === 'string') {
332
- this._element.title = this.options.title;
333
- }
334
- else if (this.options.title) {
335
- this._element.title = value;
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, attachButtonStyler as a, attachProgressBarStyler as b, attachDialogStyler as c, ButtonWithDescription as d, getServiceOverride as g, n };
367
+ export { ButtonBar as B, ButtonWithDescription as a, getServiceOverride as g };