@gem-sdk/swiper 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/a11y.min.mjs +1 -1
- package/modules/a11y.mjs +1 -1
- package/modules/pagination.min.mjs +1 -1
- package/modules/pagination.min.mjs.map +1 -1
- package/modules/pagination.mjs +20 -16
- package/package.json +3 -3
- package/shared/swiper-core.min.mjs +1 -1
- package/shared/swiper-core.min.mjs.map +1 -1
- package/shared/swiper-core.mjs +360 -51
- package/shared/update-swiper.min.mjs +1 -1
- package/shared/update-swiper.min.mjs.map +1 -1
- package/shared/update-swiper.mjs +1 -1
- package/shared/utils.min.mjs +1 -1
- package/shared/utils.min.mjs.map +1 -1
- package/shared/utils.mjs +1 -1
- package/swiper-bundle.css +1 -1
- package/swiper-bundle.js +381 -68
- package/swiper-bundle.min.css +1 -1
- package/swiper-bundle.min.js +2 -2
- package/swiper-bundle.min.js.map +1 -1
- package/swiper-bundle.min.mjs +1 -1
- package/swiper-bundle.mjs +1 -1
- package/swiper-effect-utils.min.mjs +1 -1
- package/swiper-effect-utils.mjs +1 -1
- package/swiper-element-bundle.js +383 -70
- package/swiper-element-bundle.min.js +2 -2
- package/swiper-element-bundle.min.js.map +1 -1
- package/swiper-element-bundle.min.mjs +1 -1
- package/swiper-element-bundle.mjs +1 -1
- package/swiper-element.d.ts +5 -0
- package/swiper-element.js +362 -53
- package/swiper-element.min.js +2 -2
- package/swiper-element.min.js.map +1 -1
- package/swiper-element.min.mjs +1 -1
- package/swiper-element.mjs +1 -1
- package/swiper-react.d.ts +5 -0
- package/swiper-react.mjs +1 -1
- package/swiper-vue.d.ts +9 -0
- package/swiper-vue.mjs +6 -2
- package/swiper.css +1 -1
- package/swiper.js +360 -51
- package/swiper.less +1 -1
- package/swiper.min.css +1 -1
- package/swiper.min.js +2 -2
- package/swiper.min.js.map +1 -1
- package/swiper.min.mjs +1 -1
- package/swiper.mjs +1 -1
- package/swiper.scss +1 -1
- package/types/swiper-class.d.ts +10 -0
- package/types/swiper-events.d.ts +5 -0
- package/types/swiper-options.d.ts +7 -0
package/shared/swiper-core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as getWindow, g as getDocument } from './ssr-window.esm.mjs';
|
|
2
|
-
import { b as elementParents, q as elementStyle, e as elementChildren, a as setCSSProperty,
|
|
2
|
+
import { b as elementParents, q as elementStyle, e as elementChildren, a as setCSSProperty, i as elementOuterSize, r as elementNextAll, t as elementPrevAll, k as getTranslate, u as animateCSSModeScroll, n as nextTick, v as showWarning, c as createElement, w as elementIsChildOf, f as now, x as extend, h as elementIndex, y as deleteProps } from './utils.mjs';
|
|
3
3
|
|
|
4
4
|
let support;
|
|
5
5
|
function calcSupport() {
|
|
@@ -1541,56 +1541,63 @@ function slideToLoop(index, speed, runCallbacks, internal) {
|
|
|
1541
1541
|
if (typeof speed === 'undefined') {
|
|
1542
1542
|
speed = swiper.params.speed;
|
|
1543
1543
|
}
|
|
1544
|
-
const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
|
|
1545
1544
|
let newIndex = index;
|
|
1546
1545
|
if (swiper.params.loop) {
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1546
|
+
swiper.slides;
|
|
1547
|
+
const totalSlides = swiper.slides.length;
|
|
1548
|
+
let targetSlideIndex;
|
|
1549
|
+
targetSlideIndex = swiper.getSlideIndexByData(newIndex);
|
|
1550
|
+
const cols = swiper.slides.length;
|
|
1551
|
+
const {
|
|
1552
|
+
centeredSlides
|
|
1553
|
+
} = swiper.params;
|
|
1554
|
+
let slidesPerView = swiper.params.slidesPerView;
|
|
1555
|
+
if (slidesPerView === 'auto') {
|
|
1556
|
+
slidesPerView = swiper.slidesPerViewDynamic();
|
|
1550
1557
|
} else {
|
|
1551
|
-
|
|
1552
|
-
if (
|
|
1553
|
-
|
|
1554
|
-
targetSlideIndex = swiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex).column;
|
|
1555
|
-
} else {
|
|
1556
|
-
targetSlideIndex = swiper.getSlideIndexByData(newIndex);
|
|
1557
|
-
}
|
|
1558
|
-
const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
|
|
1559
|
-
const {
|
|
1560
|
-
centeredSlides
|
|
1561
|
-
} = swiper.params;
|
|
1562
|
-
let slidesPerView = swiper.params.slidesPerView;
|
|
1563
|
-
if (slidesPerView === 'auto') {
|
|
1564
|
-
slidesPerView = swiper.slidesPerViewDynamic();
|
|
1565
|
-
} else {
|
|
1566
|
-
slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
1567
|
-
if (centeredSlides && slidesPerView % 2 === 0) {
|
|
1568
|
-
slidesPerView = slidesPerView + 1;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
let needLoopFix = cols - targetSlideIndex < slidesPerView;
|
|
1572
|
-
if (centeredSlides) {
|
|
1573
|
-
needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
|
|
1574
|
-
}
|
|
1575
|
-
if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
|
|
1576
|
-
needLoopFix = false;
|
|
1577
|
-
}
|
|
1578
|
-
if (needLoopFix) {
|
|
1579
|
-
const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
|
|
1580
|
-
swiper.loopFix({
|
|
1581
|
-
direction,
|
|
1582
|
-
slideTo: true,
|
|
1583
|
-
activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
|
|
1584
|
-
slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
|
|
1585
|
-
});
|
|
1558
|
+
slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
1559
|
+
if (centeredSlides && slidesPerView % 2 === 0) {
|
|
1560
|
+
slidesPerView = slidesPerView + 1;
|
|
1586
1561
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1562
|
+
}
|
|
1563
|
+
let needLoopFix = cols - targetSlideIndex < slidesPerView;
|
|
1564
|
+
if (centeredSlides) {
|
|
1565
|
+
needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
|
|
1566
|
+
}
|
|
1567
|
+
if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto') {
|
|
1568
|
+
needLoopFix = false;
|
|
1569
|
+
}
|
|
1570
|
+
if (centeredSlides && needLoopFix) {
|
|
1571
|
+
const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
|
|
1572
|
+
swiper.loopFix({
|
|
1573
|
+
direction,
|
|
1574
|
+
slideTo: true,
|
|
1575
|
+
activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
|
|
1576
|
+
slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
if (!centeredSlides && needLoopFix) {
|
|
1580
|
+
let direction;
|
|
1581
|
+
let nextSteps;
|
|
1582
|
+
let prevSteps;
|
|
1583
|
+
if (swiper.activeIndex < targetSlideIndex) {
|
|
1584
|
+
nextSteps = targetSlideIndex - swiper.activeIndex;
|
|
1585
|
+
prevSteps = swiper.activeIndex - (targetSlideIndex - totalSlides);
|
|
1590
1586
|
} else {
|
|
1591
|
-
|
|
1587
|
+
prevSteps = swiper.activeIndex - targetSlideIndex;
|
|
1588
|
+
nextSteps = targetSlideIndex + totalSlides - swiper.activeIndex;
|
|
1592
1589
|
}
|
|
1590
|
+
direction = nextSteps > prevSteps ? 'prev' : 'next';
|
|
1591
|
+
swiper.loopFixDot({
|
|
1592
|
+
direction,
|
|
1593
|
+
slideTo: true,
|
|
1594
|
+
activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
|
|
1595
|
+
slideRealIndex: direction === 'next' ? swiper.realIndex : undefined,
|
|
1596
|
+
targetSlideIndex,
|
|
1597
|
+
newIndex: swiper.getSlideIndexByData(newIndex)
|
|
1598
|
+
});
|
|
1593
1599
|
}
|
|
1600
|
+
newIndex = swiper.getSlideIndexByData(newIndex);
|
|
1594
1601
|
}
|
|
1595
1602
|
requestAnimationFrame(() => {
|
|
1596
1603
|
swiper.slideTo(newIndex, speed, runCallbacks, internal);
|
|
@@ -1598,6 +1605,87 @@ function slideToLoop(index, speed, runCallbacks, internal) {
|
|
|
1598
1605
|
return swiper;
|
|
1599
1606
|
}
|
|
1600
1607
|
|
|
1608
|
+
function slideToLoopCenterSneakPeek(index, speed, runCallbacks, internal) {
|
|
1609
|
+
if (index === void 0) {
|
|
1610
|
+
index = 0;
|
|
1611
|
+
}
|
|
1612
|
+
if (runCallbacks === void 0) {
|
|
1613
|
+
runCallbacks = true;
|
|
1614
|
+
}
|
|
1615
|
+
if (typeof index === 'string') {
|
|
1616
|
+
const indexAsNumber = parseInt(index, 10);
|
|
1617
|
+
index = indexAsNumber;
|
|
1618
|
+
}
|
|
1619
|
+
const swiper = this;
|
|
1620
|
+
if (swiper.destroyed) return;
|
|
1621
|
+
if (typeof speed === 'undefined') {
|
|
1622
|
+
speed = swiper.params.speed;
|
|
1623
|
+
}
|
|
1624
|
+
let newIndex = index;
|
|
1625
|
+
if (swiper.params.loop) {
|
|
1626
|
+
swiper.slides;
|
|
1627
|
+
const totalSlides = swiper.slides.length;
|
|
1628
|
+
let targetSlideIndex;
|
|
1629
|
+
targetSlideIndex = swiper.getSlideIndexByData(newIndex);
|
|
1630
|
+
const cols = swiper.slides.length;
|
|
1631
|
+
const {
|
|
1632
|
+
centeredSlides
|
|
1633
|
+
} = swiper.params;
|
|
1634
|
+
let slidesPerView = swiper.params.slidesPerView;
|
|
1635
|
+
if (slidesPerView === 'auto') {
|
|
1636
|
+
slidesPerView = swiper.slidesPerViewDynamic();
|
|
1637
|
+
} else {
|
|
1638
|
+
slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
1639
|
+
if (centeredSlides && slidesPerView % 2 === 0) {
|
|
1640
|
+
slidesPerView = slidesPerView + 1;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto') ;
|
|
1644
|
+
const isSneakPeekCenter = swiper.params?.isSneakPeekCenter;
|
|
1645
|
+
if (isSneakPeekCenter) {
|
|
1646
|
+
let direction;
|
|
1647
|
+
let nextSteps;
|
|
1648
|
+
let prevSteps;
|
|
1649
|
+
if (swiper.activeIndex < targetSlideIndex) {
|
|
1650
|
+
nextSteps = targetSlideIndex - swiper.activeIndex;
|
|
1651
|
+
prevSteps = swiper.activeIndex - (targetSlideIndex - totalSlides);
|
|
1652
|
+
} else {
|
|
1653
|
+
prevSteps = swiper.activeIndex - targetSlideIndex;
|
|
1654
|
+
nextSteps = targetSlideIndex + totalSlides - swiper.activeIndex;
|
|
1655
|
+
}
|
|
1656
|
+
direction = nextSteps > prevSteps ? 'prev' : 'next';
|
|
1657
|
+
swiper.loopFixDot({
|
|
1658
|
+
direction,
|
|
1659
|
+
slideTo: true,
|
|
1660
|
+
activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
|
|
1661
|
+
slideRealIndex: direction === 'next' ? swiper.realIndex : undefined,
|
|
1662
|
+
targetSlideIndex,
|
|
1663
|
+
newIndex: swiper.getSlideIndexByData(newIndex)
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
newIndex = swiper.getSlideIndexByData(newIndex);
|
|
1667
|
+
}
|
|
1668
|
+
swiper.slideTo(newIndex, speed, runCallbacks, internal);
|
|
1669
|
+
const slides = swiper.slides;
|
|
1670
|
+
if (swiper.params?.isSneakPeekCenter && slides.length > 1 && swiper.activeIndex === 0) {
|
|
1671
|
+
const gap = Math.abs(swiper.snapGrid[1] - swiper.snapGrid[0]);
|
|
1672
|
+
const swiperTranslate = JSON.parse(JSON.stringify(swiper.snapGrid[1]));
|
|
1673
|
+
|
|
1674
|
+
// Move last item to first position only if active slide is the first slide
|
|
1675
|
+
const lastSlide = slides[slides.length - 1];
|
|
1676
|
+
lastSlide.swiperLoopMoveDOM = true;
|
|
1677
|
+
swiper.slidesEl.prepend(lastSlide);
|
|
1678
|
+
lastSlide.swiperLoopMoveDOM = false;
|
|
1679
|
+
swiper.setTransition(0);
|
|
1680
|
+
swiper.setTranslate(-(swiperTranslate + gap));
|
|
1681
|
+
swiper.recalcSlides();
|
|
1682
|
+
swiper.updateSlides();
|
|
1683
|
+
swiper.setTransition(swiper.params.speed);
|
|
1684
|
+
swiper.setTranslate(-swiperTranslate);
|
|
1685
|
+
}
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1601
1689
|
/* eslint no-unused-vars: "off" */
|
|
1602
1690
|
function slideNext(speed, runCallbacks, internal) {
|
|
1603
1691
|
if (runCallbacks === void 0) {
|
|
@@ -1622,7 +1710,7 @@ function slideNext(speed, runCallbacks, internal) {
|
|
|
1622
1710
|
if (params.loop) {
|
|
1623
1711
|
if (animating && !isVirtual && params.loopPreventsSliding) return false;
|
|
1624
1712
|
|
|
1625
|
-
//
|
|
1713
|
+
// Kiểm tra xem loop có bị disable không
|
|
1626
1714
|
const currentSlidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
|
|
1627
1715
|
if (swiper.slides.length >= currentSlidesPerView) {
|
|
1628
1716
|
swiper.loopFix({
|
|
@@ -1662,11 +1750,9 @@ function slidePrev(speed, runCallbacks, internal) {
|
|
|
1662
1750
|
if (typeof speed === 'undefined') {
|
|
1663
1751
|
speed = swiper.params.speed;
|
|
1664
1752
|
}
|
|
1665
|
-
|
|
1753
|
+
swiper.virtual && params.virtual.enabled;
|
|
1666
1754
|
if (params.loop) {
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
// Check if loop is disabled
|
|
1755
|
+
// Kiểm tra xem loop có bị disable không
|
|
1670
1756
|
const currentSlidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
|
|
1671
1757
|
if (swiper.slides.length >= currentSlidesPerView) {
|
|
1672
1758
|
swiper.loopFix({
|
|
@@ -1715,7 +1801,27 @@ function slidePrev(speed, runCallbacks, internal) {
|
|
|
1715
1801
|
});
|
|
1716
1802
|
return true;
|
|
1717
1803
|
}
|
|
1718
|
-
|
|
1804
|
+
requestAnimationFrame(() => {
|
|
1805
|
+
swiper.slideTo(prevIndex, speed, runCallbacks, internal);
|
|
1806
|
+
const slides = swiper.slides;
|
|
1807
|
+
if (swiper.params?.isSneakPeekCenter && slides.length > 1 && swiper.activeIndex === 0) {
|
|
1808
|
+
const gap = Math.abs(swiper.snapGrid[1] - swiper.snapGrid[0]);
|
|
1809
|
+
const swiperTranslate = JSON.parse(JSON.stringify(swiper.snapGrid[1]));
|
|
1810
|
+
|
|
1811
|
+
// Move last item to first position only if active slide is the first slide
|
|
1812
|
+
const lastSlide = slides[slides.length - 1];
|
|
1813
|
+
lastSlide.swiperLoopMoveDOM = true;
|
|
1814
|
+
swiper.slidesEl.prepend(lastSlide);
|
|
1815
|
+
lastSlide.swiperLoopMoveDOM = false;
|
|
1816
|
+
swiper.setTransition(0);
|
|
1817
|
+
swiper.setTranslate(-(swiperTranslate + gap));
|
|
1818
|
+
swiper.recalcSlides();
|
|
1819
|
+
swiper.updateSlides();
|
|
1820
|
+
swiper.setTransition(swiper.params.speed);
|
|
1821
|
+
swiper.setTranslate(-swiperTranslate);
|
|
1822
|
+
}
|
|
1823
|
+
});
|
|
1824
|
+
return;
|
|
1719
1825
|
}
|
|
1720
1826
|
|
|
1721
1827
|
/* eslint no-unused-vars: "off" */
|
|
@@ -1804,6 +1910,7 @@ function slideToClickedSlide() {
|
|
|
1804
1910
|
var slide = {
|
|
1805
1911
|
slideTo,
|
|
1806
1912
|
slideToLoop,
|
|
1913
|
+
slideToLoopCenterSneakPeek,
|
|
1807
1914
|
slideNext,
|
|
1808
1915
|
slidePrev,
|
|
1809
1916
|
slideReset,
|
|
@@ -1891,7 +1998,7 @@ function loopFix(_temp) {
|
|
|
1891
1998
|
const swiper = this;
|
|
1892
1999
|
if (!swiper.params.loop) return;
|
|
1893
2000
|
|
|
1894
|
-
// Disable loop mode
|
|
2001
|
+
// Disable loop mode nếu số slides ít hơn slidesPerView
|
|
1895
2002
|
const currentSlidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
1896
2003
|
if (swiper.slides.length < currentSlidesPerView) {
|
|
1897
2004
|
console.warn('Swiper: Loop mode disabled - slides.length < slidesPerView');
|
|
@@ -2103,6 +2210,206 @@ function loopFix(_temp) {
|
|
|
2103
2210
|
swiper.emit('loopFix');
|
|
2104
2211
|
}
|
|
2105
2212
|
|
|
2213
|
+
function loopFixDot(_temp) {
|
|
2214
|
+
let {
|
|
2215
|
+
slideRealIndex,
|
|
2216
|
+
slideTo = true,
|
|
2217
|
+
direction,
|
|
2218
|
+
activeSlideIndex,
|
|
2219
|
+
initial,
|
|
2220
|
+
targetSlideIndex,
|
|
2221
|
+
newIndex
|
|
2222
|
+
} = _temp === void 0 ? {} : _temp;
|
|
2223
|
+
const swiper = this;
|
|
2224
|
+
if (!swiper.params.loop) return;
|
|
2225
|
+
|
|
2226
|
+
// Disable loop mode nếu số slides ít hơn slidesPerView
|
|
2227
|
+
const currentSlidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
2228
|
+
if (swiper.slides.length < currentSlidesPerView) {
|
|
2229
|
+
console.warn('Swiper: Loop mode disabled - slides.length < slidesPerView');
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
swiper.emit('beforeLoopFix');
|
|
2233
|
+
const {
|
|
2234
|
+
slides,
|
|
2235
|
+
allowSlidePrev,
|
|
2236
|
+
allowSlideNext,
|
|
2237
|
+
slidesEl,
|
|
2238
|
+
params
|
|
2239
|
+
} = swiper;
|
|
2240
|
+
const targetData = slidesEl.children[targetSlideIndex].getAttribute('data-swiper-slide-index');
|
|
2241
|
+
const oldActiveData = Array.from(slidesEl.children).find(el => el.classList.contains(params.slideActiveClass)).getAttribute('data-swiper-slide-index');
|
|
2242
|
+
const {
|
|
2243
|
+
centeredSlides,
|
|
2244
|
+
initialSlide
|
|
2245
|
+
} = params;
|
|
2246
|
+
const swiperDataOldActiveIndex = slidesEl.children[swiper.activeIndex].getAttribute('data-swiper-slide-index');
|
|
2247
|
+
swiper.allowSlidePrev = true;
|
|
2248
|
+
swiper.allowSlideNext = true;
|
|
2249
|
+
let slidesPerView = params.slidesPerView;
|
|
2250
|
+
if (slidesPerView === 'auto') {
|
|
2251
|
+
slidesPerView = swiper.slidesPerViewDynamic();
|
|
2252
|
+
} else {
|
|
2253
|
+
slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
|
|
2254
|
+
if (centeredSlides && slidesPerView % 2 === 0) {
|
|
2255
|
+
slidesPerView = slidesPerView + 1;
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
|
|
2259
|
+
let loopedSlides = centeredSlides ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup;
|
|
2260
|
+
if (loopedSlides % slidesPerGroup !== 0) {
|
|
2261
|
+
loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
|
|
2262
|
+
}
|
|
2263
|
+
loopedSlides += params.loopAdditionalSlides;
|
|
2264
|
+
swiper.loopedSlides = loopedSlides;
|
|
2265
|
+
if (slides.length < slidesPerView + loopedSlides || swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) {
|
|
2266
|
+
showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');
|
|
2267
|
+
}
|
|
2268
|
+
const isNext = direction === 'next' || !direction;
|
|
2269
|
+
const isPrev = direction === 'prev' || !direction;
|
|
2270
|
+
let numberOfSlidesNeedClone = [];
|
|
2271
|
+
let slidesIndex = [];
|
|
2272
|
+
for (let i = 0; i < slidesEl.children.length; i++) {
|
|
2273
|
+
slidesIndex.push(slidesEl.children[i].getAttribute('data-swiper-slide-index'));
|
|
2274
|
+
}
|
|
2275
|
+
if (isPrev) {
|
|
2276
|
+
for (let i = targetSlideIndex; i < slidesEl.children.length; i++) {
|
|
2277
|
+
numberOfSlidesNeedClone.push(i);
|
|
2278
|
+
}
|
|
2279
|
+
} else if (isNext) {
|
|
2280
|
+
for (let i = 0; i < slidesPerView - (slidesEl.children.length - targetSlideIndex); i++) {
|
|
2281
|
+
numberOfSlidesNeedClone.push(i);
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
const cols = slides.length;
|
|
2285
|
+
const isInitialOverflow = initial && cols - initialSlide < slidesPerView && !centeredSlides;
|
|
2286
|
+
isInitialOverflow ? initialSlide : swiper.activeIndex;
|
|
2287
|
+
if (typeof activeSlideIndex === 'undefined') {
|
|
2288
|
+
activeSlideIndex = swiper.getSlideIndex(slides.find(el => el.classList.contains(params.slideActiveClass)));
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
// Tạo DocumentFragment để chứa các slide clone
|
|
2292
|
+
const cloneFragment = document.createDocumentFragment();
|
|
2293
|
+
|
|
2294
|
+
// Clone các slide theo numberOfSlidesNeedClone (đã đảo ngược) và thêm vào fragment
|
|
2295
|
+
(isNext ? numberOfSlidesNeedClone : numberOfSlidesNeedClone.reverse()).forEach(index => {
|
|
2296
|
+
if (slides[index]) {
|
|
2297
|
+
const originalSlide = slides[index];
|
|
2298
|
+
const clonedSlide = originalSlide.cloneNode(true);
|
|
2299
|
+
|
|
2300
|
+
// Đánh dấu slide clone
|
|
2301
|
+
clonedSlide.setAttribute('data-swiper-clone', 'true');
|
|
2302
|
+
clonedSlide.classList.add('swiper-slide-clone');
|
|
2303
|
+
|
|
2304
|
+
// Thêm clone vào fragment
|
|
2305
|
+
cloneFragment.appendChild(clonedSlide);
|
|
2306
|
+
}
|
|
2307
|
+
});
|
|
2308
|
+
if (isPrev) {
|
|
2309
|
+
numberOfSlidesNeedClone.forEach(index => {
|
|
2310
|
+
const originalSlide = slides[index];
|
|
2311
|
+
originalSlide.swiperLoopMoveDOM = true;
|
|
2312
|
+
slidesEl.prepend(originalSlide);
|
|
2313
|
+
originalSlide.swiperLoopMoveDOM = false;
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
if (isNext) {
|
|
2317
|
+
numberOfSlidesNeedClone.forEach(index => {
|
|
2318
|
+
const originalSlide = slides[index];
|
|
2319
|
+
originalSlide.swiperLoopMoveDOM = true;
|
|
2320
|
+
slidesEl.append(originalSlide);
|
|
2321
|
+
originalSlide.swiperLoopMoveDOM = false;
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
// Sắp xếp cloneFragment theo data-swiper-slide-index tăng dần
|
|
2326
|
+
const clonedSlides = Array.from(cloneFragment.children);
|
|
2327
|
+
clonedSlides.sort((a, b) => {
|
|
2328
|
+
const indexA = parseInt(a.getAttribute('data-swiper-slide-index')) || 0;
|
|
2329
|
+
const indexB = parseInt(b.getAttribute('data-swiper-slide-index')) || 0;
|
|
2330
|
+
return indexA - indexB;
|
|
2331
|
+
});
|
|
2332
|
+
|
|
2333
|
+
// Xóa tất cả children cũ và thêm lại theo thứ tự đã sắp xếp
|
|
2334
|
+
cloneFragment.innerHTML = '';
|
|
2335
|
+
clonedSlides.forEach(slide => {
|
|
2336
|
+
cloneFragment.appendChild(slide);
|
|
2337
|
+
});
|
|
2338
|
+
|
|
2339
|
+
// Thêm fragment vào vị trí phù hợp
|
|
2340
|
+
if (isPrev) {
|
|
2341
|
+
// Nếu là prev, thêm fragment vào cuối slidesEl
|
|
2342
|
+
slidesEl.appendChild(cloneFragment);
|
|
2343
|
+
} else if (isNext) {
|
|
2344
|
+
// Nếu là next, thêm fragment vào đầu slidesEl
|
|
2345
|
+
slidesEl.insertBefore(cloneFragment, slidesEl.firstChild);
|
|
2346
|
+
}
|
|
2347
|
+
swiper.recalcSlides();
|
|
2348
|
+
swiper.updateSlides();
|
|
2349
|
+
|
|
2350
|
+
// Tìm slide có data-swiper-slide-index tương ứng
|
|
2351
|
+
let oldActiveIndex = null;
|
|
2352
|
+
for (let i = 0; i < slidesEl.children.length; i++) {
|
|
2353
|
+
const child = slidesEl.children[i];
|
|
2354
|
+
if (child.getAttribute('data-swiper-slide-index') === swiperDataOldActiveIndex) {
|
|
2355
|
+
oldActiveIndex = i;
|
|
2356
|
+
break;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
if (slideTo && oldActiveIndex !== swiper.activeIndex) {
|
|
2360
|
+
swiper.slideTo(oldActiveIndex, 0);
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
// Tìm vị trí slide cũ sau khi remove clone để set lại translate tạo hiệu ứng animate
|
|
2364
|
+
const skip = Math.min(swiper.params.slidesPerGroupSkip, newIndex);
|
|
2365
|
+
let snapIndex = skip + Math.floor((newIndex - skip) / swiper.params.slidesPerGroup);
|
|
2366
|
+
if (snapIndex >= swiper.snapGrid.length) snapIndex = swiper.snapGrid.length - 1;
|
|
2367
|
+
const translate = -swiper.snapGrid[snapIndex];
|
|
2368
|
+
if (translate === swiper.translate) {
|
|
2369
|
+
let oldActiveIndexAfterRemoveClone;
|
|
2370
|
+
for (let i = 0; i < slidesEl.children.length; i++) {
|
|
2371
|
+
const child = slidesEl.children[i];
|
|
2372
|
+
if (child.getAttribute('data-swiper-slide-index') === swiperDataOldActiveIndex) {
|
|
2373
|
+
oldActiveIndexAfterRemoveClone = i;
|
|
2374
|
+
break;
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
const skip = Math.min(swiper.params.slidesPerGroupSkip, oldActiveIndexAfterRemoveClone);
|
|
2378
|
+
let snapIndex = skip + Math.floor((oldActiveIndexAfterRemoveClone - skip) / swiper.params.slidesPerGroup);
|
|
2379
|
+
if (snapIndex >= swiper.snapGrid.length) snapIndex = swiper.snapGrid.length - 1;
|
|
2380
|
+
const oldTranslate = -swiper.snapGrid[snapIndex];
|
|
2381
|
+
let updateTranslate;
|
|
2382
|
+
if (oldTranslate === swiper.translate) {
|
|
2383
|
+
updateTranslate = swiper.snapGrid[snapIndex > 0 ? snapIndex - 1 : swiper.snapGrid.length - 1];
|
|
2384
|
+
} else {
|
|
2385
|
+
updateTranslate = oldTranslate;
|
|
2386
|
+
}
|
|
2387
|
+
swiper.setTranslate(updateTranslate);
|
|
2388
|
+
}
|
|
2389
|
+
// Remove slide clone ra khỏi slidesEl sau khi slideTo hoàn thành
|
|
2390
|
+
const cloneSlides = slidesEl.querySelectorAll('[data-swiper-clone="true"]');
|
|
2391
|
+
cloneSlides.forEach(cloneSlide => {
|
|
2392
|
+
if (cloneSlide.parentNode) {
|
|
2393
|
+
cloneSlide.parentNode.removeChild(cloneSlide);
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2396
|
+
swiper.recalcSlides();
|
|
2397
|
+
swiper.updateSlides();
|
|
2398
|
+
const targetDataIndex = Array.from(slidesEl.children).findIndex(el => el.getAttribute('data-swiper-slide-index') * 1 === targetData * 1);
|
|
2399
|
+
const oldDataIndex = Array.from(slidesEl.children).findIndex(el => el.getAttribute('data-swiper-slide-index') * 1 === oldActiveData * 1);
|
|
2400
|
+
const snapIndexNew = skip + Math.floor((targetDataIndex - skip) / swiper.params.slidesPerGroup);
|
|
2401
|
+
const snapIndexOld = skip + Math.floor((oldDataIndex - skip) / swiper.params.slidesPerGroup);
|
|
2402
|
+
if (slideTo && snapIndexNew === targetDataIndex) {
|
|
2403
|
+
const translateOld = -swiper.snapGrid[snapIndexOld > swiper.snapGrid.length - 1 ? snapIndexNew - 1 > swiper.snapGrid.length - 1 ? 0 : snapIndexNew - 1 : snapIndexOld];
|
|
2404
|
+
swiper.setTranslate(translateOld);
|
|
2405
|
+
}
|
|
2406
|
+
swiper.recalcSlides();
|
|
2407
|
+
swiper.updateSlides();
|
|
2408
|
+
swiper.allowSlidePrev = allowSlidePrev;
|
|
2409
|
+
swiper.allowSlideNext = allowSlideNext;
|
|
2410
|
+
swiper.emit('loopFixDot');
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2106
2413
|
function loopDestroy() {
|
|
2107
2414
|
const swiper = this;
|
|
2108
2415
|
const {
|
|
@@ -2129,6 +2436,7 @@ function loopDestroy() {
|
|
|
2129
2436
|
var loop = {
|
|
2130
2437
|
loopCreate,
|
|
2131
2438
|
loopFix,
|
|
2439
|
+
loopFixDot,
|
|
2132
2440
|
loopDestroy
|
|
2133
2441
|
};
|
|
2134
2442
|
|
|
@@ -3264,6 +3572,7 @@ var defaults = {
|
|
|
3264
3572
|
loopAddBlankSlides: true,
|
|
3265
3573
|
loopAdditionalSlides: 0,
|
|
3266
3574
|
loopPreventsSliding: true,
|
|
3575
|
+
isSneakPeekCenter: false,
|
|
3267
3576
|
// rewind
|
|
3268
3577
|
rewind: false,
|
|
3269
3578
|
// Swiping/no swiping
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as setInnerHTML}from"./utils.min.mjs";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","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function isObject(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!e.__swiper__}function extend(e,t){const i=["__proto__","constructor","prototype"];Object.keys(t).filter((e=>i.indexOf(e)<0)).forEach((i=>{void 0===e[i]?e[i]=t[i]:isObject(t[i])&&isObject(e[i])&&Object.keys(t[i]).length>0?t[i].__swiper__?e[i]=t[i]:extend(e[i],t[i]):e[i]=t[i]}))}function needsNavigation(e){return void 0===e&&(e={}),e.navigation&&void 0===e.navigation.nextEl&&void 0===e.navigation.prevEl}function needsPagination(e){return void 0===e&&(e={}),e.pagination&&void 0===e.pagination.el}function needsScrollbar(e){return void 0===e&&(e={}),e.scrollbar&&void 0===e.scrollbar.el}function uniqueClasses(e){void 0===e&&(e="");const t=e.split(" ").map((e=>e.trim())).filter((e=>!!e)),i=[];return t.forEach((e=>{i.indexOf(e)<0&&i.push(e)})),i.join(" ")}function attrToProp(e){return void 0===e&&(e=""),e.replace(/-[a-z]/g,(e=>e.toUpperCase().replace("-","")))}function wrapperClass(e){return void 0===e&&(e=""),e?e.includes("swiper-wrapper")?e:`swiper-wrapper ${e}`:"swiper-wrapper"}function updateSwiper(e){let{swiper:t,slides:i,passedParams:l,changedParams:n,nextEl:o,prevEl:r,scrollbarEl:s,paginationEl:a}=e;const d=n.filter((e=>"children"!==e&&"direction"!==e&&"wrapperClass"!==e)),{params:c,pagination:p,navigation:u,scrollbar:v,virtual:g,thumbs:b}=t;let f,w,
|
|
1
|
+
import{s as setInnerHTML}from"./utils.min.mjs";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","_isSneakPeekCenter","_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","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function isObject(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!e.__swiper__}function extend(e,t){const i=["__proto__","constructor","prototype"];Object.keys(t).filter((e=>i.indexOf(e)<0)).forEach((i=>{void 0===e[i]?e[i]=t[i]:isObject(t[i])&&isObject(e[i])&&Object.keys(t[i]).length>0?t[i].__swiper__?e[i]=t[i]:extend(e[i],t[i]):e[i]=t[i]}))}function needsNavigation(e){return void 0===e&&(e={}),e.navigation&&void 0===e.navigation.nextEl&&void 0===e.navigation.prevEl}function needsPagination(e){return void 0===e&&(e={}),e.pagination&&void 0===e.pagination.el}function needsScrollbar(e){return void 0===e&&(e={}),e.scrollbar&&void 0===e.scrollbar.el}function uniqueClasses(e){void 0===e&&(e="");const t=e.split(" ").map((e=>e.trim())).filter((e=>!!e)),i=[];return t.forEach((e=>{i.indexOf(e)<0&&i.push(e)})),i.join(" ")}function attrToProp(e){return void 0===e&&(e=""),e.replace(/-[a-z]/g,(e=>e.toUpperCase().replace("-","")))}function wrapperClass(e){return void 0===e&&(e=""),e?e.includes("swiper-wrapper")?e:`swiper-wrapper ${e}`:"swiper-wrapper"}function updateSwiper(e){let{swiper:t,slides:i,passedParams:l,changedParams:n,nextEl:o,prevEl:r,scrollbarEl:s,paginationEl:a}=e;const d=n.filter((e=>"children"!==e&&"direction"!==e&&"wrapperClass"!==e)),{params:c,pagination:p,navigation:u,scrollbar:v,virtual:g,thumbs:b}=t;let f,_,w,h,m,S,E,C;n.includes("thumbs")&&l.thumbs&&l.thumbs.swiper&&!l.thumbs.swiper.destroyed&&c.thumbs&&(!c.thumbs.swiper||c.thumbs.swiper.destroyed)&&(f=!0),n.includes("controller")&&l.controller&&l.controller.control&&c.controller&&!c.controller.control&&(_=!0),n.includes("pagination")&&l.pagination&&(l.pagination.el||a)&&(c.pagination||!1===c.pagination)&&p&&!p.el&&(w=!0),n.includes("scrollbar")&&l.scrollbar&&(l.scrollbar.el||s)&&(c.scrollbar||!1===c.scrollbar)&&v&&!v.el&&(h=!0),n.includes("navigation")&&l.navigation&&(l.navigation.prevEl||r)&&(l.navigation.nextEl||o)&&(c.navigation||!1===c.navigation)&&u&&!u.prevEl&&!u.nextEl&&(m=!0);const x=e=>{t[e]&&(t[e].destroy(),"navigation"===e?(t.isElement&&(t[e].prevEl.remove(),t[e].nextEl.remove()),c[e].prevEl=void 0,c[e].nextEl=void 0,t[e].prevEl=void 0,t[e].nextEl=void 0):(t.isElement&&t[e].el.remove(),c[e].el=void 0,t[e].el=void 0))};if(n.includes("loop")&&t.isElement&&(c.loop&&!l.loop?S=!0:!c.loop&&l.loop?E=!0:C=!0),d.forEach((e=>{if(isObject(c[e])&&isObject(l[e]))Object.assign(c[e],l[e]),"navigation"!==e&&"pagination"!==e&&"scrollbar"!==e||!("enabled"in l[e])||l[e].enabled||x(e);else{const t=l[e];!0!==t&&!1!==t||"navigation"!==e&&"pagination"!==e&&"scrollbar"!==e?c[e]=l[e]:!1===t&&x(e)}})),d.includes("controller")&&!_&&t.controller&&t.controller.control&&c.controller&&c.controller.control&&(t.controller.control=c.controller.control),n.includes("children")&&i&&g&&c.virtual.enabled?(g.slides=i,g.update(!0)):n.includes("virtual")&&g&&c.virtual.enabled&&(i&&(g.slides=i),g.update(!0)),n.includes("children")&&i&&c.loop&&(C=!0),f){b.init()&&b.update(!0)}_&&(t.controller.control=c.controller.control),w&&(!t.isElement||a&&"string"!=typeof a||(a=document.createElement("div"),a.classList.add("swiper-pagination"),a.part.add("pagination"),t.el.appendChild(a)),a&&(c.pagination.el=a),p.init(),p.render(),p.update()),h&&(!t.isElement||s&&"string"!=typeof s||(s=document.createElement("div"),s.classList.add("swiper-scrollbar"),s.part.add("scrollbar"),t.el.appendChild(s)),s&&(c.scrollbar.el=s),v.init(),v.updateSize(),v.setTranslate()),m&&(t.isElement&&(o&&"string"!=typeof o||(o=document.createElement("div"),o.classList.add("swiper-button-next"),setInnerHTML(o,t.hostEl.constructor.nextButtonSvg),o.part.add("button-next"),t.el.appendChild(o)),r&&"string"!=typeof r||(r=document.createElement("div"),r.classList.add("swiper-button-prev"),setInnerHTML(r,t.hostEl.constructor.prevButtonSvg),r.part.add("button-prev"),t.el.appendChild(r))),o&&(c.navigation.nextEl=o),r&&(c.navigation.prevEl=r),u.init(),u.update()),n.includes("allowSlideNext")&&(t.allowSlideNext=l.allowSlideNext),n.includes("allowSlidePrev")&&(t.allowSlidePrev=l.allowSlidePrev),n.includes("direction")&&t.changeDirection(l.direction,!1),(S||C)&&t.loopDestroy(),(E||C)&&t.loopCreate(),t.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};
|
|
2
2
|
//# sourceMappingURL=update-swiper.min.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-swiper.mjs.mjs","names":["setInnerHTML","paramsList","isObject","o","constructor","Object","prototype","toString","call","slice","__swiper__","extend","target","src","noExtend","keys","filter","key","indexOf","forEach","length","needsNavigation","params","navigation","nextEl","prevEl","needsPagination","pagination","el","needsScrollbar","scrollbar","uniqueClasses","classNames","classes","split","map","c","trim","unique","push","join","attrToProp","attrName","replace","l","toUpperCase","wrapperClass","className","includes","updateSwiper","_ref","swiper","slides","passedParams","changedParams","scrollbarEl","paginationEl","updateParams","currentParams","virtual","thumbs","needThumbsInit","needControllerInit","needPaginationInit","needScrollbarInit","needNavigationInit","loopNeedDestroy","loopNeedEnable","loopNeedReloop","destroyed","controller","control","destroyModule","mod","destroy","isElement","remove","undefined","loop","assign","enabled","newValue","update","init","document","createElement","classList","add","part","appendChild","render","updateSize","setTranslate","hostEl","nextButtonSvg","prevButtonSvg","allowSlideNext","allowSlidePrev","changeDirection","direction","loopDestroy","loopCreate"],"sources":["0"],"mappings":"YAAcA,iBAAoB,kBAGlC,MAAMC,WAAa,CAAC,eAAgB,eAAgB,mBAAoB,UAAW,OAAQ,aAAc,iBAAkB,wBAAyB,oBAAqB,eAAgB,SAAU,UAAW,uBAAwB,iBAAkB,SAAU,oBAAqB,WAAY,SAAU,UAAW,iCAAkC,YAAa,MAAO,sBAAuB,sBAAuB,YAAa,cAAe,iBAAkB,mBAAoB,UAAW,cAAe,kBAAmB,gBAAiB,iBAAkB,0BAA2B,QAAS,kBAAmB,sBAAuB,sBAAuB,kBAAmB,wBAAyB,sBAAuB,qBAAsB,sBAAuB,4BAA6B,iBAAkB,eAAgB,aAAc,aAAc,gBAAiB,eAAgB,cAAe,kBAAmB,eAAgB,gBAAiB,iBAAkB,aAAc,2BAA4B,2BAA4B,gCAAiC,sBAAuB,oBAAqB,cAAe,mBAAoB,uBAAwB,cAAe,gBAAiB,2BAA4B,uBAAwB,QAAS,uBAAwB,qBAAsB,sBAAuB,UAAW,kBAAmB,kBAAmB,gBAAiB,aAAc,iBAAkB,oBAAqB,mBAAoB,yBAA0B,aAAc,mBAAoB,oBAAqB,yBAA0B,iBAAkB,iBAAkB,kBAAmB,eAAgB,qBAAsB,sBAAuB,qBAAsB,WAAY,iBAAkB,
|
|
1
|
+
{"version":3,"file":"update-swiper.mjs.mjs","names":["setInnerHTML","paramsList","isObject","o","constructor","Object","prototype","toString","call","slice","__swiper__","extend","target","src","noExtend","keys","filter","key","indexOf","forEach","length","needsNavigation","params","navigation","nextEl","prevEl","needsPagination","pagination","el","needsScrollbar","scrollbar","uniqueClasses","classNames","classes","split","map","c","trim","unique","push","join","attrToProp","attrName","replace","l","toUpperCase","wrapperClass","className","includes","updateSwiper","_ref","swiper","slides","passedParams","changedParams","scrollbarEl","paginationEl","updateParams","currentParams","virtual","thumbs","needThumbsInit","needControllerInit","needPaginationInit","needScrollbarInit","needNavigationInit","loopNeedDestroy","loopNeedEnable","loopNeedReloop","destroyed","controller","control","destroyModule","mod","destroy","isElement","remove","undefined","loop","assign","enabled","newValue","update","init","document","createElement","classList","add","part","appendChild","render","updateSize","setTranslate","hostEl","nextButtonSvg","prevButtonSvg","allowSlideNext","allowSlidePrev","changeDirection","direction","loopDestroy","loopCreate"],"sources":["0"],"mappings":"YAAcA,iBAAoB,kBAGlC,MAAMC,WAAa,CAAC,eAAgB,eAAgB,mBAAoB,UAAW,OAAQ,aAAc,iBAAkB,wBAAyB,oBAAqB,eAAgB,SAAU,UAAW,uBAAwB,iBAAkB,SAAU,oBAAqB,WAAY,SAAU,UAAW,iCAAkC,YAAa,MAAO,sBAAuB,sBAAuB,YAAa,cAAe,iBAAkB,mBAAoB,UAAW,cAAe,kBAAmB,gBAAiB,qBAAsB,iBAAkB,0BAA2B,QAAS,kBAAmB,sBAAuB,sBAAuB,kBAAmB,wBAAyB,sBAAuB,qBAAsB,sBAAuB,4BAA6B,iBAAkB,eAAgB,aAAc,aAAc,gBAAiB,eAAgB,cAAe,kBAAmB,eAAgB,gBAAiB,iBAAkB,aAAc,2BAA4B,2BAA4B,gCAAiC,sBAAuB,oBAAqB,cAAe,mBAAoB,uBAAwB,cAAe,gBAAiB,2BAA4B,uBAAwB,QAAS,uBAAwB,qBAAsB,sBAAuB,UAAW,kBAAmB,kBAAmB,gBAAiB,aAAc,iBAAkB,oBAAqB,mBAAoB,yBAA0B,aAAc,mBAAoB,oBAAqB,yBAA0B,iBAAkB,iBAAkB,kBAAmB,eAAgB,qBAAsB,sBAAu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nBC,GAA4B,iBAAXA,IACpBA,EAAS2D,SAASC,cAAc,OAChC5D,EAAO6D,UAAUC,IAAI,sBACrBvF,aAAayB,EAAQ0B,EAAO0C,OAAOzF,YAAY2F,eAC/CtE,EAAO+D,KAAKD,IAAI,eAChBpC,EAAOvB,GAAG6D,YAAYhE,KAGtBD,IAAQkC,EAAcnC,WAAWC,OAASA,GAC1CC,IAAQiC,EAAcnC,WAAWE,OAASA,GAC9CF,EAAW4D,OACX5D,EAAW2D,UAET5B,EAAcN,SAAS,oBACzBG,EAAO6C,eAAiB3C,EAAa2C,gBAEnC1C,EAAcN,SAAS,oBACzBG,EAAO8C,eAAiB5C,EAAa4C,gBAEnC3C,EAAcN,SAAS,cACzBG,EAAO+C,gBAAgB7C,EAAa8C,WAAW,IAE7CjC,GAAmBE,IACrBjB,EAAOiD,eAELjC,GAAkBC,IACpBjB,EAAOkD,aAETlD,EAAO+B,QACT,QAESxD,qBAAsBG,oBAAqBY,gBAAiBV,mBAAoBpB,YAAaT,cAAemB,qBAAsBpB,gBAAiBgD,kBAAmBH"}
|
package/shared/update-swiper.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as setInnerHTML } from './utils.mjs';
|
|
2
2
|
|
|
3
3
|
/* underscore in name -> watch for changes */
|
|
4
|
-
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',
|
|
4
|
+
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', '_isSneakPeekCenter', '_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',
|
|
5
5
|
// modules
|
|
6
6
|
'a11y', '_autoplay', '_controller', 'coverflowEffect', 'cubeEffect', 'fadeEffect', 'flipEffect', 'creativeEffect', 'cardsEffect', 'hashNavigation', 'history', 'keyboard', 'mousewheel', '_navigation', '_pagination', 'parallax', '_scrollbar', '_thumbs', 'virtual', 'zoom', 'control'];
|
|
7
7
|
|
package/shared/utils.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as getWindow,g as getDocument}from"./ssr-window.esm.min.mjs";function classesToTokens(e){return void 0===e&&(e=""),e.trim().split(" ").filter((e=>!!e.trim()))}function deleteProps(e){const t=e;Object.keys(t).forEach((e=>{try{t[e]=null}catch(e){}try{delete t[e]}catch(e){}}))}function nextTick(e,t){return void 0===t&&(t=0),setTimeout(e,t)}function now(){return Date.now()}function getComputedStyle(e){const t=getWindow();let n;return t.getComputedStyle&&(n=t.getComputedStyle(e,null)),!n&&e.currentStyle&&(n=e.currentStyle),n||(n=e.style),n}function getTranslate(e,t){void 0===t&&(t="x");const n=getWindow();let r,o,s;const l=getComputedStyle(e);return n.WebKitCSSMatrix?(o=l.transform||l.webkitTransform,o.split(",").length>6&&(o=o.split(", ").map((e=>e.replace(",","."))).join(", ")),s=new n.WebKitCSSMatrix("none"===o?"":o)):(s=l.MozTransform||l.OTransform||l.MsTransform||l.msTransform||l.transform||l.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=s.toString().split(",")),"x"===t&&(o=n.WebKitCSSMatrix?s.m41:16===r.length?parseFloat(r[12]):parseFloat(r[4])),"y"===t&&(o=n.WebKitCSSMatrix?s.m42:16===r.length?parseFloat(r[13]):parseFloat(r[5])),o||0}function isObject(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)}function isNode(e){return"undefined"!=typeof window&&void 0!==window.HTMLElement?e instanceof HTMLElement:e&&(1===e.nodeType||11===e.nodeType)}function extend(){const e=Object(arguments.length<=0?void 0:arguments[0]),t=["__proto__","constructor","prototype"];for(let n=1;n<arguments.length;n+=1){const r=n<0||arguments.length<=n?void 0:arguments[n];if(null!=r&&!isNode(r)){const n=Object.keys(Object(r)).filter((e=>t.indexOf(e)<0));for(let t=0,o=n.length;t<o;t+=1){const o=n[t],s=Object.getOwnPropertyDescriptor(r,o);void 0!==s&&s.enumerable&&(isObject(e[o])&&isObject(r[o])?r[o].__swiper__?e[o]=r[o]:extend(e[o],r[o]):!isObject(e[o])&&isObject(r[o])?(e[o]={},r[o].__swiper__?e[o]=r[o]:extend(e[o],r[o])):e[o]=r[o])}}}return e}function setCSSProperty(e,t,n){e.style.setProperty(t,n)}function animateCSSModeScroll(e){let{swiper:t,targetPosition:n,side:r}=e;const o=getWindow(),s=-t.translate;let l,i=null;const a=t.params.speed;t.wrapperEl.style.scrollSnapType="none",o.cancelAnimationFrame(t.cssModeFrameID);const c=n>s?"next":"prev",m=(e,t)=>"next"===c&&e>=t||"prev"===c&&e<=t,u=()=>{l=(new Date).getTime(),null===i&&(i=l);const e=Math.max(Math.min((l-i)/a,1),0),c=.5-Math.cos(e*Math.PI)/2;let d=s+c*(n-s);if(m(d,n)&&(d=n),t.wrapperEl.scrollTo({[r]:d}),m(d,n))return t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout((()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[r]:d})})),void o.cancelAnimationFrame(t.cssModeFrameID);t.cssModeFrameID=o.requestAnimationFrame(u)};u()}function getSlideTransformEl(e){return e.querySelector(".swiper-slide-transform")||e.shadowRoot&&e.shadowRoot.querySelector(".swiper-slide-transform")||e}function elementChildren(e,t){void 0===t&&(t="");const n=getWindow(),r=[...e.children];return n.HTMLSlotElement&&e instanceof HTMLSlotElement&&r.push(...e.assignedElements()),t?r.filter((e=>e.matches(t))):r}function elementIsChildOfSlot(e,t){const n=[t];for(;n.length>0;){const t=n.shift();if(e===t)return!0;n.push(...t.children,...t.shadowRoot?t.shadowRoot.children:[],...t.assignedElements?t.assignedElements():[])}}function elementIsChildOf(e,t){const n=getWindow();let r=t.contains(e);if(!r&&n.HTMLSlotElement&&t instanceof HTMLSlotElement){r=[...t.assignedElements()].includes(e),r||(r=elementIsChildOfSlot(e,t))}return r}function showWarning(e){try{return void console.warn(e)}catch(e){}}function createElement(e,t){void 0===t&&(t=[]);const n=document.createElement(e);return n.classList.add(...Array.isArray(t)?t:classesToTokens(t)),n}function elementOffset(e){const t=getWindow(),n=getDocument(),r=e.getBoundingClientRect(),o=n.body,s=e.clientTop||o.clientTop||0,l=e.clientLeft||o.clientLeft||0,i=e===t?t.scrollY:e.scrollTop,a=e===t?t.scrollX:e.scrollLeft;return{top:r.top+i-s,left:r.left+a-l}}function elementPrevAll(e,t){const n=[];for(;e.previousElementSibling;){const r=e.previousElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}function elementNextAll(e,t){const n=[];for(;e.nextElementSibling;){const r=e.nextElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}function elementStyle(e,t){return getWindow().getComputedStyle(e,null).getPropertyValue(t)}function elementIndex(e){let t,n=e;if(n){for(t=0;null!==(n=n.previousSibling);)1===n.nodeType&&(t+=1);return t}}function elementParents(e,t){const n=[];let r=e.parentElement;for(;r;)t?r.matches(t)&&n.push(r):n.push(r),r=r.parentElement;return n}function elementTransitionEnd(e,t){t&&e.addEventListener("transitionend",(function n(r){r.target===e&&(t.call(e,r),e.removeEventListener("transitionend",n))}))}function elementOuterSize(e,t,n){const r=getWindow();return n?e["width"===t?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(e,null).getPropertyValue("width"===t?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(e,null).getPropertyValue("width"===t?"margin-left":"margin-bottom")):e.offsetWidth}function makeElementsArray(e){return(Array.isArray(e)?e:[e]).filter((e=>!!e))}function getRotateFix(e){return t=>Math.abs(t)>0&&e.browser&&e.browser.need3dFix&&Math.abs(t)%90==0?t+.001:t}function setInnerHTML(e,t){void 0===t&&(t=""),"undefined"!=typeof trustedTypes?e.innerHTML=trustedTypes.createPolicy("html",{createHTML:e=>e}).createHTML(t):e.innerHTML=t}export{setCSSProperty as a,elementParents as b,createElement as c,elementOffset as d,elementChildren as e,now as f,getSlideTransformEl as g,
|
|
1
|
+
import{a as getWindow,g as getDocument}from"./ssr-window.esm.min.mjs";function classesToTokens(e){return void 0===e&&(e=""),e.trim().split(" ").filter((e=>!!e.trim()))}function deleteProps(e){const t=e;Object.keys(t).forEach((e=>{try{t[e]=null}catch(e){}try{delete t[e]}catch(e){}}))}function nextTick(e,t){return void 0===t&&(t=0),setTimeout(e,t)}function now(){return Date.now()}function getComputedStyle(e){const t=getWindow();let n;return t.getComputedStyle&&(n=t.getComputedStyle(e,null)),!n&&e.currentStyle&&(n=e.currentStyle),n||(n=e.style),n}function getTranslate(e,t){void 0===t&&(t="x");const n=getWindow();let r,o,s;const l=getComputedStyle(e);return n.WebKitCSSMatrix?(o=l.transform||l.webkitTransform,o.split(",").length>6&&(o=o.split(", ").map((e=>e.replace(",","."))).join(", ")),s=new n.WebKitCSSMatrix("none"===o?"":o)):(s=l.MozTransform||l.OTransform||l.MsTransform||l.msTransform||l.transform||l.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=s.toString().split(",")),"x"===t&&(o=n.WebKitCSSMatrix?s.m41:16===r.length?parseFloat(r[12]):parseFloat(r[4])),"y"===t&&(o=n.WebKitCSSMatrix?s.m42:16===r.length?parseFloat(r[13]):parseFloat(r[5])),o||0}function isObject(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)}function isNode(e){return"undefined"!=typeof window&&void 0!==window.HTMLElement?e instanceof HTMLElement:e&&(1===e.nodeType||11===e.nodeType)}function extend(){const e=Object(arguments.length<=0?void 0:arguments[0]),t=["__proto__","constructor","prototype"];for(let n=1;n<arguments.length;n+=1){const r=n<0||arguments.length<=n?void 0:arguments[n];if(null!=r&&!isNode(r)){const n=Object.keys(Object(r)).filter((e=>t.indexOf(e)<0));for(let t=0,o=n.length;t<o;t+=1){const o=n[t],s=Object.getOwnPropertyDescriptor(r,o);void 0!==s&&s.enumerable&&(isObject(e[o])&&isObject(r[o])?r[o].__swiper__?e[o]=r[o]:extend(e[o],r[o]):!isObject(e[o])&&isObject(r[o])?(e[o]={},r[o].__swiper__?e[o]=r[o]:extend(e[o],r[o])):e[o]=r[o])}}}return e}function setCSSProperty(e,t,n){e.style.setProperty(t,n)}function animateCSSModeScroll(e){let{swiper:t,targetPosition:n,side:r}=e;const o=getWindow(),s=-t.translate;let l,i=null;const a=t.params.speed;t.wrapperEl.style.scrollSnapType="none",o.cancelAnimationFrame(t.cssModeFrameID);const c=n>s?"next":"prev",m=(e,t)=>"next"===c&&e>=t||"prev"===c&&e<=t,u=()=>{l=(new Date).getTime(),null===i&&(i=l);const e=Math.max(Math.min((l-i)/a,1),0),c=.5-Math.cos(e*Math.PI)/2;let d=s+c*(n-s);if(m(d,n)&&(d=n),t.wrapperEl.scrollTo({[r]:d}),m(d,n))return t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout((()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[r]:d})})),void o.cancelAnimationFrame(t.cssModeFrameID);t.cssModeFrameID=o.requestAnimationFrame(u)};u()}function getSlideTransformEl(e){return e.querySelector(".swiper-slide-transform")||e.shadowRoot&&e.shadowRoot.querySelector(".swiper-slide-transform")||e}function elementChildren(e,t){void 0===t&&(t="");const n=getWindow(),r=[...e.children];return n.HTMLSlotElement&&e instanceof HTMLSlotElement&&r.push(...e.assignedElements()),t?r.filter((e=>e.matches(t))):r}function elementIsChildOfSlot(e,t){const n=[t];for(;n.length>0;){const t=n.shift();if(e===t)return!0;n.push(...t.children,...t.shadowRoot?t.shadowRoot.children:[],...t.assignedElements?t.assignedElements():[])}}function elementIsChildOf(e,t){const n=getWindow();let r=t.contains(e);if(!r&&n.HTMLSlotElement&&t instanceof HTMLSlotElement){r=[...t.assignedElements()].includes(e),r||(r=elementIsChildOfSlot(e,t))}return r}function showWarning(e){try{return void console.warn(e)}catch(e){}}function createElement(e,t){void 0===t&&(t=[]);const n=document.createElement(e);return n.classList.add(...Array.isArray(t)?t:classesToTokens(t)),n}function elementOffset(e){const t=getWindow(),n=getDocument(),r=e.getBoundingClientRect(),o=n.body,s=e.clientTop||o.clientTop||0,l=e.clientLeft||o.clientLeft||0,i=e===t?t.scrollY:e.scrollTop,a=e===t?t.scrollX:e.scrollLeft;return{top:r.top+i-s,left:r.left+a-l}}function elementPrevAll(e,t){const n=[];for(;e.previousElementSibling;){const r=e.previousElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}function elementNextAll(e,t){const n=[];for(;e.nextElementSibling;){const r=e.nextElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}function elementStyle(e,t){return getWindow().getComputedStyle(e,null).getPropertyValue(t)}function elementIndex(e){let t,n=e;if(n){for(t=0;null!==(n=n.previousSibling);)1===n.nodeType&&(t+=1);return t}}function elementParents(e,t){const n=[];let r=e.parentElement;for(;r;)t?r.matches(t)&&n.push(r):n.push(r),r=r.parentElement;return n}function elementTransitionEnd(e,t){t&&e.addEventListener("transitionend",(function n(r){r.target===e&&(t.call(e,r),e.removeEventListener("transitionend",n))}))}function elementOuterSize(e,t,n){const r=getWindow();return n?e["width"===t?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(e,null).getPropertyValue("width"===t?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(e,null).getPropertyValue("width"===t?"margin-left":"margin-bottom")):e.offsetWidth}function makeElementsArray(e){return(Array.isArray(e)?e:[e]).filter((e=>!!e))}function getRotateFix(e){return t=>Math.abs(t)>0&&e.browser&&e.browser.need3dFix&&Math.abs(t)%90==0?t+.001:t}function setInnerHTML(e,t){void 0===t&&(t=""),"undefined"!=typeof trustedTypes?e.innerHTML=trustedTypes.createPolicy("html",{createHTML:e=>e}).createHTML(t):e.innerHTML=t}export{setCSSProperty as a,elementParents as b,createElement as c,elementOffset as d,elementChildren as e,now as f,getSlideTransformEl as g,elementIndex as h,elementOuterSize 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};
|
|
2
2
|
//# sourceMappingURL=utils.min.mjs.map
|