1 | // @ts-ignore
|
2 | import { Swiper, SwiperOptions } 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 key press
|
40 | */
|
41 | keypress: CustomEvent<[swiper: Swiper, keyCode: string]>;/**
|
42 | * Event will be fired on mousewheel scroll
|
43 | */
|
44 | scroll: CustomEvent<[swiper: Swiper, event: WheelEvent]>;/**
|
45 | * Event will be fired on draggable scrollbar drag start
|
46 | */
|
47 | scrollbardragstart: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
48 |
|
49 | /**
|
50 | * Event will be fired on draggable scrollbar drag move
|
51 | */
|
52 | scrollbardragmove: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
53 |
|
54 | /**
|
55 | * Event will be fired on draggable scrollbar drag end
|
56 | */
|
57 | scrollbardragend: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;/**
|
58 | * Event will be fired on navigation hide
|
59 | */
|
60 | navigationhide: CustomEvent<[swiper: Swiper]>;
|
61 | /**
|
62 | * Event will be fired on navigation show
|
63 | */
|
64 | navigationshow: CustomEvent<[swiper: Swiper]>;
|
65 | /**
|
66 | * Event will be fired on navigation prev button click
|
67 | */
|
68 | navigationprev: CustomEvent<[swiper: Swiper]>;
|
69 | /**
|
70 | * Event will be fired on navigation next button click
|
71 | */
|
72 | navigationnext: CustomEvent<[swiper: Swiper]>;/**
|
73 | * Event will be fired after pagination rendered
|
74 | */
|
75 | paginationrender: CustomEvent<[swiper: Swiper, paginationEl: HTMLElement]>;
|
76 |
|
77 | /**
|
78 | * Event will be fired when pagination updated
|
79 | */
|
80 | paginationupdate: CustomEvent<[swiper: Swiper, paginationEl: HTMLElement]>;
|
81 |
|
82 | /**
|
83 | * Event will be fired on pagination hide
|
84 | */
|
85 | paginationhide: CustomEvent<[swiper: Swiper]>;
|
86 |
|
87 | /**
|
88 | * Event will be fired on pagination show
|
89 | */
|
90 | paginationshow: CustomEvent<[swiper: Swiper]>;/**
|
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 after slides and their sizes are calculated and updated
|
136 | */
|
137 | slidesupdated: CustomEvent<[swiper: Swiper]>;
|
138 | /**
|
139 | * Event will be fired when currently active slide is changed
|
140 | */
|
141 | slidechange: CustomEvent<[swiper: Swiper]>;
|
142 |
|
143 | /**
|
144 | * Event will be fired in the beginning of animation to other slide (next or previous).
|
145 | */
|
146 | slidechangetransitionstart: CustomEvent<[swiper: Swiper]>;
|
147 |
|
148 | /**
|
149 | * Event will be fired after animation to other slide (next or previous).
|
150 | */
|
151 | slidechangetransitionend: CustomEvent<[swiper: Swiper]>;
|
152 |
|
153 | /**
|
154 | * Same as "slideChangeTransitionStart" but for "forward" direction only
|
155 | */
|
156 | slidenexttransitionstart: CustomEvent<[swiper: Swiper]>;
|
157 |
|
158 | /**
|
159 | * Same as "slideChangeTransitionEnd" but for "forward" direction only
|
160 | */
|
161 | slidenexttransitionend: CustomEvent<[swiper: Swiper]>;
|
162 |
|
163 | /**
|
164 | * Same as "slideChangeTransitionStart" but for "backward" direction only
|
165 | */
|
166 | slideprevtransitionstart: CustomEvent<[swiper: Swiper]>;
|
167 |
|
168 | /**
|
169 | * Same as "slideChangeTransitionEnd" but for "backward" direction only
|
170 | */
|
171 | slideprevtransitionend: CustomEvent<[swiper: Swiper]>;
|
172 |
|
173 | /**
|
174 | * Event will be fired in the beginning of transition.
|
175 | */
|
176 | transitionstart: CustomEvent<[swiper: Swiper]>;
|
177 |
|
178 | /**
|
179 | * Event will be fired after transition.
|
180 | */
|
181 | transitionend: CustomEvent<[swiper: Swiper]>;
|
182 |
|
183 | /**
|
184 | * Event will be fired when user touch Swiper. Receives `pointerdown` event as an arguments.
|
185 | */
|
186 | touchstart: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
187 |
|
188 | /**
|
189 | * Event will be fired when user touch and move finger over Swiper. Receives `pointermove` event as an arguments.
|
190 | */
|
191 | touchmove: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
192 |
|
193 | /**
|
194 | * Event will be fired when user touch and move finger over Swiper in direction opposite to direction parameter. Receives `pointermove` event as an arguments.
|
195 | */
|
196 | touchmoveopposite: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
197 |
|
198 | /**
|
199 | * Event will be fired when user touch and move finger over Swiper and move it. Receives `pointermove` event as an arguments.
|
200 | */
|
201 | slidermove: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
202 |
|
203 | /**
|
204 | * Event will be fired when user release Swiper. Receives `pointerup` event as an arguments.
|
205 | */
|
206 | touchend: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
207 |
|
208 | /**
|
209 | * Event will be fired when user click/tap on Swiper. Receives `pointerup` event as an arguments.
|
210 | */
|
211 | click: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
212 |
|
213 | /**
|
214 | * Event will be fired when user click/tap on Swiper. Receives `pointerup` event as an arguments.
|
215 | */
|
216 | tap: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
217 |
|
218 | /**
|
219 | * Event will be fired when user double tap on Swiper's container. Receives `pointerup` event as an arguments
|
220 | */
|
221 | doubletap: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
222 |
|
223 | /**
|
224 | * Event will be fired when Swiper progress is changed, as an arguments it receives progress that is always from 0 to 1
|
225 | */
|
226 | progress: CustomEvent<[swiper: Swiper, progress: number]>;
|
227 |
|
228 | /**
|
229 | * Event will be fired when Swiper reach its beginning (initial position)
|
230 | */
|
231 | reachbeginning: CustomEvent<[swiper: Swiper]>;
|
232 |
|
233 | /**
|
234 | * Event will be fired when Swiper reach last slide
|
235 | */
|
236 | reachend: CustomEvent<[swiper: Swiper]>;
|
237 |
|
238 | /**
|
239 | * Event will be fired when Swiper goes to beginning or end position
|
240 | */
|
241 | toedge: CustomEvent<[swiper: Swiper]>;
|
242 |
|
243 | /**
|
244 | * Event will be fired when Swiper goes from beginning or end position
|
245 | */
|
246 | fromedge: CustomEvent<[swiper: Swiper]>;
|
247 |
|
248 | /**
|
249 | * Event will be fired when swiper's wrapper change its position. Receives current translate value as an arguments
|
250 | */
|
251 | settranslate: CustomEvent<[swiper: Swiper, translate: number]>;
|
252 |
|
253 | /**
|
254 | * Event will be fired everytime when swiper starts animation. Receives current transition duration (in ms) as an arguments
|
255 | */
|
256 | settransition: CustomEvent<[swiper: Swiper, transition: number]>;
|
257 |
|
258 | /**
|
259 | * Event will be fired on window resize right before swiper's onresize manipulation
|
260 | */
|
261 | resize: CustomEvent<[swiper: Swiper]>;
|
262 |
|
263 | /**
|
264 | * Event will be fired if observer is enabled and it detects DOM mutations
|
265 | */
|
266 | observerupdate: CustomEvent<[swiper: Swiper]>;
|
267 |
|
268 | /**
|
269 | * Event will be fired right before "loop fix"
|
270 | */
|
271 | beforeloopfix: CustomEvent<[swiper: Swiper]>;
|
272 |
|
273 | /**
|
274 | * Event will be fired after "loop fix"
|
275 | */
|
276 | loopfix: CustomEvent<[swiper: Swiper]>;
|
277 |
|
278 | /**
|
279 | * Event will be fired on breakpoint change
|
280 | */
|
281 | breakpoint: CustomEvent<[swiper: Swiper, breakpointParams: SwiperOptions]>;
|
282 |
|
283 | /**
|
284 | * !INTERNAL: Event will fired right before breakpoint change
|
285 | */
|
286 |
|
287 |
|
288 | /**
|
289 | * !INTERNAL: Event will fired after setting CSS classes on swiper container element
|
290 | */
|
291 |
|
292 |
|
293 | /**
|
294 | * !INTERNAL: Event will fired after setting CSS classes on swiper slide element
|
295 | */
|
296 |
|
297 |
|
298 | /**
|
299 | * !INTERNAL: Event will fired after setting CSS classes on all swiper slides
|
300 | */
|
301 |
|
302 |
|
303 | /**
|
304 | * !INTERNAL: Event will fired as soon as swiper instance available (before init)
|
305 | */
|
306 |
|
307 |
|
308 | /**
|
309 | * !INTERNAL: Event will be fired on free mode touch end (release) and there will no be momentum
|
310 | */
|
311 |
|
312 |
|
313 | /**
|
314 | * Event will fired on active index change
|
315 | */
|
316 | activeindexchange: CustomEvent<[swiper: Swiper]>;
|
317 | /**
|
318 | * Event will fired on snap index change
|
319 | */
|
320 | snapindexchange: CustomEvent<[swiper: Swiper]>;
|
321 | /**
|
322 | * Event will fired on real index change
|
323 | */
|
324 | realindexchange: CustomEvent<[swiper: Swiper]>;
|
325 | /**
|
326 | * Event will fired right after initialization
|
327 | */
|
328 | afterinit: CustomEvent<[swiper: Swiper]>;
|
329 | /**
|
330 | * Event will fired right before initialization
|
331 | */
|
332 | beforeinit: CustomEvent<[swiper: Swiper]>;
|
333 | /**
|
334 | * Event will fired before resize handler
|
335 | */
|
336 | beforeresize: CustomEvent<[swiper: Swiper]>;
|
337 | /**
|
338 | * Event will fired before slide change transition start
|
339 | */
|
340 | beforeslidechangestart: CustomEvent<[swiper: Swiper]>;
|
341 | /**
|
342 | * Event will fired before transition start
|
343 | */
|
344 | beforetransitionstart: CustomEvent<[swiper: Swiper, speed: number, internal: any]>; // what is internal?
|
345 | /**
|
346 | * Event will fired on direction change
|
347 | */
|
348 | changedirection: CustomEvent<[swiper: Swiper]>;
|
349 | /**
|
350 | * Event will be fired when user double click/tap on Swiper
|
351 | */
|
352 | doubleclick: CustomEvent<[swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent]>;
|
353 | /**
|
354 | * Event will be fired on swiper destroy
|
355 | */
|
356 | destroy: CustomEvent<[swiper: Swiper]>;
|
357 | /**
|
358 | * Event will be fired on momentum bounce
|
359 | */
|
360 | momentumbounce: CustomEvent<[swiper: Swiper]>;
|
361 | /**
|
362 | * Event will be fired on orientation change (e.g. landscape -> portrait)
|
363 | */
|
364 | orientationchange: CustomEvent<[swiper: Swiper]>;
|
365 | /**
|
366 | * Event will be fired in the beginning of animation of resetting slide to current one
|
367 | */
|
368 | slideresettransitionstart: CustomEvent<[swiper: Swiper]>;
|
369 | /**
|
370 | * Event will be fired in the end of animation of resetting slide to current one
|
371 | */
|
372 | slideresettransitionend: CustomEvent<[swiper: Swiper]>;
|
373 | /**
|
374 | * Event will be fired with first touch/drag move
|
375 | */
|
376 | sliderfirstmove: CustomEvent<[swiper: Swiper, event: TouchEvent]>;
|
377 | /**
|
378 | * Event will be fired when number of slides has changed
|
379 | */
|
380 | slideslengthchange: CustomEvent<[swiper: Swiper]>;
|
381 | /**
|
382 | * Event will be fired when slides grid has changed
|
383 | */
|
384 | slidesgridlengthchange: CustomEvent<[swiper: Swiper]>;
|
385 | /**
|
386 | * Event will be fired when snap grid has changed
|
387 | */
|
388 | snapgridlengthchange: CustomEvent<[swiper: Swiper]>;
|
389 | /**
|
390 | * Event will be fired after swiper.update() call
|
391 | */
|
392 | update: CustomEvent<[swiper: Swiper]>;
|
393 | /**
|
394 | * Event will be fired when swiper is locked (when `watchOverflow` enabled)
|
395 | */
|
396 | lock: CustomEvent<[swiper: Swiper]>;
|
397 | /**
|
398 | * Event will be fired when swiper is unlocked (when `watchOverflow` enabled)
|
399 | */
|
400 | unlock: CustomEvent<[swiper: Swiper]>;
|
401 |
|
402 | }
|
403 |
|
404 | interface SwiperContainer extends HTMLElement {}
|
405 | interface SwiperContainer extends SwiperOptions {
|
406 | swiper: Swiper;
|
407 | initialize: () => void;
|
408 | injectStyles: string[];
|
409 | injectStylesUrls: string[];
|
410 | eventsPrefix: string;
|
411 | addEventListener<K extends keyof SwiperContainerEventMap>(
|
412 | type: K,
|
413 | listener: (this: SwiperContainer, ev: SwiperContainerEventMap[K]) => any,
|
414 | options?: boolean | AddEventListenerOptions,
|
415 | ): void;
|
416 | addEventListener(
|
417 | type: string,
|
418 | listener: EventListenerOrEventListenerObject,
|
419 | options?: boolean | AddEventListenerOptions,
|
420 | ): void;
|
421 | removeEventListener<K extends keyof SwiperContainerEventMap>(
|
422 | type: K,
|
423 | listener: (this: SwiperContainer, ev: SwiperContainerEventMap[K]) => any,
|
424 | options?: boolean | EventListenerOptions,
|
425 | ): void;
|
426 | removeEventListener(
|
427 | type: string,
|
428 | listener: EventListenerOrEventListenerObject,
|
429 | options?: boolean | EventListenerOptions,
|
430 | ): void;
|
431 | }
|
432 |
|
433 | interface SwiperSlide extends HTMLElement {
|
434 | lazy: string | boolean;
|
435 | }
|
436 |
|
437 | declare global {
|
438 | interface HTMLElementTagNameMap {
|
439 | 'swiper-container': SwiperContainer;
|
440 | 'swiper-slide': SwiperSlide;
|
441 | }
|
442 | }
|
443 |
|
444 | export { SwiperContainer, SwiperSlide, register };
|