import { MaybeRefOrGetter, Ref } from "vue"; //#region src/composables/useDelay/index.d.ts interface UseDelayOptions { /** * Delay in milliseconds before the opening transition fires. * * @example * ```ts * useDelay(undefined, { openDelay: 300 }) * useDelay(undefined, { openDelay: () => isFocus.value ? 0 : 500 }) * ``` */ openDelay?: MaybeRefOrGetter; /** * Delay in milliseconds before the closing transition fires. * * @example * ```ts * useDelay(undefined, { closeDelay: 200 }) * ``` */ closeDelay?: MaybeRefOrGetter; } /** * Per-call options for `start()`. * * @example * ```ts * delay.start(false, { minDelay: 500 }) * ``` */ interface UseDelayStartOptions { /** Minimum delay floor in ms; max(configuredDelay, minDelay) wins. */ minDelay?: number; } /** * The reactive controls and state surface returned by `useDelay`. * * @example * ```ts * const { start, stop, pause, resume, isActive, isOpening } = useDelay( * undefined, * { openDelay: 300, closeDelay: 200 }, * ) * * start(true) * ``` */ interface UseDelayReturn { /** * Start a delay in the given direction. Restarts if already running. Resolves * with `isOpening` once the delay elapses. If `start()` is called again before * the previous resolves, the previous promise resolves with the new direction. * * @example * ```ts * const delay = useDelay(undefined, { openDelay: 300, closeDelay: 200 }) * await delay.start(true) // resolves true after 300ms * await delay.start(false, { minDelay: 500 }) // resolves false after max(200, 500) * ``` */ start: (isOpening: boolean, options?: UseDelayStartOptions) => Promise; /** * Cancel any pending delay and reset state. Resolves the pending promise with the current direction. * * @example * ```ts * delay.stop() * ``` */ stop: () => void; /** * Pause the in-flight delay, preserving remaining time. No-op if not running. * * @example * ```ts * delay.pause() * ``` */ pause: () => void; /** * Resume from where pause left off. No-op if not paused. * * @example * ```ts * delay.resume() * ``` */ resume: () => void; /** * Whether a delay is currently pending (started, not stopped). */ isActive: Readonly>; /** * Whether the pending delay is currently paused. */ isPaused: Readonly>; /** * Milliseconds remaining until the pending transition fires. */ remaining: Readonly>; /** * Direction of the pending transition (`true` = opening, `false` = closing). */ isOpening: Readonly>; } /** * Schedule open and close transitions with configurable delays. * * Composes `useTimer` for the lifecycle (`start` / `stop` / `pause` / `resume` plus * reactive `isActive`, `isPaused`, `remaining`) and adds direction tracking * (`isOpening`) and promise-based resolution. * * @param callback Optional callback invoked once a started delay elapses; receives the resolved direction. * @param options Reactive delay settings. * @returns Lifecycle controls and reactive state. * * @see https://0.vuetifyjs.com/composables/system/use-delay * * @example * ```ts * const delay = useDelay(isOpening => isVisible.value = isOpening, { * openDelay: 300, * closeDelay: 200, * }) * * delay.start(true) * delay.start(false, { minDelay: 500 }) * delay.pause() * delay.resume() * delay.stop() * ``` */ declare function useDelay(callback?: (isOpening: boolean) => void, options?: UseDelayOptions): UseDelayReturn; //#endregion export { UseDelayOptions, UseDelayReturn, UseDelayStartOptions, useDelay };