@codingame/monaco-vscode-dialogs-service-override 25.1.2 → 26.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-dialogs-service-override",
3
- "version": "25.1.2",
3
+ "version": "26.0.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - dialogs service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "25.1.2"
18
+ "@codingame/monaco-vscode-api": "26.0.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -16,8 +16,20 @@ import { createBrowserAboutDialogDetails } from '@codingame/monaco-vscode-api/vs
16
16
  import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service';
17
17
 
18
18
  let DialogHandlerContribution = class DialogHandlerContribution extends Disposable {
19
- static { this.ID = 'workbench.contrib.dialogHandler'; }
20
- constructor(dialogService, logService, layoutService, keybindingService, instantiationService, productService, clipboardService, openerService, markdownRendererService) {
19
+ static {
20
+ this.ID = "workbench.contrib.dialogHandler";
21
+ }
22
+ constructor(
23
+ dialogService,
24
+ logService,
25
+ layoutService,
26
+ keybindingService,
27
+ instantiationService,
28
+ productService,
29
+ clipboardService,
30
+ openerService,
31
+ markdownRendererService
32
+ ) {
21
33
  super();
22
34
  this.dialogService = dialogService;
23
35
  this.productService = productService;
@@ -46,21 +58,21 @@ let DialogHandlerContribution = class DialogHandlerContribution extends Disposab
46
58
  if (this.currentDialog.args.confirmArgs) {
47
59
  const args = this.currentDialog.args.confirmArgs;
48
60
  result = await this.impl.value.confirm(args.confirmation);
49
- }
50
- else if (this.currentDialog.args.inputArgs) {
61
+ } else if (this.currentDialog.args.inputArgs) {
51
62
  const args = this.currentDialog.args.inputArgs;
52
63
  result = await this.impl.value.input(args.input);
53
- }
54
- else if (this.currentDialog.args.promptArgs) {
64
+ } else if (this.currentDialog.args.promptArgs) {
55
65
  const args = this.currentDialog.args.promptArgs;
56
66
  result = await this.impl.value.prompt(args.prompt);
57
- }
58
- else {
67
+ } else {
59
68
  const aboutDialogDetails = createBrowserAboutDialogDetails(this.productService);
60
- await this.impl.value.about(aboutDialogDetails.title, aboutDialogDetails.details, aboutDialogDetails.detailsToCopy);
69
+ await this.impl.value.about(
70
+ aboutDialogDetails.title,
71
+ aboutDialogDetails.details,
72
+ aboutDialogDetails.detailsToCopy
73
+ );
61
74
  }
62
- }
63
- catch (error) {
75
+ } catch (error) {
64
76
  result = error;
65
77
  }
66
78
  this.currentDialog.close(result);
@@ -68,18 +80,11 @@ let DialogHandlerContribution = class DialogHandlerContribution extends Disposab
68
80
  }
69
81
  }
70
82
  };
71
- DialogHandlerContribution = ( __decorate([
72
- ( __param(0, IDialogService)),
73
- ( __param(1, ILogService)),
74
- ( __param(2, ILayoutService)),
75
- ( __param(3, IKeybindingService)),
76
- ( __param(4, IInstantiationService)),
77
- ( __param(5, IProductService)),
78
- ( __param(6, IClipboardService)),
79
- ( __param(7, IOpenerService)),
80
- ( __param(8, IMarkdownRendererService))
81
- ], DialogHandlerContribution));
82
- registerWorkbenchContribution2(DialogHandlerContribution.ID, DialogHandlerContribution, WorkbenchPhase.BlockStartup
83
+ DialogHandlerContribution = ( __decorate([( __param(0, IDialogService)), ( __param(1, ILogService)), ( __param(2, ILayoutService)), ( __param(3, IKeybindingService)), ( __param(4, IInstantiationService)), ( __param(5, IProductService)), ( __param(6, IClipboardService)), ( __param(7, IOpenerService)), ( __param(8, IMarkdownRendererService))], DialogHandlerContribution));
84
+ registerWorkbenchContribution2(
85
+ DialogHandlerContribution.ID,
86
+ DialogHandlerContribution,
87
+ WorkbenchPhase.BlockStartup
83
88
  );
84
89
 
85
90
  export { DialogHandlerContribution };
@@ -17,16 +17,28 @@ import { createWorkbenchDialogOptions } from '@codingame/monaco-vscode-api/vscod
17
17
 
18
18
  var BrowserDialogHandler_1;
19
19
  let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHandler {
20
- static { BrowserDialogHandler_1 = this; }
21
- static { this.ALLOWABLE_COMMANDS = [
22
- 'copy',
23
- 'cut',
24
- 'editor.action.selectAll',
25
- 'editor.action.clipboardCopyAction',
26
- 'editor.action.clipboardCutAction',
27
- 'editor.action.clipboardPasteAction'
28
- ]; }
29
- constructor(logService, layoutService, keybindingService, instantiationService, clipboardService, openerService, markdownRendererService) {
20
+ static {
21
+ BrowserDialogHandler_1 = this;
22
+ }
23
+ static {
24
+ this.ALLOWABLE_COMMANDS = [
25
+ "copy",
26
+ "cut",
27
+ "editor.action.selectAll",
28
+ "editor.action.clipboardCopyAction",
29
+ "editor.action.clipboardCutAction",
30
+ "editor.action.clipboardPasteAction"
31
+ ];
32
+ }
33
+ constructor(
34
+ logService,
35
+ layoutService,
36
+ keybindingService,
37
+ instantiationService,
38
+ clipboardService,
39
+ openerService,
40
+ markdownRendererService
41
+ ) {
30
42
  super();
31
43
  this.logService = logService;
32
44
  this.layoutService = layoutService;
@@ -36,41 +48,89 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
36
48
  this.markdownRendererService = markdownRendererService;
37
49
  }
38
50
  async prompt(prompt) {
39
- this.logService.trace('DialogService#prompt', prompt.message);
51
+ this.logService.trace("DialogService#prompt", prompt.message);
40
52
  const buttons = this.getPromptButtons(prompt);
41
- const { button, checkboxChecked } = await this.doShow(prompt.type, prompt.message, buttons, prompt.detail, prompt.cancelButton ? buttons.length - 1 : -1 , prompt.checkbox, undefined, typeof prompt?.custom === 'object' ? prompt.custom : undefined);
53
+ const {
54
+ button,
55
+ checkboxChecked
56
+ } = await this.doShow(
57
+ prompt.type,
58
+ prompt.message,
59
+ buttons,
60
+ prompt.detail,
61
+ prompt.cancelButton ? buttons.length - 1 : -1,
62
+ prompt.checkbox,
63
+ undefined,
64
+ typeof prompt?.custom === "object" ? prompt.custom : undefined
65
+ );
42
66
  return this.getPromptResult(prompt, button, checkboxChecked);
43
67
  }
44
68
  async confirm(confirmation) {
45
- this.logService.trace('DialogService#confirm', confirmation.message);
69
+ this.logService.trace("DialogService#confirm", confirmation.message);
46
70
  const buttons = this.getConfirmationButtons(confirmation);
47
- const { button, checkboxChecked } = await this.doShow(confirmation.type ?? 'question', confirmation.message, buttons, confirmation.detail, buttons.length - 1, confirmation.checkbox, undefined, typeof confirmation?.custom === 'object' ? confirmation.custom : undefined);
48
- return { confirmed: button === 0, checkboxChecked };
71
+ const {
72
+ button,
73
+ checkboxChecked
74
+ } = await this.doShow(
75
+ confirmation.type ?? "question",
76
+ confirmation.message,
77
+ buttons,
78
+ confirmation.detail,
79
+ buttons.length - 1,
80
+ confirmation.checkbox,
81
+ undefined,
82
+ typeof confirmation?.custom === "object" ? confirmation.custom : undefined
83
+ );
84
+ return {
85
+ confirmed: button === 0,
86
+ checkboxChecked
87
+ };
49
88
  }
50
89
  async input(input) {
51
- this.logService.trace('DialogService#input', input.message);
90
+ this.logService.trace("DialogService#input", input.message);
52
91
  const buttons = this.getInputButtons(input);
53
- const { button, checkboxChecked, values } = await this.doShow(input.type ?? 'question', input.message, buttons, input.detail, buttons.length - 1, input?.checkbox, input.inputs, typeof input.custom === 'object' ? input.custom : undefined);
54
- return { confirmed: button === 0, checkboxChecked, values };
92
+ const {
93
+ button,
94
+ checkboxChecked,
95
+ values
96
+ } = await this.doShow(
97
+ input.type ?? "question",
98
+ input.message,
99
+ buttons,
100
+ input.detail,
101
+ buttons.length - 1,
102
+ input?.checkbox,
103
+ input.inputs,
104
+ typeof input.custom === "object" ? input.custom : undefined
105
+ );
106
+ return {
107
+ confirmed: button === 0,
108
+ checkboxChecked,
109
+ values
110
+ };
55
111
  }
56
112
  async about(title, details, detailsToCopy) {
57
- const { button } = await this.doShow(Severity.Info, title, [
58
- ( localize(3047, "&&Copy")),
59
- ( localize(3048, "OK"))
60
- ], details, 1);
113
+ const {
114
+ button
115
+ } = await this.doShow(Severity.Info, title, [( localize(3051, "&&Copy")), ( localize(3052, "OK"))], details, 1);
61
116
  if (button === 0) {
62
117
  this.clipboardService.writeText(detailsToCopy);
63
118
  }
64
119
  }
65
120
  async doShow(type, message, buttons, detail, cancelId, checkbox, inputs, customOptions) {
66
121
  const dialogDisposables = ( new DisposableStore());
67
- const renderBody = customOptions ? (parent) => {
122
+ const renderBody = customOptions ? parent => {
68
123
  parent.classList.add(...(customOptions.classes || []));
69
124
  customOptions.markdownDetails?.forEach(markdownDetail => {
70
125
  const result = dialogDisposables.add(this.markdownRendererService.render(markdownDetail.markdown, {
71
126
  actionHandler: markdownDetail.actionHandler || ((link, mdStr) => {
72
- return openLinkFromMarkdown(this.openerService, link, mdStr.isTrusted, true );
73
- }),
127
+ return openLinkFromMarkdown(
128
+ this.openerService,
129
+ link,
130
+ mdStr.isTrusted,
131
+ true
132
+ );
133
+ })
74
134
  }));
75
135
  parent.appendChild(result.element);
76
136
  result.element.classList.add(...(markdownDetail.classes || []));
@@ -87,7 +147,9 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
87
147
  renderBody,
88
148
  icon: customOptions?.icon,
89
149
  disableCloseAction: customOptions?.disableCloseAction,
90
- buttonOptions: customOptions?.buttonDetails?.map(detail => ({ sublabel: detail })),
150
+ buttonOptions: customOptions?.buttonDetails?.map(detail => ({
151
+ sublabel: detail
152
+ })),
91
153
  checkboxLabel: checkbox?.label,
92
154
  checkboxChecked: checkbox?.checked,
93
155
  inputs
@@ -99,14 +161,6 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
99
161
  return result;
100
162
  }
101
163
  };
102
- BrowserDialogHandler = BrowserDialogHandler_1 = ( __decorate([
103
- ( __param(0, ILogService)),
104
- ( __param(1, ILayoutService)),
105
- ( __param(2, IKeybindingService)),
106
- ( __param(3, IInstantiationService)),
107
- ( __param(4, IClipboardService)),
108
- ( __param(5, IOpenerService)),
109
- ( __param(6, IMarkdownRendererService))
110
- ], BrowserDialogHandler));
164
+ BrowserDialogHandler = BrowserDialogHandler_1 = ( __decorate([( __param(0, ILogService)), ( __param(1, ILayoutService)), ( __param(2, IKeybindingService)), ( __param(3, IInstantiationService)), ( __param(4, IClipboardService)), ( __param(5, IOpenerService)), ( __param(6, IMarkdownRendererService))], BrowserDialogHandler));
111
165
 
112
166
  export { BrowserDialogHandler };
@@ -20,8 +20,7 @@ class DialogsModel extends Disposable {
20
20
  this.dialogs.splice(0, 1);
21
21
  if (result instanceof Error) {
22
22
  promise.error(result);
23
- }
24
- else {
23
+ } else {
25
24
  promise.complete(result);
26
25
  }
27
26
  this._onDidShowDialog.fire();