vevet
Version:
Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.
103 lines • 3.34 kB
TypeScript
import { Module, TModuleOnCallbacksProps } from '../../base';
import { TRequiredProps } from '../../internal/requiredProps';
import { ISwipeMatrix, ISwipeVec2 } from './global';
import { ISwipeCallbacksMap, ISwipeMutableProps, ISwipeStaticProps } from './types';
export * from './types';
export * from './global';
type TC = ISwipeCallbacksMap;
type TS = ISwipeStaticProps;
type TM = ISwipeMutableProps;
/**
* Manages swipe interactions:
* - Tracks movement and detects direction
* - Emits events on start, move, and end
* - Supports inertia-based movement
*
* Notes:
* - Does not transform elements, only computes coordinates.
* - Does not persist state after swipe completion.
*
* [Documentation](https://vevetjs.com/docs/Swipe)
*
* @group Components
*/
export declare class Swipe extends Module<TC, TS, TM> {
/**
* Returns default static properties.
*/
_getStatic(): TRequiredProps<TS>;
/**
* Returns default mutable properties.
*/
_getMutable(): TRequiredProps<TM>;
/** Swipe coords */
private _coords;
/** Inertia animation */
private _inertia;
/** Styles manager */
private _styles;
/** Pointer event manager */
private _pointers;
/** If swiping has started */
private _isSwiping;
/** If swiping has been aborted */
private _isAborted;
/** Swipe start time */
private _startTime;
/** Initial swipe coordinates (internal use) */
private _startCoord;
constructor(props?: TS & TM & TModuleOnCallbacksProps<TC, Swipe>, onCallbacks?: TModuleOnCallbacksProps<TC, Swipe>);
/** Returns current swipe coordinates */
get coords(): import("./global").ISwipeCoords;
/** Event target element */
get container(): HTMLElement | SVGElement;
/** Indicates if inertia is active */
get hasInertia(): boolean;
/** Indicates if a swipe is active */
get isSwiping(): boolean;
/** Handles property updates */
protected _handleProps(props: Partial<TM>): void;
/** Sets event listeners */
private _setEvents;
/** Handles `touchstart` events */
private _handleTouchStart;
/** Prevents edge swipes if enabled */
private _preventEdgeSwipe;
/** Handles swipe start and tracking */
private _handlePointersStart;
/** Handles `touchmove` event */
private _handleTouchMove;
/** Handles `mousemove` event */
private _handleMouseMove;
/** Handles move events */
private _handleMove;
/** Checks if swipe can start */
private _canStart;
/** Handles move events */
private _move;
/** Handles swipe end */
private _handleEnd;
/** Reset swipe states */
private _reset;
/** Apply inertia-based movement */
private _releaseInertia;
/** Cancel inertia */
cancelInertia(): void;
/** Start coordinate */
get start(): ISwipeMatrix;
/** Previous coordinate */
get prev(): ISwipeMatrix;
/** Current coordinate */
get current(): ISwipeMatrix;
/** Difference between start and current coordinates */
get diff(): ISwipeMatrix;
/** Difference between start and previous coordinates */
get step(): ISwipeMatrix;
/** Accumulated movement */
get accum(): ISwipeVec2;
/**
* Destroys the component
*/
protected _destroy(): void;
}
//# sourceMappingURL=index.d.ts.map