@codingame/monaco-vscode-api 1.69.8 → 1.69.9
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/dist/api.js +6 -6
- package/dist/configuration.js +74 -384
- package/dist/contextkey.js +1 -13
- package/dist/dialogs.js +11 -11
- package/dist/extHost.js +1402 -2068
- package/dist/files.js +106 -100
- package/dist/keybindings.js +308 -358
- package/dist/languageConfiguration.js +4 -4
- package/dist/languageService.js +2 -2
- package/dist/languages.js +3 -3
- package/dist/layout.js +310 -292
- package/dist/missing-services.js +867 -5546
- package/dist/modelEditor.js +67 -67
- package/dist/monaco.js +13 -13
- package/dist/notifications.js +336 -266
- package/dist/polyfill.js +395 -394
- package/dist/services.js +1 -1
- package/dist/services2.js +27 -659
- package/dist/snippets.js +112 -104
- package/dist/textmate.js +88 -80
- package/dist/theme.js +408 -396
- package/dist/tokenClassification.js +3 -3
- package/dist/tokenClassificationRegistry.js +83 -77
- package/dist/workbenchThemeService.js +1 -1
- package/dist/workspaceContext.js +1 -1
- package/package.json +1 -1
package/dist/layout.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { _ as __decorate, a as __param } from './contextkey.js';
|
|
2
|
+
import { c as IProductService } from './services2.js';
|
|
3
3
|
import { E as Emitter } from './polyfill.js';
|
|
4
4
|
import { Widget } from 'monaco-editor/esm/vs/base/browser/ui/widget.js';
|
|
5
|
-
import {
|
|
5
|
+
import { CSSIcon, Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
6
6
|
import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
7
7
|
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
8
|
-
import { addDisposableListener, EventType, EventHelper, trackFocus, reset, $, hide, clearNode, isAncestor, show
|
|
8
|
+
import { addDisposableListener, EventType, EventHelper, trackFocus, reset, getClientArea, $, hide, clearNode, isAncestor, show } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
9
9
|
import { mixin } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
10
10
|
import { Gesture, EventType as EventType$1 } from 'monaco-editor/esm/vs/base/browser/touch.js';
|
|
11
11
|
import { renderLabelWithIcons } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js';
|
|
12
12
|
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
13
13
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
14
14
|
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
15
|
-
import { isMacintosh,
|
|
15
|
+
import { isMacintosh, isLinux, isWindows } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
16
16
|
import { InputBox } from 'monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js';
|
|
17
17
|
import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
|
|
18
|
-
import {
|
|
18
|
+
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';
|
|
19
19
|
import { MarkdownRenderer } from 'monaco-editor/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.js';
|
|
20
20
|
import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
|
|
21
21
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
@@ -31,18 +31,18 @@ import { o as onServicesInitialized } from './tools.js';
|
|
|
31
31
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
32
32
|
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
33
33
|
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
34
|
-
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}}
|
|
34
|
+
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}}
|
|
35
35
|
const defaultOpts = {
|
|
36
|
-
inputActiveOptionBorder: ( Color.fromHex('#007ACC00')),
|
|
37
|
-
inputActiveOptionForeground: ( Color.fromHex('#FFFFFF')),
|
|
38
|
-
inputActiveOptionBackground: ( Color.fromHex('#0E639C50'))
|
|
36
|
+
inputActiveOptionBorder: ( (Color.fromHex('#007ACC00'))),
|
|
37
|
+
inputActiveOptionForeground: ( (Color.fromHex('#FFFFFF'))),
|
|
38
|
+
inputActiveOptionBackground: ( (Color.fromHex('#0E639C50')))
|
|
39
39
|
};
|
|
40
40
|
class Toggle extends Widget {
|
|
41
41
|
constructor(opts) {
|
|
42
42
|
super();
|
|
43
|
-
this._onChange = this._register(( new Emitter()));
|
|
43
|
+
this._onChange = this._register(( (new Emitter())));
|
|
44
44
|
this.onChange = this._onChange.event;
|
|
45
|
-
this._onKeyDown = this._register(( new Emitter()));
|
|
45
|
+
this._onKeyDown = this._register(( (new Emitter())));
|
|
46
46
|
this.onKeyDown = this._onKeyDown.event;
|
|
47
47
|
this._opts = { ...defaultOpts, ...opts };
|
|
48
48
|
this._checked = this._opts.isChecked;
|
|
@@ -127,9 +127,9 @@ class Toggle extends Widget {
|
|
|
127
127
|
}
|
|
128
128
|
applyStyles() {
|
|
129
129
|
if (this.domNode) {
|
|
130
|
-
this.domNode.style.borderColor = this._checked && this._opts.inputActiveOptionBorder ? ( this._opts.inputActiveOptionBorder.toString()) : '';
|
|
131
|
-
this.domNode.style.color = this._checked && this._opts.inputActiveOptionForeground ? ( this._opts.inputActiveOptionForeground.toString()) : 'inherit';
|
|
132
|
-
this.domNode.style.backgroundColor = this._checked && this._opts.inputActiveOptionBackground ? ( this._opts.inputActiveOptionBackground.toString()) : '';
|
|
130
|
+
this.domNode.style.borderColor = this._checked && this._opts.inputActiveOptionBorder ? ( (this._opts.inputActiveOptionBorder.toString())) : '';
|
|
131
|
+
this.domNode.style.color = this._checked && this._opts.inputActiveOptionForeground ? ( (this._opts.inputActiveOptionForeground.toString())) : 'inherit';
|
|
132
|
+
this.domNode.style.backgroundColor = this._checked && this._opts.inputActiveOptionBackground ? ( (this._opts.inputActiveOptionBackground.toString())) : '';
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
enable() {
|
|
@@ -148,9 +148,9 @@ class Checkbox extends Widget {
|
|
|
148
148
|
super();
|
|
149
149
|
this.title = title;
|
|
150
150
|
this.isChecked = isChecked;
|
|
151
|
-
this.checkbox = ( new Toggle(
|
|
151
|
+
this.checkbox = ( (new Toggle(
|
|
152
152
|
{ title: this.title, isChecked: this.isChecked, icon: Codicon.check, actionClassName: 'monaco-checkbox' }
|
|
153
|
-
));
|
|
153
|
+
)));
|
|
154
154
|
this.domNode = this.checkbox.domNode;
|
|
155
155
|
this.styles = {};
|
|
156
156
|
this.checkbox.onChange(() => {
|
|
@@ -175,9 +175,9 @@ class Checkbox extends Widget {
|
|
|
175
175
|
this.applyStyles();
|
|
176
176
|
}
|
|
177
177
|
applyStyles() {
|
|
178
|
-
this.domNode.style.color = this.styles.checkboxForeground ? ( this.styles.checkboxForeground.toString()) : '';
|
|
179
|
-
this.domNode.style.backgroundColor = this.styles.checkboxBackground ? ( this.styles.checkboxBackground.toString()) : '';
|
|
180
|
-
this.domNode.style.borderColor = this.styles.checkboxBorder ? ( this.styles.checkboxBorder.toString()) : '';
|
|
178
|
+
this.domNode.style.color = this.styles.checkboxForeground ? ( (this.styles.checkboxForeground.toString())) : '';
|
|
179
|
+
this.domNode.style.backgroundColor = this.styles.checkboxBackground ? ( (this.styles.checkboxBackground.toString())) : '';
|
|
180
|
+
this.domNode.style.borderColor = this.styles.checkboxBorder ? ( (this.styles.checkboxBorder.toString())) : '';
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
function computeStyles(theme, styleMap) {
|
|
@@ -248,15 +248,15 @@ function attachDialogStyler(widget, themeService, style) {
|
|
|
248
248
|
return attachStyler(themeService, { ...defaultDialogStyles, ...style }, widget);
|
|
249
249
|
}
|
|
250
250
|
const defaultOptions = {
|
|
251
|
-
buttonBackground: ( Color.fromHex('#0E639C')),
|
|
252
|
-
buttonHoverBackground: ( Color.fromHex('#006BB3')),
|
|
251
|
+
buttonBackground: ( (Color.fromHex('#0E639C'))),
|
|
252
|
+
buttonHoverBackground: ( (Color.fromHex('#006BB3'))),
|
|
253
253
|
buttonSeparator: Color.white,
|
|
254
254
|
buttonForeground: Color.white
|
|
255
255
|
};
|
|
256
256
|
class Button extends Disposable {
|
|
257
257
|
constructor(container, options) {
|
|
258
258
|
super();
|
|
259
|
-
this._onDidClick = this._register(( new Emitter()));
|
|
259
|
+
this._onDidClick = this._register(( (new Emitter())));
|
|
260
260
|
this.options = options || Object.create(null);
|
|
261
261
|
mixin(this.options, defaultOptions, false);
|
|
262
262
|
this.buttonForeground = this.options.buttonForeground;
|
|
@@ -282,7 +282,7 @@ class Button extends Disposable {
|
|
|
282
282
|
}));
|
|
283
283
|
});
|
|
284
284
|
this._register(addDisposableListener(this._element, EventType.KEY_DOWN, e => {
|
|
285
|
-
const event = ( new StandardKeyboardEvent(e));
|
|
285
|
+
const event = ( (new StandardKeyboardEvent(e)));
|
|
286
286
|
let eventHandled = false;
|
|
287
287
|
if (this.enabled && (event.equals(3 ) || event.equals(10 ))) {
|
|
288
288
|
this._onDidClick.fire(e);
|
|
@@ -317,10 +317,10 @@ class Button extends Disposable {
|
|
|
317
317
|
setHoverBackground() {
|
|
318
318
|
let hoverBackground;
|
|
319
319
|
if (this.options.secondary) {
|
|
320
|
-
hoverBackground = this.buttonSecondaryHoverBackground ? ( this.buttonSecondaryHoverBackground.toString()) : null;
|
|
320
|
+
hoverBackground = this.buttonSecondaryHoverBackground ? ( (this.buttonSecondaryHoverBackground.toString())) : null;
|
|
321
321
|
}
|
|
322
322
|
else {
|
|
323
|
-
hoverBackground = this.buttonHoverBackground ? ( this.buttonHoverBackground.toString()) : null;
|
|
323
|
+
hoverBackground = this.buttonHoverBackground ? ( (this.buttonHoverBackground.toString())) : null;
|
|
324
324
|
}
|
|
325
325
|
if (hoverBackground) {
|
|
326
326
|
this._element.style.backgroundColor = hoverBackground;
|
|
@@ -340,14 +340,14 @@ class Button extends Disposable {
|
|
|
340
340
|
if (this._element) {
|
|
341
341
|
let background, foreground;
|
|
342
342
|
if (this.options.secondary) {
|
|
343
|
-
foreground = this.buttonSecondaryForeground ? ( this.buttonSecondaryForeground.toString()) : '';
|
|
344
|
-
background = this.buttonSecondaryBackground ? ( this.buttonSecondaryBackground.toString()) : '';
|
|
343
|
+
foreground = this.buttonSecondaryForeground ? ( (this.buttonSecondaryForeground.toString())) : '';
|
|
344
|
+
background = this.buttonSecondaryBackground ? ( (this.buttonSecondaryBackground.toString())) : '';
|
|
345
345
|
}
|
|
346
346
|
else {
|
|
347
|
-
foreground = this.buttonForeground ? ( this.buttonForeground.toString()) : '';
|
|
348
|
-
background = this.buttonBackground ? ( this.buttonBackground.toString()) : '';
|
|
347
|
+
foreground = this.buttonForeground ? ( (this.buttonForeground.toString())) : '';
|
|
348
|
+
background = this.buttonBackground ? ( (this.buttonBackground.toString())) : '';
|
|
349
349
|
}
|
|
350
|
-
const border = this.buttonBorder ? ( this.buttonBorder.toString()) : '';
|
|
350
|
+
const border = this.buttonBorder ? ( (this.buttonBorder.toString())) : '';
|
|
351
351
|
this._element.style.color = foreground;
|
|
352
352
|
this._element.style.backgroundColor = background;
|
|
353
353
|
this._element.style.borderWidth = border ? '1px' : '';
|
|
@@ -400,27 +400,27 @@ class Button extends Disposable {
|
|
|
400
400
|
class ButtonWithDropdown extends Disposable {
|
|
401
401
|
constructor(container, options) {
|
|
402
402
|
super();
|
|
403
|
-
this._onDidClick = this._register(( new Emitter()));
|
|
403
|
+
this._onDidClick = this._register(( (new Emitter())));
|
|
404
404
|
this.onDidClick = this._onDidClick.event;
|
|
405
405
|
this.element = document.createElement('div');
|
|
406
406
|
this.element.classList.add('monaco-button-dropdown');
|
|
407
407
|
container.appendChild(this.element);
|
|
408
|
-
this.button = this._register(( new Button(this.element, options)));
|
|
408
|
+
this.button = this._register(( (new Button(this.element, options))));
|
|
409
409
|
this._register(this.button.onDidClick(e => this._onDidClick.fire(e)));
|
|
410
|
-
this.action = this._register(( new Action(
|
|
410
|
+
this.action = this._register(( (new Action(
|
|
411
411
|
'primaryAction',
|
|
412
412
|
this.button.label,
|
|
413
413
|
undefined,
|
|
414
414
|
true,
|
|
415
415
|
async () => this._onDidClick.fire(undefined)
|
|
416
|
-
)));
|
|
416
|
+
))));
|
|
417
417
|
this.separatorContainer = document.createElement('div');
|
|
418
418
|
this.separatorContainer.classList.add('monaco-button-dropdown-separator');
|
|
419
419
|
this.separator = document.createElement('div');
|
|
420
420
|
this.separatorContainer.appendChild(this.separator);
|
|
421
421
|
this.element.appendChild(this.separatorContainer);
|
|
422
|
-
this.dropdownButton = this._register(( new Button(this.element, { ...options, title: false, supportIcons: true })));
|
|
423
|
-
this.dropdownButton.element.title = ( localize("button dropdown more actions", 'More Actions...'));
|
|
422
|
+
this.dropdownButton = this._register(( (new Button(this.element, { ...options, title: false, supportIcons: true }))));
|
|
423
|
+
this.dropdownButton.element.title = ( (localize("button dropdown more actions", 'More Actions...')));
|
|
424
424
|
this.dropdownButton.element.setAttribute('aria-haspopup', 'true');
|
|
425
425
|
this.dropdownButton.element.setAttribute('aria-expanded', 'false');
|
|
426
426
|
this.dropdownButton.element.classList.add('monaco-dropdown-button');
|
|
@@ -453,7 +453,7 @@ class ButtonWithDropdown extends Disposable {
|
|
|
453
453
|
style(styles) {
|
|
454
454
|
this.button.style(styles);
|
|
455
455
|
this.dropdownButton.style(styles);
|
|
456
|
-
const border = styles.buttonBorder ? ( styles.buttonBorder.toString()) : '';
|
|
456
|
+
const border = styles.buttonBorder ? ( (styles.buttonBorder.toString())) : '';
|
|
457
457
|
this.separatorContainer.style.borderTopWidth = border ? '1px' : '';
|
|
458
458
|
this.separatorContainer.style.borderTopStyle = border ? 'solid' : '';
|
|
459
459
|
this.separatorContainer.style.borderTopColor = border;
|
|
@@ -515,17 +515,17 @@ class ButtonBar extends Disposable {
|
|
|
515
515
|
return this._buttons;
|
|
516
516
|
}
|
|
517
517
|
addButton(options) {
|
|
518
|
-
const button = this._register(( new Button(this.container, options)));
|
|
518
|
+
const button = this._register(( (new Button(this.container, options))));
|
|
519
519
|
this.pushButton(button);
|
|
520
520
|
return button;
|
|
521
521
|
}
|
|
522
522
|
addButtonWithDescription(options) {
|
|
523
|
-
const button = this._register(( new ButtonWithDescription(this.container, options)));
|
|
523
|
+
const button = this._register(( (new ButtonWithDescription(this.container, options))));
|
|
524
524
|
this.pushButton(button);
|
|
525
525
|
return button;
|
|
526
526
|
}
|
|
527
527
|
addButtonWithDropdown(options) {
|
|
528
|
-
const button = this._register(( new ButtonWithDropdown(this.container, options)));
|
|
528
|
+
const button = this._register(( (new ButtonWithDropdown(this.container, options))));
|
|
529
529
|
this.pushButton(button);
|
|
530
530
|
return button;
|
|
531
531
|
}
|
|
@@ -533,7 +533,7 @@ class ButtonBar extends Disposable {
|
|
|
533
533
|
this._buttons.push(button);
|
|
534
534
|
const index = this._buttons.length - 1;
|
|
535
535
|
this._register(addDisposableListener(button.element, EventType.KEY_DOWN, e => {
|
|
536
|
-
const event = ( new StandardKeyboardEvent(e));
|
|
536
|
+
const event = ( (new StandardKeyboardEvent(e)));
|
|
537
537
|
let eventHandled = true;
|
|
538
538
|
let buttonIndexToFocus;
|
|
539
539
|
if (event.equals(15 )) {
|
|
@@ -579,7 +579,7 @@ class Dialog extends Disposable {
|
|
|
579
579
|
this.buttons = buttons;
|
|
580
580
|
}
|
|
581
581
|
else if (!this.options.disableDefaultAction) {
|
|
582
|
-
this.buttons = [( localize('ok', "OK"))];
|
|
582
|
+
this.buttons = [( (localize('ok', "OK")))];
|
|
583
583
|
}
|
|
584
584
|
else {
|
|
585
585
|
this.buttons = [];
|
|
@@ -612,10 +612,10 @@ class Dialog extends Disposable {
|
|
|
612
612
|
if (this.options.inputs) {
|
|
613
613
|
this.inputs = this.options.inputs.map(input => {
|
|
614
614
|
const inputRowElement = this.messageContainer.appendChild($('.dialog-message-input'));
|
|
615
|
-
const inputBox = this._register(( new InputBox(inputRowElement, undefined, {
|
|
615
|
+
const inputBox = this._register(( (new InputBox(inputRowElement, undefined, {
|
|
616
616
|
placeholder: input.placeholder,
|
|
617
617
|
type: input.type ?? 'text',
|
|
618
|
-
})));
|
|
618
|
+
}))));
|
|
619
619
|
if (input.value) {
|
|
620
620
|
inputBox.value = input.value;
|
|
621
621
|
}
|
|
@@ -627,7 +627,7 @@ class Dialog extends Disposable {
|
|
|
627
627
|
}
|
|
628
628
|
if (this.options.checkboxLabel) {
|
|
629
629
|
const checkboxRowElement = this.messageContainer.appendChild($('.dialog-checkbox-row'));
|
|
630
|
-
const checkbox = this.checkbox = this._register(( new Checkbox(this.options.checkboxLabel, !!this.options.checkboxChecked)));
|
|
630
|
+
const checkbox = this.checkbox = this._register(( (new Checkbox(this.options.checkboxLabel, !!this.options.checkboxChecked))));
|
|
631
631
|
checkboxRowElement.appendChild(checkbox.domNode);
|
|
632
632
|
const checkboxMessageElement = checkboxRowElement.appendChild($('.dialog-checkbox-message'));
|
|
633
633
|
checkboxMessageElement.innerText = this.options.checkboxLabel;
|
|
@@ -637,7 +637,7 @@ class Dialog extends Disposable {
|
|
|
637
637
|
this.toolbarContainer = toolbarRowElement.appendChild($('.dialog-toolbar'));
|
|
638
638
|
}
|
|
639
639
|
getIconAriaLabel() {
|
|
640
|
-
const typeLabel = ( localize('dialogInfoMessage', 'Info'));
|
|
640
|
+
const typeLabel = ( (localize('dialogInfoMessage', 'Info')));
|
|
641
641
|
return typeLabel;
|
|
642
642
|
}
|
|
643
643
|
updateMessage(message) {
|
|
@@ -645,178 +645,186 @@ class Dialog extends Disposable {
|
|
|
645
645
|
}
|
|
646
646
|
async show() {
|
|
647
647
|
this.focusToReturn = document.activeElement;
|
|
648
|
-
return (
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
button
|
|
658
|
-
|
|
659
|
-
this._register(button.onDidClick(e => {
|
|
660
|
-
if (e) {
|
|
661
|
-
EventHelper.stop(e);
|
|
648
|
+
return (
|
|
649
|
+
(new Promise((resolve) => {
|
|
650
|
+
clearNode(this.buttonsContainer);
|
|
651
|
+
const buttonBar = this.buttonBar = this._register(( (new ButtonBar(this.buttonsContainer))));
|
|
652
|
+
const buttonMap = this.rearrangeButtons(this.buttons, this.options.cancelId);
|
|
653
|
+
buttonMap.forEach((entry, index) => {
|
|
654
|
+
const primary = buttonMap[index].index === 0;
|
|
655
|
+
const button = this.options.buttonDetails ? this._register(buttonBar.addButtonWithDescription({ title: true, secondary: !primary })) : this._register(buttonBar.addButton({ title: true, secondary: !primary }));
|
|
656
|
+
button.label = mnemonicButtonLabel(buttonMap[index].label, true);
|
|
657
|
+
if (button instanceof ButtonWithDescription) {
|
|
658
|
+
button.description = this.options.buttonDetails[buttonMap[index].index];
|
|
662
659
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
});
|
|
668
|
-
}));
|
|
669
|
-
});
|
|
670
|
-
this._register(addDisposableListener(window, 'keydown', e => {
|
|
671
|
-
const evt = ( new StandardKeyboardEvent(e));
|
|
672
|
-
if (evt.equals(512 )) {
|
|
673
|
-
evt.preventDefault();
|
|
674
|
-
}
|
|
675
|
-
if (evt.equals(3 )) {
|
|
676
|
-
if (this.inputs.some(input => input.hasFocus())) {
|
|
677
|
-
EventHelper.stop(e);
|
|
660
|
+
this._register(button.onDidClick(e => {
|
|
661
|
+
if (e) {
|
|
662
|
+
EventHelper.stop(e);
|
|
663
|
+
}
|
|
678
664
|
resolve({
|
|
679
|
-
button: buttonMap
|
|
665
|
+
button: buttonMap[index].index,
|
|
680
666
|
checkboxChecked: this.checkbox ? this.checkbox.checked : undefined,
|
|
681
667
|
values: this.inputs.length > 0 ? this.inputs.map(input => input.value) : undefined
|
|
682
668
|
});
|
|
669
|
+
}));
|
|
670
|
+
});
|
|
671
|
+
this._register(addDisposableListener(window, 'keydown', e => {
|
|
672
|
+
const evt = ( (new StandardKeyboardEvent(e)));
|
|
673
|
+
if (evt.equals(512 )) {
|
|
674
|
+
evt.preventDefault();
|
|
683
675
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
let focusedIndex = -1;
|
|
693
|
-
if (this.messageContainer) {
|
|
694
|
-
const links = this.messageContainer.querySelectorAll('a');
|
|
695
|
-
for (const link of links) {
|
|
696
|
-
focusableElements.push(link);
|
|
697
|
-
if (link === document.activeElement) {
|
|
698
|
-
focusedIndex = focusableElements.length - 1;
|
|
699
|
-
}
|
|
676
|
+
if (evt.equals(3 )) {
|
|
677
|
+
if (this.inputs.some(input => input.hasFocus())) {
|
|
678
|
+
EventHelper.stop(e);
|
|
679
|
+
resolve({
|
|
680
|
+
button: buttonMap.find(button => button.index !== this.options.cancelId)?.index ?? 0,
|
|
681
|
+
checkboxChecked: this.checkbox ? this.checkbox.checked : undefined,
|
|
682
|
+
values: this.inputs.length > 0 ? this.inputs.map(input => input.value) : undefined
|
|
683
|
+
});
|
|
700
684
|
}
|
|
685
|
+
return;
|
|
701
686
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
if (input.hasFocus()) {
|
|
705
|
-
focusedIndex = focusableElements.length - 1;
|
|
706
|
-
}
|
|
687
|
+
if (evt.equals(10 )) {
|
|
688
|
+
return;
|
|
707
689
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
690
|
+
let eventHandled = false;
|
|
691
|
+
if (evt.equals(2 ) || evt.equals(17 ) || evt.equals(1024 | 2 ) || evt.equals(15 )) {
|
|
692
|
+
const focusableElements = [];
|
|
693
|
+
let focusedIndex = -1;
|
|
694
|
+
if (this.messageContainer) {
|
|
695
|
+
const links = this.messageContainer.querySelectorAll('a');
|
|
696
|
+
for (const link of links) {
|
|
697
|
+
focusableElements.push(link);
|
|
698
|
+
if (link === document.activeElement) {
|
|
699
|
+
focusedIndex = focusableElements.length - 1;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
712
702
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
focusableElements.push(button);
|
|
717
|
-
if (button.hasFocus()) {
|
|
703
|
+
for (const input of this.inputs) {
|
|
704
|
+
focusableElements.push(input);
|
|
705
|
+
if (input.hasFocus()) {
|
|
718
706
|
focusedIndex = focusableElements.length - 1;
|
|
719
707
|
}
|
|
720
708
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
709
|
+
if (this.checkbox) {
|
|
710
|
+
focusableElements.push(this.checkbox);
|
|
711
|
+
if (this.checkbox.hasFocus()) {
|
|
712
|
+
focusedIndex = focusableElements.length - 1;
|
|
713
|
+
}
|
|
725
714
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
715
|
+
if (this.buttonBar) {
|
|
716
|
+
for (const button of this.buttonBar.buttons) {
|
|
717
|
+
focusableElements.push(button);
|
|
718
|
+
if (button.hasFocus()) {
|
|
719
|
+
focusedIndex = focusableElements.length - 1;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
732
722
|
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
723
|
+
if (evt.equals(2 ) || evt.equals(17 )) {
|
|
724
|
+
if (focusedIndex === -1) {
|
|
725
|
+
focusedIndex = 0;
|
|
726
|
+
}
|
|
727
|
+
const newFocusedIndex = (focusedIndex + 1) % focusableElements.length;
|
|
728
|
+
focusableElements[newFocusedIndex].focus();
|
|
736
729
|
}
|
|
737
|
-
|
|
730
|
+
else {
|
|
731
|
+
if (focusedIndex === -1) {
|
|
732
|
+
focusedIndex = focusableElements.length;
|
|
733
|
+
}
|
|
734
|
+
let newFocusedIndex = focusedIndex - 1;
|
|
735
|
+
if (newFocusedIndex === -1) {
|
|
736
|
+
newFocusedIndex = focusableElements.length - 1;
|
|
737
|
+
}
|
|
738
|
+
focusableElements[newFocusedIndex].focus();
|
|
739
|
+
}
|
|
740
|
+
eventHandled = true;
|
|
738
741
|
}
|
|
739
|
-
eventHandled
|
|
740
|
-
|
|
741
|
-
|
|
742
|
+
if (eventHandled) {
|
|
743
|
+
EventHelper.stop(e, true);
|
|
744
|
+
}
|
|
745
|
+
else if (this.options.keyEventProcessor) {
|
|
746
|
+
this.options.keyEventProcessor(evt);
|
|
747
|
+
}
|
|
748
|
+
}, true));
|
|
749
|
+
this._register(addDisposableListener(window, 'keyup', e => {
|
|
742
750
|
EventHelper.stop(e, true);
|
|
751
|
+
const evt = ( (new StandardKeyboardEvent(e)));
|
|
752
|
+
if (!this.options.disableCloseAction && evt.equals(9 )) {
|
|
753
|
+
resolve({
|
|
754
|
+
button: this.options.cancelId || 0,
|
|
755
|
+
checkboxChecked: this.checkbox ? this.checkbox.checked : undefined
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
}, true));
|
|
759
|
+
this._register(addDisposableListener(this.element, 'focusout', e => {
|
|
760
|
+
if (!!e.relatedTarget && !!this.element) {
|
|
761
|
+
if (!isAncestor(e.relatedTarget, this.element)) {
|
|
762
|
+
this.focusToReturn = e.relatedTarget;
|
|
763
|
+
if (e.target) {
|
|
764
|
+
e.target.focus();
|
|
765
|
+
EventHelper.stop(e, true);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}, false));
|
|
770
|
+
const spinModifierClassName = 'codicon-modifier-spin';
|
|
771
|
+
this.iconElement.classList.remove(...Codicon.dialogError.classNamesArray, ...Codicon.dialogWarning.classNamesArray, ...Codicon.dialogInfo.classNamesArray, ...Codicon.loading.classNamesArray, spinModifierClassName);
|
|
772
|
+
if (this.options.icon) {
|
|
773
|
+
this.iconElement.classList.add(...this.options.icon.classNamesArray);
|
|
743
774
|
}
|
|
744
|
-
else
|
|
745
|
-
this.options.
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
775
|
+
else {
|
|
776
|
+
switch (this.options.type) {
|
|
777
|
+
case 'error':
|
|
778
|
+
this.iconElement.classList.add(...Codicon.dialogError.classNamesArray);
|
|
779
|
+
break;
|
|
780
|
+
case 'warning':
|
|
781
|
+
this.iconElement.classList.add(...Codicon.dialogWarning.classNamesArray);
|
|
782
|
+
break;
|
|
783
|
+
case 'pending':
|
|
784
|
+
this.iconElement.classList.add(...Codicon.loading.classNamesArray, spinModifierClassName);
|
|
785
|
+
break;
|
|
786
|
+
case 'none':
|
|
787
|
+
case 'info':
|
|
788
|
+
case 'question':
|
|
789
|
+
default:
|
|
790
|
+
this.iconElement.classList.add(...Codicon.dialogInfo.classNamesArray);
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
756
793
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
794
|
+
if (!this.options.disableCloseAction) {
|
|
795
|
+
const actionBar = this._register(( (new ActionBar(this.toolbarContainer, {}))));
|
|
796
|
+
const action = this._register(( (new Action(
|
|
797
|
+
'dialog.close',
|
|
798
|
+
(localize('dialogClose', "Close Dialog")),
|
|
799
|
+
Codicon.dialogClose.classNames,
|
|
800
|
+
true,
|
|
801
|
+
async () => {
|
|
802
|
+
resolve({
|
|
803
|
+
button: this.options.cancelId || 0,
|
|
804
|
+
checkboxChecked: this.checkbox ? this.checkbox.checked : undefined
|
|
805
|
+
});
|
|
765
806
|
}
|
|
766
|
-
|
|
807
|
+
))));
|
|
808
|
+
actionBar.push(action, { icon: true, label: false, });
|
|
767
809
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
case 'error':
|
|
777
|
-
this.iconElement.classList.add(...Codicon.dialogError.classNamesArray);
|
|
778
|
-
break;
|
|
779
|
-
case 'warning':
|
|
780
|
-
this.iconElement.classList.add(...Codicon.dialogWarning.classNamesArray);
|
|
781
|
-
break;
|
|
782
|
-
case 'pending':
|
|
783
|
-
this.iconElement.classList.add(...Codicon.loading.classNamesArray, spinModifierClassName);
|
|
784
|
-
break;
|
|
785
|
-
case 'none':
|
|
786
|
-
case 'info':
|
|
787
|
-
case 'question':
|
|
788
|
-
default:
|
|
789
|
-
this.iconElement.classList.add(...Codicon.dialogInfo.classNamesArray);
|
|
790
|
-
break;
|
|
810
|
+
this.applyStyles();
|
|
811
|
+
this.element.setAttribute('aria-modal', 'true');
|
|
812
|
+
this.element.setAttribute('aria-labelledby', 'monaco-dialog-icon monaco-dialog-message-text');
|
|
813
|
+
this.element.setAttribute('aria-describedby', 'monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body');
|
|
814
|
+
show(this.element);
|
|
815
|
+
if (this.inputs.length > 0) {
|
|
816
|
+
this.inputs[0].focus();
|
|
817
|
+
this.inputs[0].select();
|
|
791
818
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
button: this.options.cancelId || 0,
|
|
798
|
-
checkboxChecked: this.checkbox ? this.checkbox.checked : undefined
|
|
819
|
+
else {
|
|
820
|
+
buttonMap.forEach((value, index) => {
|
|
821
|
+
if (value.index === 0) {
|
|
822
|
+
buttonBar.buttons[index].focus();
|
|
823
|
+
}
|
|
799
824
|
});
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
this.applyStyles();
|
|
804
|
-
this.element.setAttribute('aria-modal', 'true');
|
|
805
|
-
this.element.setAttribute('aria-labelledby', 'monaco-dialog-icon monaco-dialog-message-text');
|
|
806
|
-
this.element.setAttribute('aria-describedby', 'monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body');
|
|
807
|
-
show(this.element);
|
|
808
|
-
if (this.inputs.length > 0) {
|
|
809
|
-
this.inputs[0].focus();
|
|
810
|
-
this.inputs[0].select();
|
|
811
|
-
}
|
|
812
|
-
else {
|
|
813
|
-
buttonMap.forEach((value, index) => {
|
|
814
|
-
if (value.index === 0) {
|
|
815
|
-
buttonBar.buttons[index].focus();
|
|
816
|
-
}
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
}));
|
|
825
|
+
}
|
|
826
|
+
}))
|
|
827
|
+
);
|
|
820
828
|
}
|
|
821
829
|
applyStyles() {
|
|
822
830
|
if (this.styles) {
|
|
@@ -833,12 +841,12 @@ class Dialog extends Disposable {
|
|
|
833
841
|
this.buttonBar?.buttons.forEach(button => button.style(style));
|
|
834
842
|
this.checkbox?.style(style);
|
|
835
843
|
if (fgColor && bgColor) {
|
|
836
|
-
const messageDetailColor = ( fgColor.transparent(.9));
|
|
837
|
-
this.messageDetailElement.style.color = ( messageDetailColor.makeOpaque(bgColor).toString());
|
|
844
|
+
const messageDetailColor = ( (fgColor.transparent(.9)));
|
|
845
|
+
this.messageDetailElement.style.color = ( (messageDetailColor.makeOpaque(bgColor).toString()));
|
|
838
846
|
}
|
|
839
847
|
if (linkFgColor) {
|
|
840
848
|
for (const el of this.messageContainer.getElementsByTagName('a')) {
|
|
841
|
-
el.style.color = ( linkFgColor.toString());
|
|
849
|
+
el.style.color = ( (linkFgColor.toString()));
|
|
842
850
|
}
|
|
843
851
|
}
|
|
844
852
|
let color;
|
|
@@ -854,7 +862,7 @@ class Dialog extends Disposable {
|
|
|
854
862
|
break;
|
|
855
863
|
}
|
|
856
864
|
if (color) {
|
|
857
|
-
this.iconElement.style.color = ( color.toString());
|
|
865
|
+
this.iconElement.style.color = ( (color.toString()));
|
|
858
866
|
}
|
|
859
867
|
for (const input of this.inputs) {
|
|
860
868
|
input.style(style);
|
|
@@ -904,12 +912,20 @@ function fromNow(date, appendAgoLabel, useFullTimeWords) {
|
|
|
904
912
|
if (typeof date !== 'number') {
|
|
905
913
|
date = date.getTime();
|
|
906
914
|
}
|
|
907
|
-
const seconds = Math.round((( new Date()).getTime() - date) / 1000);
|
|
915
|
+
const seconds = Math.round((( (new Date())).getTime() - date) / 1000);
|
|
908
916
|
if (seconds < -30) {
|
|
909
|
-
return (
|
|
917
|
+
return (
|
|
918
|
+
(localize(
|
|
919
|
+
'date.fromNow.in',
|
|
920
|
+
'in {0}',
|
|
921
|
+
fromNow(( (new Date())).getTime() + seconds * 1000, false)
|
|
922
|
+
))
|
|
923
|
+
);
|
|
910
924
|
}
|
|
911
925
|
if (seconds < 30) {
|
|
912
|
-
return (
|
|
926
|
+
return (
|
|
927
|
+
(localize('date.fromNow.now', 'now'))
|
|
928
|
+
);
|
|
913
929
|
}
|
|
914
930
|
let value;
|
|
915
931
|
if (seconds < minute) {
|
|
@@ -917,25 +933,25 @@ function fromNow(date, appendAgoLabel, useFullTimeWords) {
|
|
|
917
933
|
if (appendAgoLabel) {
|
|
918
934
|
if (value === 1) {
|
|
919
935
|
return useFullTimeWords
|
|
920
|
-
? ( localize('date.fromNow.seconds.singular.ago.fullWord', '{0} second ago', value))
|
|
921
|
-
: ( localize('date.fromNow.seconds.singular.ago', '{0} sec ago', value));
|
|
936
|
+
? ( (localize('date.fromNow.seconds.singular.ago.fullWord', '{0} second ago', value)))
|
|
937
|
+
: ( (localize('date.fromNow.seconds.singular.ago', '{0} sec ago', value)));
|
|
922
938
|
}
|
|
923
939
|
else {
|
|
924
940
|
return useFullTimeWords
|
|
925
|
-
? ( localize('date.fromNow.seconds.plural.ago.fullWord', '{0} seconds ago', value))
|
|
926
|
-
: ( localize('date.fromNow.seconds.plural.ago', '{0} secs ago', value));
|
|
941
|
+
? ( (localize('date.fromNow.seconds.plural.ago.fullWord', '{0} seconds ago', value)))
|
|
942
|
+
: ( (localize('date.fromNow.seconds.plural.ago', '{0} secs ago', value)));
|
|
927
943
|
}
|
|
928
944
|
}
|
|
929
945
|
else {
|
|
930
946
|
if (value === 1) {
|
|
931
947
|
return useFullTimeWords
|
|
932
|
-
? ( localize('date.fromNow.seconds.singular.fullWord', '{0} second', value))
|
|
933
|
-
: ( localize('date.fromNow.seconds.singular', '{0} sec', value));
|
|
948
|
+
? ( (localize('date.fromNow.seconds.singular.fullWord', '{0} second', value)))
|
|
949
|
+
: ( (localize('date.fromNow.seconds.singular', '{0} sec', value)));
|
|
934
950
|
}
|
|
935
951
|
else {
|
|
936
952
|
return useFullTimeWords
|
|
937
|
-
? ( localize('date.fromNow.seconds.plural.fullWord', '{0} seconds', value))
|
|
938
|
-
: ( localize('date.fromNow.seconds.plural', '{0} secs', value));
|
|
953
|
+
? ( (localize('date.fromNow.seconds.plural.fullWord', '{0} seconds', value)))
|
|
954
|
+
: ( (localize('date.fromNow.seconds.plural', '{0} secs', value)));
|
|
939
955
|
}
|
|
940
956
|
}
|
|
941
957
|
}
|
|
@@ -944,25 +960,25 @@ function fromNow(date, appendAgoLabel, useFullTimeWords) {
|
|
|
944
960
|
if (appendAgoLabel) {
|
|
945
961
|
if (value === 1) {
|
|
946
962
|
return useFullTimeWords
|
|
947
|
-
? ( localize('date.fromNow.minutes.singular.ago.fullWord', '{0} minute ago', value))
|
|
948
|
-
: ( localize('date.fromNow.minutes.singular.ago', '{0} min ago', value));
|
|
963
|
+
? ( (localize('date.fromNow.minutes.singular.ago.fullWord', '{0} minute ago', value)))
|
|
964
|
+
: ( (localize('date.fromNow.minutes.singular.ago', '{0} min ago', value)));
|
|
949
965
|
}
|
|
950
966
|
else {
|
|
951
967
|
return useFullTimeWords
|
|
952
|
-
? ( localize('date.fromNow.minutes.plural.ago.fullWord', '{0} minutes ago', value))
|
|
953
|
-
: ( localize('date.fromNow.minutes.plural.ago', '{0} mins ago', value));
|
|
968
|
+
? ( (localize('date.fromNow.minutes.plural.ago.fullWord', '{0} minutes ago', value)))
|
|
969
|
+
: ( (localize('date.fromNow.minutes.plural.ago', '{0} mins ago', value)));
|
|
954
970
|
}
|
|
955
971
|
}
|
|
956
972
|
else {
|
|
957
973
|
if (value === 1) {
|
|
958
974
|
return useFullTimeWords
|
|
959
|
-
? ( localize('date.fromNow.minutes.singular.fullWord', '{0} minute', value))
|
|
960
|
-
: ( localize('date.fromNow.minutes.singular', '{0} min', value));
|
|
975
|
+
? ( (localize('date.fromNow.minutes.singular.fullWord', '{0} minute', value)))
|
|
976
|
+
: ( (localize('date.fromNow.minutes.singular', '{0} min', value)));
|
|
961
977
|
}
|
|
962
978
|
else {
|
|
963
979
|
return useFullTimeWords
|
|
964
|
-
? ( localize('date.fromNow.minutes.plural.fullWord', '{0} minutes', value))
|
|
965
|
-
: ( localize('date.fromNow.minutes.plural', '{0} mins', value));
|
|
980
|
+
? ( (localize('date.fromNow.minutes.plural.fullWord', '{0} minutes', value)))
|
|
981
|
+
: ( (localize('date.fromNow.minutes.plural', '{0} mins', value)));
|
|
966
982
|
}
|
|
967
983
|
}
|
|
968
984
|
}
|
|
@@ -971,25 +987,25 @@ function fromNow(date, appendAgoLabel, useFullTimeWords) {
|
|
|
971
987
|
if (appendAgoLabel) {
|
|
972
988
|
if (value === 1) {
|
|
973
989
|
return useFullTimeWords
|
|
974
|
-
? ( localize('date.fromNow.hours.singular.ago.fullWord', '{0} hour ago', value))
|
|
975
|
-
: ( localize('date.fromNow.hours.singular.ago', '{0} hr ago', value));
|
|
990
|
+
? ( (localize('date.fromNow.hours.singular.ago.fullWord', '{0} hour ago', value)))
|
|
991
|
+
: ( (localize('date.fromNow.hours.singular.ago', '{0} hr ago', value)));
|
|
976
992
|
}
|
|
977
993
|
else {
|
|
978
994
|
return useFullTimeWords
|
|
979
|
-
? ( localize('date.fromNow.hours.plural.ago.fullWord', '{0} hours ago', value))
|
|
980
|
-
: ( localize('date.fromNow.hours.plural.ago', '{0} hrs ago', value));
|
|
995
|
+
? ( (localize('date.fromNow.hours.plural.ago.fullWord', '{0} hours ago', value)))
|
|
996
|
+
: ( (localize('date.fromNow.hours.plural.ago', '{0} hrs ago', value)));
|
|
981
997
|
}
|
|
982
998
|
}
|
|
983
999
|
else {
|
|
984
1000
|
if (value === 1) {
|
|
985
1001
|
return useFullTimeWords
|
|
986
|
-
? ( localize('date.fromNow.hours.singular.fullWord', '{0} hour', value))
|
|
987
|
-
: ( localize('date.fromNow.hours.singular', '{0} hr', value));
|
|
1002
|
+
? ( (localize('date.fromNow.hours.singular.fullWord', '{0} hour', value)))
|
|
1003
|
+
: ( (localize('date.fromNow.hours.singular', '{0} hr', value)));
|
|
988
1004
|
}
|
|
989
1005
|
else {
|
|
990
1006
|
return useFullTimeWords
|
|
991
|
-
? ( localize('date.fromNow.hours.plural.fullWord', '{0} hours', value))
|
|
992
|
-
: ( localize('date.fromNow.hours.plural', '{0} hrs', value));
|
|
1007
|
+
? ( (localize('date.fromNow.hours.plural.fullWord', '{0} hours', value)))
|
|
1008
|
+
: ( (localize('date.fromNow.hours.plural', '{0} hrs', value)));
|
|
993
1009
|
}
|
|
994
1010
|
}
|
|
995
1011
|
}
|
|
@@ -997,13 +1013,13 @@ function fromNow(date, appendAgoLabel, useFullTimeWords) {
|
|
|
997
1013
|
value = Math.floor(seconds / day);
|
|
998
1014
|
if (appendAgoLabel) {
|
|
999
1015
|
return value === 1
|
|
1000
|
-
? ( localize('date.fromNow.days.singular.ago', '{0} day ago', value))
|
|
1001
|
-
: ( localize('date.fromNow.days.plural.ago', '{0} days ago', value));
|
|
1016
|
+
? ( (localize('date.fromNow.days.singular.ago', '{0} day ago', value)))
|
|
1017
|
+
: ( (localize('date.fromNow.days.plural.ago', '{0} days ago', value)));
|
|
1002
1018
|
}
|
|
1003
1019
|
else {
|
|
1004
1020
|
return value === 1
|
|
1005
|
-
? ( localize('date.fromNow.days.singular', '{0} day', value))
|
|
1006
|
-
: ( localize('date.fromNow.days.plural', '{0} days', value));
|
|
1021
|
+
? ( (localize('date.fromNow.days.singular', '{0} day', value)))
|
|
1022
|
+
: ( (localize('date.fromNow.days.plural', '{0} days', value)));
|
|
1007
1023
|
}
|
|
1008
1024
|
}
|
|
1009
1025
|
if (seconds < month) {
|
|
@@ -1011,25 +1027,25 @@ function fromNow(date, appendAgoLabel, useFullTimeWords) {
|
|
|
1011
1027
|
if (appendAgoLabel) {
|
|
1012
1028
|
if (value === 1) {
|
|
1013
1029
|
return useFullTimeWords
|
|
1014
|
-
? ( localize('date.fromNow.weeks.singular.ago.fullWord', '{0} week ago', value))
|
|
1015
|
-
: ( localize('date.fromNow.weeks.singular.ago', '{0} wk ago', value));
|
|
1030
|
+
? ( (localize('date.fromNow.weeks.singular.ago.fullWord', '{0} week ago', value)))
|
|
1031
|
+
: ( (localize('date.fromNow.weeks.singular.ago', '{0} wk ago', value)));
|
|
1016
1032
|
}
|
|
1017
1033
|
else {
|
|
1018
1034
|
return useFullTimeWords
|
|
1019
|
-
? ( localize('date.fromNow.weeks.plural.ago.fullWord', '{0} weeks ago', value))
|
|
1020
|
-
: ( localize('date.fromNow.weeks.plural.ago', '{0} wks ago', value));
|
|
1035
|
+
? ( (localize('date.fromNow.weeks.plural.ago.fullWord', '{0} weeks ago', value)))
|
|
1036
|
+
: ( (localize('date.fromNow.weeks.plural.ago', '{0} wks ago', value)));
|
|
1021
1037
|
}
|
|
1022
1038
|
}
|
|
1023
1039
|
else {
|
|
1024
1040
|
if (value === 1) {
|
|
1025
1041
|
return useFullTimeWords
|
|
1026
|
-
? ( localize('date.fromNow.weeks.singular.fullWord', '{0} week', value))
|
|
1027
|
-
: ( localize('date.fromNow.weeks.singular', '{0} wk', value));
|
|
1042
|
+
? ( (localize('date.fromNow.weeks.singular.fullWord', '{0} week', value)))
|
|
1043
|
+
: ( (localize('date.fromNow.weeks.singular', '{0} wk', value)));
|
|
1028
1044
|
}
|
|
1029
1045
|
else {
|
|
1030
1046
|
return useFullTimeWords
|
|
1031
|
-
? ( localize('date.fromNow.weeks.plural.fullWord', '{0} weeks', value))
|
|
1032
|
-
: ( localize('date.fromNow.weeks.plural', '{0} wks', value));
|
|
1047
|
+
? ( (localize('date.fromNow.weeks.plural.fullWord', '{0} weeks', value)))
|
|
1048
|
+
: ( (localize('date.fromNow.weeks.plural', '{0} wks', value)));
|
|
1033
1049
|
}
|
|
1034
1050
|
}
|
|
1035
1051
|
}
|
|
@@ -1038,25 +1054,25 @@ function fromNow(date, appendAgoLabel, useFullTimeWords) {
|
|
|
1038
1054
|
if (appendAgoLabel) {
|
|
1039
1055
|
if (value === 1) {
|
|
1040
1056
|
return useFullTimeWords
|
|
1041
|
-
? ( localize('date.fromNow.months.singular.ago.fullWord', '{0} month ago', value))
|
|
1042
|
-
: ( localize('date.fromNow.months.singular.ago', '{0} mo ago', value));
|
|
1057
|
+
? ( (localize('date.fromNow.months.singular.ago.fullWord', '{0} month ago', value)))
|
|
1058
|
+
: ( (localize('date.fromNow.months.singular.ago', '{0} mo ago', value)));
|
|
1043
1059
|
}
|
|
1044
1060
|
else {
|
|
1045
1061
|
return useFullTimeWords
|
|
1046
|
-
? ( localize('date.fromNow.months.plural.ago.fullWord', '{0} months ago', value))
|
|
1047
|
-
: ( localize('date.fromNow.months.plural.ago', '{0} mos ago', value));
|
|
1062
|
+
? ( (localize('date.fromNow.months.plural.ago.fullWord', '{0} months ago', value)))
|
|
1063
|
+
: ( (localize('date.fromNow.months.plural.ago', '{0} mos ago', value)));
|
|
1048
1064
|
}
|
|
1049
1065
|
}
|
|
1050
1066
|
else {
|
|
1051
1067
|
if (value === 1) {
|
|
1052
1068
|
return useFullTimeWords
|
|
1053
|
-
? ( localize('date.fromNow.months.singular.fullWord', '{0} month', value))
|
|
1054
|
-
: ( localize('date.fromNow.months.singular', '{0} mo', value));
|
|
1069
|
+
? ( (localize('date.fromNow.months.singular.fullWord', '{0} month', value)))
|
|
1070
|
+
: ( (localize('date.fromNow.months.singular', '{0} mo', value)));
|
|
1055
1071
|
}
|
|
1056
1072
|
else {
|
|
1057
1073
|
return useFullTimeWords
|
|
1058
|
-
? ( localize('date.fromNow.months.plural.fullWord', '{0} months', value))
|
|
1059
|
-
: ( localize('date.fromNow.months.plural', '{0} mos', value));
|
|
1074
|
+
? ( (localize('date.fromNow.months.plural.fullWord', '{0} months', value)))
|
|
1075
|
+
: ( (localize('date.fromNow.months.plural', '{0} mos', value)));
|
|
1060
1076
|
}
|
|
1061
1077
|
}
|
|
1062
1078
|
}
|
|
@@ -1064,25 +1080,25 @@ function fromNow(date, appendAgoLabel, useFullTimeWords) {
|
|
|
1064
1080
|
if (appendAgoLabel) {
|
|
1065
1081
|
if (value === 1) {
|
|
1066
1082
|
return useFullTimeWords
|
|
1067
|
-
? ( localize('date.fromNow.years.singular.ago.fullWord', '{0} year ago', value))
|
|
1068
|
-
: ( localize('date.fromNow.years.singular.ago', '{0} yr ago', value));
|
|
1083
|
+
? ( (localize('date.fromNow.years.singular.ago.fullWord', '{0} year ago', value)))
|
|
1084
|
+
: ( (localize('date.fromNow.years.singular.ago', '{0} yr ago', value)));
|
|
1069
1085
|
}
|
|
1070
1086
|
else {
|
|
1071
1087
|
return useFullTimeWords
|
|
1072
|
-
? ( localize('date.fromNow.years.plural.ago.fullWord', '{0} years ago', value))
|
|
1073
|
-
: ( localize('date.fromNow.years.plural.ago', '{0} yrs ago', value));
|
|
1088
|
+
? ( (localize('date.fromNow.years.plural.ago.fullWord', '{0} years ago', value)))
|
|
1089
|
+
: ( (localize('date.fromNow.years.plural.ago', '{0} yrs ago', value)));
|
|
1074
1090
|
}
|
|
1075
1091
|
}
|
|
1076
1092
|
else {
|
|
1077
1093
|
if (value === 1) {
|
|
1078
1094
|
return useFullTimeWords
|
|
1079
|
-
? ( localize('date.fromNow.years.singular.fullWord', '{0} year', value))
|
|
1080
|
-
: ( localize('date.fromNow.years.singular', '{0} yr', value));
|
|
1095
|
+
? ( (localize('date.fromNow.years.singular.fullWord', '{0} year', value)))
|
|
1096
|
+
: ( (localize('date.fromNow.years.singular', '{0} yr', value)));
|
|
1081
1097
|
}
|
|
1082
1098
|
else {
|
|
1083
1099
|
return useFullTimeWords
|
|
1084
|
-
? ( localize('date.fromNow.years.plural.fullWord', '{0} years', value))
|
|
1085
|
-
: ( localize('date.fromNow.years.plural', '{0} yrs', value));
|
|
1100
|
+
? ( (localize('date.fromNow.years.plural.fullWord', '{0} years', value)))
|
|
1101
|
+
: ( (localize('date.fromNow.years.plural', '{0} yrs', value)));
|
|
1086
1102
|
}
|
|
1087
1103
|
}
|
|
1088
1104
|
}
|
|
@@ -1104,13 +1120,13 @@ let BrowserDialogHandler = class BrowserDialogHandler {
|
|
|
1104
1120
|
buttons.push(confirmation.primaryButton);
|
|
1105
1121
|
}
|
|
1106
1122
|
else {
|
|
1107
|
-
buttons.push(( localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes")));
|
|
1123
|
+
buttons.push(( (localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes"))));
|
|
1108
1124
|
}
|
|
1109
1125
|
if (confirmation.secondaryButton) {
|
|
1110
1126
|
buttons.push(confirmation.secondaryButton);
|
|
1111
1127
|
}
|
|
1112
1128
|
else if (typeof confirmation.secondaryButton === 'undefined') {
|
|
1113
|
-
buttons.push(( localize('cancelButton', "Cancel")));
|
|
1129
|
+
buttons.push(( (localize('cancelButton', "Cancel"))));
|
|
1114
1130
|
}
|
|
1115
1131
|
const result = await this.doShow(confirmation.type, confirmation.message, buttons, confirmation.detail, 1, confirmation.checkbox);
|
|
1116
1132
|
return { confirmed: result.button === 0, checkboxChecked: result.checkboxChecked };
|
|
@@ -1127,7 +1143,7 @@ let BrowserDialogHandler = class BrowserDialogHandler {
|
|
|
1127
1143
|
};
|
|
1128
1144
|
}
|
|
1129
1145
|
async doShow(type, message, buttons, detail, cancelId, checkbox, inputs, customOptions) {
|
|
1130
|
-
const dialogDisposables = ( new DisposableStore());
|
|
1146
|
+
const dialogDisposables = ( (new DisposableStore()));
|
|
1131
1147
|
const renderBody = customOptions ? (parent) => {
|
|
1132
1148
|
parent.classList.add(...(customOptions.classes || []));
|
|
1133
1149
|
customOptions.markdownDetails?.forEach(markdownDetail => {
|
|
@@ -1137,7 +1153,7 @@ let BrowserDialogHandler = class BrowserDialogHandler {
|
|
|
1137
1153
|
dialogDisposables.add(result);
|
|
1138
1154
|
});
|
|
1139
1155
|
} : undefined;
|
|
1140
|
-
const dialog = ( new Dialog(this.layoutService.container, message, buttons, {
|
|
1156
|
+
const dialog = ( (new Dialog(this.layoutService.container, message, buttons, {
|
|
1141
1157
|
detail,
|
|
1142
1158
|
cancelId,
|
|
1143
1159
|
type,
|
|
@@ -1156,7 +1172,7 @@ let BrowserDialogHandler = class BrowserDialogHandler {
|
|
|
1156
1172
|
checkboxLabel: checkbox?.label,
|
|
1157
1173
|
checkboxChecked: checkbox?.checked,
|
|
1158
1174
|
inputs
|
|
1159
|
-
}));
|
|
1175
|
+
})));
|
|
1160
1176
|
dialogDisposables.add(dialog);
|
|
1161
1177
|
dialogDisposables.add(attachDialogStyler(dialog, this.themeService));
|
|
1162
1178
|
const result = await dialog.show();
|
|
@@ -1174,18 +1190,20 @@ let BrowserDialogHandler = class BrowserDialogHandler {
|
|
|
1174
1190
|
}
|
|
1175
1191
|
async about() {
|
|
1176
1192
|
const detailString = (useAgo) => {
|
|
1177
|
-
return (
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1193
|
+
return (
|
|
1194
|
+
(localize(
|
|
1195
|
+
'aboutDetail',
|
|
1196
|
+
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
|
1197
|
+
this.productService.version || 'Unknown',
|
|
1198
|
+
this.productService.commit || 'Unknown',
|
|
1199
|
+
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(( new Date(this.productService.date)), true) + ')' : ''}` : 'Unknown',
|
|
1200
|
+
navigator.userAgent
|
|
1201
|
+
))
|
|
1202
|
+
);
|
|
1185
1203
|
};
|
|
1186
1204
|
const detail = detailString(true);
|
|
1187
1205
|
const detailToCopy = detailString(false);
|
|
1188
|
-
const { choice } = await this.show(Severity.Info, this.productService.nameLong, [( localize('copy', "Copy")), ( localize('ok', "OK"))], { detail, cancelId: 1 });
|
|
1206
|
+
const { choice } = await this.show(Severity.Info, this.productService.nameLong, [( (localize('copy', "Copy"))), ( (localize('ok', "OK")))], { detail, cancelId: 1 });
|
|
1189
1207
|
if (choice === 0) {
|
|
1190
1208
|
this.clipboardService.writeText(detailToCopy);
|
|
1191
1209
|
}
|
|
@@ -1199,20 +1217,20 @@ BrowserDialogHandler.ALLOWABLE_COMMANDS = [
|
|
|
1199
1217
|
'editor.action.clipboardCutAction',
|
|
1200
1218
|
'editor.action.clipboardPasteAction'
|
|
1201
1219
|
];
|
|
1202
|
-
BrowserDialogHandler = ( __decorate([
|
|
1203
|
-
( __param(0, ILogService)),
|
|
1204
|
-
( __param(1, ILayoutService)),
|
|
1205
|
-
( __param(2, IThemeService)),
|
|
1206
|
-
( __param(3, IKeybindingService)),
|
|
1207
|
-
( __param(4, IInstantiationService)),
|
|
1208
|
-
( __param(5, IProductService)),
|
|
1209
|
-
( __param(6, IClipboardService))
|
|
1210
|
-
], BrowserDialogHandler));
|
|
1220
|
+
BrowserDialogHandler = ( (__decorate([
|
|
1221
|
+
( (__param(0, ILogService))),
|
|
1222
|
+
( (__param(1, ILayoutService))),
|
|
1223
|
+
( (__param(2, IThemeService))),
|
|
1224
|
+
( (__param(3, IKeybindingService))),
|
|
1225
|
+
( (__param(4, IInstantiationService))),
|
|
1226
|
+
( (__param(5, IProductService))),
|
|
1227
|
+
( (__param(6, IClipboardService)))
|
|
1228
|
+
], BrowserDialogHandler)));
|
|
1211
1229
|
let DialogHandlerContribution = class DialogHandlerContribution extends Disposable {
|
|
1212
1230
|
constructor(dialogService, logService, layoutService, themeService, keybindingService, instantiationService, productService, clipboardService) {
|
|
1213
1231
|
super();
|
|
1214
1232
|
this.dialogService = dialogService;
|
|
1215
|
-
this.impl = ( new BrowserDialogHandler(
|
|
1233
|
+
this.impl = ( (new BrowserDialogHandler(
|
|
1216
1234
|
logService,
|
|
1217
1235
|
layoutService,
|
|
1218
1236
|
themeService,
|
|
@@ -1220,7 +1238,7 @@ let DialogHandlerContribution = class DialogHandlerContribution extends Disposab
|
|
|
1220
1238
|
instantiationService,
|
|
1221
1239
|
productService,
|
|
1222
1240
|
clipboardService
|
|
1223
|
-
));
|
|
1241
|
+
)));
|
|
1224
1242
|
this.model = this.dialogService.model;
|
|
1225
1243
|
this._register(this.model.onWillShowDialog(() => {
|
|
1226
1244
|
if (!this.currentDialog) {
|
|
@@ -1253,16 +1271,16 @@ let DialogHandlerContribution = class DialogHandlerContribution extends Disposab
|
|
|
1253
1271
|
}
|
|
1254
1272
|
}
|
|
1255
1273
|
};
|
|
1256
|
-
DialogHandlerContribution = ( __decorate([
|
|
1257
|
-
( __param(0, IDialogService)),
|
|
1258
|
-
( __param(1, ILogService)),
|
|
1259
|
-
( __param(2, ILayoutService)),
|
|
1260
|
-
( __param(3, IThemeService)),
|
|
1261
|
-
( __param(4, IKeybindingService)),
|
|
1262
|
-
( __param(5, IInstantiationService)),
|
|
1263
|
-
( __param(6, IProductService)),
|
|
1264
|
-
( __param(7, IClipboardService))
|
|
1265
|
-
], DialogHandlerContribution));
|
|
1274
|
+
DialogHandlerContribution = ( (__decorate([
|
|
1275
|
+
( (__param(0, IDialogService))),
|
|
1276
|
+
( (__param(1, ILogService))),
|
|
1277
|
+
( (__param(2, ILayoutService))),
|
|
1278
|
+
( (__param(3, IThemeService))),
|
|
1279
|
+
( (__param(4, IKeybindingService))),
|
|
1280
|
+
( (__param(5, IInstantiationService))),
|
|
1281
|
+
( (__param(6, IProductService))),
|
|
1282
|
+
( (__param(7, IClipboardService)))
|
|
1283
|
+
], DialogHandlerContribution)));
|
|
1266
1284
|
class LayoutService {
|
|
1267
1285
|
constructor(container) {
|
|
1268
1286
|
this.container = container;
|
|
@@ -1294,8 +1312,8 @@ function initialize(instantiationService) {
|
|
|
1294
1312
|
function getServiceOverride(container = document.body) {
|
|
1295
1313
|
onServicesInitialized(initialize);
|
|
1296
1314
|
return {
|
|
1297
|
-
[ILayoutService.toString()]: new SyncDescriptor(LayoutService, [container]),
|
|
1298
|
-
[IWorkbenchLayoutService.toString()]: new SyncDescriptor(LayoutService, [container])
|
|
1315
|
+
[( ILayoutService.toString())]: new SyncDescriptor(LayoutService, [container]),
|
|
1316
|
+
[( IWorkbenchLayoutService.toString())]: new SyncDescriptor(LayoutService, [container])
|
|
1299
1317
|
};
|
|
1300
1318
|
}
|
|
1301
|
-
export { ButtonBar as B, DialogHandlerContribution as D,
|
|
1319
|
+
export { ButtonBar as B, DialogHandlerContribution as D, attachButtonStyler as a, attachProgressBarStyler as b, getServiceOverride as g, n };
|