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