@codingame/monaco-vscode-update-service-override 30.0.0 → 31.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.
Files changed (23) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/update/common/update.config.contribution.js +23 -46
  3. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +14 -14
  4. package/vscode/src/vs/workbench/contrib/update/browser/media/postUpdateWidget.css +68 -0
  5. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTitleBarEntry.css +2 -20
  6. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTooltip.css +32 -26
  7. package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.d.ts +35 -0
  8. package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.js +219 -0
  9. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.d.ts +1 -7
  10. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +5 -177
  11. package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +44 -17
  12. package/vscode/src/vs/workbench/contrib/update/browser/update.d.ts +1 -17
  13. package/vscode/src/vs/workbench/contrib/update/browser/update.js +40 -279
  14. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.d.ts +5 -7
  15. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.js +83 -78
  16. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.d.ts +6 -12
  17. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.js +83 -125
  18. package/vscode/src/vs/workbench/contrib/update/common/updateInfoParser.d.ts +42 -0
  19. package/vscode/src/vs/workbench/contrib/update/common/updateInfoParser.js +74 -0
  20. package/vscode/src/vs/workbench/contrib/update/common/updateUtils.js +9 -21
  21. package/vscode/src/vs/workbench/contrib/update/browser/media/updateStatusBarEntry.css +0 -9
  22. package/vscode/src/vs/workbench/contrib/update/browser/updateStatusBarEntry.d.ts +0 -22
  23. package/vscode/src/vs/workbench/contrib/update/browser/updateStatusBarEntry.js +0 -140
@@ -2,71 +2,41 @@
2
2
  import { registerCss } from '@codingame/monaco-vscode-api/css';
3
3
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
4
  import { $, append, addDisposableListener, clearNode, createTextNode } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
5
- import { ActionBar } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionbar';
6
- import { toAction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
7
- import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
8
5
  import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
9
- import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
10
- import { Disposable, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
11
7
  import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
12
8
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
13
9
  import { IClipboardService } from '@codingame/monaco-vscode-api/vscode/vs/platform/clipboard/common/clipboardService.service';
14
10
  import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
15
11
  import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
16
- import { nativeHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover';
17
12
  import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
18
- import { openLinkFromMarkdown } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer';
19
- import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service';
20
13
  import { IMeteredConnectionService } from '@codingame/monaco-vscode-api/vscode/vs/platform/meteredConnection/common/meteredConnection.service';
21
- import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
22
14
  import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
23
- import { asTextOrError } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request';
24
- import { IRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service';
25
15
  import { StateType, DisablementReason } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update';
26
- import { computeProgressPercent, formatBytes, computeDownloadSpeed, computeDownloadTimeRemaining, formatTimeRemaining, getUpdateInfoUrl, tryParseDate, formatDate } from '../common/updateUtils.js';
16
+ import { ShowCurrentReleaseNotesActionId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/update/common/update';
17
+ import { computeProgressPercent, formatBytes, computeDownloadSpeed, computeDownloadTimeRemaining, formatTimeRemaining, tryParseDate, formatDate } from '../common/updateUtils.js';
27
18
  import * as updateTooltip from './media/updateTooltip.css';
28
19
 
29
20
  registerCss(updateTooltip);
30
21
  let UpdateTooltip = class UpdateTooltip extends Disposable {
31
22
  constructor(
32
- hostedByTitleBar,
33
23
  clipboardService,
34
24
  commandService,
35
25
  configurationService,
36
26
  hoverService,
37
- markdownRendererService,
38
27
  meteredConnectionService,
39
- openerService,
40
- productService,
41
- requestService
28
+ productService
42
29
  ) {
43
30
  super();
44
- this.hostedByTitleBar = hostedByTitleBar;
45
31
  this.clipboardService = clipboardService;
46
32
  this.commandService = commandService;
47
33
  this.configurationService = configurationService;
48
34
  this.hoverService = hoverService;
49
- this.markdownRendererService = markdownRendererService;
50
35
  this.meteredConnectionService = meteredConnectionService;
51
- this.openerService = openerService;
52
36
  this.productService = productService;
53
- this.requestService = requestService;
54
- this.markdown = this._register(( new MutableDisposable()));
55
37
  this.domNode = $(".update-tooltip");
56
38
  const header = append(this.domNode, $(".header"));
57
39
  this.titleNode = append(header, $(".title"));
58
- const actionBar = this._register(( new ActionBar(header, {
59
- hoverDelegate: nativeHoverDelegate
60
- })));
61
- actionBar.push(toAction({
62
- id: "update.openSettings",
63
- label: ( localize(14878, "Update Settings")),
64
- class: ThemeIcon.asClassName(Codicon.gear),
65
- run: () => this.runCommandAndClose("workbench.action.openSettings", "@id:update*")
66
- }), {
67
- icon: true,
68
- label: false
69
- });
70
40
  this.productInfoNode = append(this.domNode, $(".product-info"));
71
41
  const logoContainer = append(this.productInfoNode, $(".product-logo"));
72
42
  logoContainer.setAttribute("role", "img");
@@ -81,15 +51,6 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
81
51
  this.latestVersionNode = latestVersionRow.label;
82
52
  this.latestVersionCopyValue = latestVersionRow.copyValue;
83
53
  this.releaseDateNode = append(details, $(".product-release-date"));
84
- this.releaseNotesLink = append(details, $("a.release-notes-link"));
85
- this.releaseNotesLink.textContent = ( localize(14879, "Release Notes"));
86
- this.releaseNotesLink.href = "#";
87
- this._register(addDisposableListener(this.releaseNotesLink, "click", e => {
88
- e.preventDefault();
89
- if (this.releaseNotesVersion) {
90
- this.runCommandAndClose("update.showCurrentReleaseNotes", this.releaseNotesVersion);
91
- }
92
- }));
93
54
  this.progressContainer = append(this.domNode, $(".progress-container"));
94
55
  const progressBar = append(this.progressContainer, $(".progress-bar"));
95
56
  this.progressFill = append(progressBar, $(".progress-fill"));
@@ -99,15 +60,29 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
99
60
  this.downloadStatsContainer = append(this.progressContainer, $(".download-stats"));
100
61
  this.timeRemainingNode = append(this.downloadStatsContainer, $(".time-remaining"));
101
62
  this.speedInfoNode = append(this.downloadStatsContainer, $(".speed-info"));
102
- this.markdownContainer = append(this.domNode, $(".update-markdown"));
103
63
  this.messageNode = append(this.domNode, $(".state-message"));
64
+ this.buttonBar = append(this.domNode, $(".button-bar"));
65
+ this.releaseNotesButton = append(this.buttonBar, $("button.release-notes-button"));
66
+ this.releaseNotesButton.textContent = ( localize(15015, "Release Notes"));
67
+ this._register(addDisposableListener(this.releaseNotesButton, "click", () => {
68
+ if (this.releaseNotesVersion) {
69
+ this.runCommandAndClose(ShowCurrentReleaseNotesActionId, this.releaseNotesVersion);
70
+ }
71
+ }));
72
+ this.actionButton = append(this.buttonBar, $("button.action-button"));
73
+ this._register(addDisposableListener(this.actionButton, "click", () => {
74
+ const commandId = this.actionButton.dataset.commandId;
75
+ if (commandId) {
76
+ this.runCommandAndClose(commandId);
77
+ }
78
+ }));
104
79
  this.updateCurrentVersion();
105
80
  }
106
81
  updateCurrentVersion() {
107
82
  const productVersion = this.productService.version;
108
83
  if (productVersion) {
109
84
  const currentCommitId = this.productService.commit?.substring(0, 7);
110
- this.currentVersionNode.textContent = currentCommitId ? ( localize(14880, "Current Version: {0} ({1})", productVersion, currentCommitId)) : ( localize(14881, "Current Version: {0}", productVersion));
85
+ this.currentVersionNode.textContent = currentCommitId ? ( localize(15016, "Current Version: {0} ({1})", productVersion, currentCommitId)) : ( localize(15017, "Current Version: {0}", productVersion));
111
86
  this.currentVersionCopyValue.value = currentCommitId ? `${productVersion} (${this.productService.commit})` : productVersion;
112
87
  this.currentVersionNode.parentElement.style.display = "";
113
88
  } else {
@@ -120,8 +95,9 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
120
95
  this.speedInfoNode.textContent = "";
121
96
  this.timeRemainingNode.textContent = "";
122
97
  this.messageNode.style.display = "none";
123
- this.markdownContainer.style.display = "none";
124
- this.markdown.clear();
98
+ this.actionButton.style.display = "none";
99
+ this.actionButton.dataset.commandId = "";
100
+ this.releaseNotesButton.style.marginRight = "";
125
101
  }
126
102
  renderState(state) {
127
103
  this.hideAll();
@@ -156,49 +132,52 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
156
132
  case StateType.Overwriting:
157
133
  this.renderOverwriting(state);
158
134
  break;
135
+ case StateType.Restarting:
136
+ this.renderRestarting(state);
137
+ break;
159
138
  }
160
139
  }
161
140
  renderUninitialized() {
162
- this.renderTitleAndInfo(( localize(14882, "Initializing")));
163
- this.renderMessage(( localize(14883, "Initializing update service...")));
141
+ this.renderTitleAndInfo(( localize(15018, "Initializing")));
142
+ this.renderMessage(( localize(15019, "Initializing update service...")));
164
143
  }
165
144
  renderDisabled(
166
145
  {
167
146
  reason
168
147
  }
169
148
  ) {
170
- this.renderTitleAndInfo(( localize(14884, "Updates Disabled")));
149
+ this.renderTitleAndInfo(( localize(15020, "Updates Disabled")));
171
150
  switch (reason) {
172
151
  case DisablementReason.NotBuilt:
173
- this.renderMessage(( localize(14885, "Updates are not available for this build.")), Codicon.info);
152
+ this.renderMessage(( localize(15021, "Updates are not available for this build.")), Codicon.info);
174
153
  break;
175
154
  case DisablementReason.DisabledByEnvironment:
176
- this.renderMessage(( localize(14886, "Updates are disabled by the --disable-updates command line flag.")), Codicon.warning);
155
+ this.renderMessage(( localize(15022, "Updates are disabled by the --disable-updates command line flag.")), Codicon.warning);
177
156
  break;
178
157
  case DisablementReason.ManuallyDisabled:
179
158
  this.renderMessage(( localize(
180
- 14887,
159
+ 15023,
181
160
  "Updates are manually disabled. Change the \"update.mode\" setting to enable."
182
161
  )), Codicon.warning);
183
162
  break;
184
163
  case DisablementReason.Policy:
185
- this.renderMessage(( localize(14888, "Updates are disabled by organization policy.")), Codicon.info);
164
+ this.renderMessage(( localize(15024, "Updates are disabled by organization policy.")), Codicon.info);
186
165
  break;
187
166
  case DisablementReason.MissingConfiguration:
188
- this.renderMessage(( localize(14889, "Updates are disabled because no update URL is configured.")), Codicon.info);
167
+ this.renderMessage(( localize(15025, "Updates are disabled because no update URL is configured.")), Codicon.info);
189
168
  break;
190
169
  case DisablementReason.InvalidConfiguration:
191
- this.renderMessage(( localize(14890, "Updates are disabled because the update URL is invalid.")), Codicon.error);
170
+ this.renderMessage(( localize(15026, "Updates are disabled because the update URL is invalid.")), Codicon.error);
192
171
  break;
193
172
  case DisablementReason.RunningAsAdmin:
194
173
  this.renderMessage(( localize(
195
- 14891,
174
+ 15027,
196
175
  "Updates are not available when running a user install of {0} as administrator.",
197
176
  this.productService.nameShort
198
177
  )), Codicon.warning);
199
178
  break;
200
179
  default:
201
- this.renderMessage(( localize(14892, "Updates are disabled.")), Codicon.warning);
180
+ this.renderMessage(( localize(15028, "Updates are disabled.")), Codicon.warning);
202
181
  break;
203
182
  }
204
183
  }
@@ -209,57 +188,55 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
209
188
  }
210
189
  ) {
211
190
  if (error) {
212
- this.renderTitleAndInfo(( localize(14893, "Update Error")));
191
+ this.renderTitleAndInfo(( localize(15029, "Update Error")));
213
192
  this.renderMessage(error, Codicon.error);
214
193
  return;
215
194
  }
216
195
  if (notAvailable) {
217
- this.renderTitleAndInfo(( localize(14894, "No Update Available")));
218
- this.renderMessage(( localize(14895, "There are no updates currently available.")), Codicon.info);
196
+ this.renderTitleAndInfo(( localize(15030, "No Update Available")));
197
+ this.renderMessage(( localize(15031, "There are no updates currently available.")), Codicon.info);
219
198
  return;
220
199
  }
221
- this.renderTitleAndInfo(( localize(14896, "Up to Date")));
200
+ this.renderTitleAndInfo(( localize(15032, "Up to Date")));
222
201
  switch (this.configurationService.getValue("update.mode")) {
223
202
  case "none":
224
- this.renderMessage(( localize(14897, "Automatic updates are disabled.")), Codicon.warning);
203
+ this.renderMessage(( localize(15033, "Automatic updates are disabled.")), Codicon.warning);
225
204
  break;
226
205
  case "manual":
227
206
  this.renderMessage(( localize(
228
- 14898,
207
+ 15034,
229
208
  "Automatic updates will be checked but not installed automatically."
230
209
  )));
231
210
  break;
232
211
  case "start":
233
- this.renderMessage(( localize(14899, "Updates will be applied on restart.")));
212
+ this.renderMessage(( localize(15035, "Updates will be applied on restart.")));
234
213
  break;
235
214
  case "default":
236
215
  if (this.meteredConnectionService.isConnectionMetered) {
237
216
  this.renderMessage(( localize(
238
- 14900,
217
+ 15036,
239
218
  "Automatic updates are paused because the network connection is metered."
240
219
  )), Codicon.radioTower);
241
220
  } else {
242
- this.renderMessage(( localize(14901, "Automatic updates are enabled. Happy Coding!")), Codicon.smiley);
221
+ this.renderMessage(( localize(15037, "Automatic updates are enabled. Happy Coding!")), Codicon.smiley);
243
222
  }
244
223
  break;
245
224
  }
246
225
  }
247
226
  renderCheckingForUpdates() {
248
- this.renderTitleAndInfo(( localize(14902, "Checking for Updates")));
249
- this.renderMessage(( localize(14903, "Checking for updates, please wait...")));
227
+ this.renderTitleAndInfo(( localize(15038, "Checking for Updates")));
228
+ this.renderMessage(( localize(15039, "Checking for updates, please wait...")));
250
229
  }
251
230
  renderAvailableForDownload(
252
231
  {
253
232
  update
254
233
  }
255
234
  ) {
256
- this.renderTitleAndInfo(( localize(14904, "Update Available")), update);
257
- if (this.hostedByTitleBar) {
258
- this.renderMessage(( localize(14905, "Click the Update button to download.")));
259
- }
235
+ this.renderTitleAndInfo(( localize(15040, "Update Available")), update);
236
+ this.renderActionButton(( localize(15041, "Download")), "update.downloadNow");
260
237
  }
261
238
  renderDownloading(state) {
262
- this.renderTitleAndInfo(( localize(14906, "Downloading Update")), state.update);
239
+ this.renderTitleAndInfo(( localize(15042, "Downloading Update")), state.update);
263
240
  const {
264
241
  downloadedBytes,
265
242
  totalBytes
@@ -272,15 +249,15 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
272
249
  this.progressContainer.style.display = "";
273
250
  const speed = computeDownloadSpeed(state);
274
251
  if (speed !== undefined && speed > 0) {
275
- this.speedInfoNode.textContent = ( localize(14907, "{0}/s", formatBytes(speed)));
252
+ this.speedInfoNode.textContent = ( localize(15043, "{0}/s", formatBytes(speed)));
276
253
  }
277
254
  const timeRemaining = computeDownloadTimeRemaining(state);
278
255
  if (timeRemaining !== undefined && timeRemaining > 0) {
279
- this.timeRemainingNode.textContent = `~${formatTimeRemaining(timeRemaining)} ${( localize(14908, "remaining"))}`;
256
+ this.timeRemainingNode.textContent = `~${formatTimeRemaining(timeRemaining)} ${( localize(15044, "remaining"))}`;
280
257
  }
281
258
  this.downloadStatsContainer.style.display = "";
282
259
  } else {
283
- this.renderMessage(( localize(14909, "Downloading update, please wait...")));
260
+ this.renderMessage(( localize(15045, "Downloading update, please wait...")));
284
261
  }
285
262
  }
286
263
  renderDownloaded(
@@ -288,10 +265,8 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
288
265
  update
289
266
  }
290
267
  ) {
291
- this.renderTitleAndInfo(( localize(14910, "Update is Ready to Install")), update);
292
- if (this.hostedByTitleBar) {
293
- this.renderMessage(( localize(14911, "Click the Update button to install.")));
294
- }
268
+ this.renderTitleAndInfo(( localize(15046, "Update is Ready to Install")), update);
269
+ this.renderActionButton(( localize(15047, "Install")), "update.install");
295
270
  }
296
271
  renderUpdating(
297
272
  {
@@ -300,7 +275,7 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
300
275
  maxProgress
301
276
  }
302
277
  ) {
303
- this.renderTitleAndInfo(( localize(14912, "Installing Update")), update);
278
+ this.renderTitleAndInfo(( localize(15048, "Installing Update")), update);
304
279
  const percentage = computeProgressPercent(currentProgress, maxProgress);
305
280
  if (percentage !== undefined) {
306
281
  this.progressFill.style.width = `${percentage}%`;
@@ -308,7 +283,7 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
308
283
  this.progressSizeNode.textContent = "";
309
284
  this.progressContainer.style.display = "";
310
285
  } else {
311
- this.renderMessage(( localize(14913, "Installing update, please wait...")));
286
+ this.renderMessage(( localize(15049, "Installing update, please wait...")));
312
287
  }
313
288
  }
314
289
  renderReady(
@@ -316,9 +291,11 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
316
291
  update
317
292
  }
318
293
  ) {
319
- this.renderTitleAndInfo(( localize(14914, "Update Installed")), update);
320
- if (this.hostedByTitleBar) {
321
- this.renderMessage(( localize(14915, "Click the Update button to restart and apply.")));
294
+ if (this.configurationService.getValue("update.mode") === "manual") {
295
+ this.renderTitleAndInfo(( localize(15050, "Update Installed")), update);
296
+ this.renderActionButton(( localize(15051, "Restart")), "update.restart");
297
+ } else {
298
+ this.renderTitleAndInfo(( localize(15052, "Restart to Update")), update);
322
299
  }
323
300
  }
324
301
  renderOverwriting(
@@ -326,49 +303,23 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
326
303
  update
327
304
  }
328
305
  ) {
329
- this.renderTitleAndInfo(( localize(14916, "Downloading Newer Update")), update);
330
- this.renderMessage(( localize(14917, "A newer update was released. Downloading, please wait...")));
306
+ this.renderTitleAndInfo(( localize(15053, "Downloading Newer Update")), update);
307
+ this.renderMessage(( localize(15054, "A newer update was released. Downloading, please wait...")));
331
308
  }
332
- async renderPostInstall() {
333
- this.hideAll();
334
- this.renderTitleAndInfo(( localize(14918, "New Update Installed")));
335
- this.renderMessage(( localize(14919, "See release notes for details on what's new in this release.")), Codicon.info);
336
- let text = null;
337
- try {
338
- const url = getUpdateInfoUrl(this.productService.version);
339
- const context = await this.requestService.request({
340
- url,
341
- callSite: "updateTooltip"
342
- }, CancellationToken.None);
343
- text = await asTextOrError(context);
344
- } catch {}
345
- if (!text) {
346
- return;
309
+ renderRestarting(
310
+ {
311
+ update
347
312
  }
348
- this.titleNode.textContent = ( localize(14920, "New in {0}", this.productService.version));
349
- this.productInfoNode.style.display = "none";
350
- this.messageNode.style.display = "none";
351
- const rendered = this.markdownRendererService.render(( new MarkdownString(text, {
352
- isTrusted: true,
353
- supportHtml: true,
354
- supportThemeIcons: true
355
- })), {
356
- actionHandler: (link, mdStr) => {
357
- openLinkFromMarkdown(this.openerService, link, mdStr.isTrusted);
358
- this.hoverService.hideHover(true);
359
- }
360
- });
361
- this.markdown.value = rendered;
362
- clearNode(this.markdownContainer);
363
- this.markdownContainer.appendChild(rendered.element);
364
- this.markdownContainer.style.display = "";
313
+ ) {
314
+ this.renderTitleAndInfo(( localize(15055, "Restarting {0}", this.productService.nameShort)), update);
315
+ this.renderMessage(( localize(15056, "Restarting to update, please wait...")));
365
316
  }
366
317
  renderTitleAndInfo(title, update) {
367
318
  this.titleNode.textContent = title;
368
319
  const version = update?.productVersion;
369
320
  if (version) {
370
321
  const updateCommitId = update.version?.substring(0, 7);
371
- this.latestVersionNode.textContent = updateCommitId ? ( localize(14921, "Latest Version: {0} ({1})", version, updateCommitId)) : ( localize(14922, "Latest Version: {0}", version));
322
+ this.latestVersionNode.textContent = updateCommitId ? ( localize(15057, "Latest Version: {0} ({1})", version, updateCommitId)) : ( localize(15058, "Latest Version: {0}", version));
372
323
  this.latestVersionCopyValue.value = updateCommitId ? `${version} (${update.version})` : version;
373
324
  this.latestVersionNode.parentElement.style.display = "";
374
325
  } else {
@@ -376,13 +327,20 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
376
327
  }
377
328
  const releaseDate = update?.timestamp ?? tryParseDate(this.productService.date);
378
329
  if (typeof releaseDate === "number" && releaseDate > 0) {
379
- this.releaseDateNode.textContent = ( localize(14923, "Released {0}", formatDate(releaseDate)));
330
+ this.releaseDateNode.textContent = ( localize(15059, "Released {0}", formatDate(releaseDate)));
380
331
  this.releaseDateNode.style.display = "";
381
332
  } else {
382
333
  this.releaseDateNode.style.display = "none";
383
334
  }
384
335
  this.releaseNotesVersion = version ?? this.productService.version;
385
- this.releaseNotesLink.style.display = this.releaseNotesVersion ? "" : "none";
336
+ this.releaseNotesButton.style.display = this.releaseNotesVersion ? "" : "none";
337
+ this.releaseNotesButton.style.marginRight = this.releaseNotesVersion ? "auto" : "";
338
+ this.buttonBar.style.display = this.releaseNotesVersion ? "" : "none";
339
+ }
340
+ renderActionButton(label, commandId) {
341
+ this.actionButton.textContent = label;
342
+ this.actionButton.dataset.commandId = commandId;
343
+ this.actionButton.style.display = "";
386
344
  }
387
345
  renderMessage(message, icon) {
388
346
  clearNode(this.messageNode);
@@ -402,7 +360,7 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
402
360
  const copyButton = append(row, $("a.copy-version-button"));
403
361
  copyButton.setAttribute("role", "button");
404
362
  copyButton.setAttribute("tabindex", "0");
405
- const title = ( localize(14924, "Copy"));
363
+ const title = ( localize(15060, "Copy"));
406
364
  copyButton.title = title;
407
365
  copyButton.setAttribute("aria-label", title);
408
366
  const copyIcon = append(copyButton, $(".copy-icon"));
@@ -424,6 +382,6 @@ let UpdateTooltip = class UpdateTooltip extends Disposable {
424
382
  this.hoverService.hideHover(true);
425
383
  }
426
384
  };
427
- UpdateTooltip = ( __decorate([( __param(1, IClipboardService)), ( __param(2, ICommandService)), ( __param(3, IConfigurationService)), ( __param(4, IHoverService)), ( __param(5, IMarkdownRendererService)), ( __param(6, IMeteredConnectionService)), ( __param(7, IOpenerService)), ( __param(8, IProductService)), ( __param(9, IRequestService))], UpdateTooltip));
385
+ UpdateTooltip = ( __decorate([( __param(0, IClipboardService)), ( __param(1, ICommandService)), ( __param(2, IConfigurationService)), ( __param(3, IHoverService)), ( __param(4, IMeteredConnectionService)), ( __param(5, IProductService))], UpdateTooltip));
428
386
 
429
387
  export { UpdateTooltip };
@@ -0,0 +1,42 @@
1
+ export type UpdateInfoButtonStyle = "primary" | "secondary";
2
+ export interface IUpdateInfoButton {
3
+ readonly label: string;
4
+ readonly commandId: string;
5
+ readonly args?: unknown[];
6
+ readonly style?: UpdateInfoButtonStyle;
7
+ }
8
+ export interface IParsedUpdateInfoInput {
9
+ readonly markdown: string;
10
+ readonly buttons?: IUpdateInfoButton[];
11
+ }
12
+ /**
13
+ * Parses optional metadata from update info input.
14
+ *
15
+ * Supported formats:
16
+ *
17
+ * **JSON envelope** - a single JSON object with `markdown` and optional `buttons`:
18
+ * ```json
19
+ * {
20
+ * "markdown": "$(info) **Feature**<br>Description...",
21
+ * "buttons": [
22
+ * { "label": "Release Notes", "commandId": "update.showCurrentReleaseNotes", "style": "secondary" },
23
+ * { "label": "Open Sessions", "commandId": "workbench.action.chat.open", "style": "primary" }
24
+ * ]
25
+ * }
26
+ * ```
27
+ *
28
+ * **Block frontmatter** - YAML-style `---` delimiters wrapping a JSON metadata block:
29
+ * ```
30
+ * ---
31
+ * { "buttons": [...] }
32
+ * ---
33
+ * $(info) **Feature**<br>Description...
34
+ * ```
35
+ *
36
+ * **Inline frontmatter** - metadata on a single `---` line:
37
+ * ```
38
+ * --- { "buttons": [...] } ---
39
+ * $(info) **Feature**<br>Description...
40
+ * ```
41
+ */
42
+ export declare function parseUpdateInfoInput(text: string): IParsedUpdateInfoInput;
@@ -0,0 +1,74 @@
1
+
2
+ import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
3
+
4
+ function parseUpdateInfoInput(text) {
5
+ const normalized = text.replace(/^\uFEFF/, '');
6
+ return tryParseUpdateInfoEnvelope(normalized) ?? parseUpdateInfoFrontmatter(normalized);
7
+ }
8
+ function tryParseUpdateInfoEnvelope(text) {
9
+ const trimmed = text.trim();
10
+ if (!trimmed.startsWith('{') || !trimmed.endsWith('}')) {
11
+ return undefined;
12
+ }
13
+ try {
14
+ const value = JSON.parse(trimmed);
15
+ if (typeof value.markdown !== 'string') {
16
+ return undefined;
17
+ }
18
+ return {
19
+ markdown: value.markdown,
20
+ buttons: parseUpdateInfoButtons(value.buttons),
21
+ };
22
+ }
23
+ catch {
24
+ return undefined;
25
+ }
26
+ }
27
+ function parseUpdateInfoFrontmatter(text) {
28
+ const blockMatch = text.match(/^---[ \t]*\r?\n(?<json>[\s\S]*?)\r?\n---[ \t]*(?:\r?\n(?<body>[\s\S]*))?$/);
29
+ if (blockMatch?.groups) {
30
+ return parseUpdateInfoFrontmatterMatch(text, blockMatch.groups['json'], blockMatch.groups['body'] ?? '');
31
+ }
32
+ const inlineMatch = text.match(/^---[ \t]*(?<json>\{.*\})[ \t]*---[ \t]*(?<body>[\s\S]*)$/);
33
+ if (inlineMatch?.groups) {
34
+ return parseUpdateInfoFrontmatterMatch(text, inlineMatch.groups['json'], inlineMatch.groups['body']);
35
+ }
36
+ return { markdown: text };
37
+ }
38
+ function parseUpdateInfoFrontmatterMatch(text, jsonText, markdown) {
39
+ try {
40
+ const meta = JSON.parse(jsonText);
41
+ return {
42
+ markdown,
43
+ buttons: parseUpdateInfoButtons(meta.buttons),
44
+ };
45
+ }
46
+ catch {
47
+ return { markdown: text };
48
+ }
49
+ }
50
+ function parseUpdateInfoButtons(buttons) {
51
+ if (!Array.isArray(buttons)) {
52
+ return undefined;
53
+ }
54
+ const parsedButtons = [];
55
+ for (const button of buttons) {
56
+ if (typeof button !== 'object' || button === null) {
57
+ continue;
58
+ }
59
+ if (!hasKey(button, { label: true, commandId: true }) || typeof button.label !== 'string' || typeof button.commandId !== 'string') {
60
+ continue;
61
+ }
62
+ const style = hasKey(button, { style: true }) && (button.style === 'primary' || button.style === 'secondary') ? button.style : undefined;
63
+ const args = hasKey(button, { args: true }) && Array.isArray(button.args) ? button.args : undefined;
64
+ parsedButtons.push({
65
+ label: button.label,
66
+ commandId: button.commandId,
67
+ args,
68
+ style,
69
+ });
70
+ }
71
+ return parsedButtons.length ? parsedButtons : undefined;
72
+ }
73
+
74
+ export { parseUpdateInfoInput };
@@ -54,31 +54,31 @@ function formatTimeRemaining(seconds) {
54
54
  if (hours >= 1) {
55
55
  const formattedHours = formatDecimal(hours);
56
56
  if (formattedHours === "1") {
57
- return localize(14925, "{0} hour", formattedHours);
57
+ return localize(15061, "{0} hour", formattedHours);
58
58
  } else {
59
- return localize(14926, "{0} hours", formattedHours);
59
+ return localize(15062, "{0} hours", formattedHours);
60
60
  }
61
61
  }
62
62
  const minutes = Math.floor(seconds / 60);
63
63
  if (minutes >= 1) {
64
- return localize(14927, "{0} min", minutes);
64
+ return localize(15063, "{0} min", minutes);
65
65
  }
66
- return localize(14928, "{0}s", seconds);
66
+ return localize(15064, "{0}s", seconds);
67
67
  }
68
68
  function formatBytes(bytes) {
69
69
  if (bytes < 1024) {
70
- return localize(14929, "{0} B", bytes);
70
+ return localize(15065, "{0} B", bytes);
71
71
  }
72
72
  const kb = bytes / 1024;
73
73
  if (kb < 1024) {
74
- return localize(14930, "{0} KB", formatDecimal(kb));
74
+ return localize(15066, "{0} KB", formatDecimal(kb));
75
75
  }
76
76
  const mb = kb / 1024;
77
77
  if (mb < 1024) {
78
- return localize(14931, "{0} MB", formatDecimal(mb));
78
+ return localize(15067, "{0} MB", formatDecimal(mb));
79
79
  }
80
80
  const gb = mb / 1024;
81
- return localize(14932, "{0} GB", formatDecimal(gb));
81
+ return localize(15068, "{0} GB", formatDecimal(gb));
82
82
  }
83
83
  function tryParseDate(date) {
84
84
  if (date === undefined) {
@@ -120,22 +120,10 @@ function tryParseVersion(version) {
120
120
  return undefined;
121
121
  }
122
122
  }
123
- function preprocessError(error) {
124
- if (!error) {
125
- return undefined;
126
- }
127
- if (/The request timed out|The network connection was lost/i.test(error)) {
128
- return undefined;
129
- }
130
- return error.replace(
131
- /See https:\/\/github\.com\/Squirrel\/Squirrel\.Mac\/issues\/182 for more information/,
132
- "This might mean the application was put on quarantine by macOS. See [this link](https://github.com/microsoft/vscode/issues/7426#issuecomment-425093469) for more information"
133
- );
134
- }
135
123
  function isMajorMinorVersionChange(previousVersion, newVersion) {
136
124
  const previous = tryParseVersion(previousVersion);
137
125
  const current = tryParseVersion(newVersion);
138
126
  return !!previous && !!current && (previous.major !== current.major || previous.minor !== current.minor);
139
127
  }
140
128
 
141
- export { computeDownloadSpeed, computeDownloadTimeRemaining, computeProgressPercent, formatBytes, formatDate, formatDecimal, formatTimeRemaining, getUpdateInfoUrl, isMajorMinorVersionChange, preprocessError, tryParseDate, tryParseVersion };
129
+ export { computeDownloadSpeed, computeDownloadTimeRemaining, computeProgressPercent, formatBytes, formatDate, formatDecimal, formatTimeRemaining, getUpdateInfoUrl, isMajorMinorVersionChange, tryParseDate, tryParseVersion };
@@ -1,9 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- .monaco-workbench .part.statusbar > .items-container > #status\.update > a > span {
7
- color: var(--vscode-button-background);
8
- font-size: 16px;
9
- }
@@ -1,22 +0,0 @@
1
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
3
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
4
- import { IUpdateService } from "@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service";
5
- import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
6
- import { IStatusbarService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service";
7
- /**
8
- * Displays update status and actions in the status bar.
9
- */
10
- export declare class UpdateStatusBarContribution extends Disposable implements IWorkbenchContribution {
11
- private readonly configurationService;
12
- private readonly statusbarService;
13
- private static readonly actionableStates;
14
- private readonly accessor;
15
- private readonly tooltip;
16
- private lastStateType;
17
- constructor(configurationService: IConfigurationService, instantiationService: IInstantiationService, statusbarService: IStatusbarService, updateService: IUpdateService);
18
- private onStateChange;
19
- private updateEntry;
20
- private getDownloadingText;
21
- private getUpdatingText;
22
- }