@codingame/monaco-vscode-update-service-override 37.2.0 → 37.3.1

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 (19) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/update/common/update.config.contribution.js +18 -18
  3. package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.js +5 -5
  4. package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +19 -19
  5. package/vscode/src/vs/workbench/browser/media/code-icon.svg +0 -1
  6. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.d.ts +0 -43
  7. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +0 -330
  8. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTitleBarEntry.css +0 -91
  9. package/vscode/src/vs/workbench/contrib/update/browser/media/updateTooltip.css +0 -165
  10. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.d.ts +0 -67
  11. package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +0 -646
  12. package/vscode/src/vs/workbench/contrib/update/browser/update.d.ts +0 -65
  13. package/vscode/src/vs/workbench/contrib/update/browser/update.js +0 -498
  14. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.d.ts +0 -64
  15. package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.js +0 -364
  16. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.d.ts +0 -61
  17. package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.js +0 -395
  18. package/vscode/src/vs/workbench/contrib/update/common/updateUtils.d.ts +0 -61
  19. package/vscode/src/vs/workbench/contrib/update/common/updateUtils.js +0 -129
@@ -1,646 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
4
- import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
5
- import { onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
6
- import { escapeMarkdownSyntaxTokens } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
7
- import { KeybindingParser } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keybindingParser';
8
- import { escape } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
9
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
10
- import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
11
- import { TokenizationRegistry } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
12
- import { generateTokensCSSForColorMap } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/supports/tokenization';
13
- import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
14
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
15
- import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
16
- import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
17
- import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
18
- import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
19
- import { asTextOrError } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request';
20
- import { IRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service';
21
- import { DEFAULT_MARKDOWN_STYLES, renderMarkdownDocument } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer';
22
- import { IWebviewWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.service';
23
- import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
24
- import { ACTIVE_GROUP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService';
25
- import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
26
- import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
27
- import { supportsTelemetry, getTelemetryLevel } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetryUtils';
28
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
29
- import { TelemetryLevel } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry';
30
- import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
31
- import { SimpleSettingRenderer } from '../../markdown/browser/markdownSettingRenderer.js';
32
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
33
- import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
34
- import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
35
- import { dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
36
- import { asWebviewUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/webview/common/webview';
37
-
38
- let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
39
- constructor(
40
- _environmentService,
41
- _keybindingService,
42
- _languageService,
43
- _openerService,
44
- _requestService,
45
- _configurationService,
46
- _editorService,
47
- _editorGroupService,
48
- _codeEditorService,
49
- _webviewWorkbenchService,
50
- _extensionService,
51
- _productService,
52
- _instantiationService
53
- ) {
54
- super();
55
- this._environmentService = _environmentService;
56
- this._keybindingService = _keybindingService;
57
- this._languageService = _languageService;
58
- this._openerService = _openerService;
59
- this._requestService = _requestService;
60
- this._configurationService = _configurationService;
61
- this._editorService = _editorService;
62
- this._editorGroupService = _editorGroupService;
63
- this._codeEditorService = _codeEditorService;
64
- this._webviewWorkbenchService = _webviewWorkbenchService;
65
- this._extensionService = _extensionService;
66
- this._productService = _productService;
67
- this._instantiationService = _instantiationService;
68
- this._releaseNotesCache = ( new Map());
69
- this._currentReleaseNotes = undefined;
70
- this._register(TokenizationRegistry.onDidChange(() => {
71
- return this.updateHtml();
72
- }));
73
- this._register(
74
- _configurationService.onDidChangeConfiguration(e => this.onDidChangeConfiguration(e))
75
- );
76
- this._register(
77
- _webviewWorkbenchService.onDidChangeActiveWebviewEditor(e => this.onDidChangeActiveWebviewEditor(e))
78
- );
79
- this._simpleSettingRenderer = this._instantiationService.createInstance(SimpleSettingRenderer);
80
- }
81
- async updateHtml() {
82
- if (!this._currentReleaseNotes || !this._lastMeta) {
83
- return;
84
- }
85
- const html = await this.renderBody(this._lastMeta);
86
- if (this._currentReleaseNotes) {
87
- this._currentReleaseNotes.webview.setHtml(html);
88
- }
89
- }
90
- async getBase(useCurrentFile) {
91
- if (useCurrentFile) {
92
- const currentFileUri = this._codeEditorService.getActiveCodeEditor()?.getModel()?.uri;
93
- if (currentFileUri) {
94
- return dirname(currentFileUri);
95
- }
96
- }
97
- return ( URI.parse("https://code.visualstudio.com/raw"));
98
- }
99
- async show(version, useCurrentFile) {
100
- const releaseNoteText = await this.loadReleaseNotes(version, useCurrentFile);
101
- const base = await this.getBase(useCurrentFile);
102
- this._lastMeta = {
103
- text: releaseNoteText,
104
- base
105
- };
106
- const html = await this.renderBody(this._lastMeta);
107
- const title = ( localize(18356, "Release Notes: {0}", version));
108
- const activeEditorPane = this._editorService.activeEditorPane;
109
- if (this._currentReleaseNotes) {
110
- this._currentReleaseNotes.setWebviewTitle(title);
111
- this._currentReleaseNotes.webview.setHtml(html);
112
- this._webviewWorkbenchService.revealWebview(
113
- this._currentReleaseNotes,
114
- activeEditorPane ? activeEditorPane.group : this._editorGroupService.activeGroup,
115
- false
116
- );
117
- } else {
118
- this._currentReleaseNotes = this._webviewWorkbenchService.openWebview({
119
- title,
120
- options: {
121
- tryRestoreScrollPosition: true,
122
- enableFindWidget: true,
123
- disableServiceWorker: useCurrentFile ? false : true
124
- },
125
- contentOptions: {
126
- localResourceRoots: useCurrentFile ? [base] : [],
127
- allowScripts: true
128
- },
129
- extension: undefined
130
- }, "releaseNotes", title, Codicon.vscode, {
131
- group: ACTIVE_GROUP,
132
- preserveFocus: false
133
- });
134
- const disposables = ( new DisposableStore());
135
- disposables.add(
136
- this._currentReleaseNotes.webview.onDidClickLink(uri => this.onDidClickLink(( URI.parse(uri))))
137
- );
138
- disposables.add(this._currentReleaseNotes.webview.onMessage(e => {
139
- if (e.message.type === "showReleaseNotes") {
140
- this._configurationService.updateValue("update.showReleaseNotes", e.message.value);
141
- } else if (e.message.type === "clickSetting") {
142
- const x = this._currentReleaseNotes?.webview.container.offsetLeft + e.message.value.x;
143
- const y = this._currentReleaseNotes?.webview.container.offsetTop + e.message.value.y;
144
- this._simpleSettingRenderer.updateSetting(( URI.parse(e.message.value.uri)), x, y);
145
- }
146
- }));
147
- disposables.add(this._currentReleaseNotes.onWillDispose(() => {
148
- disposables.dispose();
149
- this._currentReleaseNotes = undefined;
150
- }));
151
- this._currentReleaseNotes.webview.setHtml(html);
152
- }
153
- return true;
154
- }
155
- async loadReleaseNotes(version, useCurrentFile) {
156
- const match = /^(\d+\.\d+)\./.exec(version);
157
- if (!match) {
158
- throw ( new Error("not found"));
159
- }
160
- const versionLabel = match[1].replace(/\./g, "_");
161
- const baseUrl = "https://code.visualstudio.com/raw";
162
- const url = `${baseUrl}/v${versionLabel}.md`;
163
- const unassigned = ( localize(18357, "unassigned"));
164
- const escapeMdHtml = text => {
165
- return escape(text).replace(/\\/g, "\\\\");
166
- };
167
- const patchKeybindings = text => {
168
- const kb = (match, kb) => {
169
- const keybinding = this._keybindingService.lookupKeybinding(kb);
170
- if (!keybinding) {
171
- return kb;
172
- }
173
- return keybinding.getLabel() || kb;
174
- };
175
- const kbstyle = (match, kb) => {
176
- const keybinding = KeybindingParser.parseKeybinding(kb);
177
- if (!keybinding) {
178
- return unassigned;
179
- }
180
- const resolvedKeybindings = this._keybindingService.resolveKeybinding(keybinding);
181
- if (resolvedKeybindings.length === 0) {
182
- return unassigned;
183
- }
184
- return resolvedKeybindings[0].getLabel() || unassigned;
185
- };
186
- const kbCode = (match, binding) => {
187
- const resolved = kb(match, binding);
188
- return resolved ? `<code title="${binding}">${escapeMdHtml(resolved)}</code>` : resolved;
189
- };
190
- const kbstyleCode = (match, binding) => {
191
- const resolved = kbstyle(match, binding);
192
- return resolved ? `<code title="${binding}">${escapeMdHtml(resolved)}</code>` : resolved;
193
- };
194
- return text.replace(/`kb\(([a-z.\d\-]+)\)`/gi, kbCode).replace(/`kbstyle\(([^\)]+)\)`/gi, kbstyleCode).replace(
195
- /kb\(([a-z.\d\-]+)\)/gi,
196
- (match, binding) => escapeMarkdownSyntaxTokens(kb(match, binding))
197
- ).replace(
198
- /kbstyle\(([^\)]+)\)/gi,
199
- (match, binding) => escapeMarkdownSyntaxTokens(kbstyle(match, binding))
200
- );
201
- };
202
- const fetchReleaseNotes = async () => {
203
- let text;
204
- try {
205
- if (useCurrentFile) {
206
- const file = this._codeEditorService.getActiveCodeEditor()?.getModel()?.getValue();
207
- text = file ? file.substring(file.indexOf("#")) : undefined;
208
- } else {
209
- text = await asTextOrError(await this._requestService.request({
210
- url,
211
- callSite: "releaseNotesEditor.fetchReleaseNotes"
212
- }, CancellationToken.None));
213
- }
214
- } catch {
215
- throw ( new Error("Failed to fetch release notes"));
216
- }
217
- if (!text || (!/^#\s/.test(text) && !useCurrentFile)) {
218
- throw ( new Error("Invalid release notes"));
219
- }
220
- return patchKeybindings(text);
221
- };
222
- if (useCurrentFile) {
223
- return fetchReleaseNotes();
224
- }
225
- if (!( this._releaseNotesCache.has(version))) {
226
- this._releaseNotesCache.set(version, (async () => {
227
- try {
228
- return await fetchReleaseNotes();
229
- } catch (err) {
230
- this._releaseNotesCache.delete(version);
231
- throw err;
232
- }
233
- })());
234
- }
235
- return this._releaseNotesCache.get(version);
236
- }
237
- async onDidClickLink(uri) {
238
- if (uri.scheme === Schemas.codeSetting)
239
- ; else {
240
- this.addGAParameters(uri, "ReleaseNotes").then(updated => this._openerService.open(updated, {
241
- allowCommands: ["workbench.action.openSettings", "summarize.release.notes"]
242
- })).then(undefined, onUnexpectedError);
243
- }
244
- }
245
- async addGAParameters(uri, origin, experiment = "1") {
246
- if (supportsTelemetry(this._productService, this._environmentService) && getTelemetryLevel(this._configurationService) === TelemetryLevel.USAGE) {
247
- if (uri.scheme === "https" && uri.authority === "code.visualstudio.com") {
248
- return uri.with({
249
- query: `${uri.query ? uri.query + "&" : ""}utm_source=VsCode&utm_medium=${encodeURIComponent(origin)}&utm_content=${encodeURIComponent(experiment)}`
250
- });
251
- }
252
- }
253
- return uri;
254
- }
255
- async renderBody(fileContent) {
256
- const nonce = generateUuid();
257
- const processedContent = await renderReleaseNotesMarkdown(
258
- fileContent.text,
259
- this._extensionService,
260
- this._languageService,
261
- this._simpleSettingRenderer,
262
- this._productService.quality
263
- );
264
- const colorMap = TokenizationRegistry.getColorMap();
265
- const css = colorMap ? generateTokensCSSForColorMap(colorMap) : "";
266
- const showReleaseNotes = Boolean(this._configurationService.getValue("update.showReleaseNotes"));
267
- return `<!DOCTYPE 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,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
408
- mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
409
- width: 16px;
410
- height: 16px;
411
- }
412
-
413
- /* 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
-
527
- </style>
528
- </head>
529
- <body>
530
- ${processedContent}
531
- <script nonce="${nonce}">
532
- const vscode = acquireVsCodeApi();
533
- const container = document.createElement('p');
534
- container.style.display = 'flex';
535
- container.style.alignItems = 'center';
536
-
537
- const input = document.createElement('input');
538
- input.type = 'checkbox';
539
- input.id = 'showReleaseNotes';
540
- input.checked = ${showReleaseNotes};
541
- container.appendChild(input);
542
-
543
- const label = document.createElement('label');
544
- label.htmlFor = 'showReleaseNotes';
545
- label.textContent = '${( localize(18358, "Show release notes after an update"))}';
546
- container.appendChild(label);
547
-
548
- const beforeElement = document.querySelector("body > h1")?.nextElementSibling;
549
- if (beforeElement) {
550
- document.body.insertBefore(container, beforeElement);
551
- } else {
552
- document.body.appendChild(container);
553
- }
554
-
555
- window.addEventListener('message', event => {
556
- if (event.data.type === 'showReleaseNotes') {
557
- input.checked = event.data.value;
558
- }
559
- });
560
-
561
- window.addEventListener('click', event => {
562
- const href = event.target.href ?? event.target.parentElement?.href ?? event.target.parentElement?.parentElement?.href;
563
- if (href && (href.startsWith('${Schemas.codeSetting}'))) {
564
- vscode.postMessage({ type: 'clickSetting', value: { uri: href, x: event.clientX, y: event.clientY }});
565
- }
566
- });
567
-
568
- window.addEventListener('keypress', event => {
569
- if (event.keyCode === 13) {
570
- if (event.target.children.length > 0 && event.target.children[0].href) {
571
- const clientRect = event.target.getBoundingClientRect();
572
- vscode.postMessage({ type: 'clickSetting', value: { uri: event.target.children[0].href, x: clientRect.right , y: clientRect.bottom }});
573
- }
574
- }
575
- });
576
-
577
- input.addEventListener('change', event => {
578
- vscode.postMessage({ type: 'showReleaseNotes', value: input.checked }, '*');
579
- });
580
- </script>
581
- </body>
582
- </html>`;
583
- }
584
- onDidChangeConfiguration(e) {
585
- if (e.affectsConfiguration("update.showReleaseNotes")) {
586
- this.updateCheckboxWebview();
587
- }
588
- }
589
- onDidChangeActiveWebviewEditor(input) {
590
- if (input && input === this._currentReleaseNotes) {
591
- this.updateCheckboxWebview();
592
- }
593
- }
594
- updateCheckboxWebview() {
595
- if (this._currentReleaseNotes) {
596
- this._currentReleaseNotes.webview.postMessage({
597
- type: "showReleaseNotes",
598
- value: this._configurationService.getValue("update.showReleaseNotes")
599
- });
600
- }
601
- }
602
- };
603
- 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));
604
- function processConditionalBlocks(text, activeConditions) {
605
- return text.replace(
606
- /<!--\s*%IF\s+(\w+)\s*%([\s\S]*?)%ENDIF\s*%\s*-->/gi,
607
- (_match, condition, content) => {
608
- if (( activeConditions.has(condition.toUpperCase()))) {
609
- return content;
610
- }
611
- return "";
612
- }
613
- );
614
- }
615
- async function renderReleaseNotesMarkdown(text, extensionService, languageService, simpleSettingRenderer, quality) {
616
- text = ( text.toString()).replace(/<!--\s*TOC\s*/gi, "").replace(/\s*Navigation End\s*-->/gi, "");
617
- const activeConditions = ( new Set(["IN_PRODUCT"]));
618
- if (quality === "stable") {
619
- activeConditions.add("STABLE");
620
- } else if (quality === "insider") {
621
- activeConditions.add("INSIDERS");
622
- }
623
- text = processConditionalBlocks(text, activeConditions);
624
- return renderMarkdownDocument(text, extensionService, languageService, {
625
- sanitizerConfig: {
626
- allowRelativeMediaPaths: true,
627
- allowedLinkProtocols: {
628
- override: [Schemas.http, Schemas.https, Schemas.command, Schemas.codeSetting]
629
- },
630
- allowedTags: {
631
- augment: ["nav", "svg", "path"]
632
- },
633
- allowedAttributes: {
634
- augment: ["aria-role", "viewBox", "fill", "xmlns", "d"]
635
- }
636
- },
637
- markedExtensions: [{
638
- renderer: {
639
- html: simpleSettingRenderer.getHtmlRenderer(),
640
- codespan: simpleSettingRenderer.getCodeSpanRenderer()
641
- }
642
- }]
643
- });
644
- }
645
-
646
- export { ReleaseNotesManager, processConditionalBlocks, renderReleaseNotesMarkdown };