export type TanstackReactVirtualMockItem = { readonly index: number; readonly start: number; readonly end: number; readonly size: number; readonly lane: number; readonly key: number; readonly measureRef: () => void; }; type TanstackReactVirtualMockVirtualizer = { readonly getVirtualItems: () => ReadonlyArray; readonly getTotalSize: () => number; readonly containerRef: () => void; readonly scrollOffset: number; readonly isScrolling: boolean; readonly scrollToIndex: () => void; readonly scrollToOffset: () => void; readonly scrollToAlign: () => void; readonly scrollToItem: () => void; readonly resetAfterIndex: () => void; readonly resetAfterItem: () => void; readonly scrollTo: () => void; readonly measure: () => void; readonly measureElement: () => number; }; type UseVirtualizerOptions = { readonly count: number; }; type TanstackReactVirtualMockModule = { readonly useVirtualizer: (options: UseVirtualizerOptions) => TanstackReactVirtualMockVirtualizer; }; /** * Overrides the virtual items returned by every mocked virtualizer. Pass * `undefined` to fall back to the deterministic full-window items derived * from `count`. */ export declare const setTanstackReactVirtualItems: (virtualItems: ReadonlyArray | undefined) => void; /** * Controls whether `useVirtualizer` returns a referentially stable object * across re-renders of the same mounted instance, mirroring the real * virtualizer's in-place-update behaviour. Defaults to `false` (a new object * every render). */ export declare const setTanstackReactVirtualStableInstance: (isStableInstance: boolean) => void; /** Resets all mock test controls set via `setTanstackReactVirtualItems`/`setTanstackReactVirtualStableInstance`. */ export declare const resetTanstackReactVirtualMock: () => void; /** * Builds the mock module object for `@tanstack/react-virtual`. * * `useVirtualizer` is replaced with a deterministic implementation that * returns every item (no real DOM virtualisation), so tests can assert on the * full rendered list without worrying about scroll-driven windowing. The * shape mirrors the fields consumed after the `directDomUpdates` migration * (`containerRef`, `scrollOffset`, `isScrolling`, and item `size`/`end`/`lane`). * * `count`/object-identity are tracked per mounted call site via `useRef` (the * mock is invoked during render, so real hooks are safe to use here), so two * simultaneously-rendered virtualized components don't stomp on each other's * state the way a shared module-level variable would. * * Use this from a per-file `vi.mock` when a project-wide mock is not desirable * (e.g. sibling specs render virtualized components through real pagination * flows that would otherwise loop): * * @example * vi.mock("@tanstack/react-virtual", async () => { * const { tanstackReactVirtualMock } = await import("@trackunit/react-vite-test-setup"); * return tanstackReactVirtualMock(); * }); */ export declare const tanstackReactVirtualMock: () => Promise; /** * Mocks the `@tanstack/react-virtual` library for testing environments. * * Opt-in: the mock is registered via `vi.doMock` so it is NOT hoisted and only * takes effect once `setupTanstackReactVirtual()` is called from a test setup * file. Tests that need the real virtualizer (or their own mock) are * unaffected unless they explicitly call this. * * @example * import { setupTanstackReactVirtual } from '@trackunit/react-vite-test-setup'; * setupTanstackReactVirtual(); */ export declare const setupTanstackReactVirtual: () => void; export {};