@theia/messages 1.48.1 → 1.48.2

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,275 +1,275 @@
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.NotificationManager = void 0;
19
- const tslib_1 = require("tslib");
20
- const inversify_1 = require("@theia/core/shared/inversify");
21
- const common_1 = require("@theia/core/lib/common");
22
- const objects_1 = require("@theia/core/lib/common/objects");
23
- const core_1 = require("@theia/core");
24
- const promise_util_1 = require("@theia/core/lib/common/promise-util");
25
- const ts_md5_1 = require("ts-md5");
26
- const throttle = require("@theia/core/shared/lodash.throttle");
27
- const notification_preferences_1 = require("./notification-preferences");
28
- const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
29
- const browser_1 = require("@theia/core/lib/browser");
30
- const uri_1 = require("@theia/core/lib/common/uri");
31
- const notification_content_renderer_1 = require("./notification-content-renderer");
32
- let NotificationManager = class NotificationManager extends common_1.MessageClient {
33
- constructor() {
34
- super(...arguments);
35
- this.onUpdatedEmitter = new core_1.Emitter();
36
- this.onUpdated = this.onUpdatedEmitter.event;
37
- this.fireUpdatedEvent = throttle(() => {
38
- const notifications = (0, objects_1.deepClone)(Array.from(this.notifications.values()).filter((notification) => notification.message));
39
- const toasts = (0, objects_1.deepClone)(Array.from(this.toasts.values()).filter((toast) => toast.message));
40
- const visibilityState = this.visibilityState;
41
- this.onUpdatedEmitter.fire({ notifications, toasts, visibilityState });
42
- }, 250, { leading: true, trailing: true });
43
- this.deferredResults = new Map();
44
- this.notifications = new Map();
45
- this.toasts = new Map();
46
- this.visibilityState = 'hidden';
47
- this.hideTimeouts = new Map();
48
- }
49
- init() {
50
- this.doInit();
51
- }
52
- async doInit() {
53
- this.notificationToastsVisibleKey = this.contextKeyService.createKey('notificationToastsVisible', false);
54
- this.notificationCenterVisibleKey = this.contextKeyService.createKey('notificationCenterVisible', false);
55
- this.notificationsVisible = this.contextKeyService.createKey('notificationsVisible', false);
56
- }
57
- updateContextKeys() {
58
- this.notificationToastsVisibleKey.set(this.toastsVisible);
59
- this.notificationCenterVisibleKey.set(this.centerVisible);
60
- this.notificationsVisible.set(this.toastsVisible || this.centerVisible);
61
- }
62
- get toastsVisible() {
63
- return this.visibilityState === 'toasts';
64
- }
65
- get centerVisible() {
66
- return this.visibilityState === 'center';
67
- }
68
- setVisibilityState(newState) {
69
- const changed = this.visibilityState !== newState;
70
- this.visibilityState = newState;
71
- if (changed) {
72
- this.fireUpdatedEvent();
73
- this.updateContextKeys();
74
- }
75
- }
76
- hideCenter() {
77
- this.setVisibilityState('hidden');
78
- }
79
- showCenter() {
80
- this.setVisibilityState('center');
81
- }
82
- toggleCenter() {
83
- this.setVisibilityState(this.centerVisible ? 'hidden' : 'center');
84
- }
85
- accept(notification, action) {
86
- const messageId = this.getId(notification);
87
- if (!messageId) {
88
- return;
89
- }
90
- this.notifications.delete(messageId);
91
- this.toasts.delete(messageId);
92
- const result = this.deferredResults.get(messageId);
93
- if (!result) {
94
- return;
95
- }
96
- this.deferredResults.delete(messageId);
97
- if ((this.centerVisible && !this.notifications.size) || (this.toastsVisible && !this.toasts.size)) {
98
- this.setVisibilityState('hidden');
99
- }
100
- result.resolve(action);
101
- this.fireUpdatedEvent();
102
- }
103
- find(notification) {
104
- return typeof notification === 'string' ? this.notifications.get(notification) : notification;
105
- }
106
- getId(notification) {
107
- return typeof notification === 'string' ? notification : notification.messageId;
108
- }
109
- hide() {
110
- if (this.toastsVisible) {
111
- this.toasts.clear();
112
- }
113
- this.setVisibilityState('hidden');
114
- }
115
- clearAll() {
116
- this.setVisibilityState('hidden');
117
- Array.from(this.notifications.values()).forEach(n => this.clear(n));
118
- }
119
- clear(notification) {
120
- this.accept(notification, undefined);
121
- }
122
- toggleExpansion(notificationId) {
123
- const notification = this.find(notificationId);
124
- if (!notification) {
125
- return;
126
- }
127
- notification.collapsed = !notification.collapsed;
128
- this.fireUpdatedEvent();
129
- }
130
- showMessage(plainMessage) {
131
- const messageId = this.getMessageId(plainMessage);
132
- let notification = this.notifications.get(messageId);
133
- if (!notification) {
134
- const message = this.contentRenderer.renderMessage(plainMessage.text);
135
- const type = this.toNotificationType(plainMessage.type);
136
- const actions = Array.from(new Set(plainMessage.actions));
137
- const source = plainMessage.source;
138
- const expandable = this.isExpandable(message, source, actions);
139
- const collapsed = expandable;
140
- notification = { messageId, message, type, actions, expandable, collapsed };
141
- this.notifications.set(messageId, notification);
142
- }
143
- const result = this.deferredResults.get(messageId) || new promise_util_1.Deferred();
144
- this.deferredResults.set(messageId, result);
145
- if (!this.centerVisible) {
146
- this.toasts.delete(messageId);
147
- this.toasts.set(messageId, notification);
148
- this.startHideTimeout(messageId, this.getTimeout(plainMessage));
149
- this.setVisibilityState('toasts');
150
- }
151
- this.fireUpdatedEvent();
152
- return result.promise;
153
- }
154
- startHideTimeout(messageId, timeout) {
155
- if (timeout > 0) {
156
- this.hideTimeouts.set(messageId, window.setTimeout(() => {
157
- this.hideToast(messageId);
158
- }, timeout));
159
- }
160
- }
161
- hideToast(messageId) {
162
- this.toasts.delete(messageId);
163
- if (this.toastsVisible && !this.toasts.size) {
164
- this.setVisibilityState('hidden');
165
- }
166
- else {
167
- this.fireUpdatedEvent();
168
- }
169
- }
170
- getTimeout(plainMessage) {
171
- if (plainMessage.actions && plainMessage.actions.length > 0) {
172
- // Ignore the timeout if at least one action is set, and we wait for user interaction.
173
- return 0;
174
- }
175
- return plainMessage.options && plainMessage.options.timeout || this.preferences['notification.timeout'];
176
- }
177
- isExpandable(message, source, actions) {
178
- if (!actions.length && source) {
179
- return true;
180
- }
181
- return message.length > 500;
182
- }
183
- toNotificationType(type) {
184
- switch (type) {
185
- case common_1.MessageType.Error:
186
- return 'error';
187
- case common_1.MessageType.Warning:
188
- return 'warning';
189
- case common_1.MessageType.Progress:
190
- return 'progress';
191
- default:
192
- return 'info';
193
- }
194
- }
195
- getMessageId(m) {
196
- return String(ts_md5_1.Md5.hashStr(`[${m.type}] ${m.text} : ${(m.actions || []).join(' | ')};`));
197
- }
198
- async showProgress(messageId, plainMessage, cancellationToken) {
199
- let notification = this.notifications.get(messageId);
200
- if (!notification) {
201
- const message = this.contentRenderer.renderMessage(plainMessage.text);
202
- const type = this.toNotificationType(plainMessage.type);
203
- const actions = Array.from(new Set(plainMessage.actions));
204
- const source = plainMessage.source;
205
- const expandable = this.isExpandable(message, source, actions);
206
- const collapsed = expandable;
207
- notification = { messageId, message, type, actions, expandable, collapsed };
208
- this.notifications.set(messageId, notification);
209
- notification.progress = 0;
210
- cancellationToken.onCancellationRequested(() => {
211
- this.accept(messageId, common_1.ProgressMessage.Cancel);
212
- });
213
- }
214
- const result = this.deferredResults.get(messageId) || new promise_util_1.Deferred();
215
- this.deferredResults.set(messageId, result);
216
- if (!this.centerVisible) {
217
- this.toasts.set(messageId, notification);
218
- this.setVisibilityState('toasts');
219
- }
220
- this.fireUpdatedEvent();
221
- return result.promise;
222
- }
223
- async reportProgress(messageId, update, originalMessage, cancellationToken) {
224
- const notification = this.find(messageId);
225
- if (!notification) {
226
- return;
227
- }
228
- if (cancellationToken.isCancellationRequested) {
229
- this.clear(messageId);
230
- }
231
- else {
232
- const textMessage = originalMessage.text && update.message ? `${originalMessage.text}: ${update.message}` : originalMessage.text || (update === null || update === void 0 ? void 0 : update.message);
233
- if (textMessage) {
234
- notification.message = this.contentRenderer.renderMessage(textMessage);
235
- }
236
- notification.progress = this.toPlainProgress(update) || notification.progress;
237
- }
238
- this.fireUpdatedEvent();
239
- }
240
- toPlainProgress(update) {
241
- return update.work && Math.min(update.work.done / update.work.total * 100, 100);
242
- }
243
- async openLink(link) {
244
- const uri = new uri_1.default(link);
245
- const opener = await this.openerService.getOpener(uri);
246
- opener.open(uri);
247
- }
248
- };
249
- (0, tslib_1.__decorate)([
250
- (0, inversify_1.inject)(notification_preferences_1.NotificationPreferences),
251
- (0, tslib_1.__metadata)("design:type", Object)
252
- ], NotificationManager.prototype, "preferences", void 0);
253
- (0, tslib_1.__decorate)([
254
- (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
255
- (0, tslib_1.__metadata)("design:type", Object)
256
- ], NotificationManager.prototype, "contextKeyService", void 0);
257
- (0, tslib_1.__decorate)([
258
- (0, inversify_1.inject)(browser_1.OpenerService),
259
- (0, tslib_1.__metadata)("design:type", Object)
260
- ], NotificationManager.prototype, "openerService", void 0);
261
- (0, tslib_1.__decorate)([
262
- (0, inversify_1.inject)(notification_content_renderer_1.NotificationContentRenderer),
263
- (0, tslib_1.__metadata)("design:type", notification_content_renderer_1.NotificationContentRenderer)
264
- ], NotificationManager.prototype, "contentRenderer", void 0);
265
- (0, tslib_1.__decorate)([
266
- (0, inversify_1.postConstruct)(),
267
- (0, tslib_1.__metadata)("design:type", Function),
268
- (0, tslib_1.__metadata)("design:paramtypes", []),
269
- (0, tslib_1.__metadata)("design:returntype", void 0)
270
- ], NotificationManager.prototype, "init", null);
271
- NotificationManager = (0, tslib_1.__decorate)([
272
- (0, inversify_1.injectable)()
273
- ], NotificationManager);
274
- exports.NotificationManager = NotificationManager;
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.NotificationManager = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const common_1 = require("@theia/core/lib/common");
22
+ const objects_1 = require("@theia/core/lib/common/objects");
23
+ const core_1 = require("@theia/core");
24
+ const promise_util_1 = require("@theia/core/lib/common/promise-util");
25
+ const ts_md5_1 = require("ts-md5");
26
+ const throttle = require("@theia/core/shared/lodash.throttle");
27
+ const notification_preferences_1 = require("./notification-preferences");
28
+ const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
29
+ const browser_1 = require("@theia/core/lib/browser");
30
+ const uri_1 = require("@theia/core/lib/common/uri");
31
+ const notification_content_renderer_1 = require("./notification-content-renderer");
32
+ let NotificationManager = class NotificationManager extends common_1.MessageClient {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.onUpdatedEmitter = new core_1.Emitter();
36
+ this.onUpdated = this.onUpdatedEmitter.event;
37
+ this.fireUpdatedEvent = throttle(() => {
38
+ const notifications = (0, objects_1.deepClone)(Array.from(this.notifications.values()).filter((notification) => notification.message));
39
+ const toasts = (0, objects_1.deepClone)(Array.from(this.toasts.values()).filter((toast) => toast.message));
40
+ const visibilityState = this.visibilityState;
41
+ this.onUpdatedEmitter.fire({ notifications, toasts, visibilityState });
42
+ }, 250, { leading: true, trailing: true });
43
+ this.deferredResults = new Map();
44
+ this.notifications = new Map();
45
+ this.toasts = new Map();
46
+ this.visibilityState = 'hidden';
47
+ this.hideTimeouts = new Map();
48
+ }
49
+ init() {
50
+ this.doInit();
51
+ }
52
+ async doInit() {
53
+ this.notificationToastsVisibleKey = this.contextKeyService.createKey('notificationToastsVisible', false);
54
+ this.notificationCenterVisibleKey = this.contextKeyService.createKey('notificationCenterVisible', false);
55
+ this.notificationsVisible = this.contextKeyService.createKey('notificationsVisible', false);
56
+ }
57
+ updateContextKeys() {
58
+ this.notificationToastsVisibleKey.set(this.toastsVisible);
59
+ this.notificationCenterVisibleKey.set(this.centerVisible);
60
+ this.notificationsVisible.set(this.toastsVisible || this.centerVisible);
61
+ }
62
+ get toastsVisible() {
63
+ return this.visibilityState === 'toasts';
64
+ }
65
+ get centerVisible() {
66
+ return this.visibilityState === 'center';
67
+ }
68
+ setVisibilityState(newState) {
69
+ const changed = this.visibilityState !== newState;
70
+ this.visibilityState = newState;
71
+ if (changed) {
72
+ this.fireUpdatedEvent();
73
+ this.updateContextKeys();
74
+ }
75
+ }
76
+ hideCenter() {
77
+ this.setVisibilityState('hidden');
78
+ }
79
+ showCenter() {
80
+ this.setVisibilityState('center');
81
+ }
82
+ toggleCenter() {
83
+ this.setVisibilityState(this.centerVisible ? 'hidden' : 'center');
84
+ }
85
+ accept(notification, action) {
86
+ const messageId = this.getId(notification);
87
+ if (!messageId) {
88
+ return;
89
+ }
90
+ this.notifications.delete(messageId);
91
+ this.toasts.delete(messageId);
92
+ const result = this.deferredResults.get(messageId);
93
+ if (!result) {
94
+ return;
95
+ }
96
+ this.deferredResults.delete(messageId);
97
+ if ((this.centerVisible && !this.notifications.size) || (this.toastsVisible && !this.toasts.size)) {
98
+ this.setVisibilityState('hidden');
99
+ }
100
+ result.resolve(action);
101
+ this.fireUpdatedEvent();
102
+ }
103
+ find(notification) {
104
+ return typeof notification === 'string' ? this.notifications.get(notification) : notification;
105
+ }
106
+ getId(notification) {
107
+ return typeof notification === 'string' ? notification : notification.messageId;
108
+ }
109
+ hide() {
110
+ if (this.toastsVisible) {
111
+ this.toasts.clear();
112
+ }
113
+ this.setVisibilityState('hidden');
114
+ }
115
+ clearAll() {
116
+ this.setVisibilityState('hidden');
117
+ Array.from(this.notifications.values()).forEach(n => this.clear(n));
118
+ }
119
+ clear(notification) {
120
+ this.accept(notification, undefined);
121
+ }
122
+ toggleExpansion(notificationId) {
123
+ const notification = this.find(notificationId);
124
+ if (!notification) {
125
+ return;
126
+ }
127
+ notification.collapsed = !notification.collapsed;
128
+ this.fireUpdatedEvent();
129
+ }
130
+ showMessage(plainMessage) {
131
+ const messageId = this.getMessageId(plainMessage);
132
+ let notification = this.notifications.get(messageId);
133
+ if (!notification) {
134
+ const message = this.contentRenderer.renderMessage(plainMessage.text);
135
+ const type = this.toNotificationType(plainMessage.type);
136
+ const actions = Array.from(new Set(plainMessage.actions));
137
+ const source = plainMessage.source;
138
+ const expandable = this.isExpandable(message, source, actions);
139
+ const collapsed = expandable;
140
+ notification = { messageId, message, type, actions, expandable, collapsed };
141
+ this.notifications.set(messageId, notification);
142
+ }
143
+ const result = this.deferredResults.get(messageId) || new promise_util_1.Deferred();
144
+ this.deferredResults.set(messageId, result);
145
+ if (!this.centerVisible) {
146
+ this.toasts.delete(messageId);
147
+ this.toasts.set(messageId, notification);
148
+ this.startHideTimeout(messageId, this.getTimeout(plainMessage));
149
+ this.setVisibilityState('toasts');
150
+ }
151
+ this.fireUpdatedEvent();
152
+ return result.promise;
153
+ }
154
+ startHideTimeout(messageId, timeout) {
155
+ if (timeout > 0) {
156
+ this.hideTimeouts.set(messageId, window.setTimeout(() => {
157
+ this.hideToast(messageId);
158
+ }, timeout));
159
+ }
160
+ }
161
+ hideToast(messageId) {
162
+ this.toasts.delete(messageId);
163
+ if (this.toastsVisible && !this.toasts.size) {
164
+ this.setVisibilityState('hidden');
165
+ }
166
+ else {
167
+ this.fireUpdatedEvent();
168
+ }
169
+ }
170
+ getTimeout(plainMessage) {
171
+ if (plainMessage.actions && plainMessage.actions.length > 0) {
172
+ // Ignore the timeout if at least one action is set, and we wait for user interaction.
173
+ return 0;
174
+ }
175
+ return plainMessage.options && plainMessage.options.timeout || this.preferences['notification.timeout'];
176
+ }
177
+ isExpandable(message, source, actions) {
178
+ if (!actions.length && source) {
179
+ return true;
180
+ }
181
+ return message.length > 500;
182
+ }
183
+ toNotificationType(type) {
184
+ switch (type) {
185
+ case common_1.MessageType.Error:
186
+ return 'error';
187
+ case common_1.MessageType.Warning:
188
+ return 'warning';
189
+ case common_1.MessageType.Progress:
190
+ return 'progress';
191
+ default:
192
+ return 'info';
193
+ }
194
+ }
195
+ getMessageId(m) {
196
+ return String(ts_md5_1.Md5.hashStr(`[${m.type}] ${m.text} : ${(m.actions || []).join(' | ')};`));
197
+ }
198
+ async showProgress(messageId, plainMessage, cancellationToken) {
199
+ let notification = this.notifications.get(messageId);
200
+ if (!notification) {
201
+ const message = this.contentRenderer.renderMessage(plainMessage.text);
202
+ const type = this.toNotificationType(plainMessage.type);
203
+ const actions = Array.from(new Set(plainMessage.actions));
204
+ const source = plainMessage.source;
205
+ const expandable = this.isExpandable(message, source, actions);
206
+ const collapsed = expandable;
207
+ notification = { messageId, message, type, actions, expandable, collapsed };
208
+ this.notifications.set(messageId, notification);
209
+ notification.progress = 0;
210
+ cancellationToken.onCancellationRequested(() => {
211
+ this.accept(messageId, common_1.ProgressMessage.Cancel);
212
+ });
213
+ }
214
+ const result = this.deferredResults.get(messageId) || new promise_util_1.Deferred();
215
+ this.deferredResults.set(messageId, result);
216
+ if (!this.centerVisible) {
217
+ this.toasts.set(messageId, notification);
218
+ this.setVisibilityState('toasts');
219
+ }
220
+ this.fireUpdatedEvent();
221
+ return result.promise;
222
+ }
223
+ async reportProgress(messageId, update, originalMessage, cancellationToken) {
224
+ const notification = this.find(messageId);
225
+ if (!notification) {
226
+ return;
227
+ }
228
+ if (cancellationToken.isCancellationRequested) {
229
+ this.clear(messageId);
230
+ }
231
+ else {
232
+ const textMessage = originalMessage.text && update.message ? `${originalMessage.text}: ${update.message}` : originalMessage.text || (update === null || update === void 0 ? void 0 : update.message);
233
+ if (textMessage) {
234
+ notification.message = this.contentRenderer.renderMessage(textMessage);
235
+ }
236
+ notification.progress = this.toPlainProgress(update) || notification.progress;
237
+ }
238
+ this.fireUpdatedEvent();
239
+ }
240
+ toPlainProgress(update) {
241
+ return update.work && Math.min(update.work.done / update.work.total * 100, 100);
242
+ }
243
+ async openLink(link) {
244
+ const uri = new uri_1.default(link);
245
+ const opener = await this.openerService.getOpener(uri);
246
+ opener.open(uri);
247
+ }
248
+ };
249
+ (0, tslib_1.__decorate)([
250
+ (0, inversify_1.inject)(notification_preferences_1.NotificationPreferences),
251
+ (0, tslib_1.__metadata)("design:type", Object)
252
+ ], NotificationManager.prototype, "preferences", void 0);
253
+ (0, tslib_1.__decorate)([
254
+ (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
255
+ (0, tslib_1.__metadata)("design:type", Object)
256
+ ], NotificationManager.prototype, "contextKeyService", void 0);
257
+ (0, tslib_1.__decorate)([
258
+ (0, inversify_1.inject)(browser_1.OpenerService),
259
+ (0, tslib_1.__metadata)("design:type", Object)
260
+ ], NotificationManager.prototype, "openerService", void 0);
261
+ (0, tslib_1.__decorate)([
262
+ (0, inversify_1.inject)(notification_content_renderer_1.NotificationContentRenderer),
263
+ (0, tslib_1.__metadata)("design:type", notification_content_renderer_1.NotificationContentRenderer)
264
+ ], NotificationManager.prototype, "contentRenderer", void 0);
265
+ (0, tslib_1.__decorate)([
266
+ (0, inversify_1.postConstruct)(),
267
+ (0, tslib_1.__metadata)("design:type", Function),
268
+ (0, tslib_1.__metadata)("design:paramtypes", []),
269
+ (0, tslib_1.__metadata)("design:returntype", void 0)
270
+ ], NotificationManager.prototype, "init", null);
271
+ NotificationManager = (0, tslib_1.__decorate)([
272
+ (0, inversify_1.injectable)()
273
+ ], NotificationManager);
274
+ exports.NotificationManager = NotificationManager;
275
275
  //# sourceMappingURL=notifications-manager.js.map
@@ -1,14 +1,14 @@
1
- import { Root } from '@theia/core/shared/react-dom/client';
2
- import { ApplicationShell, CorePreferences } from '@theia/core/lib/browser';
3
- import { NotificationManager } from './notifications-manager';
4
- export declare class NotificationsRenderer {
5
- protected readonly shell: ApplicationShell;
6
- protected readonly manager: NotificationManager;
7
- protected readonly corePreferences: CorePreferences;
8
- protected containerRoot: Root;
9
- protected init(): void;
10
- protected container: HTMLDivElement;
11
- protected createOverlayContainer(): void;
12
- protected render(): void;
13
- }
1
+ import { Root } from '@theia/core/shared/react-dom/client';
2
+ import { ApplicationShell, CorePreferences } from '@theia/core/lib/browser';
3
+ import { NotificationManager } from './notifications-manager';
4
+ export declare class NotificationsRenderer {
5
+ protected readonly shell: ApplicationShell;
6
+ protected readonly manager: NotificationManager;
7
+ protected readonly corePreferences: CorePreferences;
8
+ protected containerRoot: Root;
9
+ protected init(): void;
10
+ protected container: HTMLDivElement;
11
+ protected createOverlayContainer(): void;
12
+ protected render(): void;
13
+ }
14
14
  //# sourceMappingURL=notifications-renderer.d.ts.map