ngx-snotifire 15.1.2 → 17.0.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 (38) hide show
  1. package/{esm2020 → esm2022}/lib/components/buttons/buttons.component.mjs +5 -5
  2. package/{esm2020 → esm2022}/lib/components/ngx-notifire/ngx-snotifire.component.mjs +5 -5
  3. package/{esm2020 → esm2022}/lib/components/prompt/prompt.component.mjs +4 -4
  4. package/{esm2020 → esm2022}/lib/components/toast/toast.component.mjs +5 -5
  5. package/{esm2020 → esm2022}/lib/ngx-snotifire.module.mjs +10 -10
  6. package/{esm2020 → esm2022}/lib/pipes/keys.pipe.mjs +4 -4
  7. package/{esm2020 → esm2022}/lib/pipes/truncate.pipe.mjs +4 -4
  8. package/{esm2020 → esm2022}/lib/services/notification.service.mjs +6 -6
  9. package/{fesm2020 → fesm2022}/ngx-snotifire.mjs +36 -36
  10. package/{fesm2020 → fesm2022}/ngx-snotifire.mjs.map +1 -1
  11. package/lib/components/buttons/buttons.component.d.ts +1 -1
  12. package/lib/components/prompt/prompt.component.d.ts +1 -1
  13. package/lib/components/toast/toast.component.d.ts +1 -1
  14. package/package.json +12 -16
  15. package/fesm2015/ngx-snotifire.mjs +0 -1060
  16. package/fesm2015/ngx-snotifire.mjs.map +0 -1
  17. /package/{esm2020 → esm2022}/lib/components/buttons/buttons-config.interface.mjs +0 -0
  18. /package/{esm2020 → esm2022}/lib/components/index.mjs +0 -0
  19. /package/{esm2020 → esm2022}/lib/components/toast/notifire-toast.model.mjs +0 -0
  20. /package/{esm2020 → esm2022}/lib/decorators/set-toast-type.decorator.mjs +0 -0
  21. /package/{esm2020 → esm2022}/lib/decorators/transform-argument.decorator.mjs +0 -0
  22. /package/{esm2020 → esm2022}/lib/defaults/defaults.interface.mjs +0 -0
  23. /package/{esm2020 → esm2022}/lib/defaults/global-config.interface.mjs +0 -0
  24. /package/{esm2020 → esm2022}/lib/defaults/index.mjs +0 -0
  25. /package/{esm2020 → esm2022}/lib/defaults/toast-defaults.mjs +0 -0
  26. /package/{esm2020 → esm2022}/lib/models/index.mjs +0 -0
  27. /package/{esm2020 → esm2022}/lib/models/snotifire-animate.interface.mjs +0 -0
  28. /package/{esm2020 → esm2022}/lib/models/snotifire-config.interface.mjs +0 -0
  29. /package/{esm2020 → esm2022}/lib/models/snotifire-event.type.mjs +0 -0
  30. /package/{esm2020 → esm2022}/lib/models/snotifire-notifications.interface.mjs +0 -0
  31. /package/{esm2020 → esm2022}/lib/models/snotifire-position.type.mjs +0 -0
  32. /package/{esm2020 → esm2022}/lib/models/snotifire.model.mjs +0 -0
  33. /package/{esm2020 → esm2022}/lib/models/snotifire.type.mjs +0 -0
  34. /package/{esm2020 → esm2022}/lib/pipes/index.mjs +0 -0
  35. /package/{esm2020 → esm2022}/lib/services/index.mjs +0 -0
  36. /package/{esm2020 → esm2022}/lib/utils.mjs +0 -0
  37. /package/{esm2020 → esm2022}/ngx-snotifire.mjs +0 -0
  38. /package/{esm2020 → esm2022}/public-api.mjs +0 -0
@@ -1,1060 +0,0 @@
1
- import * as i2 from '@angular/common';
2
- import { CommonModule } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { Injectable, Inject, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Pipe, EventEmitter, Output, NgModule } from '@angular/core';
5
- import { __decorate } from 'tslib';
6
- import { Subject, from, tap, catchError, throwError, finalize, takeUntil } from 'rxjs';
7
-
8
- /**
9
- * Defines toast style depending on method name
10
- * @param target any
11
- * @param propertyKey NotificationType
12
- * @param descriptor PropertyDescriptor
13
- * @returns value: ((...args: any[]) => any)
14
- */
15
- function SetToastType(target, propertyKey, descriptor) {
16
- return {
17
- value(...args) {
18
- args[0].config = Object.assign(Object.assign({}, args[0].config), { type: propertyKey });
19
- return descriptor.value.apply(this, args);
20
- },
21
- };
22
- }
23
-
24
- var SnotifireEventType;
25
- (function (SnotifireEventType) {
26
- SnotifireEventType["MOUNTED"] = "mounted";
27
- SnotifireEventType["BEFORE_SHOW"] = "beforeShow";
28
- SnotifireEventType["SHOWN"] = "shown";
29
- SnotifireEventType["INPUT"] = "input";
30
- SnotifireEventType["CLICK"] = "click";
31
- SnotifireEventType["MOUSE_ENTER"] = "mouseenter";
32
- SnotifireEventType["MOUSE_LEAVE"] = "mouseleave";
33
- SnotifireEventType["BEFORE_HIDE"] = "beforeHide";
34
- SnotifireEventType["HIDDEN"] = "hidden";
35
- SnotifireEventType["DESTROYED"] = "destroyed";
36
- })(SnotifireEventType || (SnotifireEventType = {}));
37
-
38
- var SnotificationPositionType;
39
- (function (SnotificationPositionType) {
40
- SnotificationPositionType["LEFT_TOP"] = "leftTop";
41
- SnotificationPositionType["LEFT_CENTER"] = "leftCenter";
42
- SnotificationPositionType["LEFT_BOTTOM"] = "leftBottom";
43
- SnotificationPositionType["RIGHT_TOP"] = "rightTop";
44
- SnotificationPositionType["RIGHT_CENTER"] = "rightCenter";
45
- SnotificationPositionType["RIGHT_BOTTOM"] = "rightBottom";
46
- SnotificationPositionType["CENTER_TOP"] = "centerTop";
47
- SnotificationPositionType["CENTER_CENTER"] = "centerCenter";
48
- SnotificationPositionType["CENTER_BOTTOM"] = "centerBottom";
49
- })(SnotificationPositionType || (SnotificationPositionType = {}));
50
-
51
- var SnotifireType;
52
- (function (SnotifireType) {
53
- SnotifireType["SUCCESS"] = "success";
54
- SnotifireType["INFO"] = "info";
55
- SnotifireType["WARNING"] = "warning";
56
- SnotifireType["ERROR"] = "error";
57
- SnotifireType["ASYNC"] = "async";
58
- SnotifireType["CONFIRM"] = "confirm";
59
- SnotifireType["PROMPT"] = "prompt";
60
- })(SnotifireType || (SnotifireType = {}));
61
-
62
- class SnotifireModel {
63
- constructor(type,
64
- /**
65
- * Notification Title
66
- */
67
- title,
68
- /**
69
- * Notification message
70
- */
71
- body,
72
- /**
73
- * Config object
74
- */
75
- config,
76
- /**
77
- * Html content
78
- */
79
- html) {
80
- this.type = type;
81
- this.title = title;
82
- this.body = body;
83
- this.config = config;
84
- this.html = html;
85
- }
86
- }
87
-
88
- //todo: cp check if async
89
- /**
90
- * Transform arguments to Snotify object
91
- * @param target any
92
- * @param propertyKey SnotifyTypeType
93
- * @param descriptor PropertyDescriptor
94
- * @returns Snotify
95
- */
96
- function TransformArgument(target, propertyKey, descriptor) {
97
- if (propertyKey === SnotifireType.ASYNC) {
98
- return {
99
- value(...args) {
100
- let result;
101
- if (args.length === 2) {
102
- result = {
103
- title: null,
104
- body: args[0],
105
- config: null,
106
- action: args[1],
107
- };
108
- }
109
- else if (args.length === 3) {
110
- if (typeof args[1] === 'string') {
111
- result = {
112
- title: args[1],
113
- body: args[0],
114
- config: null,
115
- action: args[2],
116
- };
117
- }
118
- else {
119
- result = {
120
- title: null,
121
- body: args[0],
122
- config: args[2],
123
- action: args[1],
124
- };
125
- }
126
- }
127
- else {
128
- result = {
129
- title: args[1],
130
- body: args[0],
131
- config: args[3],
132
- action: args[2],
133
- };
134
- }
135
- return descriptor.value.apply(this, [
136
- result,
137
- ]);
138
- },
139
- };
140
- }
141
- else {
142
- return {
143
- value(...args) {
144
- let result;
145
- if (args.length === 1) {
146
- result = {
147
- title: null,
148
- body: args[0],
149
- config: null,
150
- };
151
- }
152
- else if (args.length === 3) {
153
- result = {
154
- title: args[1],
155
- body: args[0],
156
- config: args[2],
157
- };
158
- }
159
- else {
160
- result = {
161
- title: null,
162
- config: null,
163
- body: args[0],
164
- [typeof args[1] === 'string' ? 'title' : 'config']: args[1],
165
- };
166
- }
167
- return descriptor.value.apply(this, [
168
- result,
169
- ]);
170
- },
171
- };
172
- }
173
- }
174
-
175
- /**
176
- * Toast main model
177
- */
178
- class SnotifireToastModel {
179
- constructor(id, title, body, config) {
180
- this.id = id;
181
- this.title = title;
182
- this.body = body;
183
- this.config = config;
184
- /**
185
- * Emits NotifireEventType
186
- */
187
- this.eventEmitter = new Subject();
188
- /**
189
- * Holds all subscribers because we need to unsubscribe from all before toast get destroyed
190
- */
191
- this.eventsHolder = [];
192
- /**
193
- * Toast validator
194
- */
195
- this.valid = true;
196
- if (this.config && this.config.type === SnotifireType.PROMPT) {
197
- this.value = '';
198
- }
199
- this.on(SnotifireEventType.HIDDEN, () => {
200
- this.eventsHolder.forEach((subscription) => {
201
- subscription.unsubscribe();
202
- });
203
- });
204
- }
205
- /**
206
- * Subscribe to toast events
207
- * @returns this
208
- * @param event NotificationEventType
209
- * @param action (toast: this) => void
210
- */
211
- on(event, action) {
212
- this.eventsHolder.push(this.eventEmitter.subscribe((e) => {
213
- if (e === event) {
214
- action(this);
215
- }
216
- }));
217
- return this;
218
- }
219
- /**
220
- * Tests if a toast equals this toast.
221
- * @returns boolean true then equals else false.
222
- * @param toast notifire-toast
223
- */
224
- equals(toast) {
225
- return this.config && toast.config
226
- ? this.body === toast.body &&
227
- this.title === toast.title &&
228
- this.config.type === toast.config.type
229
- : this.body === toast.body && this.title === toast.title;
230
- }
231
- }
232
-
233
- /**
234
- * Deep merge objects.
235
- * @param sources Array<Object<any>>
236
- * @returns Object<any>
237
- */
238
- function mergeDeep(...sources) {
239
- const target = {};
240
- if (!sources.length) {
241
- return target;
242
- }
243
- while (sources.length > 0) {
244
- const source = sources.shift();
245
- if (isObject(source)) {
246
- for (const key in source) {
247
- if (isObject(source[key])) {
248
- target[key] = mergeDeep(target[key], source[key]);
249
- }
250
- else {
251
- Object.assign(target, { [key]: source[key] });
252
- }
253
- }
254
- }
255
- }
256
- return target;
257
- }
258
- /**
259
- * Generates random id
260
- * @return number
261
- */
262
- function uuid() {
263
- return Math.floor(Math.random() * (Date.now() - 1)) + 1;
264
- }
265
- /**
266
- * Simple is object check.
267
- * @param item Object<any>
268
- * @returns boolean
269
- */
270
- function isObject(item) {
271
- return item && typeof item === 'object' && !Array.isArray(item);
272
- }
273
-
274
- class SnotifireService {
275
- constructor(defaultConfig) {
276
- this.defaultConfig = defaultConfig;
277
- /**
278
- * Minimum display time of the notification message
279
- */
280
- this.minimumDisplayedTime = 3000;
281
- /**
282
- * Emits Notifire Notifications
283
- */
284
- this.emitter = new Subject();
285
- this.toastDeleted = new Subject();
286
- this.toastChanged = new Subject();
287
- this.notifications = [];
288
- }
289
- /**
290
- * Creates toast and add it to array, returns toast id
291
- * @param NotificationModel NotificationModel
292
- * @return number
293
- */
294
- create(notif) {
295
- if (this.defaultConfig.type && notif.config && notif.config.type) {
296
- const config = mergeDeep(this.defaultConfig.snotifireConfig, this.defaultConfig.type[notif.config.type], notif.config);
297
- const toast = new SnotifireToastModel(uuid(), notif.title ? notif.title : '', notif.body ? notif.body : '', config);
298
- this.add(toast);
299
- return toast;
300
- }
301
- const config = mergeDeep(this.defaultConfig.snotifireConfig, notif.config);
302
- const defaulToast = new SnotifireToastModel(uuid(), notif.title ? notif.title : '', notif.body ? notif.body : '', config);
303
- this.add(defaulToast);
304
- return defaulToast;
305
- }
306
- /**
307
- * If ID passed, emits toast animation remove, if ID & REMOVE passed, removes toast from notifications array
308
- * @param id number
309
- * @param remove boolean
310
- */
311
- remove(id, remove) {
312
- if (!id) {
313
- return this.clear();
314
- }
315
- if (remove) {
316
- this.notifications = this.notifications.filter((toast) => toast.id !== id);
317
- return this.emit();
318
- }
319
- this.toastDeleted.next(id);
320
- }
321
- setDefaults(defaults) {
322
- const mergedConfig = (this.defaultConfig = mergeDeep(this.defaultConfig, defaults));
323
- return mergedConfig;
324
- }
325
- /**
326
- * Clear notifications array
327
- */
328
- clear() {
329
- this.notifications = [];
330
- this.emit();
331
- }
332
- /**
333
- * add NotifireToast to notifications array
334
- * @param toast NotifireToast
335
- */
336
- add(toast) {
337
- if (this.defaultConfig &&
338
- this.defaultConfig.global &&
339
- this.defaultConfig.global.filterDuplicates &&
340
- this.containsToast(toast)) {
341
- if (!this.defaultConfig.global.filterDuplicates) {
342
- throw new Error('Missing global config');
343
- }
344
- return;
345
- }
346
- if (this.defaultConfig &&
347
- this.defaultConfig.global &&
348
- this.defaultConfig.global.newOnTop) {
349
- this.notifications.unshift(toast);
350
- }
351
- else {
352
- this.notifications.push(toast);
353
- }
354
- this.emit();
355
- }
356
- /**
357
- * emit changes in notifications array
358
- */
359
- emit() {
360
- this.emitter.next(this.notifications.slice());
361
- }
362
- /**
363
- * checks if the toast is in the collection.
364
- * @param inToast NotifireToast
365
- * @returns boolean
366
- */
367
- containsToast(inToast) {
368
- return this.notifications.some((toast) => toast.equals(inToast));
369
- }
370
- /**
371
- * Creates empty toast with html string inside
372
- * @param html string | SafeHtml
373
- * @param config NotifireConfig
374
- * @returns number
375
- */
376
- html(html, config) {
377
- return this.create({
378
- title: undefined,
379
- body: undefined,
380
- config: Object.assign(Object.assign({}, config), { html }),
381
- });
382
- }
383
- /**
384
- * Transform toast arguments into NotificationModel object
385
- */
386
- success(args) {
387
- if (!args.config) {
388
- throw new Error('Missing config, please configure service accordingly');
389
- }
390
- return this.create(args);
391
- }
392
- /**
393
- * Transform toast arguments into NotificationModel object
394
- */
395
- error(args) {
396
- return this.create(args);
397
- }
398
- /**
399
- * Transform toast arguments into NotificationModel object
400
- */
401
- info(args) {
402
- return this.create(args);
403
- }
404
- /**
405
- * Transform toast arguments into NotificationModel object
406
- */
407
- warning(args) {
408
- return this.create(args);
409
- }
410
- /**
411
- * Transform toast arguments into NotificationModel object
412
- */
413
- confirm(args) {
414
- return this.create(args);
415
- }
416
- /**
417
- * Transform toast arguments into NotificationModel object
418
- */
419
- prompt(args) {
420
- return this.create(args);
421
- }
422
- /**
423
- * Transform toast arguments into NotificationModel object
424
- */
425
- async(args) {
426
- let async;
427
- if (args.action instanceof Promise) {
428
- async = from(args.action);
429
- }
430
- else {
431
- async = args.action;
432
- }
433
- const toast = this.create(args);
434
- let failed = false;
435
- const asyncAtion = async.pipe(tap((next) => {
436
- console.log('called'), this.mergeToast(toast, next);
437
- }), catchError((error) => {
438
- failed = true;
439
- return throwError(() => error);
440
- }), finalize(() => {
441
- this.mergeToast(toast, {}, failed === true ? SnotifireType.ERROR : SnotifireType.SUCCESS);
442
- }));
443
- toast.on(SnotifireEventType.MOUNTED, () => {
444
- console.log('mounted');
445
- return asyncAtion;
446
- });
447
- return asyncAtion;
448
- // const toast = this.create(args);
449
- // toast.on(SnotifireEventType.MOUNTED, () => {
450
- // const subscription: Subscription = async.subscribe({
451
- // next: (next?: SnotifireModel) => {
452
- // this.mergeToast(toast, next);
453
- // },
454
- // error: (error?: SnotifireModel) => {
455
- // this.mergeToast(toast, error, SnotifireType.ERROR);
456
- // subscription.unsubscribe();
457
- // },
458
- // complete: () => {
459
- // this.mergeToast(toast, {}, SnotifireType.SUCCESS);
460
- // subscription.unsubscribe();
461
- // },
462
- // });
463
- // });
464
- // return toast;
465
- }
466
- mergeToast(toast, next, type) {
467
- var _a;
468
- if (next.body) {
469
- toast.body = next.body;
470
- }
471
- if (next.title) {
472
- toast.title = next.title;
473
- }
474
- if (type && this.defaultConfig) {
475
- console.log(type);
476
- toast.config = mergeDeep(toast.config, this.defaultConfig.global, (_a = this.defaultConfig.snotifireConfig) === null || _a === void 0 ? void 0 : _a.type, { type }, next.config);
477
- }
478
- else {
479
- toast.config = mergeDeep(toast.config, next.config);
480
- }
481
- if (next.html) {
482
- toast.config.html = next.html;
483
- }
484
- this.emit();
485
- this.toastChanged.next(toast);
486
- }
487
- /**
488
- * returns SnotifyToast object
489
- * @param id Number
490
- * @return SnotifyToast|undefined
491
- */
492
- get(id) {
493
- return (this.notifications && this.notifications.find((toast) => toast.id === id));
494
- }
495
- }
496
- SnotifireService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SnotifireService, deps: [{ token: 'snotifireConfig' }], target: i0.ɵɵFactoryTarget.Injectable });
497
- SnotifireService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SnotifireService });
498
- __decorate([
499
- TransformArgument
500
- /**
501
- * Determines current toast type and collects default configuration
502
- */
503
- ,
504
- SetToastType
505
- ], SnotifireService.prototype, "success", null);
506
- __decorate([
507
- TransformArgument
508
- /**
509
- * Determines current toast type and collects default configuration
510
- */
511
- ,
512
- SetToastType
513
- ], SnotifireService.prototype, "error", null);
514
- __decorate([
515
- TransformArgument
516
- /**
517
- * Determines current toast type and collects default configuration
518
- */
519
- ,
520
- SetToastType
521
- ], SnotifireService.prototype, "info", null);
522
- __decorate([
523
- TransformArgument
524
- /**
525
- * Determines current toast type and collects default configuration
526
- */
527
- ,
528
- SetToastType
529
- ], SnotifireService.prototype, "warning", null);
530
- __decorate([
531
- TransformArgument
532
- /**
533
- * Determines current toast type and collects default configuration
534
- */
535
- ,
536
- SetToastType
537
- ], SnotifireService.prototype, "confirm", null);
538
- __decorate([
539
- TransformArgument
540
- /**
541
- * Determines current toast type and collects default configuration
542
- */
543
- ,
544
- SetToastType
545
- ], SnotifireService.prototype, "prompt", null);
546
- __decorate([
547
- TransformArgument
548
- /**
549
- * Determines current toast type and collects default configuration
550
- */
551
- ,
552
- SetToastType
553
- ], SnotifireService.prototype, "async", null);
554
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SnotifireService, decorators: [{
555
- type: Injectable
556
- }], ctorParameters: function () {
557
- return [{ type: undefined, decorators: [{
558
- type: Inject,
559
- args: ['snotifireConfig']
560
- }] }];
561
- }, propDecorators: { success: [], error: [], info: [], warning: [], confirm: [], prompt: [], async: [] } });
562
-
563
- /**
564
- * Buttons component
565
- */
566
- class ButtonsComponent {
567
- constructor(service) {
568
- this.service = service;
569
- }
570
- /**
571
- * remove toast
572
- */
573
- remove() {
574
- this.service.remove(this.toast.id);
575
- }
576
- }
577
- ButtonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ButtonsComponent, deps: [{ token: SnotifireService }], target: i0.ɵɵFactoryTarget.Component });
578
- ButtonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: ButtonsComponent, selector: "notifire-button", inputs: { toast: "toast" }, ngImport: i0, template: "<div class=\"notifire-toast__buttons\">\n <ng-container *ngIf=\"toast.config\">\n <button\n type=\"button\"\n *ngFor=\"let button of toast.config.buttons\"\n [ngClass]=\"{ 'notifire-toast__buttons--bold': button.bold }\"\n (click)=\"button.action ? button.action(toast) : remove()\"\n >\n {{ button.text }}\n </button>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
579
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ButtonsComponent, decorators: [{
580
- type: Component,
581
- args: [{ selector: 'notifire-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"notifire-toast__buttons\">\n <ng-container *ngIf=\"toast.config\">\n <button\n type=\"button\"\n *ngFor=\"let button of toast.config.buttons\"\n [ngClass]=\"{ 'notifire-toast__buttons--bold': button.bold }\"\n (click)=\"button.action ? button.action(toast) : remove()\"\n >\n {{ button.text }}\n </button>\n </ng-container>\n</div>\n" }]
582
- }], ctorParameters: function () { return [{ type: SnotifireService }]; }, propDecorators: { toast: [{
583
- type: Input
584
- }] } });
585
-
586
- /**
587
- * Truncate toast text pipe
588
- */
589
- class TruncatePipe {
590
- constructor() {
591
- this.DEFAULT_LIMIT = 40;
592
- this.DEFAULT_TRAIL = '...';
593
- }
594
- transform(value, ...args) {
595
- const limit = args.length > 0 ? parseInt(args[0], 10) : this.DEFAULT_LIMIT;
596
- return value.length > limit
597
- ? value.substring(0, limit) +
598
- (args.length > 1 ? args[1] : this.DEFAULT_TRAIL)
599
- : value;
600
- }
601
- }
602
- TruncatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
603
- TruncatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: TruncatePipe, name: "truncate" });
604
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TruncatePipe, decorators: [{
605
- type: Pipe,
606
- args: [{
607
- name: 'truncate',
608
- }]
609
- }] });
610
-
611
- class PromptComponent {
612
- constructor() {
613
- this.inputType = SnotifireEventType.INPUT;
614
- /**
615
- * Is PROMPT focused
616
- */
617
- this.isPromptFocused = false;
618
- }
619
- getValue($event) {
620
- return $event.target.value;
621
- }
622
- }
623
- PromptComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PromptComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
624
- PromptComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: PromptComponent, selector: "ngx-snotify-prompt", inputs: { toast: "toast" }, ngImport: i0, template: "<span\n class=\"notifire-toast__input\"\n [ngClass]=\"{ 'notifire-toast__input--filled': isPromptFocused }\"\n>\n <input\n (input)=\"toast.value = getValue($event); toast.eventEmitter.next(inputType)\"\n autofocus\n class=\"notifire-toast__input__field\"\n type=\"text\"\n [id]=\"toast.id\"\n (focus)=\"isPromptFocused = true\"\n (blur)=\"isPromptFocused = !!toast.value && !!toast.value.length\"\n >\n <label\n class=\"notifire-toast__input__label\"\n [for]=\"toast.id\"\n >\n <span\n class=\"notifire-toast__input__labelContent\"\n *ngIf=\"toast.config && toast.config.placeholder \"\n >\n {{ toast.config.placeholder | truncate }}\n </span>\n </label>\n</span>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: TruncatePipe, name: "truncate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
625
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PromptComponent, decorators: [{
626
- type: Component,
627
- args: [{ selector: 'ngx-snotify-prompt', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<span\n class=\"notifire-toast__input\"\n [ngClass]=\"{ 'notifire-toast__input--filled': isPromptFocused }\"\n>\n <input\n (input)=\"toast.value = getValue($event); toast.eventEmitter.next(inputType)\"\n autofocus\n class=\"notifire-toast__input__field\"\n type=\"text\"\n [id]=\"toast.id\"\n (focus)=\"isPromptFocused = true\"\n (blur)=\"isPromptFocused = !!toast.value && !!toast.value.length\"\n >\n <label\n class=\"notifire-toast__input__label\"\n [for]=\"toast.id\"\n >\n <span\n class=\"notifire-toast__input__labelContent\"\n *ngIf=\"toast.config && toast.config.placeholder \"\n >\n {{ toast.config.placeholder | truncate }}\n </span>\n </label>\n</span>\n" }]
628
- }], propDecorators: { toast: [{
629
- type: Input
630
- }] } });
631
-
632
- class ToastComponent {
633
- constructor(service) {
634
- this.service = service;
635
- this.unsubscribe$ = new Subject();
636
- this.stateChanged = new EventEmitter();
637
- /**
638
- * Toast state
639
- */
640
- this.state = {
641
- paused: false,
642
- progress: 0,
643
- animation: '',
644
- isDestroying: false,
645
- promptType: SnotifireType.PROMPT,
646
- };
647
- }
648
- ngOnInit() {
649
- this.service.toastChanged
650
- .pipe(takeUntil(this.unsubscribe$))
651
- .subscribe((toast) => {
652
- if (this.toast.id === toast.id) {
653
- this.initToast();
654
- }
655
- });
656
- this.service.toastDeleted
657
- .pipe(takeUntil(this.unsubscribe$))
658
- .subscribe((id) => {
659
- if (this.toast.id === id) {
660
- this.onRemove();
661
- }
662
- });
663
- if (this.toast && this.toast.config && !this.toast.config.timeout) {
664
- this.toast.config.showProgressBar = false;
665
- }
666
- this.toast.eventEmitter.next(SnotifireEventType.MOUNTED);
667
- this.state.animation = 'notifire-toast--in';
668
- }
669
- ngAfterContentInit() {
670
- if (this.service.defaultConfig.snotifireConfig &&
671
- this.service.defaultConfig.snotifireConfig.animation) {
672
- setTimeout(() => {
673
- this.stateChanged.emit(SnotifireEventType.BEFORE_SHOW);
674
- this.toast.eventEmitter.next(SnotifireEventType.BEFORE_SHOW);
675
- this.state.animation =
676
- this.toast.config &&
677
- this.toast.config.animation &&
678
- this.toast.config.animation.enter
679
- ? this.toast.config.animation.enter
680
- : '';
681
- }, this.service.defaultConfig.snotifireConfig.animation.time / 5); // time to show toast push animation (notifire-toast--in)
682
- }
683
- }
684
- /**
685
- * Trigger beforeDestroy lifecycle. Removes toast
686
- */
687
- onRemove() {
688
- this.state.isDestroying = true;
689
- this.toast.eventEmitter.next(SnotifireEventType.BEFORE_HIDE);
690
- this.stateChanged.emit(SnotifireEventType.BEFORE_HIDE);
691
- this.state.animation =
692
- (this.toast.config &&
693
- this.toast.config.animation &&
694
- this.toast.config.animation.exit) ||
695
- '';
696
- setTimeout(() => {
697
- this.stateChanged.emit(SnotifireEventType.HIDDEN);
698
- this.state.animation = 'notifire-toast--out';
699
- this.toast.eventEmitter.next(SnotifireEventType.HIDDEN);
700
- setTimeout(() => this.service.remove(this.toast.id, true), this.toast.config &&
701
- this.toast.config.animation &&
702
- this.toast.config.animation.time / 2);
703
- }, this.toast.config && this.toast.config.animation && this.toast.config.animation.time / 2);
704
- }
705
- /**
706
- * Trigger OnClick lifecycle
707
- */
708
- onClick() {
709
- this.toast.eventEmitter.next(SnotifireEventType.CLICK);
710
- if (this.toast && this.toast.config && this.toast.config.closeOnClick) {
711
- this.service.remove(this.toast.id);
712
- }
713
- }
714
- /**
715
- * Trigger onHoverEnter lifecycle
716
- */
717
- onMouseEnter() {
718
- this.toast.eventEmitter.next(SnotifireEventType.MOUSE_ENTER);
719
- if (this.toast && this.toast.config && this.toast.config.pauseOnHover) {
720
- this.state.paused = true;
721
- }
722
- }
723
- /**
724
- * Trigger onHoverLeave lifecycle
725
- */
726
- onMouseLeave() {
727
- if (this.toast &&
728
- this.toast.config &&
729
- this.toast.config.pauseOnHover &&
730
- this.toast.config.timeout) {
731
- this.state.paused = false;
732
- this.startTimeout(this.toast.config.timeout * this.state.progress);
733
- }
734
- this.toast.eventEmitter.next(SnotifireEventType.MOUSE_LEAVE);
735
- }
736
- /**
737
- * Remove toast completely after animation
738
- */
739
- onExitTransitionEnd() {
740
- if (this.state.isDestroying) {
741
- return;
742
- }
743
- this.initToast();
744
- this.toast.eventEmitter.next(SnotifireEventType.SHOWN);
745
- }
746
- /*
747
- Common
748
- */
749
- /**
750
- * Initialize base toast config
751
- *
752
- */
753
- initToast() {
754
- if ((this.toast && this.toast.config && this.toast.config.timeout
755
- ? this.toast.config.timeout
756
- : 0) > 0) {
757
- this.startTimeout(0);
758
- }
759
- }
760
- /**
761
- * Start progress bar
762
- * @param startTime number
763
- */
764
- startTimeout(startTime = 0) {
765
- const start = performance.now();
766
- const calculate = () => {
767
- this.animationFrame = requestAnimationFrame((timestamp) => {
768
- const runtime = timestamp + startTime - start;
769
- const progress = Math.min(runtime /
770
- (this.toast && this.toast.config && this.toast.config.timeout
771
- ? this.toast.config.timeout
772
- : 1), 1);
773
- if (this.state.paused) {
774
- cancelAnimationFrame(this.animationFrame);
775
- }
776
- else if (runtime <
777
- (this.toast && this.toast.config && this.toast.config.timeout
778
- ? this.toast.config.timeout
779
- : 1)) {
780
- this.state.progress = progress;
781
- calculate();
782
- }
783
- else {
784
- this.state.progress = 1;
785
- cancelAnimationFrame(this.animationFrame);
786
- this.service.remove(this.toast.id);
787
- }
788
- });
789
- };
790
- calculate();
791
- }
792
- ngOnDestroy() {
793
- this.unsubscribe$.next();
794
- this.unsubscribe$.complete();
795
- }
796
- }
797
- ToastComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ToastComponent, deps: [{ token: SnotifireService }], target: i0.ɵɵFactoryTarget.Component });
798
- ToastComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: ToastComponent, selector: "ngx-toast", inputs: { toast: "toast" }, outputs: { stateChanged: "stateChanged" }, ngImport: i0, template: "<ng-container *ngIf=\"toast && toast.config\">\n <div\n [attr.role]=\"toast.config.type === state.promptType ? 'dialog' : 'alert'\"\n [attr.aria-labelledby]=\"'snotify_' + toast.id\"\n [attr.aria-modal]=\"toast.config.type === state.promptType\"\n [ngClass]=\"[\n 'notifire-toast animated',\n 'snotify-' + toast.config.type,\n state.animation, toast.valid === undefined ? '' : toast.valid ? 'snotifyToast--valid' : 'snotifyToast--invalid'\n]\"\n [ngStyle]=\"{\n '-webkit-transition': toast.config.animation && toast.config.animation.time + 'ms',\n transition: toast.config.animation && toast.config.animation.time + 'ms',\n '-webkit-animation-duration': toast.config.animation && toast.config.animation.time + 'ms',\n 'animation-duration': toast.config.animation && toast.config.animation.time + 'ms'\n}\"\n (animationend)=\"onExitTransitionEnd()\"\n (click)=\"onClick()\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n >\n <div\n class=\"notifire-toast__progressBar\"\n *ngIf=\"toast.config.showProgressBar\"\n >\n <span\n class=\"notifire-toast__progressBar__percentage\"\n [ngStyle]=\"{ width: state.progress * 100 + '%' }\"\n ></span>\n </div>\n <div\n class=\"notifire-toast__inner\"\n *ngIf=\"!toast.config.html; else toastHTML\"\n >\n <div\n class=\"notifire-toast__title\"\n [attr.id]=\"'snotify_' + toast.id\"\n *ngIf=\"toast.title\"\n >\n {{ toast.title | truncate: toast.config.titleMaxLength }}\n </div>\n <div\n class=\"notifire-toast__body\"\n *ngIf=\"toast.body\"\n >\n {{ toast.body | truncate: toast.config.bodyMaxLength }}\n </div>\n <ngx-snotify-prompt\n *ngIf=\"toast.config.type === state.promptType\"\n [toast]=\"toast\"\n >\n </ngx-snotify-prompt>\n <div\n *ngIf=\"!toast.config.icon; else elseBlock\"\n [ngClass]=\"['snotifire-icon', toast.config.iconClass || 'snotifire-icon--' + toast.config.type]\"\n ></div>\n <ng-template #elseBlock>\n <img\n class=\"snotifire-icon\"\n [src]=\"toast.config.icon\"\n >\n </ng-template>\n </div>\n <ng-template #toastHTML>\n <div\n class=\"notifire-toast__inner\"\n [innerHTML]=\"toast.config.html\"\n ></div>\n </ng-template>\n <notifire-button\n *ngIf=\"toast.config.buttons\"\n [toast]=\"toast\"\n ></notifire-button>\n </div>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: PromptComponent, selector: "ngx-snotify-prompt", inputs: ["toast"] }, { kind: "component", type: ButtonsComponent, selector: "notifire-button", inputs: ["toast"] }, { kind: "pipe", type: TruncatePipe, name: "truncate" }], encapsulation: i0.ViewEncapsulation.None });
799
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ToastComponent, decorators: [{
800
- type: Component,
801
- args: [{ selector: 'ngx-toast', encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"toast && toast.config\">\n <div\n [attr.role]=\"toast.config.type === state.promptType ? 'dialog' : 'alert'\"\n [attr.aria-labelledby]=\"'snotify_' + toast.id\"\n [attr.aria-modal]=\"toast.config.type === state.promptType\"\n [ngClass]=\"[\n 'notifire-toast animated',\n 'snotify-' + toast.config.type,\n state.animation, toast.valid === undefined ? '' : toast.valid ? 'snotifyToast--valid' : 'snotifyToast--invalid'\n]\"\n [ngStyle]=\"{\n '-webkit-transition': toast.config.animation && toast.config.animation.time + 'ms',\n transition: toast.config.animation && toast.config.animation.time + 'ms',\n '-webkit-animation-duration': toast.config.animation && toast.config.animation.time + 'ms',\n 'animation-duration': toast.config.animation && toast.config.animation.time + 'ms'\n}\"\n (animationend)=\"onExitTransitionEnd()\"\n (click)=\"onClick()\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n >\n <div\n class=\"notifire-toast__progressBar\"\n *ngIf=\"toast.config.showProgressBar\"\n >\n <span\n class=\"notifire-toast__progressBar__percentage\"\n [ngStyle]=\"{ width: state.progress * 100 + '%' }\"\n ></span>\n </div>\n <div\n class=\"notifire-toast__inner\"\n *ngIf=\"!toast.config.html; else toastHTML\"\n >\n <div\n class=\"notifire-toast__title\"\n [attr.id]=\"'snotify_' + toast.id\"\n *ngIf=\"toast.title\"\n >\n {{ toast.title | truncate: toast.config.titleMaxLength }}\n </div>\n <div\n class=\"notifire-toast__body\"\n *ngIf=\"toast.body\"\n >\n {{ toast.body | truncate: toast.config.bodyMaxLength }}\n </div>\n <ngx-snotify-prompt\n *ngIf=\"toast.config.type === state.promptType\"\n [toast]=\"toast\"\n >\n </ngx-snotify-prompt>\n <div\n *ngIf=\"!toast.config.icon; else elseBlock\"\n [ngClass]=\"['snotifire-icon', toast.config.iconClass || 'snotifire-icon--' + toast.config.type]\"\n ></div>\n <ng-template #elseBlock>\n <img\n class=\"snotifire-icon\"\n [src]=\"toast.config.icon\"\n >\n </ng-template>\n </div>\n <ng-template #toastHTML>\n <div\n class=\"notifire-toast__inner\"\n [innerHTML]=\"toast.config.html\"\n ></div>\n </ng-template>\n <notifire-button\n *ngIf=\"toast.config.buttons\"\n [toast]=\"toast\"\n ></notifire-button>\n </div>\n</ng-container>\n" }]
802
- }], ctorParameters: function () { return [{ type: SnotifireService }]; }, propDecorators: { toast: [{
803
- type: Input
804
- }], stateChanged: [{
805
- type: Output
806
- }] } });
807
-
808
- /**
809
- * Extract object keys pipe
810
- */
811
- class KeysPipe {
812
- transform(value) {
813
- if (!value) {
814
- return value;
815
- }
816
- return Object.keys(value);
817
- }
818
- }
819
- KeysPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: KeysPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
820
- KeysPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: KeysPipe, name: "keys", pure: false });
821
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: KeysPipe, decorators: [{
822
- type: Pipe,
823
- args: [{
824
- name: 'keys',
825
- pure: false,
826
- }]
827
- }] });
828
-
829
- class NgxSnotifireComponent {
830
- constructor(service) {
831
- this.service = service;
832
- this.unsubscribe$ = new Subject();
833
- /**
834
- * Backdrop Opacity
835
- */
836
- this.backdrop = -1;
837
- /**
838
- * How many toasts with backdrop in current queue
839
- */
840
- this.withBackdrop = [];
841
- }
842
- ngAfterViewInit() { }
843
- ngOnInit() {
844
- this.service.emitter
845
- .pipe(takeUntil(this.unsubscribe$))
846
- .subscribe((toasts) => {
847
- if (this.service.defaultConfig &&
848
- this.service.defaultConfig.global &&
849
- this.service.defaultConfig.global.newOnTop) {
850
- this.dockSizeA = this.service.defaultConfig.global.maxOnScreen
851
- ? -this.service.defaultConfig.global.maxOnScreen
852
- : 6;
853
- this.dockSizeB = undefined;
854
- this.blockSizeA = this.service.defaultConfig.global.maxAtPosition
855
- ? -this.service.defaultConfig.global.maxAtPosition
856
- : 4;
857
- this.blockSizeB = undefined;
858
- this.withBackdrop = toasts.filter((toast) => toast.config &&
859
- toast.config.backdrop &&
860
- toast.config.backdrop >= 0);
861
- }
862
- else {
863
- this.dockSizeA = 0;
864
- this.dockSizeB =
865
- this.service.defaultConfig.global &&
866
- this.service.defaultConfig.global.maxOnScreen;
867
- this.blockSizeA = 0;
868
- this.blockSizeB =
869
- this.service.defaultConfig.global &&
870
- this.service.defaultConfig.global.maxAtPosition;
871
- this.withBackdrop = toasts
872
- .filter((toast) => toast.config &&
873
- toast.config.backdrop &&
874
- toast.config.backdrop >= 0)
875
- .reverse();
876
- }
877
- this.notifications = this.splitToasts(toasts.slice(this.dockSizeA, this.dockSizeB));
878
- this.stateChanged(SnotifireEventType.MOUNTED);
879
- });
880
- }
881
- /**
882
- * Split toasts toasts into different objects
883
- * @param toasts notifire-toast[]
884
- * @returns SnotifyNotifications
885
- */
886
- splitToasts(toasts) {
887
- const result = {};
888
- for (const property in SnotificationPositionType) {
889
- if (SnotificationPositionType.hasOwnProperty(property)) {
890
- result[SnotificationPositionType[property]] = [];
891
- }
892
- }
893
- toasts.forEach((toast) => {
894
- var _a;
895
- if (toast.config.position) {
896
- const keyIndex = Object.keys(SnotificationPositionType).indexOf(toast.config.position);
897
- const searchedString = Object.values(SnotificationPositionType)[keyIndex];
898
- (_a = result[searchedString]) === null || _a === void 0 ? void 0 : _a.push(toast);
899
- }
900
- });
901
- return result;
902
- }
903
- getNotificationArray(notifications, position) {
904
- return notifications[position];
905
- }
906
- /**
907
- * Changes the backdrop opacity
908
- * @param event NotificationEventType
909
- */
910
- stateChanged(event) {
911
- var _a;
912
- if (!this.withBackdrop.length) {
913
- if (this.backdrop && this.backdrop >= 0) {
914
- this.backdrop = -1;
915
- }
916
- return;
917
- }
918
- switch (event) {
919
- case 'mounted':
920
- if (this.backdrop && this.backdrop < 0) {
921
- this.backdrop = 0;
922
- }
923
- break;
924
- case 'beforeShow':
925
- this.backdrop =
926
- (_a = this.withBackdrop[this.withBackdrop.length - 1].config) === null || _a === void 0 ? void 0 : _a.backdrop;
927
- break;
928
- case 'beforeHide':
929
- if (this.withBackdrop.length === 1) {
930
- this.backdrop = 0;
931
- }
932
- break;
933
- case 'hidden':
934
- if (this.withBackdrop.length === 1) {
935
- this.backdrop = -1;
936
- }
937
- break;
938
- }
939
- }
940
- ngOnDestroy() {
941
- this.unsubscribe$.next();
942
- this.unsubscribe$.complete();
943
- }
944
- }
945
- NgxSnotifireComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NgxSnotifireComponent, deps: [{ token: SnotifireService }], target: i0.ɵɵFactoryTarget.Component });
946
- NgxSnotifireComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: NgxSnotifireComponent, selector: "ngx-snotifire", ngImport: i0, template: "<div\n class=\"snotifire-backdrop\"\n *ngIf=\"backdrop && backdrop >= 0\"\n [style.opacity]=\"backdrop\"\n></div>\n\n<div\n *ngFor=\"let position of notifications | keys\"\n class=\"snotify snotify-{{ position }}\"\n>\n <ngx-toast\n *ngFor=\"let notification of getNotificationArray(notifications, position) | slice: blockSizeA:blockSizeB\"\n [toast]=\"notification\"\n (stateChanged)=\"stateChanged($event)\"\n >\n </ngx-toast>\n\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ToastComponent, selector: "ngx-toast", inputs: ["toast"], outputs: ["stateChanged"] }, { kind: "pipe", type: i2.SlicePipe, name: "slice" }, { kind: "pipe", type: KeysPipe, name: "keys" }], encapsulation: i0.ViewEncapsulation.None });
947
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NgxSnotifireComponent, decorators: [{
948
- type: Component,
949
- args: [{ selector: 'ngx-snotifire', encapsulation: ViewEncapsulation.None, template: "<div\n class=\"snotifire-backdrop\"\n *ngIf=\"backdrop && backdrop >= 0\"\n [style.opacity]=\"backdrop\"\n></div>\n\n<div\n *ngFor=\"let position of notifications | keys\"\n class=\"snotify snotify-{{ position }}\"\n>\n <ngx-toast\n *ngFor=\"let notification of getNotificationArray(notifications, position) | slice: blockSizeA:blockSizeB\"\n [toast]=\"notification\"\n (stateChanged)=\"stateChanged($event)\"\n >\n </ngx-toast>\n\n</div>\n" }]
950
- }], ctorParameters: function () { return [{ type: SnotifireService }]; } });
951
-
952
- class NgxSnotifireModule {
953
- static forRoot() {
954
- return {
955
- ngModule: NgxSnotifireModule,
956
- providers: [SnotifireService],
957
- };
958
- }
959
- }
960
- NgxSnotifireModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NgxSnotifireModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
961
- NgxSnotifireModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: NgxSnotifireModule, declarations: [PromptComponent,
962
- ToastComponent,
963
- ButtonsComponent,
964
- TruncatePipe,
965
- KeysPipe,
966
- NgxSnotifireComponent], imports: [CommonModule], exports: [NgxSnotifireComponent] });
967
- NgxSnotifireModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NgxSnotifireModule, imports: [CommonModule] });
968
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NgxSnotifireModule, decorators: [{
969
- type: NgModule,
970
- args: [{
971
- declarations: [
972
- PromptComponent,
973
- ToastComponent,
974
- ButtonsComponent,
975
- TruncatePipe,
976
- KeysPipe,
977
- NgxSnotifireComponent,
978
- ],
979
- imports: [CommonModule],
980
- exports: [NgxSnotifireComponent],
981
- }]
982
- }] });
983
-
984
- /**
985
- * Snotify default configuration object
986
- */
987
- const ToastDefaults = {
988
- global: {
989
- newOnTop: true,
990
- maxOnScreen: 8,
991
- maxAtPosition: 8,
992
- filterDuplicates: false,
993
- },
994
- snotifireConfig: {
995
- type: SnotifireType.INFO,
996
- showProgressBar: true,
997
- timeout: 5000,
998
- closeOnClick: true,
999
- pauseOnHover: true,
1000
- bodyMaxLength: 150,
1001
- titleMaxLength: 16,
1002
- backdrop: -1,
1003
- icon: undefined,
1004
- iconClass: undefined,
1005
- html: undefined,
1006
- position: 'RIGHT_TOP',
1007
- animation: { enter: 'fadeIn', exit: 'fadeOut', time: 400 },
1008
- },
1009
- type: {
1010
- [SnotifireType.PROMPT]: {
1011
- timeout: 0,
1012
- closeOnClick: false,
1013
- buttons: [
1014
- { text: 'Ok', action: null, bold: true },
1015
- { text: 'Cancel', action: null, bold: false },
1016
- ],
1017
- placeholder: 'Enter answer here...',
1018
- type: SnotifireType.PROMPT,
1019
- },
1020
- [SnotifireType.CONFIRM]: {
1021
- timeout: 0,
1022
- closeOnClick: false,
1023
- buttons: [
1024
- { text: 'Ok', action: null, bold: true },
1025
- { text: 'Cancel', action: null, bold: false },
1026
- ],
1027
- type: SnotifireType.CONFIRM,
1028
- },
1029
- [SnotifireType.SUCCESS]: {
1030
- type: SnotifireType.SUCCESS,
1031
- },
1032
- [SnotifireType.ERROR]: {
1033
- type: SnotifireType.ERROR,
1034
- },
1035
- [SnotifireType.WARNING]: {
1036
- type: SnotifireType.WARNING,
1037
- },
1038
- [SnotifireType.INFO]: {
1039
- type: SnotifireType.INFO,
1040
- },
1041
- [SnotifireType.ASYNC]: {
1042
- pauseOnHover: false,
1043
- closeOnClick: false,
1044
- timeout: 0,
1045
- showProgressBar: false,
1046
- type: SnotifireType.ASYNC,
1047
- },
1048
- },
1049
- };
1050
-
1051
- /*
1052
- * Public API Surface of ngx-notifire
1053
- */
1054
-
1055
- /**
1056
- * Generated bundle index. Do not edit.
1057
- */
1058
-
1059
- export { ButtonsComponent, KeysPipe, NgxSnotifireComponent, NgxSnotifireModule, PromptComponent, SnotificationPositionType, SnotifireEventType, SnotifireModel, SnotifireService, SnotifireToastModel, SnotifireType, ToastComponent, ToastDefaults, TruncatePipe };
1060
- //# sourceMappingURL=ngx-snotifire.mjs.map