import { DeepMaybeObservable, ReadonlyObservable } from '@usels/core'; import { MaybeEventTarget } from '../../types.mjs'; import { UseSwipeDirection } from '../usePointerSwipe/core.mjs'; interface UseSwipeOptions { /** Minimum distance in px to trigger swipe. Default: 50 */ threshold?: number; /** Callback on swipe start */ onSwipeStart?: (e: TouchEvent) => void; /** Callback on swipe move */ onSwipe?: (e: TouchEvent) => void; /** Callback on swipe end */ onSwipeEnd?: (e: TouchEvent, direction: UseSwipeDirection) => void; /** Use passive event listeners. Default: true */ passive?: boolean; } interface UseSwipeReturn { /** Whether swiping is in progress */ isSwiping$: ReadonlyObservable; /** Swipe direction */ direction$: ReadonlyObservable; /** Horizontal swipe length (startX - currentX) */ lengthX$: ReadonlyObservable; /** Vertical swipe length (startY - currentY) */ lengthY$: ReadonlyObservable; /** Touch start coordinates */ coordsStart$: ReadonlyObservable<{ x: number; y: number; }>; /** Current/end touch coordinates */ coordsEnd$: ReadonlyObservable<{ x: number; y: number; }>; /** Stop listening */ stop: () => void; } /** * Framework-agnostic reactive swipe detector based on TouchEvents. * * Listens to `touchstart` / `touchmove` / `touchend` on the target and tracks * swipe direction, length, and start/end coordinates. `threshold` and callback * fields are read reactively via `opts$`, so they may be swapped at runtime. * `passive` is consumed once at mount — AddEventListenerOptions cannot change * after the listener is registered. */ declare function createSwipe(target: MaybeEventTarget, options?: DeepMaybeObservable): UseSwipeReturn; export { UseSwipeDirection, type UseSwipeOptions, type UseSwipeReturn, createSwipe };