From dade8fa6f710f802fd100c27ca7a480f1df8a52c Mon Sep 17 00:00:00 2001 From: Asif Rahman Date: Wed, 12 Dec 2018 14:59:56 -0500 Subject: [PATCH] Swiper 4.4 typings update - Added missing swiper options - Added missing methods --- types/swiper/index.d.ts | 64 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/types/swiper/index.d.ts b/types/swiper/index.d.ts index 9e77516978..74b8d928b9 100644 --- a/types/swiper/index.d.ts +++ b/types/swiper/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for Swiper 4.2 +// Type definitions for Swiper 4.4 // Project: https://github.com/nolimits4web/Swiper // Definitions by: Sebastián Galiano // Luca Trazzi // Eugene Matseruk // Luiz M. // Justin Abene +// Asif Rahman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -221,6 +222,7 @@ export interface SwiperOptions { slidesOffsetBefore?: number; slidesOffsetAfter?: number; normalizeSlideIndex?: boolean; + centerInsufficientSlides?: boolean; // Grab Cursor grabCursor?: boolean; @@ -238,6 +240,8 @@ export interface SwiperOptions { followFinger?: boolean; allowTouchMove?: boolean; threshold?: number; + touchStartPreventDefault?: boolean; + touchStartForcePreventDefault?: boolean; touchMoveStopPropagation?: boolean; iOSEdgeSwipeDetection?: boolean; iOSEdgeSwipeThreshold?: number; @@ -249,11 +253,12 @@ export interface SwiperOptions { resistanceRatio?: number; // Swiping / No swiping + preventInteractionOnTransition?: boolean; allowSlidePrev?: boolean; allowSlideNext?: boolean; noSwiping?: boolean; noSwipingClass?: string; - // noSwipingSelector?: string; + noSwipingSelector?: string; swipeHandler?: SelectableElement; // Clicks @@ -289,6 +294,7 @@ export interface SwiperOptions { breakpoints?: { [index: number]: SwiperOptions; }; + breakpointsInverse?: boolean; // Observer observer?: boolean; @@ -1073,6 +1079,44 @@ export default class Swiper { */ slideTo(index: number, speed?: number, runCallbacks?: boolean): void; + /** + * Does the same as .slideTo but for the case when used with enabled loop. So this + * method will slide to slides with realIndex matching to passed index + * + * @param index Index number of slide. + * @param speed Transition duration (in ms). + * @param runCallbacks Set it to false (by default it is true) and transition will + * not produce transition events. + */ + slideToLoop(index: number, speed?: number, runCallbacks?: boolean): void; + + /** + * Reset swiper position to currently active slide for the duration equal to 'speed' + * parameter. + * + * @param speed Transition duration (in ms). + * @param runCallbacks Set it to false (by default it is true) and transition will + * not produce transition events. + */ + slideReset(speed?: number, runCallbacks?: boolean): void; + + /** + * Reset swiper position to closest slide/snap point for the duration equal to 'speed' parameter. + * + * @param speed Transition duration (in ms). + * @param runCallbacks Set it to false (by default it is true) and transition will + * not produce transition events. + */ + slideToClosest(speed?: number, runCallbacks?: boolean): void; + + /** + * Force swiper to update its height (when autoHeight enabled) for the duration equal to + * 'speed' parameter + * + * @param speed Transition duration (in ms). + */ + updateAutoHeight(speed?: number): void; + /** * You should call it after you add/remove slides * manually, or after you hide/show it, or do any @@ -1162,6 +1206,17 @@ export default class Swiper { */ prependSlide(slides: HTMLElement | string | string[]): void; + /** + * Add new slides to the required index. slides could be HTMLElement or HTML string with new slide or array with such slides, for example: + * + * @example addSlide(1, '
Slide 10"
') + * @example addSlide(1, [ + * '
Slide 10"
', + * '
Slide 11"
' + * ]); + */ + addSlide(index: number, slides: HTMLElement | string | string[]): void; + /** * Remove selected slides. slideIndex could be a number with slide index to remove or array with indexes. * @@ -1171,6 +1226,11 @@ export default class Swiper { */ removeSlide(slideIndex: number | number[]): void; + /** + * Remove all slides + */ + removeAllSlides(): any; + /** * Set custom css3 transform's translate value for swiper wrapper */