UNPKG

@egjs/flicking

Version:

Everyday 30 million people experience. It's reliable, flexible and extendable carousel.

56 lines (55 loc) • 3.69 kB
import { ALIGN, DIRECTION } from "./constants/values"; import Flicking, { FlickingOptions } from "./Flicking"; import { ElementLike } from "./types/external"; import { LiteralUnion, Merged, ValueOf } from "./types/internal"; export declare const merge: <From extends object, To extends object>(target: From, ...sources: To[]) => Merged<From, To>; export declare const getElement: (el: HTMLElement | string | null, parent?: HTMLElement | undefined) => HTMLElement; export declare const checkExistence: (value: any, nameOnErrMsg: string) => void; export declare const clamp: (x: number, min: number, max: number) => number; export declare const getFlickingAttached: (val: Flicking | null) => Flicking; export declare const toArray: <T>(iterable: ArrayLike<T>) => T[]; export declare const parseAlign: (align: LiteralUnion<ValueOf<typeof ALIGN>> | number, size: number) => number; export declare const parseBounce: (bounce: FlickingOptions["bounce"], size: number) => number[]; export declare const parseArithmeticSize: (cssValue: number | string, base: number) => number | null; export declare const parseArithmeticExpression: (cssValue: number | string) => { percentage: number; absolute: number; } | null; export declare const parseCSSSizeValue: (val: string | number) => string; export declare const parsePanelAlign: (align: FlickingOptions["align"]) => string | number; export declare const getDirection: (start: number, end: number) => ValueOf<typeof DIRECTION>; export declare const parseElement: (element: ElementLike | ElementLike[]) => HTMLElement[]; /** * Parse an HTML string into elements with sanitization, used by {@link Flicking.setStatus} to restore * panels from a serialized `html` string. The string is parsed inside a `<template>` (an inert * document, so no script runs and no resource loads), event-handler attributes and script-capable * elements are stripped, and the result is imported — neutralizing a mutation-XSS payload revived by * the `outerHTML`→`innerHTML` round-trip. */ export declare const parseSanitizedElement: (html: string) => HTMLElement[]; export declare const getMinusCompensatedIndex: (idx: number, max: number) => number; export declare const includes: <T>(array: T[], target: any) => target is T; export declare const isString: (val: any) => val is string; export declare const circulatePosition: (pos: number, min: number, max: number) => number; export declare const find: <T>(array: T[], checker: (val: T) => boolean) => T | null; export declare const findRight: <T>(array: T[], checker: (val: T) => boolean) => T | null; export declare const findIndex: <T>(array: T[], checker: (val: T) => boolean) => number; export declare const getProgress: (pos: number, prev: number, next: number) => number; export declare const getStyle: (el: HTMLElement) => CSSStyleDeclaration; export declare const setSize: (el: HTMLElement, { width, height }: Partial<{ width: number | string; height: number | string; }>) => void; export declare const isBetween: (val: number, min: number, max: number) => boolean; export declare const circulateIndex: (index: number, max: number) => number; export declare const range: (end: number) => number[]; export declare const getElementSize: ({ el, horizontal, useFractionalSize, useOffset, style }: { el: HTMLElement; horizontal: boolean; useFractionalSize: boolean; useOffset: boolean; style: CSSStyleDeclaration; }) => number; export declare const setPrototypeOf: (o: any, proto: object | null) => any; export declare const camelize: (str: string) => string; export declare const getDataAttributes: (element: HTMLElement, attributePrefix: string) => Record<string, string>;