@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,36 +1,36 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2020 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.NotificationContentRenderer = void 0;
19
- const tslib_1 = require("tslib");
20
- const markdownit = require("@theia/core/shared/markdown-it");
21
- const inversify_1 = require("@theia/core/shared/inversify");
22
- let NotificationContentRenderer = class NotificationContentRenderer {
23
- constructor() {
24
- this.mdEngine = markdownit({ html: false });
25
- }
26
- renderMessage(content) {
27
- // in alignment with vscode, new lines aren't supported
28
- const contentWithoutNewlines = content.replace(/((\r)?\n)+/gm, ' ');
29
- return this.mdEngine.renderInline(contentWithoutNewlines);
30
- }
31
- };
32
- NotificationContentRenderer = (0, tslib_1.__decorate)([
33
- (0, inversify_1.injectable)()
34
- ], NotificationContentRenderer);
35
- exports.NotificationContentRenderer = NotificationContentRenderer;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2020 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.NotificationContentRenderer = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const markdownit = require("@theia/core/shared/markdown-it");
21
+ const inversify_1 = require("@theia/core/shared/inversify");
22
+ let NotificationContentRenderer = class NotificationContentRenderer {
23
+ constructor() {
24
+ this.mdEngine = markdownit({ html: false });
25
+ }
26
+ renderMessage(content) {
27
+ // in alignment with vscode, new lines aren't supported
28
+ const contentWithoutNewlines = content.replace(/((\r)?\n)+/gm, ' ');
29
+ return this.mdEngine.renderInline(contentWithoutNewlines);
30
+ }
31
+ };
32
+ NotificationContentRenderer = (0, tslib_1.__decorate)([
33
+ (0, inversify_1.injectable)()
34
+ ], NotificationContentRenderer);
35
+ exports.NotificationContentRenderer = NotificationContentRenderer;
36
36
  //# sourceMappingURL=notification-content-renderer.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=notification-content-renderer.spec.d.ts.map
@@ -1,42 +1,42 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2020 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
- const chai_1 = require("chai");
19
- const notification_content_renderer_1 = require("./notification-content-renderer");
20
- describe('notification-content-renderer', () => {
21
- const contentRenderer = new notification_content_renderer_1.NotificationContentRenderer();
22
- it('should remove new lines', () => {
23
- expectRenderedContent('foo\nbar', 'foo bar');
24
- expectRenderedContent('foo\n\n\nbar', 'foo bar');
25
- });
26
- it('should render links', () => {
27
- expectRenderedContent('Link to [theia](https://github.com/eclipse-theia/theia)!', 'Link to <a href="https://github.com/eclipse-theia/theia">theia</a>!');
28
- expectRenderedContent('Link to [theia](https://github.com/eclipse-theia/theia "title on hover")!', 'Link to <a href="https://github.com/eclipse-theia/theia" title="title on hover">theia</a>!');
29
- expectRenderedContent('Click [here](command:my-command-id) to open stuff!', 'Click <a href="command:my-command-id">here</a> to open stuff!');
30
- expectRenderedContent('Click [here](javascript:window.alert();) to open stuff!', 'Click [here](javascript:window.alert();) to open stuff!');
31
- });
32
- it('should render markdown', () => {
33
- expectRenderedContent('*italic*', '<em>italic</em>');
34
- expectRenderedContent('**bold**', '<strong>bold</strong>');
35
- });
36
- it('should not render html', () => {
37
- expectRenderedContent('<script>document.getElementById("demo").innerHTML = "Hello JavaScript!";</script>', '&lt;script&gt;document.getElementById(&quot;demo&quot;).innerHTML = &quot;Hello JavaScript!&quot;;&lt;/script&gt;');
38
- expectRenderedContent('<a href="javascript:window.alert();">foobar</a>', '&lt;a href=&quot;javascript:window.alert();&quot;&gt;foobar&lt;/a&gt;');
39
- });
40
- const expectRenderedContent = (input, output) => (0, chai_1.expect)(contentRenderer.renderMessage(input)).to.be.equal(output);
41
- });
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2020 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
+ const chai_1 = require("chai");
19
+ const notification_content_renderer_1 = require("./notification-content-renderer");
20
+ describe('notification-content-renderer', () => {
21
+ const contentRenderer = new notification_content_renderer_1.NotificationContentRenderer();
22
+ it('should remove new lines', () => {
23
+ expectRenderedContent('foo\nbar', 'foo bar');
24
+ expectRenderedContent('foo\n\n\nbar', 'foo bar');
25
+ });
26
+ it('should render links', () => {
27
+ expectRenderedContent('Link to [theia](https://github.com/eclipse-theia/theia)!', 'Link to <a href="https://github.com/eclipse-theia/theia">theia</a>!');
28
+ expectRenderedContent('Link to [theia](https://github.com/eclipse-theia/theia "title on hover")!', 'Link to <a href="https://github.com/eclipse-theia/theia" title="title on hover">theia</a>!');
29
+ expectRenderedContent('Click [here](command:my-command-id) to open stuff!', 'Click <a href="command:my-command-id">here</a> to open stuff!');
30
+ expectRenderedContent('Click [here](javascript:window.alert();) to open stuff!', 'Click [here](javascript:window.alert();) to open stuff!');
31
+ });
32
+ it('should render markdown', () => {
33
+ expectRenderedContent('*italic*', '<em>italic</em>');
34
+ expectRenderedContent('**bold**', '<strong>bold</strong>');
35
+ });
36
+ it('should not render html', () => {
37
+ expectRenderedContent('<script>document.getElementById("demo").innerHTML = "Hello JavaScript!";</script>', '&lt;script&gt;document.getElementById(&quot;demo&quot;).innerHTML = &quot;Hello JavaScript!&quot;;&lt;/script&gt;');
38
+ expectRenderedContent('<a href="javascript:window.alert();">foobar</a>', '&lt;a href=&quot;javascript:window.alert();&quot;&gt;foobar&lt;/a&gt;');
39
+ });
40
+ const expectRenderedContent = (input, output) => (0, chai_1.expect)(contentRenderer.renderMessage(input)).to.be.equal(output);
41
+ });
42
42
  //# sourceMappingURL=notification-content-renderer.spec.js.map
@@ -1,12 +1,12 @@
1
- import { interfaces } from '@theia/core/shared/inversify';
2
- import { PreferenceProxy, PreferenceService, PreferenceSchema } from '@theia/core/lib/browser/preferences';
3
- export declare const NotificationConfigSchema: PreferenceSchema;
4
- export interface NotificationConfiguration {
5
- 'notification.timeout': number;
6
- }
7
- export declare const NotificationPreferenceContribution: unique symbol;
8
- export declare const NotificationPreferences: unique symbol;
9
- export declare type NotificationPreferences = PreferenceProxy<NotificationConfiguration>;
10
- export declare function createNotificationPreferences(preferences: PreferenceService, schema?: PreferenceSchema): NotificationPreferences;
11
- export declare function bindNotificationPreferences(bind: interfaces.Bind): void;
1
+ import { interfaces } from '@theia/core/shared/inversify';
2
+ import { PreferenceProxy, PreferenceService, PreferenceSchema } from '@theia/core/lib/browser/preferences';
3
+ export declare const NotificationConfigSchema: PreferenceSchema;
4
+ export interface NotificationConfiguration {
5
+ 'notification.timeout': number;
6
+ }
7
+ export declare const NotificationPreferenceContribution: unique symbol;
8
+ export declare const NotificationPreferences: unique symbol;
9
+ export declare type NotificationPreferences = PreferenceProxy<NotificationConfiguration>;
10
+ export declare function createNotificationPreferences(preferences: PreferenceService, schema?: PreferenceSchema): NotificationPreferences;
11
+ export declare function bindNotificationPreferences(bind: interfaces.Bind): void;
12
12
  //# sourceMappingURL=notification-preferences.d.ts.map
@@ -1,47 +1,47 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 Ericsson 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.bindNotificationPreferences = exports.createNotificationPreferences = exports.NotificationPreferences = exports.NotificationPreferenceContribution = exports.NotificationConfigSchema = void 0;
19
- const preferences_1 = require("@theia/core/lib/browser/preferences");
20
- const nls_1 = require("@theia/core/lib/common/nls");
21
- exports.NotificationConfigSchema = {
22
- 'type': 'object',
23
- 'properties': {
24
- 'notification.timeout': {
25
- 'type': 'number',
26
- 'description': nls_1.nls.localize('theia/messages/notificationTimeout', 'Informative notifications will be hidden after this timeout.'),
27
- 'default': 30 * 1000 // `0` and negative values are treated as no timeout.
28
- }
29
- }
30
- };
31
- exports.NotificationPreferenceContribution = Symbol('NotificationPreferenceContribution');
32
- exports.NotificationPreferences = Symbol('NotificationPreferences');
33
- function createNotificationPreferences(preferences, schema = exports.NotificationConfigSchema) {
34
- return (0, preferences_1.createPreferenceProxy)(preferences, schema);
35
- }
36
- exports.createNotificationPreferences = createNotificationPreferences;
37
- function bindNotificationPreferences(bind) {
38
- bind(exports.NotificationPreferences).toDynamicValue(ctx => {
39
- const preferences = ctx.container.get(preferences_1.PreferenceService);
40
- const contribution = ctx.container.get(exports.NotificationPreferenceContribution);
41
- return createNotificationPreferences(preferences, contribution.schema);
42
- }).inSingletonScope();
43
- bind(exports.NotificationPreferenceContribution).toConstantValue({ schema: exports.NotificationConfigSchema });
44
- bind(preferences_1.PreferenceContribution).toService(exports.NotificationPreferenceContribution);
45
- }
46
- exports.bindNotificationPreferences = bindNotificationPreferences;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 Ericsson 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.bindNotificationPreferences = exports.createNotificationPreferences = exports.NotificationPreferences = exports.NotificationPreferenceContribution = exports.NotificationConfigSchema = void 0;
19
+ const preferences_1 = require("@theia/core/lib/browser/preferences");
20
+ const nls_1 = require("@theia/core/lib/common/nls");
21
+ exports.NotificationConfigSchema = {
22
+ 'type': 'object',
23
+ 'properties': {
24
+ 'notification.timeout': {
25
+ 'type': 'number',
26
+ 'description': nls_1.nls.localize('theia/messages/notificationTimeout', 'Informative notifications will be hidden after this timeout.'),
27
+ 'default': 30 * 1000 // `0` and negative values are treated as no timeout.
28
+ }
29
+ }
30
+ };
31
+ exports.NotificationPreferenceContribution = Symbol('NotificationPreferenceContribution');
32
+ exports.NotificationPreferences = Symbol('NotificationPreferences');
33
+ function createNotificationPreferences(preferences, schema = exports.NotificationConfigSchema) {
34
+ return (0, preferences_1.createPreferenceProxy)(preferences, schema);
35
+ }
36
+ exports.createNotificationPreferences = createNotificationPreferences;
37
+ function bindNotificationPreferences(bind) {
38
+ bind(exports.NotificationPreferences).toDynamicValue(ctx => {
39
+ const preferences = ctx.container.get(preferences_1.PreferenceService);
40
+ const contribution = ctx.container.get(exports.NotificationPreferenceContribution);
41
+ return createNotificationPreferences(preferences, contribution.schema);
42
+ }).inSingletonScope();
43
+ bind(exports.NotificationPreferenceContribution).toConstantValue({ schema: exports.NotificationConfigSchema });
44
+ bind(preferences_1.PreferenceContribution).toService(exports.NotificationPreferenceContribution);
45
+ }
46
+ exports.bindNotificationPreferences = bindNotificationPreferences;
47
47
  //# sourceMappingURL=notification-preferences.js.map
@@ -1,19 +1,19 @@
1
- /// <reference types="react" />
2
- import * as React from '@theia/core/shared/react';
3
- import { DisposableCollection } from '@theia/core';
4
- import { NotificationManager, NotificationUpdateEvent } from './notifications-manager';
5
- import { CorePreferences } from '@theia/core/lib/browser';
6
- export interface NotificationToastsComponentProps {
7
- readonly manager: NotificationManager;
8
- readonly corePreferences: CorePreferences;
9
- }
10
- declare type NotificationToastsComponentState = Pick<NotificationUpdateEvent, Exclude<keyof NotificationUpdateEvent, 'notifications'>>;
11
- export declare class NotificationToastsComponent extends React.Component<NotificationToastsComponentProps, NotificationToastsComponentState> {
12
- constructor(props: NotificationToastsComponentProps);
13
- protected readonly toDisposeOnUnmount: DisposableCollection;
14
- componentDidMount(): Promise<void>;
15
- componentWillUnmount(): void;
16
- render(): React.ReactNode;
17
- }
18
- export {};
1
+ /// <reference types="react" />
2
+ import * as React from '@theia/core/shared/react';
3
+ import { DisposableCollection } from '@theia/core';
4
+ import { NotificationManager, NotificationUpdateEvent } from './notifications-manager';
5
+ import { CorePreferences } from '@theia/core/lib/browser';
6
+ export interface NotificationToastsComponentProps {
7
+ readonly manager: NotificationManager;
8
+ readonly corePreferences: CorePreferences;
9
+ }
10
+ declare type NotificationToastsComponentState = Pick<NotificationUpdateEvent, Exclude<keyof NotificationUpdateEvent, 'notifications'>>;
11
+ export declare class NotificationToastsComponent extends React.Component<NotificationToastsComponentProps, NotificationToastsComponentState> {
12
+ constructor(props: NotificationToastsComponentProps);
13
+ protected readonly toDisposeOnUnmount: DisposableCollection;
14
+ componentDidMount(): Promise<void>;
15
+ componentWillUnmount(): void;
16
+ render(): React.ReactNode;
17
+ }
18
+ export {};
19
19
  //# sourceMappingURL=notification-toasts-component.d.ts.map
@@ -1,49 +1,49 @@
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.NotificationToastsComponent = void 0;
19
- const React = require("@theia/core/shared/react");
20
- const core_1 = require("@theia/core");
21
- const notification_component_1 = require("./notification-component");
22
- class NotificationToastsComponent extends React.Component {
23
- constructor(props) {
24
- super(props);
25
- this.toDisposeOnUnmount = new core_1.DisposableCollection();
26
- this.state = {
27
- toasts: [],
28
- visibilityState: 'hidden'
29
- };
30
- }
31
- async componentDidMount() {
32
- this.toDisposeOnUnmount.push(this.props.manager.onUpdated(({ toasts, visibilityState }) => {
33
- visibilityState = this.props.corePreferences['workbench.silentNotifications'] ? 'hidden' : visibilityState;
34
- this.setState({
35
- toasts: toasts.slice(-3),
36
- visibilityState
37
- });
38
- }));
39
- }
40
- componentWillUnmount() {
41
- this.toDisposeOnUnmount.dispose();
42
- }
43
- render() {
44
- return (React.createElement("div", { className: `theia-notifications-container theia-notification-toasts ${this.state.visibilityState === 'toasts' ? 'open' : 'closed'}` },
45
- React.createElement("div", { className: 'theia-notification-list' }, this.state.toasts.map(notification => React.createElement(notification_component_1.NotificationComponent, { key: notification.messageId, notification: notification, manager: this.props.manager })))));
46
- }
47
- }
48
- exports.NotificationToastsComponent = NotificationToastsComponent;
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.NotificationToastsComponent = void 0;
19
+ const React = require("@theia/core/shared/react");
20
+ const core_1 = require("@theia/core");
21
+ const notification_component_1 = require("./notification-component");
22
+ class NotificationToastsComponent extends React.Component {
23
+ constructor(props) {
24
+ super(props);
25
+ this.toDisposeOnUnmount = new core_1.DisposableCollection();
26
+ this.state = {
27
+ toasts: [],
28
+ visibilityState: 'hidden'
29
+ };
30
+ }
31
+ async componentDidMount() {
32
+ this.toDisposeOnUnmount.push(this.props.manager.onUpdated(({ toasts, visibilityState }) => {
33
+ visibilityState = this.props.corePreferences['workbench.silentNotifications'] ? 'hidden' : visibilityState;
34
+ this.setState({
35
+ toasts: toasts.slice(-3),
36
+ visibilityState
37
+ });
38
+ }));
39
+ }
40
+ componentWillUnmount() {
41
+ this.toDisposeOnUnmount.dispose();
42
+ }
43
+ render() {
44
+ return (React.createElement("div", { className: `theia-notifications-container theia-notification-toasts ${this.state.visibilityState === 'toasts' ? 'open' : 'closed'}` },
45
+ React.createElement("div", { className: 'theia-notification-list' }, this.state.toasts.map(notification => React.createElement(notification_component_1.NotificationComponent, { key: notification.messageId, notification: notification, manager: this.props.manager })))));
46
+ }
47
+ }
48
+ exports.NotificationToastsComponent = NotificationToastsComponent;
49
49
  //# sourceMappingURL=notification-toasts-component.js.map
@@ -1,8 +1,8 @@
1
- import { Command } from '@theia/core';
2
- export declare namespace NotificationsCommands {
3
- const TOGGLE: Command;
4
- const SHOW: Command;
5
- const HIDE: Command;
6
- const CLEAR_ALL: Command;
7
- }
1
+ import { Command } from '@theia/core';
2
+ export declare namespace NotificationsCommands {
3
+ const TOGGLE: Command;
4
+ const SHOW: Command;
5
+ const HIDE: Command;
6
+ const CLEAR_ALL: Command;
7
+ }
8
8
  //# sourceMappingURL=notifications-commands.d.ts.map
@@ -1,48 +1,48 @@
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.NotificationsCommands = void 0;
19
- const core_1 = require("@theia/core");
20
- const browser_1 = require("@theia/core/lib/browser");
21
- var NotificationsCommands;
22
- (function (NotificationsCommands) {
23
- const NOTIFICATIONS_CATEGORY = 'Notifications';
24
- const NOTIFICATIONS_CATEGORY_KEY = core_1.nls.getDefaultKey(NOTIFICATIONS_CATEGORY);
25
- NotificationsCommands.TOGGLE = core_1.Command.toLocalizedCommand({
26
- id: 'notifications.commands.toggle',
27
- category: NOTIFICATIONS_CATEGORY,
28
- iconClass: (0, browser_1.codicon)('list-unordered'),
29
- label: 'Toggle Notifications'
30
- }, 'theia/messages/toggleNotifications', NOTIFICATIONS_CATEGORY_KEY);
31
- NotificationsCommands.SHOW = core_1.Command.toDefaultLocalizedCommand({
32
- id: 'notifications.commands.show',
33
- category: NOTIFICATIONS_CATEGORY,
34
- label: 'Show Notifications'
35
- });
36
- NotificationsCommands.HIDE = core_1.Command.toDefaultLocalizedCommand({
37
- id: 'notifications.commands.hide',
38
- category: NOTIFICATIONS_CATEGORY,
39
- label: 'Hide Notifications'
40
- });
41
- NotificationsCommands.CLEAR_ALL = core_1.Command.toDefaultLocalizedCommand({
42
- id: 'notifications.commands.clearAll',
43
- category: NOTIFICATIONS_CATEGORY,
44
- iconClass: (0, browser_1.codicon)('clear-all'),
45
- label: 'Clear All Notifications'
46
- });
47
- })(NotificationsCommands = exports.NotificationsCommands || (exports.NotificationsCommands = {}));
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.NotificationsCommands = void 0;
19
+ const core_1 = require("@theia/core");
20
+ const browser_1 = require("@theia/core/lib/browser");
21
+ var NotificationsCommands;
22
+ (function (NotificationsCommands) {
23
+ const NOTIFICATIONS_CATEGORY = 'Notifications';
24
+ const NOTIFICATIONS_CATEGORY_KEY = core_1.nls.getDefaultKey(NOTIFICATIONS_CATEGORY);
25
+ NotificationsCommands.TOGGLE = core_1.Command.toLocalizedCommand({
26
+ id: 'notifications.commands.toggle',
27
+ category: NOTIFICATIONS_CATEGORY,
28
+ iconClass: (0, browser_1.codicon)('list-unordered'),
29
+ label: 'Toggle Notifications'
30
+ }, 'theia/messages/toggleNotifications', NOTIFICATIONS_CATEGORY_KEY);
31
+ NotificationsCommands.SHOW = core_1.Command.toDefaultLocalizedCommand({
32
+ id: 'notifications.commands.show',
33
+ category: NOTIFICATIONS_CATEGORY,
34
+ label: 'Show Notifications'
35
+ });
36
+ NotificationsCommands.HIDE = core_1.Command.toDefaultLocalizedCommand({
37
+ id: 'notifications.commands.hide',
38
+ category: NOTIFICATIONS_CATEGORY,
39
+ label: 'Hide Notifications'
40
+ });
41
+ NotificationsCommands.CLEAR_ALL = core_1.Command.toDefaultLocalizedCommand({
42
+ id: 'notifications.commands.clearAll',
43
+ category: NOTIFICATIONS_CATEGORY,
44
+ iconClass: (0, browser_1.codicon)('clear-all'),
45
+ label: 'Clear All Notifications'
46
+ });
47
+ })(NotificationsCommands = exports.NotificationsCommands || (exports.NotificationsCommands = {}));
48
48
  //# sourceMappingURL=notifications-commands.js.map
@@ -1,22 +1,22 @@
1
- import { FrontendApplicationContribution, StatusBar, FrontendApplication, KeybindingContribution, KeybindingRegistry, StylingParticipant, ColorTheme, CssStyleCollector } from '@theia/core/lib/browser';
2
- import { CommandContribution, CommandRegistry } from '@theia/core';
3
- import { NotificationManager } from './notifications-manager';
4
- import { NotificationsRenderer } from './notifications-renderer';
5
- import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
6
- import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
7
- export declare class NotificationsContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution, ColorContribution, StylingParticipant {
8
- protected readonly id = "theia-notification-center";
9
- protected readonly manager: NotificationManager;
10
- protected readonly notificationsRenderer: NotificationsRenderer;
11
- protected readonly statusBar: StatusBar;
12
- onStart(_app: FrontendApplication): void;
13
- protected createStatusBarItem(): void;
14
- protected updateStatusBarItem(count?: number): void;
15
- protected getStatusBarItemText(count: number): string;
16
- protected getStatusBarItemTooltip(count: number): string;
17
- registerCommands(commands: CommandRegistry): void;
18
- registerKeybindings(keybindings: KeybindingRegistry): void;
19
- registerColors(colors: ColorRegistry): void;
20
- registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void;
21
- }
1
+ import { FrontendApplicationContribution, StatusBar, FrontendApplication, KeybindingContribution, KeybindingRegistry, StylingParticipant, ColorTheme, CssStyleCollector } from '@theia/core/lib/browser';
2
+ import { CommandContribution, CommandRegistry } from '@theia/core';
3
+ import { NotificationManager } from './notifications-manager';
4
+ import { NotificationsRenderer } from './notifications-renderer';
5
+ import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
6
+ import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
7
+ export declare class NotificationsContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution, ColorContribution, StylingParticipant {
8
+ protected readonly id = "theia-notification-center";
9
+ protected readonly manager: NotificationManager;
10
+ protected readonly notificationsRenderer: NotificationsRenderer;
11
+ protected readonly statusBar: StatusBar;
12
+ onStart(_app: FrontendApplication): void;
13
+ protected createStatusBarItem(): void;
14
+ protected updateStatusBarItem(count?: number): void;
15
+ protected getStatusBarItemText(count: number): string;
16
+ protected getStatusBarItemTooltip(count: number): string;
17
+ registerCommands(commands: CommandRegistry): void;
18
+ registerKeybindings(keybindings: KeybindingRegistry): void;
19
+ registerColors(colors: ColorRegistry): void;
20
+ registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void;
21
+ }
22
22
  //# sourceMappingURL=notifications-contribution.d.ts.map