/** * Orientation-specific property names for carousel positioning */ export type OrientationProps = { size: "width" | "height"; scroll: "scrollWidth" | "scrollHeight"; client: "clientWidth" | "clientHeight"; direction: "x" | "y"; pagePosition: "pageX" | "pageY"; clientPosition: "clientX" | "clientY"; }; import { type MomentumConfig } from "./momentum"; import { type ParsedTransition, WaapiAnimationCore } from "./waapi-core"; /** * Calculates the scroll position for a specific item based on alignment. */ export declare function getItemPosition(params: { scrollArea: HTMLElement; index: number; itemRefsArray: Array<{ value: HTMLElement | undefined; }>; align: "start" | "center" | "end"; orientationProps: OrientationProps; }): number; /** * Manages CSS transform-based scrolling for the carousel. * Handles transitions, positioning, and scroll initialization. * * Performance: Tracks last known position to avoid expensive getComputedStyle() * calls during touch interactions on mobile. */ export declare class TransformManager extends WaapiAnimationCore { private givenTransition; private isInitialTransition; readonly direction: "x" | "y"; private orientationProps; private lastAppliedPosition; private cachedBoundaries; private boundariesInvalidated; private cachedItemPositions; private itemPositionsInvalidated; constructor(params: { scrollArea: HTMLElement; direction: "x" | "y"; orientationProps: OrientationProps; givenTransition: { value: string | undefined; }; parsedTransition: { value: ParsedTransition | null; }; isInitialTransition: { value: boolean; }; }); applyTransform(params: { transform: { x: number; y: number; z: number; }; }): void; /** * Navigates to a specific item using WAAPI animation. * Enforces boundaries for non-loop mode. */ navigateToItem(params: { index: number; itemRefsArray: Array<{ value: HTMLElement | undefined; }>; align: "start" | "center" | "end"; transform: { value: { x: number; y: number; z: number; }; }; overridePosition?: number; onComplete?: () => void; }): { position: number; animation: Animation | null; }; /** * Calculates snap target and animates to it. * Unifies momentum and closest-item snapping logic. */ animateSnap(params: { currentTransform: number; align: "start" | "center" | "end"; velocity?: number; momentumConfig?: Partial; itemRefs: Array<{ value: HTMLElement | undefined; }>; onFrame: (transform: number) => void; onComplete: () => void; }): { index: number; snapDelta: number; animation: Animation | null; }; /** * Ensures CSS transition is parsed for WAAPI use. */ protected ensureTransitionParsed(): void; applyTransformWithoutTransition(params: { transform: { x: number; y: number; z: number; }; }): void; /** * High-performance transform update for drag operations. * Avoids object allocations by taking the value directly. * Use this in touch/mouse move handlers for best mobile performance. */ applyTransformDirect(value: number): void; initializeFromScroll(params: { transform: { value: { x: number; y: number; z: number; }; }; }): void; disableTransition(): void; /** * Invalidates cached boundaries and item positions. Call this on resize. */ invalidateBoundaries(): void; /** * Returns cached boundaries, calculating only if invalidated. * Avoids expensive scrollWidth/clientWidth reads on every touch start. */ getBoundaries(): { min: number; max: number; }; /** * Invalidates cached item positions. Call this on resize. */ invalidateItemPositions(): void; /** * Returns cached item positions array, calculating only if invalidated. * Uses Float64Array for memory efficiency and fast iteration. */ getItemPositions(itemRefsArray: Array<{ value: HTMLElement | undefined; }>, align: "start" | "center" | "end"): Float64Array; /** * Finds the closest item index using cached positions. * O(n) but avoids DOM reads when positions are cached. */ findClosestItemIndex(currentPosition: number, itemRefsArray: Array<{ value: HTMLElement | undefined; }>, align: "start" | "center" | "end"): number; /** * Legacy interrupt method - now uses WAAPI cancellation. * Kept for API compatibility with carousel-utils.ts */ interruptTransition(transform: { value: { x: number; y: number; z: number; }; }): void; } /** * Gets or creates a cached TransformManager for a scroll area element. * Uses WeakMap caching to avoid recreating managers unnecessarily. */ export declare function getCachedTransformManager(params: { scrollArea: HTMLElement | undefined; direction: "x" | "y"; orientationProps: OrientationProps; givenTransition: { value: string | undefined; }; parsedTransition: { value: ParsedTransition | null; }; isInitialTransition: { value: boolean; }; }): TransformManager | null;