import type { ChatScrollDirection } from './chatScrollIntent.js'; import { type ScrollGeometry } from './chatScrollPolicy.js'; export type DirectionalScrollGeometry = ScrollGeometry & { capturedAt: number; direction: ChatScrollDirection; }; export type PendingScrollDirection = { capturedAt: number; direction: ChatScrollDirection; }; export type RecordScrollIntentArgs = { direction: ChatScrollDirection; current: ScrollGeometry; now: number; }; export type RecordUserScrollArgs = { previousScrollTop: number; current: ScrollGeometry; now: number; }; export type GetProgressPreservationTargetArgs = { current: ScrollGeometry; now: number; }; export type ChatScrollProgressPreserverOptions = { activeWindowMs?: number; movementThresholdPx?: number; minAdjustmentPx?: number; }; export type PreserveMinimumScrollProgressArgs = { previous: ScrollGeometry; current: ScrollGeometry; minAdjustmentPx?: number; }; export type PreserveDirectionalScrollProgressArgs = { direction: ChatScrollDirection; previous: ScrollGeometry; current: ScrollGeometry; minAdjustmentPx?: number; }; export declare const getGapFromBottom: (geometry: ScrollGeometry) => number; export declare const getScrollProgress: (geometry: ScrollGeometry) => number; /** * When content grows under an actively downward-scrolling user, keep the * scrollbar from losing normalized progress through the now-taller viewport. */ export declare const preserveMinimumScrollProgressTarget: ({ previous, current, minAdjustmentPx }: PreserveMinimumScrollProgressArgs) => number | null; /** * Preserve the user's scrollbar trajectory through late layout growth. * - Downward input should not lose normalized scroll progress. * - Upward input should not gain normalized scroll progress. */ export declare const preserveDirectionalScrollProgressTarget: ({ direction, previous, current, minAdjustmentPx }: PreserveDirectionalScrollProgressArgs) => number | null; export declare class ChatScrollProgressPreserver { #private; constructor(options?: ChatScrollProgressPreserverOptions); recordScrollIntent({ direction, current, now }: RecordScrollIntentArgs): void; recordUserScroll({ previousScrollTop, current, now }: RecordUserScrollArgs): void; getPreservationTarget({ current, now }: GetProgressPreservationTargetArgs): number | null; isActive(now: number): boolean; commitAdjustment(current: ScrollGeometry, now: number): void; reset(): void; }