/** * Enhanced ScrollView Component (Phase 5.5) * * SwiftUI-inspired ScrollView component with performance optimization, * smooth scrolling, pull-to-refresh, and advanced scroll handling. */ import type { ModifiableComponentWithModifiers } from '@tachui/core'; import type { Signal } from '@tachui/core'; import type { ComponentInstance, ComponentProps } from '@tachui/core'; /** * Scroll direction */ export type ScrollDirection = 'vertical' | 'horizontal' | 'both'; /** * Scroll behavior for programmatic scrolling */ export type ScrollBehavior = 'auto' | 'smooth' | 'instant'; /** * Content offset position */ export interface ContentOffset { x: number; y: number; } /** * Scroll edge detection */ export interface ScrollEdges { top: boolean; bottom: boolean; left: boolean; right: boolean; } /** * Pull-to-refresh state */ export type PullToRefreshState = 'idle' | 'pulling' | 'ready' | 'refreshing'; /** * Scroll event information */ export interface ScrollEventInfo { offset: ContentOffset; velocity: ContentOffset; contentSize: { width: number; height: number; }; containerSize: { width: number; height: number; }; edges: ScrollEdges; } /** * ScrollView component properties */ export interface ScrollViewProps extends ComponentProps { children?: ComponentInstance[]; direction?: ScrollDirection; showsScrollIndicator?: boolean; bounces?: boolean; scrollEnabled?: boolean | Signal; contentOffset?: Signal; contentSize?: Signal<{ width: number; height: number; }>; refreshControl?: { enabled: boolean; onRefresh: () => Promise; refreshing?: Signal; threshold?: number; tintColor?: string; }; onScroll?: (info: ScrollEventInfo) => void; onScrollBegin?: () => void; onScrollEnd?: () => void; onReachTop?: () => void; onReachBottom?: () => void; onReachLeft?: () => void; onReachRight?: () => void; scrollEventThrottle?: number; decelerationRate?: 'normal' | 'fast' | number; contentInset?: { top?: number; bottom?: number; left?: number; right?: number; }; pagingEnabled?: boolean; snapToAlignment?: 'start' | 'center' | 'end'; snapToInterval?: number; keyboardDismissMode?: 'none' | 'on-drag' | 'interactive'; accessibilityLabel?: string; accessibilityRole?: string; } type ScrollViewInstance = ModifiableComponentWithModifiers; /** * Enhanced ScrollView component class */ export declare class EnhancedScrollView implements ComponentInstance { props: ScrollViewProps; readonly type: "component"; readonly id: string; mounted: boolean; cleanup: (() => void)[]; private scrollElement; contentOffsetSignal: () => ContentOffset; private setContentOffset; contentSizeSignal: () => { width: number; height: number; }; private setContentSize; private setIsScrolling; private pullToRefreshStateSignal; private setPullToRefreshState; private scrollEventThrottle; private lastScrollTime; private scrollVelocity; private lastScrollOffset; private pullStartY; private isPulling; constructor(props: ScrollViewProps); /** * Calculate scroll velocity */ private calculateVelocity; /** * Detect scroll edges */ private detectScrollEdges; /** * Handle scroll events */ private handleScroll; /** * Handle scroll start */ private handleScrollStart; /** * Handle scroll end */ private handleScrollEnd; /** * Handle touch start for pull to refresh */ private handleTouchStart; /** * Handle touch move for pull to refresh */ private handleTouchMove; /** * Handle touch end for pull to refresh */ private handleTouchEnd; /** * Set up scroll event handlers */ private setupScrollHandlers; /** * Get overflow styles based on direction */ private getOverflowStyles; /** * Apply additional scroll view styling (position and overflow already set in initial render) */ private applyScrollViewStyles; /** * Apply content insets */ private applyContentInsets; /** * Create pull to refresh indicator */ private createPullToRefreshIndicator; /** * Scroll to specific position */ scrollTo(offset: Partial, behavior?: ScrollBehavior): void; /** * Scroll to top */ scrollToTop(behavior?: ScrollBehavior): void; /** * Scroll to bottom */ scrollToBottom(behavior?: ScrollBehavior): void; /** * Render the scroll view component */ render(): import("@tachui/core").DOMNode[]; } /** * Create enhanced ScrollView component with modifier support */ export declare function ScrollView(props?: ScrollViewProps): ScrollViewInstance; /** * ScrollView utility functions */ export declare const ScrollViewUtils: { /** * Create a scroll view with pull to refresh */ withRefresh(children: ComponentInstance[], onRefresh: () => Promise, options?: Partial): ScrollViewInstance; /** * Create a horizontal scroll view */ horizontal(children: ComponentInstance[], props?: Omit): ScrollViewInstance; /** * Create a paged scroll view */ paged(children: ComponentInstance[], props?: Omit): ScrollViewInstance; }; export {}; //# sourceMappingURL=ScrollView.d.ts.map