@codingame/monaco-vscode-api 2.1.3 → 2.2.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/contributions.js +1 -0
- package/extensions.d.ts +6 -3
- package/extensions.js +18 -7
- package/lifecycle.js +11 -3
- package/missing-services.js +55 -10
- package/monaco.js +7 -3
- package/package.json +8 -8
- package/service-override/tools/editor.js +3 -1
- package/service-override/tools/views.d.ts +98 -0
- package/service-override/tools/views.js +249 -0
- package/services.d.ts +4 -2
- package/services.js +11 -9
- package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
- package/vscode/src/vs/base/browser/dom.js +18 -1
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
- package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
- package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
- package/vscode/src/vs/base/common/async.js +46 -2
- package/vscode/src/vs/base/common/codicons.d.ts +579 -0
- package/vscode/src/vs/base/common/event.js +11 -2
- package/vscode/src/vs/base/common/keybindingParser.js +87 -0
- package/vscode/src/vs/base/common/network.js +1 -2
- package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
- package/vscode/src/vs/base/common/platform.js +2 -1
- package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
- package/vscode/src/vs/platform/log/browser/log.js +24 -0
- package/vscode/src/vs/platform/product/common/product.js +1 -2
- package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
- package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
- package/vscode/src/vs/workbench/browser/window.js +239 -5
- package/vscode/src/vs/workbench/common/configuration.js +11 -1
- package/vscode/src/vs/workbench/common/theme.js +3 -3
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
- package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
- package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
- package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
- package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
- package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
- package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
- package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/notificationsToasts.css.js';
|
|
3
|
+
import { localizeWithPath } from '../../../../nls.js';
|
|
4
|
+
import { toDisposable, dispose, DisposableStore } from '../../../../base/common/lifecycle.js';
|
|
5
|
+
import { Dimension, scheduleAtNextAnimationFrame, getWindow, addDisposableListener, isAncestorOfActiveElement, EventType } from '../../../../base/browser/dom.js';
|
|
6
|
+
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
7
|
+
import { NotificationsList } from './notificationsList.js';
|
|
8
|
+
import { Emitter, Event } from '../../../../base/common/event.js';
|
|
9
|
+
import { IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.js';
|
|
10
|
+
import { NOTIFICATIONS_BACKGROUND, NOTIFICATIONS_TOAST_BORDER } from '../../../common/theme.js';
|
|
11
|
+
import { Themable, IThemeService } from '../../../../platform/theme/common/themeService.js';
|
|
12
|
+
import { widgetShadow } from '../../../../platform/theme/common/colorRegistry.js';
|
|
13
|
+
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
|
|
14
|
+
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
15
|
+
import { Severity, NotificationsFilter, NotificationPriority } from '../../../../platform/notification/common/notification.js';
|
|
16
|
+
import { ILifecycleService } from '../../../services/lifecycle/common/lifecycle.js';
|
|
17
|
+
import { IHostService } from '../../../services/host/browser/host.js';
|
|
18
|
+
import { IntervalCounter } from '../../../../base/common/async.js';
|
|
19
|
+
import { assertIsDefined } from '../../../../base/common/types.js';
|
|
20
|
+
import { NotificationsToastsVisibleContext } from '../../../common/contextkeys.js';
|
|
21
|
+
import { mainWindow } from '../../../../base/browser/window.js';
|
|
22
|
+
var NotificationsToasts_1;
|
|
23
|
+
var ToastVisibility;
|
|
24
|
+
( (function(ToastVisibility) {
|
|
25
|
+
ToastVisibility[ToastVisibility["HIDDEN_OR_VISIBLE"] = 0] = "HIDDEN_OR_VISIBLE";
|
|
26
|
+
ToastVisibility[ToastVisibility["HIDDEN"] = 1] = "HIDDEN";
|
|
27
|
+
ToastVisibility[ToastVisibility["VISIBLE"] = 2] = "VISIBLE";
|
|
28
|
+
})(ToastVisibility || (ToastVisibility = {})));
|
|
29
|
+
let NotificationsToasts = class NotificationsToasts extends Themable {
|
|
30
|
+
static { NotificationsToasts_1 = this; }
|
|
31
|
+
static { this.MAX_WIDTH = 450; }
|
|
32
|
+
static { this.MAX_NOTIFICATIONS = 3; }
|
|
33
|
+
static { this.PURGE_TIMEOUT = {
|
|
34
|
+
[Severity.Info]: 15000,
|
|
35
|
+
[Severity.Warning]: 18000,
|
|
36
|
+
[Severity.Error]: 20000
|
|
37
|
+
}; }
|
|
38
|
+
static { this.SPAM_PROTECTION = {
|
|
39
|
+
interval: 800,
|
|
40
|
+
limit: NotificationsToasts_1.MAX_NOTIFICATIONS
|
|
41
|
+
}; }
|
|
42
|
+
get isVisible() { return !!this._isVisible; }
|
|
43
|
+
constructor(container, model, instantiationService, layoutService, themeService, editorGroupService, contextKeyService, lifecycleService, hostService) {
|
|
44
|
+
super(themeService);
|
|
45
|
+
this.container = container;
|
|
46
|
+
this.model = model;
|
|
47
|
+
this.instantiationService = instantiationService;
|
|
48
|
+
this.layoutService = layoutService;
|
|
49
|
+
this.editorGroupService = editorGroupService;
|
|
50
|
+
this.contextKeyService = contextKeyService;
|
|
51
|
+
this.lifecycleService = lifecycleService;
|
|
52
|
+
this.hostService = hostService;
|
|
53
|
+
this._onDidChangeVisibility = this._register(( new Emitter()));
|
|
54
|
+
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
55
|
+
this._isVisible = false;
|
|
56
|
+
this.mapNotificationToToast = ( new Map());
|
|
57
|
+
this.mapNotificationToDisposable = ( new Map());
|
|
58
|
+
this.notificationsToastsVisibleContextKey = NotificationsToastsVisibleContext.bindTo(this.contextKeyService);
|
|
59
|
+
this.addedToastsIntervalCounter = ( new IntervalCounter(NotificationsToasts_1.SPAM_PROTECTION.interval));
|
|
60
|
+
this.registerListeners();
|
|
61
|
+
}
|
|
62
|
+
registerListeners() {
|
|
63
|
+
this._register(this.layoutService.onDidLayoutMainContainer(dimension => this.layout(Dimension.lift(dimension))));
|
|
64
|
+
this.lifecycleService.when(3 ).then(() => {
|
|
65
|
+
this.model.notifications.forEach(notification => this.addToast(notification));
|
|
66
|
+
this._register(this.model.onDidChangeNotification(e => this.onDidChangeNotification(e)));
|
|
67
|
+
});
|
|
68
|
+
this._register(this.model.onDidChangeFilter(({ global, sources }) => {
|
|
69
|
+
if (global === NotificationsFilter.ERROR) {
|
|
70
|
+
this.hide();
|
|
71
|
+
}
|
|
72
|
+
else if (sources) {
|
|
73
|
+
for (const [notification] of this.mapNotificationToToast) {
|
|
74
|
+
if (typeof notification.sourceId === 'string' && sources.get(notification.sourceId) === NotificationsFilter.ERROR && notification.severity !== Severity.Error && notification.priority !== NotificationPriority.URGENT) {
|
|
75
|
+
this.removeToast(notification);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
onDidChangeNotification(e) {
|
|
82
|
+
switch (e.kind) {
|
|
83
|
+
case 0 :
|
|
84
|
+
return this.addToast(e.item);
|
|
85
|
+
case 3 :
|
|
86
|
+
return this.removeToast(e.item);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
addToast(item) {
|
|
90
|
+
if (this.isNotificationsCenterVisible) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (item.priority === NotificationPriority.SILENT) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (this.addedToastsIntervalCounter.increment() > NotificationsToasts_1.SPAM_PROTECTION.limit) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const itemDisposables = ( new DisposableStore());
|
|
100
|
+
this.mapNotificationToDisposable.set(item, itemDisposables);
|
|
101
|
+
itemDisposables.add(scheduleAtNextAnimationFrame(getWindow(this.container), () => this.doAddToast(item, itemDisposables)));
|
|
102
|
+
}
|
|
103
|
+
doAddToast(item, itemDisposables) {
|
|
104
|
+
let notificationsToastsContainer = this.notificationsToastsContainer;
|
|
105
|
+
if (!notificationsToastsContainer) {
|
|
106
|
+
notificationsToastsContainer = this.notificationsToastsContainer = document.createElement('div');
|
|
107
|
+
notificationsToastsContainer.classList.add('notifications-toasts');
|
|
108
|
+
this.container.appendChild(notificationsToastsContainer);
|
|
109
|
+
}
|
|
110
|
+
notificationsToastsContainer.classList.add('visible');
|
|
111
|
+
const notificationToastContainer = document.createElement('div');
|
|
112
|
+
notificationToastContainer.classList.add('notification-toast-container');
|
|
113
|
+
const firstToast = notificationsToastsContainer.firstChild;
|
|
114
|
+
if (firstToast) {
|
|
115
|
+
notificationsToastsContainer.insertBefore(notificationToastContainer, firstToast);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
notificationsToastsContainer.appendChild(notificationToastContainer);
|
|
119
|
+
}
|
|
120
|
+
const notificationToast = document.createElement('div');
|
|
121
|
+
notificationToast.classList.add('notification-toast');
|
|
122
|
+
notificationToastContainer.appendChild(notificationToast);
|
|
123
|
+
const notificationList = this.instantiationService.createInstance(NotificationsList, notificationToast, {
|
|
124
|
+
verticalScrollMode: 2 ,
|
|
125
|
+
widgetAriaLabel: (() => {
|
|
126
|
+
if (!item.source) {
|
|
127
|
+
return ( localizeWithPath(
|
|
128
|
+
'vs/workbench/browser/parts/notifications/notificationsToasts',
|
|
129
|
+
'notificationAriaLabel',
|
|
130
|
+
"{0}, notification",
|
|
131
|
+
item.message.raw
|
|
132
|
+
));
|
|
133
|
+
}
|
|
134
|
+
return ( localizeWithPath(
|
|
135
|
+
'vs/workbench/browser/parts/notifications/notificationsToasts',
|
|
136
|
+
'notificationWithSourceAriaLabel',
|
|
137
|
+
"{0}, source: {1}, notification",
|
|
138
|
+
item.message.raw,
|
|
139
|
+
item.source
|
|
140
|
+
));
|
|
141
|
+
})()
|
|
142
|
+
});
|
|
143
|
+
itemDisposables.add(notificationList);
|
|
144
|
+
const toast = { item, list: notificationList, container: notificationToastContainer, toast: notificationToast };
|
|
145
|
+
this.mapNotificationToToast.set(item, toast);
|
|
146
|
+
itemDisposables.add(toDisposable(() => this.updateToastVisibility(toast, false)));
|
|
147
|
+
notificationList.show();
|
|
148
|
+
const maxDimensions = this.computeMaxDimensions();
|
|
149
|
+
this.layoutLists(maxDimensions.width);
|
|
150
|
+
notificationList.updateNotificationsList(0, 0, [item]);
|
|
151
|
+
this.layoutContainer(maxDimensions.height);
|
|
152
|
+
itemDisposables.add(item.onDidChangeExpansion(() => {
|
|
153
|
+
notificationList.updateNotificationsList(0, 1, [item]);
|
|
154
|
+
}));
|
|
155
|
+
itemDisposables.add(item.onDidChangeContent(e => {
|
|
156
|
+
switch (e.kind) {
|
|
157
|
+
case 2 :
|
|
158
|
+
notificationList.updateNotificationsList(0, 1, [item]);
|
|
159
|
+
break;
|
|
160
|
+
case 1 :
|
|
161
|
+
if (item.expanded) {
|
|
162
|
+
notificationList.updateNotificationHeight(item);
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
Event.once(item.onDidClose)(() => {
|
|
168
|
+
this.removeToast(item);
|
|
169
|
+
});
|
|
170
|
+
this.purgeNotification(item, notificationToastContainer, notificationList, itemDisposables);
|
|
171
|
+
this.updateStyles();
|
|
172
|
+
this.notificationsToastsVisibleContextKey.set(true);
|
|
173
|
+
notificationToast.classList.add('notification-fade-in');
|
|
174
|
+
itemDisposables.add(addDisposableListener(notificationToast, 'transitionend', () => {
|
|
175
|
+
notificationToast.classList.remove('notification-fade-in');
|
|
176
|
+
notificationToast.classList.add('notification-fade-in-done');
|
|
177
|
+
}));
|
|
178
|
+
item.updateVisibility(true);
|
|
179
|
+
if (!this._isVisible) {
|
|
180
|
+
this._isVisible = true;
|
|
181
|
+
this._onDidChangeVisibility.fire();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
purgeNotification(item, notificationToastContainer, notificationList, disposables) {
|
|
185
|
+
let isMouseOverToast = false;
|
|
186
|
+
disposables.add(addDisposableListener(notificationToastContainer, EventType.MOUSE_OVER, () => isMouseOverToast = true));
|
|
187
|
+
disposables.add(addDisposableListener(notificationToastContainer, EventType.MOUSE_OUT, () => isMouseOverToast = false));
|
|
188
|
+
let purgeTimeoutHandle;
|
|
189
|
+
let listener;
|
|
190
|
+
const hideAfterTimeout = () => {
|
|
191
|
+
purgeTimeoutHandle = setTimeout(() => {
|
|
192
|
+
if (!this.hostService.hasFocus) {
|
|
193
|
+
if (!listener) {
|
|
194
|
+
listener = this.hostService.onDidChangeFocus(focus => {
|
|
195
|
+
if (focus) {
|
|
196
|
+
hideAfterTimeout();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
disposables.add(listener);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else if (item.sticky ||
|
|
203
|
+
notificationList.hasFocus() ||
|
|
204
|
+
isMouseOverToast
|
|
205
|
+
) {
|
|
206
|
+
hideAfterTimeout();
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
this.removeToast(item);
|
|
210
|
+
}
|
|
211
|
+
}, NotificationsToasts_1.PURGE_TIMEOUT[item.severity]);
|
|
212
|
+
};
|
|
213
|
+
hideAfterTimeout();
|
|
214
|
+
disposables.add(toDisposable(() => clearTimeout(purgeTimeoutHandle)));
|
|
215
|
+
}
|
|
216
|
+
removeToast(item) {
|
|
217
|
+
let focusEditor = false;
|
|
218
|
+
const notificationToast = this.mapNotificationToToast.get(item);
|
|
219
|
+
if (notificationToast) {
|
|
220
|
+
const toastHasDOMFocus = isAncestorOfActiveElement(notificationToast.container);
|
|
221
|
+
if (toastHasDOMFocus) {
|
|
222
|
+
focusEditor = !(this.focusNext() || this.focusPrevious());
|
|
223
|
+
}
|
|
224
|
+
this.mapNotificationToToast.delete(item);
|
|
225
|
+
}
|
|
226
|
+
const notificationDisposables = this.mapNotificationToDisposable.get(item);
|
|
227
|
+
if (notificationDisposables) {
|
|
228
|
+
dispose(notificationDisposables);
|
|
229
|
+
this.mapNotificationToDisposable.delete(item);
|
|
230
|
+
}
|
|
231
|
+
if (this.mapNotificationToToast.size > 0) {
|
|
232
|
+
this.layout(this.workbenchDimensions);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
this.doHide();
|
|
236
|
+
if (focusEditor) {
|
|
237
|
+
this.editorGroupService.activeGroup.focus();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
removeToasts() {
|
|
242
|
+
this.mapNotificationToToast.clear();
|
|
243
|
+
this.mapNotificationToDisposable.forEach(disposable => dispose(disposable));
|
|
244
|
+
this.mapNotificationToDisposable.clear();
|
|
245
|
+
this.doHide();
|
|
246
|
+
}
|
|
247
|
+
doHide() {
|
|
248
|
+
this.notificationsToastsContainer?.classList.remove('visible');
|
|
249
|
+
this.notificationsToastsVisibleContextKey.set(false);
|
|
250
|
+
if (this._isVisible) {
|
|
251
|
+
this._isVisible = false;
|
|
252
|
+
this._onDidChangeVisibility.fire();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
hide() {
|
|
256
|
+
const focusEditor = this.notificationsToastsContainer ? isAncestorOfActiveElement(this.notificationsToastsContainer) : false;
|
|
257
|
+
this.removeToasts();
|
|
258
|
+
if (focusEditor) {
|
|
259
|
+
this.editorGroupService.activeGroup.focus();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
focus() {
|
|
263
|
+
const toasts = this.getToasts(ToastVisibility.VISIBLE);
|
|
264
|
+
if (toasts.length > 0) {
|
|
265
|
+
toasts[0].list.focusFirst();
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
focusNext() {
|
|
271
|
+
const toasts = this.getToasts(ToastVisibility.VISIBLE);
|
|
272
|
+
for (let i = 0; i < toasts.length; i++) {
|
|
273
|
+
const toast = toasts[i];
|
|
274
|
+
if (toast.list.hasFocus()) {
|
|
275
|
+
const nextToast = toasts[i + 1];
|
|
276
|
+
if (nextToast) {
|
|
277
|
+
nextToast.list.focusFirst();
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
focusPrevious() {
|
|
286
|
+
const toasts = this.getToasts(ToastVisibility.VISIBLE);
|
|
287
|
+
for (let i = 0; i < toasts.length; i++) {
|
|
288
|
+
const toast = toasts[i];
|
|
289
|
+
if (toast.list.hasFocus()) {
|
|
290
|
+
const previousToast = toasts[i - 1];
|
|
291
|
+
if (previousToast) {
|
|
292
|
+
previousToast.list.focusFirst();
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
focusFirst() {
|
|
301
|
+
const toast = this.getToasts(ToastVisibility.VISIBLE)[0];
|
|
302
|
+
if (toast) {
|
|
303
|
+
toast.list.focusFirst();
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
focusLast() {
|
|
309
|
+
const toasts = this.getToasts(ToastVisibility.VISIBLE);
|
|
310
|
+
if (toasts.length > 0) {
|
|
311
|
+
toasts[toasts.length - 1].list.focusFirst();
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
update(isCenterVisible) {
|
|
317
|
+
if (this.isNotificationsCenterVisible !== isCenterVisible) {
|
|
318
|
+
this.isNotificationsCenterVisible = isCenterVisible;
|
|
319
|
+
if (this.isNotificationsCenterVisible) {
|
|
320
|
+
this.removeToasts();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
updateStyles() {
|
|
325
|
+
this.mapNotificationToToast.forEach(({ toast }) => {
|
|
326
|
+
const backgroundColor = this.getColor(NOTIFICATIONS_BACKGROUND);
|
|
327
|
+
toast.style.background = backgroundColor ? backgroundColor : '';
|
|
328
|
+
const widgetShadowColor = this.getColor(widgetShadow);
|
|
329
|
+
toast.style.boxShadow = widgetShadowColor ? `0 0 8px 2px ${widgetShadowColor}` : '';
|
|
330
|
+
const borderColor = this.getColor(NOTIFICATIONS_TOAST_BORDER);
|
|
331
|
+
toast.style.border = borderColor ? `1px solid ${borderColor}` : '';
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
getToasts(state) {
|
|
335
|
+
const notificationToasts = [];
|
|
336
|
+
this.mapNotificationToToast.forEach(toast => {
|
|
337
|
+
switch (state) {
|
|
338
|
+
case ToastVisibility.HIDDEN_OR_VISIBLE:
|
|
339
|
+
notificationToasts.push(toast);
|
|
340
|
+
break;
|
|
341
|
+
case ToastVisibility.HIDDEN:
|
|
342
|
+
if (!this.isToastInDOM(toast)) {
|
|
343
|
+
notificationToasts.push(toast);
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
346
|
+
case ToastVisibility.VISIBLE:
|
|
347
|
+
if (this.isToastInDOM(toast)) {
|
|
348
|
+
notificationToasts.push(toast);
|
|
349
|
+
}
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
return notificationToasts.reverse();
|
|
354
|
+
}
|
|
355
|
+
layout(dimension) {
|
|
356
|
+
this.workbenchDimensions = dimension;
|
|
357
|
+
const maxDimensions = this.computeMaxDimensions();
|
|
358
|
+
if (maxDimensions.height) {
|
|
359
|
+
this.layoutContainer(maxDimensions.height);
|
|
360
|
+
}
|
|
361
|
+
this.layoutLists(maxDimensions.width);
|
|
362
|
+
}
|
|
363
|
+
computeMaxDimensions() {
|
|
364
|
+
const maxWidth = NotificationsToasts_1.MAX_WIDTH;
|
|
365
|
+
let availableWidth = maxWidth;
|
|
366
|
+
let availableHeight;
|
|
367
|
+
if (this.workbenchDimensions) {
|
|
368
|
+
availableWidth = this.workbenchDimensions.width;
|
|
369
|
+
availableWidth -= (2 * 8);
|
|
370
|
+
availableHeight = this.workbenchDimensions.height;
|
|
371
|
+
if (this.layoutService.isVisible("workbench.parts.statusbar" , mainWindow)) {
|
|
372
|
+
availableHeight -= 22;
|
|
373
|
+
}
|
|
374
|
+
if (this.layoutService.isVisible("workbench.parts.titlebar" , mainWindow)) {
|
|
375
|
+
availableHeight -= 22;
|
|
376
|
+
}
|
|
377
|
+
availableHeight -= (2 * 12);
|
|
378
|
+
}
|
|
379
|
+
availableHeight = typeof availableHeight === 'number'
|
|
380
|
+
? Math.round(availableHeight * 0.618)
|
|
381
|
+
: 0;
|
|
382
|
+
return ( new Dimension(Math.min(maxWidth, availableWidth), availableHeight));
|
|
383
|
+
}
|
|
384
|
+
layoutLists(width) {
|
|
385
|
+
this.mapNotificationToToast.forEach(({ list }) => list.layout(width));
|
|
386
|
+
}
|
|
387
|
+
layoutContainer(heightToGive) {
|
|
388
|
+
let visibleToasts = 0;
|
|
389
|
+
for (const toast of this.getToasts(ToastVisibility.HIDDEN_OR_VISIBLE)) {
|
|
390
|
+
toast.container.style.opacity = '0';
|
|
391
|
+
this.updateToastVisibility(toast, true);
|
|
392
|
+
heightToGive -= toast.container.offsetHeight;
|
|
393
|
+
let makeVisible = false;
|
|
394
|
+
if (visibleToasts === NotificationsToasts_1.MAX_NOTIFICATIONS) {
|
|
395
|
+
makeVisible = false;
|
|
396
|
+
}
|
|
397
|
+
else if (heightToGive >= 0) {
|
|
398
|
+
makeVisible = true;
|
|
399
|
+
}
|
|
400
|
+
this.updateToastVisibility(toast, makeVisible);
|
|
401
|
+
toast.container.style.opacity = '';
|
|
402
|
+
if (makeVisible) {
|
|
403
|
+
visibleToasts++;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
updateToastVisibility(toast, visible) {
|
|
408
|
+
if (this.isToastInDOM(toast) === visible) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const notificationsToastsContainer = assertIsDefined(this.notificationsToastsContainer);
|
|
412
|
+
if (visible) {
|
|
413
|
+
notificationsToastsContainer.appendChild(toast.container);
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
notificationsToastsContainer.removeChild(toast.container);
|
|
417
|
+
}
|
|
418
|
+
toast.item.updateVisibility(visible);
|
|
419
|
+
}
|
|
420
|
+
isToastInDOM(toast) {
|
|
421
|
+
return !!toast.container.parentElement;
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
NotificationsToasts = NotificationsToasts_1 = ( __decorate([
|
|
425
|
+
( __param(2, IInstantiationService)),
|
|
426
|
+
( __param(3, IWorkbenchLayoutService)),
|
|
427
|
+
( __param(4, IThemeService)),
|
|
428
|
+
( __param(5, IEditorGroupsService)),
|
|
429
|
+
( __param(6, IContextKeyService)),
|
|
430
|
+
( __param(7, ILifecycleService)),
|
|
431
|
+
( __param(8, IHostService))
|
|
432
|
+
], NotificationsToasts));
|
|
433
|
+
export { NotificationsToasts };
|