/** * `DialogStore` — thin Solid 2 port of Base UI React's `DialogStore` * (`packages/react/src/dialog/store/DialogStore.ts`). * * Mirrors `PopoverStore` from the popover compound: the actual state * machine lives on ``'s local signals (open / mount / * transition status / interactions). This store is a thin imperative-API * wrapper that exposes: * * - a `PopupTriggerMap` so `` can register * itself and `DialogHandle.open(id)` can resolve the trigger element. * - `setOpen(next, details)` — the writer `` binds via * `attachSetOpen` during setup. The handle's `open()` / `close()` / * `openWithPayload()` all route through this. * - `setPayload(payload)` — same deal, for the payload slot. * - Synchronous `isOpen` read for imperative callers who don't want to * subscribe to reactivity. */ import { PopupTriggerMap } from "../../internals/floating-ui/popup-trigger-map.js"; import type { DialogRootChangeEventDetails } from "../dialog-root-context.js"; export type DialogStoreSetOpen = (next: boolean, details: DialogRootChangeEventDetails) => void; export type DialogStoreSetPayload = (payload: Payload | undefined) => void; /** * Internal store shape for ``. Public surface via * `DialogHandle` is stable; everything else is `@internal`. */ export declare class DialogStore<_Payload = unknown> { /** * Trigger registry. `` adds itself on mount; * `DialogHandle.open(id)` looks up the element to seed the change * details' `trigger` slot. */ readonly context: { triggerElements: PopupTriggerMap; }; private _setOpen; private _setPayload; private _open; constructor(); /** @internal */ attachSetOpen(fn: DialogStoreSetOpen | null): void; /** @internal */ attachSetPayload(fn: DialogStoreSetPayload<_Payload> | null): void; /** @internal */ setOpenMirror(next: boolean): void; /** * Imperative open-state writer. If the root is not currently mounted * (handle was constructed but never used inside a live ``), * this is a no-op. */ setOpen(next: boolean, details: DialogRootChangeEventDetails): void; /** Imperative payload writer. No-op when no root is bound. */ setPayload(payload: _Payload | undefined): void; /** Synchronous snapshot — does NOT subscribe to Solid's reactive graph. */ get isOpen(): boolean; } /** * `DialogHandle` — imperative + cross-tree trigger-association surface. * * Matches Base UI React's `DialogHandle` on the public method surface * (`open(triggerId)` / `openWithPayload(payload)` / `close()` / `isOpen`) * and carries an internal store that `` adopts. * * Usage: * * ```ts * const handle = Dialog.createHandle(); * * // ... inside the component * * Open * {/* ... *\/} * * * // Later, from outside: * handle.open("t1"); * handle.openWithPayload({ title: "Hello" }); * handle.close(); * ``` */ export declare class DialogHandle { /** @internal */ readonly store: DialogStore; constructor(store?: DialogStore); /** * Opens the dialog. If `triggerId` is provided and a trigger with * that id is registered, the dialog is associated with it (focus * returns there on close; `aria-labelledby` / positioning downstream * anchors against it). A missing `triggerId` still opens the dialog * but skips the association. */ open(triggerId: string | null): void; /** * Opens the dialog and sets the payload. Does NOT associate the * dialog with any trigger — the render-function children receive * `{ payload }` but there's no anchor element. */ openWithPayload(payload: Payload): void; /** * Closes the dialog. */ close(): void; /** Synchronous snapshot of the open state. */ get isOpen(): boolean; } /** Factory for `DialogHandle` — matches React's `createDialogHandle()`. */ export declare function createDialogHandle(): DialogHandle; //# sourceMappingURL=dialog-store.d.ts.map