/** * Options for the useIntersectionObserver hook * @property {Element | Document | null} [root] - The root element for intersection calculations * @property {string} [rootMargin] - Margin around the root element * @property {number | number[]} [threshold] - Threshold values for intersection detection * @property {boolean} [freezeOnceVisible] - Whether to freeze once the element becomes visible * @property {(isIntersecting: boolean, entry: IntersectionObserverEntry) => void} [onChange] - Callback when intersection changes * @property {boolean} [initialIsIntersecting] - Initial intersection state */ export type UseIntersectionObserverOptions = { /** * The root element for intersection calculations */ root?: Element | Document | null; /** * Margin around the root element */ rootMargin?: string; /** * Threshold values for intersection detection */ threshold?: number | number[]; /** * Whether to freeze once the element becomes visible */ freezeOnceVisible?: boolean; /** * Callback when intersection changes */ onChange?: (isIntersecting: boolean, entry: IntersectionObserverEntry) => void; /** * Initial intersection state */ initialIsIntersecting?: boolean; }; /** * Return type for the useIntersectionObserver hook * @property {(node?: Element | null) => void} ref - Function to set the element to observe * @property {boolean} isIntersecting - Whether the element is intersecting * @property {IntersectionObserverEntry} [entry] - The intersection observer entry */ export type IntersectionReturn = [ (node?: Element | null) => void, boolean, IntersectionObserverEntry | undefined ] & { ref: (node?: Element | null) => void; isIntersecting: boolean; entry?: IntersectionObserverEntry; }; /** * Custom hook for observing element intersection with viewport or root element. * * Features: * - Observes element intersection with viewport or custom root element * - Supports configurable threshold values and root margins * - Provides intersection state and detailed entry information * - Supports freezing observation once element becomes visible * - Handles browser compatibility gracefully * - Provides both array and object destructuring support * - Automatically cleans up observer on unmount * - Supports onChange callback for custom intersection handling * * @param options - Configuration options for the intersection observer * @returns Array containing ref function, intersection state, and entry, with additional object properties */ export declare function useIntersectionObserver({ threshold, root, rootMargin, freezeOnceVisible, initialIsIntersecting, onChange, }?: UseIntersectionObserverOptions): IntersectionReturn;