@theia/messages 1.47.1 → 1.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/messages-frontend-module.d.ts +4 -4
  3. package/lib/browser/messages-frontend-module.js +41 -41
  4. package/lib/browser/notification-center-component.d.ts +18 -18
  5. package/lib/browser/notification-center-component.js +67 -67
  6. package/lib/browser/notification-component.d.ts +15 -15
  7. package/lib/browser/notification-component.js +88 -88
  8. package/lib/browser/notification-content-renderer.d.ts +5 -5
  9. package/lib/browser/notification-content-renderer.js +35 -35
  10. package/lib/browser/notification-content-renderer.spec.d.ts +1 -1
  11. package/lib/browser/notification-content-renderer.spec.js +41 -41
  12. package/lib/browser/notification-preferences.d.ts +11 -11
  13. package/lib/browser/notification-preferences.js +46 -46
  14. package/lib/browser/notification-toasts-component.d.ts +18 -18
  15. package/lib/browser/notification-toasts-component.js +48 -48
  16. package/lib/browser/notifications-commands.d.ts +7 -7
  17. package/lib/browser/notifications-commands.js +47 -47
  18. package/lib/browser/notifications-contribution.d.ts +21 -21
  19. package/lib/browser/notifications-contribution.js +203 -203
  20. package/lib/browser/notifications-manager.d.ts +71 -71
  21. package/lib/browser/notifications-manager.js +274 -274
  22. package/lib/browser/notifications-renderer.d.ts +13 -13
  23. package/lib/browser/notifications-renderer.js +67 -67
  24. package/package.json +4 -4
  25. package/src/browser/messages-frontend-module.ts +42 -42
  26. package/src/browser/notification-center-component.tsx +95 -95
  27. package/src/browser/notification-component.tsx +128 -128
  28. package/src/browser/notification-content-renderer.spec.ts +73 -73
  29. package/src/browser/notification-content-renderer.ts +31 -31
  30. package/src/browser/notification-preferences.ts +58 -58
  31. package/src/browser/notification-toasts-component.tsx +67 -67
  32. package/src/browser/notifications-commands.ts +50 -50
  33. package/src/browser/notifications-contribution.ts +218 -218
  34. package/src/browser/notifications-manager.ts +305 -305
  35. package/src/browser/notifications-renderer.tsx +61 -61
  36. package/src/browser/style/index.css +17 -17
  37. package/src/browser/style/notifications.css +283 -283
@@ -1,204 +1,204 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.NotificationsContribution = void 0;
19
- const tslib_1 = require("tslib");
20
- const inversify_1 = require("@theia/core/shared/inversify");
21
- const browser_1 = require("@theia/core/lib/browser");
22
- const notifications_commands_1 = require("./notifications-commands");
23
- const notifications_manager_1 = require("./notifications-manager");
24
- const notifications_renderer_1 = require("./notifications-renderer");
25
- const color_1 = require("@theia/core/lib/common/color");
26
- const nls_1 = require("@theia/core/lib/common/nls");
27
- const theme_1 = require("@theia/core/lib/common/theme");
28
- let NotificationsContribution = class NotificationsContribution {
29
- constructor() {
30
- this.id = 'theia-notification-center';
31
- }
32
- onStart(_app) {
33
- this.createStatusBarItem();
34
- }
35
- createStatusBarItem() {
36
- this.updateStatusBarItem();
37
- this.manager.onUpdated(e => this.updateStatusBarItem(e.notifications.length));
38
- }
39
- updateStatusBarItem(count = 0) {
40
- this.statusBar.setElement(this.id, {
41
- text: this.getStatusBarItemText(count),
42
- alignment: browser_1.StatusBarAlignment.RIGHT,
43
- priority: -900,
44
- command: notifications_commands_1.NotificationsCommands.TOGGLE.id,
45
- tooltip: this.getStatusBarItemTooltip(count),
46
- accessibilityInformation: {
47
- label: this.getStatusBarItemTooltip(count)
48
- }
49
- });
50
- }
51
- getStatusBarItemText(count) {
52
- return `$(${count ? 'codicon-bell-dot' : 'codicon-bell'}) ${count ? ` ${count}` : ''}`;
53
- }
54
- getStatusBarItemTooltip(count) {
55
- if (this.manager.centerVisible) {
56
- return nls_1.nls.localizeByDefault('Hide Notifications');
57
- }
58
- return count === 0
59
- ? nls_1.nls.localizeByDefault('No Notifications')
60
- : count === 1
61
- ? nls_1.nls.localizeByDefault('1 New Notification')
62
- : nls_1.nls.localizeByDefault('{0} New Notifications', count.toString());
63
- }
64
- registerCommands(commands) {
65
- commands.registerCommand(notifications_commands_1.NotificationsCommands.TOGGLE, {
66
- isEnabled: () => true,
67
- execute: () => this.manager.toggleCenter()
68
- });
69
- commands.registerCommand(notifications_commands_1.NotificationsCommands.SHOW, {
70
- isEnabled: () => true,
71
- execute: () => this.manager.showCenter()
72
- });
73
- commands.registerCommand(notifications_commands_1.NotificationsCommands.HIDE, {
74
- execute: () => this.manager.hide()
75
- });
76
- commands.registerCommand(notifications_commands_1.NotificationsCommands.CLEAR_ALL, {
77
- execute: () => this.manager.clearAll()
78
- });
79
- }
80
- registerKeybindings(keybindings) {
81
- keybindings.registerKeybinding({
82
- command: notifications_commands_1.NotificationsCommands.HIDE.id,
83
- when: 'notificationsVisible',
84
- keybinding: 'esc'
85
- });
86
- }
87
- registerColors(colors) {
88
- colors.register({
89
- id: 'notificationCenter.border', defaults: {
90
- hcDark: 'contrastBorder',
91
- hcLight: 'contrastBorder'
92
- }, description: 'Notifications center border color. Notifications slide in from the bottom right of the window.'
93
- }, {
94
- id: 'notificationToast.border', defaults: {
95
- hcDark: 'contrastBorder',
96
- hcLight: 'contrastBorder'
97
- }, description: 'Notification toast border color. Notifications slide in from the bottom right of the window.'
98
- }, {
99
- id: 'notifications.foreground', defaults: {
100
- dark: 'editorWidget.foreground',
101
- light: 'editorWidget.foreground',
102
- hcDark: 'editorWidget.foreground',
103
- hcLight: 'editorWidget.foreground'
104
- }, description: 'Notifications foreground color. Notifications slide in from the bottom right of the window.'
105
- }, {
106
- id: 'notifications.background', defaults: {
107
- dark: 'editorWidget.background',
108
- light: 'editorWidget.background',
109
- hcDark: 'editorWidget.background',
110
- hcLight: 'editorWidget.background'
111
- }, description: 'Notifications background color. Notifications slide in from the bottom right of the window.'
112
- }, {
113
- id: 'notificationLink.foreground', defaults: {
114
- dark: 'textLink.foreground',
115
- light: 'textLink.foreground',
116
- hcDark: 'textLink.foreground',
117
- hcLight: 'textLink.foreground'
118
- }, description: 'Notification links foreground color. Notifications slide in from the bottom right of the window.'
119
- }, {
120
- id: 'notificationCenterHeader.foreground',
121
- description: 'Notifications center header foreground color. Notifications slide in from the bottom right of the window.'
122
- }, {
123
- id: 'notificationCenterHeader.background', defaults: {
124
- dark: color_1.Color.lighten('notifications.background', 0.3),
125
- light: color_1.Color.darken('notifications.background', 0.05),
126
- hcDark: 'notifications.background',
127
- hcLight: 'notifications.background'
128
- }, description: 'Notifications center header background color. Notifications slide in from the bottom right of the window.'
129
- }, {
130
- id: 'notifications.border', defaults: {
131
- dark: 'notificationCenterHeader.background',
132
- light: 'notificationCenterHeader.background',
133
- hcDark: 'notificationCenterHeader.background',
134
- hcLight: 'notificationCenterHeader.background'
135
- // eslint-disable-next-line max-len
136
- }, description: 'Notifications border color separating from other notifications in the notifications center. Notifications slide in from the bottom right of the window.'
137
- }, {
138
- id: 'notificationsErrorIcon.foreground', defaults: {
139
- dark: 'editorError.foreground',
140
- light: 'editorError.foreground',
141
- hcDark: 'editorError.foreground',
142
- hcLight: 'editorError.foreground'
143
- }, description: 'The color used for the icon of error notifications. Notifications slide in from the bottom right of the window.'
144
- }, {
145
- id: 'notificationsWarningIcon.foreground', defaults: {
146
- dark: 'editorWarning.foreground',
147
- light: 'editorWarning.foreground',
148
- hcDark: 'editorWarning.foreground',
149
- hcLight: 'editorWarning.foreground'
150
- }, description: 'The color used for the icon of warning notifications. Notifications slide in from the bottom right of the window.'
151
- }, {
152
- id: 'notificationsInfoIcon.foreground', defaults: {
153
- dark: 'editorInfo.foreground',
154
- light: 'editorInfo.foreground',
155
- hcDark: 'editorInfo.foreground',
156
- hcLight: 'editorInfo.foreground'
157
- }, description: 'The color used for the icon of info notifications. Notifications slide in from the bottom right of the window.'
158
- });
159
- }
160
- registerThemeStyle(theme, collector) {
161
- const notificationsBackground = theme.getColor('notifications.background');
162
- if (notificationsBackground) {
163
- collector.addRule(`
164
- .theia-notification-list-item-container {
165
- background-color: ${notificationsBackground};
166
- }
167
- `);
168
- }
169
- const notificationHover = theme.getColor('list.hoverBackground');
170
- if (notificationHover) {
171
- collector.addRule(`
172
- .theia-notification-list-item:hover:not(:focus) {
173
- background-color: ${notificationHover};
174
- }
175
- `);
176
- }
177
- const focusBorder = theme.getColor('focusBorder');
178
- if (focusBorder && (0, theme_1.isHighContrast)(theme.type)) {
179
- collector.addRule(`
180
- .theia-notification-list-item:hover:not(:focus) {
181
- outline: 1px dashed ${focusBorder};
182
- outline-offset: -2px;
183
- }
184
- `);
185
- }
186
- }
187
- };
188
- (0, tslib_1.__decorate)([
189
- (0, inversify_1.inject)(notifications_manager_1.NotificationManager),
190
- (0, tslib_1.__metadata)("design:type", notifications_manager_1.NotificationManager)
191
- ], NotificationsContribution.prototype, "manager", void 0);
192
- (0, tslib_1.__decorate)([
193
- (0, inversify_1.inject)(notifications_renderer_1.NotificationsRenderer),
194
- (0, tslib_1.__metadata)("design:type", notifications_renderer_1.NotificationsRenderer)
195
- ], NotificationsContribution.prototype, "notificationsRenderer", void 0);
196
- (0, tslib_1.__decorate)([
197
- (0, inversify_1.inject)(browser_1.StatusBar),
198
- (0, tslib_1.__metadata)("design:type", Object)
199
- ], NotificationsContribution.prototype, "statusBar", void 0);
200
- NotificationsContribution = (0, tslib_1.__decorate)([
201
- (0, inversify_1.injectable)()
202
- ], NotificationsContribution);
203
- exports.NotificationsContribution = NotificationsContribution;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.NotificationsContribution = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const browser_1 = require("@theia/core/lib/browser");
22
+ const notifications_commands_1 = require("./notifications-commands");
23
+ const notifications_manager_1 = require("./notifications-manager");
24
+ const notifications_renderer_1 = require("./notifications-renderer");
25
+ const color_1 = require("@theia/core/lib/common/color");
26
+ const nls_1 = require("@theia/core/lib/common/nls");
27
+ const theme_1 = require("@theia/core/lib/common/theme");
28
+ let NotificationsContribution = class NotificationsContribution {
29
+ constructor() {
30
+ this.id = 'theia-notification-center';
31
+ }
32
+ onStart(_app) {
33
+ this.createStatusBarItem();
34
+ }
35
+ createStatusBarItem() {
36
+ this.updateStatusBarItem();
37
+ this.manager.onUpdated(e => this.updateStatusBarItem(e.notifications.length));
38
+ }
39
+ updateStatusBarItem(count = 0) {
40
+ this.statusBar.setElement(this.id, {
41
+ text: this.getStatusBarItemText(count),
42
+ alignment: browser_1.StatusBarAlignment.RIGHT,
43
+ priority: -900,
44
+ command: notifications_commands_1.NotificationsCommands.TOGGLE.id,
45
+ tooltip: this.getStatusBarItemTooltip(count),
46
+ accessibilityInformation: {
47
+ label: this.getStatusBarItemTooltip(count)
48
+ }
49
+ });
50
+ }
51
+ getStatusBarItemText(count) {
52
+ return `$(${count ? 'codicon-bell-dot' : 'codicon-bell'}) ${count ? ` ${count}` : ''}`;
53
+ }
54
+ getStatusBarItemTooltip(count) {
55
+ if (this.manager.centerVisible) {
56
+ return nls_1.nls.localizeByDefault('Hide Notifications');
57
+ }
58
+ return count === 0
59
+ ? nls_1.nls.localizeByDefault('No Notifications')
60
+ : count === 1
61
+ ? nls_1.nls.localizeByDefault('1 New Notification')
62
+ : nls_1.nls.localizeByDefault('{0} New Notifications', count.toString());
63
+ }
64
+ registerCommands(commands) {
65
+ commands.registerCommand(notifications_commands_1.NotificationsCommands.TOGGLE, {
66
+ isEnabled: () => true,
67
+ execute: () => this.manager.toggleCenter()
68
+ });
69
+ commands.registerCommand(notifications_commands_1.NotificationsCommands.SHOW, {
70
+ isEnabled: () => true,
71
+ execute: () => this.manager.showCenter()
72
+ });
73
+ commands.registerCommand(notifications_commands_1.NotificationsCommands.HIDE, {
74
+ execute: () => this.manager.hide()
75
+ });
76
+ commands.registerCommand(notifications_commands_1.NotificationsCommands.CLEAR_ALL, {
77
+ execute: () => this.manager.clearAll()
78
+ });
79
+ }
80
+ registerKeybindings(keybindings) {
81
+ keybindings.registerKeybinding({
82
+ command: notifications_commands_1.NotificationsCommands.HIDE.id,
83
+ when: 'notificationsVisible',
84
+ keybinding: 'esc'
85
+ });
86
+ }
87
+ registerColors(colors) {
88
+ colors.register({
89
+ id: 'notificationCenter.border', defaults: {
90
+ hcDark: 'contrastBorder',
91
+ hcLight: 'contrastBorder'
92
+ }, description: 'Notifications center border color. Notifications slide in from the bottom right of the window.'
93
+ }, {
94
+ id: 'notificationToast.border', defaults: {
95
+ hcDark: 'contrastBorder',
96
+ hcLight: 'contrastBorder'
97
+ }, description: 'Notification toast border color. Notifications slide in from the bottom right of the window.'
98
+ }, {
99
+ id: 'notifications.foreground', defaults: {
100
+ dark: 'editorWidget.foreground',
101
+ light: 'editorWidget.foreground',
102
+ hcDark: 'editorWidget.foreground',
103
+ hcLight: 'editorWidget.foreground'
104
+ }, description: 'Notifications foreground color. Notifications slide in from the bottom right of the window.'
105
+ }, {
106
+ id: 'notifications.background', defaults: {
107
+ dark: 'editorWidget.background',
108
+ light: 'editorWidget.background',
109
+ hcDark: 'editorWidget.background',
110
+ hcLight: 'editorWidget.background'
111
+ }, description: 'Notifications background color. Notifications slide in from the bottom right of the window.'
112
+ }, {
113
+ id: 'notificationLink.foreground', defaults: {
114
+ dark: 'textLink.foreground',
115
+ light: 'textLink.foreground',
116
+ hcDark: 'textLink.foreground',
117
+ hcLight: 'textLink.foreground'
118
+ }, description: 'Notification links foreground color. Notifications slide in from the bottom right of the window.'
119
+ }, {
120
+ id: 'notificationCenterHeader.foreground',
121
+ description: 'Notifications center header foreground color. Notifications slide in from the bottom right of the window.'
122
+ }, {
123
+ id: 'notificationCenterHeader.background', defaults: {
124
+ dark: color_1.Color.lighten('notifications.background', 0.3),
125
+ light: color_1.Color.darken('notifications.background', 0.05),
126
+ hcDark: 'notifications.background',
127
+ hcLight: 'notifications.background'
128
+ }, description: 'Notifications center header background color. Notifications slide in from the bottom right of the window.'
129
+ }, {
130
+ id: 'notifications.border', defaults: {
131
+ dark: 'notificationCenterHeader.background',
132
+ light: 'notificationCenterHeader.background',
133
+ hcDark: 'notificationCenterHeader.background',
134
+ hcLight: 'notificationCenterHeader.background'
135
+ // eslint-disable-next-line max-len
136
+ }, description: 'Notifications border color separating from other notifications in the notifications center. Notifications slide in from the bottom right of the window.'
137
+ }, {
138
+ id: 'notificationsErrorIcon.foreground', defaults: {
139
+ dark: 'editorError.foreground',
140
+ light: 'editorError.foreground',
141
+ hcDark: 'editorError.foreground',
142
+ hcLight: 'editorError.foreground'
143
+ }, description: 'The color used for the icon of error notifications. Notifications slide in from the bottom right of the window.'
144
+ }, {
145
+ id: 'notificationsWarningIcon.foreground', defaults: {
146
+ dark: 'editorWarning.foreground',
147
+ light: 'editorWarning.foreground',
148
+ hcDark: 'editorWarning.foreground',
149
+ hcLight: 'editorWarning.foreground'
150
+ }, description: 'The color used for the icon of warning notifications. Notifications slide in from the bottom right of the window.'
151
+ }, {
152
+ id: 'notificationsInfoIcon.foreground', defaults: {
153
+ dark: 'editorInfo.foreground',
154
+ light: 'editorInfo.foreground',
155
+ hcDark: 'editorInfo.foreground',
156
+ hcLight: 'editorInfo.foreground'
157
+ }, description: 'The color used for the icon of info notifications. Notifications slide in from the bottom right of the window.'
158
+ });
159
+ }
160
+ registerThemeStyle(theme, collector) {
161
+ const notificationsBackground = theme.getColor('notifications.background');
162
+ if (notificationsBackground) {
163
+ collector.addRule(`
164
+ .theia-notification-list-item-container {
165
+ background-color: ${notificationsBackground};
166
+ }
167
+ `);
168
+ }
169
+ const notificationHover = theme.getColor('list.hoverBackground');
170
+ if (notificationHover) {
171
+ collector.addRule(`
172
+ .theia-notification-list-item:hover:not(:focus) {
173
+ background-color: ${notificationHover};
174
+ }
175
+ `);
176
+ }
177
+ const focusBorder = theme.getColor('focusBorder');
178
+ if (focusBorder && (0, theme_1.isHighContrast)(theme.type)) {
179
+ collector.addRule(`
180
+ .theia-notification-list-item:hover:not(:focus) {
181
+ outline: 1px dashed ${focusBorder};
182
+ outline-offset: -2px;
183
+ }
184
+ `);
185
+ }
186
+ }
187
+ };
188
+ (0, tslib_1.__decorate)([
189
+ (0, inversify_1.inject)(notifications_manager_1.NotificationManager),
190
+ (0, tslib_1.__metadata)("design:type", notifications_manager_1.NotificationManager)
191
+ ], NotificationsContribution.prototype, "manager", void 0);
192
+ (0, tslib_1.__decorate)([
193
+ (0, inversify_1.inject)(notifications_renderer_1.NotificationsRenderer),
194
+ (0, tslib_1.__metadata)("design:type", notifications_renderer_1.NotificationsRenderer)
195
+ ], NotificationsContribution.prototype, "notificationsRenderer", void 0);
196
+ (0, tslib_1.__decorate)([
197
+ (0, inversify_1.inject)(browser_1.StatusBar),
198
+ (0, tslib_1.__metadata)("design:type", Object)
199
+ ], NotificationsContribution.prototype, "statusBar", void 0);
200
+ NotificationsContribution = (0, tslib_1.__decorate)([
201
+ (0, inversify_1.injectable)()
202
+ ], NotificationsContribution);
203
+ exports.NotificationsContribution = NotificationsContribution;
204
204
  //# sourceMappingURL=notifications-contribution.js.map
@@ -1,72 +1,72 @@
1
- /// <reference types="lodash" />
2
- import { MessageClient, MessageType, Message as PlainMessage, ProgressMessage, ProgressUpdate, CancellationToken } from '@theia/core/lib/common';
3
- import { Emitter } from '@theia/core';
4
- import { Deferred } from '@theia/core/lib/common/promise-util';
5
- import { NotificationPreferences } from './notification-preferences';
6
- import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
7
- import { OpenerService } from '@theia/core/lib/browser';
8
- import { NotificationContentRenderer } from './notification-content-renderer';
9
- export interface NotificationUpdateEvent {
10
- readonly notifications: Notification[];
11
- readonly toasts: Notification[];
12
- readonly visibilityState: Notification.Visibility;
13
- }
14
- export interface Notification {
15
- messageId: string;
16
- message: string;
17
- source?: string;
18
- expandable: boolean;
19
- collapsed: boolean;
20
- type: Notification.Type;
21
- actions: string[];
22
- progress?: number;
23
- }
24
- export declare namespace Notification {
25
- type Visibility = 'hidden' | 'toasts' | 'center';
26
- type Type = 'info' | 'warning' | 'error' | 'progress';
27
- }
28
- export declare class NotificationManager extends MessageClient {
29
- protected readonly preferences: NotificationPreferences;
30
- protected readonly contextKeyService: ContextKeyService;
31
- protected readonly openerService: OpenerService;
32
- protected readonly contentRenderer: NotificationContentRenderer;
33
- protected readonly onUpdatedEmitter: Emitter<NotificationUpdateEvent>;
34
- readonly onUpdated: import("@theia/core/lib/common").Event<NotificationUpdateEvent>;
35
- protected readonly fireUpdatedEvent: import("lodash").DebouncedFunc<() => void>;
36
- protected readonly deferredResults: Map<string, Deferred<string | undefined>>;
37
- protected readonly notifications: Map<string, Notification>;
38
- protected readonly toasts: Map<string, Notification>;
39
- protected notificationToastsVisibleKey: ContextKey<boolean>;
40
- protected notificationCenterVisibleKey: ContextKey<boolean>;
41
- protected notificationsVisible: ContextKey<boolean>;
42
- protected init(): void;
43
- protected doInit(): Promise<void>;
44
- protected updateContextKeys(): void;
45
- get toastsVisible(): boolean;
46
- get centerVisible(): boolean;
47
- protected visibilityState: Notification.Visibility;
48
- protected setVisibilityState(newState: Notification.Visibility): void;
49
- hideCenter(): void;
50
- showCenter(): void;
51
- toggleCenter(): void;
52
- accept(notification: Notification | string, action: string | undefined): void;
53
- protected find(notification: Notification | string): Notification | undefined;
54
- protected getId(notification: Notification | string): string;
55
- hide(): void;
56
- clearAll(): void;
57
- clear(notification: Notification | string): void;
58
- toggleExpansion(notificationId: string): void;
59
- showMessage(plainMessage: PlainMessage): Promise<string | undefined>;
60
- protected hideTimeouts: Map<string, number>;
61
- protected startHideTimeout(messageId: string, timeout: number): void;
62
- protected hideToast(messageId: string): void;
63
- protected getTimeout(plainMessage: PlainMessage): number;
64
- protected isExpandable(message: string, source: string | undefined, actions: string[]): boolean;
65
- protected toNotificationType(type?: MessageType): Notification.Type;
66
- protected getMessageId(m: PlainMessage): string;
67
- showProgress(messageId: string, plainMessage: ProgressMessage, cancellationToken: CancellationToken): Promise<string | undefined>;
68
- reportProgress(messageId: string, update: ProgressUpdate, originalMessage: ProgressMessage, cancellationToken: CancellationToken): Promise<void>;
69
- protected toPlainProgress(update: ProgressUpdate): number | undefined;
70
- openLink(link: string): Promise<void>;
71
- }
1
+ /// <reference types="lodash" />
2
+ import { MessageClient, MessageType, Message as PlainMessage, ProgressMessage, ProgressUpdate, CancellationToken } from '@theia/core/lib/common';
3
+ import { Emitter } from '@theia/core';
4
+ import { Deferred } from '@theia/core/lib/common/promise-util';
5
+ import { NotificationPreferences } from './notification-preferences';
6
+ import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
7
+ import { OpenerService } from '@theia/core/lib/browser';
8
+ import { NotificationContentRenderer } from './notification-content-renderer';
9
+ export interface NotificationUpdateEvent {
10
+ readonly notifications: Notification[];
11
+ readonly toasts: Notification[];
12
+ readonly visibilityState: Notification.Visibility;
13
+ }
14
+ export interface Notification {
15
+ messageId: string;
16
+ message: string;
17
+ source?: string;
18
+ expandable: boolean;
19
+ collapsed: boolean;
20
+ type: Notification.Type;
21
+ actions: string[];
22
+ progress?: number;
23
+ }
24
+ export declare namespace Notification {
25
+ type Visibility = 'hidden' | 'toasts' | 'center';
26
+ type Type = 'info' | 'warning' | 'error' | 'progress';
27
+ }
28
+ export declare class NotificationManager extends MessageClient {
29
+ protected readonly preferences: NotificationPreferences;
30
+ protected readonly contextKeyService: ContextKeyService;
31
+ protected readonly openerService: OpenerService;
32
+ protected readonly contentRenderer: NotificationContentRenderer;
33
+ protected readonly onUpdatedEmitter: Emitter<NotificationUpdateEvent>;
34
+ readonly onUpdated: import("@theia/core/lib/common").Event<NotificationUpdateEvent>;
35
+ protected readonly fireUpdatedEvent: import("lodash").DebouncedFunc<() => void>;
36
+ protected readonly deferredResults: Map<string, Deferred<string | undefined>>;
37
+ protected readonly notifications: Map<string, Notification>;
38
+ protected readonly toasts: Map<string, Notification>;
39
+ protected notificationToastsVisibleKey: ContextKey<boolean>;
40
+ protected notificationCenterVisibleKey: ContextKey<boolean>;
41
+ protected notificationsVisible: ContextKey<boolean>;
42
+ protected init(): void;
43
+ protected doInit(): Promise<void>;
44
+ protected updateContextKeys(): void;
45
+ get toastsVisible(): boolean;
46
+ get centerVisible(): boolean;
47
+ protected visibilityState: Notification.Visibility;
48
+ protected setVisibilityState(newState: Notification.Visibility): void;
49
+ hideCenter(): void;
50
+ showCenter(): void;
51
+ toggleCenter(): void;
52
+ accept(notification: Notification | string, action: string | undefined): void;
53
+ protected find(notification: Notification | string): Notification | undefined;
54
+ protected getId(notification: Notification | string): string;
55
+ hide(): void;
56
+ clearAll(): void;
57
+ clear(notification: Notification | string): void;
58
+ toggleExpansion(notificationId: string): void;
59
+ showMessage(plainMessage: PlainMessage): Promise<string | undefined>;
60
+ protected hideTimeouts: Map<string, number>;
61
+ protected startHideTimeout(messageId: string, timeout: number): void;
62
+ protected hideToast(messageId: string): void;
63
+ protected getTimeout(plainMessage: PlainMessage): number;
64
+ protected isExpandable(message: string, source: string | undefined, actions: string[]): boolean;
65
+ protected toNotificationType(type?: MessageType): Notification.Type;
66
+ protected getMessageId(m: PlainMessage): string;
67
+ showProgress(messageId: string, plainMessage: ProgressMessage, cancellationToken: CancellationToken): Promise<string | undefined>;
68
+ reportProgress(messageId: string, update: ProgressUpdate, originalMessage: ProgressMessage, cancellationToken: CancellationToken): Promise<void>;
69
+ protected toPlainProgress(update: ProgressUpdate): number | undefined;
70
+ openLink(link: string): Promise<void>;
71
+ }
72
72
  //# sourceMappingURL=notifications-manager.d.ts.map