import type { ToastData, ToastInput, ToastPromiseOptions, ToastShorthandOpts } from './index.js'; import type { ToastPlacement } from './toast.variants.js'; /** * Reactive store that manages the global toast queue. * Import the singleton `toaster` and call its methods from anywhere in the app. * * @example * ```typescript * import { toaster } from '@urbicon-ui/blocks'; * * toaster.success('Saved!', { description: 'All changes applied.' }); * ``` */ declare class ToastStore { toasts: ToastData[]; placement: ToastPlacement; /** * Whether the whole visible stack is currently frozen because the pointer or * keyboard focus is inside the toaster region. Drives each progress bar's * `animation-play-state`; the auto-dismiss timers freeze together with it. Set * by `` via {@link pause} / {@link resume}. */ paused: boolean; private timers; private subscriberCount; private hasWarnedNoSubscriber; /** * Called by `` on mount. Increments the active-subscriber count so * the store knows whether a renderer is present. Returns an unsubscribe fn. */ registerSubscriber(): () => void; /** * Arm the auto-dismiss timer for `id` — or, if the stack is currently paused, * pre-register it frozen so it starts counting when the stack resumes. * Persistent toasts (`duration <= 0` or non-finite, e.g. `Infinity`, and the * loading leg of a promise toast) get no timer at all. */ private armTimer; /** Cancel and forget the timer for `id` (if any). */ private clearTimer; /** Create a toast with full control over all options. Returns the toast ID for programmatic dismissal. */ add(input: ToastInput): string; /** * Merge new fields into an existing toast in place — same id, same stack * position — and reset its auto-dismiss timer to the new `duration`. No-op if * the toast is gone. Backs `promise()`, which flips a pending toast to * success/error without it sliding out and a new one flying in. */ update(id: string, input: ToastInput): void; /** * Drive a toast through a promise's lifecycle (Sonner-style). Shows a * persistent, non-dismissible spinner toast while pending, then flips it in * place to success on resolve or danger on reject. `success`/`error` may be a * plain title, a full {@link ToastInput}, or a function of the resolved value * / rejection reason. Returns the toast id. * * @example * ```ts * toaster.promise(saveDraft(), { * loading: 'Saving…', * success: (draft) => `Saved “${draft.title}”`, * error: (e) => `Could not save: ${e.message}` * }); * ``` */ promise(promise: Promise, opts: ToastPromiseOptions): string; /** Remove a single toast by ID. Clears its auto-dismiss timer. */ dismiss(id: string): void; /** Remove all toasts, cancel their timers, and un-freeze the stack. */ clear(): void; /** * Freeze the whole visible stack (Sonner-style hover-to-pause): cancel every * running auto-dismiss timer, banking the time each has left, and flag * {@link paused} so the progress bars stop. Idempotent — `` calls it * on pointer-enter / focus-in of the region. Persistent toasts and a promise's * loading leg have no timer and are untouched; the banked remainders are * restarted by {@link resume}. */ pause(): void; /** * Resume the stack: restart every frozen timer from its banked remaining time * (not from the full duration) and clear {@link paused} so the progress bars * run again. Idempotent — called on pointer-leave / focus-out of the region. */ resume(): void; /** Shorthand for `add()` with `intent: 'info'`. Shows an info icon. */ info(title: string, opts?: ToastShorthandOpts): string; /** Shorthand for `add()` with `intent: 'success'`. Shows a check icon. */ success(title: string, opts?: ToastShorthandOpts): string; /** Shorthand for `add()` with `intent: 'warning'`. Shows a warning icon. */ warning(title: string, opts?: ToastShorthandOpts): string; /** Shorthand for `add()` with `intent: 'danger'`. Shows an error icon. */ danger(title: string, opts?: ToastShorthandOpts): string; } export declare const toaster: ToastStore; export {};