UNPKG

angular-toaster

Version:

An Angular Toaster Notification library based on AngularJS-Toaster

716 lines (703 loc) 30.7 kB
import * as i0 from '@angular/core'; import { Injectable, InjectionToken, inject, Pipe, ViewContainerRef, ChangeDetectorRef, NgZone, ElementRef, Renderer2, EventEmitter, HostListener, Output, ViewChild, Input, Component, NgModule, makeEnvironmentProviders } from '@angular/core'; import { Observable, share, Subject } from 'rxjs'; import { NgClass, CommonModule } from '@angular/common'; import { trigger, state, transition, style, animate, group } from '@angular/animations'; import { DomSanitizer } from '@angular/platform-browser'; class Guid { static newGuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { const r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } } class ToasterService { constructor() { this.addToast = new Observable((observer) => this._addToast = observer).pipe(share()); this.clearToasts = new Observable((observer) => this._clearToasts = observer).pipe(share()); this._removeToastSubject = new Subject(); this.removeToast = this._removeToastSubject.pipe(share()); } /** * Synchronously create and show a new toast instance. * * @param {(string | Toast)} type The type of the toast, or a Toast object. * @param {string=} title The toast title. * @param {string=} body The toast body. * @returns {Toast} * The newly created Toast instance with a randomly generated GUID Id. */ pop(type, title, body) { const toast = typeof type === 'string' ? { type: type, title: title, body: body } : type; if (!toast.toastId) { toast.toastId = Guid.newGuid(); } if (!this._addToast) { throw new Error('No Toaster Containers have been initialized to receive toasts.'); } this._addToast.next(toast); return toast; } /** * Asynchronously create and show a new toast instance. * * @param {(string | Toast)} type The type of the toast, or a Toast object. * @param {string=} title The toast title. * @param {string=} body The toast body. * @returns {Observable<Toast>} * A hot Observable that can be subscribed to in order to receive the Toast instance * with a randomly generated GUID Id. */ popAsync(type, title, body) { setTimeout(() => { this.pop(type, title, body); }, 0); return this.addToast; } /** * Clears a toast by toastId and/or toastContainerId. * * @param {string} toastId The toastId to clear. * @param {number=} toastContainerId * The toastContainerId of the container to remove toasts from. */ clear(toastId, toastContainerId) { const clearWrapper = { toastId: toastId, toastContainerId: toastContainerId }; this._clearToasts.next(clearWrapper); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterService, providedIn: 'root' }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: () => [] }); var BodyOutputType; (function (BodyOutputType) { BodyOutputType[BodyOutputType["Default"] = 0] = "Default"; BodyOutputType[BodyOutputType["TrustedHtml"] = 1] = "TrustedHtml"; BodyOutputType[BodyOutputType["Component"] = 2] = "Component"; })(BodyOutputType || (BodyOutputType = {})); const DefaultTypeClasses = { error: "angular-toast-error", info: "angular-toast-info", wait: "angular-toast-wait", success: "angular-toast-success", warning: "angular-toast-warning", }; const DefaultIconClasses = { error: "icon-error", info: "icon-info", wait: "icon-wait", success: "icon-success", warning: "icon-warning", }; const defaultToasterConfig = { limit: null, tapToDismiss: true, showCloseButton: false, closeHtml: "<span>&times;</span>", newestOnTop: true, timeout: 5000, typeClasses: DefaultTypeClasses, iconClasses: DefaultIconClasses, bodyOutputType: BodyOutputType.Default, bodyTemplate: "toasterBodyTmpl.html", defaultToastType: "info", positionClass: "angular-toast-top-right", titleClass: "angular-toast-title", messageClass: "angular-toast-message", animation: "", preventDuplicates: false, mouseoverTimerStop: false, toastContainerId: null, }; const ToasterConfigInjectionToken = new InjectionToken("ToasterConfig"); class ToasterConfig { constructor(configOverrides) { configOverrides = configOverrides || {}; this.limit = configOverrides.limit || null; this.tapToDismiss = configOverrides.tapToDismiss != null ? configOverrides.tapToDismiss : true; this.showCloseButton = configOverrides.showCloseButton != null ? configOverrides.showCloseButton : false; this.closeHtml = configOverrides.closeHtml || "<span>&times;</span>"; this.newestOnTop = configOverrides.newestOnTop != null ? configOverrides.newestOnTop : true; this.timeout = configOverrides.timeout != null ? configOverrides.timeout : 5000; this.typeClasses = configOverrides.typeClasses || DefaultTypeClasses; this.iconClasses = configOverrides.iconClasses || DefaultIconClasses; this.bodyOutputType = configOverrides.bodyOutputType || BodyOutputType.Default; this.bodyTemplate = configOverrides.bodyTemplate || "toasterBodyTmpl.html"; this.defaultToastType = configOverrides.defaultToastType || "info"; this.positionClass = configOverrides.positionClass || "angular-toast-top-right"; this.titleClass = configOverrides.titleClass || "angular-toast-title"; this.messageClass = configOverrides.messageClass || "angular-toast-message"; this.animation = configOverrides.animation || ""; this.preventDuplicates = configOverrides.preventDuplicates != null ? configOverrides.preventDuplicates : false; this.mouseoverTimerStop = configOverrides.mouseoverTimerStop != null ? configOverrides.mouseoverTimerStop : false; this.toastContainerId = configOverrides.toastContainerId != null ? configOverrides.toastContainerId : null; } } const Transitions = [ trigger('toastState', [ state('flyRight, flyLeft, slideDown, slideDown, slideUp, slideUp, fade', style({ opacity: 1, transform: 'translate(0,0)' })), transition('void => flyRight', [ style({ opacity: 0, transform: 'translateX(100%)', height: 0 }), animate('0.15s ease-in', style({ opacity: 1, height: '*' })), animate('0.25s 15ms ease-in') ]), transition('flyRight => void', [ animate('0.25s ease-out', style({ opacity: 0, transform: 'translateX(100%)' })), animate('0.15s ease-out', style({ height: 0 })) ]), transition('void => flyLeft', [ style({ opacity: 0, transform: 'translateX(-100%)', height: 0 }), animate('0.15s ease-in', style({ opacity: 1, height: '*' })), animate('0.25s 15ms ease-in') ]), transition('flyLeft => void', [ animate('0.25s 10ms ease-out', style({ opacity: 0, transform: 'translateX(-100%)' })), animate('0.15s ease-out', style({ height: 0 })) ]), transition('void => slideDown', [ style({ opacity: 0, transform: 'translateY(-500%)', height: 0 }), group([ animate('0.2s ease-in', style({ height: '*' })), animate('0.4s ease-in', style({ transform: 'translate(0,0)' })), animate('0.3s 0.1s ease-in', style({ opacity: 1 })) ]) ]), transition('slideDown => void', group([ animate('0.3s ease-out', style({ opacity: 0 })), animate('0.4s ease-out', style({ transform: 'translateY(-500%)' })), animate('0.2s 0.2s ease-out', style({ height: 0 })) ])), transition('void => slideUp', [ style({ opacity: 0, transform: 'translateY(1000%)', height: 0 }), group([ animate('0.2s ease-in', style({ height: '*' })), animate('0.5s ease-in', style({ transform: 'translate(0,0)' })), animate('0.3s 0.1s ease-in', style({ opacity: 1 })) ]) ]), transition('slideUp => void', group([ animate('0.3s ease-out', style({ opacity: 0 })), animate('0.5s ease-out', style({ transform: 'translateY(1000%)' })), animate('0.3s 0.15s ease-out', style({ height: 0 })) ])), transition('void => fade', [ style({ opacity: 0, height: 0 }), animate('0.20s ease-in', style({ height: '*' })), animate('0.15s ease-in', style({ opacity: 1 })) ]), transition('fade => void', [ group([ animate('0.0s ease-out', style({ // reposition the background to prevent // a ghost image during transition 'background-position': '-99999px' })), animate('0.15s ease-out', style({ opacity: 0, //'background-image': '' })), animate('0.3s 20ms ease-out', style({ height: 0 })) ]) ]) ]), ]; class TrustHtmlPipe { constructor() { this.sanitizer = inject(DomSanitizer); } transform(content) { return this.sanitizer.bypassSecurityTrustHtml(content ?? ""); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: TrustHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); } static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.2", ngImport: i0, type: TrustHtmlPipe, isStandalone: true, name: "trustHtml" }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: TrustHtmlPipe, decorators: [{ type: Pipe, args: [{ name: "trustHtml", pure: true, standalone: true, }] }] }); class ToasterComponent { constructor() { this.viewContainerRef = inject(ViewContainerRef); this.changeDetectorRef = inject(ChangeDetectorRef); this.ngZone = inject(NgZone); this.element = inject(ElementRef); this.renderer2 = inject(Renderer2); this.progressBarWidth = -1; this.bodyOutputType = BodyOutputType; this.clickEvent = new EventEmitter(); this.removeToastEvent = new EventEmitter(); this.timeoutId = null; this.timeout = 0; this.progressBarIntervalId = null; } ngOnInit() { if (this.toast.progressBar) { this.toast.progressBarDirection = this.toast.progressBarDirection || "decreasing"; } let timeout = typeof this.toast.timeout === "number" ? this.toast.timeout : this.toasterconfig.timeout; if (typeof timeout === "object") { timeout = timeout[this.toast.type]; } this.timeout = timeout; } ngAfterViewInit() { if (this.toast.bodyOutputType === this.bodyOutputType.Component) { const componentInstance = this.viewContainerRef.createComponent(this.toast.body, undefined, this.componentBody.injector); componentInstance.instance.toast = this.toast; this.changeDetectorRef.detectChanges(); } if (this.toasterconfig.mouseoverTimerStop) { // only apply a mouseenter event when necessary to avoid // unnecessary event and change detection cycles. this.removeMouseOverListener = this.renderer2.listen(this.element.nativeElement, "mouseenter", () => this.stopTimer()); } this.configureTimer(); } click(event, toast) { event.stopPropagation(); this.clickEvent.emit({ value: { toast: toast, isCloseButton: true } }); } stopTimer() { this.progressBarWidth = 0; this.clearTimers(); } restartTimer() { if (this.toasterconfig.mouseoverTimerStop) { if (!this.timeoutId) { this.configureTimer(); } } else if (this.timeout && !this.timeoutId) { this.removeToast(); } } ngOnDestroy() { if (this.removeMouseOverListener) { this.removeMouseOverListener(); } this.clearTimers(); } configureTimer() { if (!this.timeout || this.timeout < 1) { return; } if (this.toast.progressBar) { this.removeToastTick = new Date().getTime() + this.timeout; this.progressBarWidth = -1; } this.ngZone.runOutsideAngular(() => { this.timeoutId = window.setTimeout(() => { this.ngZone.run(() => { this.changeDetectorRef.markForCheck(); this.removeToast(); }); }, this.timeout); if (this.toast.progressBar) { this.progressBarIntervalId = window.setInterval(() => { this.ngZone.run(() => { this.updateProgressBar(); }); }, 10); } }); } updateProgressBar() { if (this.progressBarWidth === 0 || this.progressBarWidth === 100) { return; } this.progressBarWidth = ((this.removeToastTick - new Date().getTime()) / this.timeout) * 100; if (this.toast.progressBarDirection === "increasing") { this.progressBarWidth = 100 - this.progressBarWidth; } if (this.progressBarWidth < 0) { this.progressBarWidth = 0; } if (this.progressBarWidth > 100) { this.progressBarWidth = 100; } } clearTimers() { if (this.timeoutId) { window.clearTimeout(this.timeoutId); } if (this.progressBarIntervalId) { window.clearInterval(this.progressBarIntervalId); } this.timeoutId = null; this.progressBarIntervalId = null; } removeToast() { this.removeToastEvent.emit(this.toast); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.2", type: ToasterComponent, isStandalone: true, selector: "[toastComp]", inputs: { toasterconfig: "toasterconfig", toast: "toast", titleClass: "titleClass", messageClass: "messageClass" }, outputs: { clickEvent: "clickEvent", removeToastEvent: "removeToastEvent" }, host: { listeners: { "mouseleave": "restartTimer()" } }, viewQueries: [{ propertyName: "componentBody", first: true, predicate: ["componentBody"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div class=\"angular-toast-content\">\n <div [ngClass]=\"titleClass\">{{toast.title}}</div>\n <div [ngClass]=\"messageClass\">\n @switch (toast.bodyOutputType) {\n @case (bodyOutputType.Component) {\n <div #componentBody></div>\n }\n @case (bodyOutputType.TrustedHtml) {\n <div [innerHTML]=\"toast.body | trustHtml\"></div>\n }\n @case (bodyOutputType.Default) {\n <div>{{toast.body}}</div>\n }\n }\n </div>\n</div>\n@if (toast.showCloseButton) {\n<button class=\"angular-toast-close-button\" (click)=\"click($event, toast)\" [innerHTML]=\"toast.closeHtml | trustHtml\">\n</button>\n}\n@if (toast.progressBar) {\n<div>\n <div class=\"angular-toast-progress-bar\" [style.width]=\"progressBarWidth + '%'\"></div>\n</div>\n\n}\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: TrustHtmlPipe, name: "trustHtml" }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterComponent, decorators: [{ type: Component, args: [{ selector: "[toastComp]", imports: [NgClass, TrustHtmlPipe], template: "<div class=\"angular-toast-content\">\n <div [ngClass]=\"titleClass\">{{toast.title}}</div>\n <div [ngClass]=\"messageClass\">\n @switch (toast.bodyOutputType) {\n @case (bodyOutputType.Component) {\n <div #componentBody></div>\n }\n @case (bodyOutputType.TrustedHtml) {\n <div [innerHTML]=\"toast.body | trustHtml\"></div>\n }\n @case (bodyOutputType.Default) {\n <div>{{toast.body}}</div>\n }\n }\n </div>\n</div>\n@if (toast.showCloseButton) {\n<button class=\"angular-toast-close-button\" (click)=\"click($event, toast)\" [innerHTML]=\"toast.closeHtml | trustHtml\">\n</button>\n}\n@if (toast.progressBar) {\n<div>\n <div class=\"angular-toast-progress-bar\" [style.width]=\"progressBarWidth + '%'\"></div>\n</div>\n\n}\n" }] }], propDecorators: { toasterconfig: [{ type: Input }], toast: [{ type: Input }], titleClass: [{ type: Input }], messageClass: [{ type: Input }], componentBody: [{ type: ViewChild, args: ["componentBody", { read: ViewContainerRef, static: false }] }], clickEvent: [{ type: Output }], removeToastEvent: [{ type: Output }], restartTimer: [{ type: HostListener, args: ["mouseleave"] }] } }); class ToasterContainerComponent { set toasterconfig(_toasterconfig) { this._toasterconfig = (this._defaultToasterConfig ? { ...defaultToasterConfig, ...this._defaultToasterConfig, ..._toasterconfig, } : { ...defaultToasterConfig, ..._toasterconfig }); } get toasterconfig() { return this._toasterconfig; } constructor() { this._defaultToasterConfig = inject(ToasterConfigInjectionToken, { optional: true }); this.toasts = []; this.toasterService = inject(ToasterService); this._toasterconfig = (this._defaultToasterConfig ? { ...defaultToasterConfig, ...this._defaultToasterConfig } : defaultToasterConfig); } ngOnInit() { this.registerSubscribers(); } ngOnDestroy() { if (this.addToastSubscriber) { this.addToastSubscriber.unsubscribe(); } if (this.clearToastsSubscriber) { this.clearToastsSubscriber.unsubscribe(); } } // event handlers click(toast, isCloseButton) { if (toast.onClickCallback) { toast.onClickCallback(toast); } const tapToDismiss = !this.isNullOrUndefined(toast.tapToDismiss) ? toast.tapToDismiss : this.toasterconfig.tapToDismiss; if (tapToDismiss || (toast.showCloseButton && isCloseButton)) { this.removeToast(toast); } } keypress(toast) { this.removeToast(toast); } childClick($event) { this.click($event.value.toast, $event.value.isCloseButton); } removeToast(toast) { const index = this.toasts.indexOf(toast); if (index < 0) { return; } const toastId = this.toastIdOrDefault(toast); this.toasts.splice(index, 1); if (toast.onHideCallback) { toast.onHideCallback(toast); } this.toasterService._removeToastSubject.next({ toastId: toastId, toastContainerId: toast.toastContainerId, }); } buildPositionClass() { const classes = ["angular-toast-container"]; const position = this.toasterconfig.positionClass; if (position) { classes.push(position); } return classes; } buildToastCompClasses(toast) { const classes = []; if (this.toasterconfig.iconClasses && this.toasterconfig.iconClasses?.[toast.type]) { classes.push(this.toasterconfig.iconClasses?.[toast.type]); } if (this.toasterconfig.typeClasses && this.toasterconfig.typeClasses?.[toast.type]) { classes.push(this.toasterconfig.typeClasses?.[toast.type]); } return classes; } // private functions registerSubscribers() { this.addToastSubscriber = this.toasterService.addToast.subscribe((toast) => { this.addToast(toast); }); this.clearToastsSubscriber = this.toasterService.clearToasts.subscribe((clearWrapper) => { this.clearToasts(clearWrapper); }); } addToast(toast) { if (toast.toastContainerId && this.toasterconfig.toastContainerId && toast.toastContainerId !== this.toasterconfig.toastContainerId) { return; } if (!toast.type || !this.toasterconfig.typeClasses?.[toast.type] || !this.toasterconfig.iconClasses?.[toast.type]) { toast.type = this.toasterconfig.defaultToastType; } if (this.toasterconfig.preventDuplicates && this.toasts.length > 0) { if (toast.toastId && this.toasts.some((t) => t.toastId === toast.toastId)) { return; } else if (this.toasts.some((t) => t.body === toast.body)) { return; } } if (this.isNullOrUndefined(toast.showCloseButton)) { if (typeof this.toasterconfig.showCloseButton === "object") { toast.showCloseButton = this.toasterconfig.showCloseButton[toast.type]; } else if (typeof this.toasterconfig.showCloseButton === "boolean") { toast.showCloseButton = this.toasterconfig.showCloseButton; } } if (toast.showCloseButton) { toast.closeHtml = toast.closeHtml || this.toasterconfig.closeHtml; } toast.bodyOutputType = toast.bodyOutputType || this.toasterconfig.bodyOutputType; if (this.toasterconfig.newestOnTop) { this.toasts.unshift(toast); if (this.isLimitExceeded()) { this.toasts.pop(); } } else { this.toasts.push(toast); if (this.isLimitExceeded()) { this.toasts.shift(); } } if (toast.onShowCallback) { toast.onShowCallback(toast); } } isLimitExceeded() { return (this.toasterconfig.limit && this.toasts.length > this.toasterconfig.limit); } removeAllToasts() { for (let i = this.toasts.length - 1; i >= 0; i--) { this.removeToast(this.toasts[i]); } } clearToasts(clearWrapper) { const toastId = clearWrapper.toastId; const toastContainerId = clearWrapper.toastContainerId; if (this.isNullOrUndefined(toastContainerId) || toastContainerId === this.toasterconfig.toastContainerId) { this.clearToastsAction(toastId); } } clearToastsAction(toastId) { if (toastId) { this.removeToast(this.toasts.filter((t) => t.toastId === toastId)[0]); } else { this.removeAllToasts(); } } toastIdOrDefault(toast) { return toast.toastId || ""; } isNullOrUndefined(value) { return value === null || typeof value === "undefined"; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.2", type: ToasterContainerComponent, isStandalone: true, selector: "toaster-container, angular-toaster-container, div[toaster-container], div[angular-toaster-container]", inputs: { toasterconfig: "toasterconfig" }, ngImport: i0, template: "<div [ngClass]=\"buildPositionClass()\">\n @for (toast of toasts; track $index) {\n <div\n toastComp\n class=\"angular-toast\"\n aria-hidden=\"true\"\n tabIndex=\"0\"\n [toast]=\"toast\"\n [toasterconfig]=\"toasterconfig\"\n [@toastState]=\"toasterconfig.animation\"\n [titleClass]=\"toasterconfig.titleClass!\"\n [messageClass]=\"toasterconfig.messageClass!\"\n [ngClass]=\"buildToastCompClasses(toast)\"\n (click)=\"click(toast)\"\n (keypress)=\"keypress(toast)\"\n (clickEvent)=\"childClick($event)\"\n (removeToastEvent)=\"removeToast($event)\"\n ></div>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ToasterComponent, selector: "[toastComp]", inputs: ["toasterconfig", "toast", "titleClass", "messageClass"], outputs: ["clickEvent", "removeToastEvent"] }], animations: Transitions }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterContainerComponent, decorators: [{ type: Component, args: [{ selector: `toaster-container, angular-toaster-container, div[toaster-container], div[angular-toaster-container]`, animations: Transitions, imports: [NgClass, ToasterComponent], template: "<div [ngClass]=\"buildPositionClass()\">\n @for (toast of toasts; track $index) {\n <div\n toastComp\n class=\"angular-toast\"\n aria-hidden=\"true\"\n tabIndex=\"0\"\n [toast]=\"toast\"\n [toasterconfig]=\"toasterconfig\"\n [@toastState]=\"toasterconfig.animation\"\n [titleClass]=\"toasterconfig.titleClass!\"\n [messageClass]=\"toasterconfig.messageClass!\"\n [ngClass]=\"buildToastCompClasses(toast)\"\n (click)=\"click(toast)\"\n (keypress)=\"keypress(toast)\"\n (clickEvent)=\"childClick($event)\"\n (removeToastEvent)=\"removeToast($event)\"\n ></div>\n }\n</div>\n" }] }], ctorParameters: () => [], propDecorators: { toasterconfig: [{ type: Input }] } }); const toasterConfigProvider = (config) => { return { provide: ToasterConfigInjectionToken, useFactory: () => { const defaultConfig = config ? { ...defaultToasterConfig, ...config } : defaultToasterConfig; return defaultConfig; } }; }; class ToasterModule { static forRoot(config) { return { ngModule: ToasterModule, providers: [ toasterConfigProvider(config), ToasterService, ToasterContainerComponent ] }; } static forChild(config) { return { ngModule: ToasterModule, providers: [ toasterConfigProvider(config), ToasterContainerComponent ] }; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.2", ngImport: i0, type: ToasterModule, imports: [CommonModule, ToasterComponent, ToasterContainerComponent], exports: [ToasterContainerComponent, ToasterComponent] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterModule, imports: [CommonModule] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: ToasterModule, decorators: [{ type: NgModule, args: [{ imports: [ CommonModule, ToasterComponent, ToasterContainerComponent, ], declarations: [], exports: [ ToasterContainerComponent, ToasterComponent ] }] }] }); const provideAngularToaster = (config) => { return makeEnvironmentProviders([ toasterConfigProvider(config), ToasterService, ToasterContainerComponent ]); }; /* * Public API Surface of angular-toaster */ /** * Generated bundle index. Do not edit. */ export { BodyOutputType, DefaultIconClasses, DefaultTypeClasses, ToasterComponent, ToasterConfig, ToasterConfigInjectionToken, ToasterContainerComponent, ToasterModule, ToasterService, defaultToasterConfig, provideAngularToaster }; //# sourceMappingURL=angular-toaster.mjs.map