/** * The **Toast component** — owns the DOM, lifecycle and auto-dismiss timing of * a single toast. It renders an icon, an optional title, the message, an * optional action button, a close button and an optional shrinking progress * bar, all from theme tokens with zero inline styling (only CSS custom * properties are set, the same pattern the grid uses for dynamic dimensions). * * Timing is pause-aware: the remaining time is tracked across hover/focus * pauses so a toast the user is reading never disappears mid-glance. The * component never removes itself from the DOM — it calls its * {@link ToastComponentCallbacks.onDismiss} so the {@link ToastService} can run * the shared exit animation and update the queue. * * @packageDocumentation */ import type { IconRenderer } from '../icons/icon-renderer'; import { ToastDismissReason, ToastType, type ToastHandle, type ToastOptions, type ToastUpdate } from './toast.types'; /** Callbacks the component uses to talk back to the service. */ export interface ToastComponentCallbacks { /** Requests dismissal (service plays the exit animation + removes the node). */ readonly onDismiss: (id: string, reason: ToastDismissReason) => void; } /** Fully-resolved per-toast settings (service defaults already merged in). */ export interface ResolvedToastSettings { readonly id: string; readonly type: ToastType; readonly title?: string; readonly message: string; readonly duration: number; readonly dismissible: boolean; readonly pauseOnHover: boolean; readonly showProgress: boolean; readonly icon?: string | null; readonly ariaLive: 'polite' | 'assertive'; readonly options: ToastOptions; } /** One toast's view + timer + interaction state. */ export declare class ToastComponent { private readonly iconRenderer; private readonly callbacks; private readonly el; private iconEl; private titleEl; private messageEl; private progressBarEl; /** Auto-dismiss timer handle, or `null` when none is running. */ private timer; /** Remaining ms until auto-dismiss (tracked across pauses). */ private remaining; /** Timestamp the current timer segment started. */ private segmentStart; private disposed; private settings; constructor(settings: ResolvedToastSettings, iconRenderer: IconRenderer, callbacks: ToastComponentCallbacks, animationClass: string); /** The toast's root element (for the container to mount). */ get element(): HTMLElement; /** The toast id. */ get id(): string; /** A public handle bound to this component. */ handle(): ToastHandle; private build; /** Resolves the icon name, honoring an explicit override or `null` (hidden). */ private resolveIcon; /** Starts the auto-dismiss countdown and the progress animation. Idempotent. */ start(): void; /** Pauses the countdown (and freezes the progress bar). */ private pause; /** Resumes the countdown from the remaining time (continues the frozen bar). */ private resume; /** Applies a content patch in place, resetting the timer if the duration changed. */ update(patch: ToastUpdate): void; /** Stops the timer without dismissing (used before teardown). */ private clearTimer; /** Tears down timers + listeners. The element is removed by the container. */ dispose(): void; /** Fires the caller's {@link ToastOptions.onDismiss} callback with the reason. */ notifyDismissed(reason: ToastDismissReason): void; /** High-resolution-ish timestamp for pause math. */ private static now; } //# sourceMappingURL=toast-component.d.ts.map