@codingame/monaco-vscode-update-service-override 25.1.1 → 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.
@@ -38,7 +38,21 @@ import { asWebviewUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/c
38
38
 
39
39
  registerCss(releasenoteseditor);
40
40
  let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
41
- constructor(_environmentService, _keybindingService, _languageService, _openerService, _requestService, _configurationService, _editorService, _editorGroupService, _codeEditorService, _webviewWorkbenchService, _extensionService, _productService, _instantiationService) {
41
+ constructor(
42
+ _environmentService,
43
+ _keybindingService,
44
+ _languageService,
45
+ _openerService,
46
+ _requestService,
47
+ _configurationService,
48
+ _editorService,
49
+ _editorGroupService,
50
+ _codeEditorService,
51
+ _webviewWorkbenchService,
52
+ _extensionService,
53
+ _productService,
54
+ _instantiationService
55
+ ) {
42
56
  super();
43
57
  this._environmentService = _environmentService;
44
58
  this._keybindingService = _keybindingService;
@@ -58,8 +72,12 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
58
72
  this._register(TokenizationRegistry.onDidChange(() => {
59
73
  return this.updateHtml();
60
74
  }));
61
- this._register(_configurationService.onDidChangeConfiguration((e) => this.onDidChangeConfiguration(e)));
62
- this._register(_webviewWorkbenchService.onDidChangeActiveWebviewEditor((e) => this.onDidChangeActiveWebviewEditor(e)));
75
+ this._register(
76
+ _configurationService.onDidChangeConfiguration(e => this.onDidChangeConfiguration(e))
77
+ );
78
+ this._register(
79
+ _webviewWorkbenchService.onDidChangeActiveWebviewEditor(e => this.onDidChangeActiveWebviewEditor(e))
80
+ );
63
81
  this._simpleSettingRenderer = this._instantiationService.createInstance(SimpleSettingRenderer);
64
82
  }
65
83
  async updateHtml() {
@@ -78,41 +96,51 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
78
96
  return dirname(currentFileUri);
79
97
  }
80
98
  }
81
- return ( URI.parse('https://code.visualstudio.com/raw'));
99
+ return ( URI.parse("https://code.visualstudio.com/raw"));
82
100
  }
83
101
  async show(version, useCurrentFile) {
84
102
  const releaseNoteText = await this.loadReleaseNotes(version, useCurrentFile);
85
103
  const base = await this.getBase(useCurrentFile);
86
- this._lastMeta = { text: releaseNoteText, base };
104
+ this._lastMeta = {
105
+ text: releaseNoteText,
106
+ base
107
+ };
87
108
  const html = await this.renderBody(this._lastMeta);
88
- const title = ( localize(12859, "Release Notes: {0}", version));
109
+ const title = ( localize(13216, "Release Notes: {0}", version));
89
110
  const activeEditorPane = this._editorService.activeEditorPane;
90
111
  if (this._currentReleaseNotes) {
91
112
  this._currentReleaseNotes.setWebviewTitle(title);
92
113
  this._currentReleaseNotes.webview.setHtml(html);
93
- this._webviewWorkbenchService.revealWebview(this._currentReleaseNotes, activeEditorPane ? activeEditorPane.group : this._editorGroupService.activeGroup, false);
94
- }
95
- else {
114
+ this._webviewWorkbenchService.revealWebview(
115
+ this._currentReleaseNotes,
116
+ activeEditorPane ? activeEditorPane.group : this._editorGroupService.activeGroup,
117
+ false
118
+ );
119
+ } else {
96
120
  this._currentReleaseNotes = this._webviewWorkbenchService.openWebview({
97
121
  title,
98
122
  options: {
99
123
  tryRestoreScrollPosition: true,
100
124
  enableFindWidget: true,
101
- disableServiceWorker: useCurrentFile ? false : true,
125
+ disableServiceWorker: useCurrentFile ? false : true
102
126
  },
103
127
  contentOptions: {
104
128
  localResourceRoots: useCurrentFile ? [base] : [],
105
129
  allowScripts: true
106
130
  },
107
131
  extension: undefined
108
- }, 'releaseNotes', title, undefined, { group: ACTIVE_GROUP, preserveFocus: false });
132
+ }, "releaseNotes", title, undefined, {
133
+ group: ACTIVE_GROUP,
134
+ preserveFocus: false
135
+ });
109
136
  const disposables = ( new DisposableStore());
110
- disposables.add(this._currentReleaseNotes.webview.onDidClickLink(uri => this.onDidClickLink(( URI.parse(uri)))));
137
+ disposables.add(
138
+ this._currentReleaseNotes.webview.onDidClickLink(uri => this.onDidClickLink(( URI.parse(uri))))
139
+ );
111
140
  disposables.add(this._currentReleaseNotes.webview.onMessage(e => {
112
- if (e.message.type === 'showReleaseNotes') {
113
- this._configurationService.updateValue('update.showReleaseNotes', e.message.value);
114
- }
115
- else if (e.message.type === 'clickSetting') {
141
+ if (e.message.type === "showReleaseNotes") {
142
+ this._configurationService.updateValue("update.showReleaseNotes", e.message.value);
143
+ } else if (e.message.type === "clickSetting") {
116
144
  const x = this._currentReleaseNotes?.webview.container.offsetLeft + e.message.value.x;
117
145
  const y = this._currentReleaseNotes?.webview.container.offsetTop + e.message.value.y;
118
146
  this._simpleSettingRenderer.updateSetting(( URI.parse(e.message.value.uri)), x, y);
@@ -129,16 +157,16 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
129
157
  async loadReleaseNotes(version, useCurrentFile) {
130
158
  const match = /^(\d+\.\d+)\./.exec(version);
131
159
  if (!match) {
132
- throw ( new Error('not found'));
160
+ throw ( new Error("not found"));
133
161
  }
134
- const versionLabel = match[1].replace(/\./g, '_');
135
- const baseUrl = 'https://code.visualstudio.com/raw';
162
+ const versionLabel = match[1].replace(/\./g, "_");
163
+ const baseUrl = "https://code.visualstudio.com/raw";
136
164
  const url = `${baseUrl}/v${versionLabel}.md`;
137
- const unassigned = ( localize(12860, "unassigned"));
138
- const escapeMdHtml = (text) => {
139
- return escape(text).replace(/\\/g, '\\\\');
165
+ const unassigned = ( localize(13217, "unassigned"));
166
+ const escapeMdHtml = text => {
167
+ return escape(text).replace(/\\/g, "\\\\");
140
168
  };
141
- const patchKeybindings = (text) => {
169
+ const patchKeybindings = text => {
142
170
  const kb = (match, kb) => {
143
171
  const keybinding = this._keybindingService.lookupKeybinding(kb);
144
172
  if (!keybinding) {
@@ -165,28 +193,30 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
165
193
  const resolved = kbstyle(match, binding);
166
194
  return resolved ? `<code title="${binding}">${escapeMdHtml(resolved)}</code>` : resolved;
167
195
  };
168
- return text
169
- .replace(/`kb\(([a-z.\d\-]+)\)`/gi, kbCode)
170
- .replace(/`kbstyle\(([^\)]+)\)`/gi, kbstyleCode)
171
- .replace(/kb\(([a-z.\d\-]+)\)/gi, (match, binding) => escapeMarkdownSyntaxTokens(kb(match, binding)))
172
- .replace(/kbstyle\(([^\)]+)\)/gi, (match, binding) => escapeMarkdownSyntaxTokens(kbstyle(match, binding)));
196
+ return text.replace(/`kb\(([a-z.\d\-]+)\)`/gi, kbCode).replace(/`kbstyle\(([^\)]+)\)`/gi, kbstyleCode).replace(
197
+ /kb\(([a-z.\d\-]+)\)/gi,
198
+ (match, binding) => escapeMarkdownSyntaxTokens(kb(match, binding))
199
+ ).replace(
200
+ /kbstyle\(([^\)]+)\)/gi,
201
+ (match, binding) => escapeMarkdownSyntaxTokens(kbstyle(match, binding))
202
+ );
173
203
  };
174
204
  const fetchReleaseNotes = async () => {
175
205
  let text;
176
206
  try {
177
207
  if (useCurrentFile) {
178
208
  const file = this._codeEditorService.getActiveCodeEditor()?.getModel()?.getValue();
179
- text = file ? file.substring(file.indexOf('#')) : undefined;
180
- }
181
- else {
182
- text = await asTextOrError(await this._requestService.request({ url }, CancellationToken.None));
209
+ text = file ? file.substring(file.indexOf("#")) : undefined;
210
+ } else {
211
+ text = await asTextOrError(await this._requestService.request({
212
+ url
213
+ }, CancellationToken.None));
183
214
  }
184
- }
185
- catch {
186
- throw ( new Error('Failed to fetch release notes'));
215
+ } catch {
216
+ throw ( new Error("Failed to fetch release notes"));
187
217
  }
188
218
  if (!text || (!/^#\s/.test(text) && !useCurrentFile)) {
189
- throw ( new Error('Invalid release notes'));
219
+ throw ( new Error("Invalid release notes"));
190
220
  }
191
221
  return patchKeybindings(text);
192
222
  };
@@ -197,8 +227,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
197
227
  this._releaseNotesCache.set(version, (async () => {
198
228
  try {
199
229
  return await fetchReleaseNotes();
200
- }
201
- catch (err) {
230
+ } catch (err) {
202
231
  this._releaseNotesCache.delete(version);
203
232
  throw err;
204
233
  }
@@ -207,345 +236,352 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
207
236
  return this._releaseNotesCache.get(version);
208
237
  }
209
238
  async onDidClickLink(uri) {
210
- if (uri.scheme === Schemas.codeSetting) ;
211
- else {
212
- this.addGAParameters(uri, 'ReleaseNotes')
213
- .then(updated => this._openerService.open(updated, { allowCommands: ['workbench.action.openSettings', 'summarize.release.notes'] }))
214
- .then(undefined, onUnexpectedError);
239
+ if (uri.scheme === Schemas.codeSetting)
240
+ ; else {
241
+ this.addGAParameters(uri, "ReleaseNotes").then(updated => this._openerService.open(updated, {
242
+ allowCommands: ["workbench.action.openSettings", "summarize.release.notes"]
243
+ })).then(undefined, onUnexpectedError);
215
244
  }
216
245
  }
217
- async addGAParameters(uri, origin, experiment = '1') {
246
+ async addGAParameters(uri, origin, experiment = "1") {
218
247
  if (supportsTelemetry(this._productService, this._environmentService) && getTelemetryLevel(this._configurationService) === TelemetryLevel.USAGE) {
219
- if (uri.scheme === 'https' && uri.authority === 'code.visualstudio.com') {
220
- return uri.with({ query: `${uri.query ? uri.query + '&' : ''}utm_source=VsCode&utm_medium=${encodeURIComponent(origin)}&utm_content=${encodeURIComponent(experiment)}` });
248
+ if (uri.scheme === "https" && uri.authority === "code.visualstudio.com") {
249
+ return uri.with({
250
+ query: `${uri.query ? uri.query + "&" : ""}utm_source=VsCode&utm_medium=${encodeURIComponent(origin)}&utm_content=${encodeURIComponent(experiment)}`
251
+ });
221
252
  }
222
253
  }
223
254
  return uri;
224
255
  }
225
256
  async renderBody(fileContent) {
226
257
  const nonce = generateUuid();
227
- const processedContent = await renderReleaseNotesMarkdown(fileContent.text, this._extensionService, this._languageService, this._simpleSettingRenderer);
258
+ const processedContent = await renderReleaseNotesMarkdown(
259
+ fileContent.text,
260
+ this._extensionService,
261
+ this._languageService,
262
+ this._simpleSettingRenderer
263
+ );
228
264
  const colorMap = TokenizationRegistry.getColorMap();
229
- const css = colorMap ? generateTokensCSSForColorMap(colorMap) : '';
230
- const showReleaseNotes = Boolean(this._configurationService.getValue('update.showReleaseNotes'));
265
+ const css = colorMap ? generateTokensCSSForColorMap(colorMap) : "";
266
+ const showReleaseNotes = Boolean(this._configurationService.getValue("update.showReleaseNotes"));
231
267
  return `<!DOCTYPE html>
232
- <html>
233
- <head>
234
- <base href="${( asWebviewUri(fileContent.base).toString(true))}/" >
235
- <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
236
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; style-src 'nonce-${nonce}' https://code.visualstudio.com; script-src 'nonce-${nonce}';">
237
- <style nonce="${nonce}">
238
- ${DEFAULT_MARKDOWN_STYLES}
239
- ${css}
240
-
241
- /* codesetting */
242
-
243
- code:has(.codesetting) {
244
- background-color: var(--vscode-textPreformat-background);
245
- color: var(--vscode-textPreformat-foreground);
246
- padding-left: 1px;
247
- margin-right: 3px;
248
- padding-right: 0px;
249
- }
250
-
251
- code:has(.codesetting):focus {
252
- border: 1px solid var(--vscode-button-border, transparent);
253
- }
254
-
255
- .codesetting {
256
- color: var(--vscode-textPreformat-foreground);
257
- padding: 0px 1px 1px 0px;
258
- font-size: 0px;
259
- overflow: hidden;
260
- text-overflow: ellipsis;
261
- outline-offset: 2px !important;
262
- box-sizing: border-box;
263
- text-align: center;
264
- cursor: pointer;
265
- display: inline;
266
- margin-right: 3px;
267
- }
268
- .codesetting svg {
269
- font-size: 12px;
270
- text-align: center;
271
- cursor: pointer;
272
- border: 1px solid var(--vscode-button-secondaryBorder, transparent);
273
- outline: 1px solid transparent;
274
- line-height: 9px;
275
- margin-bottom: -5px;
276
- padding-left: 0px;
277
- padding-top: 2px;
278
- padding-bottom: 2px;
279
- padding-right: 2px;
280
- display: inline-block;
281
- text-decoration: none;
282
- text-rendering: auto;
283
- text-transform: none;
284
- -webkit-font-smoothing: antialiased;
285
- -moz-osx-font-smoothing: grayscale;
286
- user-select: none;
287
- -webkit-user-select: none;
288
- }
289
- .codesetting .setting-name {
290
- font-size: 13px;
291
- padding-left: 2px;
292
- padding-right: 3px;
293
- padding-top: 1px;
294
- padding-bottom: 1px;
295
- margin-top: -3px;
296
- }
297
- .codesetting:hover {
298
- color: var(--vscode-textPreformat-foreground) !important;
299
- text-decoration: none !important;
300
- }
301
- code:has(.codesetting):hover {
302
- filter: brightness(140%);
303
- text-decoration: none !important;
304
- }
305
- .codesetting:focus {
306
- outline: 0 !important;
307
- text-decoration: none !important;
308
- color: var(--vscode-button-hoverForeground) !important;
309
- }
310
- .codesetting .separator {
311
- width: 1px;
312
- height: 14px;
313
- margin-bottom: -3px;
314
- display: inline-block;
315
- background-color: var(--vscode-editor-background);
316
- font-size: 12px;
317
- margin-right: 4px;
318
- }
319
-
320
- header { display: flex; align-items: center; padding-top: 1em; }
321
-
322
- /* Release notes enhancements from vscode-docs */
323
- html {
324
- font-size: 10px;
325
- height: 100%;
326
- overscroll-behavior: none;
327
- }
328
-
329
- body {
330
- margin: 0 auto;
331
- max-width: 980px;
332
- height: auto;
333
- overflow-y: auto;
334
- overscroll-behavior: none;
335
- }
336
-
337
- /* Scroll to top button */
338
- #scroll-to-top {
339
- position: fixed;
340
- width: 40px;
341
- height: 40px;
342
- right: 25px;
343
- bottom: 25px;
344
- background-color: var(--vscode-button-background, #444);
345
- border-color: var(--vscode-button-border);
346
- border-radius: 50%;
347
- cursor: pointer;
348
- box-shadow: 1px 1px 1px rgba(0,0,0,.25);
349
- outline: none;
350
- display: flex;
351
- justify-content: center;
352
- align-items: center;
353
- }
354
-
355
- #scroll-to-top:hover {
356
- background-color: var(--vscode-button-hoverBackground);
357
- box-shadow: 2px 2px 2px rgba(0,0,0,.25);
358
- }
359
-
360
- body.vscode-high-contrast #scroll-to-top {
361
- border-width: 2px;
362
- border-style: solid;
363
- box-shadow: none;
364
- }
365
-
366
- #scroll-to-top span.icon::before {
367
- content: "";
368
- display: block;
369
- background: var(--vscode-button-foreground);
370
- /* Chevron up icon */
371
- -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m9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
373
- width: 16px;
374
- height: 16px;
375
- }
376
-
377
- /* Header styling */
378
- h2 {
379
- margin-top: 1.2em;
380
- scroll-margin-top: 1.2em;
381
- }
382
-
383
- h2:not(:first-of-type) {
384
- margin-top: 4em;
385
- scroll-margin-top: 1em;
386
- }
387
-
388
- h3 {
389
- margin-top: 4em;
390
- scroll-margin-top: 1em;
391
- }
392
-
393
- h2 + h3 {
394
- margin-top: 0;
395
- }
396
-
397
- /* Highlights table styling */
398
- .highlights-table {
399
- border-collapse: collapse;
400
- border: none;
401
- }
402
-
403
- .highlights-table th {
404
- vertical-align: top;
405
- border: none;
406
- padding-top: 2em;
407
- font-weight: bold;
408
- }
409
-
410
- .highlights-table td {
411
- vertical-align: top;
412
- border: none;
413
- }
414
-
415
- .highlights-table tr:nth-child(2) td {
416
- padding-bottom: 1em;
417
- }
418
-
419
- /* Main content layout */
420
- .toc-nav-layout {
421
- display: flex;
422
- align-items: flex-start;
423
- }
424
-
425
- /* TOC Navigation */
426
- #toc-nav {
427
- position: sticky;
428
- top: 20px;
429
- width: 10vw;
430
- min-width: 120px;
431
- margin-right: 32px;
432
- margin-top: 2em;
433
- }
434
-
435
- #toc-nav > div {
436
- font-weight: bold;
437
- font-size: 1em;
438
- margin-bottom: 1em;
439
- text-transform: uppercase;
440
- }
441
-
442
- #toc-nav ul {
443
- list-style: none;
444
- padding: 0;
445
- margin: 0;
446
- }
447
-
448
- #toc-nav ul li {
449
- margin-bottom: 0.5em;
450
- }
451
-
452
- #toc-nav a {
453
- color: var(--vscode-editor-foreground, #ccc);
454
- text-decoration: none !important;
455
- transition: background-color 0.2s, color 0.2s;
456
- padding: 4px 6px;
457
- margin: -4px -6px;
458
- border-radius: 4px;
459
- display: block;
460
- outline: none;
461
- }
462
-
463
- #toc-nav a:hover {
464
- background-color: var(--vscode-button-secondaryHoverBackground, #1177bb);
465
- color: var(--vscode-button-secondaryForeground, #ffffff);
466
- cursor: pointer;
467
- text-decoration: none !important;
468
- }
469
-
470
- /* Main content area */
471
- .notes-main {
472
- flex: 1;
473
- min-width: 0;
474
- }
475
-
476
- /* Responsive breakpoint - Hide TOC on smaller screens */
477
- @media (max-width: 576px) {
478
- #toc-nav {
479
- display: none;
480
- }
481
-
482
- .toc-nav-layout {
483
- flex-direction: column;
484
- }
485
-
486
- .notes-main {
487
- margin-left: 0;
488
- }
489
- }
490
- </style>
491
- </head>
492
- <body>
493
- ${processedContent}
494
- <script nonce="${nonce}">
495
- const vscode = acquireVsCodeApi();
496
- const container = document.createElement('p');
497
- container.style.display = 'flex';
498
- container.style.alignItems = 'center';
499
-
500
- const input = document.createElement('input');
501
- input.type = 'checkbox';
502
- input.id = 'showReleaseNotes';
503
- input.checked = ${showReleaseNotes};
504
- container.appendChild(input);
505
-
506
- const label = document.createElement('label');
507
- label.htmlFor = 'showReleaseNotes';
508
- label.textContent = '${( localize(12861, "Show release notes after an update"))}';
509
- container.appendChild(label);
510
-
511
- const beforeElement = document.querySelector("body > h1")?.nextElementSibling;
512
- if (beforeElement) {
513
- document.body.insertBefore(container, beforeElement);
514
- } else {
515
- document.body.appendChild(container);
516
- }
517
-
518
- window.addEventListener('message', event => {
519
- if (event.data.type === 'showReleaseNotes') {
520
- input.checked = event.data.value;
521
- }
522
- });
523
-
524
- window.addEventListener('click', event => {
525
- const href = event.target.href ?? event.target.parentElement?.href ?? event.target.parentElement?.parentElement?.href;
526
- if (href && (href.startsWith('${Schemas.codeSetting}'))) {
527
- vscode.postMessage({ type: 'clickSetting', value: { uri: href, x: event.clientX, y: event.clientY }});
528
- }
529
- });
530
-
531
- window.addEventListener('keypress', event => {
532
- if (event.keyCode === 13) {
533
- if (event.target.children.length > 0 && event.target.children[0].href) {
534
- const clientRect = event.target.getBoundingClientRect();
535
- vscode.postMessage({ type: 'clickSetting', value: { uri: event.target.children[0].href, x: clientRect.right , y: clientRect.bottom }});
536
- }
537
- }
538
- });
539
-
540
- input.addEventListener('change', event => {
541
- vscode.postMessage({ type: 'showReleaseNotes', value: input.checked }, '*');
542
- });
543
- </script>
544
- </body>
545
- </html>`;
268
+ <html>
269
+ <head>
270
+ <base href="${( asWebviewUri(fileContent.base).toString(true))}/" >
271
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
272
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; style-src 'nonce-${nonce}' https://code.visualstudio.com; script-src 'nonce-${nonce}';">
273
+ <style nonce="${nonce}">
274
+ ${DEFAULT_MARKDOWN_STYLES}
275
+ ${css}
276
+
277
+ /* codesetting */
278
+
279
+ code:has(.codesetting) {
280
+ background-color: var(--vscode-textPreformat-background);
281
+ color: var(--vscode-textPreformat-foreground);
282
+ padding-left: 1px;
283
+ margin-right: 3px;
284
+ padding-right: 0px;
285
+ }
286
+
287
+ code:has(.codesetting):focus {
288
+ border: 1px solid var(--vscode-button-border, transparent);
289
+ }
290
+
291
+ .codesetting {
292
+ color: var(--vscode-textPreformat-foreground);
293
+ padding: 0px 1px 1px 0px;
294
+ font-size: 0px;
295
+ overflow: hidden;
296
+ text-overflow: ellipsis;
297
+ outline-offset: 2px !important;
298
+ box-sizing: border-box;
299
+ text-align: center;
300
+ cursor: pointer;
301
+ display: inline;
302
+ margin-right: 3px;
303
+ }
304
+ .codesetting svg {
305
+ font-size: 12px;
306
+ text-align: center;
307
+ cursor: pointer;
308
+ border: 1px solid var(--vscode-button-secondaryBorder, transparent);
309
+ outline: 1px solid transparent;
310
+ line-height: 9px;
311
+ margin-bottom: -5px;
312
+ padding-left: 0px;
313
+ padding-top: 2px;
314
+ padding-bottom: 2px;
315
+ padding-right: 2px;
316
+ display: inline-block;
317
+ text-decoration: none;
318
+ text-rendering: auto;
319
+ text-transform: none;
320
+ -webkit-font-smoothing: antialiased;
321
+ -moz-osx-font-smoothing: grayscale;
322
+ user-select: none;
323
+ -webkit-user-select: none;
324
+ }
325
+ .codesetting .setting-name {
326
+ font-size: 13px;
327
+ padding-left: 2px;
328
+ padding-right: 3px;
329
+ padding-top: 1px;
330
+ padding-bottom: 1px;
331
+ margin-top: -3px;
332
+ }
333
+ .codesetting:hover {
334
+ color: var(--vscode-textPreformat-foreground) !important;
335
+ text-decoration: none !important;
336
+ }
337
+ code:has(.codesetting):hover {
338
+ filter: brightness(140%);
339
+ text-decoration: none !important;
340
+ }
341
+ .codesetting:focus {
342
+ outline: 0 !important;
343
+ text-decoration: none !important;
344
+ color: var(--vscode-button-hoverForeground) !important;
345
+ }
346
+ .codesetting .separator {
347
+ width: 1px;
348
+ height: 14px;
349
+ margin-bottom: -3px;
350
+ display: inline-block;
351
+ background-color: var(--vscode-editor-background);
352
+ font-size: 12px;
353
+ margin-right: 4px;
354
+ }
355
+
356
+ header { display: flex; align-items: center; padding-top: 1em; }
357
+
358
+ /* Release notes enhancements from vscode-docs */
359
+ html {
360
+ font-size: 10px;
361
+ height: 100%;
362
+ overscroll-behavior: none;
363
+ }
364
+
365
+ body {
366
+ margin: 0 auto;
367
+ max-width: 980px;
368
+ height: auto;
369
+ overflow-y: auto;
370
+ overscroll-behavior: none;
371
+ }
372
+
373
+ /* Scroll to top button */
374
+ #scroll-to-top {
375
+ position: fixed;
376
+ width: 40px;
377
+ height: 40px;
378
+ right: 25px;
379
+ bottom: 25px;
380
+ background-color: var(--vscode-button-background, #444);
381
+ border-color: var(--vscode-button-border);
382
+ border-radius: 50%;
383
+ cursor: pointer;
384
+ box-shadow: 1px 1px 1px rgba(0,0,0,.25);
385
+ outline: none;
386
+ display: flex;
387
+ justify-content: center;
388
+ align-items: center;
389
+ }
390
+
391
+ #scroll-to-top:hover {
392
+ background-color: var(--vscode-button-hoverBackground);
393
+ box-shadow: 2px 2px 2px rgba(0,0,0,.25);
394
+ }
395
+
396
+ body.vscode-high-contrast #scroll-to-top {
397
+ border-width: 2px;
398
+ border-style: solid;
399
+ box-shadow: none;
400
+ }
401
+
402
+ #scroll-to-top span.icon::before {
403
+ content: "";
404
+ display: block;
405
+ background: var(--vscode-button-foreground);
406
+ /* Chevron up icon */
407
+ -webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KC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
+ /* Header styling */
414
+ h2 {
415
+ margin-top: 1.2em;
416
+ scroll-margin-top: 1.2em;
417
+ }
418
+
419
+ h2:not(:first-of-type) {
420
+ margin-top: 4em;
421
+ scroll-margin-top: 1em;
422
+ }
423
+
424
+ h3 {
425
+ margin-top: 4em;
426
+ scroll-margin-top: 1em;
427
+ }
428
+
429
+ h2 + h3 {
430
+ margin-top: 0;
431
+ }
432
+
433
+ /* Highlights table styling */
434
+ .highlights-table {
435
+ border-collapse: collapse;
436
+ border: none;
437
+ }
438
+
439
+ .highlights-table th {
440
+ vertical-align: top;
441
+ border: none;
442
+ padding-top: 2em;
443
+ font-weight: bold;
444
+ }
445
+
446
+ .highlights-table td {
447
+ vertical-align: top;
448
+ border: none;
449
+ }
450
+
451
+ .highlights-table tr:nth-child(2) td {
452
+ padding-bottom: 1em;
453
+ }
454
+
455
+ /* Main content layout */
456
+ .toc-nav-layout {
457
+ display: flex;
458
+ align-items: flex-start;
459
+ }
460
+
461
+ /* TOC Navigation */
462
+ #toc-nav {
463
+ position: sticky;
464
+ top: 20px;
465
+ width: 10vw;
466
+ min-width: 120px;
467
+ margin-right: 32px;
468
+ margin-top: 2em;
469
+ }
470
+
471
+ #toc-nav > div {
472
+ font-weight: bold;
473
+ font-size: 1em;
474
+ margin-bottom: 1em;
475
+ text-transform: uppercase;
476
+ }
477
+
478
+ #toc-nav ul {
479
+ list-style: none;
480
+ padding: 0;
481
+ margin: 0;
482
+ }
483
+
484
+ #toc-nav ul li {
485
+ margin-bottom: 0.5em;
486
+ }
487
+
488
+ #toc-nav a {
489
+ color: var(--vscode-editor-foreground, #ccc);
490
+ text-decoration: none !important;
491
+ transition: background-color 0.2s, color 0.2s;
492
+ padding: 4px 6px;
493
+ margin: -4px -6px;
494
+ border-radius: 4px;
495
+ display: block;
496
+ outline: none;
497
+ }
498
+
499
+ #toc-nav a:hover {
500
+ background-color: var(--vscode-button-secondaryHoverBackground, #1177bb);
501
+ color: var(--vscode-button-secondaryForeground, #ffffff);
502
+ cursor: pointer;
503
+ text-decoration: none !important;
504
+ }
505
+
506
+ /* Main content area */
507
+ .notes-main {
508
+ flex: 1;
509
+ min-width: 0;
510
+ }
511
+
512
+ /* Responsive breakpoint - Hide TOC on smaller screens */
513
+ @media (max-width: 576px) {
514
+ #toc-nav {
515
+ display: none;
516
+ }
517
+
518
+ .toc-nav-layout {
519
+ flex-direction: column;
520
+ }
521
+
522
+ .notes-main {
523
+ margin-left: 0;
524
+ }
525
+ }
526
+ </style>
527
+ </head>
528
+ <body>
529
+ ${processedContent}
530
+ <script nonce="${nonce}">
531
+ const vscode = acquireVsCodeApi();
532
+ const container = document.createElement('p');
533
+ container.style.display = 'flex';
534
+ container.style.alignItems = 'center';
535
+
536
+ const input = document.createElement('input');
537
+ input.type = 'checkbox';
538
+ input.id = 'showReleaseNotes';
539
+ input.checked = ${showReleaseNotes};
540
+ container.appendChild(input);
541
+
542
+ const label = document.createElement('label');
543
+ label.htmlFor = 'showReleaseNotes';
544
+ label.textContent = '${( localize(13218, "Show release notes after an update"))}';
545
+ container.appendChild(label);
546
+
547
+ const beforeElement = document.querySelector("body > h1")?.nextElementSibling;
548
+ if (beforeElement) {
549
+ document.body.insertBefore(container, beforeElement);
550
+ } else {
551
+ document.body.appendChild(container);
552
+ }
553
+
554
+ window.addEventListener('message', event => {
555
+ if (event.data.type === 'showReleaseNotes') {
556
+ input.checked = event.data.value;
557
+ }
558
+ });
559
+
560
+ window.addEventListener('click', event => {
561
+ const href = event.target.href ?? event.target.parentElement?.href ?? event.target.parentElement?.parentElement?.href;
562
+ if (href && (href.startsWith('${Schemas.codeSetting}'))) {
563
+ vscode.postMessage({ type: 'clickSetting', value: { uri: href, x: event.clientX, y: event.clientY }});
564
+ }
565
+ });
566
+
567
+ window.addEventListener('keypress', event => {
568
+ if (event.keyCode === 13) {
569
+ if (event.target.children.length > 0 && event.target.children[0].href) {
570
+ const clientRect = event.target.getBoundingClientRect();
571
+ vscode.postMessage({ type: 'clickSetting', value: { uri: event.target.children[0].href, x: clientRect.right , y: clientRect.bottom }});
572
+ }
573
+ }
574
+ });
575
+
576
+ input.addEventListener('change', event => {
577
+ vscode.postMessage({ type: 'showReleaseNotes', value: input.checked }, '*');
578
+ });
579
+ </script>
580
+ </body>
581
+ </html>`;
546
582
  }
547
583
  onDidChangeConfiguration(e) {
548
- if (e.affectsConfiguration('update.showReleaseNotes')) {
584
+ if (e.affectsConfiguration("update.showReleaseNotes")) {
549
585
  this.updateCheckboxWebview();
550
586
  }
551
587
  }
@@ -557,47 +593,34 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
557
593
  updateCheckboxWebview() {
558
594
  if (this._currentReleaseNotes) {
559
595
  this._currentReleaseNotes.webview.postMessage({
560
- type: 'showReleaseNotes',
561
- value: this._configurationService.getValue('update.showReleaseNotes')
596
+ type: "showReleaseNotes",
597
+ value: this._configurationService.getValue("update.showReleaseNotes")
562
598
  });
563
599
  }
564
600
  }
565
601
  };
566
- ReleaseNotesManager = ( __decorate([
567
- ( __param(0, IEnvironmentService)),
568
- ( __param(1, IKeybindingService)),
569
- ( __param(2, ILanguageService)),
570
- ( __param(3, IOpenerService)),
571
- ( __param(4, IRequestService)),
572
- ( __param(5, IConfigurationService)),
573
- ( __param(6, IEditorService)),
574
- ( __param(7, IEditorGroupsService)),
575
- ( __param(8, ICodeEditorService)),
576
- ( __param(9, IWebviewWorkbenchService)),
577
- ( __param(10, IExtensionService)),
578
- ( __param(11, IProductService)),
579
- ( __param(12, IInstantiationService))
580
- ], ReleaseNotesManager));
602
+ ReleaseNotesManager = ( __decorate([( __param(0, IEnvironmentService)), ( __param(1, IKeybindingService)), ( __param(2, ILanguageService)), ( __param(3, IOpenerService)), ( __param(4, IRequestService)), ( __param(5, IConfigurationService)), ( __param(6, IEditorService)), ( __param(7, IEditorGroupsService)), ( __param(8, ICodeEditorService)), ( __param(9, IWebviewWorkbenchService)), ( __param(10, IExtensionService)), ( __param(11, IProductService)), ( __param(12, IInstantiationService))], ReleaseNotesManager));
581
603
  async function renderReleaseNotesMarkdown(text, extensionService, languageService, simpleSettingRenderer) {
582
- text = ( text
583
- .toString())
584
- .replace(/<!--\s*TOC\s*/gi, '')
585
- .replace(/\s*Navigation End\s*-->/gi, '');
604
+ text = ( text.toString()).replace(/<!--\s*TOC\s*/gi, "").replace(/\s*Navigation End\s*-->/gi, "");
586
605
  return renderMarkdownDocument(text, extensionService, languageService, {
587
606
  sanitizerConfig: {
588
607
  allowRelativeMediaPaths: true,
589
608
  allowedLinkProtocols: {
590
609
  override: [Schemas.http, Schemas.https, Schemas.command, Schemas.codeSetting]
591
610
  },
592
- allowedTags: { augment: ['nav', 'svg', 'path'] },
593
- allowedAttributes: { augment: ['aria-role', 'viewBox', 'fill', 'xmlns', 'd'] }
611
+ allowedTags: {
612
+ augment: ["nav", "svg", "path"]
613
+ },
614
+ allowedAttributes: {
615
+ augment: ["aria-role", "viewBox", "fill", "xmlns", "d"]
616
+ }
594
617
  },
595
618
  markedExtensions: [{
596
- renderer: {
597
- html: simpleSettingRenderer.getHtmlRenderer(),
598
- codespan: simpleSettingRenderer.getCodeSpanRenderer(),
599
- }
600
- }]
619
+ renderer: {
620
+ html: simpleSettingRenderer.getHtmlRenderer(),
621
+ codespan: simpleSettingRenderer.getCodeSpanRenderer()
622
+ }
623
+ }]
601
624
  });
602
625
  }
603
626