import { ComputedRef, CSSProperties, MaybeRef, Ref, StyleValue, UnwrapRef } from 'vue'; import type { ViewerPdfPage, ElementRect, VisibleArea } from '@/utils/types'; import { ScrollMode, ViewMode, ZoomLevel } from '@/utils/enumerators'; import type { PDFDocumentProxy } from 'pdfjs-dist'; interface UseVirtualListItem { data: T; index: number; } export interface UseVirtualListReturn { list: Ref[]>; scrollTo: (index: number, rect?: ElementRect) => void; pageGroups: ComputedRef[]> | undefined>; containerProps: { ref: Ref; onScroll: () => void; style: StyleValue; }; wrapperProps: ComputedRef<{ style: CSSProperties; }>; pagesPerRow: Ref; targetScale: Ref; isScaling: Ref; onScaleRequest: (newScale: number, options?: { immediate?: boolean; origin?: [number, number]; }) => Promise; pageVisibleAreas: Ref>; currentPageIndex: Ref; /** * The focused page number (1-indexed) adjusted for view mode. * Handles DualPage and DualPageWithCover offsets automatically. * Use this instead of currentPageIndex for UI display. */ focusedPageNumber: ComputedRef; /** * True during programmatic scroll (scrollTo). * Used to prevent scroll events from updating focusedPageNumber * until the scroll animation settles. */ isScrollSettling: Ref; } interface UseVirtualPagesProps { pages: Ref; actualPdfPages: Ref; viewerRef: Ref; scrollMode: Ref; viewMode: Ref; isRtl: boolean; smoothScroll: Ref; currentScale: Ref; pdfDocument: Ref; initialScale: MaybeRef; cancelAllRenders?: () => void; reprioritizeCurrentPage?: () => void; pageRotationMap?: Ref>; } /** * Composable for virtual scrolling of PDF pages with support for multiple view modes. * * Implements efficient virtual scrolling by only rendering pages in the viewport plus overscan. * Supports smooth CSS-based zooming with atomic canvas swapping to prevent flashing. * * Features: * - Virtual scrolling with configurable overscan * - Multiple scroll modes: vertical, horizontal, wrapped, page * - Multiple view modes: single, dual page, dual page with cover * - Smooth zoom with CSS transform bridge and debounced re-render * - Maintains scroll position during zoom operations * - Dual page grouping for proper layout * * @param props - Configuration for virtual pages including pages, scroll mode, view mode * @returns Virtual list utilities including list, scrollTo, containerProps, wrapperProps, and zoom controls */ declare function useVirtualPages(props: UnwrapRef): UseVirtualListReturn; export default useVirtualPages;