Skip to content

Commit

Permalink
Update SwiperJS.
Browse files Browse the repository at this point in the history
  • Loading branch information
R5-3600 committed Apr 15, 2023
1 parent 3165051 commit 2afe67d
Show file tree
Hide file tree
Showing 79 changed files with 441 additions and 235 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions DatabaseFiles/assets/vendor/swiper/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ class Swiper {
progress: 0,
velocity: 0,
animating: false,
cssOverflowAdjustment() {
// Returns 0 unless `translate` is > 2**23
// Should be subtracted from css values to prevent overflow
return Math.trunc(this.translate / 2 ** 23) * 2 ** 23;
},
// Locks
allowSlideNext: swiper.params.allowSlideNext,
allowSlidePrev: swiper.params.allowSlidePrev,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function getSwiperTranslate(axis = this.isHorizontal() ? 'x' : 'y
return translate;
}
let currentTranslate = getTranslate(wrapperEl, axis);
currentTranslate += swiper.cssOverflowAdjustment();
if (rtl) currentTranslate = -currentTranslate;
return currentTranslate || 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ export default function setTranslate(translate, byController) {
x = Math.floor(x);
y = Math.floor(y);
}
swiper.previousTranslate = swiper.translate;
swiper.translate = swiper.isHorizontal() ? x : y;
if (params.cssMode) {
wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
} else if (!params.virtualTranslate) {
if (swiper.isHorizontal()) {
x -= swiper.cssOverflowAdjustment();
} else {
y -= swiper.cssOverflowAdjustment();
}
wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`;
}
swiper.previousTranslate = swiper.translate;
swiper.translate = swiper.isHorizontal() ? x : y;

// Check if we need to update progress
let newProgress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export default function updateSlidesOffset() {
// eslint-disable-next-line
const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0;
for (let i = 0; i < slides.length; i += 1) {
slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset;
slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment();
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Swiper Custom Element 9.2.0
* Swiper Custom Element 9.2.2
* Most modern mobile touch slider and framework with hardware accelerated transitions
* https://swiperjs.com
*
* Copyright 2014-2023 Vladimir Kharlampidi
*
* Released under the MIT License
*
* Released on: April 1, 2023
* Released on: April 15, 2023
*/

/* eslint-disable spaced-comment */
Expand Down
4 changes: 2 additions & 2 deletions DatabaseFiles/assets/vendor/swiper/element/swiper-element.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Swiper Custom Element 9.2.0
* Swiper Custom Element 9.2.2
* Most modern mobile touch slider and framework with hardware accelerated transitions
* https://swiperjs.com
*
* Copyright 2014-2023 Vladimir Kharlampidi
*
* Released under the MIT License
*
* Released on: April 1, 2023
* Released on: April 15, 2023
*/

/* eslint-disable spaced-comment */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ export default function Controller({
};
return this;
}
// xxx: for now i will just save one spline function to to
function getInterpolateFunction(c) {
if (!swiper.controller.spline) {
swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid);
}
swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid);
}
function setTranslate(_t, byController) {
const controlled = swiper.controller.control;
Expand All @@ -83,6 +80,9 @@ export default function Controller({
}
if (!controlledTranslate || swiper.params.controller.by === 'container') {
multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
if (Number.isNaN(multiplier) || !Number.isFinite(multiplier)) {
multiplier = 1;
}
controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();
}
if (swiper.params.controller.inverse) {
Expand Down Expand Up @@ -169,11 +169,11 @@ export default function Controller({
removeSpline();
});
on('setTranslate', (_s, translate, byController) => {
if (!swiper.controller.control) return;
if (!swiper.controller.control || swiper.controller.control.destroyed) return;
swiper.controller.setTranslate(translate, byController);
});
on('setTransition', (_s, duration, byController) => {
if (!swiper.controller.control) return;
if (!swiper.controller.control || swiper.controller.control.destroyed) return;
swiper.controller.setTransition(duration, byController);
});
Object.assign(swiper.controller, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,18 @@ export default function Pagination({
}
if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));
}
on('changeDirection', () => {
if (!swiper.pagination || !swiper.pagination.el) return;
const params = swiper.params.pagination;
let {
el
} = swiper.pagination;
el = makeElementsArray(el);
el.forEach(subEl => {
subEl.classList.remove(params.horizontalClass, params.verticalClass);
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
});
});
on('init', () => {
if (swiper.params.pagination.enabled === false) {
// eslint-disable-next-line
Expand Down
4 changes: 2 additions & 2 deletions DatabaseFiles/assets/vendor/swiper/modules/virtual/virtual.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default function Virtual({
if (previousFrom === from && previousTo === to && !force) {
if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) {
swiper.slides.forEach(slideEl => {
slideEl.style[offsetProp] = `${offset}px`;
slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`;
});
}
swiper.updateProgress();
Expand Down Expand Up @@ -199,7 +199,7 @@ export default function Virtual({
});
}
elementChildren(swiper.slidesEl, '.swiper-slide, swiper-slide').forEach(slideEl => {
slideEl.style[offsetProp] = `${offset}px`;
slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`;
});
onRendered();
}
Expand Down
4 changes: 2 additions & 2 deletions DatabaseFiles/assets/vendor/swiper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swiper",
"version": "9.2.0",
"version": "9.2.2",
"description": "Most modern mobile touch slider and framework with hardware accelerated transitions",
"typings": "swiper.d.ts",
"type": "module",
Expand Down Expand Up @@ -186,5 +186,5 @@
"dependencies": {
"ssr-window": "^4.0.2"
},
"releaseDate": "March 31, 2023"
"releaseDate": "April 14, 2023"
}
8 changes: 4 additions & 4 deletions DatabaseFiles/assets/vendor/swiper/react/swiper-react.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ interface SwiperProps extends SwiperOptions {
* Event will be fired on pagination show
*/
onPaginationShow?: (swiper: SwiperClass) => void;/**
* Event will be fired on zoom change
*/
onZoomChange?: (swiper: SwiperClass, scale: number, imageEl: HTMLElement, slideEl: HTMLElement) => void;/**
* Event will be fired on draggable scrollbar drag start
*/
onScrollbarDragStart?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
Expand All @@ -107,7 +104,10 @@ interface SwiperProps extends SwiperOptions {
/**
* Event will be fired on draggable scrollbar drag end
*/
onScrollbarDragEnd?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
onScrollbarDragEnd?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;/**
* Event will be fired on zoom change
*/
onZoomChange?: (swiper: SwiperClass, scale: number, imageEl: HTMLElement, slideEl: HTMLElement) => void;

/**
* Fired right after Swiper initialization.
Expand Down
4 changes: 2 additions & 2 deletions DatabaseFiles/assets/vendor/swiper/react/swiper-react.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Swiper React 9.2.0
* Swiper React 9.2.2
* Most modern mobile touch slider and framework with hardware accelerated transitions
* https://swiperjs.com
*
* Copyright 2014-2023 Vladimir Kharlampidi
*
* Released under the MIT License
*
* Released on: April 1, 2023
* Released on: April 15, 2023
*/

import { Swiper } from './swiper.js';
Expand Down
4 changes: 2 additions & 2 deletions DatabaseFiles/assets/vendor/swiper/swiper-bundle.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Swiper 9.2.0
* Swiper 9.2.2
* Most modern mobile touch slider and framework with hardware accelerated transitions
* https://swiperjs.com
*
* Copyright 2014-2023 Vladimir Kharlampidi
*
* Released under the MIT License
*
* Released on: April 1, 2023
* Released on: April 15, 2023
*/

/* FONT_START */
Expand Down
49 changes: 36 additions & 13 deletions DatabaseFiles/assets/vendor/swiper/swiper-bundle.esm.browser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions DatabaseFiles/assets/vendor/swiper/swiper-bundle.esm.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Swiper 9.2.0
* Swiper 9.2.2
* Most modern mobile touch slider and framework with hardware accelerated transitions
* https://swiperjs.com
*
* Copyright 2014-2023 Vladimir Kharlampidi
*
* Released under the MIT License
*
* Released on: April 1, 2023
* Released on: April 15, 2023
*/

import Swiper from './core/core.js';
Expand Down
Loading

0 comments on commit 2afe67d

Please sign in to comment.