import type { CommonGestureConfig, ComposedGestureConfig, GestureCallbacks, GestureRelations, InternalConfigProps, } from './ConfigTypes'; import type { DetectorCallbacks } from './DetectorTypes'; import type { FilterNeverProperties } from './UtilityTypes'; // Unfortunately, this type cannot be moved into ConfigTypes.ts because of circular dependency export type ExternalRelations = { simultaneousWith?: AnyGesture | AnyGesture[] | undefined; requireToFail?: AnyGesture | AnyGesture[] | undefined; block?: AnyGesture | AnyGesture[] | undefined; }; // Similarly, this type cannot be moved into ConfigTypes.ts because it depends on `ExternalRelations` export type BaseGestureConfig< TConfig, THandlerData, TExtendedHandlerData extends THandlerData = THandlerData, > = ExternalRelations & GestureCallbacks & FilterNeverProperties & InternalConfigProps & CommonGestureConfig; export type BaseDiscreteGestureConfig< TConfig, THandlerData, TExtendedHandlerData extends THandlerData = THandlerData, > = Omit< BaseGestureConfig, 'onUpdate' >; export type SingleGesture< TConfig, THandlerData, TExtendedHandlerData extends THandlerData = THandlerData, > = { handlerTag: number; type: SingleGestureName; config: BaseGestureConfig; detectorCallbacks: DetectorCallbacks; gestureRelations: GestureRelations; }; export type DiscreteSingleGesture< TConfig, THandlerData, TExtendedHandlerData extends THandlerData = THandlerData, > = { [K in keyof SingleGesture< TConfig, THandlerData, TExtendedHandlerData >]: K extends 'config' ? Omit< SingleGesture[K], 'onUpdate' > : SingleGesture[K]; }; export type ComposedGesture = { handlerTags: number[]; type: ComposedGestureName; config: ComposedGestureConfig; detectorCallbacks: DetectorCallbacks; externalSimultaneousHandlers: number[]; gestures: Gesture[]; }; export type Gesture< TConfig = unknown, THandlerData = unknown, TExtendedHandlerData extends THandlerData = THandlerData, > = | SingleGesture | ComposedGesture; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type AnyGesture = Gesture; export enum SingleGestureName { Tap = 'TapGestureHandler', LongPress = 'LongPressGestureHandler', Pan = 'PanGestureHandler', Pinch = 'PinchGestureHandler', Rotation = 'RotationGestureHandler', Fling = 'FlingGestureHandler', Manual = 'ManualGestureHandler', Native = 'NativeViewGestureHandler', Hover = 'HoverGestureHandler', } export enum ComposedGestureName { Simultaneous = 'SimultaneousGesture', Exclusive = 'ExclusiveGesture', Race = 'RaceGesture', }