@frontile/notifications 0.17.0-alpha.2 → 0.17.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/-private/manager.d.ts.map +1 -1
- package/declarations/-private/timer.d.ts.map +1 -1
- package/declarations/components/notification-card.d.ts +14 -13
- package/declarations/components/notification-card.d.ts.map +1 -1
- package/declarations/components/notifications-container.d.ts +22 -21
- package/declarations/components/notifications-container.d.ts.map +1 -1
- package/declarations/index.d.ts +4 -1
- package/declarations/index.d.ts.map +1 -1
- package/declarations/manager-Bfx-JQOm.d.ts +10 -0
- package/declarations/manager-PexDbR1y.d.ts +10 -0
- package/declarations/notification-64b501e5.d.ts +1 -1
- package/declarations/notifications-6S2s2xJm.d.ts +7 -7
- package/declarations/template-registry.d.ts +1 -2
- package/declarations/template-registry.d.ts.map +1 -1
- package/declarations/timer-0a840cef.d.ts +13 -0
- package/declarations/timer-dbe538e6.d.ts +10 -10
- package/dist/components/notification-card.js +2 -2
- package/dist/components/notification-card.js.map +1 -1
- package/dist/components/notifications-container.js +2 -2
- package/dist/components/notifications-container.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/{notifications-02bGKw8W.js → manager-PexDbR1y.js} +3 -29
- package/dist/manager-PexDbR1y.js.map +1 -0
- package/dist/services/notifications.js +30 -3
- package/dist/services/notifications.js.map +1 -1
- package/package.json +18 -18
- package/dist/notifications-02bGKw8W.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/-private/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/-private/manager.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAK1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,oBAAoB;IAC9B,aAAa,EAAE,YAAY,EAAE,CAAM;IAE5C,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,YAAY;IAqBrE,MAAM,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI;IAkBzC,SAAS,IAAI,IAAI;IAMjB,OAAO,CAAC,gBAAgB;CAKzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/-private/timer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/-private/timer.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,OAAO,KAAK;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,UAAQ;IAE1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAa;IAC3B,OAAO,CAAC,KAAK,CAAU;gBAEX,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI;IAM1C,KAAK,IAAI,IAAI;IAQb,KAAK,IAAI,IAAI;IAKb,MAAM,IAAI,IAAI;IAKtB,OAAO,CAAC,KAAK;CAad"}
|
|
@@ -2,21 +2,20 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import type NotificationsService from '../services/notifications';
|
|
3
3
|
import type Notification from '../-private/notification';
|
|
4
4
|
import type { CustomAction, containerPlacement } from '../-private/types';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Args: NotificationCardArgs;
|
|
5
|
+
interface NotificationCardSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
notification: Notification;
|
|
8
|
+
placement: containerPlacement;
|
|
9
|
+
/**
|
|
10
|
+
* Spacing for each notification, in px.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue 16
|
|
13
|
+
*/
|
|
14
|
+
spacing?: number;
|
|
15
|
+
};
|
|
17
16
|
Element: HTMLDivElement;
|
|
18
17
|
}
|
|
19
|
-
|
|
18
|
+
declare class NotificationCard extends Component<NotificationCardSignature> {
|
|
20
19
|
notifications: NotificationsService;
|
|
21
20
|
hasEntered: boolean;
|
|
22
21
|
get styles(): unknown;
|
|
@@ -35,4 +34,6 @@ export default class NotificationCard extends Component<NotificationCardSignatur
|
|
|
35
34
|
closeButton: string;
|
|
36
35
|
};
|
|
37
36
|
}
|
|
37
|
+
export { NotificationCard, type NotificationCardSignature };
|
|
38
|
+
export default NotificationCard;
|
|
38
39
|
//# sourceMappingURL=notification-card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-card.d.ts","sourceRoot":"","sources":["../../src/components/notification-card.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notification-card.d.ts","sourceRoot":"","sources":["../../src/components/notification-card.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAc3C,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,UAAU,yBAAyB;IACjC,IAAI,EAAE;QACJ,YAAY,EAAE,YAAY,CAAC;QAC3B,SAAS,EAAE,kBAAkB,CAAC;QAE9B;;;;WAIG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,cAAM,gBAAiB,SAAQ,SAAS,CAAC,yBAAyB,CAAC;IACxD,aAAa,EAAG,oBAAoB,CAAC;IACrC,UAAU,UAAS;IAE5B,IAAI,MAAM,IAAI,OAAO,CAYpB;IAEO,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAMtC,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAyBxC,aAAa,CACnB,OAAO,EAAE,WAAW,EACpB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,GAC3B,IAAI;IAMC,MAAM,IAAI,IAAI;IAId,KAAK,IAAI,IAAI;IAMb,MAAM,IAAI,IAAI;IAMd,uBAAuB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAKjE,IAAI,OAAO;;;;;;MAeV;CA4DF;AAED,OAAO,EAAE,gBAAgB,EAAE,KAAK,yBAAyB,EAAE,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
|
@@ -2,33 +2,34 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import type NotificationsService from '../services/notifications';
|
|
3
3
|
import type Notification from '../-private/notification';
|
|
4
4
|
import { type containerPlacement } from '../-private/types';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Args: NotificationsContainerArgs;
|
|
5
|
+
interface NotificationsContainerSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
/**
|
|
8
|
+
* The placement of the notifications
|
|
9
|
+
*
|
|
10
|
+
* @defaultValue 'bottom-right'
|
|
11
|
+
*/
|
|
12
|
+
placement?: containerPlacement;
|
|
13
|
+
/**
|
|
14
|
+
* Spacing for each notification, in px.
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue 16
|
|
17
|
+
*/
|
|
18
|
+
spacing?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Custom class name, it will override the default ones using Tailwind Merge library.
|
|
21
|
+
*/
|
|
22
|
+
class?: string;
|
|
23
|
+
};
|
|
25
24
|
Element: HTMLDivElement;
|
|
26
25
|
}
|
|
27
|
-
|
|
26
|
+
declare class NotificationsContainer extends Component<NotificationsContainerSignature> {
|
|
28
27
|
notifications: NotificationsService;
|
|
29
28
|
get isTopPlacement(): boolean;
|
|
30
29
|
get sortedNotifications(): Notification[];
|
|
31
30
|
get classes(): string;
|
|
32
31
|
addSpacing(element: HTMLElement): void;
|
|
33
32
|
}
|
|
33
|
+
export { NotificationsContainer, type NotificationsContainerSignature };
|
|
34
|
+
export default NotificationsContainer;
|
|
34
35
|
//# sourceMappingURL=notifications-container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-container.d.ts","sourceRoot":"","sources":["../../src/components/notifications-container.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifications-container.d.ts","sourceRoot":"","sources":["../../src/components/notifications-container.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAM3C,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,UAAU,+BAA+B;IACvC,IAAI,EAAE;QACJ;;;;WAIG;QACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;QAC/B;;;;WAIG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,cAAM,sBAAuB,SAAQ,SAAS,CAAC,+BAA+B,CAAC;IACpE,aAAa,EAAG,oBAAoB,CAAC;IAE9C,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED,IAAI,mBAAmB,IAAI,YAAY,EAAE,CAMxC;IAED,IAAI,OAAO,WAOV;IAEO,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CAoC/C;AAED,OAAO,EAAE,sBAAsB,EAAE,KAAK,+BAA+B,EAAE,CAAC;AACxE,eAAe,sBAAsB,CAAC"}
|
package/declarations/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import Notification from './-private/notification';
|
|
|
2
2
|
import Timer from './-private/timer';
|
|
3
3
|
import NotificationsService from './services/notifications';
|
|
4
4
|
import type { DefaultConfig, NotificationOptions, CustomAction } from './-private/types';
|
|
5
|
-
export { Notification, Timer
|
|
5
|
+
export { Notification, Timer };
|
|
6
|
+
export type { NotificationsService };
|
|
6
7
|
export type { NotificationOptions, DefaultConfig, CustomAction };
|
|
8
|
+
export * from './components/notification-card';
|
|
9
|
+
export * from './components/notifications-container';
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AAC/B,YAAY,EAAE,oBAAoB,EAAE,CAAC;AACrC,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AACjE,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Notification from "./notification-64b501e5.js";
|
|
2
|
+
import { NotificationOptions } from "./types-16c08671.js";
|
|
3
|
+
declare class NotificationsManager {
|
|
4
|
+
notifications: Notification[];
|
|
5
|
+
add(message: string, options?: NotificationOptions): Notification;
|
|
6
|
+
remove(notification?: Notification): void;
|
|
7
|
+
removeAll(): void;
|
|
8
|
+
private setupAutoRemoval;
|
|
9
|
+
}
|
|
10
|
+
export { NotificationsManager as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Notification from "./notification-64b501e5.js";
|
|
2
|
+
import { NotificationOptions } from "./types-16c08671.js";
|
|
3
|
+
declare class NotificationsManager {
|
|
4
|
+
notifications: Notification[];
|
|
5
|
+
add(message: string, options?: NotificationOptions): Notification;
|
|
6
|
+
remove(notification?: Notification): void;
|
|
7
|
+
removeAll(): void;
|
|
8
|
+
private setupAutoRemoval;
|
|
9
|
+
}
|
|
10
|
+
export { NotificationsManager as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Notification from
|
|
2
|
-
import { NotificationOptions } from
|
|
1
|
+
import Notification from './notification-64b501e5.js';
|
|
2
|
+
import { NotificationOptions } from './types-16c08671.js';
|
|
3
3
|
declare class NotificationsManager {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
notifications: Notification[];
|
|
5
|
+
add(message: string, options?: NotificationOptions): Notification;
|
|
6
|
+
remove(notification?: Notification): void;
|
|
7
|
+
removeAll(): void;
|
|
8
|
+
private setupAutoRemoval;
|
|
9
9
|
}
|
|
10
10
|
export { NotificationsManager as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type NotificationCard from './
|
|
2
|
-
import type NotificationsContainer from './components/notifications-container';
|
|
1
|
+
import type { NotificationCard, NotificationsContainer } from './index';
|
|
3
2
|
export default interface Registry {
|
|
4
3
|
NotificationCard: typeof NotificationCard;
|
|
5
4
|
NotificationsContainer: typeof NotificationsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAExE,MAAM,CAAC,OAAO,WAAW,QAAQ;IAC/B,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CACvD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare class Timer {
|
|
2
|
+
remaining: number;
|
|
3
|
+
isRunning: boolean;
|
|
4
|
+
readonly onFinish: () => void;
|
|
5
|
+
private timer?;
|
|
6
|
+
private start;
|
|
7
|
+
constructor(duration: number, onFinish: () => void);
|
|
8
|
+
clear(): void;
|
|
9
|
+
pause(): void;
|
|
10
|
+
resume(): void;
|
|
11
|
+
private setup;
|
|
12
|
+
}
|
|
13
|
+
export { Timer as default };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
declare class Timer {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
remaining: number;
|
|
3
|
+
isRunning: boolean;
|
|
4
|
+
readonly onFinish: () => void;
|
|
5
|
+
private timer?;
|
|
6
|
+
private start;
|
|
7
|
+
constructor(duration: number, onFinish: () => void);
|
|
8
|
+
clear(): void;
|
|
9
|
+
pause(): void;
|
|
10
|
+
resume(): void;
|
|
11
|
+
private setup;
|
|
12
12
|
}
|
|
13
13
|
export { Timer as default };
|
|
@@ -12,7 +12,7 @@ import { on } from '@ember/modifier';
|
|
|
12
12
|
import { concat, fn } from '@ember/helper';
|
|
13
13
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
14
14
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
15
|
-
import CloseButton from '@frontile/
|
|
15
|
+
import { CloseButton } from '@frontile/buttons';
|
|
16
16
|
import { cssTransition } from 'ember-css-transitions';
|
|
17
17
|
import { useStyles } from '@frontile/theme';
|
|
18
18
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
@@ -121,5 +121,5 @@ let NotificationCard = (_class = (_class2 = class NotificationCard extends Compo
|
|
|
121
121
|
}
|
|
122
122
|
}), _applyDecoratedDescriptor(_class.prototype, "addSpacing", [action], Object.getOwnPropertyDescriptor(_class.prototype, "addSpacing"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "transitionIn", [action], Object.getOwnPropertyDescriptor(_class.prototype, "transitionIn"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "transitionOut", [action], Object.getOwnPropertyDescriptor(_class.prototype, "transitionOut"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "remove", [action], Object.getOwnPropertyDescriptor(_class.prototype, "remove"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "pause", [action], Object.getOwnPropertyDescriptor(_class.prototype, "pause"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "resume", [action], Object.getOwnPropertyDescriptor(_class.prototype, "resume"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleClickCustomAction", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleClickCustomAction"), _class.prototype)), _class);
|
|
123
123
|
|
|
124
|
-
export { NotificationCard as default };
|
|
124
|
+
export { NotificationCard, NotificationCard as default };
|
|
125
125
|
//# sourceMappingURL=notification-card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-card.js","sources":["../../src/components/notification-card.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { fn, concat } from '@ember/helper';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport CloseButton from '@frontile/core/components/close-button';\nimport { cssTransition } from 'ember-css-transitions';\nimport { useStyles } from '@frontile/theme';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport type { CustomAction, containerPlacement } from '../-private/types';\nexport interface NotificationCardArgs {\n notification: Notification;\n placement: containerPlacement;\n /**\n * Spacing for each notification, in px.\n *\n * @defaultValue 16\n */ spacing?: number;\n}\nexport interface NotificationCardSignature {\n Args: NotificationCardArgs;\n Element: HTMLDivElement;\n}\nexport default class NotificationCard extends Component<NotificationCardSignature> {\n @service\n notifications: NotificationsService;\n @tracked\n hasEntered = false;\n get styles(): unknown {\n const styles1 = [\n `transition-duration: ${this.args.notification.transitionDuration}ms`\n ];\n if (!this.hasEntered) {\n styles1.push(`transition-delay: ${this.args.notification.transitionDuration}ms`);\n }\n return htmlSafe(styles1.join('; '));\n }\n @action\n addSpacing(element1: HTMLElement): void {\n if (this.args.placement && this.args.placement.includes('top')) {\n element1.style.marginTop = `${this.args.spacing || 16}px`;\n }\n }\n @action\n transitionIn(element1: HTMLElement): void {\n const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n const expectedHeight1 = element1.offsetHeight + spacing1;\n const duration1 = this.args.notification.transitionDuration / 2;\n requestAnimationFrame(()=>{\n element1.style.height = '0';\n const transition1 = `height ${duration1}ms ease-in ${duration1}ms`;\n element1.style.transition = transition1;\n requestAnimationFrame(()=>{\n element1.style.height = `${expectedHeight1}px`;\n });\n });\n later(this, ()=>{\n this.hasEntered = true;\n }, this.args.notification.transitionDuration);\n }\n @action\n transitionOut(element1: HTMLElement, [isExiting1, ..._1]: boolean[]): void {\n if (isExiting1) {\n element1.style.height = '0';\n }\n }\n @action\n remove(): void {\n this.notifications.remove(this.args.notification);\n }\n @action\n pause(): void {\n if (this.args.notification.timer) {\n this.args.notification.timer.pause();\n }\n }\n @action\n resume(): void {\n if (this.args.notification.timer) {\n this.args.notification.timer.resume();\n }\n }\n @action\n handleClickCustomAction(customAction1: CustomAction): void {\n customAction1.onClick();\n this.remove();\n }\n get classes() {\n const { notificationCard: notificationCard1 } = useStyles();\n let { base: base1, message: message1, customActions: customActions1, customActionButton: customActionButton1, closeButton: closeButton1 } = notificationCard1({\n appearance: this.args.notification.appearance\n });\n return {\n base: base1(),\n message: message1(),\n customActions: customActions1(),\n customActionButton: customActionButton1(),\n closeButton: closeButton1()\n };\n }\n static{\n template(`\n {{! template-lint-disable no-invalid-interactive }}\n {{! template-lint-disable no-unnecessary-concat }}\n {{! template-lint-disable no-inline-styles }}\n {{! template-lint-disable style-concatenation }}\n <div\n {{didInsert this.transitionIn}}\n {{didUpdate this.transitionOut @notification.isRemoving}}\n >\n {{#unless @notification.isRemoving}}\n <div\n {{on \"mouseenter\" this.pause}}\n {{on \"mouseleave\" this.resume}}\n {{cssTransition\n (concat \"notification-transition--slide-from-\" @placement)\n isEnabled=true\n }}\n class={{this.classes.base}}\n style=\"{{this.styles}}\"\n ...attributes\n >\n <div class={{this.classes.message}}>\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction|}}\n <button\n type=\"button\"\n class={{this.classes.customActionButton}}\n {{on \"click\" (fn this.handleClickCustomAction customAction)}}\n >\n {{customAction.label}}\n </button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton\n @onClick={{this.remove}}\n @size=\"sm\"\n @class={{this.classes.closeButton}}\n />\n {{/if}}\n </div>\n {{/unless}}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["NotificationCard","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","styles","styles1","notification","transitionDuration","hasEntered","push","htmlSafe","join","addSpacing","element1","placement","includes","style","marginTop","spacing","transitionIn","spacing1","expectedHeight1","offsetHeight","duration1","requestAnimationFrame","height","transition1","transition","later","transitionOut","isExiting1","_1","remove","notifications","pause","timer","resume","handleClickCustomAction","customAction1","onClick","classes","notificationCard","notificationCard1","useStyles","base","base1","message","message1","customActions","customActions1","customActionButton","customActionButton1","closeButton","closeButton1","appearance","setComponentTemplate","precompileTemplate","scope","didInsert","didUpdate","on","cssTransition","concat","fn","CloseButton","strictMode","_applyDecoratedDescriptor","prototype","service","configurable","enumerable","writable","initializer","tracked","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BqBA,IAAAA,gBAAgB,IAAAC,MAAA,IAAAC,OAAA,GAAtB,MAAMF,gBAAgB,SAASG,SAAS,CAA4B;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,wBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,qBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAK/E,IAAIC,MAAMA,GAAY;AAClB,IAAA,MAAMC,OAAO,GAAG,CACX,CAAA,qBAAA,EAAuB,IAAI,CAACL,IAAI,CAACM,YAAY,CAACC,kBAAmB,CAAA,EAAA,CAAG,CACxE,CAAA;AACD,IAAA,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;AAClBH,MAAAA,OAAO,CAACI,IAAI,CAAE,CAAA,kBAAA,EAAoB,IAAI,CAACT,IAAI,CAACM,YAAY,CAACC,kBAAmB,CAAA,EAAA,CAAG,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AA,IAAAvE,MAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"notification-card.js","sources":["../../src/components/notification-card.gts"],"sourcesContent":["/* eslint-disable ember/no-at-ember-render-modifiers, ember/no-runloop */ import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { fn, concat } from '@ember/helper';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport { CloseButton } from '@frontile/buttons';\nimport { cssTransition } from 'ember-css-transitions';\nimport { useStyles } from '@frontile/theme';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport type { CustomAction, containerPlacement } from '../-private/types';\ninterface NotificationCardSignature {\n Args: {\n notification: Notification;\n placement: containerPlacement;\n /**\n * Spacing for each notification, in px.\n *\n * @defaultValue 16\n */ spacing?: number;\n };\n Element: HTMLDivElement;\n}\nlet NotificationCard = class NotificationCard extends Component<NotificationCardSignature> {\n @service\n notifications: NotificationsService;\n @tracked\n hasEntered = false;\n get styles(): unknown {\n const styles1 = [\n `transition-duration: ${this.args.notification.transitionDuration}ms`\n ];\n if (!this.hasEntered) {\n styles1.push(`transition-delay: ${this.args.notification.transitionDuration}ms`);\n }\n return htmlSafe(styles1.join('; '));\n }\n @action\n addSpacing(element1: HTMLElement): void {\n if (this.args.placement && this.args.placement.includes('top')) {\n element1.style.marginTop = `${this.args.spacing || 16}px`;\n }\n }\n @action\n transitionIn(element1: HTMLElement): void {\n const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n const expectedHeight1 = element1.offsetHeight + spacing1;\n const duration1 = this.args.notification.transitionDuration / 2;\n requestAnimationFrame(()=>{\n element1.style.height = '0';\n const transition1 = `height ${duration1}ms ease-in ${duration1}ms`;\n element1.style.transition = transition1;\n requestAnimationFrame(()=>{\n element1.style.height = `${expectedHeight1}px`;\n });\n });\n later(this, ()=>{\n this.hasEntered = true;\n }, this.args.notification.transitionDuration);\n }\n @action\n transitionOut(element1: HTMLElement, [isExiting1, ..._1]: boolean[]): void {\n if (isExiting1) {\n element1.style.height = '0';\n }\n }\n @action\n remove(): void {\n this.notifications.remove(this.args.notification);\n }\n @action\n pause(): void {\n if (this.args.notification.timer) {\n this.args.notification.timer.pause();\n }\n }\n @action\n resume(): void {\n if (this.args.notification.timer) {\n this.args.notification.timer.resume();\n }\n }\n @action\n handleClickCustomAction(customAction1: CustomAction): void {\n customAction1.onClick();\n this.remove();\n }\n get classes() {\n const { notificationCard: notificationCard1 } = useStyles();\n let { base: base1, message: message1, customActions: customActions1, customActionButton: customActionButton1, closeButton: closeButton1 } = notificationCard1({\n appearance: this.args.notification.appearance\n });\n return {\n base: base1(),\n message: message1(),\n customActions: customActions1(),\n customActionButton: customActionButton1(),\n closeButton: closeButton1()\n };\n }\n static{\n template(`\n {{! template-lint-disable no-invalid-interactive }}\n {{! template-lint-disable no-unnecessary-concat }}\n {{! template-lint-disable no-inline-styles }}\n {{! template-lint-disable style-concatenation }}\n <div\n {{didInsert this.transitionIn}}\n {{didUpdate this.transitionOut @notification.isRemoving}}\n >\n {{#unless @notification.isRemoving}}\n <div\n {{on \"mouseenter\" this.pause}}\n {{on \"mouseleave\" this.resume}}\n {{cssTransition\n (concat \"notification-transition--slide-from-\" @placement)\n isEnabled=true\n }}\n class={{this.classes.base}}\n style=\"{{this.styles}}\"\n ...attributes\n >\n <div class={{this.classes.message}}>\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction|}}\n <button\n type=\"button\"\n class={{this.classes.customActionButton}}\n {{on \"click\" (fn this.handleClickCustomAction customAction)}}\n >\n {{customAction.label}}\n </button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton\n @onClick={{this.remove}}\n @size=\"sm\"\n @class={{this.classes.closeButton}}\n />\n {{/if}}\n </div>\n {{/unless}}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n};\nexport { NotificationCard, NotificationCardSignature };\nexport default NotificationCard;\n"],"names":["NotificationCard","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","styles","styles1","notification","transitionDuration","hasEntered","push","htmlSafe","join","addSpacing","element1","placement","includes","style","marginTop","spacing","transitionIn","spacing1","expectedHeight1","offsetHeight","duration1","requestAnimationFrame","height","transition1","transition","later","transitionOut","isExiting1","_1","remove","notifications","pause","timer","resume","handleClickCustomAction","customAction1","onClick","classes","notificationCard","notificationCard1","useStyles","base","base1","message","message1","customActions","customActions1","customActionButton","customActionButton1","closeButton","closeButton1","appearance","setComponentTemplate","precompileTemplate","scope","didInsert","didUpdate","on","cssTransition","concat","fn","CloseButton","strictMode","_applyDecoratedDescriptor","prototype","service","configurable","enumerable","writable","initializer","tracked","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BIA,IAAAA,gBAAgB,IAAAC,MAAA,IAAAC,OAAA,GAAG,MAAMF,gBAAgB,SAASG,SAAS,CAA4B;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,wBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,qBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAKvF,IAAIC,MAAMA,GAAY;AAClB,IAAA,MAAMC,OAAO,GAAG,CACX,CAAA,qBAAA,EAAuB,IAAI,CAACL,IAAI,CAACM,YAAY,CAACC,kBAAmB,CAAA,EAAA,CAAG,CACxE,CAAA;AACD,IAAA,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;AACl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,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAhF,MAAA,CAAAuE,SAAA,8BAAAvE,MAAA,CAAAuE,SAAA,CAAA,GAAAvE,MAAA;;;;"}
|
|
@@ -7,7 +7,7 @@ import { inject } from '@ember/service';
|
|
|
7
7
|
import { action } from '@ember/object';
|
|
8
8
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
9
9
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
10
|
-
import NotificationCard from './notification-card.js';
|
|
10
|
+
import { NotificationCard } from './notification-card.js';
|
|
11
11
|
import { useStyles } from '@frontile/theme';
|
|
12
12
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
13
|
import { setComponentTemplate } from '@ember/component';
|
|
@@ -57,5 +57,5 @@ let NotificationsContainer = (_class = (_class2 = class NotificationsContainer e
|
|
|
57
57
|
initializer: null
|
|
58
58
|
}), _applyDecoratedDescriptor(_class.prototype, "addSpacing", [action], Object.getOwnPropertyDescriptor(_class.prototype, "addSpacing"), _class.prototype)), _class);
|
|
59
59
|
|
|
60
|
-
export { NotificationsContainer as default };
|
|
60
|
+
export { NotificationsContainer, NotificationsContainer as default };
|
|
61
61
|
//# sourceMappingURL=notifications-container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-container.js","sources":["../../src/components/notifications-container.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { inject as service } from '@ember/service';\nimport { action } from '@ember/object';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport NotificationCard from './notification-card';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport { type containerPlacement } from '../-private/types';\nimport { useStyles } from '@frontile/theme';\
|
|
1
|
+
{"version":3,"file":"notifications-container.js","sources":["../../src/components/notifications-container.gts"],"sourcesContent":["/* eslint-disable ember/no-at-ember-render-modifiers */ import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { inject as service } from '@ember/service';\nimport { action } from '@ember/object';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport NotificationCard from './notification-card';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport { type containerPlacement } from '../-private/types';\nimport { useStyles } from '@frontile/theme';\ninterface NotificationsContainerSignature {\n Args: {\n /**\n * The placement of the notifications\n *\n * @defaultValue 'bottom-right'\n */ placement?: containerPlacement;\n /**\n * Spacing for each notification, in px.\n *\n * @defaultValue 16\n */ spacing?: number;\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */ class?: string;\n };\n Element: HTMLDivElement;\n}\nlet NotificationsContainer = class NotificationsContainer extends Component<NotificationsContainerSignature> {\n @service\n notifications: NotificationsService;\n get isTopPlacement(): boolean {\n return !!(this.args.placement && this.args.placement.includes('top'));\n }\n get sortedNotifications(): Notification[] {\n if (this.isTopPlacement) {\n return this.notifications.notifications.slice().reverse();\n } else {\n return this.notifications.notifications;\n }\n }\n get classes() {\n const { notificationsContainer: notificationsContainer1 } = useStyles();\n return notificationsContainer1({\n placement: this.args.placement,\n class: this.args.class\n });\n }\n @action\n addSpacing(element1: HTMLElement): void {\n const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n if (this.isTopPlacement) {\n element1.style.marginTop = `${spacing1}px`;\n }\n }\n static{\n template(`\n {{#if this.sortedNotifications}}\n <div\n {{didInsert this.addSpacing}}\n {{didUpdate this.addSpacing @spacing @placement}}\n class={{this.classes}}\n role=\"alert\"\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n ...attributes\n >\n {{#each this.sortedNotifications as |notification|}}\n <NotificationCard\n @spacing={{@spacing}}\n @placement={{if @placement @placement \"bottom-right\"}}\n @notification={{notification}}\n />\n {{/each}}\n </div>\n {{/if}}\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n};\nexport { NotificationsContainer, NotificationsContainerSignature };\nexport default NotificationsContainer;\n"],"names":["NotificationsContainer","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","isTopPlacement","placement","includes","sortedNotifications","notifications","slice","reverse","classes","notificationsContainer","notificationsContainer1","useStyles","class","addSpacing","element1","spacing1","spacing","style","marginTop","setComponentTemplate","precompileTemplate","scope","didInsert","didUpdate","NotificationCard","strictMode","_applyDecoratedDescriptor","prototype","service","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;AA6BIA,IAAAA,sBAAsB,IAAAC,MAAA,IAAAC,OAAA,GAAG,MAAMF,sBAAsB,SAASG,SAAS,CAAkC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,wBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAGzG,IAAIC,cAAcA,GAAY;AAC1B,IAAA,OAAO,CAAC,EAAE,IAAI,CAACH,IAAI,CAACI,SAAS,IAAI,IAAI,CAACJ,IAAI,CAACI,SAAS,CAACC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;AACzE,GAAA;EACA,IAAIC,mBAAmBA,GAAmB;IACtC,IAAI,IAAI,CAACH,cAAc,EAAE;AACrB,MAAA,OAAO,IAAI,CAACI,aAAa,CAACA,aAAa,CAACC,KAAK,EAAE,CAACC,OAAO,EAAE,CAAA;AAC7D,KAAC,MAAM;AACH,MAAA,OAAO,IAAI,CAACF,aAAa,CAACA,aAAa,CAAA;AAC3C,KAAA;AACJ,GAAA;EACA,IAAIG,OAAOA,GAAG;IACV,MAAM;AAAEC,MAAAA,sBAAsB,EAAEC,uBAAAA;KAAyB,GAAGC,SAAS,EAAE,CAAA;AACvE,IAAA,OAAOD,uBAAuB,CAAC;AAC3BR,MAAAA,SAAS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-PexDbR1y.js';
|
|
2
|
+
import '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
+
import '@ember/service';
|
|
4
|
+
export { NotificationCard } from './components/notification-card.js';
|
|
5
|
+
export { NotificationsContainer } from './components/notifications-container.js';
|
|
2
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import Service from '@ember/service';
|
|
3
1
|
import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
3
|
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
|
|
5
4
|
import '@babel/runtime/helpers/esm/initializerWarningHelper';
|
|
6
5
|
import { tracked } from '@glimmer/tracking';
|
|
@@ -156,30 +155,5 @@ let NotificationsManager = (_class = class NotificationsManager {
|
|
|
156
155
|
}
|
|
157
156
|
})), _class);
|
|
158
157
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
super(...args);
|
|
162
|
-
_defineProperty(this, "manager", new NotificationsManager());
|
|
163
|
-
_defineProperty(this, "add", (message, options) => {
|
|
164
|
-
return this.manager.add(message, options);
|
|
165
|
-
});
|
|
166
|
-
_defineProperty(this, "remove", notification => {
|
|
167
|
-
this.manager.remove(notification);
|
|
168
|
-
});
|
|
169
|
-
_defineProperty(this, "removeAll", () => {
|
|
170
|
-
this.manager.removeAll();
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
get notifications() {
|
|
174
|
-
return this.manager.notifications;
|
|
175
|
-
}
|
|
176
|
-
willDestroy() {
|
|
177
|
-
this.removeAll();
|
|
178
|
-
super.willDestroy();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// DO NOT DELETE: this is how TypeScript knows how to look up your services.
|
|
183
|
-
|
|
184
|
-
export { Notification as N, Timer as T, NotificationsService as a };
|
|
185
|
-
//# sourceMappingURL=notifications-02bGKw8W.js.map
|
|
158
|
+
export { Notification as N, Timer as T, NotificationsManager as a };
|
|
159
|
+
//# sourceMappingURL=manager-PexDbR1y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager-PexDbR1y.js","sources":["../src/-private/timer.ts","../src/-private/get-config.ts","../src/-private/notification.ts","../src/-private/manager.ts"],"sourcesContent":["/* eslint-disable ember/no-runloop */\nimport { tracked } from '@glimmer/tracking';\nimport { later, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport { action } from '@ember/object';\n\nexport default class Timer {\n @tracked remaining: number;\n @tracked isRunning = true;\n\n readonly onFinish: () => void;\n private timer?: EmberTimer;\n private start!: number;\n\n constructor(duration: number, onFinish: () => void) {\n this.remaining = duration;\n this.onFinish = onFinish;\n this.setup();\n }\n\n @action clear(): void {\n this.isRunning = false;\n\n if (this.timer) {\n cancel(this.timer);\n }\n }\n\n @action pause(): void {\n this.clear();\n this.remaining -= Date.now() - this.start;\n }\n\n @action resume(): void {\n this.clear();\n this.setup();\n }\n\n private setup(): void {\n this.start = Date.now();\n this.isRunning = true;\n\n this.timer = later(\n this,\n () => {\n this.onFinish();\n this.isRunning = false;\n },\n this.remaining\n );\n }\n}\n","import config from 'ember-get-config';\nimport { get } from '@ember/object';\nimport type { DefaultConfig } from './types';\n\nexport function getConfigOption<T extends keyof DefaultConfig>(\n key: T,\n defaultValue: NonNullable<DefaultConfig[T]>\n): NonNullable<DefaultConfig[T]> {\n const value = get(\n config['@frontile/notifications'] || ({} as never),\n key as never\n );\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n}\n","import { tracked } from '@glimmer/tracking';\nimport Timer from './timer';\nimport { getConfigOption } from './get-config';\nimport type { NotificationOptions, CustomAction } from './types';\n\nexport default class Notification {\n readonly message: string;\n readonly transitionDuration: number;\n readonly appearance: NonNullable<NotificationOptions['appearance']>;\n readonly customActions?: CustomAction[];\n readonly allowClosing: boolean;\n readonly duration: number;\n\n @tracked timer?: Timer;\n @tracked isRemoving = false;\n\n constructor(message: string, options: NotificationOptions = {}) {\n this.message = message;\n this.appearance =\n options.appearance || getConfigOption('appearance', 'info');\n this.customActions = options.customActions;\n this.duration = options.duration || getConfigOption('duration', 5000);\n this.transitionDuration =\n typeof options.transitionDuration !== 'undefined'\n ? options.transitionDuration\n : getConfigOption('transitionDuration', 200);\n\n if (options.allowClosing === false) {\n this.allowClosing = false;\n } else {\n this.allowClosing = true;\n }\n }\n\n remove(): void {\n this.isRemoving = true;\n\n if (this.timer) {\n this.timer.clear();\n }\n }\n}\n","/* eslint-disable ember/no-runloop */\nimport Notification from './notification';\nimport Timer from './timer';\nimport { getConfigOption } from './get-config';\nimport { tracked } from '@glimmer/tracking';\nimport { later } from '@ember/runloop';\nimport type { NotificationOptions } from './types';\n\nexport default class NotificationsManager {\n @tracked notifications: Notification[] = [];\n\n add(message: string, options: NotificationOptions = {}): Notification {\n const notification = new Notification(message, options);\n this.notifications = [...this.notifications, notification];\n\n let preserve =\n typeof options.preserve === 'undefined'\n ? getConfigOption('preserve', false)\n : options.preserve;\n\n // if default config has set skipTimer to true, we will preserve the\n // notification, therefore skiping the timer\n if (getConfigOption('skipTimer', false) === true) {\n preserve = true;\n }\n\n if (preserve === false) {\n this.setupAutoRemoval(notification, notification.duration);\n }\n return notification;\n }\n\n remove(notification?: Notification): void {\n if (!notification) {\n return;\n }\n\n notification.remove();\n\n later(\n this,\n () => {\n this.notifications = this.notifications.filter((n) => {\n return n !== notification;\n });\n },\n notification.transitionDuration\n );\n }\n\n removeAll(): void {\n this.notifications.forEach((notification) => {\n this.remove(notification);\n });\n }\n\n private setupAutoRemoval(notification: Notification, duration: number): void {\n notification.timer = new Timer(duration, () => {\n this.remove(notification);\n });\n }\n}\n"],"names":["Timer","_class","constructor","duration","onFinish","_initializerDefineProperty","_descriptor","_descriptor2","_defineProperty","remaining","setup","clear","isRunning","timer","cancel","pause","Date","now","start","resume","later","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","getConfigOption","key","defaultValue","value","get","config","undefined","Notification","message","options","appearance","customActions","transitionDuration","allowClosing","remove","isRemoving","NotificationsManager","add","notification","notifications","preserve","setupAutoRemoval","filter","n","removeAll","forEach"],"mappings":";;;;;;;;;;AAIuC,IAElBA,KAAK,IAAAC,QAAA,GAAX,MAAMD,KAAK,CAAC;AAQzBE,EAAAA,WAAWA,CAACC,QAAgB,EAAEC,QAAoB,EAAE;AAAAC,IAAAA,0BAAA,oBAAAC,aAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,oBAAAE,cAAA,EAAA,IAAA,CAAA,CAAA;IAAAC,eAAA,CAAA,IAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAClD,IAAI,CAACC,SAAS,GAAGN,QAAQ,CAAA;IACzB,IAAI,CAACC,QAAQ,GAAGA,QAAQ,CAAA;IACxB,IAAI,CAACM,KAAK,EAAE,CAAA;AACd,GAAA;AAEQC,EAAAA,KAAKA,GAAS;IACpB,IAAI,CAACC,SAAS,GAAG,KAAK,CAAA;IAEtB,IAAI,IAAI,CAACC,KAAK,EAAE;AACdC,MAAAA,MAAM,CAAC,IAAI,CAACD,KAAK,CAAC,CAAA;AACpB,KAAA;AACF,GAAA;AAEQE,EAAAA,KAAKA,GAAS;IACpB,IAAI,CAACJ,KAAK,EAAE,C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I,CAAC8B,aAAa,GAAG,IAAI,CAACA,aAAa,CAACG,MAAM,CAAEC,CAAC,IAAK;QACpD,OAAOA,CAAC,KAAKL,YAAY,CAAA;AAC3B,OAAC,CAAC,CAAA;AACJ,KAAC,EACDA,YAAY,CAACN,kBACf,CAAC,CAAA;AACH,GAAA;AAEAY,EAAAA,SAASA,GAAS;AAChB,IAAA,IAAI,CAACL,aAAa,CAACM,OAAO,CAAEP,YAAY,IAAK;AAC3C,MAAA,IAAI,CAACJ,MAAM,CAACI,YAAY,CAAC,CAAA;AAC3B,KAAC,CAAC,CAAA;AACJ,GAAA;AAEQG,EAAAA,gBAAgBA,CAACH,YAA0B,EAAE9C,QAAgB,EAAQ;IAC3E8C,YAAY,CAACpC,KAAK,GAAG,IAAIb,KAAK,CAACG,QAAQ,EAAE,MAAM;AAC7C,MAAA,IAAI,CAAC0C,MAAM,CAACI,YAAY,CAAC,CAAA;AAC3B,KAAC,CAAC,CAAA;AACJ,GAAA;AACF,CAAC,GAAA3C,WAAA,GAAAe,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EAAA,eAAA,EAAA,CApDEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAiC,EAAE,CAAA;AAAA,GAAA;AAAA,CAAA,CAAA,GAAA1B,MAAA;;;;"}
|
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import '@ember/service';
|
|
3
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import Service from '@ember/service';
|
|
3
|
+
import { a as NotificationsManager } from '../manager-PexDbR1y.js';
|
|
4
|
+
|
|
5
|
+
class NotificationsService extends Service {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
_defineProperty(this, "manager", new NotificationsManager());
|
|
9
|
+
_defineProperty(this, "add", (message, options) => {
|
|
10
|
+
return this.manager.add(message, options);
|
|
11
|
+
});
|
|
12
|
+
_defineProperty(this, "remove", notification => {
|
|
13
|
+
this.manager.remove(notification);
|
|
14
|
+
});
|
|
15
|
+
_defineProperty(this, "removeAll", () => {
|
|
16
|
+
this.manager.removeAll();
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
get notifications() {
|
|
20
|
+
return this.manager.notifications;
|
|
21
|
+
}
|
|
22
|
+
willDestroy() {
|
|
23
|
+
this.removeAll();
|
|
24
|
+
super.willDestroy();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// DO NOT DELETE: this is how TypeScript knows how to look up your services.
|
|
29
|
+
|
|
30
|
+
export { NotificationsService as default };
|
|
4
31
|
//# sourceMappingURL=notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
1
|
+
{"version":3,"file":"notifications.js","sources":["../../src/services/notifications.ts"],"sourcesContent":["import Service from '@ember/service';\nimport Notification from '../-private/notification';\nimport NotificationsManager from '../-private/manager';\nimport type { NotificationOptions } from '../-private/types';\n\nexport default class NotificationsService extends Service {\n manager = new NotificationsManager();\n\n get notifications(): Notification[] {\n return this.manager.notifications;\n }\n\n add = (message: string, options?: NotificationOptions): Notification => {\n return this.manager.add(message, options);\n };\n\n remove = (notification?: Notification): void => {\n this.manager.remove(notification);\n };\n\n removeAll = (): void => {\n this.manager.removeAll();\n };\n\n willDestroy(): void {\n this.removeAll();\n super.willDestroy();\n }\n}\n\n// DO NOT DELETE: this is how TypeScript knows how to look up your services.\ndeclare module '@ember/service' {\n interface Registry {\n notifications: NotificationsService;\n }\n}\n"],"names":["NotificationsService","Service","constructor","args","_defineProperty","NotificationsManager","message","options","manager","add","notification","remove","removeAll","notifications","willDestroy"],"mappings":";;;;AAKe,MAAMA,oBAAoB,SAASC,OAAO,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,eAAA,CAC9C,IAAA,EAAA,SAAA,EAAA,IAAIC,oBAAoB,EAAE,CAAA,CAAA;AAAAD,IAAAA,eAAA,CAM9B,IAAA,EAAA,KAAA,EAAA,CAACE,OAAe,EAAEC,OAA6B,KAAmB;MACtE,OAAO,IAAI,CAACC,OAAO,CAACC,GAAG,CAACH,OAAO,EAAEC,OAAO,CAAC,CAAA;KAC1C,CAAA,CAAA;IAAAH,eAAA,CAAA,IAAA,EAAA,QAAA,EAESM,YAA2B,IAAW;AAC9C,MAAA,IAAI,CAACF,OAAO,CAACG,MAAM,CAACD,YAAY,CAAC,CAAA;KAClC,CAAA,CAAA;AAAAN,IAAAA,eAAA,oBAEW,MAAY;AACtB,MAAA,IAAI,CAACI,OAAO,CAACI,SAAS,EAAE,CAAA;KACzB,CAAA,CAAA;AAAA,GAAA;EAdD,IAAIC,aAAaA,GAAmB;AAClC,IAAA,OAAO,IAAI,CAACL,OAAO,CAACK,aAAa,CAAA;AACnC,GAAA;AAcAC,EAAAA,WAAWA,GAAS;IAClB,IAAI,CAACF,SAAS,EAAE,CAAA;IAChB,KAAK,CAACE,WAAW,EAAE,CAAA;AACrB,GAAA;AACF,CAAA;;AAEA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontile/notifications",
|
|
3
|
-
"version": "0.17.0-alpha.
|
|
3
|
+
"version": "0.17.0-alpha.5",
|
|
4
4
|
"description": "Component Library for Ember Octane apps: Notifications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -42,35 +42,35 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@ember/render-modifiers": "^2.1.0",
|
|
44
44
|
"@embroider/addon-shim": "^1.8.7",
|
|
45
|
-
"@frontile/
|
|
46
|
-
"@frontile/theme": "
|
|
47
|
-
"ember-auto-import": "^2.
|
|
45
|
+
"@frontile/buttons": "0.17.0-alpha.5",
|
|
46
|
+
"@frontile/theme": "0.17.0-alpha.5",
|
|
47
|
+
"ember-auto-import": "^2.7.2",
|
|
48
48
|
"ember-css-transitions": "^4.4.0",
|
|
49
49
|
"ember-get-config": "^2.1.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@babel/core": "7.23.
|
|
52
|
+
"@babel/core": "7.23.7",
|
|
53
53
|
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
54
|
-
"@babel/plugin-proposal-decorators": "7.23.
|
|
54
|
+
"@babel/plugin-proposal-decorators": "7.23.7",
|
|
55
55
|
"@babel/plugin-transform-class-static-block": "^7.23.4",
|
|
56
56
|
"@babel/preset-typescript": "7.23.3",
|
|
57
57
|
"@embroider/addon-dev": "4.1.3",
|
|
58
58
|
"@embroider/addon-shim": "^1.8.6",
|
|
59
59
|
"@glimmer/component": "^1.1.2",
|
|
60
60
|
"@glimmer/tracking": "^1.1.2",
|
|
61
|
-
"@glint/core": "1.
|
|
62
|
-
"@glint/environment-ember-loose": "1.
|
|
63
|
-
"@glint/environment-ember-template-imports": "1.
|
|
64
|
-
"@glint/template": "1.
|
|
61
|
+
"@glint/core": "1.3.0",
|
|
62
|
+
"@glint/environment-ember-loose": "1.3.0",
|
|
63
|
+
"@glint/environment-ember-template-imports": "1.3.0",
|
|
64
|
+
"@glint/template": "1.3.0",
|
|
65
65
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
66
|
-
"@tsconfig/ember": "^3.0.
|
|
67
|
-
"babel-plugin-ember-template-compilation": "^2.
|
|
68
|
-
"concurrently": "^8.2.
|
|
66
|
+
"@tsconfig/ember": "^3.0.3",
|
|
67
|
+
"babel-plugin-ember-template-compilation": "^2.2.1",
|
|
68
|
+
"concurrently": "^8.2.2",
|
|
69
69
|
"ember-source": "^5.5.0",
|
|
70
|
-
"rollup": "^4.9.
|
|
71
|
-
"rollup-plugin-ts": "^3.
|
|
72
|
-
"tailwindcss": "^3.
|
|
73
|
-
"typescript": "^5.
|
|
70
|
+
"rollup": "^4.9.6",
|
|
71
|
+
"rollup-plugin-ts": "^3.4.5",
|
|
72
|
+
"tailwindcss": "^3.4.1",
|
|
73
|
+
"typescript": "^5.3.3"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": "10.* || >= 12"
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
]
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "7e01670d8d6f8f3f807ab292f5a64694bcbc1fc7"
|
|
113
113
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-02bGKw8W.js","sources":["../src/-private/timer.ts","../src/-private/get-config.ts","../src/-private/notification.ts","../src/-private/manager.ts","../src/services/notifications.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { later, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport { action } from '@ember/object';\n\nexport default class Timer {\n @tracked remaining: number;\n @tracked isRunning = true;\n\n readonly onFinish: () => void;\n private timer?: EmberTimer;\n private start!: number;\n\n constructor(duration: number, onFinish: () => void) {\n this.remaining = duration;\n this.onFinish = onFinish;\n this.setup();\n }\n\n @action clear(): void {\n this.isRunning = false;\n\n if (this.timer) {\n cancel(this.timer);\n }\n }\n\n @action pause(): void {\n this.clear();\n this.remaining -= Date.now() - this.start;\n }\n\n @action resume(): void {\n this.clear();\n this.setup();\n }\n\n private setup(): void {\n this.start = Date.now();\n this.isRunning = true;\n\n this.timer = later(\n this,\n () => {\n this.onFinish();\n this.isRunning = false;\n },\n this.remaining\n );\n }\n}\n","import config from 'ember-get-config';\nimport { get } from '@ember/object';\nimport type { DefaultConfig } from './types';\n\nexport function getConfigOption<T extends keyof DefaultConfig>(\n key: T,\n defaultValue: NonNullable<DefaultConfig[T]>\n): NonNullable<DefaultConfig[T]> {\n const value = get(\n config['@frontile/notifications'] || ({} as never),\n key as never\n );\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n}\n","import { tracked } from '@glimmer/tracking';\nimport Timer from './timer';\nimport { getConfigOption } from './get-config';\nimport type { NotificationOptions, CustomAction } from './types';\n\nexport default class Notification {\n readonly message: string;\n readonly transitionDuration: number;\n readonly appearance: NonNullable<NotificationOptions['appearance']>;\n readonly customActions?: CustomAction[];\n readonly allowClosing: boolean;\n readonly duration: number;\n\n @tracked timer?: Timer;\n @tracked isRemoving = false;\n\n constructor(message: string, options: NotificationOptions = {}) {\n this.message = message;\n this.appearance =\n options.appearance || getConfigOption('appearance', 'info');\n this.customActions = options.customActions;\n this.duration = options.duration || getConfigOption('duration', 5000);\n this.transitionDuration =\n typeof options.transitionDuration !== 'undefined'\n ? options.transitionDuration\n : getConfigOption('transitionDuration', 200);\n\n if (options.allowClosing === false) {\n this.allowClosing = false;\n } else {\n this.allowClosing = true;\n }\n }\n\n remove(): void {\n this.isRemoving = true;\n\n if (this.timer) {\n this.timer.clear();\n }\n }\n}\n","import Notification from './notification';\nimport Timer from './timer';\nimport { getConfigOption } from './get-config';\nimport { tracked } from '@glimmer/tracking';\nimport { later } from '@ember/runloop';\nimport type { NotificationOptions } from './types';\n\nexport default class NotificationsManager {\n @tracked notifications: Notification[] = [];\n\n add(message: string, options: NotificationOptions = {}): Notification {\n const notification = new Notification(message, options);\n this.notifications = [...this.notifications, notification];\n\n let preserve =\n typeof options.preserve === 'undefined'\n ? getConfigOption('preserve', false)\n : options.preserve;\n\n // if default config has set skipTimer to true, we will preserve the\n // notification, therefore skiping the timer\n if (getConfigOption('skipTimer', false) === true) {\n preserve = true;\n }\n\n if (preserve === false) {\n this.setupAutoRemoval(notification, notification.duration);\n }\n return notification;\n }\n\n remove(notification?: Notification): void {\n if (!notification) {\n return;\n }\n\n notification.remove();\n\n later(\n this,\n () => {\n this.notifications = this.notifications.filter((n) => {\n return n !== notification;\n });\n },\n notification.transitionDuration\n );\n }\n\n removeAll(): void {\n this.notifications.forEach((notification) => {\n this.remove(notification);\n });\n }\n\n private setupAutoRemoval(notification: Notification, duration: number): void {\n notification.timer = new Timer(duration, () => {\n this.remove(notification);\n });\n }\n}\n","import Service from '@ember/service';\nimport Notification from '../-private/notification';\nimport NotificationsManager from '../-private/manager';\nimport type { NotificationOptions } from '../-private/types';\n\nexport default class NotificationsService extends Service {\n manager = new NotificationsManager();\n\n get notifications(): Notification[] {\n return this.manager.notifications;\n }\n\n add = (message: string, options?: NotificationOptions): Notification => {\n return this.manager.add(message, options);\n };\n\n remove = (notification?: Notification): void => {\n this.manager.remove(notification);\n };\n\n removeAll = (): void => {\n this.manager.removeAll();\n };\n\n willDestroy(): void {\n this.removeAll();\n super.willDestroy();\n }\n}\n\n// DO NOT DELETE: this is how TypeScript knows how to look up your services.\ndeclare module '@ember/service' {\n interface Registry {\n notifications: NotificationsService;\n }\n}\n"],"names":["Timer","_class","constructor","duration","onFinish","_initializerDefineProperty","_descriptor","_descriptor2","_defineProperty","remaining","setup","clear","isRunning","timer","cancel","pause","Date","now","start","resume","later","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","getConfigOption","key","defaultValue","value","get","config","undefined","Notification","message","options","appearance","customActions","transitionDuration","allowClosing","remove","isRemoving","NotificationsManager","add","notification","notifications","preserve","setupAutoRemoval","filter","n","removeAll","forEach","NotificationsService","Service","args","manager","willDestroy"],"mappings":";;;;;;;;;;;AAGuC,IAElBA,KAAK,IAAAC,QAAA,GAAX,MAAMD,KAAK,CAAC;AAQzBE,EAAAA,WAAWA,CAACC,QAAgB,EAAEC,QAAoB,EAAE;AAAAC,IAAAA,0BAAA,oBAAAC,aAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,oBAAAE,cAAA,EAAA,IAAA,CAAA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