forked from rcbyr/keen-slider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
87 lines (81 loc) · 2.05 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
export type THtmlElementGetter = () => NodeListOf<Element>
export type TContainer =
| HTMLElement
| NodeListOf<Element>
| string
| THtmlElementGetter
| undefined
export type TSlides =
| HTMLElement
| NodeListOf<Element>
| string
| THtmlElementGetter
| number
| undefined
export type TDetails = {
direction: 1 | 0 | -1
progressTrack: number
progressSlides: number
position: number
positions: {
distance: number
portion: number
}[]
speed: number
relativeSlide: number
absoluteSlide: number
size: number
slidesPerView: number
widthOrHeight: number
}
export type TSlidesPerViewGetter = () => number
export type TOptions = {
breakpoints?: {
[key: string]: Omit<TOptionsEvents, 'breakpoints'>
}
centered?: boolean
controls?: boolean
dragSpeed?: number
duration?: number
friction?: number
initial?: number
loop?: boolean
mode?: 'snap' | 'free' | 'free-snap'
preventEvent?: string
resetSlide?: boolean
rubberband?: boolean
slides?: TSlides
slidesPerView?: number | TSlidesPerViewGetter
spacing?: number
vertical?: boolean
inlineBlockMode?: boolean
deactivateWheelEvent?: boolean
}
export type TEvents = {
afterChange?: (instance: KeenSlider) => void
beforeChange?: (instance: KeenSlider) => void
created?: (instance: KeenSlider) => void
dragEnd?: (instance: KeenSlider) => void
dragStart?: (instance: KeenSlider) => void
destroyed?: (instance: KeenSlider) => void
mounted?: (instance: KeenSlider) => void
move?: (instance: KeenSlider) => void
slideChanged?: (instance: KeenSlider) => void
}
export type TOptionsEvents = TOptions & TEvents
export default class KeenSlider {
constructor(container: TContainer, options?: TOptionsEvents)
controls: (active: boolean) => void
next: () => void
prev: () => void
destroy: () => void
refresh: (options?: TOptionsEvents) => void
moveToSlideRelative: (
slide: number,
nearest?: boolean,
duration?: number
) => void
moveToSlide: (slide: number, duration?: number) => void
resize: () => void
details: () => TDetails
}