/** * `MenuStore` + `MenuHandle` — thin Solid 2 port of Base UI React's * `MenuStore` / `MenuHandle` (`packages/react/src/menu/store/MenuStore.ts` + * `MenuHandle.ts`), mirroring the popover pattern already shipped * (`src/popover/store/popover-store.ts`). * * The React source threads a full store + selector pair through every * sub-part. The Solid `` uses its local signal-accessor context * (same shape as ``); this store only carries the minimal * surface the imperative handle + multi-trigger registry need: * * - A `PopupTriggerMap` so `` can register and * `MenuHandle.open(id)` can resolve the correct trigger. * - A `setOpen` slot that `` binds during setup via * {@link attachSetOpen}. * - An `open` mirror so `handle.isOpen` returns synchronously. */ import { PopupTriggerMap } from "../../internals/floating-ui/popup-trigger-map.js"; import type { MenuRootChangeEventDetails } from "../root/menu-root-context.js"; /** * Writer signature for `setOpen`. Matches the Solid root's internal * `setOpen(next, details)` callback. */ export type MenuStoreSetOpen = (next: boolean, details: MenuRootChangeEventDetails) => void; /** * Minimal store shape consumed by the handle + imperative callers. */ export declare class MenuStore<_Payload = unknown> { /** * Registry of triggers keyed by id. `` adds * itself here on mount, and `MenuHandle.open(id)` looks it up. */ readonly context: { triggerElements: PopupTriggerMap; }; /** * Internal setOpen slot. `` binds this during setup via * {@link attachSetOpen}; clears on teardown. */ private _setOpen; /** * Last-seen reactive open flag. Used by `MenuHandle.isOpen` so the * caller can read synchronously without needing a subscription hook. */ private _open; constructor(); /** * Bind the root's `setOpen` writer. * * @internal */ attachSetOpen(fn: MenuStoreSetOpen | null): void; /** * Mirror the root's current open flag. Called by ``'s effect * so `handle.isOpen` returns the latest value synchronously. * * @internal */ setOpenMirror(next: boolean): void; /** * Imperative open-state writer. No-op when no root is bound. */ setOpen(next: boolean, details: MenuRootChangeEventDetails): void; /** * Synchronous snapshot of the current open state. */ get isOpen(): boolean; } /** * `MenuHandle` — imperative surface + detached-trigger association. * Matches React's `MenuHandle` 1:1 on the public methods. */ export declare class MenuHandle { /** @internal */ readonly store: MenuStore; constructor(); /** * Opens the menu and associates it with the trigger with the given id. * Throws if no trigger with that id is registered. */ open(triggerId: string): void; /** Closes the menu. */ close(): void; /** Whether the menu is currently open. Synchronous. */ get isOpen(): boolean; } /** * Factory for `MenuHandle` — matches React's `createMenuHandle()`. */ export declare function createMenuHandle(): MenuHandle; //# sourceMappingURL=menu-store.d.ts.map