@codingame/monaco-vscode-walkthrough-service-override 4.3.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/assets/commandPalette.svg +50 -0
- package/assets/dark-hc.png +0 -0
- package/assets/dark.png +0 -0
- package/assets/debug.svg +87 -0
- package/assets/extensions-web.svg +216 -0
- package/assets/extensions.svg +236 -0
- package/assets/git.svg +105 -0
- package/assets/languages.svg +88 -0
- package/assets/learn.svg +85 -0
- package/assets/light-hc.png +0 -0
- package/assets/light.png +0 -0
- package/assets/menuBar.svg +100 -0
- package/assets/openFolder.svg +91 -0
- package/assets/profiles.svg +47 -0
- package/assets/runTask.svg +42 -0
- package/assets/search.svg +48 -0
- package/assets/settings.svg +53 -0
- package/assets/settingsSync.svg +148 -0
- package/assets/shortcuts.svg +180 -0
- package/assets/terminal.svg +42 -0
- package/assets/workspaceTrust.svg +43 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +23 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.js +421 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.js +1528 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedColors.js +48 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedDetailsRenderer.js +263 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedIcons.js +16 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.js +53 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedList.js +97 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/startupPage.js +218 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/all.png.js +8 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/all.svg.js +21 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile.js +37 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker.js +53 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/editor/editorWalkThrough.js +63 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough.js +190 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/media/walkThroughPart.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThrough.contribution.js +39 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughActions.js +59 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughInput.js +115 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart.js +431 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughContentProvider.js +76 -0
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughUtils.js +19 -0
- package/walkthrough.d.ts +5 -0
- package/walkthrough.js +21 -0
|
@@ -0,0 +1,1528 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { $, addDisposableListener, clearNode, reset, append } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
+
import { renderFormattedText } from 'vscode/vscode/vs/base/browser/formattedTextRenderer';
|
|
4
|
+
import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
5
|
+
import { Button } from 'vscode/vscode/vs/base/browser/ui/button/button';
|
|
6
|
+
import { renderLabelWithIcons } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
7
|
+
import { DomScrollableElement } from 'vscode/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
|
|
8
|
+
import { Toggle } from 'vscode/vscode/vs/base/browser/ui/toggle/toggle';
|
|
9
|
+
import { flatten, coalesce, equals } from 'vscode/vscode/vs/base/common/arrays';
|
|
10
|
+
import { Throttler, Delayer } from 'vscode/vscode/vs/base/common/async';
|
|
11
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
12
|
+
import { onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
|
|
13
|
+
import { splitRecentLabel } from 'vscode/vscode/vs/base/common/labels';
|
|
14
|
+
import { DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
15
|
+
import { parse } from 'vscode/vscode/vs/base/common/marshalling';
|
|
16
|
+
import { matchesScheme, Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
17
|
+
import { isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
18
|
+
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
19
|
+
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
20
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
21
|
+
import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
|
|
22
|
+
import './media/gettingStarted.css.js';
|
|
23
|
+
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
24
|
+
import { MarkdownRenderer } from 'vscode/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
25
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
26
|
+
import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
|
|
27
|
+
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
28
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
29
|
+
import { RawContextKey, ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
30
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
31
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
32
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
33
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
34
|
+
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
35
|
+
import { Link } from 'vscode/vscode/vs/platform/opener/browser/link';
|
|
36
|
+
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
37
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
38
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
39
|
+
import { WillSaveStateReason, IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
40
|
+
import { firstSessionDateStorageKey, ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
41
|
+
import { getTelemetryLevel } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
|
|
42
|
+
import { defaultToggleStyles, defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
43
|
+
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
44
|
+
import { UNKNOWN_EMPTY_WINDOW_WORKSPACE, IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
45
|
+
import { isRecentWorkspace, IWorkspacesService, isRecentFolder } from 'vscode/vscode/vs/platform/workspaces/common/workspaces';
|
|
46
|
+
import { OpenRecentAction } from 'vscode/vscode/vs/workbench/browser/actions/windowActions';
|
|
47
|
+
import { OpenFolderViaWorkspaceAction, OpenFileFolderAction, OpenFolderAction } from 'vscode/vscode/vs/workbench/browser/actions/workspaceActions';
|
|
48
|
+
import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
49
|
+
import { WorkbenchStateContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
50
|
+
import { IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
|
|
51
|
+
import './gettingStartedColors.js';
|
|
52
|
+
import { GettingStartedDetailsRenderer } from './gettingStartedDetailsRenderer.js';
|
|
53
|
+
import { gettingStartedUncheckedCodicon, gettingStartedCheckedCodicon } from './gettingStartedIcons.js';
|
|
54
|
+
import { GettingStartedInput } from './gettingStartedInput.js';
|
|
55
|
+
import { hiddenEntriesConfigurationKey, parseDescription, IWalkthroughsService } from 'vscode/vscode/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService';
|
|
56
|
+
import { restoreWalkthroughsConfigurationKey } from './startupPage.js';
|
|
57
|
+
import { startEntries } from 'vscode/vscode/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent';
|
|
58
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
59
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
60
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
61
|
+
import { ThemeSettings } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
|
|
62
|
+
import { GettingStartedIndexList } from './gettingStartedList.js';
|
|
63
|
+
import { IWorkbenchAssignmentService } from 'vscode/vscode/vs/workbench/services/assignment/common/assignmentService';
|
|
64
|
+
|
|
65
|
+
var GettingStartedPage_1;
|
|
66
|
+
const SLIDE_TRANSITION_TIME_MS = 250;
|
|
67
|
+
const configurationKey = 'workbench.startupEditor';
|
|
68
|
+
const allWalkthroughsHiddenContext = ( new RawContextKey('allWalkthroughsHidden', false));
|
|
69
|
+
const inWelcomeContext = ( new RawContextKey('inWelcome', false));
|
|
70
|
+
const parsedStartEntries = ( startEntries.map((e, i) => ({
|
|
71
|
+
command: e.content.command,
|
|
72
|
+
description: e.description,
|
|
73
|
+
icon: { type: 'icon', icon: e.icon },
|
|
74
|
+
id: e.id,
|
|
75
|
+
order: i,
|
|
76
|
+
title: e.title,
|
|
77
|
+
when: ContextKeyExpr.deserialize(e.when) ?? ContextKeyExpr.true()
|
|
78
|
+
})));
|
|
79
|
+
const REDUCED_MOTION_KEY = 'workbench.welcomePage.preferReducedMotion';
|
|
80
|
+
let GettingStartedPage = class GettingStartedPage extends EditorPane {
|
|
81
|
+
static { GettingStartedPage_1 = this; }
|
|
82
|
+
static { this.ID = 'gettingStartedPage'; }
|
|
83
|
+
constructor(group, commandService, productService, keybindingService, gettingStartedService, configurationService, telemetryService, languageService, fileService, openerService, themeService, storageService, extensionService, instantiationService, notificationService, groupsService, contextService, quickInputService, workspacesService, labelService, hostService, webviewService, workspaceContextService, accessibilityService, tasExperimentService) {
|
|
84
|
+
super(GettingStartedPage_1.ID, group, telemetryService, themeService, storageService);
|
|
85
|
+
this.commandService = commandService;
|
|
86
|
+
this.productService = productService;
|
|
87
|
+
this.keybindingService = keybindingService;
|
|
88
|
+
this.gettingStartedService = gettingStartedService;
|
|
89
|
+
this.configurationService = configurationService;
|
|
90
|
+
this.languageService = languageService;
|
|
91
|
+
this.fileService = fileService;
|
|
92
|
+
this.openerService = openerService;
|
|
93
|
+
this.storageService = storageService;
|
|
94
|
+
this.extensionService = extensionService;
|
|
95
|
+
this.instantiationService = instantiationService;
|
|
96
|
+
this.notificationService = notificationService;
|
|
97
|
+
this.groupsService = groupsService;
|
|
98
|
+
this.quickInputService = quickInputService;
|
|
99
|
+
this.workspacesService = workspacesService;
|
|
100
|
+
this.labelService = labelService;
|
|
101
|
+
this.hostService = hostService;
|
|
102
|
+
this.webviewService = webviewService;
|
|
103
|
+
this.workspaceContextService = workspaceContextService;
|
|
104
|
+
this.accessibilityService = accessibilityService;
|
|
105
|
+
this.tasExperimentService = tasExperimentService;
|
|
106
|
+
this.inProgressScroll = Promise.resolve();
|
|
107
|
+
this.dispatchListeners = ( new DisposableStore());
|
|
108
|
+
this.stepDisposables = ( new DisposableStore());
|
|
109
|
+
this.detailsPageDisposables = ( new DisposableStore());
|
|
110
|
+
this.mediaDisposables = ( new DisposableStore());
|
|
111
|
+
this.buildSlideThrottle = ( new Throttler());
|
|
112
|
+
this.hasScrolledToFirstCategory = false;
|
|
113
|
+
this.showFeaturedWalkthrough = true;
|
|
114
|
+
this.currentMediaComponent = undefined;
|
|
115
|
+
this.currentMediaType = undefined;
|
|
116
|
+
this.container = $('.gettingStartedContainer', {
|
|
117
|
+
role: 'document',
|
|
118
|
+
tabindex: 0,
|
|
119
|
+
'aria-label': ( localizeWithPath(
|
|
120
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
121
|
+
'welcomeAriaLabel',
|
|
122
|
+
"Overview of how to get up to speed with your editor."
|
|
123
|
+
))
|
|
124
|
+
});
|
|
125
|
+
this.stepMediaComponent = $('.getting-started-media');
|
|
126
|
+
this.stepMediaComponent.id = generateUuid();
|
|
127
|
+
this.categoriesSlideDisposables = this._register(( new DisposableStore()));
|
|
128
|
+
this.detailsRenderer = ( new GettingStartedDetailsRenderer(
|
|
129
|
+
this.fileService,
|
|
130
|
+
this.notificationService,
|
|
131
|
+
this.extensionService,
|
|
132
|
+
this.languageService
|
|
133
|
+
));
|
|
134
|
+
this.contextService = this._register(contextService.createScoped(this.container));
|
|
135
|
+
inWelcomeContext.bindTo(this.contextService).set(true);
|
|
136
|
+
this.gettingStartedCategories = this.gettingStartedService.getWalkthroughs();
|
|
137
|
+
this._register(this.dispatchListeners);
|
|
138
|
+
this.buildSlideThrottle = ( new Throttler());
|
|
139
|
+
const rerender = () => {
|
|
140
|
+
this.gettingStartedCategories = this.gettingStartedService.getWalkthroughs();
|
|
141
|
+
if (this.currentWalkthrough) {
|
|
142
|
+
const existingSteps = ( this.currentWalkthrough.steps.map(step => step.id));
|
|
143
|
+
const newCategory = this.gettingStartedCategories.find(category => this.currentWalkthrough?.id === category.id);
|
|
144
|
+
if (newCategory) {
|
|
145
|
+
const newSteps = ( newCategory.steps.map(step => step.id));
|
|
146
|
+
if (!equals(newSteps, existingSteps)) {
|
|
147
|
+
this.buildSlideThrottle.queue(() => this.buildCategoriesSlide());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.buildSlideThrottle.queue(() => this.buildCategoriesSlide());
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
this._register(this.gettingStartedService.onDidAddWalkthrough(rerender));
|
|
156
|
+
this._register(this.gettingStartedService.onDidRemoveWalkthrough(rerender));
|
|
157
|
+
this.recentlyOpened = this.workspacesService.getRecentlyOpened();
|
|
158
|
+
this._register(workspacesService.onDidChangeRecentlyOpened(() => {
|
|
159
|
+
this.recentlyOpened = workspacesService.getRecentlyOpened();
|
|
160
|
+
rerender();
|
|
161
|
+
}));
|
|
162
|
+
this._register(this.gettingStartedService.onDidChangeWalkthrough(category => {
|
|
163
|
+
const ourCategory = this.gettingStartedCategories.find(c => c.id === category.id);
|
|
164
|
+
if (!ourCategory) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
ourCategory.title = category.title;
|
|
168
|
+
ourCategory.description = category.description;
|
|
169
|
+
this.container.querySelectorAll(`[x-category-title-for="${category.id}"]`).forEach(step => step.innerText = ourCategory.title);
|
|
170
|
+
this.container.querySelectorAll(`[x-category-description-for="${category.id}"]`).forEach(step => step.innerText = ourCategory.description);
|
|
171
|
+
}));
|
|
172
|
+
this._register(this.gettingStartedService.onDidProgressStep(step => {
|
|
173
|
+
const category = this.gettingStartedCategories.find(category => category.id === step.category);
|
|
174
|
+
if (!category) {
|
|
175
|
+
throw Error('Could not find category with ID: ' + step.category);
|
|
176
|
+
}
|
|
177
|
+
const ourStep = category.steps.find(_step => _step.id === step.id);
|
|
178
|
+
if (!ourStep) {
|
|
179
|
+
throw Error('Could not find step with ID: ' + step.id);
|
|
180
|
+
}
|
|
181
|
+
const stats = this.getWalkthroughCompletionStats(category);
|
|
182
|
+
if (!ourStep.done && stats.stepsComplete === stats.stepsTotal - 1) {
|
|
183
|
+
this.hideCategory(category.id);
|
|
184
|
+
}
|
|
185
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
186
|
+
if (e.affectsConfiguration(REDUCED_MOTION_KEY)) {
|
|
187
|
+
this.container.classList.toggle('animatable', this.shouldAnimate());
|
|
188
|
+
}
|
|
189
|
+
}));
|
|
190
|
+
ourStep.done = step.done;
|
|
191
|
+
if (category.id === this.currentWalkthrough?.id) {
|
|
192
|
+
const badgeelements = assertIsDefined(this.window.document.querySelectorAll(`[data-done-step-id="${step.id}"]`));
|
|
193
|
+
badgeelements.forEach(badgeelement => {
|
|
194
|
+
if (step.done) {
|
|
195
|
+
badgeelement.setAttribute('aria-checked', 'true');
|
|
196
|
+
badgeelement.parentElement?.setAttribute('aria-checked', 'true');
|
|
197
|
+
badgeelement.classList.remove(...ThemeIcon.asClassNameArray(gettingStartedUncheckedCodicon));
|
|
198
|
+
badgeelement.classList.add('complete', ...ThemeIcon.asClassNameArray(gettingStartedCheckedCodicon));
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
badgeelement.setAttribute('aria-checked', 'false');
|
|
202
|
+
badgeelement.parentElement?.setAttribute('aria-checked', 'false');
|
|
203
|
+
badgeelement.classList.remove('complete', ...ThemeIcon.asClassNameArray(gettingStartedCheckedCodicon));
|
|
204
|
+
badgeelement.classList.add(...ThemeIcon.asClassNameArray(gettingStartedUncheckedCodicon));
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
this.updateCategoryProgress();
|
|
209
|
+
}));
|
|
210
|
+
this._register(this.storageService.onWillSaveState((e) => {
|
|
211
|
+
if (e.reason !== WillSaveStateReason.SHUTDOWN) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (this.workspaceContextService.getWorkspace().folders.length !== 0) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (!this.editorInput || !this.currentWalkthrough || !this.editorInput.selectedCategory || !this.editorInput.selectedStep) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const restoreData = { folder: UNKNOWN_EMPTY_WINDOW_WORKSPACE.id, category: this.editorInput.selectedCategory, step: this.editorInput.selectedStep };
|
|
221
|
+
this.storageService.store(restoreWalkthroughsConfigurationKey, JSON.stringify(restoreData), 0 , 1 );
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
shouldAnimate() {
|
|
225
|
+
if (this.configurationService.getValue(REDUCED_MOTION_KEY)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
if (this.accessibilityService.isMotionReduced()) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
getWalkthroughCompletionStats(walkthrough) {
|
|
234
|
+
const activeSteps = walkthrough.steps.filter(s => this.contextService.contextMatchesRules(s.when));
|
|
235
|
+
return {
|
|
236
|
+
stepsComplete: activeSteps.filter(s => s.done).length,
|
|
237
|
+
stepsTotal: activeSteps.length,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
async setInput(newInput, options, context, token) {
|
|
241
|
+
this.container.classList.remove('animatable');
|
|
242
|
+
this.editorInput = newInput;
|
|
243
|
+
await super.setInput(newInput, options, context, token);
|
|
244
|
+
await this.buildCategoriesSlide();
|
|
245
|
+
if (this.shouldAnimate()) {
|
|
246
|
+
setTimeout(() => this.container.classList.add('animatable'), 0);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
async makeCategoryVisibleWhenAvailable(categoryID, stepId) {
|
|
250
|
+
this.scrollToCategory(categoryID, stepId);
|
|
251
|
+
}
|
|
252
|
+
registerDispatchListeners() {
|
|
253
|
+
this.dispatchListeners.clear();
|
|
254
|
+
this.container.querySelectorAll('[x-dispatch]').forEach(element => {
|
|
255
|
+
const dispatch = element.getAttribute('x-dispatch') ?? '';
|
|
256
|
+
let command, argument;
|
|
257
|
+
if (dispatch.startsWith('openLink:https')) {
|
|
258
|
+
[command, argument] = ['openLink', dispatch.replace('openLink:', '')];
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
[command, argument] = dispatch.split(':');
|
|
262
|
+
}
|
|
263
|
+
if (command) {
|
|
264
|
+
this.dispatchListeners.add(addDisposableListener(element, 'click', (e) => {
|
|
265
|
+
e.stopPropagation();
|
|
266
|
+
this.runDispatchCommand(command, argument);
|
|
267
|
+
}));
|
|
268
|
+
this.dispatchListeners.add(addDisposableListener(element, 'keyup', (e) => {
|
|
269
|
+
const keyboardEvent = ( new StandardKeyboardEvent(e));
|
|
270
|
+
e.stopPropagation();
|
|
271
|
+
switch (keyboardEvent.keyCode) {
|
|
272
|
+
case 3 :
|
|
273
|
+
case 10 :
|
|
274
|
+
this.runDispatchCommand(command, argument);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}));
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
async runDispatchCommand(command, argument) {
|
|
282
|
+
this.commandService.executeCommand('workbench.action.keepEditor');
|
|
283
|
+
this.telemetryService.publicLog2('gettingStarted.ActionExecuted', { command, argument, walkthroughId: this.currentWalkthrough?.id });
|
|
284
|
+
switch (command) {
|
|
285
|
+
case 'scrollPrev': {
|
|
286
|
+
this.scrollPrev();
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case 'skip': {
|
|
290
|
+
this.runSkip();
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
case 'showMoreRecents': {
|
|
294
|
+
this.commandService.executeCommand(OpenRecentAction.ID);
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case 'seeAllWalkthroughs': {
|
|
298
|
+
await this.openWalkthroughSelector();
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case 'openFolder': {
|
|
302
|
+
if (this.contextService.contextMatchesRules(( ContextKeyExpr.and(( WorkbenchStateContext.isEqualTo('workspace')))))) {
|
|
303
|
+
this.commandService.executeCommand(OpenFolderViaWorkspaceAction.ID);
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
this.commandService.executeCommand(isMacintosh ? 'workbench.action.files.openFileFolder' : 'workbench.action.files.openFolder');
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
case 'selectCategory': {
|
|
311
|
+
this.scrollToCategory(argument);
|
|
312
|
+
this.gettingStartedService.markWalkthroughOpened(argument);
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
case 'selectStartEntry': {
|
|
316
|
+
const selected = startEntries.find(e => e.id === argument);
|
|
317
|
+
if (selected) {
|
|
318
|
+
this.runStepCommand(selected.content.command);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
throw Error('could not find start entry with id: ' + argument);
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
case 'hideCategory': {
|
|
326
|
+
this.hideCategory(argument);
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
case 'selectTask': {
|
|
330
|
+
this.selectStep(argument);
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
case 'toggleStepCompletion': {
|
|
334
|
+
this.toggleStepCompletion(argument);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
case 'allDone': {
|
|
338
|
+
this.markAllStepsComplete();
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
case 'nextSection': {
|
|
342
|
+
const next = this.currentWalkthrough?.next;
|
|
343
|
+
if (next) {
|
|
344
|
+
this.scrollToCategory(next);
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
console.error('Error scrolling to next section of', this.currentWalkthrough);
|
|
348
|
+
}
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
case 'hideVideos': {
|
|
352
|
+
this.hideVideos();
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
case 'openLink': {
|
|
356
|
+
this.openerService.open(argument);
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
default: {
|
|
360
|
+
console.error('Dispatch to', command, argument, 'not defined');
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
hideCategory(categoryId) {
|
|
366
|
+
const selectedCategory = this.gettingStartedCategories.find(category => category.id === categoryId);
|
|
367
|
+
if (!selectedCategory) {
|
|
368
|
+
throw Error('Could not find category with ID ' + categoryId);
|
|
369
|
+
}
|
|
370
|
+
this.setHiddenCategories([...this.getHiddenCategories().add(categoryId)]);
|
|
371
|
+
this.gettingStartedList?.rerender();
|
|
372
|
+
}
|
|
373
|
+
hideVideos() {
|
|
374
|
+
this.setHiddenCategories([...this.getHiddenCategories().add('getting-started-videos')]);
|
|
375
|
+
this.videoList?.setEntries(undefined);
|
|
376
|
+
}
|
|
377
|
+
markAllStepsComplete() {
|
|
378
|
+
if (this.currentWalkthrough) {
|
|
379
|
+
this.currentWalkthrough?.steps.forEach(step => {
|
|
380
|
+
if (!step.done) {
|
|
381
|
+
this.gettingStartedService.progressStep(step.id);
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
this.hideCategory(this.currentWalkthrough?.id);
|
|
385
|
+
this.scrollPrev();
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
throw Error('No walkthrough opened');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
toggleStepCompletion(argument) {
|
|
392
|
+
const stepToggle = assertIsDefined(this.currentWalkthrough?.steps.find(step => step.id === argument));
|
|
393
|
+
if (stepToggle.done) {
|
|
394
|
+
this.gettingStartedService.deprogressStep(argument);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
this.gettingStartedService.progressStep(argument);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
async openWalkthroughSelector() {
|
|
401
|
+
const selection = await this.quickInputService.pick(( this.gettingStartedCategories
|
|
402
|
+
.filter(c => this.contextService.contextMatchesRules(c.when))
|
|
403
|
+
.map(x => ({
|
|
404
|
+
id: x.id,
|
|
405
|
+
label: x.title,
|
|
406
|
+
detail: x.description,
|
|
407
|
+
description: x.source,
|
|
408
|
+
}))), { canPickMany: false, matchOnDescription: true, matchOnDetail: true, title: ( localizeWithPath(
|
|
409
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
410
|
+
'pickWalkthroughs',
|
|
411
|
+
"Open Walkthrough..."
|
|
412
|
+
)) });
|
|
413
|
+
if (selection) {
|
|
414
|
+
this.runDispatchCommand('selectCategory', selection.id);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
getHiddenCategories() {
|
|
418
|
+
return ( new Set(
|
|
419
|
+
JSON.parse(this.storageService.get(hiddenEntriesConfigurationKey, 0 , '[]'))
|
|
420
|
+
));
|
|
421
|
+
}
|
|
422
|
+
setHiddenCategories(hidden) {
|
|
423
|
+
this.storageService.store(hiddenEntriesConfigurationKey, JSON.stringify(hidden), 0 , 0 );
|
|
424
|
+
}
|
|
425
|
+
async buildMediaComponent(stepId, forceRebuild = false) {
|
|
426
|
+
if (!this.currentWalkthrough) {
|
|
427
|
+
throw Error('no walkthrough selected');
|
|
428
|
+
}
|
|
429
|
+
const stepToExpand = assertIsDefined(this.currentWalkthrough.steps.find(step => step.id === stepId));
|
|
430
|
+
if (!forceRebuild && this.currentMediaComponent === stepId) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
this.currentMediaComponent = stepId;
|
|
434
|
+
this.stepDisposables.clear();
|
|
435
|
+
this.stepDisposables.add({
|
|
436
|
+
dispose: () => {
|
|
437
|
+
this.currentMediaComponent = undefined;
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
if (this.currentMediaType !== stepToExpand.media.type) {
|
|
441
|
+
this.currentMediaType = stepToExpand.media.type;
|
|
442
|
+
this.mediaDisposables.add(toDisposable(() => {
|
|
443
|
+
this.currentMediaType = undefined;
|
|
444
|
+
}));
|
|
445
|
+
clearNode(this.stepMediaComponent);
|
|
446
|
+
if (stepToExpand.media.type === 'svg') {
|
|
447
|
+
this.webview = this.mediaDisposables.add(this.webviewService.createWebviewElement({ title: undefined, options: { disableServiceWorker: true }, contentOptions: {}, extension: undefined }));
|
|
448
|
+
this.webview.mountTo(this.stepMediaComponent, this.window);
|
|
449
|
+
}
|
|
450
|
+
else if (stepToExpand.media.type === 'markdown') {
|
|
451
|
+
this.webview = this.mediaDisposables.add(this.webviewService.createWebviewElement({ options: {}, contentOptions: { localResourceRoots: [stepToExpand.media.root], allowScripts: true }, title: '', extension: undefined }));
|
|
452
|
+
this.webview.mountTo(this.stepMediaComponent, this.window);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (stepToExpand.media.type === 'image') {
|
|
456
|
+
this.stepsContent.classList.add('image');
|
|
457
|
+
this.stepsContent.classList.remove('markdown');
|
|
458
|
+
const media = stepToExpand.media;
|
|
459
|
+
const mediaElement = $('img');
|
|
460
|
+
clearNode(this.stepMediaComponent);
|
|
461
|
+
this.stepMediaComponent.appendChild(mediaElement);
|
|
462
|
+
mediaElement.setAttribute('alt', media.altText);
|
|
463
|
+
this.updateMediaSourceForColorMode(mediaElement, media.path);
|
|
464
|
+
this.stepDisposables.add(addDisposableListener(this.stepMediaComponent, 'click', () => {
|
|
465
|
+
const hrefs = flatten(( stepToExpand.description.map(lt => ( lt.nodes.filter((node) => typeof node !== 'string').map(node => node.href)))));
|
|
466
|
+
if (hrefs.length === 1) {
|
|
467
|
+
const href = hrefs[0];
|
|
468
|
+
if (href.startsWith('http')) {
|
|
469
|
+
this.telemetryService.publicLog2('gettingStarted.ActionExecuted', { command: 'runStepAction', argument: href, walkthroughId: this.currentWalkthrough?.id });
|
|
470
|
+
this.openerService.open(href);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}));
|
|
474
|
+
this.stepDisposables.add(this.themeService.onDidColorThemeChange(() => this.updateMediaSourceForColorMode(mediaElement, media.path)));
|
|
475
|
+
}
|
|
476
|
+
else if (stepToExpand.media.type === 'svg') {
|
|
477
|
+
this.stepsContent.classList.add('image');
|
|
478
|
+
this.stepsContent.classList.remove('markdown');
|
|
479
|
+
const media = stepToExpand.media;
|
|
480
|
+
this.webview.setHtml(await this.detailsRenderer.renderSVG(media.path));
|
|
481
|
+
let isDisposed = false;
|
|
482
|
+
this.stepDisposables.add(toDisposable(() => { isDisposed = true; }));
|
|
483
|
+
this.stepDisposables.add(this.themeService.onDidColorThemeChange(async () => {
|
|
484
|
+
const body = await this.detailsRenderer.renderSVG(media.path);
|
|
485
|
+
if (!isDisposed) {
|
|
486
|
+
this.webview.setHtml(body);
|
|
487
|
+
}
|
|
488
|
+
}));
|
|
489
|
+
this.stepDisposables.add(addDisposableListener(this.stepMediaComponent, 'click', () => {
|
|
490
|
+
const hrefs = flatten(( stepToExpand.description.map(lt => ( lt.nodes.filter((node) => typeof node !== 'string').map(node => node.href)))));
|
|
491
|
+
if (hrefs.length === 1) {
|
|
492
|
+
const href = hrefs[0];
|
|
493
|
+
if (href.startsWith('http')) {
|
|
494
|
+
this.telemetryService.publicLog2('gettingStarted.ActionExecuted', { command: 'runStepAction', argument: href, walkthroughId: this.currentWalkthrough?.id });
|
|
495
|
+
this.openerService.open(href);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}));
|
|
499
|
+
this.stepDisposables.add(this.webview.onDidClickLink(link => {
|
|
500
|
+
if (matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.http) || (matchesScheme(link, Schemas.command))) {
|
|
501
|
+
this.openerService.open(link, { allowCommands: true });
|
|
502
|
+
}
|
|
503
|
+
}));
|
|
504
|
+
}
|
|
505
|
+
else if (stepToExpand.media.type === 'markdown') {
|
|
506
|
+
this.stepsContent.classList.remove('image');
|
|
507
|
+
this.stepsContent.classList.add('markdown');
|
|
508
|
+
const media = stepToExpand.media;
|
|
509
|
+
const rawHTML = await this.detailsRenderer.renderMarkdown(media.path, media.base);
|
|
510
|
+
this.webview.setHtml(rawHTML);
|
|
511
|
+
const serializedContextKeyExprs = rawHTML.match(/checked-on=\"([^'][^"]*)\"/g)?.map(attr => attr.slice('checked-on="'.length, -1)
|
|
512
|
+
.replace(/'/g, '\'')
|
|
513
|
+
.replace(/&/g, '&'));
|
|
514
|
+
const postTrueKeysMessage = () => {
|
|
515
|
+
const enabledContextKeys = serializedContextKeyExprs?.filter(expr => this.contextService.contextMatchesRules(ContextKeyExpr.deserialize(expr)));
|
|
516
|
+
if (enabledContextKeys) {
|
|
517
|
+
this.webview.postMessage({
|
|
518
|
+
enabledContextKeys
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
if (serializedContextKeyExprs) {
|
|
523
|
+
const contextKeyExprs = coalesce(( serializedContextKeyExprs.map(expr => ContextKeyExpr.deserialize(expr))));
|
|
524
|
+
const watchingKeys = ( new Set(flatten(( contextKeyExprs.map(expr => ( expr.keys()))))));
|
|
525
|
+
this.stepDisposables.add(this.contextService.onDidChangeContext(e => {
|
|
526
|
+
if (e.affectsSome(watchingKeys)) {
|
|
527
|
+
postTrueKeysMessage();
|
|
528
|
+
}
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
let isDisposed = false;
|
|
532
|
+
this.stepDisposables.add(toDisposable(() => { isDisposed = true; }));
|
|
533
|
+
this.stepDisposables.add(this.webview.onDidClickLink(link => {
|
|
534
|
+
if (matchesScheme(link, Schemas.https) || matchesScheme(link, Schemas.http) || (matchesScheme(link, Schemas.command))) {
|
|
535
|
+
const toSide = link.startsWith('command:toSide:');
|
|
536
|
+
if (toSide) {
|
|
537
|
+
link = link.replace('command:toSide:', 'command:');
|
|
538
|
+
this.focusSideEditorGroup();
|
|
539
|
+
}
|
|
540
|
+
this.openerService.open(link, { allowCommands: true, openToSide: toSide });
|
|
541
|
+
}
|
|
542
|
+
}));
|
|
543
|
+
if (rawHTML.indexOf('<code>') >= 0) {
|
|
544
|
+
this.stepDisposables.add(this.themeService.onDidColorThemeChange(async () => {
|
|
545
|
+
const body = await this.detailsRenderer.renderMarkdown(media.path, media.base);
|
|
546
|
+
if (!isDisposed) {
|
|
547
|
+
this.webview.setHtml(body);
|
|
548
|
+
postTrueKeysMessage();
|
|
549
|
+
}
|
|
550
|
+
}));
|
|
551
|
+
}
|
|
552
|
+
const layoutDelayer = ( new Delayer(50));
|
|
553
|
+
this.layoutMarkdown = () => {
|
|
554
|
+
layoutDelayer.trigger(() => {
|
|
555
|
+
this.webview.postMessage({ layoutMeNow: true });
|
|
556
|
+
});
|
|
557
|
+
};
|
|
558
|
+
this.stepDisposables.add(layoutDelayer);
|
|
559
|
+
this.stepDisposables.add({ dispose: () => this.layoutMarkdown = undefined });
|
|
560
|
+
postTrueKeysMessage();
|
|
561
|
+
this.stepDisposables.add(this.webview.onMessage(e => {
|
|
562
|
+
const message = e.message;
|
|
563
|
+
if (message.startsWith('command:')) {
|
|
564
|
+
this.openerService.open(message, { allowCommands: true });
|
|
565
|
+
}
|
|
566
|
+
else if (message.startsWith('setTheme:')) {
|
|
567
|
+
this.configurationService.updateValue(ThemeSettings.COLOR_THEME, message.slice('setTheme:'.length), 2 );
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
console.error('Unexpected message', message);
|
|
571
|
+
}
|
|
572
|
+
}));
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
async selectStepLoose(id) {
|
|
576
|
+
if (id.startsWith(`${this.editorInput.selectedCategory}#`)) {
|
|
577
|
+
this.selectStep(id);
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
const toSelect = this.editorInput.selectedCategory + '#' + id;
|
|
581
|
+
this.selectStep(toSelect);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
async selectStep(id, delayFocus = true) {
|
|
585
|
+
if (id) {
|
|
586
|
+
let stepElement = this.container.querySelector(`[data-step-id="${id}"]`);
|
|
587
|
+
if (!stepElement) {
|
|
588
|
+
stepElement = this.container.querySelector(`[data-step-id]`);
|
|
589
|
+
if (!stepElement) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
id = assertIsDefined(stepElement.getAttribute('data-step-id'));
|
|
593
|
+
}
|
|
594
|
+
stepElement.parentElement?.querySelectorAll('.expanded').forEach(node => {
|
|
595
|
+
if (node.getAttribute('data-step-id') !== id) {
|
|
596
|
+
node.classList.remove('expanded');
|
|
597
|
+
node.setAttribute('aria-expanded', 'false');
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
setTimeout(() => stepElement.focus(), delayFocus && this.shouldAnimate() ? SLIDE_TRANSITION_TIME_MS : 0);
|
|
601
|
+
this.editorInput.selectedStep = id;
|
|
602
|
+
stepElement.classList.add('expanded');
|
|
603
|
+
stepElement.setAttribute('aria-expanded', 'true');
|
|
604
|
+
this.buildMediaComponent(id, true);
|
|
605
|
+
this.gettingStartedService.progressByEvent('stepSelected:' + id);
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
this.editorInput.selectedStep = undefined;
|
|
609
|
+
}
|
|
610
|
+
this.detailsPageScrollbar?.scanDomNode();
|
|
611
|
+
this.detailsScrollbar?.scanDomNode();
|
|
612
|
+
}
|
|
613
|
+
updateMediaSourceForColorMode(element, sources) {
|
|
614
|
+
const themeType = this.themeService.getColorTheme().type;
|
|
615
|
+
const src = ( sources[themeType].toString(true)).replace(/ /g, '%20');
|
|
616
|
+
element.srcset = src.toLowerCase().endsWith('.svg') ? src : (src + ' 1.5x');
|
|
617
|
+
}
|
|
618
|
+
createEditor(parent) {
|
|
619
|
+
if (this.detailsPageScrollbar) {
|
|
620
|
+
this.detailsPageScrollbar.dispose();
|
|
621
|
+
}
|
|
622
|
+
if (this.categoriesPageScrollbar) {
|
|
623
|
+
this.categoriesPageScrollbar.dispose();
|
|
624
|
+
}
|
|
625
|
+
this.categoriesSlide = $('.gettingStartedSlideCategories.gettingStartedSlide');
|
|
626
|
+
const prevButton = $('button.prev-button.button-link', { 'x-dispatch': 'scrollPrev' }, $('span.scroll-button.codicon.codicon-chevron-left'), $('span.moreText', {}, ( localizeWithPath(
|
|
627
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
628
|
+
'welcome',
|
|
629
|
+
"Welcome"
|
|
630
|
+
))));
|
|
631
|
+
this.stepsSlide = $('.gettingStartedSlideDetails.gettingStartedSlide', {}, prevButton);
|
|
632
|
+
this.stepsContent = $('.gettingStartedDetailsContent', {});
|
|
633
|
+
this.detailsPageScrollbar = this._register(( new DomScrollableElement(this.stepsContent, { className: 'full-height-scrollable' })));
|
|
634
|
+
this.categoriesPageScrollbar = this._register(( new DomScrollableElement(
|
|
635
|
+
this.categoriesSlide,
|
|
636
|
+
{ className: 'full-height-scrollable categoriesScrollbar' }
|
|
637
|
+
)));
|
|
638
|
+
this.stepsSlide.appendChild(this.detailsPageScrollbar.getDomNode());
|
|
639
|
+
const gettingStartedPage = $('.gettingStarted', {}, this.categoriesPageScrollbar.getDomNode(), this.stepsSlide);
|
|
640
|
+
this.container.appendChild(gettingStartedPage);
|
|
641
|
+
this.categoriesPageScrollbar.scanDomNode();
|
|
642
|
+
this.detailsPageScrollbar.scanDomNode();
|
|
643
|
+
parent.appendChild(this.container);
|
|
644
|
+
}
|
|
645
|
+
async buildCategoriesSlide() {
|
|
646
|
+
this.categoriesSlideDisposables.clear();
|
|
647
|
+
const showOnStartupCheckbox = ( new Toggle({
|
|
648
|
+
icon: Codicon.check,
|
|
649
|
+
actionClassName: 'getting-started-checkbox',
|
|
650
|
+
isChecked: this.configurationService.getValue(configurationKey) === 'welcomePage',
|
|
651
|
+
title: ( localizeWithPath(
|
|
652
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
653
|
+
'checkboxTitle',
|
|
654
|
+
"When checked, this page will be shown on startup."
|
|
655
|
+
)),
|
|
656
|
+
...defaultToggleStyles
|
|
657
|
+
}));
|
|
658
|
+
showOnStartupCheckbox.domNode.id = 'showOnStartup';
|
|
659
|
+
const showOnStartupLabel = $('label.caption', { for: 'showOnStartup' }, ( localizeWithPath(
|
|
660
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
661
|
+
'welcomePage.showOnStartup',
|
|
662
|
+
"Show welcome page on startup"
|
|
663
|
+
)));
|
|
664
|
+
const onShowOnStartupChanged = () => {
|
|
665
|
+
if (showOnStartupCheckbox.checked) {
|
|
666
|
+
this.telemetryService.publicLog2('gettingStarted.ActionExecuted', { command: 'showOnStartupChecked', argument: undefined, walkthroughId: this.currentWalkthrough?.id });
|
|
667
|
+
this.configurationService.updateValue(configurationKey, 'welcomePage');
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
this.telemetryService.publicLog2('gettingStarted.ActionExecuted', { command: 'showOnStartupUnchecked', argument: undefined, walkthroughId: this.currentWalkthrough?.id });
|
|
671
|
+
this.configurationService.updateValue(configurationKey, 'none');
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
this.categoriesSlideDisposables.add(showOnStartupCheckbox);
|
|
675
|
+
this.categoriesSlideDisposables.add(showOnStartupCheckbox.onChange(() => {
|
|
676
|
+
onShowOnStartupChanged();
|
|
677
|
+
}));
|
|
678
|
+
this.categoriesSlideDisposables.add(addDisposableListener(showOnStartupLabel, 'click', () => {
|
|
679
|
+
showOnStartupCheckbox.checked = !showOnStartupCheckbox.checked;
|
|
680
|
+
onShowOnStartupChanged();
|
|
681
|
+
}));
|
|
682
|
+
const header = $('.header', {}, $('h1.product-name.caption', {}, this.productService.nameLong), $('p.subtitle.description', {}, ( localizeWithPath(
|
|
683
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
684
|
+
{ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] },
|
|
685
|
+
"Editing evolved"
|
|
686
|
+
))));
|
|
687
|
+
const leftColumn = $('.categories-column.categories-column-left', {});
|
|
688
|
+
const rightColumn = $('.categories-column.categories-column-right', {});
|
|
689
|
+
const startList = this.buildStartList();
|
|
690
|
+
const recentList = this.buildRecentlyOpenedList();
|
|
691
|
+
const showVideoTutorials = await Promise.race([
|
|
692
|
+
this.tasExperimentService?.getTreatment('gettingStarted.showVideoTutorials'),
|
|
693
|
+
( new Promise(resolve => setTimeout(() => resolve(false), 200)))
|
|
694
|
+
]);
|
|
695
|
+
let videoList;
|
|
696
|
+
if (showVideoTutorials === true) {
|
|
697
|
+
this.showFeaturedWalkthrough = false;
|
|
698
|
+
videoList = this.buildVideosList();
|
|
699
|
+
const layoutVideos = () => {
|
|
700
|
+
if (videoList?.itemCount > 0) {
|
|
701
|
+
reset(rightColumn, videoList?.getDomElement(), gettingStartedList.getDomElement());
|
|
702
|
+
}
|
|
703
|
+
else {
|
|
704
|
+
reset(rightColumn, gettingStartedList.getDomElement());
|
|
705
|
+
}
|
|
706
|
+
setTimeout(() => this.categoriesPageScrollbar?.scanDomNode(), 50);
|
|
707
|
+
layoutRecentList();
|
|
708
|
+
};
|
|
709
|
+
videoList.onDidChange(layoutVideos);
|
|
710
|
+
}
|
|
711
|
+
const gettingStartedList = this.buildGettingStartedWalkthroughsList();
|
|
712
|
+
const footer = $('.footer', {}, $('p.showOnStartup', {}, showOnStartupCheckbox.domNode, showOnStartupLabel));
|
|
713
|
+
const layoutLists = () => {
|
|
714
|
+
if (gettingStartedList.itemCount) {
|
|
715
|
+
this.container.classList.remove('noWalkthroughs');
|
|
716
|
+
if (videoList?.itemCount > 0) {
|
|
717
|
+
this.container.classList.remove('noVideos');
|
|
718
|
+
reset(rightColumn, videoList?.getDomElement(), gettingStartedList.getDomElement());
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
this.container.classList.add('noVideos');
|
|
722
|
+
reset(rightColumn, gettingStartedList.getDomElement());
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
else {
|
|
726
|
+
this.container.classList.add('noWalkthroughs');
|
|
727
|
+
if (videoList?.itemCount > 0) {
|
|
728
|
+
this.container.classList.remove('noVideos');
|
|
729
|
+
reset(rightColumn, videoList?.getDomElement());
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
this.container.classList.add('noVideos');
|
|
733
|
+
reset(rightColumn);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
setTimeout(() => this.categoriesPageScrollbar?.scanDomNode(), 50);
|
|
737
|
+
layoutRecentList();
|
|
738
|
+
};
|
|
739
|
+
const layoutRecentList = () => {
|
|
740
|
+
if (this.container.classList.contains('noWalkthroughs') && this.container.classList.contains('noVideos')) {
|
|
741
|
+
recentList.setLimit(10);
|
|
742
|
+
reset(leftColumn, startList.getDomElement());
|
|
743
|
+
reset(rightColumn, recentList.getDomElement());
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
recentList.setLimit(5);
|
|
747
|
+
reset(leftColumn, startList.getDomElement(), recentList.getDomElement());
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
gettingStartedList.onDidChange(layoutLists);
|
|
751
|
+
layoutLists();
|
|
752
|
+
reset(this.categoriesSlide, $('.gettingStartedCategoriesContainer', {}, header, leftColumn, rightColumn, footer));
|
|
753
|
+
this.categoriesPageScrollbar?.scanDomNode();
|
|
754
|
+
this.updateCategoryProgress();
|
|
755
|
+
this.registerDispatchListeners();
|
|
756
|
+
if (this.editorInput.selectedCategory) {
|
|
757
|
+
this.currentWalkthrough = this.gettingStartedCategories.find(category => category.id === this.editorInput.selectedCategory);
|
|
758
|
+
if (!this.currentWalkthrough) {
|
|
759
|
+
this.gettingStartedCategories = this.gettingStartedService.getWalkthroughs();
|
|
760
|
+
this.currentWalkthrough = this.gettingStartedCategories.find(category => category.id === this.editorInput.selectedCategory);
|
|
761
|
+
if (this.currentWalkthrough) {
|
|
762
|
+
this.buildCategorySlide(this.editorInput.selectedCategory, this.editorInput.selectedStep);
|
|
763
|
+
this.setSlide('details');
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
else {
|
|
768
|
+
this.buildCategorySlide(this.editorInput.selectedCategory, this.editorInput.selectedStep);
|
|
769
|
+
this.setSlide('details');
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
const someStepsComplete = ( this.gettingStartedCategories.some(category => category.steps.find(s => s.done)));
|
|
774
|
+
if (this.editorInput.showTelemetryNotice && this.productService.openToWelcomeMainPage) {
|
|
775
|
+
const telemetryNotice = $('p.telemetry-notice');
|
|
776
|
+
this.buildTelemetryFooter(telemetryNotice);
|
|
777
|
+
footer.appendChild(telemetryNotice);
|
|
778
|
+
}
|
|
779
|
+
else if (!this.productService.openToWelcomeMainPage && !someStepsComplete && !this.hasScrolledToFirstCategory && this.showFeaturedWalkthrough) {
|
|
780
|
+
const firstSessionDateString = this.storageService.get(firstSessionDateStorageKey, -1 ) || ( new Date()).toUTCString();
|
|
781
|
+
const daysSinceFirstSession = ((+( new Date())) - (+( new Date(firstSessionDateString)))) / 1000 / 60 / 60 / 24;
|
|
782
|
+
const fistContentBehaviour = daysSinceFirstSession < 1 ? 'openToFirstCategory' : 'index';
|
|
783
|
+
if (fistContentBehaviour === 'openToFirstCategory') {
|
|
784
|
+
const first = this.gettingStartedCategories.filter(c => !c.when || this.contextService.contextMatchesRules(c.when))[0];
|
|
785
|
+
if (first) {
|
|
786
|
+
this.hasScrolledToFirstCategory = true;
|
|
787
|
+
this.currentWalkthrough = first;
|
|
788
|
+
this.editorInput.selectedCategory = this.currentWalkthrough?.id;
|
|
789
|
+
this.buildCategorySlide(this.editorInput.selectedCategory, undefined);
|
|
790
|
+
this.setSlide('details');
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
this.setSlide('categories');
|
|
796
|
+
}
|
|
797
|
+
buildRecentlyOpenedList() {
|
|
798
|
+
const renderRecent = (recent) => {
|
|
799
|
+
let fullPath;
|
|
800
|
+
let windowOpenable;
|
|
801
|
+
if (isRecentFolder(recent)) {
|
|
802
|
+
windowOpenable = { folderUri: recent.folderUri };
|
|
803
|
+
fullPath = recent.label || this.labelService.getWorkspaceLabel(recent.folderUri, { verbose: 2 });
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
fullPath = recent.label || this.labelService.getWorkspaceLabel(recent.workspace, { verbose: 2 });
|
|
807
|
+
windowOpenable = { workspaceUri: recent.workspace.configPath };
|
|
808
|
+
}
|
|
809
|
+
const { name, parentPath } = splitRecentLabel(fullPath);
|
|
810
|
+
const li = $('li');
|
|
811
|
+
const link = $('button.button-link');
|
|
812
|
+
link.innerText = name;
|
|
813
|
+
link.title = fullPath;
|
|
814
|
+
link.setAttribute('aria-label', ( localizeWithPath(
|
|
815
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
816
|
+
'welcomePage.openFolderWithPath',
|
|
817
|
+
"Open folder {0} with path {1}",
|
|
818
|
+
name,
|
|
819
|
+
parentPath
|
|
820
|
+
)));
|
|
821
|
+
link.addEventListener('click', e => {
|
|
822
|
+
this.telemetryService.publicLog2('gettingStarted.ActionExecuted', { command: 'openRecent', argument: undefined, walkthroughId: this.currentWalkthrough?.id });
|
|
823
|
+
this.hostService.openWindow([windowOpenable], {
|
|
824
|
+
forceNewWindow: e.ctrlKey || e.metaKey,
|
|
825
|
+
remoteAuthority: recent.remoteAuthority || null
|
|
826
|
+
});
|
|
827
|
+
e.preventDefault();
|
|
828
|
+
e.stopPropagation();
|
|
829
|
+
});
|
|
830
|
+
li.appendChild(link);
|
|
831
|
+
const span = $('span');
|
|
832
|
+
span.classList.add('path');
|
|
833
|
+
span.classList.add('detail');
|
|
834
|
+
span.innerText = parentPath;
|
|
835
|
+
span.title = fullPath;
|
|
836
|
+
li.appendChild(span);
|
|
837
|
+
return li;
|
|
838
|
+
};
|
|
839
|
+
if (this.recentlyOpenedList) {
|
|
840
|
+
this.recentlyOpenedList.dispose();
|
|
841
|
+
}
|
|
842
|
+
const recentlyOpenedList = this.recentlyOpenedList = ( new GettingStartedIndexList({
|
|
843
|
+
title: ( localizeWithPath(
|
|
844
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
845
|
+
'recent',
|
|
846
|
+
"Recent"
|
|
847
|
+
)),
|
|
848
|
+
klass: 'recently-opened',
|
|
849
|
+
limit: 5,
|
|
850
|
+
empty: $('.empty-recent', {}, ( localizeWithPath(
|
|
851
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
852
|
+
'noRecents',
|
|
853
|
+
"You have no recent folders,"
|
|
854
|
+
)), $('button.button-link', { 'x-dispatch': 'openFolder' }, ( localizeWithPath(
|
|
855
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
856
|
+
'openFolder',
|
|
857
|
+
"open a folder"
|
|
858
|
+
))), ( localizeWithPath(
|
|
859
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
860
|
+
'toStart',
|
|
861
|
+
"to start."
|
|
862
|
+
))),
|
|
863
|
+
more: $('.more', {}, $('button.button-link', {
|
|
864
|
+
'x-dispatch': 'showMoreRecents',
|
|
865
|
+
title: ( localizeWithPath(
|
|
866
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
867
|
+
'show more recents',
|
|
868
|
+
"Show All Recent Folders {0}",
|
|
869
|
+
this.getKeybindingLabel(OpenRecentAction.ID)
|
|
870
|
+
))
|
|
871
|
+
}, ( localizeWithPath(
|
|
872
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
873
|
+
'showAll',
|
|
874
|
+
"More..."
|
|
875
|
+
)))),
|
|
876
|
+
renderElement: renderRecent,
|
|
877
|
+
contextService: this.contextService
|
|
878
|
+
}));
|
|
879
|
+
recentlyOpenedList.onDidChange(() => this.registerDispatchListeners());
|
|
880
|
+
this.recentlyOpened.then(({ workspaces }) => {
|
|
881
|
+
const workspacesWithID = ( workspaces
|
|
882
|
+
.filter(recent => !this.workspaceContextService.isCurrentWorkspace(isRecentWorkspace(recent) ? recent.workspace : recent.folderUri))
|
|
883
|
+
.map(
|
|
884
|
+
recent => ({ ...recent, id: isRecentWorkspace(recent) ? recent.workspace.id : ( recent.folderUri.toString()) })
|
|
885
|
+
));
|
|
886
|
+
const updateEntries = () => {
|
|
887
|
+
recentlyOpenedList.setEntries(workspacesWithID);
|
|
888
|
+
};
|
|
889
|
+
updateEntries();
|
|
890
|
+
recentlyOpenedList.register(this.labelService.onDidChangeFormatters(() => updateEntries()));
|
|
891
|
+
}).catch(onUnexpectedError);
|
|
892
|
+
return recentlyOpenedList;
|
|
893
|
+
}
|
|
894
|
+
buildStartList() {
|
|
895
|
+
const renderStartEntry = (entry) => $('li', {}, $('button.button-link', {
|
|
896
|
+
'x-dispatch': 'selectStartEntry:' + entry.id,
|
|
897
|
+
title: entry.description + ' ' + this.getKeybindingLabel(entry.command),
|
|
898
|
+
}, this.iconWidgetFor(entry), $('span', {}, entry.title)));
|
|
899
|
+
if (this.startList) {
|
|
900
|
+
this.startList.dispose();
|
|
901
|
+
}
|
|
902
|
+
const startList = this.startList = ( new GettingStartedIndexList({
|
|
903
|
+
title: ( localizeWithPath(
|
|
904
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
905
|
+
'start',
|
|
906
|
+
"Start"
|
|
907
|
+
)),
|
|
908
|
+
klass: 'start-container',
|
|
909
|
+
limit: 10,
|
|
910
|
+
renderElement: renderStartEntry,
|
|
911
|
+
rankElement: e => -e.order,
|
|
912
|
+
contextService: this.contextService
|
|
913
|
+
}));
|
|
914
|
+
startList.setEntries(parsedStartEntries);
|
|
915
|
+
startList.onDidChange(() => this.registerDispatchListeners());
|
|
916
|
+
return startList;
|
|
917
|
+
}
|
|
918
|
+
buildGettingStartedWalkthroughsList() {
|
|
919
|
+
const renderGetttingStaredWalkthrough = (category) => {
|
|
920
|
+
const renderNewBadge = (category.newItems || category.newEntry) && !category.isFeatured;
|
|
921
|
+
const newBadge = $('.new-badge', {});
|
|
922
|
+
if (category.newEntry) {
|
|
923
|
+
reset(newBadge, $('.new-category', {}, ( localizeWithPath(
|
|
924
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
925
|
+
'new',
|
|
926
|
+
"New"
|
|
927
|
+
))));
|
|
928
|
+
}
|
|
929
|
+
else if (category.newItems) {
|
|
930
|
+
reset(newBadge, $('.new-items', {}, ( localizeWithPath(
|
|
931
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
932
|
+
{ key: 'newItems', comment: ['Shown when a list of items has changed based on an update from a remote source'] },
|
|
933
|
+
"Updated"
|
|
934
|
+
))));
|
|
935
|
+
}
|
|
936
|
+
const featuredBadge = $('.featured-badge', {});
|
|
937
|
+
const descriptionContent = $('.description-content', {});
|
|
938
|
+
if (category.isFeatured && this.showFeaturedWalkthrough) {
|
|
939
|
+
reset(featuredBadge, $('.featured', {}, $('span.featured-icon.codicon.codicon-star-full')));
|
|
940
|
+
reset(descriptionContent, ...renderLabelWithIcons(category.description));
|
|
941
|
+
}
|
|
942
|
+
const titleContent = $('h3.category-title.max-lines-3', { 'x-category-title-for': category.id });
|
|
943
|
+
reset(titleContent, ...renderLabelWithIcons(category.title));
|
|
944
|
+
return $('button.getting-started-category' + (category.isFeatured && this.showFeaturedWalkthrough ? '.featured' : ''), {
|
|
945
|
+
'x-dispatch': 'selectCategory:' + category.id,
|
|
946
|
+
'title': category.description
|
|
947
|
+
}, featuredBadge, $('.main-content', {}, this.iconWidgetFor(category), titleContent, renderNewBadge ? newBadge : $('.no-badge'), $('a.codicon.codicon-close.hide-category-button', {
|
|
948
|
+
'tabindex': 0,
|
|
949
|
+
'x-dispatch': 'hideCategory:' + category.id,
|
|
950
|
+
'title': ( localizeWithPath(
|
|
951
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
952
|
+
'close',
|
|
953
|
+
"Hide"
|
|
954
|
+
)),
|
|
955
|
+
'role': 'button',
|
|
956
|
+
'aria-label': ( localizeWithPath(
|
|
957
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
958
|
+
'closeAriaLabel',
|
|
959
|
+
"Hide"
|
|
960
|
+
)),
|
|
961
|
+
})), descriptionContent, $('.category-progress', { 'x-data-category-id': category.id, }, $('.progress-bar-outer', { 'role': 'progressbar' }, $('.progress-bar-inner'))));
|
|
962
|
+
};
|
|
963
|
+
if (this.gettingStartedList) {
|
|
964
|
+
this.gettingStartedList.dispose();
|
|
965
|
+
}
|
|
966
|
+
const rankWalkthrough = (e) => {
|
|
967
|
+
let rank = e.order;
|
|
968
|
+
if (e.isFeatured) {
|
|
969
|
+
rank += 7;
|
|
970
|
+
}
|
|
971
|
+
if (e.newEntry) {
|
|
972
|
+
rank += 3;
|
|
973
|
+
}
|
|
974
|
+
if (e.newItems) {
|
|
975
|
+
rank += 2;
|
|
976
|
+
}
|
|
977
|
+
if (e.recencyBonus) {
|
|
978
|
+
rank += 4 * e.recencyBonus;
|
|
979
|
+
}
|
|
980
|
+
if (( this.getHiddenCategories().has(e.id))) {
|
|
981
|
+
rank = null;
|
|
982
|
+
}
|
|
983
|
+
return rank;
|
|
984
|
+
};
|
|
985
|
+
const gettingStartedList = this.gettingStartedList = ( new GettingStartedIndexList({
|
|
986
|
+
title: ( localizeWithPath(
|
|
987
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
988
|
+
'walkthroughs',
|
|
989
|
+
"Walkthroughs"
|
|
990
|
+
)),
|
|
991
|
+
klass: 'getting-started',
|
|
992
|
+
limit: 5,
|
|
993
|
+
footer: $('span.button-link.see-all-walkthroughs', { 'x-dispatch': 'seeAllWalkthroughs', 'tabindex': 0 }, ( localizeWithPath(
|
|
994
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
995
|
+
'showAll',
|
|
996
|
+
"More..."
|
|
997
|
+
))),
|
|
998
|
+
renderElement: renderGetttingStaredWalkthrough,
|
|
999
|
+
rankElement: rankWalkthrough,
|
|
1000
|
+
contextService: this.contextService,
|
|
1001
|
+
}));
|
|
1002
|
+
gettingStartedList.onDidChange(() => {
|
|
1003
|
+
const hidden = this.getHiddenCategories();
|
|
1004
|
+
const someWalkthroughsHidden = hidden.size || gettingStartedList.itemCount < this.gettingStartedCategories.filter(c => this.contextService.contextMatchesRules(c.when)).length;
|
|
1005
|
+
this.container.classList.toggle('someWalkthroughsHidden', !!someWalkthroughsHidden);
|
|
1006
|
+
this.registerDispatchListeners();
|
|
1007
|
+
allWalkthroughsHiddenContext.bindTo(this.contextService).set(gettingStartedList.itemCount === 0);
|
|
1008
|
+
this.updateCategoryProgress();
|
|
1009
|
+
});
|
|
1010
|
+
gettingStartedList.setEntries(this.gettingStartedCategories);
|
|
1011
|
+
allWalkthroughsHiddenContext.bindTo(this.contextService).set(gettingStartedList.itemCount === 0);
|
|
1012
|
+
return gettingStartedList;
|
|
1013
|
+
}
|
|
1014
|
+
buildVideosList() {
|
|
1015
|
+
const renderFeaturedExtensions = (entry) => {
|
|
1016
|
+
const featuredBadge = $('.featured-badge', {});
|
|
1017
|
+
const descriptionContent = $('.description-content', {});
|
|
1018
|
+
reset(featuredBadge, $('.featured', {}, $('span.featured-icon.codicon.codicon-star-full')));
|
|
1019
|
+
reset(descriptionContent, ...renderLabelWithIcons(entry.description));
|
|
1020
|
+
const titleContent = $('h3.category-title.max-lines-3', { 'x-category-title-for': entry.id });
|
|
1021
|
+
reset(titleContent, ...renderLabelWithIcons(entry.title));
|
|
1022
|
+
return $('button.getting-started-category' + '.featured', {
|
|
1023
|
+
'x-dispatch': 'openLink:' + entry.command,
|
|
1024
|
+
'title': entry.title
|
|
1025
|
+
}, featuredBadge, $('.main-content', {}, this.iconWidgetFor(entry), titleContent, $('a.codicon.codicon-close.hide-category-button', {
|
|
1026
|
+
'tabindex': 0,
|
|
1027
|
+
'x-dispatch': 'hideVideos',
|
|
1028
|
+
'title': ( localizeWithPath(
|
|
1029
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1030
|
+
'close',
|
|
1031
|
+
"Hide"
|
|
1032
|
+
)),
|
|
1033
|
+
'role': 'button',
|
|
1034
|
+
'aria-label': ( localizeWithPath(
|
|
1035
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1036
|
+
'closeAriaLabel',
|
|
1037
|
+
"Hide"
|
|
1038
|
+
)),
|
|
1039
|
+
})), descriptionContent);
|
|
1040
|
+
};
|
|
1041
|
+
if (this.videoList) {
|
|
1042
|
+
this.videoList.dispose();
|
|
1043
|
+
}
|
|
1044
|
+
const videoList = this.videoList = ( new GettingStartedIndexList({
|
|
1045
|
+
title: ( localizeWithPath(
|
|
1046
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1047
|
+
'videos',
|
|
1048
|
+
"Videos"
|
|
1049
|
+
)),
|
|
1050
|
+
klass: 'getting-started-videos',
|
|
1051
|
+
limit: 1,
|
|
1052
|
+
renderElement: renderFeaturedExtensions,
|
|
1053
|
+
contextService: this.contextService,
|
|
1054
|
+
}));
|
|
1055
|
+
if (( this.getHiddenCategories().has('getting-started-videos'))) {
|
|
1056
|
+
return videoList;
|
|
1057
|
+
}
|
|
1058
|
+
videoList.setEntries([{
|
|
1059
|
+
id: 'getting-started-videos',
|
|
1060
|
+
title: ( localizeWithPath(
|
|
1061
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1062
|
+
'videos-title',
|
|
1063
|
+
'Watch Getting Started Tutorials'
|
|
1064
|
+
)),
|
|
1065
|
+
description: ( localizeWithPath(
|
|
1066
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1067
|
+
'videos-description',
|
|
1068
|
+
'Learn VS Code\'s must-have features in short and practical videos'
|
|
1069
|
+
)),
|
|
1070
|
+
command: 'https://aka.ms/vscode-getting-started-tutorials',
|
|
1071
|
+
order: 0,
|
|
1072
|
+
icon: { type: 'icon', icon: Codicon.deviceCameraVideo },
|
|
1073
|
+
when: ContextKeyExpr.true(),
|
|
1074
|
+
}]);
|
|
1075
|
+
videoList.onDidChange(() => this.registerDispatchListeners());
|
|
1076
|
+
return videoList;
|
|
1077
|
+
}
|
|
1078
|
+
layout(size) {
|
|
1079
|
+
this.detailsScrollbar?.scanDomNode();
|
|
1080
|
+
this.categoriesPageScrollbar?.scanDomNode();
|
|
1081
|
+
this.detailsPageScrollbar?.scanDomNode();
|
|
1082
|
+
this.startList?.layout(size);
|
|
1083
|
+
this.gettingStartedList?.layout(size);
|
|
1084
|
+
this.recentlyOpenedList?.layout(size);
|
|
1085
|
+
this.videoList?.layout(size);
|
|
1086
|
+
if (this.editorInput?.selectedStep && this.currentMediaType) {
|
|
1087
|
+
this.mediaDisposables.clear();
|
|
1088
|
+
this.stepDisposables.clear();
|
|
1089
|
+
this.buildMediaComponent(this.editorInput.selectedStep);
|
|
1090
|
+
}
|
|
1091
|
+
this.layoutMarkdown?.();
|
|
1092
|
+
this.container.classList.toggle('height-constrained', size.height <= 600);
|
|
1093
|
+
this.container.classList.toggle('width-constrained', size.width <= 400);
|
|
1094
|
+
this.container.classList.toggle('width-semi-constrained', size.width <= 800);
|
|
1095
|
+
this.categoriesPageScrollbar?.scanDomNode();
|
|
1096
|
+
this.detailsPageScrollbar?.scanDomNode();
|
|
1097
|
+
this.detailsScrollbar?.scanDomNode();
|
|
1098
|
+
}
|
|
1099
|
+
updateCategoryProgress() {
|
|
1100
|
+
this.window.document.querySelectorAll('.category-progress').forEach(element => {
|
|
1101
|
+
const categoryID = element.getAttribute('x-data-category-id');
|
|
1102
|
+
const category = this.gettingStartedCategories.find(category => category.id === categoryID);
|
|
1103
|
+
if (!category) {
|
|
1104
|
+
throw Error('Could not find category with ID ' + categoryID);
|
|
1105
|
+
}
|
|
1106
|
+
const stats = this.getWalkthroughCompletionStats(category);
|
|
1107
|
+
const bar = assertIsDefined(element.querySelector('.progress-bar-inner'));
|
|
1108
|
+
bar.setAttribute('aria-valuemin', '0');
|
|
1109
|
+
bar.setAttribute('aria-valuenow', '' + stats.stepsComplete);
|
|
1110
|
+
bar.setAttribute('aria-valuemax', '' + stats.stepsTotal);
|
|
1111
|
+
const progress = (stats.stepsComplete / stats.stepsTotal) * 100;
|
|
1112
|
+
bar.style.width = `${progress}%`;
|
|
1113
|
+
element.parentElement.classList.toggle('no-progress', stats.stepsComplete === 0);
|
|
1114
|
+
if (stats.stepsTotal === stats.stepsComplete) {
|
|
1115
|
+
bar.title = ( localizeWithPath(
|
|
1116
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1117
|
+
'gettingStarted.allStepsComplete',
|
|
1118
|
+
"All {0} steps complete!",
|
|
1119
|
+
stats.stepsComplete
|
|
1120
|
+
));
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
bar.title = ( localizeWithPath(
|
|
1124
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1125
|
+
'gettingStarted.someStepsComplete',
|
|
1126
|
+
"{0} of {1} steps complete",
|
|
1127
|
+
stats.stepsComplete,
|
|
1128
|
+
stats.stepsTotal
|
|
1129
|
+
));
|
|
1130
|
+
}
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
async scrollToCategory(categoryID, stepId) {
|
|
1134
|
+
if (!( this.gettingStartedCategories.some(c => c.id === categoryID))) {
|
|
1135
|
+
this.gettingStartedCategories = this.gettingStartedService.getWalkthroughs();
|
|
1136
|
+
}
|
|
1137
|
+
const ourCategory = this.gettingStartedCategories.find(c => c.id === categoryID);
|
|
1138
|
+
if (!ourCategory) {
|
|
1139
|
+
throw Error('Could not find category with ID: ' + categoryID);
|
|
1140
|
+
}
|
|
1141
|
+
this.inProgressScroll = this.inProgressScroll.then(async () => {
|
|
1142
|
+
reset(this.stepsContent);
|
|
1143
|
+
this.editorInput.selectedCategory = categoryID;
|
|
1144
|
+
this.editorInput.selectedStep = stepId;
|
|
1145
|
+
this.currentWalkthrough = ourCategory;
|
|
1146
|
+
this.buildCategorySlide(categoryID, stepId);
|
|
1147
|
+
this.setSlide('details');
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
iconWidgetFor(category) {
|
|
1151
|
+
const widget = category.icon.type === 'icon' ? $(ThemeIcon.asCSSSelector(category.icon.icon)) : $('img.category-icon', { src: category.icon.path });
|
|
1152
|
+
widget.classList.add('icon-widget');
|
|
1153
|
+
return widget;
|
|
1154
|
+
}
|
|
1155
|
+
focusSideEditorGroup() {
|
|
1156
|
+
const fullSize = this.groupsService.getPart(this.group).contentDimension;
|
|
1157
|
+
if (!fullSize || fullSize.width <= 700) {
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
if (this.groupsService.count === 1) {
|
|
1161
|
+
const sideGroup = this.groupsService.addGroup(this.groupsService.groups[0], 3 );
|
|
1162
|
+
this.groupsService.activateGroup(sideGroup);
|
|
1163
|
+
const gettingStartedSize = Math.floor(fullSize.width / 2);
|
|
1164
|
+
const gettingStartedGroup = this.groupsService.getGroups(1 ).find(group => (group.activeEditor instanceof GettingStartedInput));
|
|
1165
|
+
this.groupsService.setSize(assertIsDefined(gettingStartedGroup), { width: gettingStartedSize, height: fullSize.height });
|
|
1166
|
+
}
|
|
1167
|
+
const nonGettingStartedGroup = this.groupsService.getGroups(1 ).find(group => !(group.activeEditor instanceof GettingStartedInput));
|
|
1168
|
+
if (nonGettingStartedGroup) {
|
|
1169
|
+
this.groupsService.activateGroup(nonGettingStartedGroup);
|
|
1170
|
+
nonGettingStartedGroup.focus();
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
runStepCommand(href) {
|
|
1174
|
+
const isCommand = href.startsWith('command:');
|
|
1175
|
+
const toSide = href.startsWith('command:toSide:');
|
|
1176
|
+
const command = href.replace(/command:(toSide:)?/, 'command:');
|
|
1177
|
+
this.telemetryService.publicLog2('gettingStarted.ActionExecuted', { command: 'runStepAction', argument: href, walkthroughId: this.currentWalkthrough?.id });
|
|
1178
|
+
if (toSide) {
|
|
1179
|
+
this.focusSideEditorGroup();
|
|
1180
|
+
}
|
|
1181
|
+
if (isCommand) {
|
|
1182
|
+
const commandURI = ( URI.parse(command));
|
|
1183
|
+
let args = [];
|
|
1184
|
+
try {
|
|
1185
|
+
args = parse(decodeURIComponent(commandURI.query));
|
|
1186
|
+
}
|
|
1187
|
+
catch {
|
|
1188
|
+
try {
|
|
1189
|
+
args = parse(commandURI.query);
|
|
1190
|
+
}
|
|
1191
|
+
catch {
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
if (!Array.isArray(args)) {
|
|
1195
|
+
args = [args];
|
|
1196
|
+
}
|
|
1197
|
+
if ((commandURI.path === ( OpenFileFolderAction.ID.toString()) ||
|
|
1198
|
+
commandURI.path === ( OpenFolderAction.ID.toString())) &&
|
|
1199
|
+
this.workspaceContextService.getWorkspace().folders.length === 0) {
|
|
1200
|
+
const selectedStepIndex = this.currentWalkthrough?.steps.findIndex(step => step.id === this.editorInput.selectedStep);
|
|
1201
|
+
if (selectedStepIndex !== undefined &&
|
|
1202
|
+
selectedStepIndex > -1 &&
|
|
1203
|
+
this.currentWalkthrough?.steps.slice(selectedStepIndex + 1).some(step => !step.done)) {
|
|
1204
|
+
const restoreData = { folder: UNKNOWN_EMPTY_WINDOW_WORKSPACE.id, category: this.editorInput.selectedCategory, step: this.editorInput.selectedStep };
|
|
1205
|
+
this.storageService.store(restoreWalkthroughsConfigurationKey, JSON.stringify(restoreData), 0 , 1 );
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
this.commandService.executeCommand(commandURI.path, ...args).then(result => {
|
|
1209
|
+
const toOpen = result?.openFolder;
|
|
1210
|
+
if (toOpen) {
|
|
1211
|
+
if (!URI.isUri(toOpen)) {
|
|
1212
|
+
console.warn('Warn: Running walkthrough command', href, 'yielded non-URI `openFolder` result', toOpen, '. It will be disregarded.');
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
const restoreData = { folder: ( toOpen.toString()), category: this.editorInput.selectedCategory, step: this.editorInput.selectedStep };
|
|
1216
|
+
this.storageService.store(restoreWalkthroughsConfigurationKey, JSON.stringify(restoreData), 0 , 1 );
|
|
1217
|
+
this.hostService.openWindow([{ folderUri: toOpen }]);
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
else {
|
|
1222
|
+
this.openerService.open(command, { allowCommands: true });
|
|
1223
|
+
}
|
|
1224
|
+
if (!isCommand && (href.startsWith('https://') || href.startsWith('http://'))) {
|
|
1225
|
+
this.gettingStartedService.progressByEvent('onLink:' + href);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
buildMarkdownDescription(container, text) {
|
|
1229
|
+
while (container.firstChild) {
|
|
1230
|
+
container.removeChild(container.firstChild);
|
|
1231
|
+
}
|
|
1232
|
+
for (const linkedText of text) {
|
|
1233
|
+
if (linkedText.nodes.length === 1 && typeof linkedText.nodes[0] !== 'string') {
|
|
1234
|
+
const node = linkedText.nodes[0];
|
|
1235
|
+
const buttonContainer = append(container, $('.button-container'));
|
|
1236
|
+
const button = ( new Button(
|
|
1237
|
+
buttonContainer,
|
|
1238
|
+
{ title: node.title, supportIcons: true, ...defaultButtonStyles }
|
|
1239
|
+
));
|
|
1240
|
+
const isCommand = node.href.startsWith('command:');
|
|
1241
|
+
const command = node.href.replace(/command:(toSide:)?/, 'command:');
|
|
1242
|
+
button.label = node.label;
|
|
1243
|
+
button.onDidClick(e => {
|
|
1244
|
+
e.stopPropagation();
|
|
1245
|
+
e.preventDefault();
|
|
1246
|
+
this.runStepCommand(node.href);
|
|
1247
|
+
}, null, this.detailsPageDisposables);
|
|
1248
|
+
if (isCommand) {
|
|
1249
|
+
const keybindingLabel = this.getKeybindingLabel(command);
|
|
1250
|
+
if (keybindingLabel) {
|
|
1251
|
+
container.appendChild($('span.shortcut-message', {}, ( localizeWithPath(
|
|
1252
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1253
|
+
'gettingStarted.keyboardTip',
|
|
1254
|
+
'Tip: Use keyboard shortcut '
|
|
1255
|
+
)), $('span.keybinding', {}, keybindingLabel)));
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
this.detailsPageDisposables.add(button);
|
|
1259
|
+
}
|
|
1260
|
+
else {
|
|
1261
|
+
const p = append(container, $('p'));
|
|
1262
|
+
for (const node of linkedText.nodes) {
|
|
1263
|
+
if (typeof node === 'string') {
|
|
1264
|
+
const labelWithIcon = renderLabelWithIcons(node);
|
|
1265
|
+
for (const element of labelWithIcon) {
|
|
1266
|
+
if (typeof element === 'string') {
|
|
1267
|
+
p.appendChild(renderFormattedText(element, { inline: true, renderCodeSegments: true }));
|
|
1268
|
+
}
|
|
1269
|
+
else {
|
|
1270
|
+
p.appendChild(element);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
else {
|
|
1275
|
+
const link = this.instantiationService.createInstance(Link, p, node, { opener: (href) => this.runStepCommand(href) });
|
|
1276
|
+
this.detailsPageDisposables.add(link);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
return container;
|
|
1282
|
+
}
|
|
1283
|
+
clearInput() {
|
|
1284
|
+
this.stepDisposables.clear();
|
|
1285
|
+
super.clearInput();
|
|
1286
|
+
}
|
|
1287
|
+
buildCategorySlide(categoryID, selectedStep) {
|
|
1288
|
+
if (this.detailsScrollbar) {
|
|
1289
|
+
this.detailsScrollbar.dispose();
|
|
1290
|
+
}
|
|
1291
|
+
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
|
|
1292
|
+
this.extensionService.activateByEvent(`onWalkthrough:${categoryID.replace(/[^#]+#/, '')}`);
|
|
1293
|
+
});
|
|
1294
|
+
this.detailsPageDisposables.clear();
|
|
1295
|
+
this.mediaDisposables.clear();
|
|
1296
|
+
const category = this.gettingStartedCategories.find(category => category.id === categoryID);
|
|
1297
|
+
if (!category) {
|
|
1298
|
+
throw Error('could not find category with ID ' + categoryID);
|
|
1299
|
+
}
|
|
1300
|
+
const descriptionContainer = $('.category-description.description.max-lines-3', { 'x-category-description-for': category.id });
|
|
1301
|
+
this.buildMarkdownDescription(descriptionContainer, parseDescription(category.description));
|
|
1302
|
+
const categoryDescriptorComponent = $('.getting-started-category', {}, $('.category-description-container', {}, $('h2.category-title.max-lines-3', { 'x-category-title-for': category.id }, ...renderLabelWithIcons(category.title)), descriptionContainer));
|
|
1303
|
+
const stepListContainer = $('.step-list-container');
|
|
1304
|
+
this.detailsPageDisposables.add(addDisposableListener(stepListContainer, 'keydown', (e) => {
|
|
1305
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
1306
|
+
const currentStepIndex = () => category.steps.findIndex(e => e.id === this.editorInput.selectedStep);
|
|
1307
|
+
if (event.keyCode === 16 ) {
|
|
1308
|
+
const toExpand = category.steps.filter((step, index) => index < currentStepIndex() && this.contextService.contextMatchesRules(step.when));
|
|
1309
|
+
if (toExpand.length) {
|
|
1310
|
+
this.selectStep(toExpand[toExpand.length - 1].id, false);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if (event.keyCode === 18 ) {
|
|
1314
|
+
const toExpand = category.steps.find((step, index) => index > currentStepIndex() && this.contextService.contextMatchesRules(step.when));
|
|
1315
|
+
if (toExpand) {
|
|
1316
|
+
this.selectStep(toExpand.id, false);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
}));
|
|
1320
|
+
let renderedSteps = undefined;
|
|
1321
|
+
const contextKeysToWatch = ( new Set(category.steps.flatMap(step => ( step.when.keys()))));
|
|
1322
|
+
const buildStepList = () => {
|
|
1323
|
+
category.steps.sort((a, b) => a.order - b.order);
|
|
1324
|
+
const toRender = category.steps
|
|
1325
|
+
.filter(step => this.contextService.contextMatchesRules(step.when));
|
|
1326
|
+
if (equals(renderedSteps, toRender, (a, b) => a.id === b.id)) {
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
renderedSteps = toRender;
|
|
1330
|
+
reset(stepListContainer, ...( renderedSteps
|
|
1331
|
+
.map(step => {
|
|
1332
|
+
const codicon = $('.codicon' + (step.done ? '.complete' + ThemeIcon.asCSSSelector(gettingStartedCheckedCodicon) : ThemeIcon.asCSSSelector(gettingStartedUncheckedCodicon)), {
|
|
1333
|
+
'data-done-step-id': step.id,
|
|
1334
|
+
'x-dispatch': 'toggleStepCompletion:' + step.id,
|
|
1335
|
+
'role': 'checkbox',
|
|
1336
|
+
'tabindex': '0',
|
|
1337
|
+
'aria-checked': step.done ? 'true' : 'false'
|
|
1338
|
+
});
|
|
1339
|
+
const container = $('.step-description-container', { 'x-step-description-for': step.id });
|
|
1340
|
+
this.buildMarkdownDescription(container, step.description);
|
|
1341
|
+
const stepTitle = $('h3.step-title.max-lines-3', { 'x-step-title-for': step.id });
|
|
1342
|
+
reset(stepTitle, ...renderLabelWithIcons(step.title));
|
|
1343
|
+
const stepDescription = $('.step-container', {}, stepTitle, container);
|
|
1344
|
+
if (step.media.type === 'image') {
|
|
1345
|
+
stepDescription.appendChild($('.image-description', { 'aria-label': ( localizeWithPath(
|
|
1346
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1347
|
+
'imageShowing',
|
|
1348
|
+
"Image showing {0}",
|
|
1349
|
+
step.media.altText
|
|
1350
|
+
)) }));
|
|
1351
|
+
}
|
|
1352
|
+
return $('button.getting-started-step', {
|
|
1353
|
+
'x-dispatch': 'selectTask:' + step.id,
|
|
1354
|
+
'data-step-id': step.id,
|
|
1355
|
+
'aria-expanded': 'false',
|
|
1356
|
+
'aria-checked': step.done ? 'true' : 'false',
|
|
1357
|
+
'role': 'button',
|
|
1358
|
+
}, codicon, stepDescription);
|
|
1359
|
+
})));
|
|
1360
|
+
};
|
|
1361
|
+
buildStepList();
|
|
1362
|
+
this.detailsPageDisposables.add(this.contextService.onDidChangeContext(e => {
|
|
1363
|
+
if (e.affectsSome(contextKeysToWatch)) {
|
|
1364
|
+
buildStepList();
|
|
1365
|
+
this.registerDispatchListeners();
|
|
1366
|
+
this.selectStep(this.editorInput.selectedStep, false);
|
|
1367
|
+
}
|
|
1368
|
+
}));
|
|
1369
|
+
const showNextCategory = this.gettingStartedCategories.find(_category => _category.id === category.next);
|
|
1370
|
+
const stepsContainer = $('.getting-started-detail-container', { 'role': 'list' }, stepListContainer, $('.done-next-container', {}, $('button.button-link.all-done', { 'x-dispatch': 'allDone' }, $('span.codicon.codicon-check-all'), ( localizeWithPath(
|
|
1371
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1372
|
+
'allDone',
|
|
1373
|
+
"Mark Done"
|
|
1374
|
+
))), ...(showNextCategory
|
|
1375
|
+
? [$('button.button-link.next', { 'x-dispatch': 'nextSection' }, ( localizeWithPath(
|
|
1376
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1377
|
+
'nextOne',
|
|
1378
|
+
"Next Section"
|
|
1379
|
+
)), $('span.codicon.codicon-arrow-right'))]
|
|
1380
|
+
: [])));
|
|
1381
|
+
this.detailsScrollbar = this._register(( new DomScrollableElement(stepsContainer, { className: 'steps-container' })));
|
|
1382
|
+
const stepListComponent = this.detailsScrollbar.getDomNode();
|
|
1383
|
+
const categoryFooter = $('.getting-started-footer');
|
|
1384
|
+
if (this.editorInput.showTelemetryNotice && getTelemetryLevel(this.configurationService) !== 0 && this.productService.enableTelemetry) {
|
|
1385
|
+
this.buildTelemetryFooter(categoryFooter);
|
|
1386
|
+
}
|
|
1387
|
+
reset(this.stepsContent, categoryDescriptorComponent, stepListComponent, this.stepMediaComponent, categoryFooter);
|
|
1388
|
+
const toExpand = category.steps.find(step => this.contextService.contextMatchesRules(step.when) && !step.done) ?? category.steps[0];
|
|
1389
|
+
this.selectStep(selectedStep ?? toExpand.id, !selectedStep);
|
|
1390
|
+
this.detailsScrollbar.scanDomNode();
|
|
1391
|
+
this.detailsPageScrollbar?.scanDomNode();
|
|
1392
|
+
this.registerDispatchListeners();
|
|
1393
|
+
}
|
|
1394
|
+
buildTelemetryFooter(parent) {
|
|
1395
|
+
const mdRenderer = this.instantiationService.createInstance(MarkdownRenderer, {});
|
|
1396
|
+
const privacyStatementCopy = ( localizeWithPath(
|
|
1397
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1398
|
+
'privacy statement',
|
|
1399
|
+
"privacy statement"
|
|
1400
|
+
));
|
|
1401
|
+
const privacyStatementButton = `[${privacyStatementCopy}](command:workbench.action.openPrivacyStatementUrl)`;
|
|
1402
|
+
const optOutCopy = ( localizeWithPath(
|
|
1403
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1404
|
+
'optOut',
|
|
1405
|
+
"opt out"
|
|
1406
|
+
));
|
|
1407
|
+
const optOutButton = `[${optOutCopy}](command:settings.filterByTelemetry)`;
|
|
1408
|
+
const text = ( localizeWithPath(
|
|
1409
|
+
'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted',
|
|
1410
|
+
{ key: 'footer', comment: ['fist substitution is "vs code", second is "privacy statement", third is "opt out".'] },
|
|
1411
|
+
"{0} collects usage data. Read our {1} and learn how to {2}.",
|
|
1412
|
+
this.productService.nameShort,
|
|
1413
|
+
privacyStatementButton,
|
|
1414
|
+
optOutButton
|
|
1415
|
+
));
|
|
1416
|
+
parent.append(mdRenderer.render({ value: text, isTrusted: true }).element);
|
|
1417
|
+
mdRenderer.dispose();
|
|
1418
|
+
}
|
|
1419
|
+
getKeybindingLabel(command) {
|
|
1420
|
+
command = command.replace(/^command:/, '');
|
|
1421
|
+
const label = this.keybindingService.lookupKeybinding(command)?.getLabel();
|
|
1422
|
+
if (!label) {
|
|
1423
|
+
return '';
|
|
1424
|
+
}
|
|
1425
|
+
else {
|
|
1426
|
+
return `(${label})`;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
async scrollPrev() {
|
|
1430
|
+
this.inProgressScroll = this.inProgressScroll.then(async () => {
|
|
1431
|
+
this.currentWalkthrough = undefined;
|
|
1432
|
+
this.editorInput.selectedCategory = undefined;
|
|
1433
|
+
this.editorInput.selectedStep = undefined;
|
|
1434
|
+
this.editorInput.showTelemetryNotice = false;
|
|
1435
|
+
if (this.gettingStartedCategories.length !== this.gettingStartedList?.itemCount) {
|
|
1436
|
+
this.buildCategoriesSlide();
|
|
1437
|
+
}
|
|
1438
|
+
this.selectStep(undefined);
|
|
1439
|
+
this.setSlide('categories');
|
|
1440
|
+
this.container.focus();
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
runSkip() {
|
|
1444
|
+
this.commandService.executeCommand('workbench.action.closeActiveEditor');
|
|
1445
|
+
}
|
|
1446
|
+
escape() {
|
|
1447
|
+
if (this.editorInput.selectedCategory) {
|
|
1448
|
+
this.scrollPrev();
|
|
1449
|
+
}
|
|
1450
|
+
else {
|
|
1451
|
+
this.runSkip();
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
setSlide(toEnable) {
|
|
1455
|
+
const slideManager = assertIsDefined(this.container.querySelector('.gettingStarted'));
|
|
1456
|
+
if (toEnable === 'categories') {
|
|
1457
|
+
slideManager.classList.remove('showDetails');
|
|
1458
|
+
slideManager.classList.add('showCategories');
|
|
1459
|
+
this.container.querySelector('.prev-button.button-link').style.display = 'none';
|
|
1460
|
+
this.container.querySelector('.gettingStartedSlideDetails').querySelectorAll('button').forEach(button => button.disabled = true);
|
|
1461
|
+
this.container.querySelector('.gettingStartedSlideCategories').querySelectorAll('button').forEach(button => button.disabled = false);
|
|
1462
|
+
this.container.querySelector('.gettingStartedSlideCategories').querySelectorAll('input').forEach(button => button.disabled = false);
|
|
1463
|
+
}
|
|
1464
|
+
else {
|
|
1465
|
+
slideManager.classList.add('showDetails');
|
|
1466
|
+
slideManager.classList.remove('showCategories');
|
|
1467
|
+
this.container.querySelector('.prev-button.button-link').style.display = 'block';
|
|
1468
|
+
this.container.querySelector('.gettingStartedSlideDetails').querySelectorAll('button').forEach(button => button.disabled = false);
|
|
1469
|
+
this.container.querySelector('.gettingStartedSlideCategories').querySelectorAll('button').forEach(button => button.disabled = true);
|
|
1470
|
+
this.container.querySelector('.gettingStartedSlideCategories').querySelectorAll('input').forEach(button => button.disabled = true);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
focus() {
|
|
1474
|
+
super.focus();
|
|
1475
|
+
const active = this.container.ownerDocument.activeElement;
|
|
1476
|
+
let parent = this.container.parentElement;
|
|
1477
|
+
while (parent && parent !== active) {
|
|
1478
|
+
parent = parent.parentElement;
|
|
1479
|
+
}
|
|
1480
|
+
if (parent) {
|
|
1481
|
+
this.container.focus();
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
GettingStartedPage = GettingStartedPage_1 = ( __decorate([
|
|
1486
|
+
( __param(1, ICommandService)),
|
|
1487
|
+
( __param(2, IProductService)),
|
|
1488
|
+
( __param(3, IKeybindingService)),
|
|
1489
|
+
( __param(4, IWalkthroughsService)),
|
|
1490
|
+
( __param(5, IConfigurationService)),
|
|
1491
|
+
( __param(6, ITelemetryService)),
|
|
1492
|
+
( __param(7, ILanguageService)),
|
|
1493
|
+
( __param(8, IFileService)),
|
|
1494
|
+
( __param(9, IOpenerService)),
|
|
1495
|
+
( __param(10, IThemeService)),
|
|
1496
|
+
( __param(11, IStorageService)),
|
|
1497
|
+
( __param(12, IExtensionService)),
|
|
1498
|
+
( __param(13, IInstantiationService)),
|
|
1499
|
+
( __param(14, INotificationService)),
|
|
1500
|
+
( __param(15, IEditorGroupsService)),
|
|
1501
|
+
( __param(16, IContextKeyService)),
|
|
1502
|
+
( __param(17, IQuickInputService)),
|
|
1503
|
+
( __param(18, IWorkspacesService)),
|
|
1504
|
+
( __param(19, ILabelService)),
|
|
1505
|
+
( __param(20, IHostService)),
|
|
1506
|
+
( __param(21, IWebviewService)),
|
|
1507
|
+
( __param(22, IWorkspaceContextService)),
|
|
1508
|
+
( __param(23, IAccessibilityService)),
|
|
1509
|
+
( __param(24, IWorkbenchAssignmentService))
|
|
1510
|
+
], GettingStartedPage));
|
|
1511
|
+
class GettingStartedInputSerializer {
|
|
1512
|
+
canSerialize(editorInput) {
|
|
1513
|
+
return true;
|
|
1514
|
+
}
|
|
1515
|
+
serialize(editorInput) {
|
|
1516
|
+
return JSON.stringify({ selectedCategory: editorInput.selectedCategory, selectedStep: editorInput.selectedStep });
|
|
1517
|
+
}
|
|
1518
|
+
deserialize(instantiationService, serializedEditorInput) {
|
|
1519
|
+
try {
|
|
1520
|
+
const { selectedCategory, selectedStep } = JSON.parse(serializedEditorInput);
|
|
1521
|
+
return ( new GettingStartedInput({ selectedCategory, selectedStep }));
|
|
1522
|
+
}
|
|
1523
|
+
catch { }
|
|
1524
|
+
return ( new GettingStartedInput({}));
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
export { GettingStartedInputSerializer, GettingStartedPage, allWalkthroughsHiddenContext, inWelcomeContext };
|