import * as i0 from '@angular/core'; import { ViewContainerRef, Injector, ComponentRef, InjectionToken, NgZone, OnDestroy, ApplicationRef, ModuleWithProviders, EnvironmentProviders } from '@angular/core'; import { Observable, Subscription } from 'rxjs'; declare class ToastContainerDirective { private el; getContainerElement(): HTMLElement; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } type ComponentType = new (...args: unknown[]) => T; /** * A `ComponentPortal` is a portal that instantiates some Component upon attachment. */ declare class ComponentPortal { private _attachedHost?; /** The type of the component that will be instantiated for attachment. */ component: ComponentType; /** * [Optional] Where the attached component should live in Angular's *logical* component tree. * This is different from where the component *renders*, which is determined by the PortalHost. * The origin necessary when the host is outside of the Angular application context. */ viewContainerRef: ViewContainerRef; /** Injector used for the instantiation of the component. */ injector: Injector; constructor(component: ComponentType, injector: Injector); /** Attach this portal to a host. */ attach(host: BasePortalHost, newestOnTop: boolean): ComponentRef; /** Detach this portal from its host */ detach(): void; /** Whether this portal is attached to a host. */ get isAttached(): boolean; /** * Sets the PortalHost reference without performing `attach()`. This is used directly by * the PortalHost when it is performing an `attach()` or `detach()`. */ setAttachedHost(host?: BasePortalHost): void; } /** * Partial implementation of PortalHost that only deals with attaching a * ComponentPortal */ declare abstract class BasePortalHost { /** The portal currently attached to the host. */ private _attachedPortal?; /** A function that will permanently dispose this host. */ private _disposeFn?; attach(portal: ComponentPortal, newestOnTop: boolean): ComponentRef; abstract attachComponentPortal(portal: ComponentPortal, newestOnTop: boolean): ComponentRef; detach(): void; setDisposeFn(fn: () => void): void; } /** * Reference to an overlay that has been created with the Overlay service. * Used to manipulate or dispose of said overlay. */ declare class OverlayRef { private _portalHost; constructor(_portalHost: BasePortalHost); attach(portal: ComponentPortal, newestOnTop?: boolean): ComponentRef; /** * Detaches an overlay from a portal. * @returns Resolves when the overlay has been detached. */ detach(): void; } /** * Reference to a toast opened via the Toastr service. */ declare class ToastRef { private _overlayRef; /** The instance of component opened into the toast. */ componentInstance: T; /** Count of duplicates of this toast */ private duplicatesCount; /** Subject for notifying the user that the toast has finished closing. */ private _afterClosed; /** triggered when toast is activated */ private _activate; /** notifies the toast that it should close before the timeout */ private _manualClose; /** notifies the toast that it should reset the timeouts */ private _resetTimeout; /** notifies the toast that it should count a duplicate toast */ private _countDuplicate; constructor(_overlayRef: OverlayRef); manualClose(): void; manualClosed(): Observable; timeoutReset(): Observable; countDuplicate(): Observable; /** * Close the toast. */ close(): void; /** Gets an observable that is notified when the toast is finished closing. */ afterClosed(): Observable; isInactive(): boolean; activate(): void; /** Gets an observable that is notified when the toast has started opening. */ afterActivate(): Observable; /** Reset the toast timouts and count duplicates */ onDuplicate(resetTimeout: boolean, countDuplicate: boolean): void; } type ProgressAnimationType = 'increasing' | 'decreasing'; type DisableTimoutType = boolean | 'timeOut' | 'extendedTimeOut'; /** * Configuration for an individual toast. */ interface IndividualConfig { /** * disable both timeOut and extendedTimeOut * default: false */ disableTimeOut: DisableTimoutType; /** * toast time to live in milliseconds * default: 5000 */ timeOut: number; /** * toast show close button * default: false */ closeButton: boolean; /** * time to close after a user hovers over toast * default: 1000 */ extendedTimeOut: number; /** * show toast progress bar * default: false */ progressBar: boolean; /** * changes toast progress bar animation * default: decreasing */ progressAnimation: ProgressAnimationType; /** * render html in toast message (possibly unsafe) * default: false */ enableHtml: boolean; /** * css class on toast component * default: ngx-toastr */ toastClass: string; /** * css class on toast container * default: toast-top-right */ positionClass: string; /** * css class on toast title * default: toast-title */ titleClass: string; /** * css class on toast message * default: toast-message */ messageClass: string; /** * animation easing on toast * default: ease-in */ easing: string; /** * animation ease time on toast * default: 300 */ easeTime: string | number; /** * clicking on toast dismisses it * default: true */ tapToDismiss: boolean; /** * Angular toast component to be shown * default: Toast */ toastComponent?: ComponentType; /** * Helps show toast from a websocket or from event outside Angular * default: false */ onActivateTick: boolean; /** * New toast placement * default: true */ newestOnTop: boolean; /** * Payload to pass to the toast component */ payload?: ConfigPayload; } interface ToastrIconClasses { error: string; info: string; success: string; warning: string; [key: string]: string; } /** * Global Toast configuration * Includes all IndividualConfig */ interface GlobalConfig extends IndividualConfig { /** * max toasts opened. Toasts will be queued * Zero is unlimited * default: 0 */ maxOpened: number; /** * dismiss current toast when max is reached * default: false */ autoDismiss: boolean; iconClasses: Partial; /** * block duplicate messages * default: false */ preventDuplicates: boolean; /** * display the number of duplicate messages * default: false */ countDuplicates: boolean; /** * Reset toast timeout when there's a duplicate (preventDuplicates needs to be set to true) * default: false */ resetTimeoutOnDuplicate: boolean; /** * consider the title of a toast when checking if duplicate * default: false */ includeTitleDuplicates: boolean; } /** * Everything a toast needs to launch */ declare class ToastPackage { toastId: number; config: IndividualConfig; message: string | null | undefined; title: string | undefined; toastType: string; toastRef: ToastRef; private _onTap; private _onAction; constructor(toastId: number, config: IndividualConfig, message: string | null | undefined, title: string | undefined, toastType: string, toastRef: ToastRef); /** Fired on click */ triggerTap(): void; onTap(): Observable; /** available for use in custom toast */ triggerAction(action?: unknown): void; onAction(): Observable; } declare const DefaultNoComponentGlobalConfig: GlobalConfig; interface ToastToken { default: GlobalConfig; config: Partial; } declare const TOAST_CONFIG: InjectionToken; interface ActiveToast { /** Your Toast ID. Use this to close it individually */ toastId: number; /** the title of your toast. Stored to prevent duplicates */ title: string; /** the message of your toast. Stored to prevent duplicates */ message: string; /** a reference to the component see portal.ts */ portal: ComponentRef; /** a reference to your toast */ toastRef: ToastRef; /** triggered when toast is active */ onShown: Observable; /** triggered when toast is destroyed */ onHidden: Observable; /** triggered on toast click */ onTap: Observable; /** available for your use in custom toast */ onAction: Observable; } declare class ToastrService { private overlay; private _injector; private sanitizer; private ngZone; toastrConfig: GlobalConfig; currentlyActive: number; toasts: ActiveToast[]; overlayContainer?: ToastContainerDirective; previousToastMessage: string | undefined; private index; constructor(); /** show toast */ show(message?: string, title?: string, override?: Partial>, type?: string): ActiveToast | null; /** show successful toast */ success(message?: string, title?: string, override?: Partial>): ActiveToast; /** show error toast */ error(message?: string, title?: string, override?: Partial>): ActiveToast; /** show info toast */ info(message?: string, title?: string, override?: Partial>): ActiveToast; /** show warning toast */ warning(message?: string, title?: string, override?: Partial>): ActiveToast; /** * Remove all or a single toast by id */ clear(toastId?: number): void; /** * Remove and destroy a single toast by id */ remove(toastId: number): boolean; /** * Determines if toast message is already shown */ findDuplicate(title: string, message: string, resetOnDuplicate: boolean, countDuplicates: boolean): ActiveToast; /** create a clone of global config and apply individual settings */ private applyConfig; /** * Find toast object by id */ private _findToast; /** * Determines the need to run inside angular's zone then builds the toast */ private _preBuildNotification; /** * Creates and attaches toast data to component * returns the active toast, or in case preventDuplicates is enabled the original/non-duplicate active toast. */ private _buildNotification; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class TimeoutsService { protected ngZone?: NgZone; setInterval(func: () => unknown, timeout: number): number; setTimeout(func: () => unknown, timeout?: number): number; protected runInsideAngular(func: () => unknown): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ToastBase implements OnDestroy { toastPackage: ToastPackage; protected toastrService: ToastrService; protected appRef: ApplicationRef; protected timeoutsService: TimeoutsService; duplicatesCount: number; protected hideTime: number; /** width of progress bar */ readonly width: i0.WritableSignal; readonly state: i0.WritableSignal<"inactive" | "active" | "removed">; /** hides component when waiting to be displayed */ readonly displayStyle: i0.Signal; readonly message: i0.Signal; readonly title: i0.Signal; readonly options: i0.WritableSignal>; readonly originalTimeout: i0.Signal; readonly toastClasses: i0.Signal; protected timeout: number | undefined; protected intervalId: number | undefined; protected afterActivateSubscription: Subscription; protected manualClosedSubscription: Subscription; protected timeoutResetSubscription: Subscription; protected countDuplicateSubscription: Subscription; constructor(); ngOnDestroy(): void; /** * activates toast and sets timeout */ activateToast(): void; /** * updates progress bar width */ updateProgress(): void; resetTimeout(): void; /** * tells toastrService to remove this toast after animation time */ remove(): void; tapToast(): void; stickAround(): void; delayedHideToast(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "[toast-component]", never, {}, {}, never, never, true, never>; } declare class Toast extends ToastBase { readonly params: { easeTime: string | number; easing: string; }; private elementRef; remove(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "[toast-component]", never, {}, {}, never, never, true, never>; } declare class ToastrModule { static forRoot(config?: Partial): ModuleWithProviders; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare class ToastrComponentlessModule { static forRoot(config?: Partial): ModuleWithProviders; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const DefaultGlobalConfig: GlobalConfig; /** * @description * Provides the `TOAST_CONFIG` token with the given config. * * @param config The config to configure toastr. * @returns The environment providers. * * @example * ```ts * import { provideToastr } from 'ngx-toastr'; * * bootstrap(AppComponent, { * providers: [ * provideToastr({ * timeOut: 2000, * positionClass: 'toast-top-right', * }), * ], * }) */ declare const provideToastr: (config?: Partial) => EnvironmentProviders; declare const DefaultNoAnimationsGlobalConfig: GlobalConfig; declare class ToastNoAnimationModule { static forRoot(config?: Partial): ModuleWithProviders; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be * used as a low-level building building block for other components. Dialogs, tooltips, menus, * selects, etc. can all be built using overlays. The service should primarily be used by authors * of re-usable components rather than developers building end-user applications. * * An overlay *is* a PortalHost, so any kind of Portal can be loaded into one. */ declare class Overlay { private _overlayContainer; private _appRef; private _document; private _paneElements; /** * Creates an overlay. * @returns A reference to the created overlay. */ create(positionClass?: string, overlayContainer?: ToastContainerDirective): OverlayRef; getPaneElement(positionClass?: string, overlayContainer?: ToastContainerDirective): HTMLElement; /** * Creates the DOM element for an overlay and appends it to the overlay container. * @returns Newly-created pane element */ private _createPaneElement; /** * Create a DomPortalHost into which the overlay content can be loaded. * @param pane The DOM element to turn into a portal host. * @returns A portal host for the given DOM element. */ private _createPortalHost; /** * Creates an OverlayRef for an overlay in the given DOM element. * @param pane DOM element for the overlay */ private _createOverlayRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** Container inside which all toasts will render. */ declare class OverlayContainer implements OnDestroy { protected _document: Document; protected _containerElement: HTMLElement; ngOnDestroy(): void; /** * This method returns the overlay container element. It will lazily * create the element the first time it is called to facilitate using * the container in non-browser environments. * @returns the container element */ getContainerElement(): HTMLElement; /** * Create the overlay container element, which is simply a div * with the 'cdk-overlay-container' class on the document body * and 'aria-live="polite"' */ protected _createContainer(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { BasePortalHost, ComponentPortal, DefaultGlobalConfig, DefaultNoAnimationsGlobalConfig, DefaultNoComponentGlobalConfig, Overlay, OverlayContainer, OverlayRef, TOAST_CONFIG, Toast, ToastContainerDirective, ToastBase as ToastNoAnimation, ToastNoAnimationModule, ToastPackage, ToastRef, ToastrComponentlessModule, ToastrModule, ToastrService, provideToastr }; export type { ActiveToast, ComponentType, DisableTimoutType, GlobalConfig, IndividualConfig, ProgressAnimationType, ToastToken, ToastrIconClasses };