vevet
Version:
Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.
156 lines • 5.62 kB
TypeScript
import { Module, TModuleOnCallbacksProps } from '../../base';
import { TRequiredProps } from '../../internal/requiredProps';
import { SnapSlide } from './logic/Slide';
import { ISnapCallbacksMap, ISnapMagnet, ISnapMutableProps, ISnapNexPrevArg, ISnapStaticProps, ISnapToSlideArg, ISnapTransitionArg } from './types';
export * from './types';
export * from './logic/Slide';
type TC = ISnapCallbacksMap;
type TS = ISnapStaticProps;
type TM = ISnapMutableProps;
/**
* Snap/Carousel handler.
* This class manages sliding progress with options like swipe, wheel interactions, and smooth transitions.
*
* Please not that the class does not apply any styles to the slides, it only handles the logic.
*
* [Documentation](https://vevetjs.com/docs/Snap)
*
* @group Components
*/
export declare class Snap extends Module<TC, TS, TM> {
/**
* Returns the default static properties.
*/
_getStatic(): TRequiredProps<TS>;
/**
* Returns the default mutable properties.
*/
_getMutable(): TRequiredProps<TM>;
/** Swipe events */
private _swipe;
/** Snap Track */
private _track;
/** Snap Idle Logic */
private _idle;
/** Container size */
private _containerSize;
/** All slides */
private _slides;
/** Scrollable slides (which size is larger than the container) */
private _scrollableSlides;
/** Resize handler */
private _resizer;
/** Active slide index */
private _activeIndex;
/**
* Target slide index.
* For internal use only
*/
$_targetIndex?: number;
constructor(props: TS & TM & TModuleOnCallbacksProps<TC, Snap>, onCallbacks?: TModuleOnCallbacksProps<TC, Snap>);
/** Handles properties change */
protected _handleProps(props: Partial<TM>): void;
/** Get container */
get container(): HTMLElement;
/** Get events emitter */
get eventsEmitter(): HTMLElement;
/** Container size depending on direction (width or height) */
get containerSize(): number;
/**
* Container size depending on direction (width or height)
* @deprecated
*/
get domSize(): number;
/** All slides */
get slides(): SnapSlide[];
/** Scrollable slides (which size is larger than the container) */
get scrollableSlides(): SnapSlide[];
/** Active slide index */
get activeIndex(): number;
/** Active slide */
get activeSlide(): SnapSlide;
get isEmpty(): boolean;
/** Get axis name depending on direction */
get axis(): "x" | "y";
/** If transition in progress */
get isTransitioning(): boolean;
/** If swipe in progress */
get isSwiping(): boolean;
/** If swipe has inertia */
get hasInteria(): boolean;
/** If track values are interpolating */
get isInterpolating(): boolean;
/** Gets the interpolation influence */
get influence(): number;
/** Gets the current track value. */
get current(): number;
/** Gets the target track value. */
get target(): number;
/** Detect if can loop */
get canLoop(): boolean;
/** Get looped current value */
get loopedCurrent(): number;
/** Get loop count */
get loopCount(): number;
/** Sets track to current & target value instantly */
set(value: number): void;
/** Loop a coordinate if can loop */
loopCoord(coord: number): number;
/** Get minimum track value */
get min(): number;
/** Get maximum track value */
get max(): number;
/** Get track progress. From 0 to 1 if not loop. From -Infinity to Infinity if loop */
get progress(): number;
/** If the start has been reached */
get isStart(): boolean;
/** If the end has been reached */
get isEnd(): boolean;
/** Clamp target value between min and max values */
clampTarget(): void;
/** Iterate track target value */
iterateTarget(delta: number): void;
/** Set track target value */
setTarget(value: number): void;
/** Cancel slide transition */
cancelTransition(): void;
/** Check if the active slide is larger than the container and is being scrolled */
get isSlideScrolling(): boolean;
/** Get first slide size */
get firstSlideSize(): number;
/** If the scene is idle: not swiping, not interpolating, not transitioning */
get isIdle(): boolean;
/** Update slides list and attach them */
private _fetchSlides;
/** Request resize (handled with debounce timeout) */
resize(isManual?: boolean): void;
/** Resize the scene and reflow */
private _handleResize;
/** Reflow: update static values of slides */
private _reflow;
/** Render slides */
render(frameDuration?: number): void;
/** Update slides values */
private _updateSlidesCoords;
/** Update slides progress */
private _updateSlideProgress;
/** Get nearest magnet */
private get magnet();
/** Get nearest magnet to the current position */
getNearestMagnet(coord: number): ISnapMagnet | undefined;
/** Stick to the nearest magnet */
stick(): void;
/** Go to a definite coordinate */
toCoord(coordinate: number, options?: ISnapTransitionArg): boolean;
/** Go to a slide by index */
toSlide(targetIndex: number, { direction, ...options }?: ISnapToSlideArg): boolean;
/** Go to next slide */
next({ skip, ...options }?: ISnapNexPrevArg): boolean;
/** Go to previous slide */
prev({ skip, ...options }?: ISnapNexPrevArg): boolean;
/**
* Destroys the component and clears all timeouts and resources.
*/
protected _destroy(): void;
}
//# sourceMappingURL=index.d.ts.map