import { type Accessor } from "solid-js"; import type { ToastManagerAddOptions, ToastManagerPromiseOptions, ToastManagerUpdateOptions, ToastObject } from "./use-toast-manager.js"; /** * Tier-3b port of Base UI React's `ToastStore` * (`packages/react/src/toast/store.ts`). The Solid port mirrors the React * store's shape but swaps the `ReactStore`/selector plumbing for plain * Solid signals. Every external reader (`Toast.Viewport`, `Toast.Root`, * `Toast.Close`) subscribes to the signals directly through accessors — * there are no selector memos because each reader only cares about one or * two slots. * * Scope differences vs React: * * - Heights are measured on `Toast.Root` and flow into stack CSS vars. * - Pause/resume follows React: when ANY of `hovering` / `focused` is true, * or `isWindowFocused` is false, timers are paused; when all three * release the lock, timers resume from their recorded remaining delay. */ type UpdateBehavior = { resetTimer?: boolean | undefined; markUpdated?: boolean | undefined; }; /** The shape that consumers read (via accessors) from the store. */ export interface ToastStoreReaders { toasts: Accessor[]>; hovering: Accessor; focused: Accessor; expanded: Accessor; isEmpty: Accessor; prevFocusElement: Accessor; viewport: Accessor; isWindowFocused: Accessor; } export interface ToastStore extends ToastStoreReaders { readonly timeout: Accessor; readonly limit: Accessor; addToast: (options: ToastManagerAddOptions) => string; updateToast: (id: string, options: ToastManagerUpdateOptions) => void; updateToastInternal: (id: string, updates: Partial, "id">>, behavior?: UpdateBehavior) => void; closeToast: (id?: string) => void; removeToast: (id: string, opts?: { skipOnRemove?: boolean; }) => void; promiseToast: (value: Promise, options: ToastManagerPromiseOptions) => Promise; setHovering: (next: boolean) => void; setFocused: (next: boolean) => void; setIsWindowFocused: (next: boolean) => void; setViewport: (el: HTMLElement | null) => void; setPrevFocusElement: (el: HTMLElement | null) => void; restoreFocusToPrevElement: () => void; pauseTimers: () => void; resumeTimers: () => void; setTimeoutOption: (next: number) => void; setLimitOption: (next: number) => void; /** Touch outside the viewport — collapse expanded state and resume timers. */ handleDocumentPointerDown: (event: PointerEvent) => void; } export interface CreateToastStoreOptions { timeout: number; limit: number; } /** * Factory — owns all store signals + timers for the owning component. The * returned object is stable for the scope's lifetime; owner-dispose tears * every pending timer down via `onCleanup`. * * Signals opt into `ownedWrite` because the store's setters are invoked * from unowned surfaces (event handlers, timers) but the signals are * created inside the provider's owned scope. */ export declare function createToastStore(initial: CreateToastStoreOptions): ToastStore; export {}; //# sourceMappingURL=toast-store.d.ts.map