@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.
- package/package.json +2 -2
- package/vscode/src/vs/platform/update/common/update.config.contribution.js +23 -46
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownSettingRenderer.js +14 -14
- package/vscode/src/vs/workbench/contrib/update/browser/media/postUpdateWidget.css +68 -0
- package/vscode/src/vs/workbench/contrib/update/browser/media/updateTitleBarEntry.css +2 -20
- package/vscode/src/vs/workbench/contrib/update/browser/media/updateTooltip.css +32 -26
- package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/update/browser/postUpdateWidget.js +219 -0
- package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.d.ts +1 -7
- package/vscode/src/vs/workbench/contrib/update/browser/releaseNotesEditor.js +5 -177
- package/vscode/src/vs/workbench/contrib/update/browser/update.contribution.js +44 -17
- package/vscode/src/vs/workbench/contrib/update/browser/update.d.ts +1 -17
- package/vscode/src/vs/workbench/contrib/update/browser/update.js +40 -279
- package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.d.ts +5 -7
- package/vscode/src/vs/workbench/contrib/update/browser/updateTitleBarEntry.js +83 -78
- package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.d.ts +6 -12
- package/vscode/src/vs/workbench/contrib/update/browser/updateTooltip.js +83 -125
- package/vscode/src/vs/workbench/contrib/update/common/updateInfoParser.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/update/common/updateInfoParser.js +74 -0
- package/vscode/src/vs/workbench/contrib/update/common/updateUtils.js +9 -21
- package/vscode/src/vs/workbench/contrib/update/browser/media/updateStatusBarEntry.css +0 -9
- package/vscode/src/vs/workbench/contrib/update/browser/updateStatusBarEntry.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/update/browser/updateStatusBarEntry.js +0 -140
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
|
|
2
|
+
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
4
|
+
import { $, append, addDisposableListener } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
5
|
+
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
6
|
+
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
7
|
+
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { isWeb } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
9
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
10
|
+
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
11
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
12
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
13
|
+
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
14
|
+
import { ILayoutService } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service';
|
|
15
|
+
import { openLinkFromMarkdown } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer';
|
|
16
|
+
import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.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 { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
22
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
23
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
24
|
+
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
25
|
+
import { ShowCurrentReleaseNotesActionId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/update/common/update';
|
|
26
|
+
import { parseUpdateInfoInput } from '../common/updateInfoParser.js';
|
|
27
|
+
import { getUpdateInfoUrl, isMajorMinorVersionChange } from '../common/updateUtils.js';
|
|
28
|
+
import * as postUpdateWidget from './media/postUpdateWidget.css';
|
|
29
|
+
|
|
30
|
+
registerCss(postUpdateWidget);
|
|
31
|
+
const LAST_KNOWN_VERSION_KEY = "postUpdateWidget/lastKnownVersion";
|
|
32
|
+
let PostUpdateWidgetContribution = class PostUpdateWidgetContribution extends Disposable {
|
|
33
|
+
constructor(
|
|
34
|
+
commandService,
|
|
35
|
+
configurationService,
|
|
36
|
+
hostService,
|
|
37
|
+
hoverService,
|
|
38
|
+
layoutService,
|
|
39
|
+
markdownRendererService,
|
|
40
|
+
openerService,
|
|
41
|
+
productService,
|
|
42
|
+
requestService,
|
|
43
|
+
storageService,
|
|
44
|
+
telemetryService
|
|
45
|
+
) {
|
|
46
|
+
super();
|
|
47
|
+
this.commandService = commandService;
|
|
48
|
+
this.configurationService = configurationService;
|
|
49
|
+
this.hostService = hostService;
|
|
50
|
+
this.hoverService = hoverService;
|
|
51
|
+
this.layoutService = layoutService;
|
|
52
|
+
this.markdownRendererService = markdownRendererService;
|
|
53
|
+
this.openerService = openerService;
|
|
54
|
+
this.productService = productService;
|
|
55
|
+
this.requestService = requestService;
|
|
56
|
+
this.storageService = storageService;
|
|
57
|
+
this.telemetryService = telemetryService;
|
|
58
|
+
if (isWeb) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this._register(CommandsRegistry.registerCommand(
|
|
62
|
+
"_update.showUpdateInfo",
|
|
63
|
+
(_accessor, markdown) => this.showUpdateInfo(markdown)
|
|
64
|
+
));
|
|
65
|
+
void this.tryShowOnStartup();
|
|
66
|
+
}
|
|
67
|
+
async tryShowOnStartup() {
|
|
68
|
+
if (!(await this.hostService.hadLastFocus())) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!this.detectVersionChange()) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (this.configurationService.getValue("update.showPostInstallInfo") === false) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await this.showUpdateInfo();
|
|
78
|
+
}
|
|
79
|
+
async showUpdateInfo(markdown) {
|
|
80
|
+
const info = await this.getUpdateInfo(markdown);
|
|
81
|
+
if (!info) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const contentDisposables = ( new DisposableStore());
|
|
85
|
+
const target = this.layoutService.mainContainer;
|
|
86
|
+
const {
|
|
87
|
+
clientWidth
|
|
88
|
+
} = target;
|
|
89
|
+
const maxWidth = 550;
|
|
90
|
+
const x = Math.max(clientWidth - maxWidth - 80, 16);
|
|
91
|
+
this.hoverService.showInstantHover({
|
|
92
|
+
content: this.buildContent(info, contentDisposables),
|
|
93
|
+
target: {
|
|
94
|
+
targetElements: [target],
|
|
95
|
+
x,
|
|
96
|
+
y: 40,
|
|
97
|
+
dispose: () => contentDisposables.dispose()
|
|
98
|
+
},
|
|
99
|
+
persistence: {
|
|
100
|
+
sticky: true
|
|
101
|
+
},
|
|
102
|
+
appearance: {
|
|
103
|
+
showPointer: false,
|
|
104
|
+
compact: true,
|
|
105
|
+
maxHeightRatio: 0.8
|
|
106
|
+
}
|
|
107
|
+
}, true);
|
|
108
|
+
}
|
|
109
|
+
async getUpdateInfo(input) {
|
|
110
|
+
if (!input) {
|
|
111
|
+
try {
|
|
112
|
+
const url = getUpdateInfoUrl(this.productService.version);
|
|
113
|
+
const context = await this.requestService.request({
|
|
114
|
+
url,
|
|
115
|
+
callSite: "postUpdateWidget"
|
|
116
|
+
}, CancellationToken.None);
|
|
117
|
+
input = await asTextOrError(context);
|
|
118
|
+
} catch {}
|
|
119
|
+
}
|
|
120
|
+
if (!input) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
let info = parseUpdateInfoInput(input);
|
|
124
|
+
if (!info?.buttons?.length) {
|
|
125
|
+
info = {
|
|
126
|
+
...info,
|
|
127
|
+
buttons: [{
|
|
128
|
+
label: ( localize(14961, "Release Notes")),
|
|
129
|
+
commandId: ShowCurrentReleaseNotesActionId,
|
|
130
|
+
args: [this.productService.version],
|
|
131
|
+
style: "secondary"
|
|
132
|
+
}]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return info;
|
|
136
|
+
}
|
|
137
|
+
buildContent(
|
|
138
|
+
{
|
|
139
|
+
markdown,
|
|
140
|
+
buttons
|
|
141
|
+
},
|
|
142
|
+
disposables
|
|
143
|
+
) {
|
|
144
|
+
const container = $(".post-update-widget");
|
|
145
|
+
const header = append(container, $(".header"));
|
|
146
|
+
const title = append(header, $(".title"));
|
|
147
|
+
title.textContent = ( localize(14962, "New in {0}", this.productService.version));
|
|
148
|
+
const markdownContainer = append(container, $(".update-markdown"));
|
|
149
|
+
const rendered = disposables.add(this.markdownRendererService.render(( new MarkdownString(markdown, {
|
|
150
|
+
isTrusted: true,
|
|
151
|
+
supportHtml: true,
|
|
152
|
+
supportThemeIcons: true
|
|
153
|
+
})), {
|
|
154
|
+
actionHandler: (link, mdStr) => {
|
|
155
|
+
openLinkFromMarkdown(this.openerService, link, mdStr.isTrusted);
|
|
156
|
+
this.hoverService.hideHover(true);
|
|
157
|
+
}
|
|
158
|
+
}));
|
|
159
|
+
markdownContainer.appendChild(rendered.element);
|
|
160
|
+
if (buttons?.length) {
|
|
161
|
+
const buttonBar = append(container, $(".button-bar"));
|
|
162
|
+
let seenSecondary = false;
|
|
163
|
+
for (const {
|
|
164
|
+
label,
|
|
165
|
+
style,
|
|
166
|
+
commandId,
|
|
167
|
+
args
|
|
168
|
+
} of buttons) {
|
|
169
|
+
const button = append(buttonBar, $("button"));
|
|
170
|
+
button.textContent = label;
|
|
171
|
+
if (style === "secondary") {
|
|
172
|
+
button.classList.add("update-button-secondary");
|
|
173
|
+
if (!seenSecondary && buttons.length > 1) {
|
|
174
|
+
button.classList.add("update-button-leading-secondary");
|
|
175
|
+
seenSecondary = true;
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
button.classList.add("update-button-primary");
|
|
179
|
+
}
|
|
180
|
+
disposables.add(addDisposableListener(button, "click", () => {
|
|
181
|
+
this.telemetryService.publicLog2("workbenchActionExecuted", {
|
|
182
|
+
id: commandId,
|
|
183
|
+
from: "postUpdateWidget"
|
|
184
|
+
});
|
|
185
|
+
void this.commandService.executeCommand(commandId, ...(args ?? []));
|
|
186
|
+
this.hoverService.hideHover(true);
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return container;
|
|
191
|
+
}
|
|
192
|
+
detectVersionChange() {
|
|
193
|
+
let from;
|
|
194
|
+
try {
|
|
195
|
+
from = this.storageService.getObject(LAST_KNOWN_VERSION_KEY, StorageScope.APPLICATION);
|
|
196
|
+
} catch {}
|
|
197
|
+
const to = {
|
|
198
|
+
version: this.productService.version,
|
|
199
|
+
commit: this.productService.commit,
|
|
200
|
+
timestamp: Date.now()
|
|
201
|
+
};
|
|
202
|
+
if (from?.commit === to.commit) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
this.storageService.store(
|
|
206
|
+
LAST_KNOWN_VERSION_KEY,
|
|
207
|
+
JSON.stringify(to),
|
|
208
|
+
StorageScope.APPLICATION,
|
|
209
|
+
StorageTarget.MACHINE
|
|
210
|
+
);
|
|
211
|
+
if (from) {
|
|
212
|
+
return isMajorMinorVersionChange(from.version, to.version);
|
|
213
|
+
}
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
PostUpdateWidgetContribution = ( __decorate([( __param(0, ICommandService)), ( __param(1, IConfigurationService)), ( __param(2, IHostService)), ( __param(3, IHoverService)), ( __param(4, ILayoutService)), ( __param(5, IMarkdownRendererService)), ( __param(6, IOpenerService)), ( __param(7, IProductService)), ( __param(8, IRequestService)), ( __param(9, IStorageService)), ( __param(10, ITelemetryService))], PostUpdateWidgetContribution));
|
|
218
|
+
|
|
219
|
+
export { PostUpdateWidgetContribution };
|
|
@@ -13,8 +13,6 @@ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/l
|
|
|
13
13
|
import { SimpleSettingRenderer } from "../../markdown/browser/markdownSettingRenderer.js";
|
|
14
14
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
15
15
|
import { ICodeEditorService } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service";
|
|
16
|
-
import { IUpdateService } from "@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service";
|
|
17
|
-
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
18
16
|
export declare class ReleaseNotesManager extends Disposable {
|
|
19
17
|
private readonly _environmentService;
|
|
20
18
|
private readonly _keybindingService;
|
|
@@ -29,13 +27,11 @@ export declare class ReleaseNotesManager extends Disposable {
|
|
|
29
27
|
private readonly _extensionService;
|
|
30
28
|
private readonly _productService;
|
|
31
29
|
private readonly _instantiationService;
|
|
32
|
-
private readonly _updateService;
|
|
33
|
-
private readonly _commandService;
|
|
34
30
|
private readonly _simpleSettingRenderer;
|
|
35
31
|
private readonly _releaseNotesCache;
|
|
36
32
|
private _currentReleaseNotes;
|
|
37
33
|
private _lastMeta;
|
|
38
|
-
constructor(_environmentService: IEnvironmentService, _keybindingService: IKeybindingService, _languageService: ILanguageService, _openerService: IOpenerService, _requestService: IRequestService, _configurationService: IConfigurationService, _editorService: IEditorService, _editorGroupService: IEditorGroupsService, _codeEditorService: ICodeEditorService, _webviewWorkbenchService: IWebviewWorkbenchService, _extensionService: IExtensionService, _productService: IProductService, _instantiationService: IInstantiationService
|
|
34
|
+
constructor(_environmentService: IEnvironmentService, _keybindingService: IKeybindingService, _languageService: ILanguageService, _openerService: IOpenerService, _requestService: IRequestService, _configurationService: IConfigurationService, _editorService: IEditorService, _editorGroupService: IEditorGroupsService, _codeEditorService: ICodeEditorService, _webviewWorkbenchService: IWebviewWorkbenchService, _extensionService: IExtensionService, _productService: IProductService, _instantiationService: IInstantiationService);
|
|
39
35
|
private updateHtml;
|
|
40
36
|
private getBase;
|
|
41
37
|
show(version: string, useCurrentFile: boolean): Promise<boolean>;
|
|
@@ -43,8 +39,6 @@ export declare class ReleaseNotesManager extends Disposable {
|
|
|
43
39
|
private onDidClickLink;
|
|
44
40
|
private addGAParameters;
|
|
45
41
|
private renderBody;
|
|
46
|
-
private getUpdateAction;
|
|
47
|
-
private postUpdateAction;
|
|
48
42
|
private onDidChangeConfiguration;
|
|
49
43
|
private onDidChangeActiveWebviewEditor;
|
|
50
44
|
private updateCheckboxWebview;
|
|
@@ -34,9 +34,6 @@ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/netw
|
|
|
34
34
|
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
|
|
35
35
|
import { dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
36
36
|
import { asWebviewUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/webview/common/webview';
|
|
37
|
-
import { StateType } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update';
|
|
38
|
-
import { IUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service';
|
|
39
|
-
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
40
37
|
|
|
41
38
|
let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
42
39
|
constructor(
|
|
@@ -52,9 +49,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
52
49
|
_webviewWorkbenchService,
|
|
53
50
|
_extensionService,
|
|
54
51
|
_productService,
|
|
55
|
-
_instantiationService
|
|
56
|
-
_updateService,
|
|
57
|
-
_commandService
|
|
52
|
+
_instantiationService
|
|
58
53
|
) {
|
|
59
54
|
super();
|
|
60
55
|
this._environmentService = _environmentService;
|
|
@@ -70,8 +65,6 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
70
65
|
this._extensionService = _extensionService;
|
|
71
66
|
this._productService = _productService;
|
|
72
67
|
this._instantiationService = _instantiationService;
|
|
73
|
-
this._updateService = _updateService;
|
|
74
|
-
this._commandService = _commandService;
|
|
75
68
|
this._releaseNotesCache = ( new Map());
|
|
76
69
|
this._currentReleaseNotes = undefined;
|
|
77
70
|
this._register(TokenizationRegistry.onDidChange(() => {
|
|
@@ -83,7 +76,6 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
83
76
|
this._register(
|
|
84
77
|
_webviewWorkbenchService.onDidChangeActiveWebviewEditor(e => this.onDidChangeActiveWebviewEditor(e))
|
|
85
78
|
);
|
|
86
|
-
this._register(this._updateService.onStateChange(() => this.postUpdateAction()));
|
|
87
79
|
this._simpleSettingRenderer = this._instantiationService.createInstance(SimpleSettingRenderer);
|
|
88
80
|
}
|
|
89
81
|
async updateHtml() {
|
|
@@ -112,7 +104,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
112
104
|
base
|
|
113
105
|
};
|
|
114
106
|
const html = await this.renderBody(this._lastMeta);
|
|
115
|
-
const title = ( localize(
|
|
107
|
+
const title = ( localize(14963, "Release Notes: {0}", version));
|
|
116
108
|
const activeEditorPane = this._editorService.activeEditorPane;
|
|
117
109
|
if (this._currentReleaseNotes) {
|
|
118
110
|
this._currentReleaseNotes.setWebviewTitle(title);
|
|
@@ -146,10 +138,6 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
146
138
|
disposables.add(this._currentReleaseNotes.webview.onMessage(e => {
|
|
147
139
|
if (e.message.type === "showReleaseNotes") {
|
|
148
140
|
this._configurationService.updateValue("update.showReleaseNotes", e.message.value);
|
|
149
|
-
} else if (e.message.type === "updateAction") {
|
|
150
|
-
if (e.message.commandId) {
|
|
151
|
-
this._commandService.executeCommand(e.message.commandId);
|
|
152
|
-
}
|
|
153
141
|
} else if (e.message.type === "clickSetting") {
|
|
154
142
|
const x = this._currentReleaseNotes?.webview.container.offsetLeft + e.message.value.x;
|
|
155
143
|
const y = this._currentReleaseNotes?.webview.container.offsetTop + e.message.value.y;
|
|
@@ -172,7 +160,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
172
160
|
const versionLabel = match[1].replace(/\./g, "_");
|
|
173
161
|
const baseUrl = "https://code.visualstudio.com/raw";
|
|
174
162
|
const url = `${baseUrl}/v${versionLabel}.md`;
|
|
175
|
-
const unassigned = ( localize(
|
|
163
|
+
const unassigned = ( localize(14964, "unassigned"));
|
|
176
164
|
const escapeMdHtml = text => {
|
|
177
165
|
return escape(text).replace(/\\/g, "\\\\");
|
|
178
166
|
};
|
|
@@ -276,7 +264,6 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
276
264
|
const colorMap = TokenizationRegistry.getColorMap();
|
|
277
265
|
const css = colorMap ? generateTokensCSSForColorMap(colorMap) : "";
|
|
278
266
|
const showReleaseNotes = Boolean(this._configurationService.getValue("update.showReleaseNotes"));
|
|
279
|
-
const updateAction = this.getUpdateAction();
|
|
280
267
|
return `<!DOCTYPE html>
|
|
281
268
|
<html>
|
|
282
269
|
<head>
|
|
@@ -537,81 +524,6 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
537
524
|
}
|
|
538
525
|
}
|
|
539
526
|
|
|
540
|
-
/* Update action button */
|
|
541
|
-
#update-action-btn {
|
|
542
|
-
position: fixed;
|
|
543
|
-
right: 25px;
|
|
544
|
-
top: 25px;
|
|
545
|
-
background-color: var(--vscode-button-background);
|
|
546
|
-
color: var(--vscode-button-foreground);
|
|
547
|
-
border: 1px solid var(--vscode-button-border, transparent);
|
|
548
|
-
border-radius: 50%;
|
|
549
|
-
width: 40px;
|
|
550
|
-
height: 40px;
|
|
551
|
-
padding: 0;
|
|
552
|
-
cursor: pointer;
|
|
553
|
-
font-size: var(--vscode-font-size);
|
|
554
|
-
font-family: var(--vscode-font-family);
|
|
555
|
-
white-space: nowrap;
|
|
556
|
-
box-shadow: 0 2px 8px var(--vscode-widget-shadow);
|
|
557
|
-
z-index: 100;
|
|
558
|
-
overflow: hidden;
|
|
559
|
-
display: flex;
|
|
560
|
-
align-items: center;
|
|
561
|
-
justify-content: center;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
#update-action-btn .icon {
|
|
565
|
-
flex-shrink: 0;
|
|
566
|
-
display: flex;
|
|
567
|
-
align-items: center;
|
|
568
|
-
justify-content: center;
|
|
569
|
-
width: 16px;
|
|
570
|
-
height: 16px;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
#update-action-btn .icon svg {
|
|
574
|
-
width: 16px;
|
|
575
|
-
height: 16px;
|
|
576
|
-
display: block;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
#update-action-btn .label {
|
|
580
|
-
overflow: hidden;
|
|
581
|
-
max-width: 0;
|
|
582
|
-
opacity: 0;
|
|
583
|
-
margin-left: 0;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
#update-action-btn:hover,
|
|
587
|
-
#update-action-btn.expanded {
|
|
588
|
-
background-color: var(--vscode-button-hoverBackground);
|
|
589
|
-
box-shadow: 0 2px 8px var(--vscode-widget-shadow);
|
|
590
|
-
width: auto;
|
|
591
|
-
height: auto;
|
|
592
|
-
max-height: 40px;
|
|
593
|
-
border-radius: var(--vscode-cornerRadius-small);
|
|
594
|
-
padding: 6px 10px;
|
|
595
|
-
line-height: 16px;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
#update-action-btn:hover .label,
|
|
599
|
-
#update-action-btn.expanded .label {
|
|
600
|
-
max-width: 200px;
|
|
601
|
-
opacity: 1;
|
|
602
|
-
margin-left: 6px;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
#update-action-btn.expanded {
|
|
606
|
-
background-color: var(--vscode-button-background);
|
|
607
|
-
box-shadow: 0 2px 8px var(--vscode-widget-shadow);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
body.vscode-high-contrast #update-action-btn {
|
|
611
|
-
border-width: 2px;
|
|
612
|
-
border-style: solid;
|
|
613
|
-
box-shadow: none;
|
|
614
|
-
}
|
|
615
527
|
</style>
|
|
616
528
|
</head>
|
|
617
529
|
<body>
|
|
@@ -630,7 +542,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
630
542
|
|
|
631
543
|
const label = document.createElement('label');
|
|
632
544
|
label.htmlFor = 'showReleaseNotes';
|
|
633
|
-
label.textContent = '${( localize(
|
|
545
|
+
label.textContent = '${( localize(14965, "Show release notes after an update"))}';
|
|
634
546
|
container.appendChild(label);
|
|
635
547
|
|
|
636
548
|
const beforeElement = document.querySelector("body > h1")?.nextElementSibling;
|
|
@@ -643,15 +555,6 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
643
555
|
window.addEventListener('message', event => {
|
|
644
556
|
if (event.data.type === 'showReleaseNotes') {
|
|
645
557
|
input.checked = event.data.value;
|
|
646
|
-
} else if (event.data.type === 'updateAction') {
|
|
647
|
-
if (event.data.label) {
|
|
648
|
-
updateActionBtn.querySelector('.label').textContent = event.data.label;
|
|
649
|
-
updateActionBtn.dataset.commandId = event.data.commandId;
|
|
650
|
-
updateActionBtn.setAttribute('aria-label', event.data.label);
|
|
651
|
-
updateActionBtn.style.display = 'flex';
|
|
652
|
-
} else {
|
|
653
|
-
updateActionBtn.style.display = 'none';
|
|
654
|
-
}
|
|
655
558
|
}
|
|
656
559
|
});
|
|
657
560
|
|
|
@@ -674,85 +577,10 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
674
577
|
input.addEventListener('change', event => {
|
|
675
578
|
vscode.postMessage({ type: 'showReleaseNotes', value: input.checked }, '*');
|
|
676
579
|
});
|
|
677
|
-
|
|
678
|
-
// Update action button
|
|
679
|
-
const updateActionBtn = document.createElement('button');
|
|
680
|
-
updateActionBtn.id = 'update-action-btn';
|
|
681
|
-
|
|
682
|
-
// Arrow-circle-down SVG icon
|
|
683
|
-
const iconSpan = document.createElement('span');
|
|
684
|
-
iconSpan.className = 'icon';
|
|
685
|
-
iconSpan.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 1v9.5M4.5 7.5L8 11l3.5-3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 13h10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>';
|
|
686
|
-
updateActionBtn.appendChild(iconSpan);
|
|
687
|
-
|
|
688
|
-
const labelSpan = document.createElement('span');
|
|
689
|
-
labelSpan.className = 'label';
|
|
690
|
-
updateActionBtn.appendChild(labelSpan);
|
|
691
|
-
|
|
692
|
-
const initialAction = ${JSON.stringify(updateAction ?? null)};
|
|
693
|
-
if (initialAction) {
|
|
694
|
-
labelSpan.textContent = initialAction.label;
|
|
695
|
-
updateActionBtn.dataset.commandId = initialAction.commandId;
|
|
696
|
-
updateActionBtn.setAttribute('aria-label', initialAction.label);
|
|
697
|
-
updateActionBtn.style.display = 'flex';
|
|
698
|
-
} else {
|
|
699
|
-
updateActionBtn.style.display = 'none';
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
document.body.appendChild(updateActionBtn);
|
|
703
|
-
|
|
704
|
-
updateActionBtn.addEventListener('click', () => {
|
|
705
|
-
if (updateActionBtn.dataset.commandId) {
|
|
706
|
-
vscode.postMessage({ type: 'updateAction', commandId: updateActionBtn.dataset.commandId });
|
|
707
|
-
}
|
|
708
|
-
});
|
|
709
|
-
|
|
710
|
-
// Expand button when at top of page
|
|
711
|
-
function updateExpandedState() {
|
|
712
|
-
if (window.scrollY <= 100) {
|
|
713
|
-
updateActionBtn.classList.add('expanded');
|
|
714
|
-
} else {
|
|
715
|
-
updateActionBtn.classList.remove('expanded');
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
updateExpandedState();
|
|
719
|
-
window.addEventListener('scroll', updateExpandedState);
|
|
720
580
|
</script>
|
|
721
581
|
</body>
|
|
722
582
|
</html>`;
|
|
723
583
|
}
|
|
724
|
-
getUpdateAction() {
|
|
725
|
-
const state = this._updateService.state;
|
|
726
|
-
switch (state.type) {
|
|
727
|
-
case StateType.AvailableForDownload:
|
|
728
|
-
return {
|
|
729
|
-
label: ( localize(14804, "Download Update")),
|
|
730
|
-
commandId: "update.downloadNow"
|
|
731
|
-
};
|
|
732
|
-
case StateType.Downloaded:
|
|
733
|
-
return {
|
|
734
|
-
label: ( localize(14805, "Install Update")),
|
|
735
|
-
commandId: "update.install"
|
|
736
|
-
};
|
|
737
|
-
case StateType.Ready:
|
|
738
|
-
return {
|
|
739
|
-
label: ( localize(14806, "Restart to Update")),
|
|
740
|
-
commandId: "update.restart"
|
|
741
|
-
};
|
|
742
|
-
default:
|
|
743
|
-
return undefined;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
postUpdateAction() {
|
|
747
|
-
if (this._currentReleaseNotes) {
|
|
748
|
-
const action = this.getUpdateAction();
|
|
749
|
-
this._currentReleaseNotes.webview.postMessage({
|
|
750
|
-
type: "updateAction",
|
|
751
|
-
label: action?.label ?? "",
|
|
752
|
-
commandId: action?.commandId ?? ""
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
584
|
onDidChangeConfiguration(e) {
|
|
757
585
|
if (e.affectsConfiguration("update.showReleaseNotes")) {
|
|
758
586
|
this.updateCheckboxWebview();
|
|
@@ -772,7 +600,7 @@ let ReleaseNotesManager = class ReleaseNotesManager extends Disposable {
|
|
|
772
600
|
}
|
|
773
601
|
}
|
|
774
602
|
};
|
|
775
|
-
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))
|
|
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));
|
|
776
604
|
function processConditionalBlocks(text, activeConditions) {
|
|
777
605
|
return text.replace(
|
|
778
606
|
/<!--\s*%IF\s+(\w+)\s*%([\s\S]*?)%ENDIF\s*%\s*-->/gi,
|