1 | // @ts-ignore
|
2 | import { SwiperOptions, Swiper } from './types/index.d.ts';
|
3 |
|
4 | declare const register: () => void;
|
5 |
|
6 | // prettier-ignore
|
7 | interface SwiperContainerEventMap extends Omit<HTMLElementEventMap, 'click' | 'progress' | 'keypress' | 'resize' | 'touchstart' | 'touchmove' | 'touchend' | 'transitionend' | 'transitionstart'> {
|
8 | /**
|
9 | * Event will be fired in when autoplay started
|
10 | */
|
11 | autoplaystart: CustomEvent<[swiper: Swiper]>;
|
12 | /**
|
13 | * Event will be fired when autoplay stopped
|
14 | */
|
15 | autoplaystop: CustomEvent<[swiper: Swiper]>;
|
16 | /**
|
17 | * Event will be fired on autoplay pause
|
18 | */
|
19 | autoplaypause: CustomEvent<[swiper: Swiper]>;
|
20 | /**
|
21 | * Event will be fired on autoplay resume
|
22 | */
|
23 | autoplayresume: CustomEvent<[swiper: Swiper]>;
|
24 | /**
|
25 | * Event triggers continuously while autoplay is enabled. It contains time left (in ms) before transition to next slide and percentage of that time related to autoplay delay
|
26 | */
|
27 | autoplaytimeleft: CustomEvent<[swiper: Swiper, timeLeft: number, percentage: number]>;
|
28 | /**
|
29 | * Event will be fired when slide changed with autoplay
|
30 | */
|
31 | autoplay: CustomEvent<[swiper: Swiper]>;/**
|
32 | * Event will be fired on window hash change
|
33 | */
|
34 | hashchange: CustomEvent<[swiper: Swiper]>;
|
35 | /**
|
36 | * Event will be fired when swiper updates the hash
|
37 | */
|
38 | hashset: CustomEvent<[swiper: Swiper]>;/**
|
39 | * Event will be fired on mousewheel scroll
|
40 | */
|
41 | scroll: CustomEvent<[swiper: Swiper, event: WheelEvent]>;/**
|
42 | * Event will be fired on navigation hide
|
43 | */
|
44 | navigationhide: CustomEvent<[swiper: Swiper]>;
|
45 | /**
|
46 | * Event will be fired on navigation show
|
47 | */
|
48 | navigationshow: CustomEvent<[swiper: Swiper]>;
|
49 | /**
|
50 | * Event will be fired on navigation prev button click
|
51 | */
|
52 | navigationprev: CustomEvent<[swiper: Swiper]>;
|
53 | /**
|
54 | * Event will be fired on navigation next button click
|
55 | */
|
56 | navigationnext: CustomEvent<[swiper: Swiper]>;/**
|
57 | * Event will be fired on key press
|
58 | */
|
59 | keypress: CustomEvent<[swiper: Swiper, keyCode: string]>;/**
|
60 | * Event will be fired after pagination rendered
|
61 | */
|
62 | paginationrender: CustomEvent<[swiper: Swiper, paginationEl: HTMLElement]>;
|
63 |
|
64 | /**
|
65 | * Event will be fired when pagination updated
|
66 | */
|
67 | paginationupdate: CustomEvent<[swiper: Swiper, paginationEl: HTMLElement]>;
|
68 |
|
69 | /**
|
70 | * Event will be fired on pagination hide
|
71 | */
|
72 | paginationhide: CustomEvent<[swiper: Swiper]>;
|
73 |
|
74 | /**
|
75 | * Event will be fired on pagination show
|
76 | */
|
77 | paginationshow: CustomEvent<[swiper: Swiper]>;/**
|
78 | * Event will be fired on draggable scrollbar drag start
|
79 | */
|
80 | scrollbardragstart: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
81 |
|
82 | /**
|
83 | * Event will be fired on draggable scrollbar drag move
|
84 | */
|
85 | scrollbardragmove: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
86 |
|
87 | /**
|
88 | * Event will be fired on draggable scrollbar drag end
|
89 | */
|
90 | scrollbardragend: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;/**
|
91 | * Event will be fired on zoom change
|
92 | */
|
93 | zoomchange: CustomEvent<[swiper: Swiper, scale: number, imageEl: HTMLElement, slideEl: HTMLElement]>;
|
94 |
|
95 |
|
96 | /**
|
97 | * Fired right after Swiper initialization.
|
98 | * @note Note that with `swiper.on('init')` syntax it will
|
99 | * work only in case you set `init: false` parameter.
|
100 | *
|
101 | * @example
|
102 | * ```js
|
103 | * const swiper = new Swiper('.swiper', {
|
104 | * init: CustomEvent<[false,
|
105 | * // other parameters
|
106 | * }]>;
|
107 | * swiper.on('init', function() {
|
108 | * // do something
|
109 | * });
|
110 | * // init Swiper
|
111 | * swiper.init();
|
112 | * ```
|
113 | *
|
114 | * @example
|
115 | * ```js
|
116 | * // Otherwise use it as the parameter:
|
117 | * const swiper = new Swiper('.swiper', {
|
118 | * // other parameters
|
119 | * on: CustomEvent<[{
|
120 | * init: function {
|
121 | * // do something
|
122 | * },
|
123 | * }
|
124 | * })]>;
|
125 | * ```
|
126 | */
|
127 | init: CustomEvent<[swiper: Swiper]>;
|
128 |
|
129 | /**
|
130 | * Event will be fired right before Swiper destroyed
|
131 | */
|
132 | beforedestroy: CustomEvent<[swiper: Swiper]>;
|
133 |
|
134 | /**
|
135 | * Event will be fired when currently active slide is changed
|
136 | */
|
137 | slidechange: CustomEvent<[swiper: Swiper]>;
|
138 |
|
139 | /**
|
140 | * Event will be fired in the beginning of animation to other slide (next or previous).
|
141 | */
|
142 | slidechangetransitionstart: CustomEvent<[swiper: Swiper]>;
|
143 |
|
144 | /**
|
145 | * Event will be fired after animation to other slide (next or previous).
|
146 | */
|
147 | slidechangetransitionend: CustomEvent<[swiper: Swiper]>;
|
148 |
|
149 | /**
|
150 | * Same as "slideChangeTransitionStart" but for "forward" direction only
|
151 | */
|
152 | slidenexttransitionstart: CustomEvent<[swiper: Swiper]>;
|
153 |
|
154 | /**
|
155 | * Same as "slideChangeTransitionEnd" but for "forward" direction only
|
156 | */
|
157 | slidenexttransitionend: CustomEvent<[swiper: Swiper]>;
|
158 |
|
159 | /**
|
160 | * Same as "slideChangeTransitionStart" but for "backward" direction only
|
161 | */
|
162 | slideprevtransitionstart: CustomEvent<[swiper: Swiper]>;
|
163 |
|
164 | /**
|
165 | * Same as "slideChangeTransitionEnd" but for "backward" direction only
|
166 | */
|
167 | slideprevtransitionend: CustomEvent<[swiper: Swiper]>;
|
168 |
|
169 | /**
|
170 | * Event will be fired in the beginning of transition.
|
171 | */
|
172 | transitionstart: CustomEvent<[swiper: Swiper]>;
|
173 |
|
174 | /**
|
175 | * Event will be fired after transition.
|
176 | */
|
177 | transitionend: CustomEvent<[swiper: Swiper]>;
|
178 |
|
179 | /**
|
180 | * Event will be fired when user touch Swiper. Receives `touchstart` event as an arguments.
|
181 | */
|
182 | touchstart: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
183 |
|
184 | /**
|
185 | * Event will be fired when user touch and move finger over Swiper. Receives `touchmove` event as an arguments.
|
186 | */
|
187 | touchmove: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
188 |
|
189 | /**
|
190 | * Event will be fired when user touch and move finger over Swiper in direction opposite to direction parameter. Receives `touchmove` event as an arguments.
|
191 | */
|
192 | touchmoveopposite: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
193 |
|
194 | /**
|
195 | * Event will be fired when user touch and move finger over Swiper and move it. Receives `touchmove` event as an arguments.
|
196 | */
|
197 | slidermove: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
198 |
|
199 | /**
|
200 | * Event will be fired when user release Swiper. Receives `touchend` event as an arguments.
|
201 | */
|
202 | touchend: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
203 |
|
204 | /**
|
205 | * Event will be fired when user click/tap on Swiper. Receives `touchend` event as an arguments.
|
206 | */
|
207 | click: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
208 |
|
209 | /**
|
210 | * Event will be fired when user click/tap on Swiper. Receives `touchend` event as an arguments.
|
211 | */
|
212 | tap: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
213 |
|
214 | /**
|
215 | * Event will be fired when user double tap on Swiper's container. Receives `touchend` event as an arguments
|
216 | */
|
217 | doubletap: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
218 |
|
219 | /**
|
220 | * Event will be fired when Swiper progress is changed, as an arguments it receives progress that is always from 0 to 1
|
221 | */
|
222 | progress: CustomEvent<[swiper: Swiper, progress: number]>;
|
223 |
|
224 | /**
|
225 | * Event will be fired when Swiper reach its beginning (initial position)
|
226 | */
|
227 | reachbeginning: CustomEvent<[swiper: Swiper]>;
|
228 |
|
229 | /**
|
230 | * Event will be fired when Swiper reach last slide
|
231 | */
|
232 | reachend: CustomEvent<[swiper: Swiper]>;
|
233 |
|
234 | /**
|
235 | * Event will be fired when Swiper goes to beginning or end position
|
236 | */
|
237 | toedge: CustomEvent<[swiper: Swiper]>;
|
238 |
|
239 | /**
|
240 | * Event will be fired when Swiper goes from beginning or end position
|
241 | */
|
242 | fromedge: CustomEvent<[swiper: Swiper]>;
|
243 |
|
244 | /**
|
245 | * Event will be fired when swiper's wrapper change its position. Receives current translate value as an arguments
|
246 | */
|
247 | settranslate: CustomEvent<[swiper: Swiper, translate: number]>;
|
248 |
|
249 | /**
|
250 | * Event will be fired everytime when swiper starts animation. Receives current transition duration (in ms) as an arguments
|
251 | */
|
252 | settransition: CustomEvent<[swiper: Swiper, transition: number]>;
|
253 |
|
254 | /**
|
255 | * Event will be fired on window resize right before swiper's onresize manipulation
|
256 | */
|
257 | resize: CustomEvent<[swiper: Swiper]>;
|
258 |
|
259 | /**
|
260 | * Event will be fired if observer is enabled and it detects DOM mutations
|
261 | */
|
262 | observerupdate: CustomEvent<[swiper: Swiper]>;
|
263 |
|
264 | /**
|
265 | * Event will be fired right before "loop fix"
|
266 | */
|
267 | beforeloopfix: CustomEvent<[swiper: Swiper]>;
|
268 |
|
269 | /**
|
270 | * Event will be fired after "loop fix"
|
271 | */
|
272 | loopfix: CustomEvent<[swiper: Swiper]>;
|
273 |
|
274 | /**
|
275 | * Event will be fired on breakpoint change
|
276 | */
|
277 | breakpoint: CustomEvent<[swiper: Swiper, breakpointParams: SwiperOptions]>;
|
278 |
|
279 | /**
|
280 | * !INTERNAL: Event will fired right before breakpoint change
|
281 | */
|
282 |
|
283 |
|
284 | /**
|
285 | * !INTERNAL: Event will fired after setting CSS classes on swiper container element
|
286 | */
|
287 |
|
288 |
|
289 | /**
|
290 | * !INTERNAL: Event will fired after setting CSS classes on swiper slide element
|
291 | */
|
292 |
|
293 |
|
294 | /**
|
295 | * !INTERNAL: Event will fired after setting CSS classes on all swiper slides
|
296 | */
|
297 |
|
298 |
|
299 | /**
|
300 | * !INTERNAL: Event will fired as soon as swiper instance available (before init)
|
301 | */
|
302 |
|
303 |
|
304 | /**
|
305 | * !INTERNAL: Event will be fired on free mode touch end (release) and there will no be momentum
|
306 | */
|
307 |
|
308 |
|
309 | /**
|
310 | * Event will fired on active index change
|
311 | */
|
312 | activeindexchange: CustomEvent<[swiper: Swiper]>;
|
313 | /**
|
314 | * Event will fired on snap index change
|
315 | */
|
316 | snapindexchange: CustomEvent<[swiper: Swiper]>;
|
317 | /**
|
318 | * Event will fired on real index change
|
319 | */
|
320 | realindexchange: CustomEvent<[swiper: Swiper]>;
|
321 | /**
|
322 | * Event will fired right after initialization
|
323 | */
|
324 | afterinit: CustomEvent<[swiper: Swiper]>;
|
325 | /**
|
326 | * Event will fired right before initialization
|
327 | */
|
328 | beforeinit: CustomEvent<[swiper: Swiper]>;
|
329 | /**
|
330 | * Event will fired before resize handler
|
331 | */
|
332 | beforeresize: CustomEvent<[swiper: Swiper]>;
|
333 | /**
|
334 | * Event will fired before slide change transition start
|
335 | */
|
336 | beforeslidechangestart: CustomEvent<[swiper: Swiper]>;
|
337 | /**
|
338 | * Event will fired before transition start
|
339 | */
|
340 | beforetransitionstart: CustomEvent<[swiper: Swiper, speed: number, internal: any]>; // what is internal?
|
341 | /**
|
342 | * Event will fired on direction change
|
343 | */
|
344 | changedirection: CustomEvent<[swiper: Swiper]>;
|
345 | /**
|
346 | * Event will be fired when user double click/tap on Swiper
|
347 | */
|
348 | doubleclick: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
349 | /**
|
350 | * Event will be fired on swiper destroy
|
351 | */
|
352 | destroy: CustomEvent<[swiper: Swiper]>;
|
353 | /**
|
354 | * Event will be fired on momentum bounce
|
355 | */
|
356 | momentumbounce: CustomEvent<[swiper: Swiper]>;
|
357 | /**
|
358 | * Event will be fired on orientation change (e.g. landscape -> portrait)
|
359 | */
|
360 | orientationchange: CustomEvent<[swiper: Swiper]>;
|
361 | /**
|
362 | * Event will be fired in the beginning of animation of resetting slide to current one
|
363 | */
|
364 | slideresettransitionstart: CustomEvent<[swiper: Swiper]>;
|
365 | /**
|
366 | * Event will be fired in the end of animation of resetting slide to current one
|
367 | */
|
368 | slideresettransitionend: CustomEvent<[swiper: Swiper]>;
|
369 | /**
|
370 | * Event will be fired with first touch/drag move
|
371 | */
|
372 | sliderfirstmove: CustomEvent<[swiper: Swiper, event: TouchEvent]>;
|
373 | /**
|
374 | * Event will be fired when number of slides has changed
|
375 | */
|
376 | slideslengthchange: CustomEvent<[swiper: Swiper]>;
|
377 | /**
|
378 | * Event will be fired when slides grid has changed
|
379 | */
|
380 | slidesgridlengthchange: CustomEvent<[swiper: Swiper]>;
|
381 | /**
|
382 | * Event will be fired when snap grid has changed
|
383 | */
|
384 | snapgridlengthchange: CustomEvent<[swiper: Swiper]>;
|
385 | /**
|
386 | * Event will be fired after swiper.update() call
|
387 | */
|
388 | update: CustomEvent<[swiper: Swiper]>;
|
389 | /**
|
390 | * Event will be fired when swiper is locked (when `watchOverflow` enabled)
|
391 | */
|
392 | lock: CustomEvent<[swiper: Swiper]>;
|
393 | /**
|
394 | * Event will be fired when swiper is unlocked (when `watchOverflow` enabled)
|
395 | */
|
396 | unlock: CustomEvent<[swiper: Swiper]>;
|
397 |
|
398 | }
|
399 |
|
400 | interface SwiperContainer extends HTMLElement {}
|
401 | interface SwiperContainer extends SwiperOptions {
|
402 | swiper: Swiper;
|
403 | initialize: () => void;
|
404 | injectStyles: string[];
|
405 | injectStylesUrls: string[];
|
406 | eventsPrefix: string;
|
407 | addEventListener<K extends keyof SwiperContainerEventMap>(
|
408 | type: K,
|
409 | listener: (this: SwiperContainer, ev: SwiperContainerEventMap[K]) => any,
|
410 | options?: boolean | AddEventListenerOptions,
|
411 | ): void;
|
412 | addEventListener(
|
413 | type: string,
|
414 | listener: EventListenerOrEventListenerObject,
|
415 | options?: boolean | AddEventListenerOptions,
|
416 | ): void;
|
417 | removeEventListener<K extends keyof SwiperContainerEventMap>(
|
418 | type: K,
|
419 | listener: (this: SwiperContainer, ev: SwiperContainerEventMap[K]) => any,
|
420 | options?: boolean | EventListenerOptions,
|
421 | ): void;
|
422 | removeEventListener(
|
423 | type: string,
|
424 | listener: EventListenerOrEventListenerObject,
|
425 | options?: boolean | EventListenerOptions,
|
426 | ): void;
|
427 | }
|
428 |
|
429 | interface SwiperSlide extends HTMLElement {
|
430 | lazy: string | boolean;
|
431 | }
|
432 |
|
433 | export { register, SwiperContainer, SwiperSlide };
|