fix output

This commit is contained in:
2026-01-27 16:47:33 +03:30
parent c122b00647
commit a99c6aa051
4582 changed files with 389930 additions and 2514 deletions
+9
View File
@@ -0,0 +1,9 @@
function classesToSelector(classes) {
if (classes === void 0) {
classes = '';
}
return `.${classes.trim().replace(/([\.:!+\/()[\]])/g, '\\$1') // eslint-disable-line
.replace(/ /g, '.')}`;
}
export { classesToSelector as c };
@@ -0,0 +1,21 @@
import { e as elementChildren, c as createElement } from './utils.mjs';
function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
if (swiper.params.createElements) {
Object.keys(checkProps).forEach(key => {
if (!params[key] && params.auto === true) {
let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];
if (!element) {
element = createElement('div', checkProps[key]);
element.className = checkProps[key];
swiper.el.append(element);
}
params[key] = element;
originalParams[key] = element;
}
});
}
return params;
}
export { createElementIfNotDefined as c };
+14
View File
@@ -0,0 +1,14 @@
import { g as getSlideTransformEl, c as createElement } from './utils.mjs';
function createShadow(suffix, slideEl, side) {
const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}${suffix ? ` swiper-slide-shadow-${suffix}` : ''}`;
const shadowContainer = getSlideTransformEl(slideEl);
let shadowEl = shadowContainer.querySelector(`.${shadowClass.split(' ').join('.')}`);
if (!shadowEl) {
shadowEl = createElement('div', shadowClass.split(' '));
shadowContainer.append(shadowEl);
}
return shadowEl;
}
export { createShadow as c };
+58
View File
@@ -0,0 +1,58 @@
function effectInit(params) {
const {
effect,
swiper,
on,
setTranslate,
setTransition,
overwriteParams,
perspective,
recreateShadows,
getEffectParams
} = params;
on('beforeInit', () => {
if (swiper.params.effect !== effect) return;
swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`);
if (perspective && perspective()) {
swiper.classNames.push(`${swiper.params.containerModifierClass}3d`);
}
const overwriteParamsResult = overwriteParams ? overwriteParams() : {};
Object.assign(swiper.params, overwriteParamsResult);
Object.assign(swiper.originalParams, overwriteParamsResult);
});
on('setTranslate _virtualUpdated', () => {
if (swiper.params.effect !== effect) return;
setTranslate();
});
on('setTransition', (_s, duration) => {
if (swiper.params.effect !== effect) return;
setTransition(duration);
});
on('transitionEnd', () => {
if (swiper.params.effect !== effect) return;
if (recreateShadows) {
if (!getEffectParams || !getEffectParams().slideShadows) return;
// remove shadows
swiper.slides.forEach(slideEl => {
slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => shadowEl.remove());
});
// create new one
recreateShadows();
}
});
let requireUpdateOnVirtual;
on('virtualUpdate', () => {
if (swiper.params.effect !== effect) return;
if (!swiper.slides.length) {
requireUpdateOnVirtual = true;
}
requestAnimationFrame(() => {
if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) {
setTranslate();
requireUpdateOnVirtual = false;
}
});
});
}
export { effectInit as e };
+12
View File
@@ -0,0 +1,12 @@
import { g as getSlideTransformEl } from './utils.mjs';
function effectTarget(effectParams, slideEl) {
const transformEl = getSlideTransformEl(slideEl);
if (transformEl !== slideEl) {
transformEl.style.backfaceVisibility = 'hidden';
transformEl.style['-webkit-backface-visibility'] = 'hidden';
}
return transformEl;
}
export { effectTarget as e };
@@ -0,0 +1,48 @@
import { l as elementTransitionEnd } from './utils.mjs';
function effectVirtualTransitionEnd(_ref) {
let {
swiper,
duration,
transformElements,
allSlides
} = _ref;
const {
activeIndex
} = swiper;
const getSlide = el => {
if (!el.parentElement) {
// assume shadow root
const slide = swiper.slides.find(slideEl => slideEl.shadowRoot && slideEl.shadowRoot === el.parentNode);
return slide;
}
return el.parentElement;
};
if (swiper.params.virtualTranslate && duration !== 0) {
let eventTriggered = false;
let transitionEndTarget;
if (allSlides) {
transitionEndTarget = transformElements;
} else {
transitionEndTarget = transformElements.filter(transformEl => {
const el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl;
return swiper.getSlideIndex(el) === activeIndex;
});
}
transitionEndTarget.forEach(el => {
elementTransitionEnd(el, () => {
if (eventTriggered) return;
if (!swiper || swiper.destroyed) return;
eventTriggered = true;
swiper.animating = false;
const evt = new window.CustomEvent('transitionend', {
bubbles: true,
cancelable: true
});
swiper.wrapperEl.dispatchEvent(evt);
});
});
}
}
export { effectVirtualTransitionEnd as e };
+146
View File
@@ -0,0 +1,146 @@
/**
* SSR Window 5.0.1
* Better handling for window object in SSR environment
* https://github.com/nolimits4web/ssr-window
*
* Copyright 2025, Vladimir Kharlampidi
*
* Licensed under MIT
*
* Released on: June 27, 2025
*/
/* eslint-disable no-param-reassign */
function isObject(obj) {
return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object;
}
function extend(target, src) {
if (target === void 0) {
target = {};
}
if (src === void 0) {
src = {};
}
const noExtend = ['__proto__', 'constructor', 'prototype'];
Object.keys(src).filter(key => noExtend.indexOf(key) < 0).forEach(key => {
if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {
extend(target[key], src[key]);
}
});
}
const ssrDocument = {
body: {},
addEventListener() {},
removeEventListener() {},
activeElement: {
blur() {},
nodeName: ''
},
querySelector() {
return null;
},
querySelectorAll() {
return [];
},
getElementById() {
return null;
},
createEvent() {
return {
initEvent() {}
};
},
createElement() {
return {
children: [],
childNodes: [],
style: {},
setAttribute() {},
getElementsByTagName() {
return [];
}
};
},
createElementNS() {
return {};
},
importNode() {
return null;
},
location: {
hash: '',
host: '',
hostname: '',
href: '',
origin: '',
pathname: '',
protocol: '',
search: ''
}
};
function getDocument() {
const doc = typeof document !== 'undefined' ? document : {};
extend(doc, ssrDocument);
return doc;
}
const ssrWindow = {
document: ssrDocument,
navigator: {
userAgent: ''
},
location: {
hash: '',
host: '',
hostname: '',
href: '',
origin: '',
pathname: '',
protocol: '',
search: ''
},
history: {
replaceState() {},
pushState() {},
go() {},
back() {}
},
CustomEvent: function CustomEvent() {
return this;
},
addEventListener() {},
removeEventListener() {},
getComputedStyle() {
return {
getPropertyValue() {
return '';
}
};
},
Image() {},
Date() {},
screen: {},
setTimeout() {},
clearTimeout() {},
matchMedia() {
return {};
},
requestAnimationFrame(callback) {
if (typeof setTimeout === 'undefined') {
callback();
return null;
}
return setTimeout(callback, 0);
},
cancelAnimationFrame(id) {
if (typeof setTimeout === 'undefined') {
return;
}
clearTimeout(id);
}
};
function getWindow() {
const win = typeof window !== 'undefined' ? window : {};
extend(win, ssrWindow);
return win;
}
export { getWindow as a, getDocument as g };
File diff suppressed because it is too large Load Diff
+131
View File
@@ -0,0 +1,131 @@
import { e as extend, p as paramsList, i as isObject, n as needsNavigation, a as needsPagination, b as needsScrollbar } from './update-swiper.mjs';
import { d as defaults } from './swiper-core.mjs';
function getParams(obj, splitEvents) {
if (obj === void 0) {
obj = {};
}
if (splitEvents === void 0) {
splitEvents = true;
}
const params = {
on: {}
};
const events = {};
const passedParams = {};
extend(params, defaults);
params._emitClasses = true;
params.init = false;
const rest = {};
const allowedParams = paramsList.map(key => key.replace(/_/, ''));
const plainObj = Object.assign({}, obj);
Object.keys(plainObj).forEach(key => {
if (typeof obj[key] === 'undefined') return;
if (allowedParams.indexOf(key) >= 0) {
if (isObject(obj[key])) {
params[key] = {};
passedParams[key] = {};
extend(params[key], obj[key]);
extend(passedParams[key], obj[key]);
} else {
params[key] = obj[key];
passedParams[key] = obj[key];
}
} else if (key.search(/on[A-Z]/) === 0 && typeof obj[key] === 'function') {
if (splitEvents) {
events[`${key[2].toLowerCase()}${key.substr(3)}`] = obj[key];
} else {
params.on[`${key[2].toLowerCase()}${key.substr(3)}`] = obj[key];
}
} else {
rest[key] = obj[key];
}
});
['navigation', 'pagination', 'scrollbar'].forEach(key => {
if (params[key] === true) params[key] = {};
if (params[key] === false) delete params[key];
});
return {
params,
passedParams,
rest,
events
};
}
function mountSwiper(_ref, swiperParams) {
let {
el,
nextEl,
prevEl,
paginationEl,
scrollbarEl,
swiper
} = _ref;
if (needsNavigation(swiperParams) && nextEl && prevEl) {
swiper.params.navigation.nextEl = nextEl;
swiper.originalParams.navigation.nextEl = nextEl;
swiper.params.navigation.prevEl = prevEl;
swiper.originalParams.navigation.prevEl = prevEl;
}
if (needsPagination(swiperParams) && paginationEl) {
swiper.params.pagination.el = paginationEl;
swiper.originalParams.pagination.el = paginationEl;
}
if (needsScrollbar(swiperParams) && scrollbarEl) {
swiper.params.scrollbar.el = scrollbarEl;
swiper.originalParams.scrollbar.el = scrollbarEl;
}
swiper.init(el);
}
function getChangedParams(swiperParams, oldParams, children, oldChildren, getKey) {
const keys = [];
if (!oldParams) return keys;
const addKey = key => {
if (keys.indexOf(key) < 0) keys.push(key);
};
if (children && oldChildren) {
const oldChildrenKeys = oldChildren.map(getKey);
const childrenKeys = children.map(getKey);
if (oldChildrenKeys.join('') !== childrenKeys.join('')) addKey('children');
if (oldChildren.length !== children.length) addKey('children');
}
const watchParams = paramsList.filter(key => key[0] === '_').map(key => key.replace(/_/, ''));
watchParams.forEach(key => {
if (key in swiperParams && key in oldParams) {
if (isObject(swiperParams[key]) && isObject(oldParams[key])) {
const newKeys = Object.keys(swiperParams[key]);
const oldKeys = Object.keys(oldParams[key]);
if (newKeys.length !== oldKeys.length) {
addKey(key);
} else {
newKeys.forEach(newKey => {
if (swiperParams[key][newKey] !== oldParams[key][newKey]) {
addKey(key);
}
});
oldKeys.forEach(oldKey => {
if (swiperParams[key][oldKey] !== oldParams[key][oldKey]) addKey(key);
});
}
} else if (swiperParams[key] !== oldParams[key]) {
addKey(key);
}
}
});
return keys;
}
const updateOnVirtualData = swiper => {
if (!swiper || swiper.destroyed || !swiper.params.virtual || swiper.params.virtual && !swiper.params.virtual.enabled) return;
swiper.updateSlides();
swiper.updateProgress();
swiper.updateSlidesClasses();
swiper.emit('_virtualUpdated');
if (swiper.parallax && swiper.params.parallax && swiper.params.parallax.enabled) {
swiper.parallax.setTranslate();
}
};
export { getChangedParams as a, getParams as g, mountSwiper as m, updateOnVirtualData as u };
+238
View File
@@ -0,0 +1,238 @@
import { s as setInnerHTML } from './utils.mjs';
/* underscore in name -> watch for changes */
const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'swiperElementNodeName', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopAdditionalSlides', 'loopAddBlankSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideFullyVisibleClass', 'slideNextClass', 'slidePrevClass', 'slideBlankClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
// modules
'a11y', '_autoplay', '_controller', 'coverflowEffect', 'cubeEffect', 'fadeEffect', 'flipEffect', 'creativeEffect', 'cardsEffect', 'hashNavigation', 'history', 'keyboard', 'mousewheel', '_navigation', '_pagination', 'parallax', '_scrollbar', '_thumbs', 'virtual', 'zoom', 'control'];
function isObject(o) {
return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object' && !o.__swiper__;
}
function extend(target, src) {
const noExtend = ['__proto__', 'constructor', 'prototype'];
Object.keys(src).filter(key => noExtend.indexOf(key) < 0).forEach(key => {
if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {
if (src[key].__swiper__) target[key] = src[key];else extend(target[key], src[key]);
} else {
target[key] = src[key];
}
});
}
function needsNavigation(params) {
if (params === void 0) {
params = {};
}
return params.navigation && typeof params.navigation.nextEl === 'undefined' && typeof params.navigation.prevEl === 'undefined';
}
function needsPagination(params) {
if (params === void 0) {
params = {};
}
return params.pagination && typeof params.pagination.el === 'undefined';
}
function needsScrollbar(params) {
if (params === void 0) {
params = {};
}
return params.scrollbar && typeof params.scrollbar.el === 'undefined';
}
function uniqueClasses(classNames) {
if (classNames === void 0) {
classNames = '';
}
const classes = classNames.split(' ').map(c => c.trim()).filter(c => !!c);
const unique = [];
classes.forEach(c => {
if (unique.indexOf(c) < 0) unique.push(c);
});
return unique.join(' ');
}
function attrToProp(attrName) {
if (attrName === void 0) {
attrName = '';
}
return attrName.replace(/-[a-z]/g, l => l.toUpperCase().replace('-', ''));
}
function wrapperClass(className) {
if (className === void 0) {
className = '';
}
if (!className) return 'swiper-wrapper';
if (!className.includes('swiper-wrapper')) return `swiper-wrapper ${className}`;
return className;
}
function updateSwiper(_ref) {
let {
swiper,
slides,
passedParams,
changedParams,
nextEl,
prevEl,
scrollbarEl,
paginationEl
} = _ref;
const updateParams = changedParams.filter(key => key !== 'children' && key !== 'direction' && key !== 'wrapperClass');
const {
params: currentParams,
pagination,
navigation,
scrollbar,
virtual,
thumbs
} = swiper;
let needThumbsInit;
let needControllerInit;
let needPaginationInit;
let needScrollbarInit;
let needNavigationInit;
let loopNeedDestroy;
let loopNeedEnable;
let loopNeedReloop;
if (changedParams.includes('thumbs') && passedParams.thumbs && passedParams.thumbs.swiper && !passedParams.thumbs.swiper.destroyed && currentParams.thumbs && (!currentParams.thumbs.swiper || currentParams.thumbs.swiper.destroyed)) {
needThumbsInit = true;
}
if (changedParams.includes('controller') && passedParams.controller && passedParams.controller.control && currentParams.controller && !currentParams.controller.control) {
needControllerInit = true;
}
if (changedParams.includes('pagination') && passedParams.pagination && (passedParams.pagination.el || paginationEl) && (currentParams.pagination || currentParams.pagination === false) && pagination && !pagination.el) {
needPaginationInit = true;
}
if (changedParams.includes('scrollbar') && passedParams.scrollbar && (passedParams.scrollbar.el || scrollbarEl) && (currentParams.scrollbar || currentParams.scrollbar === false) && scrollbar && !scrollbar.el) {
needScrollbarInit = true;
}
if (changedParams.includes('navigation') && passedParams.navigation && (passedParams.navigation.prevEl || prevEl) && (passedParams.navigation.nextEl || nextEl) && (currentParams.navigation || currentParams.navigation === false) && navigation && !navigation.prevEl && !navigation.nextEl) {
needNavigationInit = true;
}
const destroyModule = mod => {
if (!swiper[mod]) return;
swiper[mod].destroy();
if (mod === 'navigation') {
if (swiper.isElement) {
swiper[mod].prevEl.remove();
swiper[mod].nextEl.remove();
}
currentParams[mod].prevEl = undefined;
currentParams[mod].nextEl = undefined;
swiper[mod].prevEl = undefined;
swiper[mod].nextEl = undefined;
} else {
if (swiper.isElement) {
swiper[mod].el.remove();
}
currentParams[mod].el = undefined;
swiper[mod].el = undefined;
}
};
if (changedParams.includes('loop') && swiper.isElement) {
if (currentParams.loop && !passedParams.loop) {
loopNeedDestroy = true;
} else if (!currentParams.loop && passedParams.loop) {
loopNeedEnable = true;
} else {
loopNeedReloop = true;
}
}
updateParams.forEach(key => {
if (isObject(currentParams[key]) && isObject(passedParams[key])) {
Object.assign(currentParams[key], passedParams[key]);
if ((key === 'navigation' || key === 'pagination' || key === 'scrollbar') && 'enabled' in passedParams[key] && !passedParams[key].enabled) {
destroyModule(key);
}
} else {
const newValue = passedParams[key];
if ((newValue === true || newValue === false) && (key === 'navigation' || key === 'pagination' || key === 'scrollbar')) {
if (newValue === false) {
destroyModule(key);
}
} else {
currentParams[key] = passedParams[key];
}
}
});
if (updateParams.includes('controller') && !needControllerInit && swiper.controller && swiper.controller.control && currentParams.controller && currentParams.controller.control) {
swiper.controller.control = currentParams.controller.control;
}
if (changedParams.includes('children') && slides && virtual && currentParams.virtual.enabled) {
virtual.slides = slides;
virtual.update(true);
} else if (changedParams.includes('virtual') && virtual && currentParams.virtual.enabled) {
if (slides) virtual.slides = slides;
virtual.update(true);
}
if (changedParams.includes('children') && slides && currentParams.loop) {
loopNeedReloop = true;
}
if (needThumbsInit) {
const initialized = thumbs.init();
if (initialized) thumbs.update(true);
}
if (needControllerInit) {
swiper.controller.control = currentParams.controller.control;
}
if (needPaginationInit) {
if (swiper.isElement && (!paginationEl || typeof paginationEl === 'string')) {
paginationEl = document.createElement('div');
paginationEl.classList.add('swiper-pagination');
paginationEl.part.add('pagination');
swiper.el.appendChild(paginationEl);
}
if (paginationEl) currentParams.pagination.el = paginationEl;
pagination.init();
pagination.render();
pagination.update();
}
if (needScrollbarInit) {
if (swiper.isElement && (!scrollbarEl || typeof scrollbarEl === 'string')) {
scrollbarEl = document.createElement('div');
scrollbarEl.classList.add('swiper-scrollbar');
scrollbarEl.part.add('scrollbar');
swiper.el.appendChild(scrollbarEl);
}
if (scrollbarEl) currentParams.scrollbar.el = scrollbarEl;
scrollbar.init();
scrollbar.updateSize();
scrollbar.setTranslate();
}
if (needNavigationInit) {
if (swiper.isElement) {
if (!nextEl || typeof nextEl === 'string') {
nextEl = document.createElement('div');
nextEl.classList.add('swiper-button-next');
setInnerHTML(nextEl, swiper.hostEl.constructor.nextButtonSvg);
nextEl.part.add('button-next');
swiper.el.appendChild(nextEl);
}
if (!prevEl || typeof prevEl === 'string') {
prevEl = document.createElement('div');
prevEl.classList.add('swiper-button-prev');
setInnerHTML(prevEl, swiper.hostEl.constructor.prevButtonSvg);
prevEl.part.add('button-prev');
swiper.el.appendChild(prevEl);
}
}
if (nextEl) currentParams.navigation.nextEl = nextEl;
if (prevEl) currentParams.navigation.prevEl = prevEl;
navigation.init();
navigation.update();
}
if (changedParams.includes('allowSlideNext')) {
swiper.allowSlideNext = passedParams.allowSlideNext;
}
if (changedParams.includes('allowSlidePrev')) {
swiper.allowSlidePrev = passedParams.allowSlidePrev;
}
if (changedParams.includes('direction')) {
swiper.changeDirection(passedParams.direction, false);
}
if (loopNeedDestroy || loopNeedReloop) {
swiper.loopDestroy();
}
if (loopNeedEnable || loopNeedReloop) {
swiper.loopCreate();
}
swiper.update();
}
export { needsPagination as a, needsScrollbar as b, attrToProp as c, uniqueClasses as d, extend as e, isObject as i, needsNavigation as n, paramsList as p, updateSwiper as u, wrapperClass as w };
+343
View File
@@ -0,0 +1,343 @@
import { a as getWindow, g as getDocument } from './ssr-window.esm.mjs';
function classesToTokens(classes) {
if (classes === void 0) {
classes = '';
}
return classes.trim().split(' ').filter(c => !!c.trim());
}
function deleteProps(obj) {
const object = obj;
Object.keys(object).forEach(key => {
try {
object[key] = null;
} catch (e) {
// no getter for object
}
try {
delete object[key];
} catch (e) {
// something got wrong
}
});
}
function nextTick(callback, delay) {
if (delay === void 0) {
delay = 0;
}
return setTimeout(callback, delay);
}
function now() {
return Date.now();
}
function getComputedStyle(el) {
const window = getWindow();
let style;
if (window.getComputedStyle) {
style = window.getComputedStyle(el, null);
}
if (!style && el.currentStyle) {
style = el.currentStyle;
}
if (!style) {
style = el.style;
}
return style;
}
function getTranslate(el, axis) {
if (axis === void 0) {
axis = 'x';
}
const window = getWindow();
let matrix;
let curTransform;
let transformMatrix;
const curStyle = getComputedStyle(el);
if (window.WebKitCSSMatrix) {
curTransform = curStyle.transform || curStyle.webkitTransform;
if (curTransform.split(',').length > 6) {
curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
}
// Some old versions of Webkit choke when 'none' is passed; pass
// empty string instead in this case
transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
} else {
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
matrix = transformMatrix.toString().split(',');
}
if (axis === 'x') {
// Latest Chrome and webkits Fix
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
// Crazy IE10 Matrix
else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
// Normal Browsers
else curTransform = parseFloat(matrix[4]);
}
if (axis === 'y') {
// Latest Chrome and webkits Fix
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
// Crazy IE10 Matrix
else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
// Normal Browsers
else curTransform = parseFloat(matrix[5]);
}
return curTransform || 0;
}
function isObject(o) {
return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
}
function isNode(node) {
// eslint-disable-next-line
if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
return node instanceof HTMLElement;
}
return node && (node.nodeType === 1 || node.nodeType === 11);
}
function extend() {
const to = Object(arguments.length <= 0 ? undefined : arguments[0]);
const noExtend = ['__proto__', 'constructor', 'prototype'];
for (let i = 1; i < arguments.length; i += 1) {
const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
const nextKey = keysArray[nextIndex];
const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
if (desc !== undefined && desc.enumerable) {
if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
if (nextSource[nextKey].__swiper__) {
to[nextKey] = nextSource[nextKey];
} else {
extend(to[nextKey], nextSource[nextKey]);
}
} else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
to[nextKey] = {};
if (nextSource[nextKey].__swiper__) {
to[nextKey] = nextSource[nextKey];
} else {
extend(to[nextKey], nextSource[nextKey]);
}
} else {
to[nextKey] = nextSource[nextKey];
}
}
}
}
}
return to;
}
function setCSSProperty(el, varName, varValue) {
el.style.setProperty(varName, varValue);
}
function animateCSSModeScroll(_ref) {
let {
swiper,
targetPosition,
side
} = _ref;
const window = getWindow();
const startPosition = -swiper.translate;
let startTime = null;
let time;
const duration = swiper.params.speed;
swiper.wrapperEl.style.scrollSnapType = 'none';
window.cancelAnimationFrame(swiper.cssModeFrameID);
const dir = targetPosition > startPosition ? 'next' : 'prev';
const isOutOfBound = (current, target) => {
return dir === 'next' && current >= target || dir === 'prev' && current <= target;
};
const animate = () => {
time = new Date().getTime();
if (startTime === null) {
startTime = time;
}
const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
if (isOutOfBound(currentPosition, targetPosition)) {
currentPosition = targetPosition;
}
swiper.wrapperEl.scrollTo({
[side]: currentPosition
});
if (isOutOfBound(currentPosition, targetPosition)) {
swiper.wrapperEl.style.overflow = 'hidden';
swiper.wrapperEl.style.scrollSnapType = '';
setTimeout(() => {
swiper.wrapperEl.style.overflow = '';
swiper.wrapperEl.scrollTo({
[side]: currentPosition
});
});
window.cancelAnimationFrame(swiper.cssModeFrameID);
return;
}
swiper.cssModeFrameID = window.requestAnimationFrame(animate);
};
animate();
}
function getSlideTransformEl(slideEl) {
return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl;
}
function elementChildren(element, selector) {
if (selector === void 0) {
selector = '';
}
const window = getWindow();
const children = [...element.children];
if (window.HTMLSlotElement && element instanceof HTMLSlotElement) {
children.push(...element.assignedElements());
}
if (!selector) {
return children;
}
return children.filter(el => el.matches(selector));
}
function elementIsChildOfSlot(el, slot) {
// Breadth-first search through all parent's children and assigned elements
const elementsQueue = [slot];
while (elementsQueue.length > 0) {
const elementToCheck = elementsQueue.shift();
if (el === elementToCheck) {
return true;
}
elementsQueue.push(...elementToCheck.children, ...(elementToCheck.shadowRoot ? elementToCheck.shadowRoot.children : []), ...(elementToCheck.assignedElements ? elementToCheck.assignedElements() : []));
}
}
function elementIsChildOf(el, parent) {
const window = getWindow();
let isChild = parent.contains(el);
if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) {
const children = [...parent.assignedElements()];
isChild = children.includes(el);
if (!isChild) {
isChild = elementIsChildOfSlot(el, parent);
}
}
return isChild;
}
function showWarning(text) {
try {
console.warn(text);
return;
} catch (err) {
// err
}
}
function createElement(tag, classes) {
if (classes === void 0) {
classes = [];
}
const el = document.createElement(tag);
el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
return el;
}
function elementOffset(el) {
const window = getWindow();
const document = getDocument();
const box = el.getBoundingClientRect();
const body = document.body;
const clientTop = el.clientTop || body.clientTop || 0;
const clientLeft = el.clientLeft || body.clientLeft || 0;
const scrollTop = el === window ? window.scrollY : el.scrollTop;
const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
return {
top: box.top + scrollTop - clientTop,
left: box.left + scrollLeft - clientLeft
};
}
function elementPrevAll(el, selector) {
const prevEls = [];
while (el.previousElementSibling) {
const prev = el.previousElementSibling; // eslint-disable-line
if (selector) {
if (prev.matches(selector)) prevEls.push(prev);
} else prevEls.push(prev);
el = prev;
}
return prevEls;
}
function elementNextAll(el, selector) {
const nextEls = [];
while (el.nextElementSibling) {
const next = el.nextElementSibling; // eslint-disable-line
if (selector) {
if (next.matches(selector)) nextEls.push(next);
} else nextEls.push(next);
el = next;
}
return nextEls;
}
function elementStyle(el, prop) {
const window = getWindow();
return window.getComputedStyle(el, null).getPropertyValue(prop);
}
function elementIndex(el) {
let child = el;
let i;
if (child) {
i = 0;
// eslint-disable-next-line
while ((child = child.previousSibling) !== null) {
if (child.nodeType === 1) i += 1;
}
return i;
}
return undefined;
}
function elementParents(el, selector) {
const parents = []; // eslint-disable-line
let parent = el.parentElement; // eslint-disable-line
while (parent) {
if (selector) {
if (parent.matches(selector)) parents.push(parent);
} else {
parents.push(parent);
}
parent = parent.parentElement;
}
return parents;
}
function elementTransitionEnd(el, callback) {
function fireCallBack(e) {
if (e.target !== el) return;
callback.call(el, e);
el.removeEventListener('transitionend', fireCallBack);
}
if (callback) {
el.addEventListener('transitionend', fireCallBack);
}
}
function elementOuterSize(el, size, includeMargins) {
const window = getWindow();
if (includeMargins) {
return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));
}
return el.offsetWidth;
}
function makeElementsArray(el) {
return (Array.isArray(el) ? el : [el]).filter(e => !!e);
}
function getRotateFix(swiper) {
return v => {
if (Math.abs(v) > 0 && swiper.browser && swiper.browser.need3dFix && Math.abs(v) % 90 === 0) {
return v + 0.001;
}
return v;
};
}
function setInnerHTML(el, html) {
if (html === void 0) {
html = '';
}
if (typeof trustedTypes !== 'undefined') {
el.innerHTML = trustedTypes.createPolicy('html', {
createHTML: s => s
}).createHTML(html);
} else {
el.innerHTML = html;
}
}
export { setCSSProperty as a, elementParents as b, createElement as c, elementOffset as d, elementChildren as e, now as f, getSlideTransformEl as g, elementOuterSize as h, elementIndex as i, classesToTokens as j, getTranslate as k, elementTransitionEnd as l, makeElementsArray as m, nextTick as n, isObject as o, getRotateFix as p, elementStyle as q, elementNextAll as r, setInnerHTML as s, elementPrevAll as t, animateCSSModeScroll as u, showWarning as v, elementIsChildOf as w, extend as x, deleteProps as y };