{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\n/**\n * Type layer for the floating-ui-react Solid port.\n *\n * Mirrors `base-ui/packages/react/src/floating-ui-react/types.ts`, swapping\n * three things for Solid idioms:\n *\n * 1. Positioning types come from `@floating-ui/dom` instead of\n *    `@floating-ui/react-dom` (since Solid doesn't use the React wrapper).\n * 2. React-style `RefObject<T>` becomes a plain `{ current: T | null }`\n *    contract. Solid uses mutable closed-over variables for refs, but the\n *    port surfaces them via a thin ref-like shape so caller ergonomics\n *    match the React source.\n * 3. `React.HTMLProps<E>` becomes a record of JSX-friendly attribute shapes\n *    typed loosely enough to mesh with Solid's `mergePropsN` + render-element\n *    pipeline, which normalizes props via `HTMLProps` from\n *    `src/internals/types.ts`.\n *\n * The three placeholder types — `FloatingRootStoreType`,\n * `FloatingTreeStoreType`, `ExtendedUserProps` — are defined as opaque\n * shapes here so the file type-checks in isolation. They are re-declared\n * with concrete shapes in later stages (Stage 3 for stores, Stage 4 for\n * `ExtendedUserProps`). Keeping them local-opaque avoids a circular\n * import between `types.ts` and the store/hook files.\n */\n\nimport type {\n\tComputePositionConfig,\n\tComputePositionReturn,\n\tMiddleware,\n\tMiddlewareData,\n\tPlacement,\n\tStrategy,\n\tVirtualElement,\n} from \"@floating-ui/dom\";\n\nimport type { BaseUIChangeEventDetails } from \"../change-event-details\";\n\n// ---------------------------------------------------------------------------\n// Re-exports from `@floating-ui/dom`.\n// ---------------------------------------------------------------------------\n\n// Option-object types are shipped under slightly different names in\n// `@floating-ui/dom`; re-export them as-is so callers can use the same\n// names the React source expects.\nexport type {\n\tAlignment,\n\tAutoUpdateOptions,\n\tAxis,\n\tClientRectObject,\n\tComputePositionConfig,\n\tComputePositionReturn,\n\tCoords,\n\tDimensions,\n\tElements,\n\tMiddleware,\n\tMiddlewareData,\n\tMiddlewareState,\n\tPadding,\n\tPlacement,\n\tRect,\n\tSide,\n\tStrategy,\n\tVirtualElement,\n} from \"@floating-ui/dom\";\n\n// ---------------------------------------------------------------------------\n// Local types — sized to match the React source.\n// ---------------------------------------------------------------------------\n\nexport type Prettify<T> = {\n\t[K in keyof T]: T[K];\n} & {};\n\nexport type Delay = number | Partial<{ open: number; close: number }>;\n\nexport type ReferenceType = Element | VirtualElement;\n\nexport type NarrowedElement<T> = T extends Element ? T : Element;\n\n/**\n * Ref-like container. We use a plain mutable `{ current }` object rather than\n * Solid's closed-over `let` bindings because the React source passes refs\n * around between hooks, and a shared mutable slot is the closest analogue.\n * Ports consume these as `ref.current` reads/writes; Solid reactivity is\n * layered on top (e.g. signals) when the field needs to trigger re-runs.\n */\nexport interface MutableRef<T> {\n\tcurrent: T;\n}\n\nexport interface ExtendedRefs {\n\treference: MutableRef<ReferenceType | null>;\n\tfloating: MutableRef<HTMLElement | null>;\n\tdomReference: MutableRef<NarrowedElement<ReferenceType> | null>;\n\tsetReference(node: ReferenceType | null): void;\n\tsetFloating(node: HTMLElement | null): void;\n\tsetPositionReference(node: ReferenceType | null): void;\n}\n\nexport interface ExtendedElements {\n\treference: ReferenceType | null;\n\tfloating: HTMLElement | null;\n\tdomReference: NarrowedElement<ReferenceType> | null;\n}\n\nexport interface FloatingEvents {\n\t// biome-ignore lint/suspicious/noExplicitAny: pub/sub payload type erasure.\n\temit<T extends string>(event: T, data?: any): void;\n\t// biome-ignore lint/suspicious/noExplicitAny: pub/sub payload type erasure.\n\ton(event: string, handler: (data: any) => void): void;\n\t// biome-ignore lint/suspicious/noExplicitAny: pub/sub payload type erasure.\n\toff(event: string, handler: (data: any) => void): void;\n}\n\nexport interface ContextData {\n\topenEvent?: Event | undefined;\n\tfloatingContext?: FloatingContext | undefined;\n\t/**\n\t * Internal — written by `useTypeahead`. External consumers should subscribe\n\t * via the `onTypingChange` prop instead of reading this field.\n\t */\n\ttyping?: boolean | undefined;\n\t[key: string]: unknown;\n}\n\n/**\n * Real `FloatingRootStore` (Stage 3). Kept as a type-only re-export here so\n * consumers that import from `./types` get the concrete shape without\n * paying for the store module's runtime code. The class itself is exported\n * from `components/floating-root-store.ts` — import from there to\n * instantiate.\n */\nexport type FloatingRootStoreType =\n\timport(\"./components/floating-root-store\").FloatingRootStore;\n\n/**\n * Real `FloatingTreeStore` (Stage 3). Same import-type pattern as above.\n */\nexport type FloatingTreeStoreType =\n\timport(\"./components/floating-tree-store\").FloatingTreeStore;\n\nexport type FloatingRootContext = FloatingRootStoreType;\n\nexport interface UsePositionFloatingReturn<\n\tRT extends ReferenceType = ReferenceType,\n> extends ComputePositionReturn {\n\t/**\n\t * Whether the placement has been populated yet. `false` until the first\n\t * `computePosition` cycle resolves.\n\t */\n\tisPositioned: boolean;\n\t/**\n\t * Imperatively re-run `computePosition`. Useful when external state\n\t * changes require a reflow outside the automatic auto-update cycle.\n\t */\n\tupdate(): void;\n\tplacement: Placement;\n\tstrategy: Strategy;\n\tmiddlewareData: MiddlewareData;\n\tx: number;\n\ty: number;\n\t// Refs / elements are layered on by `useFloating`; the base positioning\n\t// return carries the raw reference type as a phantom for downstream\n\t// narrowing (e.g. `domReference: NarrowedElement<RT>`).\n\t__ref?: RT;\n}\n\nexport type FloatingContext = Omit<\n\tUsePositionFloatingReturn<ReferenceType>,\n\t\"refs\" | \"elements\"\n> & {\n\topen: boolean;\n\tonOpenChange(\n\t\topen: boolean,\n\t\teventDetails: BaseUIChangeEventDetails<string>,\n\t): void;\n\tevents: FloatingEvents;\n\tdataRef: MutableRef<ContextData>;\n\tnodeId: string | undefined;\n\tfloatingId: string | undefined;\n\trefs: ExtendedRefs;\n\telements: ExtendedElements;\n\trootStore: FloatingRootContext;\n};\n\nexport interface FloatingNodeType {\n\tid: string | undefined;\n\tparentId: string | null;\n\tcontext?: FloatingContext | undefined;\n}\n\nexport type FloatingTreeType = FloatingTreeStoreType;\n\n/**\n * JSX-friendly element-props bag carried between interaction hooks. The\n * React source types this as `React.HTMLProps<E>`; the Solid port\n * accepts any `JSX.HTMLAttributes`-shaped record since we feed the bag\n * through `mergePropsN`, which normalizes event-handler shapes and\n * attribute casing.\n */\n// biome-ignore lint/suspicious/noExplicitAny: element props are event/attr bags.\nexport type ElementPropsBag = JSX.HTMLAttributes<any> & Record<string, unknown>;\n\n/**\n * Item-prop callback receives a payload of per-item state (active, selected).\n * Stage 4's `useInteractions` defines the concrete shape; until then this\n * is an opaque record.\n */\nexport type ExtendedUserProps = {\n\tactive?: boolean;\n\tselected?: boolean;\n} & Record<string, unknown>;\n\nexport interface ElementProps {\n\treference?: ElementPropsBag | undefined;\n\tfloating?: ElementPropsBag | undefined;\n\titem?:\n\t\t| ElementPropsBag\n\t\t| ((props: ExtendedUserProps) => ElementPropsBag)\n\t\t| undefined;\n\ttrigger?: ElementPropsBag | undefined;\n}\n\nexport type UseFloatingReturn = Prettify<\n\tUsePositionFloatingReturn & {\n\t\t/** `FloatingContext` */\n\t\tcontext: Prettify<FloatingContext>;\n\t\trefs: ExtendedRefs;\n\t\telements: ExtendedElements;\n\t}\n>;\n\nexport interface UseFloatingOptions {\n\tplacement?: Placement | undefined;\n\tstrategy?: Strategy | undefined;\n\tmiddleware?: Array<Middleware | null | undefined | false> | undefined;\n\t/**\n\t * Reference / floating elements supplied externally. Each field is a Solid\n\t * signal accessor in practice (reactive); typing stays permissive here.\n\t */\n\telements?:\n\t\t| {\n\t\t\t\treference?: ReferenceType | null | undefined;\n\t\t\t\tfloating?: HTMLElement | null | undefined;\n\t\t  }\n\t\t| undefined;\n\t/**\n\t * When `true`, the position is recomputed automatically on transform\n\t * changes. Matches `@floating-ui/dom`'s `transform` flag on\n\t * `ComputePositionConfig`.\n\t */\n\ttransform?: boolean | undefined;\n\trootContext?: FloatingRootContext | undefined;\n\tonOpenChange?(\n\t\topen: boolean,\n\t\teventDetails: BaseUIChangeEventDetails<string>,\n\t): void;\n\tnodeId?: string | undefined;\n\texternalTree?: FloatingTreeStoreType | undefined;\n\t// Propagated to `@floating-ui/dom`'s `computePosition`.\n\tplatform?: ComputePositionConfig[\"platform\"] | undefined;\n}\n"],"mappings":"","ignoreList":[]}