1 line
79 KiB
Plaintext
1 line
79 KiB
Plaintext
|
{"version":3,"file":"ngx-toastr.mjs","sources":["../../src/lib/toastr/toast.directive.ts","../../src/lib/portal/portal.ts","../../src/lib/toastr/toast-ref.ts","../../src/lib/toastr/toastr-config.ts","../../src/lib/portal/dom-portal-host.ts","../../src/lib/overlay/overlay-container.ts","../../src/lib/overlay/overlay-ref.ts","../../src/lib/overlay/overlay.ts","../../src/lib/toastr/toastr.service.ts","../../src/lib/toastr/toast.component.ts","../../src/lib/toastr/toast.provider.ts","../../src/lib/toastr/toastr.module.ts","../../src/lib/toastr/toast-noanimation.component.ts","../../src/lib/ngx-toastr.ts"],"sourcesContent":["import { Directive, ElementRef } from '@angular/core';\n\n@Directive({\n selector: '[toastContainer]',\n exportAs: 'toastContainer',\n standalone: true\n})\nexport class ToastContainerDirective {\n constructor(private el: ElementRef) { }\n getContainerElement(): HTMLElement {\n return this.el.nativeElement;\n }\n}\n","import {\n ComponentRef,\n Injector,\n ViewContainerRef\n} from '@angular/core';\n\nexport interface ComponentType<T> {\n new (...args: any[]): T;\n}\n\n\n/**\n * A `ComponentPortal` is a portal that instantiates some Component upon attachment.\n */\nexport class ComponentPortal<T> {\n private _attachedHost?: BasePortalHost;\n /** The type of the component that will be instantiated for attachment. */\n component: ComponentType<T>;\n\n /**\n * [Optional] Where the attached component should live in Angular's *logical* component tree.\n * This is different from where the component *renders*, which is determined by the PortalHost.\n * The origin necessary when the host is outside of the Angular application context.\n */\n viewContainerRef!: ViewContainerRef;\n\n /** Injector used for the instantiation of the component. */\n injector: Injector;\n\n constructor(component: ComponentType<T>, injector: Injector) {\n this.component = component;\n this.injector = injector;\n }\n\n /** Attach this portal to a host. */\n attach(host: BasePortalHost, newestOnTop: boolean): ComponentRef<any> {\n this._attachedHost = host;\n return host.attach(this, newestOnTop);\n }\n\n /** Detach this portal from its host */\n detach() {\n const host = this._attachedHost;\n if (host) {\n this._attachedHost = undefined;\n return host.detach();\n }\n }\n\n /** Whether this portal is attached to a host. */\n get isAttached(): boolean {\n return this._attachedHost != null;\n }\n\n /**\n * Sets the PortalHost reference without performing `attach()`. This is used directly by\n * the PortalHost when it is performing an `attach()` or `detach()`.\n */\n setAttachedHost(host?: BasePortalHost) {\n this._attachedHost = host;\n }\n}\n\n/**\n * Partial implementation of PortalHost that only deals with attaching a\n * ComponentPortal\n */\nexport abstract class BasePortalHost {\n /** The portal currently attached to the host. */\n private _attachedPortal?: ComponentPortal<any>;\n\n /** A function that will permanently dispose this host. */\n private _disposeFn?: () => void;\n\n attach(portal: ComponentPortal<any>, newestOnTop: boolean) {\n this._attachedPortal = portal;\n return this.attachComponentPortal(portal, newestOnTop);\n }\n\n abstract attachComponentPortal<T>(portal: ComponentPortal<T>, newestOnTop: boolean): ComponentRef<T>;\n\n detach() {\n if (this._attachedPortal) {\n this._attachedPortal.setAttachedHost();\n }\n\n this._attachedPortal = undefined;\n if (this._disposeFn) {\n this._disposeFn();\n this._disposeFn = undefined;\n }\n }\n\n setDisposeFn(fn: () => void) {\n this._disposeFn = fn;\n }\n}\n","import { Observable, Subject } from 'rxjs';\nimport { OverlayRef } from '../overlay/overlay-ref';\n\n/**\n * Reference to a toast opened via the Toastr service.\n */\nexport class ToastRef<T> {\n /** The instance of component opened into the toast. */\n componentInstance!: T;\n\n /** Count of duplicates of this toast */\n private duplicatesCount = 0;\n\n /** Subject for notifying the user
|