@codingame/monaco-vscode-notifications-service-override 1.82.4 → 1.82.5-next.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.
@@ -0,0 +1,3 @@
1
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
2
+
3
+ export { n as default };
@@ -0,0 +1,11 @@
1
+ function __decorate(decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ }
7
+ function __param(paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ }
10
+
11
+ export { __decorate, __param };
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { default } from 'vscode/service-override/notifications'
1
+ export { default } from './notifications.js';
package/index.js CHANGED
@@ -1 +1 @@
1
- export { default } from 'vscode/service-override/notifications'
1
+ export { default } from './notifications.js';
@@ -0,0 +1,5 @@
1
+ import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
2
+
3
+ declare function getServiceOverride(container?: HTMLElement): IEditorOverrideServices;
4
+
5
+ export { getServiceOverride as default };
@@ -0,0 +1,35 @@
1
+ import { NotificationsToasts } from './vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js';
2
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
3
+ import { NotificationService } from './vscode/src/vs/workbench/services/notification/common/notificationService.js';
4
+ import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
5
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
6
+ import { registerNotificationCommands } from 'vscode/vscode/vs/workbench/browser/parts/notifications/notificationsCommands';
7
+ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
8
+ import { NotificationsCenter } from './vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js';
9
+ import { NotificationsAlerts } from './vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js';
10
+ import { NotificationsTelemetry } from 'vscode/vscode/vs/workbench/browser/parts/notifications/notificationsTelemetry';
11
+ import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js';
12
+ import getServiceOverride$1 from 'vscode/service-override/layout';
13
+ import { onRenderWorkbench } from 'vscode/lifecycle';
14
+
15
+ onRenderWorkbench(async (accessor) => {
16
+ const container = accessor.get(ILayoutService).container;
17
+ const model = accessor.get(INotificationService).model;
18
+ const instantiationService = accessor.get(IInstantiationService);
19
+ setTimeout(() => {
20
+ const notificationsCenter = instantiationService.createInstance(NotificationsCenter, container, model);
21
+ const notificationsToasts = instantiationService.createInstance(NotificationsToasts, container, model);
22
+ instantiationService.createInstance(NotificationsAlerts, model);
23
+ instantiationService.createInstance(NotificationsTelemetry);
24
+ registerNotificationCommands(notificationsCenter, notificationsToasts, model);
25
+ notificationsToasts.layout(dom.getClientArea(container));
26
+ });
27
+ });
28
+ function getServiceOverride(container) {
29
+ return {
30
+ [( INotificationService.toString())]: new SyncDescriptor(NotificationService, undefined, true),
31
+ ...getServiceOverride$1(container)
32
+ };
33
+ }
34
+
35
+ export { getServiceOverride as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-notifications-service-override",
3
- "version": "1.82.4",
3
+ "version": "1.82.5-next.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,7 +18,7 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@1.82.4",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.82.5-next.0",
22
22
  "monaco-editor": "0.43.0"
23
23
  }
24
24
  }
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-toolbar-container .action-item,.monaco-workbench>.notifications-center>.notifications-center-header>.notifications-center-header-toolbar .action-item{margin-right:4px}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-toolbar-container .action-item:first-child,.monaco-workbench>.notifications-center>.notifications-center-header>.notifications-center-header-toolbar .action-item:first-child{margin-left:4px}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".monaco-workbench>.notifications-center{border-radius:4px;bottom:31px;display:none;overflow:hidden;position:absolute;right:8px;z-index:1000}.monaco-workbench.nostatusbar>.notifications-center{bottom:8px}.monaco-workbench>.notifications-center.visible{display:block}.monaco-workbench>.notifications-center>.notifications-center-header{align-items:center;display:flex;height:35px;padding-left:8px;padding-right:5px}.monaco-workbench>.notifications-center>.notifications-center-header>.notifications-center-header-title{font-size:11px;text-transform:uppercase}.monaco-workbench>.notifications-center>.notifications-center-header>.notifications-center-header-toolbar{flex:1}.monaco-workbench>.notifications-center>.notifications-center-header>.notifications-center-header-toolbar .actions-container{justify-content:flex-end}.monaco-workbench>.notifications-center .notifications-list-container .monaco-list-row[data-last-element=false]>.notification-list-item{border-bottom:1px solid var(--vscode-notifications-border)}.monaco-workbench>.notifications-center .notifications-list-container,.monaco-workbench>.notifications-center .notifications-list-container .monaco-scrollable-element,.monaco-workbench>.notifications-center .notifications-list-container .notification-list-item{border-radius:0}.monaco-workbench>.notifications-center .codicon.codicon-error{color:var(--vscode-notificationsErrorIcon-foreground)!important}.monaco-workbench>.notifications-center .codicon.codicon-warning{color:var(--vscode-notificationsWarningIcon-foreground)!important}.monaco-workbench>.notifications-center .codicon.codicon-info{color:var(--vscode-notificationsInfoIcon-foreground)!important}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".monaco-workbench .notifications-list-container{background:var(--vscode-notifications-background);border-radius:inherit;color:var(--vscode-notifications-foreground);outline-color:var(--vscode-contrastBorder)}.monaco-workbench .notifications-list-container .notification-list-item{border-radius:4px;box-sizing:border-box;display:flex;flex-direction:column;flex-direction:column-reverse;height:100%;padding:10px 5px}.monaco-workbench .notifications-list-container .notification-offset-helper{word-wrap:break-word;line-height:22px;opacity:0;position:absolute}.monaco-workbench .notifications-list-container .monaco-scrollable-element{border-radius:4px}.monaco-workbench .notifications-list-container .notification-list-item>.notification-list-item-main-row{display:flex;flex-grow:1}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-icon{align-items:center;background-position:50%;background-repeat:no-repeat;display:flex;flex:0 0 16px;font-size:18px;height:22px;margin-left:4px;margin-right:4px}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-message{flex:1;line-height:22px;overflow:hidden;text-overflow:ellipsis;user-select:text;-webkit-user-select:text}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-message a{color:var(--vscode-notificationLink-foreground)}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-message a:focus{outline-color:var(--vscode-focusBorder);outline-style:solid;outline-width:1px}.monaco-workbench .notifications-list-container .notification-list-item.expanded .notification-list-item-message{word-wrap:break-word;white-space:normal}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-toolbar-container{display:none;height:22px}.monaco-workbench .notifications-list-container .monaco-list-row.focused .notification-list-item .notification-list-item-toolbar-container,.monaco-workbench .notifications-list-container .monaco-list:focus-within .notification-list-item .notification-list-item-toolbar-container,.monaco-workbench .notifications-list-container .notification-list-item.expanded .notification-list-item-toolbar-container,.monaco-workbench .notifications-list-container .notification-list-item:hover .notification-list-item-toolbar-container{display:block}.monaco-workbench .notifications-list-container .notification-list-item>.notification-list-item-details-row{align-items:center;display:none;overflow:hidden;padding-left:5px}.monaco-workbench .notifications-list-container .notification-list-item.expanded>.notification-list-item-details-row{display:flex}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-source{flex:1;font-size:12px;overflow:hidden;text-overflow:ellipsis}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-buttons-container{display:flex;overflow:hidden}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-buttons-container>.monaco-button,.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-buttons-container>.monaco-button-dropdown{margin:4px 5px}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-buttons-container .monaco-button{outline-offset:2px!important}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-buttons-container .monaco-text-button{display:inline-block;font-size:12px;overflow:hidden;padding:4px 10px;text-overflow:ellipsis;width:fit-content}.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-buttons-container .monaco-dropdown-button{padding:5px}.monaco-workbench .notifications-list-container .progress-bit{bottom:0;height:2px}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".monaco-workbench>.notifications-toasts{bottom:26px;display:none;overflow:hidden;position:absolute;right:3px;z-index:1000}.monaco-workbench.nostatusbar>.notifications-toasts{bottom:3px}.monaco-workbench>.notifications-toasts.visible{display:flex;flex-direction:column}.monaco-workbench>.notifications-toasts .notification-toast-container{overflow:hidden}.monaco-workbench>.notifications-toasts .notification-toast-container>.notification-toast{border-radius:4px;margin:8px;opacity:0;transform:translate3d(0,100%,0);transition:transform .3s ease-out,opacity .3s ease-out}.monaco-workbench.reduce-motion>.notifications-toasts .notification-toast-container>.notification-toast{transition:transform 0ms ease-out,opacity 0ms ease-out}.monaco-workbench>.notifications-toasts .notification-toast-container>.notification-toast.notification-fade-in{opacity:1;transform:none}.monaco-workbench>.notifications-toasts .notification-toast-container>.notification-toast.notification-fade-in-done{opacity:1;transform:none;transition:none}.monaco-workbench>.notifications-toasts .codicon.codicon-error{color:var(--vscode-notificationsErrorIcon-foreground)!important}.monaco-workbench>.notifications-toasts .codicon.codicon-warning{color:var(--vscode-notificationsWarningIcon-foreground)!important}.monaco-workbench>.notifications-toasts .codicon.codicon-info{color:var(--vscode-notificationsInfoIcon-foreground)!important}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,126 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import './media/notificationsActions.css.js';
3
+ import { localize } from 'monaco-editor/esm/vs/nls.js';
4
+ import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
5
+ import { CLEAR_NOTIFICATION, CLEAR_ALL_NOTIFICATIONS, TOGGLE_DO_NOT_DISTURB_MODE, HIDE_NOTIFICATIONS_CENTER, EXPAND_NOTIFICATION, COLLAPSE_NOTIFICATION } from 'vscode/vscode/vs/workbench/browser/parts/notifications/notificationsCommands';
6
+ import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
7
+ import { IClipboardService } from 'monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js';
8
+ import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
9
+ import { registerIcon } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
10
+ import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
11
+
12
+ const clearIcon = registerIcon('notifications-clear', Codicon.close, ( localize('clearIcon', 'Icon for the clear action in notifications.')));
13
+ const clearAllIcon = registerIcon('notifications-clear-all', Codicon.clearAll, ( localize('clearAllIcon', 'Icon for the clear all action in notifications.')));
14
+ const hideIcon = registerIcon('notifications-hide', Codicon.chevronDown, ( localize('hideIcon', 'Icon for the hide action in notifications.')));
15
+ const expandIcon = registerIcon('notifications-expand', Codicon.chevronUp, ( localize('expandIcon', 'Icon for the expand action in notifications.')));
16
+ const collapseIcon = registerIcon('notifications-collapse', Codicon.chevronDown, ( localize('collapseIcon', 'Icon for the collapse action in notifications.')));
17
+ const configureIcon = registerIcon('notifications-configure', Codicon.gear, ( localize('configureIcon', 'Icon for the configure action in notifications.')));
18
+ const doNotDisturbIcon = registerIcon('notifications-do-not-disturb', Codicon.bellSlash, ( localize('doNotDisturbIcon', 'Icon for the mute all action in notifications.')));
19
+ let ClearNotificationAction = class ClearNotificationAction extends Action {
20
+ static { this.ID = CLEAR_NOTIFICATION; }
21
+ static { this.LABEL = ( localize('clearNotification', "Clear Notification")); }
22
+ constructor(id, label, commandService) {
23
+ super(id, label, ThemeIcon.asClassName(clearIcon));
24
+ this.commandService = commandService;
25
+ }
26
+ async run(notification) {
27
+ this.commandService.executeCommand(CLEAR_NOTIFICATION, notification);
28
+ }
29
+ };
30
+ ClearNotificationAction = ( __decorate([
31
+ ( __param(2, ICommandService))
32
+ ], ClearNotificationAction));
33
+ let ClearAllNotificationsAction = class ClearAllNotificationsAction extends Action {
34
+ static { this.ID = CLEAR_ALL_NOTIFICATIONS; }
35
+ static { this.LABEL = ( localize('clearNotifications', "Clear All Notifications")); }
36
+ constructor(id, label, commandService) {
37
+ super(id, label, ThemeIcon.asClassName(clearAllIcon));
38
+ this.commandService = commandService;
39
+ }
40
+ async run() {
41
+ this.commandService.executeCommand(CLEAR_ALL_NOTIFICATIONS);
42
+ }
43
+ };
44
+ ClearAllNotificationsAction = ( __decorate([
45
+ ( __param(2, ICommandService))
46
+ ], ClearAllNotificationsAction));
47
+ let ToggleDoNotDisturbAction = class ToggleDoNotDisturbAction extends Action {
48
+ static { this.ID = TOGGLE_DO_NOT_DISTURB_MODE; }
49
+ static { this.LABEL = ( localize('toggleDoNotDisturbMode', "Toggle Do Not Disturb Mode")); }
50
+ constructor(id, label, commandService) {
51
+ super(id, label, ThemeIcon.asClassName(doNotDisturbIcon));
52
+ this.commandService = commandService;
53
+ }
54
+ async run() {
55
+ this.commandService.executeCommand(TOGGLE_DO_NOT_DISTURB_MODE);
56
+ }
57
+ };
58
+ ToggleDoNotDisturbAction = ( __decorate([
59
+ ( __param(2, ICommandService))
60
+ ], ToggleDoNotDisturbAction));
61
+ let HideNotificationsCenterAction = class HideNotificationsCenterAction extends Action {
62
+ static { this.ID = HIDE_NOTIFICATIONS_CENTER; }
63
+ static { this.LABEL = ( localize('hideNotificationsCenter', "Hide Notifications")); }
64
+ constructor(id, label, commandService) {
65
+ super(id, label, ThemeIcon.asClassName(hideIcon));
66
+ this.commandService = commandService;
67
+ }
68
+ async run() {
69
+ this.commandService.executeCommand(HIDE_NOTIFICATIONS_CENTER);
70
+ }
71
+ };
72
+ HideNotificationsCenterAction = ( __decorate([
73
+ ( __param(2, ICommandService))
74
+ ], HideNotificationsCenterAction));
75
+ let ExpandNotificationAction = class ExpandNotificationAction extends Action {
76
+ static { this.ID = EXPAND_NOTIFICATION; }
77
+ static { this.LABEL = ( localize('expandNotification', "Expand Notification")); }
78
+ constructor(id, label, commandService) {
79
+ super(id, label, ThemeIcon.asClassName(expandIcon));
80
+ this.commandService = commandService;
81
+ }
82
+ async run(notification) {
83
+ this.commandService.executeCommand(EXPAND_NOTIFICATION, notification);
84
+ }
85
+ };
86
+ ExpandNotificationAction = ( __decorate([
87
+ ( __param(2, ICommandService))
88
+ ], ExpandNotificationAction));
89
+ let CollapseNotificationAction = class CollapseNotificationAction extends Action {
90
+ static { this.ID = COLLAPSE_NOTIFICATION; }
91
+ static { this.LABEL = ( localize('collapseNotification', "Collapse Notification")); }
92
+ constructor(id, label, commandService) {
93
+ super(id, label, ThemeIcon.asClassName(collapseIcon));
94
+ this.commandService = commandService;
95
+ }
96
+ async run(notification) {
97
+ this.commandService.executeCommand(COLLAPSE_NOTIFICATION, notification);
98
+ }
99
+ };
100
+ CollapseNotificationAction = ( __decorate([
101
+ ( __param(2, ICommandService))
102
+ ], CollapseNotificationAction));
103
+ class ConfigureNotificationAction extends Action {
104
+ static { this.ID = 'workbench.action.configureNotification'; }
105
+ static { this.LABEL = ( localize('configureNotification', "More Actions...")); }
106
+ constructor(id, label, configurationActions) {
107
+ super(id, label, ThemeIcon.asClassName(configureIcon));
108
+ this.configurationActions = configurationActions;
109
+ }
110
+ }
111
+ let CopyNotificationMessageAction = class CopyNotificationMessageAction extends Action {
112
+ static { this.ID = 'workbench.action.copyNotificationMessage'; }
113
+ static { this.LABEL = ( localize('copyNotification', "Copy Text")); }
114
+ constructor(id, label, clipboardService) {
115
+ super(id, label);
116
+ this.clipboardService = clipboardService;
117
+ }
118
+ run(notification) {
119
+ return this.clipboardService.writeText(notification.message.raw);
120
+ }
121
+ };
122
+ CopyNotificationMessageAction = ( __decorate([
123
+ ( __param(2, IClipboardService))
124
+ ], CopyNotificationMessageAction));
125
+
126
+ export { ClearAllNotificationsAction, ClearNotificationAction, CollapseNotificationAction, ConfigureNotificationAction, CopyNotificationMessageAction, ExpandNotificationAction, HideNotificationsCenterAction, ToggleDoNotDisturbAction };
@@ -0,0 +1,60 @@
1
+ import { alert } from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
2
+ import { localize } from 'monaco-editor/esm/vs/nls.js';
3
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
+ import { toErrorMessage } from 'monaco-editor/esm/vs/base/common/errorMessage.js';
5
+ import { Severity, NotificationPriority } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
6
+ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
7
+
8
+ class NotificationsAlerts extends Disposable {
9
+ constructor(model) {
10
+ super();
11
+ this.model = model;
12
+ for (const notification of model.notifications) {
13
+ this.triggerAriaAlert(notification);
14
+ }
15
+ this.registerListeners();
16
+ }
17
+ registerListeners() {
18
+ this._register(this.model.onDidChangeNotification(e => this.onDidChangeNotification(e)));
19
+ }
20
+ onDidChangeNotification(e) {
21
+ if (e.kind === 0 ) {
22
+ this.triggerAriaAlert(e.item);
23
+ if (e.item.severity === Severity.Error) {
24
+ if (e.item.message.original instanceof Error) {
25
+ console.error(e.item.message.original);
26
+ }
27
+ else {
28
+ console.error(toErrorMessage(( e.item.message.linkedText.toString()), true));
29
+ }
30
+ }
31
+ }
32
+ }
33
+ triggerAriaAlert(notification) {
34
+ if (notification.priority === NotificationPriority.SILENT) {
35
+ return;
36
+ }
37
+ const listener = notification.onDidChangeContent(e => {
38
+ if (e.kind === 1 ) {
39
+ this.doTriggerAriaAlert(notification);
40
+ }
41
+ });
42
+ Event.once(notification.onDidClose)(() => listener.dispose());
43
+ this.doTriggerAriaAlert(notification);
44
+ }
45
+ doTriggerAriaAlert(notification) {
46
+ let alertText;
47
+ if (notification.severity === Severity.Error) {
48
+ alertText = ( localize('alertErrorMessage', "Error: {0}", ( notification.message.linkedText.toString())));
49
+ }
50
+ else if (notification.severity === Severity.Warning) {
51
+ alertText = ( localize('alertWarningMessage', "Warning: {0}", ( notification.message.linkedText.toString())));
52
+ }
53
+ else {
54
+ alertText = ( localize('alertInfoMessage', "Info: {0}", ( notification.message.linkedText.toString())));
55
+ }
56
+ alert(alertText);
57
+ }
58
+ }
59
+
60
+ export { NotificationsAlerts };
@@ -0,0 +1,229 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import './media/notificationsCenter.css.js';
3
+ import './media/notificationsActions.css.js';
4
+ import { NOTIFICATIONS_CENTER_BORDER, NOTIFICATIONS_CENTER_HEADER_FOREGROUND, NOTIFICATIONS_CENTER_HEADER_BACKGROUND } from 'vscode/vscode/vs/workbench/common/theme';
5
+ import { Themable, IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
6
+ import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
7
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
8
+ import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
9
+ import { NotificationActionRunner } from 'vscode/vscode/vs/workbench/browser/parts/notifications/notificationsCommands';
10
+ import { NotificationsList } from './notificationsList.js';
11
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
12
+ import { Dimension, isAncestor } from 'monaco-editor/esm/vs/base/browser/dom.js';
13
+ import { widgetShadow } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
14
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
15
+ import { localize } from 'monaco-editor/esm/vs/nls.js';
16
+ import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
17
+ import { ClearAllNotificationsAction, ToggleDoNotDisturbAction, HideNotificationsCenterAction } from './notificationsActions.js';
18
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
19
+ import { assertIsDefined, assertAllDefined } from 'monaco-editor/esm/vs/base/common/types.js';
20
+ import { NotificationsCenterVisibleContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
21
+ import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
22
+
23
+ var NotificationsCenter_1;
24
+ let NotificationsCenter = class NotificationsCenter extends Themable {
25
+ static { NotificationsCenter_1 = this; }
26
+ static { this.MAX_DIMENSIONS = ( new Dimension(450, 400)); }
27
+ constructor(container, model, themeService, instantiationService, layoutService, contextKeyService, editorGroupService, keybindingService, notificationService) {
28
+ super(themeService);
29
+ this.container = container;
30
+ this.model = model;
31
+ this.instantiationService = instantiationService;
32
+ this.layoutService = layoutService;
33
+ this.contextKeyService = contextKeyService;
34
+ this.editorGroupService = editorGroupService;
35
+ this.keybindingService = keybindingService;
36
+ this.notificationService = notificationService;
37
+ this._onDidChangeVisibility = this._register(( new Emitter()));
38
+ this.onDidChangeVisibility = this._onDidChangeVisibility.event;
39
+ this.notificationsCenterVisibleContextKey = NotificationsCenterVisibleContext.bindTo(this.contextKeyService);
40
+ this.notificationsCenterVisibleContextKey = NotificationsCenterVisibleContext.bindTo(contextKeyService);
41
+ this.registerListeners();
42
+ }
43
+ registerListeners() {
44
+ this._register(this.model.onDidChangeNotification(e => this.onDidChangeNotification(e)));
45
+ this._register(this.layoutService.onDidLayout(dimension => this.layout(Dimension.lift(dimension))));
46
+ this._register(this.notificationService.onDidChangeDoNotDisturbMode(() => this.onDidChangeDoNotDisturbMode()));
47
+ }
48
+ onDidChangeDoNotDisturbMode() {
49
+ this.hide();
50
+ }
51
+ get isVisible() {
52
+ return !!this._isVisible;
53
+ }
54
+ show() {
55
+ if (this._isVisible) {
56
+ const notificationsList = assertIsDefined(this.notificationsList);
57
+ notificationsList.show();
58
+ notificationsList.focusFirst();
59
+ return;
60
+ }
61
+ if (!this.notificationsCenterContainer) {
62
+ this.create();
63
+ }
64
+ this.updateTitle();
65
+ const [notificationsList, notificationsCenterContainer] = assertAllDefined(this.notificationsList, this.notificationsCenterContainer);
66
+ this._isVisible = true;
67
+ notificationsCenterContainer.classList.add('visible');
68
+ notificationsList.show();
69
+ this.layout(this.workbenchDimensions);
70
+ notificationsList.updateNotificationsList(0, 0, this.model.notifications);
71
+ notificationsList.focusFirst();
72
+ this.updateStyles();
73
+ this.model.notifications.forEach(notification => notification.updateVisibility(true));
74
+ this.notificationsCenterVisibleContextKey.set(true);
75
+ this._onDidChangeVisibility.fire();
76
+ }
77
+ updateTitle() {
78
+ const [notificationsCenterTitle, clearAllAction] = assertAllDefined(this.notificationsCenterTitle, this.clearAllAction);
79
+ if (this.model.notifications.length === 0) {
80
+ notificationsCenterTitle.textContent = ( localize('notificationsEmpty', "No new notifications"));
81
+ clearAllAction.enabled = false;
82
+ }
83
+ else {
84
+ notificationsCenterTitle.textContent = ( localize('notifications', "Notifications"));
85
+ clearAllAction.enabled = ( this.model.notifications.some(notification => !notification.hasProgress));
86
+ }
87
+ }
88
+ create() {
89
+ this.notificationsCenterContainer = document.createElement('div');
90
+ this.notificationsCenterContainer.classList.add('notifications-center');
91
+ this.notificationsCenterHeader = document.createElement('div');
92
+ this.notificationsCenterHeader.classList.add('notifications-center-header');
93
+ this.notificationsCenterContainer.appendChild(this.notificationsCenterHeader);
94
+ this.notificationsCenterTitle = document.createElement('span');
95
+ this.notificationsCenterTitle.classList.add('notifications-center-header-title');
96
+ this.notificationsCenterHeader.appendChild(this.notificationsCenterTitle);
97
+ const toolbarContainer = document.createElement('div');
98
+ toolbarContainer.classList.add('notifications-center-header-toolbar');
99
+ this.notificationsCenterHeader.appendChild(toolbarContainer);
100
+ const actionRunner = this._register(this.instantiationService.createInstance(NotificationActionRunner));
101
+ const notificationsToolBar = this._register(( new ActionBar(toolbarContainer, {
102
+ ariaLabel: ( localize('notificationsToolbar', "Notification Center Actions")),
103
+ actionRunner
104
+ })));
105
+ this.clearAllAction = this._register(this.instantiationService.createInstance(ClearAllNotificationsAction, ClearAllNotificationsAction.ID, ClearAllNotificationsAction.LABEL));
106
+ notificationsToolBar.push(this.clearAllAction, { icon: true, label: false, keybinding: this.getKeybindingLabel(this.clearAllAction) });
107
+ this.toggleDoNotDisturbAction = this._register(this.instantiationService.createInstance(ToggleDoNotDisturbAction, ToggleDoNotDisturbAction.ID, ToggleDoNotDisturbAction.LABEL));
108
+ notificationsToolBar.push(this.toggleDoNotDisturbAction, { icon: true, label: false, keybinding: this.getKeybindingLabel(this.toggleDoNotDisturbAction) });
109
+ const hideAllAction = this._register(this.instantiationService.createInstance(HideNotificationsCenterAction, HideNotificationsCenterAction.ID, HideNotificationsCenterAction.LABEL));
110
+ notificationsToolBar.push(hideAllAction, { icon: true, label: false, keybinding: this.getKeybindingLabel(hideAllAction) });
111
+ this.notificationsList = this.instantiationService.createInstance(NotificationsList, this.notificationsCenterContainer, {
112
+ widgetAriaLabel: ( localize('notificationsCenterWidgetAriaLabel', "Notifications Center"))
113
+ });
114
+ this.container.appendChild(this.notificationsCenterContainer);
115
+ }
116
+ getKeybindingLabel(action) {
117
+ const keybinding = this.keybindingService.lookupKeybinding(action.id);
118
+ return keybinding ? keybinding.getLabel() : null;
119
+ }
120
+ onDidChangeNotification(e) {
121
+ if (!this._isVisible) {
122
+ return;
123
+ }
124
+ let focusEditor = false;
125
+ const [notificationsList, notificationsCenterContainer] = assertAllDefined(this.notificationsList, this.notificationsCenterContainer);
126
+ switch (e.kind) {
127
+ case 0 :
128
+ notificationsList.updateNotificationsList(e.index, 0, [e.item]);
129
+ e.item.updateVisibility(true);
130
+ break;
131
+ case 1 :
132
+ switch (e.detail) {
133
+ case 2 :
134
+ notificationsList.updateNotificationsList(e.index, 1, [e.item]);
135
+ break;
136
+ case 1 :
137
+ if (e.item.expanded) {
138
+ notificationsList.updateNotificationHeight(e.item);
139
+ }
140
+ break;
141
+ }
142
+ break;
143
+ case 2 :
144
+ notificationsList.updateNotificationsList(e.index, 1, [e.item]);
145
+ break;
146
+ case 3 :
147
+ focusEditor = isAncestor(document.activeElement, notificationsCenterContainer);
148
+ notificationsList.updateNotificationsList(e.index, 1);
149
+ e.item.updateVisibility(false);
150
+ break;
151
+ }
152
+ this.updateTitle();
153
+ if (this.model.notifications.length === 0) {
154
+ this.hide();
155
+ if (focusEditor) {
156
+ this.editorGroupService.activeGroup.focus();
157
+ }
158
+ }
159
+ }
160
+ hide() {
161
+ if (!this._isVisible || !this.notificationsCenterContainer || !this.notificationsList) {
162
+ return;
163
+ }
164
+ const focusEditor = isAncestor(document.activeElement, this.notificationsCenterContainer);
165
+ this._isVisible = false;
166
+ this.notificationsCenterContainer.classList.remove('visible');
167
+ this.notificationsList.hide();
168
+ this.model.notifications.forEach(notification => notification.updateVisibility(false));
169
+ this.notificationsCenterVisibleContextKey.set(false);
170
+ this._onDidChangeVisibility.fire();
171
+ if (focusEditor) {
172
+ this.editorGroupService.activeGroup.focus();
173
+ }
174
+ }
175
+ updateStyles() {
176
+ if (this.notificationsCenterContainer && this.notificationsCenterHeader) {
177
+ const widgetShadowColor = this.getColor(widgetShadow);
178
+ this.notificationsCenterContainer.style.boxShadow = widgetShadowColor ? `0 0 8px 2px ${widgetShadowColor}` : '';
179
+ const borderColor = this.getColor(NOTIFICATIONS_CENTER_BORDER);
180
+ this.notificationsCenterContainer.style.border = borderColor ? `1px solid ${borderColor}` : '';
181
+ const headerForeground = this.getColor(NOTIFICATIONS_CENTER_HEADER_FOREGROUND);
182
+ this.notificationsCenterHeader.style.color = headerForeground ?? '';
183
+ const headerBackground = this.getColor(NOTIFICATIONS_CENTER_HEADER_BACKGROUND);
184
+ this.notificationsCenterHeader.style.background = headerBackground ?? '';
185
+ }
186
+ }
187
+ layout(dimension) {
188
+ this.workbenchDimensions = dimension;
189
+ if (this._isVisible && this.notificationsCenterContainer) {
190
+ const maxWidth = NotificationsCenter_1.MAX_DIMENSIONS.width;
191
+ const maxHeight = NotificationsCenter_1.MAX_DIMENSIONS.height;
192
+ let availableWidth = maxWidth;
193
+ let availableHeight = maxHeight;
194
+ if (this.workbenchDimensions) {
195
+ availableWidth = this.workbenchDimensions.width;
196
+ availableWidth -= (2 * 8);
197
+ availableHeight = this.workbenchDimensions.height - 35 ;
198
+ if (this.layoutService.isVisible("workbench.parts.statusbar" )) {
199
+ availableHeight -= 22;
200
+ }
201
+ if (this.layoutService.isVisible("workbench.parts.titlebar" )) {
202
+ availableHeight -= 22;
203
+ }
204
+ availableHeight -= (2 * 12);
205
+ }
206
+ const notificationsList = assertIsDefined(this.notificationsList);
207
+ notificationsList.layout(Math.min(maxWidth, availableWidth), Math.min(maxHeight, availableHeight));
208
+ }
209
+ }
210
+ clearAll() {
211
+ this.hide();
212
+ for (const notification of [...this.model.notifications] ) {
213
+ if (!notification.hasProgress) {
214
+ notification.close();
215
+ }
216
+ }
217
+ }
218
+ };
219
+ NotificationsCenter = NotificationsCenter_1 = ( __decorate([
220
+ ( __param(2, IThemeService)),
221
+ ( __param(3, IInstantiationService)),
222
+ ( __param(4, IWorkbenchLayoutService)),
223
+ ( __param(5, IContextKeyService)),
224
+ ( __param(6, IEditorGroupsService)),
225
+ ( __param(7, IKeybindingService)),
226
+ ( __param(8, INotificationService))
227
+ ], NotificationsCenter));
228
+
229
+ export { NotificationsCenter };