@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
24 lines (23 loc) • 1.78 kB
TypeScript
import { ESLCarouselDirection } from './esl-carousel.types';
import type { ESLCarouselNavInfo, ESLCarouselSlideTarget, ESLCarouselState, ESLCarouselStaticState } from './esl-carousel.types';
/** @returns sign of the value */
export declare const sign: (value: number) => -1 | 1 | 0;
/** @returns normalized slide index in bounds of [0, count] range */
export declare function normalize(index: number, size: number): number;
/** @returns normalize first slide index according to the carousel mode */
export declare function normalizeIndex(index: number, { size, count, loop }: ESLCarouselStaticState): number;
/** @returns normalized sequence of slides starting from the current index */
export declare function sequence(current: number, count: number, size: number): number[];
/** @returns normalized numeric index from group index */
export declare function groupToIndex(group: number, count: number, size: number): number;
/** @returns numeric group index from slide index */
export declare function indexToGroup(index: number, count: number, size: number): number;
/** @returns closest direction to move to the passed index */
export declare function indexToDirection(index: number, { activeIndex, size, loop }: ESLCarouselState): ESLCarouselDirection | undefined;
/** @returns normalized index from target definition and current state */
export declare function toIndex(target: ESLCarouselSlideTarget, cfg: ESLCarouselState): ESLCarouselNavInfo;
/**
* @returns whether the carousel can navigate to the target passed as {@link ESLCarouselSlideTarget}
* E.g.: carousel can't navigate to invalid target or to the next slide if it's the last slide and loop is disabled
*/
export declare function canNavigate(target: ESLCarouselSlideTarget, cfg: ESLCarouselState): boolean;