import { type Accessor } from "solid-js"; /** * Plain `{ current }` ref shape that mirrors React's `RefObject`. Kept structurally identical to the other `MutableRef` * declarations in this codebase (see `use-latest-ref.ts`) so consumers can * pass the same object interchangeably. */ export interface MutableRef { current: T; } export interface UseOpenChangeCompleteParameters { /** * Whether the hook is enabled. May be a plain boolean or a reactive * accessor. Defaults to `true`. */ enabled?: boolean | Accessor | undefined; /** * Whether the element is open. Must be a reactive accessor — Solid has no * re-render cycle, so changes arrive via signal reads. */ open?: Accessor; /** * Ref to the element being closed. Its `.current` is read at * invocation time, so a ref that is `null` during setup but populated * before the first `open` change still works correctly. */ ref: MutableRef; /** * Function to call when the animation completes (or there is no * animation). Stabilized internally via `createStableCallback` so * consumers may swap the function freely — the latest closure wins at * firing time. */ onComplete: () => void; } /** * Calls the provided function when the CSS open/close animation or * transition on the referenced element completes. * * Port of Base UI React's * `packages/react/src/internals/useOpenChangeComplete.tsx`. The React * version re-runs its effect every time `open`, `enabled`, or the * stabilized `onComplete` changes — because the effect's dependency * array includes those inputs. The Solid equivalent uses a * `createEffect` split-form that tracks the same reactive inputs: each * change re-fires the apply, which aborts any prior in-flight wait and * schedules a fresh `runOnceAnimationsFinish` cycle. * * The `ref` is intentionally not reactive — matching React, which reads * `ref.current` lazily inside `useAnimationsFinished`'s closure. If the * ref populates after setup, the next `open` change will pick it up. * * @example * ```ts * const [open, setOpen] = createSignal(false); * let el!: HTMLDivElement; * useOpenChangeComplete({ * open, * ref: { get current() { return el; }, set current(v) { el = v!; } }, * onComplete: () => setMounted(false), * }); * ``` */ export declare function useOpenChangeComplete(parameters: UseOpenChangeCompleteParameters): void; //# sourceMappingURL=use-open-change-complete.d.ts.map