import { Overlay, OverlayConfig, OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay'; import { ComponentFactoryResolver, ComponentRef } from '@angular/core'; import { ToasterContainerComponent } from './toaster-container.component'; import { ToasterConfig } from './toaster.config'; import { Toast, ToastPosition } from './toaster.model'; export declare class ToasterRef { private toasterContainer; private toast; constructor(toasterContainer: ToasterContainer, toast: Toast); close(): void; } export declare class ToasterContainerOverlayService { private overlay; constructor(overlay: Overlay); get scrollStrategies(): ScrollStrategyOptions; create(config?: OverlayConfig): OverlayRef; } export declare class ToasterContainer { protected position: ToastPosition; protected containerRef: ComponentRef; protected toasts: Toast[]; protected prevToast: Toast | null; get nativeElement(): any; constructor(position: ToastPosition, containerRef: ComponentRef); attach(toast: Toast): ToasterRef; destroy(toast: Toast): void; private attachToast; private attachToTop; private setDestroyTimeout; private subscribeOnClick; private updateContainer; } export declare function patch(container: ComponentRef, containerContext: Object): ComponentRef; export declare class ToasterContainerRegistry { private overlay; private overlayService; private cfr; private document; private overlays; constructor(overlay: Overlay, overlayService: ToasterContainerOverlayService, cfr: ComponentFactoryResolver, document: any); get(position: ToastPosition): ToasterContainer; private instantiateContainer; private createContainer; private existsInDom; private toLogicalPosition; } /** * The `ToasterService` provides a capability to build toast notifications. * * `ToasterService.show(message, config)` accepts two params, config is optional. * * ### Import * * Import `ToasterModule` to your app module. * ```ts * @NgModule({ * imports: [ * // ... * ToasterModule, * ], * }) * export class AppModule { } * ``` * * ### Usage * * Calling `ToasterService.show(...)` will render new toast and return `ToasterRef` with * help of which you may close newly created toast by calling `close` method. * * ```ts * const toastRef: ToasterRef = this.toasterService.show(...); * toastRef.close(); * ``` * * Config accepts following options: * * `type` - coloring and icon of the toast. * Default is `info`. * * `duration` - the time after which the toast will be destroyed. * `0` means endless toast, that may be destroyed by click only. * Default is 3000 ms. * * `position` - determines where on the screen toast will be rendered. * Default is `top-end`, hardcoded for now. * * `destroyByClick` - provides a capability to destroy toast by click. * Default is true. * */ export declare class ToasterService { private globalConfig; private containerRegistry; constructor(globalConfig: ToasterConfig, containerRegistry: ToasterContainerRegistry); /** * Shows toast with message and user config. * */ show(message: string, userConfig?: Partial): ToasterRef; /** * Shows success toast with message, title and user config. * */ success(message: string, config?: Partial): ToasterRef; /** * Shows error toast with message, title and user config. * */ error(message: string, config?: Partial): ToasterRef; /** * Shows warning toast with message, title and user config. * */ warning(message: string, config?: Partial): ToasterRef; /** * Shows info toast with message, title and user config. * */ info(message: string, config?: Partial): ToasterRef; }