vevet
Version:
Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.
93 lines • 3.31 kB
TypeScript
import { Module, TModuleOnCallbacksProps } from '../../base';
import { TRequiredProps } from '../../internal/requiredProps';
import { IPointersCallbacksMap, IPointersItem, IPointersMutableProps, IPointersStaticProps } from './types';
export * from './types';
type TC = IPointersCallbacksMap;
type TS = IPointersStaticProps;
type TM = IPointersMutableProps;
/**
* Manages pointer events, including tracking multiple pointers,
* and emitting callbacks for pointer interactions.
*
* For proper functionality, ensure the container has an appropriate
* [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) property.
*
* [Documentation](https://vevetjs.com/docs/Pointers)
*
* @group Components
*/
export declare class Pointers extends Module<TC, TS, TM> {
/**
* Returns the default static properties.
*/
_getStatic(): TRequiredProps<TS>;
/**
* Returns the default mutable properties.
*/
_getMutable(): TRequiredProps<TM>;
/**
* Stores active event listeners for runtime interactions.
*/
private _listeners;
/** Indicates whether the `start` event has been triggered. */
private _isStarted;
/** Map of active pointers. */
private _pointersMap;
constructor(props?: TS & TM & TModuleOnCallbacksProps<TC, Pointers>, onCallbacks?: TModuleOnCallbacksProps<TC, Pointers>);
/** Indicates whether the `start` event has been triggered. */
get isStarted(): boolean;
/** Returns the map of active pointers. */
get pointersMap(): Map<number, IPointersItem>;
/** Returns the container element handling events. */
get container(): HTMLElement | SVGElement;
/** Returns the minimum number of pointers required to trigger events. */
get minPointers(): number;
/** Returns the maximum number of pointers that can be tracked. */
get maxPointers(): number;
/**
* Attaches base event listeners to the container.
*/
private _setBaseEvents;
/**
* Attaches runtime event listeners for active pointer interactions.
*/
private _setRuntimeEvents;
/**
* Handles pointer down events (`pointerdown`).
* Adds a new pointer if conditions are met and triggers the `pointerdown` callback.
*/
private _handlePointerDown;
/**
* Handles pointer movement (`pointermove`).
* Updates pointer positions and triggers the `pointermove` callback.
*/
private _handlePointerMove;
/**
* Handles pointer release (`pointerup`).
* Removes the pointer and triggers the `pointerup` callback.
* If no active pointers remain, fires the `end` callback.
*/
private _handlePointerUp;
/**
* Handles event cancellations (`pointercancel`, `blur`).
* Triggers the `end` callback and cleans up all pointers.
*/
private _handleCancel;
/**
* Prevents text selection during pointer interactions.
*/
private _resetSelection;
/**
* Returns pointer coordinates relative to the container.
*/
private _decodeCoords;
/**
* Cleans up event listeners, pointers, and injected styles.
*/
private _cleanup;
/**
* Destroys the component and removes all event listeners.
*/
protected _destroy(): void;
}
//# sourceMappingURL=index.d.ts.map