@frontile/notifications 0.17.0-beta.2 → 0.17.0-beta.4

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.
@@ -1,3 +1,3 @@
1
1
  import type { DefaultConfig } from './types';
2
- export declare function getConfigOption<T extends keyof DefaultConfig>(key: T, defaultValue: NonNullable<DefaultConfig[T]>): NonNullable<DefaultConfig[T]>;
2
+ export declare function getConfigOption<T extends keyof DefaultConfig>(config: DefaultConfig, key: T, defaultValue: NonNullable<DefaultConfig[T]>): NonNullable<DefaultConfig[T]>;
3
3
  //# sourceMappingURL=get-config.d.ts.map
@@ -1 +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
+ {"version":3,"file":"get-config.d.ts","sourceRoot":"","sources":["../../src/-private/get-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,aAAa,EAC3D,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAC1C,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAQ/B"}
@@ -1,7 +1,10 @@
1
1
  import Notification from './notification';
2
2
  import type { NotificationOptions } from './types';
3
+ import type { DefaultConfig } from './types';
3
4
  export default class NotificationsManager {
4
5
  notifications: Notification[];
6
+ config: DefaultConfig;
7
+ constructor(context: object);
5
8
  add(message: string, options?: NotificationOptions): Notification;
6
9
  remove(notification?: Notification): void;
7
10
  removeAll(): void;
@@ -1 +1 @@
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
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/-private/manager.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAM1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,oBAAoB;IAC9B,aAAa,EAAE,YAAY,EAAE,CAAM;IAE5C,MAAM,EAAE,aAAa,CAAM;gBAEf,OAAO,EAAE,MAAM;IAW3B,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 type { NotificationOptions, CustomAction } from './types';
2
+ import type { NotificationOptions, CustomAction, DefaultConfig } from './types';
3
3
  export default class Notification {
4
4
  readonly message: string;
5
5
  readonly transitionDuration: number;
@@ -9,7 +9,7 @@ export default class Notification {
9
9
  readonly duration: number;
10
10
  timer?: Timer;
11
11
  isRemoving: boolean;
12
- constructor(message: string, options?: NotificationOptions);
12
+ constructor(config: DefaultConfig, message: string, options?: NotificationOptions);
13
13
  remove(): void;
14
14
  }
15
15
  //# sourceMappingURL=notification.d.ts.map
@@ -1 +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"}
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,aAAa,EAAE,MAAM,SAAS,CAAC;AAEhF,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;gBAG1B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,mBAAwB;IAoBnC,MAAM,IAAI,IAAI;CAOf"}
@@ -0,0 +1,4 @@
1
+ import { DefaultConfig } from "./types-16c08671.js";
2
+ declare function getConfigOption<T extends keyof DefaultConfig>(config: DefaultConfig, key: T, defaultValue: NonNullable<DefaultConfig[T]>): NonNullable<DefaultConfig[T]>;
3
+ export { getConfigOption };
4
+ //# sourceMappingURL=get-config-44fc1a62.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-config-44fc1a62.d.ts","sourceRoot":"","sources":["../src/-private/get-config.ts"],"names":[],"mappings":"AACA,OAAO,iBAAsB,4BAAgB;AAE7C,iBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,aAAa,EAC3D,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAC1C,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAQ/B"}
@@ -0,0 +1,13 @@
1
+ import Notification from "./notification-5242cbb9.js";
2
+ import { NotificationOptions, DefaultConfig } from "./types-16c08671.js";
3
+ declare class NotificationsManager {
4
+ notifications: Notification[];
5
+ config: DefaultConfig;
6
+ constructor(context: object);
7
+ add(message: string, options?: NotificationOptions): Notification;
8
+ remove(notification?: Notification): void;
9
+ removeAll(): void;
10
+ private setupAutoRemoval;
11
+ }
12
+ export { NotificationsManager as default };
13
+ //# sourceMappingURL=manager--2XpSzrY.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager--2XpSzrY.d.ts","sourceRoot":"","sources":["../src/-private/manager.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,mCAAuB;AAM1C,OAAO,sCAA4B,4BAAgB;AAKnD,cAAqB,oBAAoB;IAC9B,aAAa,EAAE,YAAY,EAAE,CAAM;IAE5C,MAAM,EAAE,aAAa,CAAM;gBAEf,OAAO,EAAE,MAAM;IAW3B,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"}
@@ -0,0 +1,13 @@
1
+ import Notification from "./notification-5242cbb9.js";
2
+ import { NotificationOptions, DefaultConfig } from "./types-16c08671.js";
3
+ declare class NotificationsManager {
4
+ notifications: Notification[];
5
+ config: DefaultConfig;
6
+ constructor(context: object);
7
+ add(message: string, options?: NotificationOptions): Notification;
8
+ remove(notification?: Notification): void;
9
+ removeAll(): void;
10
+ private setupAutoRemoval;
11
+ }
12
+ export { NotificationsManager as default };
13
+ //# sourceMappingURL=manager-CpMKYiRF.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager-CpMKYiRF.d.ts","sourceRoot":"","sources":["../src/-private/manager.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,mCAAuB;AAM1C,OAAO,sCAA4B,4BAAgB;AAKnD,cAAqB,oBAAoB;IAC9B,aAAa,EAAE,YAAY,EAAE,CAAM;IAE5C,MAAM,EAAE,aAAa,CAAM;gBAEf,OAAO,EAAE,MAAM;IAW3B,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"}
@@ -0,0 +1,16 @@
1
+ import Timer from "./timer-0a840cef.js";
2
+ import { NotificationOptions, CustomAction, DefaultConfig } 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(config: DefaultConfig, message: string, options?: NotificationOptions);
13
+ remove(): void;
14
+ }
15
+ export { Notification as default };
16
+ //# sourceMappingURL=notification-5242cbb9.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-5242cbb9.d.ts","sourceRoot":"","sources":["../src/-private/notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,4BAAgB;AAE5B,OAAO,oDAAyD,4BAAgB;AAEhF,cAAqB,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;gBAG1B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,mBAAwB;IAoBnC,MAAM,IAAI,IAAI;CAOf"}
@@ -1 +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"}
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,uBAAkC;IAEzC,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"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { N as Notification, T as Timer } from './manager-IxquV5I2.js';
1
+ export { N as Notification, T as Timer } from './manager-CpMKYiRF.js';
2
2
  import '@babel/runtime/helpers/esm/defineProperty';
3
3
  import '@ember/service';
4
4
  export { NotificationCard } from './components/notification-card.js';
@@ -0,0 +1,167 @@
1
+ import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
2
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
4
+ import '@babel/runtime/helpers/esm/initializerWarningHelper';
5
+ import { tracked } from '@glimmer/tracking';
6
+ import { cancel, later } from '@ember/runloop';
7
+ import { action, get } from '@ember/object';
8
+ import { getOwner } from '@ember/owner';
9
+ import { assert } from '@ember/debug';
10
+
11
+ var _class$2, _descriptor$2, _descriptor2$1;
12
+ let Timer = (_class$2 = class Timer {
13
+ constructor(duration, onFinish) {
14
+ _initializerDefineProperty(this, "remaining", _descriptor$2, this);
15
+ _initializerDefineProperty(this, "isRunning", _descriptor2$1, this);
16
+ _defineProperty(this, "onFinish", void 0);
17
+ _defineProperty(this, "timer", void 0);
18
+ _defineProperty(this, "start", void 0);
19
+ this.remaining = duration;
20
+ this.onFinish = onFinish;
21
+ this.setup();
22
+ }
23
+ clear() {
24
+ this.isRunning = false;
25
+ if (this.timer) {
26
+ cancel(this.timer);
27
+ }
28
+ }
29
+ pause() {
30
+ this.clear();
31
+ this.remaining -= Date.now() - this.start;
32
+ }
33
+ resume() {
34
+ this.clear();
35
+ this.setup();
36
+ }
37
+ setup() {
38
+ this.start = Date.now();
39
+ this.isRunning = true;
40
+ this.timer = later(this, () => {
41
+ this.onFinish();
42
+ this.isRunning = false;
43
+ }, this.remaining);
44
+ }
45
+ }, _descriptor$2 = _applyDecoratedDescriptor(_class$2.prototype, "remaining", [tracked], {
46
+ configurable: true,
47
+ enumerable: true,
48
+ writable: true,
49
+ initializer: null
50
+ }), _descriptor2$1 = _applyDecoratedDescriptor(_class$2.prototype, "isRunning", [tracked], {
51
+ configurable: true,
52
+ enumerable: true,
53
+ writable: true,
54
+ initializer: function () {
55
+ return true;
56
+ }
57
+ }), _applyDecoratedDescriptor(_class$2.prototype, "clear", [action], Object.getOwnPropertyDescriptor(_class$2.prototype, "clear"), _class$2.prototype), _applyDecoratedDescriptor(_class$2.prototype, "pause", [action], Object.getOwnPropertyDescriptor(_class$2.prototype, "pause"), _class$2.prototype), _applyDecoratedDescriptor(_class$2.prototype, "resume", [action], Object.getOwnPropertyDescriptor(_class$2.prototype, "resume"), _class$2.prototype), _class$2);
58
+
59
+ function getConfigOption(config, key, defaultValue) {
60
+ const value = get(config, key);
61
+ if (value === undefined) {
62
+ return defaultValue;
63
+ }
64
+ return value;
65
+ }
66
+
67
+ var _class$1, _descriptor$1, _descriptor2;
68
+ let Notification = (_class$1 = class Notification {
69
+ constructor(config, message, options = {}) {
70
+ _defineProperty(this, "message", void 0);
71
+ _defineProperty(this, "transitionDuration", void 0);
72
+ _defineProperty(this, "appearance", void 0);
73
+ _defineProperty(this, "customActions", void 0);
74
+ _defineProperty(this, "allowClosing", void 0);
75
+ _defineProperty(this, "duration", void 0);
76
+ _initializerDefineProperty(this, "timer", _descriptor$1, this);
77
+ _initializerDefineProperty(this, "isRemoving", _descriptor2, this);
78
+ this.message = message;
79
+ this.appearance = options.appearance || getConfigOption(config, 'appearance', 'info');
80
+ this.customActions = options.customActions;
81
+ this.duration = options.duration || getConfigOption(config, 'duration', 5000);
82
+ this.transitionDuration = typeof options.transitionDuration !== 'undefined' ? options.transitionDuration : getConfigOption(config, 'transitionDuration', 200);
83
+ if (options.allowClosing === false) {
84
+ this.allowClosing = false;
85
+ } else {
86
+ this.allowClosing = true;
87
+ }
88
+ }
89
+ remove() {
90
+ this.isRemoving = true;
91
+ if (this.timer) {
92
+ this.timer.clear();
93
+ }
94
+ }
95
+ }, _descriptor$1 = _applyDecoratedDescriptor(_class$1.prototype, "timer", [tracked], {
96
+ configurable: true,
97
+ enumerable: true,
98
+ writable: true,
99
+ initializer: null
100
+ }), _descriptor2 = _applyDecoratedDescriptor(_class$1.prototype, "isRemoving", [tracked], {
101
+ configurable: true,
102
+ enumerable: true,
103
+ writable: true,
104
+ initializer: function () {
105
+ return false;
106
+ }
107
+ }), _class$1);
108
+
109
+ var _class, _descriptor;
110
+ let NotificationsManager = (_class = class NotificationsManager {
111
+ constructor(context) {
112
+ _initializerDefineProperty(this, "notifications", _descriptor, this);
113
+ _defineProperty(this, "config", {});
114
+ let owner = getOwner(context);
115
+ assert('NotificationsManager context must have an owner', owner);
116
+ const configFactory = owner.factoryFor('config:environment');
117
+ if (configFactory && configFactory.class) {
118
+ this.config = configFactory.class['@frontile/notifications'] || {};
119
+ }
120
+ }
121
+ add(message, options = {}) {
122
+ const notification = new Notification(this.config, message, options);
123
+ this.notifications = [...this.notifications, notification];
124
+ let preserve = typeof options.preserve === 'undefined' ? getConfigOption(this.config, 'preserve', false) : options.preserve;
125
+
126
+ // if default config has set skipTimer to true, we will preserve the
127
+ // notification, therefore skiping the timer
128
+ if (getConfigOption(this.config, 'skipTimer', false) === true) {
129
+ preserve = true;
130
+ }
131
+ if (preserve === false) {
132
+ this.setupAutoRemoval(notification, notification.duration);
133
+ }
134
+ return notification;
135
+ }
136
+ remove(notification) {
137
+ if (!notification) {
138
+ return;
139
+ }
140
+ notification.remove();
141
+ later(this, () => {
142
+ this.notifications = this.notifications.filter(n => {
143
+ return n !== notification;
144
+ });
145
+ }, notification.transitionDuration);
146
+ }
147
+ removeAll() {
148
+ this.notifications.forEach(notification => {
149
+ this.remove(notification);
150
+ });
151
+ }
152
+ setupAutoRemoval(notification, duration) {
153
+ notification.timer = new Timer(duration, () => {
154
+ this.remove(notification);
155
+ });
156
+ }
157
+ }, _descriptor = _applyDecoratedDescriptor(_class.prototype, "notifications", [tracked], {
158
+ configurable: true,
159
+ enumerable: true,
160
+ writable: true,
161
+ initializer: function () {
162
+ return [];
163
+ }
164
+ }), _class);
165
+
166
+ export { Notification as N, Timer as T, NotificationsManager as a };
167
+ //# sourceMappingURL=manager--2XpSzrY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager--2XpSzrY.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 { get } from '@ember/object';\nimport type { DefaultConfig } from './types';\n\nexport function getConfigOption<T extends keyof DefaultConfig>(\n config: DefaultConfig,\n key: T,\n defaultValue: NonNullable<DefaultConfig[T]>\n): NonNullable<DefaultConfig[T]> {\n const value = get(config, key);\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, DefaultConfig } 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(\n config: DefaultConfig,\n message: string,\n options: NotificationOptions = {}\n ) {\n this.message = message;\n this.appearance =\n options.appearance || getConfigOption(config, 'appearance', 'info');\n this.customActions = options.customActions;\n this.duration =\n options.duration || getConfigOption(config, 'duration', 5000);\n this.transitionDuration =\n typeof options.transitionDuration !== 'undefined'\n ? options.transitionDuration\n : getConfigOption(config, '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 { getOwner } from '@ember/owner';\nimport type { NotificationOptions } from './types';\nimport type Owner from '@ember/owner';\nimport { assert } from '@ember/debug';\nimport type { DefaultConfig } from './types';\n\nexport default class NotificationsManager {\n @tracked notifications: Notification[] = [];\n\n config: DefaultConfig = {};\n\n constructor(context: object) {\n let owner = getOwner(context) as Owner;\n assert('NotificationsManager context must have an owner', owner);\n const configFactory = owner.factoryFor('config:environment');\n\n if (configFactory && configFactory.class) {\n this.config =\n (configFactory.class as never)['@frontile/notifications'] || {};\n }\n }\n\n add(message: string, options: NotificationOptions = {}): Notification {\n const notification = new Notification(this.config, message, options);\n this.notifications = [...this.notifications, notification];\n\n let preserve =\n typeof options.preserve === 'undefined'\n ? getConfigOption(this.config, '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(this.config, '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","config","key","defaultValue","value","get","undefined","Notification","message","options","appearance","customActions","transitionDuration","allowClosing","remove","isRemoving","NotificationsManager","context","owner","getOwner","assert","configFactory","factoryFor","class","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;AAAAD,IAAAA,0BAAA,oBAAAE,cAAA,EAAA,IAAA,CAAA;IAAAC,eAAA,CAAA,IAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;IAClD,IAAI,CAACC,SAAS,GAAGN,QAAQ;IACzB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACM,KAAK,EAAE;AACd;AAEQC,EAAAA,KAAKA,GAAS;IACpB,IAAI,CAACC,SAAS,GAAG,KAAK;IAEtB,IAAI,IAAI,CAACC,KAAK,EAAE;AACdC,MAAAA,MAAM,CAAC,IAAI,CAACD,KAAK,CAAC;AACpB;AACF;AAEQE,EAAAA,KAAKA,GAAS;IACpB,IAAI,CAACJ,KAAK,EAAE;IACZ,IAAI,CAACF,SAAS,IAAIO,IAAI,CAACC,GAAG,EAAE,GAAG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Y,EAAE;AACjB,MAAA;AACF;IAEAA,YAAY,CAACX,MAAM,EAAE;IAErBzB,KAAK,CACH,IAAI,EACJ,MAAM;MACJ,IAAI,CAACqC,aAAa,GAAG,IAAI,CAACA,aAAa,CAACG,MAAM,CAAEC,CAAC,IAAK;QACpD,OAAOA,CAAC,KAAKL,YAAY;AAC3B,OAAC,CAAC;AACJ,KAAC,EACDA,YAAY,CAACb,kBACf,CAAC;AACH;AAEAmB,EAAAA,SAASA,GAAS;AAChB,IAAA,IAAI,CAACL,aAAa,CAACM,OAAO,CAAEP,YAAY,IAAK;AAC3C,MAAA,IAAI,CAACX,MAAM,CAACW,YAAY,CAAC;AAC3B,KAAC,CAAC;AACJ;AAEQG,EAAAA,gBAAgBA,CAACH,YAA0B,EAAErD,QAAgB,EAAQ;IAC3EqD,YAAY,CAAC3C,KAAK,GAAG,IAAIb,KAAK,CAACG,QAAQ,EAAE,MAAM;AAC7C,MAAA,IAAI,CAAC0C,MAAM,CAACW,YAAY,CAAC;AAC3B,KAAC,CAAC;AACJ;AACF,CAAC,EAAAlD,WAAA,GAAAe,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EAAA,eAAA,EAAA,CAjEEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAiC,EAAE;AAAA;AAAA,CAAA,CAAA,EAAA1B,MAAA;;;;"}
@@ -0,0 +1,167 @@
1
+ import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
2
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
4
+ import '@babel/runtime/helpers/esm/initializerWarningHelper';
5
+ import { tracked } from '@glimmer/tracking';
6
+ import { cancel, later } from '@ember/runloop';
7
+ import { action, get } from '@ember/object';
8
+ import { getOwner } from '@ember/owner';
9
+ import { assert } from '@ember/debug';
10
+
11
+ var _class$2, _descriptor$2, _descriptor2$1;
12
+ let Timer = (_class$2 = class Timer {
13
+ constructor(duration, onFinish) {
14
+ _initializerDefineProperty(this, "remaining", _descriptor$2, this);
15
+ _initializerDefineProperty(this, "isRunning", _descriptor2$1, this);
16
+ _defineProperty(this, "onFinish", void 0);
17
+ _defineProperty(this, "timer", void 0);
18
+ _defineProperty(this, "start", void 0);
19
+ this.remaining = duration;
20
+ this.onFinish = onFinish;
21
+ this.setup();
22
+ }
23
+ clear() {
24
+ this.isRunning = false;
25
+ if (this.timer) {
26
+ cancel(this.timer);
27
+ }
28
+ }
29
+ pause() {
30
+ this.clear();
31
+ this.remaining -= Date.now() - this.start;
32
+ }
33
+ resume() {
34
+ this.clear();
35
+ this.setup();
36
+ }
37
+ setup() {
38
+ this.start = Date.now();
39
+ this.isRunning = true;
40
+ this.timer = later(this, () => {
41
+ this.onFinish();
42
+ this.isRunning = false;
43
+ }, this.remaining);
44
+ }
45
+ }, _descriptor$2 = _applyDecoratedDescriptor(_class$2.prototype, "remaining", [tracked], {
46
+ configurable: true,
47
+ enumerable: true,
48
+ writable: true,
49
+ initializer: null
50
+ }), _descriptor2$1 = _applyDecoratedDescriptor(_class$2.prototype, "isRunning", [tracked], {
51
+ configurable: true,
52
+ enumerable: true,
53
+ writable: true,
54
+ initializer: function () {
55
+ return true;
56
+ }
57
+ }), _applyDecoratedDescriptor(_class$2.prototype, "clear", [action], Object.getOwnPropertyDescriptor(_class$2.prototype, "clear"), _class$2.prototype), _applyDecoratedDescriptor(_class$2.prototype, "pause", [action], Object.getOwnPropertyDescriptor(_class$2.prototype, "pause"), _class$2.prototype), _applyDecoratedDescriptor(_class$2.prototype, "resume", [action], Object.getOwnPropertyDescriptor(_class$2.prototype, "resume"), _class$2.prototype), _class$2);
58
+
59
+ function getConfigOption(config, key, defaultValue) {
60
+ const value = get(config, key);
61
+ if (value === undefined) {
62
+ return defaultValue;
63
+ }
64
+ return value;
65
+ }
66
+
67
+ var _class$1, _descriptor$1, _descriptor2;
68
+ let Notification = (_class$1 = class Notification {
69
+ constructor(config, message, options = {}) {
70
+ _defineProperty(this, "message", void 0);
71
+ _defineProperty(this, "transitionDuration", void 0);
72
+ _defineProperty(this, "appearance", void 0);
73
+ _defineProperty(this, "customActions", void 0);
74
+ _defineProperty(this, "allowClosing", void 0);
75
+ _defineProperty(this, "duration", void 0);
76
+ _initializerDefineProperty(this, "timer", _descriptor$1, this);
77
+ _initializerDefineProperty(this, "isRemoving", _descriptor2, this);
78
+ this.message = message;
79
+ this.appearance = options.appearance || getConfigOption(config, 'appearance', 'info');
80
+ this.customActions = options.customActions;
81
+ this.duration = options.duration || getConfigOption(config, 'duration', 5000);
82
+ this.transitionDuration = typeof options.transitionDuration !== 'undefined' ? options.transitionDuration : getConfigOption(config, 'transitionDuration', 200);
83
+ if (options.allowClosing === false) {
84
+ this.allowClosing = false;
85
+ } else {
86
+ this.allowClosing = true;
87
+ }
88
+ }
89
+ remove() {
90
+ this.isRemoving = true;
91
+ if (this.timer) {
92
+ this.timer.clear();
93
+ }
94
+ }
95
+ }, _descriptor$1 = _applyDecoratedDescriptor(_class$1.prototype, "timer", [tracked], {
96
+ configurable: true,
97
+ enumerable: true,
98
+ writable: true,
99
+ initializer: null
100
+ }), _descriptor2 = _applyDecoratedDescriptor(_class$1.prototype, "isRemoving", [tracked], {
101
+ configurable: true,
102
+ enumerable: true,
103
+ writable: true,
104
+ initializer: function () {
105
+ return false;
106
+ }
107
+ }), _class$1);
108
+
109
+ var _class, _descriptor;
110
+ let NotificationsManager = (_class = class NotificationsManager {
111
+ constructor(context) {
112
+ _initializerDefineProperty(this, "notifications", _descriptor, this);
113
+ _defineProperty(this, "config", {});
114
+ const owner = getOwner(context);
115
+ assert('NotificationsManager context must have an owner', owner);
116
+ const configFactory = owner.factoryFor('config:environment');
117
+ if (configFactory && configFactory.class) {
118
+ this.config = configFactory.class['@frontile/notifications'] || {};
119
+ }
120
+ }
121
+ add(message, options = {}) {
122
+ const notification = new Notification(this.config, message, options);
123
+ this.notifications = [...this.notifications, notification];
124
+ let preserve = typeof options.preserve === 'undefined' ? getConfigOption(this.config, 'preserve', false) : options.preserve;
125
+
126
+ // if default config has set skipTimer to true, we will preserve the
127
+ // notification, therefore skiping the timer
128
+ if (getConfigOption(this.config, 'skipTimer', false) === true) {
129
+ preserve = true;
130
+ }
131
+ if (preserve === false) {
132
+ this.setupAutoRemoval(notification, notification.duration);
133
+ }
134
+ return notification;
135
+ }
136
+ remove(notification) {
137
+ if (!notification) {
138
+ return;
139
+ }
140
+ notification.remove();
141
+ later(this, () => {
142
+ this.notifications = this.notifications.filter(n => {
143
+ return n !== notification;
144
+ });
145
+ }, notification.transitionDuration);
146
+ }
147
+ removeAll() {
148
+ this.notifications.forEach(notification => {
149
+ this.remove(notification);
150
+ });
151
+ }
152
+ setupAutoRemoval(notification, duration) {
153
+ notification.timer = new Timer(duration, () => {
154
+ this.remove(notification);
155
+ });
156
+ }
157
+ }, _descriptor = _applyDecoratedDescriptor(_class.prototype, "notifications", [tracked], {
158
+ configurable: true,
159
+ enumerable: true,
160
+ writable: true,
161
+ initializer: function () {
162
+ return [];
163
+ }
164
+ }), _class);
165
+
166
+ export { Notification as N, Timer as T, NotificationsManager as a };
167
+ //# sourceMappingURL=manager-CpMKYiRF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager-CpMKYiRF.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 { get } from '@ember/object';\nimport type { DefaultConfig } from './types';\n\nexport function getConfigOption<T extends keyof DefaultConfig>(\n config: DefaultConfig,\n key: T,\n defaultValue: NonNullable<DefaultConfig[T]>\n): NonNullable<DefaultConfig[T]> {\n const value = get(config, key);\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, DefaultConfig } 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(\n config: DefaultConfig,\n message: string,\n options: NotificationOptions = {}\n ) {\n this.message = message;\n this.appearance =\n options.appearance || getConfigOption(config, 'appearance', 'info');\n this.customActions = options.customActions;\n this.duration =\n options.duration || getConfigOption(config, 'duration', 5000);\n this.transitionDuration =\n typeof options.transitionDuration !== 'undefined'\n ? options.transitionDuration\n : getConfigOption(config, '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 { getOwner } from '@ember/owner';\nimport type { NotificationOptions } from './types';\nimport type Owner from '@ember/owner';\nimport { assert } from '@ember/debug';\nimport type { DefaultConfig } from './types';\n\nexport default class NotificationsManager {\n @tracked notifications: Notification[] = [];\n\n config: DefaultConfig = {};\n\n constructor(context: object) {\n const owner = getOwner(context) as Owner;\n assert('NotificationsManager context must have an owner', owner);\n const configFactory = owner.factoryFor('config:environment');\n\n if (configFactory && configFactory.class) {\n this.config =\n (configFactory.class as never)['@frontile/notifications'] || {};\n }\n }\n\n add(message: string, options: NotificationOptions = {}): Notification {\n const notification = new Notification(this.config, message, options);\n this.notifications = [...this.notifications, notification];\n\n let preserve =\n typeof options.preserve === 'undefined'\n ? getConfigOption(this.config, '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(this.config, '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","config","key","defaultValue","value","get","undefined","Notification","message","options","appearance","customActions","transitionDuration","allowClosing","remove","isRemoving","NotificationsManager","context","owner","getOwner","assert","configFactory","factoryFor","class","add","notification","notifications","preserve","setupAutoRemo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M,CAACW,YAAY,CAAC;AAC3B,KAAC,CAAC;AACJ;AAEQG,EAAAA,gBAAgBA,CAACH,YAA0B,EAAErD,QAAgB,EAAQ;IAC3EqD,YAAY,CAAC3C,KAAK,GAAG,IAAIb,KAAK,CAACG,QAAQ,EAAE,MAAM;AAC7C,MAAA,IAAI,CAAC0C,MAAM,CAACW,YAAY,CAAC;AAC3B,KAAC,CAAC;AACJ;AACF,CAAC,EAAAlD,WAAA,GAAAe,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EAAA,eAAA,EAAA,CAjEEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAiC,EAAE;AAAA;AAAA,CAAA,CAAA,EAAA1B,MAAA;;;;"}
@@ -1,11 +1,11 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
2
  import Service from '@ember/service';
3
- import { a as NotificationsManager } from '../manager-IxquV5I2.js';
3
+ import { a as NotificationsManager } from '../manager-CpMKYiRF.js';
4
4
 
5
5
  class NotificationsService extends Service {
6
6
  constructor(...args) {
7
7
  super(...args);
8
- _defineProperty(this, "manager", new NotificationsManager());
8
+ _defineProperty(this, "manager", new NotificationsManager(this));
9
9
  _defineProperty(this, "add", (message, options) => {
10
10
  return this.manager.add(message, options);
11
11
  });
@@ -1 +1 @@
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;AAAAC,IAAAA,eAAA,CAC9C,IAAA,EAAA,SAAA,EAAA,IAAIC,oBAAoB,EAAE,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;KAC1C,CAAA;IAAAH,eAAA,CAAA,IAAA,EAAA,QAAA,EAESM,YAA2B,IAAW;AAC9C,MAAA,IAAI,CAACF,OAAO,CAACG,MAAM,CAACD,YAAY,CAAC;KAClC,CAAA;AAAAN,IAAAA,eAAA,oBAEW,MAAY;AACtB,MAAA,IAAI,CAACI,OAAO,CAACI,SAAS,EAAE;KACzB,CAAA;AAAA;EAdD,IAAIC,aAAaA,GAAmB;AAClC,IAAA,OAAO,IAAI,CAACL,OAAO,CAACK,aAAa;AACnC;AAcAC,EAAAA,WAAWA,GAAS;IAClB,IAAI,CAACF,SAAS,EAAE;IAChB,KAAK,CAACE,WAAW,EAAE;AACrB;AACF;;AAEA;;;;"}
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(this);\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;AAAAC,IAAAA,eAAA,CAC9C,IAAA,EAAA,SAAA,EAAA,IAAIC,oBAAoB,CAAC,IAAI,CAAC,CAAA;AAAAD,IAAAA,eAAA,CAMlC,IAAA,EAAA,KAAA,EAAA,CAACE,OAAe,EAAEC,OAA6B,KAAmB;MACtE,OAAO,IAAI,CAACC,OAAO,CAACC,GAAG,CAACH,OAAO,EAAEC,OAAO,CAAC;KAC1C,CAAA;IAAAH,eAAA,CAAA,IAAA,EAAA,QAAA,EAESM,YAA2B,IAAW;AAC9C,MAAA,IAAI,CAACF,OAAO,CAACG,MAAM,CAACD,YAAY,CAAC;KAClC,CAAA;AAAAN,IAAAA,eAAA,oBAEW,MAAY;AACtB,MAAA,IAAI,CAACI,OAAO,CAACI,SAAS,EAAE;KACzB,CAAA;AAAA;EAdD,IAAIC,aAAaA,GAAmB;AAClC,IAAA,OAAO,IAAI,CAACL,OAAO,CAACK,aAAa;AACnC;AAcAC,EAAAA,WAAWA,GAAS;IAClB,IAAI,CAACF,SAAS,EAAE;IAChB,KAAK,CAACE,WAAW,EAAE;AACrB;AACF;;AAEA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontile/notifications",
3
- "version": "0.17.0-beta.2",
3
+ "version": "0.17.0-beta.4",
4
4
  "description": "Component Library for Ember Octane apps: Notifications",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -42,11 +42,10 @@
42
42
  "dependencies": {
43
43
  "@ember/render-modifiers": "^2.1.0",
44
44
  "@embroider/addon-shim": "^1.9.0",
45
- "@frontile/buttons": "0.17.0-beta.2",
46
- "@frontile/theme": "0.17.0-beta.2",
45
+ "@frontile/buttons": "0.17.0-beta.4",
46
+ "@frontile/theme": "0.17.0-beta.4",
47
47
  "ember-auto-import": "^2.7.2",
48
- "ember-css-transitions": "^4.4.0",
49
- "ember-get-config": "^2.1.1"
48
+ "ember-css-transitions": "^4.4.0"
50
49
  },
51
50
  "devDependencies": {
52
51
  "@babel/core": "7.26.0",
@@ -54,22 +53,22 @@
54
53
  "@babel/plugin-proposal-decorators": "7.25.9",
55
54
  "@babel/plugin-transform-class-static-block": "^7.23.4",
56
55
  "@babel/preset-typescript": "7.26.0",
57
- "@embroider/addon-dev": "7.0.0",
58
- "@glimmer/component": "^1.1.2",
56
+ "@embroider/addon-dev": "7.1.1",
57
+ "@glimmer/component": "^2.0.0",
59
58
  "@glimmer/tracking": "^1.1.2",
60
59
  "@glint/core": "1.5.0",
61
60
  "@glint/environment-ember-loose": "1.5.0",
62
61
  "@glint/environment-ember-template-imports": "1.5.0",
63
62
  "@glint/template": "1.5.0",
64
- "@rollup/plugin-node-resolve": "^15.2.3",
63
+ "@rollup/plugin-node-resolve": "^16.0.0",
65
64
  "@tsconfig/ember": "^3.0.5",
66
65
  "babel-plugin-ember-template-compilation": "^2.2.1",
67
66
  "concurrently": "^9.1.0",
68
- "ember-source": "^5.12.0",
69
- "rollup": "^4.25.0",
67
+ "ember-source": "^6.1.0",
68
+ "rollup": "^4.29.1",
70
69
  "rollup-plugin-ts": "^3.4.5",
71
- "tailwindcss": "^3.4.1",
72
- "typescript": "^5.4.2"
70
+ "tailwindcss": "^3.4.17",
71
+ "typescript": "^5.7.2"
73
72
  },
74
73
  "engines": {
75
74
  "node": "10.* || >= 12"
@@ -108,5 +107,5 @@
108
107
  ]
109
108
  }
110
109
  },
111
- "gitHead": "0755b1e3d6734ba228180026cc5dc65621bed57d"
110
+ "gitHead": "bd3f230b0044b7c1d6a35a295c60c435df7ec12b"
112
111
  }