import type { PositionCache } from '../utils/positionCache'; import type { ViewportBaseCalculator } from './viewportBase'; export interface AxisCalculatorContext extends ViewportBaseCalculator { needReverse: boolean; lastProcessedIndex: number; } export interface AxisCalculationParams { totalCount: number; zeroBasedScrollOffset: number; scrollEnd: number; positionCache: PositionCache; setSizeField: (ctx: T, size: number) => void; setTotalCalculated: (ctx: T, value: number) => void; getTotalCalculated: (ctx: T) => number; } /** * Shared axis calculation used by both row and column viewport calculators. * * Iterates through items (rows or columns) starting from the cache-derived * skip position, fills `startPositions`, and delegates to the calculation * types via the `_process` / `_initialize` / `_finalize` callbacks on the * provided context. * * @param {object} context The viewport calculator instance (rows or columns). * @param {object} params Parameters that differ between the row and column axes. * @param {number} params.totalCount Total number of items. * @param {number} params.zeroBasedScrollOffset Clamped scroll offset (>= 0). * @param {number} params.scrollEnd Pixel threshold at which iteration stops * (rows: `innerViewportHeight`, columns: `zeroBasedScrollOffset + viewportWidth`). * @param {PositionCache} params.positionCache Built prefix sum cache. * @param {Function} params.setSizeField Callback `(ctx, size) => {}` that writes the * per-item size onto the context (e.g. `ctx.rowHeight = size`). * @param {Function} params.setTotalCalculated Callback `(ctx, value) => {}` that writes * the running cumulative total onto the context. * @param {Function} params.getTotalCalculated Callback `(ctx) => number` that reads the * running cumulative total from the context. */ export declare function calculateAxis(context: T, { totalCount, zeroBasedScrollOffset, scrollEnd, positionCache, setSizeField, setTotalCalculated, getTotalCalculated, }: AxisCalculationParams): void;