/
Options.ts
54 lines (49 loc) · 1.33 KB
/
Options.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
import { AlignmentOptionType } from './Alignment'
import { AxisOptionType } from './Axis'
import { SlidesToScrollOptionType } from './SlidesToScroll'
import { DirectionOptionType } from './Direction'
import { ScrollContainOptionType } from './ScrollContain'
export type LooseOptionsType = {
[key: string]: unknown
}
export type CreateOptionsType<Type extends LooseOptionsType> = Type & {
active: boolean
breakpoints: {
[key: string]: Omit<Partial<CreateOptionsType<Type>>, 'breakpoints'>
}
}
export type OptionsType = CreateOptionsType<{
align: AlignmentOptionType
axis: AxisOptionType
container: string | HTMLElement | null
slides: string | HTMLElement[] | NodeListOf<HTMLElement> | null
containScroll: ScrollContainOptionType
direction: DirectionOptionType
slidesToScroll: SlidesToScrollOptionType
dragFree: boolean
draggable: boolean
inViewThreshold: number
loop: boolean
skipSnaps: boolean
speed: number
startIndex: number
}>
export const defaultOptions: OptionsType = {
align: 'center',
axis: 'x',
container: null,
slides: null,
containScroll: '',
direction: 'ltr',
slidesToScroll: 1,
breakpoints: {},
dragFree: false,
draggable: true,
inViewThreshold: 0,
loop: false,
skipSnaps: false,
speed: 10,
startIndex: 0,
active: true,
}
export type EmblaOptionsType = Partial<OptionsType>