/** * Reels Engine - Instagram Reels / YouTube Shorts style vertical scrolling * * Features: * - Full-screen snap scrolling (one item per viewport) * - Touch gesture support with momentum * - Video/image preloading * - Snap to nearest item * - Orientation detection * - Swipe navigation * - Auto-play on visible * - Pause on hidden */ import type { EngineConfig } from './types'; export interface ReelItem { id: string; type: 'video' | 'image' | 'mixed'; src: string; thumbnail?: string; duration?: number; metadata?: { title?: string; author?: string; likes?: number; comments?: number; shares?: number; }; } export interface ReelsEngineConfig extends EngineConfig { /** Enable snap scrolling */ enableSnap?: boolean; /** Snap threshold (0-1) */ snapThreshold?: number; /** Enable touch gestures */ enableTouch?: boolean; /** Touch sensitivity */ touchSensitivity?: number; /** Momentum scrolling */ enableMomentum?: boolean; /** Momentum decay rate */ momentumDecay?: number; /** Preload adjacent items */ preloadCount?: number; /** Auto-play videos when visible */ autoPlay?: boolean; /** Mute videos by default */ muteVideos?: boolean; /** Loop videos */ loopVideos?: boolean; /** Enable orientation detection */ enableOrientationDetection?: boolean; } export interface ReelsEngineState { currentIndex: number; items: ReelItem[]; isScrolling: boolean; scrollDirection: 'up' | 'down' | 'none'; touchStartY: number; touchCurrentY: number; velocity: number; orientation: 'portrait' | 'landscape'; visibleIndex: number; preloadQueue: string[]; } export declare class ReelsEngine { private config; private state; private container; private itemElements; private videoElements; private animationFrame; private touchStartTime; private lastTouchY; private touchVelocities; constructor(config: ReelsEngineConfig); /** * Initialize with container */ init(container: HTMLElement): void; /** * Set reel items */ setItems(items: ReelItem[]): void; /** * Setup touch event handlers */ private setupTouchHandlers; /** * Handle touch start */ private handleTouchStart; /** * Handle touch move */ private handleTouchMove; /** * Handle touch end with momentum */ private handleTouchEnd; /** * Handle mouse wheel */ private handleWheel; /** * Apply momentum scrolling */ private applyMomentum; /** * Snap to nearest item */ private snapToNearest; /** * Go to next reel */ goToNext(): void; /** * Go to previous reel */ goToPrevious(): void; /** * Scroll to specific index */ scrollToIndex(index: number): void; /** * Update visible index */ private updateVisibleIndex; /** * Setup orientation detection */ private setupOrientationDetection; /** * Adjust layout for orientation */ private adjustLayoutForOrientation; /** * Update preload queue */ private updatePreloadQueue; /** * Preload items (videos/images) */ private preloadItems; /** * Play video at index */ private playVideo; /** * Pause video at index */ private pauseVideo; /** * Render reels */ private render; /** * Create reel element */ private createReelElement; /** * Create metadata overlay */ private createMetadataOverlay; /** * Start animation loop */ private startAnimationLoop; /** * Update visible index from scroll position */ private updateVisibleIndexFromScroll; /** * Get current reel */ getCurrentReel(): ReelItem | null; /** * Get engine state */ getState(): ReelsEngineState; /** * Destroy engine */ destroy(): void; } //# sourceMappingURL=ReelsEngine.d.ts.map