import { RadiantElement } from '@ecopages/radiant'; import { type ToastPosition, type ToastRecord } from './toast-context'; import './toast.script'; export type RuiToasterProps = { /** Corner / edge placement. Default: `bottom-end`. */ position?: ToastPosition; /** Default lifetime in ms. Default: `4000`. */ duration?: number; /** * Max toasts mounted in the stack at once (older ones wait in queue). * Default: `3`. Collapsed UI peeks at most {@link TOAST_COLLAPSED_PEEK} * of these; hover expands to show all mounted toasts. */ visibleToasts?: number; /** Show a close button on every toast. */ closeButton?: boolean; /** * Always show the stack expanded with full gaps. * Default `false`: toasts collapse behind the front one (Sonner-style peek) * and expand on hover. */ expand?: boolean; /** Gap between toasts when expanded, in px. Default: `14`. */ gap?: number; /** Viewport inset in px. Default: `24`. */ offset?: number; /** * CSS selector for a positioning root. * * @remarks * Empty (default): `position: fixed` against the viewport. * When set, the toaster prefers an ancestor matching the selector (via * `closest`), otherwise `document.querySelector`, switches to * `position: absolute`, and ensures the root is a positioning context. */ container?: string; }; type RuiToasterBindings = { position: ToastPosition; toasts: ToastRecord[]; }; /** * `` — fixed viewport that renders the toast stack. * * Mount once at the app root, then drive it imperatively with {@link toast}. * Owns the stacking layout (collapsed peek + hover expand), visibility pause, * and per-position filtering of queued toasts. * * @element rui-toaster * * @attr {string} position - Corner / edge placement. Default: `bottom-end`. * @attr {number} duration - Default lifetime in ms. Default: `4000`. * @attr {number} visible-toasts - Max toasts mounted at once; older wait in queue. Default: `3`. * @attr {boolean} close-button - Show a close button on every toast. Default: `false`. * @attr {boolean} expand - Always render the stack expanded. Default: `false`. * @attr {number} gap - Gap between expanded toasts in px. Default: `14`. * @attr {number} offset - Viewport inset in px. Default: `24`. * @attr {string} container - CSS selector for a positioning root. Default: `''`. * * @fires rui-toast-show - Document-level event; the toaster listens and creates * a toast from `{ title, description, variant, ... }`. * @fires rui-toast-dismiss - Document-level event; the toaster dismisses the * matching toast (`{ id? }`). * * @remarks * `container` switches the host from `position: fixed` to absolute inside a * matched root — used by docs canvas demos so toasts render inside the preview. * * @cssclass rui-toaster-region - Announcement region wrapper (`display: contents`). * @cssclass rui-toaster - The `
    ` stack list. */ export declare class RuiToaster extends RadiantElement { position: ToastPosition; duration: number; visibleToasts: number; closeButton: boolean; expand: boolean; gap: number; offset: number; container: string; toasts: ToastRecord[]; private expanded; private interacting; private unsubscribe; private visibilityHandler; private readonly heights; private readonly observers; private layoutFrame; /** Prevents ResizeObserver re-entry while temporarily unclipping hosts to measure. */ private measuring; connectedCallback(): void; disconnectedCallback(): void; onConfigUpdated(): void; onDocumentShow(event: Event): void; onDocumentDismiss(event: Event): void; onToastMounted(): void; private filteredToasts; private syncHostPosition; /** * Bind the toaster to a positioning root when `container` is set. * * @remarks * Prefers an ancestor match so nested demos do not reparent. Only appends * into a query-selected root when the toaster is not already inside it. * Contained mode uses absolute positioning; default mode restores viewport fixed. */ private syncContainer; private isStackExpanded; /** * @remarks * Pause only while the pointer is interacting / hovering, or the tab is * hidden. The `expand` prop is visual-only — it must not freeze lifetimes. */ private isPaused; private resetLayoutState; private syncPauseState; /** * Measure + layout on the next frame. Re-reads `:hover` because emptying the * stack under the cursor can skip `pointerout`, leaving hold/expand stale. */ private scheduleLayoutSync; /** * Natural content height for stack math. * * @remarks * Uses the inner `.rui-toast` `offsetHeight` (layout size, transform-independent). * Host height/overflow are temporarily cleared because collapsed behind toasts are * clipped to the front height — leaving that in place can under-measure in some engines. */ private measureToast; private observeToasts; /** * @remarks * Expanded offsets use each toast's natural height (Sonner formula): * `sum(heights before) + index * gap`. Collapsed mode peeks at most * {@link TOAST_COLLAPSED_PEEK} toasts with scale; overflow stays * mounted but hidden until hover expands the stack. * Heights are always remeasured — clipped collapsed hosts make caches stale. */ private patchStackLayout; private onPointerOver; private onPointerOut; private onPointerDown; /** End interaction; collapse only when the pointer is no longer over the toaster. */ private onPointerUp; render(): import("@ecopages/jsx").JsxRenderable; } export {};