import type { MaybeElementRef, MaybeRefOrGetter } from '../types/shared/utils'; import type { VirtualItem } from '@tanstack/virtual-core'; import type { ComponentPublicInstance } from 'vue'; import { Virtualizer } from '@tanstack/virtual-core'; export interface VirtualListItem extends VirtualItem { key: string | number; } export interface VirtualListOptions { enabled?: MaybeRefOrGetter; status?: 'loading' | 'finished' | 'error' | ''; dataKey?: string; items?: readonly any[]; itemSize?: number | ((index: number) => number); overScan?: number; columnGap?: number; columnCount?: number; scrollPaddingStart?: number; scrollPaddingEnd?: number; onBottom?: () => void | Promise; bottomThreshold?: number; /** * Something holds the bottom of the viewport. Its size is final for the frame when this fires and * `nextTick` reaches it, so rows are measured before the paint instead of on the resize delivery * that would follow it. */ onGeometryChange?: () => void; } export interface VirtualListScrollToOptions { /** Scroll animation for the jump. */ behavior?: ScrollBehavior; } /** * Position and scroll operations for a data-driven outline. Implementations must read reactive * state (e.g. a layout version) inside the getters, so `PToc` re-evaluates tracking whenever the * scroll position or item measurements change. */ export interface VirtualListScrollSource { /** Scroll offset that aligns `index` with the top of the viewport, or undefined while unknown. */ getOffsetForIndex: (index: number) => number | undefined; /** Current scroll offset of the container, or null while unavailable. */ getScrollOffset: () => number | null; /** Furthest scroll offset the container can reach. */ getMaxScrollOffset: () => number; /** Scroll `index` to the top of the viewport. */ scrollToIndex: (index: number, options?: VirtualListScrollToOptions) => void; } export declare function useVirtualList(containerRef: MaybeElementRef, options: Options): { virtualItems: import("vue").ComputedRef; totalSize: import("vue").ComputedRef; measureElement: (el: Element | ComponentPublicInstance | null) => void; scrollToIndex: (index: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void; scrollToOffset: (toOffset: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void; scrollBy: (delta: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void; scrollSource: VirtualListScrollSource; getVirtualizer: () => Virtualizer; };