@frontile/notifications 0.15.0 → 0.16.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/addon-main.js +4 -0
  2. package/{-private → declarations/-private}/get-config.d.ts +2 -1
  3. package/declarations/-private/get-config.d.ts.map +1 -0
  4. package/{-private → declarations/-private}/manager.d.ts +2 -1
  5. package/declarations/-private/manager.d.ts.map +1 -0
  6. package/{-private → declarations/-private}/notification.d.ts +2 -1
  7. package/declarations/-private/notification.d.ts.map +1 -0
  8. package/{-private → declarations/-private}/timer.d.ts +1 -0
  9. package/declarations/-private/timer.d.ts.map +1 -0
  10. package/{-private → declarations/-private}/types.d.ts +2 -0
  11. package/declarations/-private/types.d.ts.map +1 -0
  12. package/{components → declarations/components}/notification-card.d.ts +6 -4
  13. package/declarations/components/notification-card.d.ts.map +1 -0
  14. package/{components → declarations/components}/notifications-container.d.ts +6 -4
  15. package/declarations/components/notifications-container.d.ts.map +1 -0
  16. package/declarations/get-config-a59d13fc.d.ts +3 -0
  17. package/{index.d.ts → declarations/index.d.ts} +1 -0
  18. package/declarations/index.d.ts.map +1 -0
  19. package/declarations/notification-64b501e5.d.ts +15 -0
  20. package/declarations/notifications-02bGKw8W.d.ts +10 -0
  21. package/declarations/notifications-6S2s2xJm.d.ts +10 -0
  22. package/{services → declarations/services}/notifications.d.ts +4 -1
  23. package/declarations/services/notifications.d.ts.map +1 -0
  24. package/declarations/template-registry.d.ts +7 -0
  25. package/declarations/template-registry.d.ts.map +1 -0
  26. package/declarations/timer-dbe538e6.d.ts +13 -0
  27. package/declarations/types-16c08671.d.ts +55 -0
  28. package/dist/_app_/components/notification-card.js +1 -0
  29. package/dist/_app_/components/notifications-container.js +1 -0
  30. package/dist/_app_/services/notifications.js +1 -0
  31. package/dist/components/notification-card.js +105 -0
  32. package/dist/components/notification-card.js.map +1 -0
  33. package/dist/components/notifications-container.js +53 -0
  34. package/dist/components/notifications-container.js.map +1 -0
  35. package/dist/index.js +2 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/notifications-02bGKw8W.js +185 -0
  38. package/dist/notifications-02bGKw8W.js.map +1 -0
  39. package/dist/services/notifications.js +4 -0
  40. package/dist/services/notifications.js.map +1 -0
  41. package/dist/template-registry.js +2 -0
  42. package/dist/template-registry.js.map +1 -0
  43. package/package.json +78 -45
  44. package/addon/-private/get-config.ts +0 -19
  45. package/addon/-private/manager.ts +0 -61
  46. package/addon/-private/notification.ts +0 -42
  47. package/addon/-private/timer.ts +0 -51
  48. package/addon/-private/types.ts +0 -66
  49. package/addon/components/notification-card.hbs +0 -44
  50. package/addon/components/notification-card.ts +0 -105
  51. package/addon/components/notifications-container.hbs +0 -19
  52. package/addon/components/notifications-container.md +0 -9
  53. package/addon/components/notifications-container.ts +0 -56
  54. package/addon/index.ts +0 -12
  55. package/addon/services/notifications.ts +0 -36
  56. package/app/components/notification-card.js +0 -1
  57. package/app/components/notifications-container.js +0 -1
  58. package/app/services/notifications.js +0 -1
  59. package/config/environment.js +0 -5
  60. package/docs/notifications-usage-demo/demo.md +0 -153
  61. package/docs/notifications-usage.md +0 -6
  62. package/index.js +0 -5
  63. package/tsconfig.json +0 -23
  64. package/types/dummy/index.d.ts +0 -0
  65. package/types/ember-get-config.d.ts +0 -3
  66. package/types/global.d.ts +0 -6
  67. package/types/index.d.ts +0 -1
package/addon-main.js ADDED
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ const { addonV1Shim } = require('@embroider/addon-shim');
4
+ module.exports = addonV1Shim(__dirname);
@@ -1,2 +1,3 @@
1
- import { DefaultConfig } from './types';
1
+ import type { DefaultConfig } from './types';
2
2
  export declare function getConfigOption<T extends keyof DefaultConfig>(key: T, defaultValue: NonNullable<DefaultConfig[T]>): NonNullable<DefaultConfig[T]>;
3
+ //# sourceMappingURL=get-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-config.d.ts","sourceRoot":"","sources":["../../src/-private/get-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,aAAa,EAC3D,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAC1C,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAW/B"}
@@ -1,5 +1,5 @@
1
1
  import Notification from './notification';
2
- import { NotificationOptions } from './types';
2
+ import type { NotificationOptions } from './types';
3
3
  export default class NotificationsManager {
4
4
  notifications: Notification[];
5
5
  add(message: string, options?: NotificationOptions): Notification;
@@ -7,3 +7,4 @@ export default class NotificationsManager {
7
7
  removeAll(): void;
8
8
  private setupAutoRemoval;
9
9
  }
10
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/-private/manager.ts"],"names":[],"mappings":"AAAA,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,5 +1,5 @@
1
1
  import Timer from './timer';
2
- import { NotificationOptions, CustomAction } from './types';
2
+ import type { NotificationOptions, CustomAction } from './types';
3
3
  export default class Notification {
4
4
  readonly message: string;
5
5
  readonly transitionDuration: number;
@@ -12,3 +12,4 @@ export default class Notification {
12
12
  constructor(message: string, options?: NotificationOptions);
13
13
  remove(): void;
14
14
  }
15
+ //# sourceMappingURL=notification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/-private/notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC;IACpE,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAEjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,UAAS;gBAEhB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB;IAkB9D,MAAM,IAAI,IAAI;CAOf"}
@@ -10,3 +10,4 @@ export default class Timer {
10
10
  resume(): void;
11
11
  private setup;
12
12
  }
13
+ //# sourceMappingURL=timer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/-private/timer.ts"],"names":[],"mappings":"AAKA,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"}
@@ -1,3 +1,4 @@
1
+ export type containerPlacement = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
1
2
  export interface CustomAction {
2
3
  /**
3
4
  * The label of the action
@@ -51,3 +52,4 @@ export interface DefaultConfig extends NotificationOptions {
51
52
  */
52
53
  skipTimer?: boolean;
53
54
  }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/-private/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAC1B,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAOlB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAEtD;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,aAAc,SAAQ,mBAAmB;IACxD;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -1,9 +1,10 @@
1
1
  import Component from '@glimmer/component';
2
- import { NotificationsService, Notification, CustomAction } from '../.';
3
- import { NotificationsContainerSignature } from './notifications-container';
2
+ import type NotificationsService from '../services/notifications';
3
+ import type Notification from '../-private/notification';
4
+ import type { CustomAction, containerPlacement } from '../-private/types';
4
5
  export interface NotificationCardArgs {
5
6
  notification: Notification;
6
- placement: NotificationsContainerSignature['Args']['placement'];
7
+ placement: containerPlacement;
7
8
  /**
8
9
  * Spacing for each notification, in px.
9
10
  *
@@ -13,7 +14,7 @@ export interface NotificationCardArgs {
13
14
  }
14
15
  export interface NotificationCardSignature {
15
16
  Args: NotificationCardArgs;
16
- Element: HTMLDivElement | null;
17
+ Element: HTMLDivElement;
17
18
  }
18
19
  export default class NotificationCard extends Component<NotificationCardSignature> {
19
20
  notifications: NotificationsService;
@@ -27,3 +28,4 @@ export default class NotificationCard extends Component<NotificationCardSignatur
27
28
  resume(): void;
28
29
  handleClickCustomAction(customAction: CustomAction): void;
29
30
  }
31
+ //# sourceMappingURL=notification-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-card.d.ts","sourceRoot":"","sources":["../../src/components/notification-card.ts"],"names":[],"mappings":"AAAA,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,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,kBAAkB,CAAC;IAE9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,SAAS,CAAC,yBAAyB,CAAC;IACvE,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;CAiElE"}
@@ -1,13 +1,14 @@
1
1
  import Component from '@glimmer/component';
2
- import NotificationsService from '../services/notifications';
3
- import { Notification } from '../';
2
+ import type NotificationsService from '../services/notifications';
3
+ import type Notification from '../-private/notification';
4
+ import { type containerPlacement } from '../-private/types';
4
5
  export interface NotificationsContainerArgs {
5
6
  /**
6
7
  * The placement of the notifications
7
8
  *
8
9
  * @defaultValue 'bottom-right'
9
10
  */
10
- placement?: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
11
+ placement?: containerPlacement;
11
12
  /**
12
13
  * Spacing for each notification, in px.
13
14
  *
@@ -17,7 +18,7 @@ export interface NotificationsContainerArgs {
17
18
  }
18
19
  export interface NotificationsContainerSignature {
19
20
  Args: NotificationsContainerArgs;
20
- Element: HTMLDivElement | null;
21
+ Element: HTMLDivElement;
21
22
  }
22
23
  export default class NotificationsContainer extends Component<NotificationsContainerSignature> {
23
24
  notifications: NotificationsService;
@@ -25,3 +26,4 @@ export default class NotificationsContainer extends Component<NotificationsConta
25
26
  get sortedNotifications(): Notification[];
26
27
  addSpacing(element: HTMLElement): void;
27
28
  }
29
+ //# sourceMappingURL=notifications-container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications-container.d.ts","sourceRoot":"","sources":["../../src/components/notifications-container.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAO3C,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAS,CAAC,+BAA+B,CAAC;IACnF,aAAa,EAAG,oBAAoB,CAAC;IAE9C,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED,IAAI,mBAAmB,IAAI,YAAY,EAAE,CAMxC;IAEO,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CAoC/C"}
@@ -0,0 +1,3 @@
1
+ import { DefaultConfig } from "./types-16c08671.js";
2
+ declare function getConfigOption<T extends keyof DefaultConfig>(key: T, defaultValue: NonNullable<DefaultConfig[T]>): NonNullable<DefaultConfig[T]>;
3
+ export { getConfigOption };
@@ -4,3 +4,4 @@ import NotificationsService from './services/notifications';
4
4
  import type { DefaultConfig, NotificationOptions, CustomAction } from './-private/types';
5
5
  export { Notification, Timer, NotificationsService };
6
6
  export type { NotificationOptions, DefaultConfig, CustomAction };
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AAErD,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import Timer from "./timer-dbe538e6.js";
2
+ import { NotificationOptions, CustomAction } from "./types-16c08671.js";
3
+ declare class Notification {
4
+ readonly message: string;
5
+ readonly transitionDuration: number;
6
+ readonly appearance: NonNullable<NotificationOptions['appearance']>;
7
+ readonly customActions?: CustomAction[];
8
+ readonly allowClosing: boolean;
9
+ readonly duration: number;
10
+ timer?: Timer;
11
+ isRemoving: boolean;
12
+ constructor(message: string, options?: NotificationOptions);
13
+ remove(): void;
14
+ }
15
+ export { Notification 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 };
@@ -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,7 +1,9 @@
1
+ /// <reference types="ember-source/types/stable/@ember/service" />
2
+ /// <reference types="ember-source/types/stable/@ember/routing/service-ext" />
1
3
  import Service from '@ember/service';
2
4
  import Notification from '../-private/notification';
3
5
  import NotificationsManager from '../-private/manager';
4
- import { NotificationOptions } from '../-private/types';
6
+ import type { NotificationOptions } from '../-private/types';
5
7
  export default class NotificationsService extends Service {
6
8
  manager: NotificationsManager;
7
9
  get notifications(): Notification[];
@@ -15,3 +17,4 @@ declare module '@ember/service' {
15
17
  notifications: NotificationsService;
16
18
  }
17
19
  }
20
+ //# sourceMappingURL=notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/services/notifications.ts"],"names":[],"mappings":";;AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,oBAAoB,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,OAAO;IACvD,OAAO,uBAA8B;IAErC,IAAI,aAAa,IAAI,YAAY,EAAE,CAElC;IAED,GAAG,YAAa,MAAM,YAAY,mBAAmB,KAAG,YAAY,CAElE;IAEF,MAAM,kBAAmB,YAAY,KAAG,IAAI,CAE1C;IAEF,SAAS,QAAO,IAAI,CAElB;IAEF,WAAW,IAAI,IAAI;CAIpB;AAGD,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,QAAQ;QAChB,aAAa,EAAE,oBAAoB,CAAC;KACrC;CACF"}
@@ -0,0 +1,7 @@
1
+ import type NotificationCard from './components/notification-card';
2
+ import type NotificationsContainer from './components/notifications-container';
3
+ export default interface Registry {
4
+ NotificationCard: typeof NotificationCard;
5
+ NotificationsContainer: typeof NotificationsContainer;
6
+ }
7
+ //# sourceMappingURL=template-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,sBAAsB,MAAM,sCAAsC,CAAC;AAE/E,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 };
@@ -0,0 +1,55 @@
1
+ type containerPlacement = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
2
+ interface CustomAction {
3
+ /**
4
+ * The label of the action
5
+ */
6
+ label: string;
7
+ /**
8
+ * The function to be called when clicked
9
+ */
10
+ onClick: () => void;
11
+ }
12
+ interface NotificationOptions {
13
+ /**
14
+ * If set to false, the close button will not be displayed.
15
+ *
16
+ * @defaultValue true
17
+ */
18
+ allowClosing?: boolean;
19
+ /**
20
+ * Preserve the notification open, no auto-dismiss.
21
+ *
22
+ * @defaultValue false
23
+ */
24
+ preserve?: boolean;
25
+ /**
26
+ * Duration before the notification is auto-dismissed, in milliseconds.
27
+ *
28
+ * @defaultValue 5000
29
+ */
30
+ duration?: number;
31
+ transitionDuration?: number;
32
+ /**
33
+ * The appearance of the notification
34
+ *
35
+ * @defaultValue 'info'
36
+ */
37
+ appearance?: 'info' | 'success' | 'warning' | 'error';
38
+ /**
39
+ * A list of custom actions
40
+ *
41
+ * @defaultValue undefined
42
+ */
43
+ customActions?: CustomAction[];
44
+ }
45
+ interface DefaultConfig extends NotificationOptions {
46
+ /**
47
+ * If set to true, we will preserve the notification, therefore skiping the timer.
48
+ * This is useful in tests because Ember will wait for any runloop to
49
+ * finish before proceeding.
50
+ *
51
+ * @defaultValue false
52
+ */
53
+ skipTimer?: boolean;
54
+ }
55
+ export { containerPlacement, CustomAction, NotificationOptions, DefaultConfig };
@@ -0,0 +1 @@
1
+ export { default } from "@frontile/notifications/components/notification-card";
@@ -0,0 +1 @@
1
+ export { default } from "@frontile/notifications/components/notifications-container";
@@ -0,0 +1 @@
1
+ export { default } from "@frontile/notifications/services/notifications";
@@ -0,0 +1,105 @@
1
+ import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
2
+ import '@babel/runtime/helpers/esm/defineProperty';
3
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
4
+ import '@babel/runtime/helpers/esm/initializerWarningHelper';
5
+ import Component from '@glimmer/component';
6
+ import { tracked } from '@glimmer/tracking';
7
+ import { action } from '@ember/object';
8
+ import { inject } from '@ember/service';
9
+ import { htmlSafe } from '@ember/template';
10
+ import { later } from '@ember/runloop';
11
+ import { on } from '@ember/modifier';
12
+ import { concat, fn } from '@ember/helper';
13
+ import didUpdate from '@ember/render-modifiers/modifiers/did-update';
14
+ import didInsert from '@ember/render-modifiers/modifiers/did-insert';
15
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
16
+ import CloseButton from '@frontile/core/components/close-button';
17
+ import { cssTransition } from 'ember-css-transitions';
18
+ import { precompileTemplate } from '@ember/template-compilation';
19
+ import { setComponentTemplate } from '@ember/component';
20
+
21
+ var _class, _descriptor, _descriptor2, _class2;
22
+ let NotificationCard = (_class = (_class2 = class NotificationCard extends Component {
23
+ constructor(...args) {
24
+ super(...args);
25
+ _initializerDefineProperty(this, "notifications", _descriptor, this);
26
+ _initializerDefineProperty(this, "hasEntered", _descriptor2, this);
27
+ }
28
+ get styles() {
29
+ const styles1 = [`transition-duration: ${this.args.notification.transitionDuration}ms`];
30
+ if (!this.hasEntered) {
31
+ styles1.push(`transition-delay: ${this.args.notification.transitionDuration}ms`);
32
+ }
33
+ return htmlSafe(styles1.join('; '));
34
+ }
35
+ addSpacing(element1) {
36
+ if (this.args.placement && this.args.placement.includes('top')) {
37
+ element1.style.marginTop = `${this.args.spacing || 16}px`;
38
+ }
39
+ }
40
+ transitionIn(element1) {
41
+ const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;
42
+ const expectedHeight1 = element1.offsetHeight + spacing1;
43
+ const duration1 = this.args.notification.transitionDuration / 2;
44
+ requestAnimationFrame(() => {
45
+ element1.style.height = '0';
46
+ const transition1 = `height ${duration1}ms ease-in ${duration1}ms`;
47
+ element1.style.transition = transition1;
48
+ requestAnimationFrame(() => {
49
+ element1.style.height = `${expectedHeight1}px`;
50
+ });
51
+ });
52
+ later(this, () => {
53
+ this.hasEntered = true;
54
+ }, this.args.notification.transitionDuration);
55
+ }
56
+ transitionOut(element1, [isExiting1, ..._1]) {
57
+ if (isExiting1) {
58
+ element1.style.height = '0';
59
+ }
60
+ }
61
+ remove() {
62
+ this.notifications.remove(this.args.notification);
63
+ }
64
+ pause() {
65
+ if (this.args.notification.timer) {
66
+ this.args.notification.timer.pause();
67
+ }
68
+ }
69
+ resume() {
70
+ if (this.args.notification.timer) {
71
+ this.args.notification.timer.resume();
72
+ }
73
+ }
74
+ handleClickCustomAction(customAction1) {
75
+ customAction1.onClick();
76
+ this.remove();
77
+ }
78
+ }, setComponentTemplate(precompileTemplate("\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 {{didInsert this.transitionIn}} {{didUpdate this.transitionOut @notification.isRemoving}}>\n {{#unless @notification.isRemoving}}\n <div {{on \"mouseenter\" this.pause}} {{on \"mouseleave\" this.resume}} {{cssTransition (concat \"notification-transition--slide-from-\" @placement) isEnabled=true}} class={{useFrontileClass \"notification-card\" @notification.appearance}} style=\"{{this.styles}}\" ...attributes>\n <div class={{useFrontileClass \"notification-card\" @notification.appearance part=\"message\"}}>\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div class={{useFrontileClass \"notification-card\" @notification.appearance part=\"custom-actions\"}}>\n {{#each @notification.customActions as |customAction|}}\n <button type=\"button\" class={{useFrontileClass \"notification-card\" @notification.appearance part=\"custom-action-btn\"}} {{on \"click\" (fn this.handleClickCustomAction customAction)}}>\n {{customAction.label}}\n </button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton @onClick={{this.remove}} class={{useFrontileClass \"notification-card\" @notification.appearance part=\"close-btn\"}} />\n {{/if}}\n </div>\n {{/unless}}\n </div>\n ", {
79
+ scope: () => ({
80
+ didInsert,
81
+ didUpdate,
82
+ useFrontileClass,
83
+ on,
84
+ cssTransition,
85
+ concat,
86
+ fn,
87
+ CloseButton
88
+ }),
89
+ strictMode: true
90
+ }), _class2), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "notifications", [inject], {
91
+ configurable: true,
92
+ enumerable: true,
93
+ writable: true,
94
+ initializer: null
95
+ }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "hasEntered", [tracked], {
96
+ configurable: true,
97
+ enumerable: true,
98
+ writable: true,
99
+ initializer: function () {
100
+ return false;
101
+ }
102
+ }), _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);
103
+
104
+ export { NotificationCard as default };
105
+ //# sourceMappingURL=notification-card.js.map
@@ -0,0 +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 useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport CloseButton from '@frontile/core/components/close-button';\nimport { cssTransition } from 'ember-css-transitions';\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 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={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n }}\n style=\"{{this.styles}}\"\n ...attributes\n >\n <div\n class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n part=\"message\"\n }}\n >\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div\n class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n part=\"custom-actions\"\n }}\n >\n {{#each @notification.customActions as |customAction|}}\n <button\n type=\"button\"\n class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n part=\"custom-action-btn\"\n }}\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 class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n part=\"close-btn\"\n }}\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","setComponentTemplate","precompileTemplate","scope","didInsert","didUpdate","useFrontileClass","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,CAAC,CAAA;AACpF,KAAA;IACA,OAAOG,QAAQ,CAACL,OAAO,CAACM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AACvC,GAAA;EAEAC,UAAUA,CAACC,QAAqB,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,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAAyD,SAAA,EAAAzD,OAAAA,CAAAA,EAAAA,MAAA,CAAAyD,SAAA,CAAAD,EAAAA,yBAAA,CAAAxD,MAAA,CAAAyD,SAAA,EAAA,QAAA,EAAA,CAMNO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAAyD,SAAA,EAAAzD,QAAAA,CAAAA,EAAAA,MAAA,CAAAyD,SAAA,CAAAD,EAAAA,yBAAA,CAAAxD,MAAA,CAAAyD,SAAA,EAAA,yBAAA,EAAA,CAMNO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAAyD,SAAA,EAAAzD,yBAAAA,CAAAA,EAAAA,MAAA,CAAAyD,SAAA,IAAAzD,MAAA;;;;"}
@@ -0,0 +1,53 @@
1
+ import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
2
+ import '@babel/runtime/helpers/esm/defineProperty';
3
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
4
+ import '@babel/runtime/helpers/esm/initializerWarningHelper';
5
+ import Component from '@glimmer/component';
6
+ import { inject } from '@ember/service';
7
+ import { action } from '@ember/object';
8
+ import didUpdate from '@ember/render-modifiers/modifiers/did-update';
9
+ import didInsert from '@ember/render-modifiers/modifiers/did-insert';
10
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
11
+ import NotificationCard from './notification-card.js';
12
+ import { precompileTemplate } from '@ember/template-compilation';
13
+ import { setComponentTemplate } from '@ember/component';
14
+
15
+ var _class, _descriptor, _class2;
16
+ let NotificationsContainer = (_class = (_class2 = class NotificationsContainer extends Component {
17
+ constructor(...args) {
18
+ super(...args);
19
+ _initializerDefineProperty(this, "notifications", _descriptor, this);
20
+ }
21
+ get isTopPlacement() {
22
+ return !!(this.args.placement && this.args.placement.includes('top'));
23
+ }
24
+ get sortedNotifications() {
25
+ if (this.isTopPlacement) {
26
+ return this.notifications.notifications.slice().reverse();
27
+ } else {
28
+ return this.notifications.notifications;
29
+ }
30
+ }
31
+ addSpacing(element1) {
32
+ const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;
33
+ if (this.isTopPlacement) {
34
+ element1.style.marginTop = `${spacing1}px`;
35
+ }
36
+ }
37
+ }, setComponentTemplate(precompileTemplate("\n {{#if this.sortedNotifications}}\n <div {{didInsert this.addSpacing}} {{didUpdate this.addSpacing @spacing @placement}} class={{useFrontileClass \"notifications-container\" (if @placement @placement \"bottom-right\")}} role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" ...attributes>\n {{#each this.sortedNotifications as |notification|}}\n <NotificationCard @spacing={{@spacing}} @placement={{if @placement @placement \"bottom-right\"}} @notification={{notification}} />\n {{/each}}\n </div>\n {{/if}}\n ", {
38
+ scope: () => ({
39
+ useFrontileClass,
40
+ didInsert,
41
+ didUpdate,
42
+ NotificationCard
43
+ }),
44
+ strictMode: true
45
+ }), _class2), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "notifications", [inject], {
46
+ configurable: true,
47
+ enumerable: true,
48
+ writable: true,
49
+ initializer: null
50
+ }), _applyDecoratedDescriptor(_class.prototype, "addSpacing", [action], Object.getOwnPropertyDescriptor(_class.prototype, "addSpacing"), _class.prototype)), _class);
51
+
52
+ export { NotificationsContainer as default };
53
+ //# sourceMappingURL=notifications-container.js.map
@@ -0,0 +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 useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport NotificationCard from './notification-card';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport { type containerPlacement } from '../-private/types';\nexport interface NotificationsContainerArgs {\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}\nexport interface NotificationsContainerSignature {\n Args: NotificationsContainerArgs;\n Element: HTMLDivElement;\n}\nexport default 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 @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={{useFrontileClass\n \"notifications-container\"\n (if @placement @placement \"bottom-right\")\n }}\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}\n"],"names":["NotificationsContainer","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","isTopPlacement","placement","includes","sortedNotifications","notifications","slice","reverse","addSpacing","element1","spacing1","spacing","style","marginTop","setComponentTemplate","precompileTemplate","scope","useFrontileClass","didInsert","didUpdate","NotificationCard","strictMode","_applyDecoratedDescriptor","prototype","service","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;AA2BqBA,IAAAA,sBAAsB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B,OAAA,CAAA,EAAAA,OAAA,CAAAK,GAAAA,WAAA,GAAAsB,yBAAA,CAAA5B,MAAA,CAAA6B,SAAA,oBAhDLC,MAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAAN,CAAAA,EAAAA,yBAAA,CAAA5B,MAAA,CAAA6B,SAAA,EAYPM,YAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAArC,MAAA,CAAA6B,SAAA,EAAA,YAAA,CAAA,EAAA7B,MAAA,CAAA6B,SAAA,IAAA7B,MAAA;;;;"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { N as Notification, a as NotificationsService, T as Timer } from './notifications-02bGKw8W.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}