import React from 'react'; interface UseScrollBasedChunksProps { scrollContainerRef: React.RefObject; tableRef: React.RefObject; totalItems: number; rowHeight: number; chunkSize: number; renderOverscan?: number; fetchOverscan?: number; } interface ChunkState { shouldRender: boolean; shouldFetch: boolean; } /** * Virtualized chunking for tables within a shared scroll container. * * Behavior: * - Dynamic offset: On scroll/resize, compute the table's current offset relative to the * scroll container using DOM rects. This stays correct as surrounding layout changes. * - Visible range: Convert the container viewport [scrollTop, scrollTop+clientHeight] * into table coordinates and derive visible chunk indices from rowHeight and chunkSize. * - Offscreen freeze: If the table's [tableStartY, tableEndY] is farther than one viewport * away (freeze margin = container.clientHeight), skip updating the visible chunk range. * This keeps offscreen groups stable and prevents scroll jumps when many groups are open. * - Overscan: renderOverscan/fetchOverscan buffer around the visible range to reduce * thrashing (Safari uses smaller render overscan). * - Throttling: Scroll updates are throttled (THROTTLE_DELAY), and resize is raf-throttled. * * Notes: * - totalItems/rowHeight changes re-evaluate bounds. * - When offscreen, the hook returns skipUpdate to preserve the previous range. */ export declare const useScrollBasedChunks: ({ scrollContainerRef, tableRef, totalItems, rowHeight, chunkSize, renderOverscan: rawRenderOverscan, fetchOverscan, }: UseScrollBasedChunksProps) => ChunkState[]; export {};