@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
67 lines (66 loc) • 3.38 kB
TypeScript
import { ESLCarouselRenderer } from '../core/esl-carousel.renderer';
import type { ESLCarouselDirection, ESLCarouselActionParams } from '../core/esl-carousel.types';
/**
* Default carousel renderer based on CSS Flexbox stage, order (flex), and stage animated movement via CSS transform.
* Supports multiple slides per view, (infinite) loop mode, touch-move, vertical mode, slide siblings rendering.
*
* Provides default slide width, supports gap between slides. Does not rely on default slide width, potentially can be used with CSS custom slide width.
*/
export declare class ESLDefaultCarouselRenderer extends ESLCarouselRenderer {
static is: string;
static classes: string[];
/** CSS variable name for slide auto size */
static SIZE_PROP: string;
/** Tolerance to treat offset enough to move to the next slide. Relative (0-1) to slide width */
static readonly NEXT_SLIDE_TOLERANCE = 0.25;
/** Slides gap size */
protected gap: number;
/** First index of active slides. */
protected currentIndex: number;
/** Multiplier for the index move on the slide move */
protected get INDEX_MOVE_MULTIPLIER(): number;
/** @returns true if moving half of the slides before current is forbidden */
protected get lazyReorder(): boolean;
/** Actual slide size (uses average) */
protected get slideSize(): number;
/**
* Processes binding of defined renderer to the carousel {@link ESLCarousel}.
* Prepare to renderer animation.
*/
onBind(): void;
redraw(initial?: boolean): void;
/**
* Processes unbinding of defined renderer from the carousel {@link ESLCarousel}.
* Clear animation.
*/
onUnbind(): void;
/** @returns slide offset by the slide index */
protected getOffset(index: number): number;
/** Sets scene offset */
protected setTransformOffset(offset: number): void;
/** Animates scene offset to index */
protected animateTo(index: number, duration?: number): Promise<void>;
/** Pre-processing animation action. */
onBeforeAnimate(nextIndex: number, direction: ESLCarouselDirection, params: ESLCarouselActionParams): Promise<void>;
/** Processes animation. */
onAnimate(nextIndex: number, direction: ESLCarouselDirection, params: ESLCarouselActionParams): Promise<void>;
/** Post-processing animation action. */
onAfterAnimate(nextIndex: number, direction: ESLCarouselDirection, params: ESLCarouselActionParams): Promise<void>;
/** Makes pre-processing the transition animation of one slide. */
protected onStepAnimate(indexOffset: number, duration: number): Promise<void>;
/** Handles the slides transition. */
move(offset: number, from: number, params: ESLCarouselActionParams): void;
/** Ends current transition and make permanent all changes performed in the transition. */
commit(offset: number, from: number, params: ESLCarouselActionParams): Promise<void>;
/**
* @returns count of slides to be rendered (reserved) before the first slide
*/
protected getReserveCount(back?: boolean): number;
/**
* Sets order style property for slides starting at index
* @param back - if true, ensures that there is a slide rendered before the current one
*/
protected reorder(back?: boolean): void;
/** Sets min size for slides */
protected resize(): void;
}