@bigbinary/neeto-site-blocks 1.10.1 → 1.10.2
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/dist/index.cjs.js +206 -1326
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +206 -1326
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -16324,7 +16324,7 @@ var PageNavigation = function PageNavigation(_ref) {
|
|
|
16324
16324
|
}));
|
|
16325
16325
|
};
|
|
16326
16326
|
|
|
16327
|
-
var Pagination
|
|
16327
|
+
var Pagination = function Pagination(_ref) {
|
|
16328
16328
|
var swiper = _ref.swiper,
|
|
16329
16329
|
_ref$design = _ref.design,
|
|
16330
16330
|
design = _ref$design === void 0 ? {} : _ref$design,
|
|
@@ -16970,16 +16970,6 @@ function elementParents(el, selector) {
|
|
|
16970
16970
|
}
|
|
16971
16971
|
return parents;
|
|
16972
16972
|
}
|
|
16973
|
-
function elementTransitionEnd(el, callback) {
|
|
16974
|
-
function fireCallBack(e) {
|
|
16975
|
-
if (e.target !== el) return;
|
|
16976
|
-
callback.call(el, e);
|
|
16977
|
-
el.removeEventListener('transitionend', fireCallBack);
|
|
16978
|
-
}
|
|
16979
|
-
if (callback) {
|
|
16980
|
-
el.addEventListener('transitionend', fireCallBack);
|
|
16981
|
-
}
|
|
16982
|
-
}
|
|
16983
16973
|
function elementOuterSize(el, size, includeMargins) {
|
|
16984
16974
|
const window = getWindow();
|
|
16985
16975
|
if (includeMargins) {
|
|
@@ -40563,6 +40553,105 @@ var FooterWithLinks = function FooterWithLinks(_ref) {
|
|
|
40563
40553
|
}, otherProps), copyrightText));
|
|
40564
40554
|
};
|
|
40565
40555
|
|
|
40556
|
+
var GalleryClassic = function GalleryClassic(_ref) {
|
|
40557
|
+
var configurations = _ref.configurations,
|
|
40558
|
+
_ref$className = _ref.className,
|
|
40559
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
40560
|
+
id = _ref.id,
|
|
40561
|
+
disableButtonAndLinks = _ref.disableButtonAndLinks,
|
|
40562
|
+
image = _ref.image;
|
|
40563
|
+
var _useState = React.useState(null),
|
|
40564
|
+
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
40565
|
+
swiper = _useState2[0],
|
|
40566
|
+
setSwiper = _useState2[1];
|
|
40567
|
+
var properties = configurations.properties,
|
|
40568
|
+
design = configurations.design;
|
|
40569
|
+
var _properties$content = properties.content,
|
|
40570
|
+
title = _properties$content.title,
|
|
40571
|
+
description = _properties$content.description,
|
|
40572
|
+
enableAnimation = properties.enableAnimation,
|
|
40573
|
+
_properties$images = properties.images,
|
|
40574
|
+
images = _properties$images === void 0 ? [] : _properties$images,
|
|
40575
|
+
src = properties.backgroundImage.src;
|
|
40576
|
+
var baseClasses = "grid grid-cols-12 items-center gap-y-8";
|
|
40577
|
+
return /*#__PURE__*/React__default["default"].createElement(BlockWrapper, {
|
|
40578
|
+
className: className,
|
|
40579
|
+
enableAnimation: enableAnimation,
|
|
40580
|
+
id: id,
|
|
40581
|
+
backgroundImage: mergeLeft({
|
|
40582
|
+
src: src
|
|
40583
|
+
}, design.backgroundImage),
|
|
40584
|
+
design: design.body,
|
|
40585
|
+
nestedClassName: baseClasses
|
|
40586
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40587
|
+
className: "col-span-12 col-start-1 sm:col-span-6 sm:col-start-4"
|
|
40588
|
+
}, /*#__PURE__*/React__default["default"].createElement(Typography$1, {
|
|
40589
|
+
disableButtonAndLinks: disableButtonAndLinks,
|
|
40590
|
+
isTitle: true,
|
|
40591
|
+
component: "h3",
|
|
40592
|
+
id: "gallery-classic-title",
|
|
40593
|
+
style: design.title
|
|
40594
|
+
}, title), /*#__PURE__*/React__default["default"].createElement(Typography$1, {
|
|
40595
|
+
disableButtonAndLinks: disableButtonAndLinks,
|
|
40596
|
+
id: "gallery-classic-description",
|
|
40597
|
+
style: design.description
|
|
40598
|
+
}, description)), /*#__PURE__*/React__default["default"].createElement(ArrowButton, {
|
|
40599
|
+
isStart: true,
|
|
40600
|
+
Icon: ArrowLeft$1,
|
|
40601
|
+
className: "hidden sm:flex",
|
|
40602
|
+
design: design.navigationButtons,
|
|
40603
|
+
onClick: function onClick() {
|
|
40604
|
+
return swiper === null || swiper === void 0 ? void 0 : swiper.slidePrev();
|
|
40605
|
+
}
|
|
40606
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40607
|
+
className: "ns-gallery-with-multiple-images col-span-10 col-start-2"
|
|
40608
|
+
}, /*#__PURE__*/React__default["default"].createElement(Swiper, {
|
|
40609
|
+
loop: true,
|
|
40610
|
+
breakpointsBase: "container",
|
|
40611
|
+
pagination: {
|
|
40612
|
+
clickable: true
|
|
40613
|
+
},
|
|
40614
|
+
slidesPerView: 1,
|
|
40615
|
+
spaceBetween: 10,
|
|
40616
|
+
breakpoints: {
|
|
40617
|
+
640: {
|
|
40618
|
+
slidesPerView: 2,
|
|
40619
|
+
spaceBetween: 10
|
|
40620
|
+
}
|
|
40621
|
+
},
|
|
40622
|
+
onSwiper: setSwiper
|
|
40623
|
+
}, images.map(function (_ref2, index) {
|
|
40624
|
+
var src = _ref2.src,
|
|
40625
|
+
caption = _ref2.title,
|
|
40626
|
+
style = _ref2.style;
|
|
40627
|
+
return /*#__PURE__*/React__default["default"].createElement(SwiperSlide, {
|
|
40628
|
+
className: "swiper__wrapper",
|
|
40629
|
+
key: getUniqueKey(src, title, index)
|
|
40630
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
|
|
40631
|
+
disableButtonAndLinks: disableButtonAndLinks,
|
|
40632
|
+
image: image,
|
|
40633
|
+
index: index,
|
|
40634
|
+
src: src,
|
|
40635
|
+
alt: caption,
|
|
40636
|
+
className: "sliding-image",
|
|
40637
|
+
design: style,
|
|
40638
|
+
id: "gallery-classic-images-".concat(index, "-image"),
|
|
40639
|
+
title: caption,
|
|
40640
|
+
wrapperClassName: "h-full w-full"
|
|
40641
|
+
}));
|
|
40642
|
+
})), /*#__PURE__*/React__default["default"].createElement(Pagination, {
|
|
40643
|
+
swiper: swiper,
|
|
40644
|
+
design: design.button
|
|
40645
|
+
})), /*#__PURE__*/React__default["default"].createElement(ArrowButton, {
|
|
40646
|
+
Icon: ArrowRight$1,
|
|
40647
|
+
className: "hidden sm:flex",
|
|
40648
|
+
design: design.navigationButtons,
|
|
40649
|
+
onClick: function onClick() {
|
|
40650
|
+
return swiper === null || swiper === void 0 ? void 0 : swiper.slideNext();
|
|
40651
|
+
}
|
|
40652
|
+
}));
|
|
40653
|
+
};
|
|
40654
|
+
|
|
40566
40655
|
/* eslint-disable consistent-return */
|
|
40567
40656
|
function Keyboard(_ref) {
|
|
40568
40657
|
let {
|
|
@@ -40676,992 +40765,115 @@ function Keyboard(_ref) {
|
|
|
40676
40765
|
});
|
|
40677
40766
|
}
|
|
40678
40767
|
|
|
40679
|
-
|
|
40680
|
-
function Mousewheel(_ref) {
|
|
40768
|
+
function History(_ref) {
|
|
40681
40769
|
let {
|
|
40682
40770
|
swiper,
|
|
40683
40771
|
extendParams,
|
|
40684
|
-
on
|
|
40685
|
-
emit
|
|
40772
|
+
on
|
|
40686
40773
|
} = _ref;
|
|
40687
|
-
const window = getWindow();
|
|
40688
40774
|
extendParams({
|
|
40689
|
-
|
|
40775
|
+
history: {
|
|
40690
40776
|
enabled: false,
|
|
40691
|
-
|
|
40692
|
-
|
|
40693
|
-
|
|
40694
|
-
|
|
40695
|
-
eventsTarget: 'container',
|
|
40696
|
-
thresholdDelta: null,
|
|
40697
|
-
thresholdTime: null,
|
|
40698
|
-
noMousewheelClass: 'swiper-no-mousewheel'
|
|
40777
|
+
root: '',
|
|
40778
|
+
replaceState: false,
|
|
40779
|
+
key: 'slides',
|
|
40780
|
+
keepQuery: false
|
|
40699
40781
|
}
|
|
40700
40782
|
});
|
|
40701
|
-
|
|
40702
|
-
|
|
40783
|
+
let initialized = false;
|
|
40784
|
+
let paths = {};
|
|
40785
|
+
const slugify = text => {
|
|
40786
|
+
return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
|
|
40703
40787
|
};
|
|
40704
|
-
|
|
40705
|
-
|
|
40706
|
-
|
|
40707
|
-
|
|
40708
|
-
|
|
40709
|
-
|
|
40710
|
-
|
|
40711
|
-
const LINE_HEIGHT = 40;
|
|
40712
|
-
const PAGE_HEIGHT = 800;
|
|
40713
|
-
let sX = 0;
|
|
40714
|
-
let sY = 0; // spinX, spinY
|
|
40715
|
-
let pX = 0;
|
|
40716
|
-
let pY = 0; // pixelX, pixelY
|
|
40717
|
-
|
|
40718
|
-
// Legacy
|
|
40719
|
-
if ('detail' in e) {
|
|
40720
|
-
sY = e.detail;
|
|
40721
|
-
}
|
|
40722
|
-
if ('wheelDelta' in e) {
|
|
40723
|
-
sY = -e.wheelDelta / 120;
|
|
40724
|
-
}
|
|
40725
|
-
if ('wheelDeltaY' in e) {
|
|
40726
|
-
sY = -e.wheelDeltaY / 120;
|
|
40727
|
-
}
|
|
40728
|
-
if ('wheelDeltaX' in e) {
|
|
40729
|
-
sX = -e.wheelDeltaX / 120;
|
|
40730
|
-
}
|
|
40731
|
-
|
|
40732
|
-
// side scrolling on FF with DOMMouseScroll
|
|
40733
|
-
if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) {
|
|
40734
|
-
sX = sY;
|
|
40735
|
-
sY = 0;
|
|
40736
|
-
}
|
|
40737
|
-
pX = sX * PIXEL_STEP;
|
|
40738
|
-
pY = sY * PIXEL_STEP;
|
|
40739
|
-
if ('deltaY' in e) {
|
|
40740
|
-
pY = e.deltaY;
|
|
40741
|
-
}
|
|
40742
|
-
if ('deltaX' in e) {
|
|
40743
|
-
pX = e.deltaX;
|
|
40744
|
-
}
|
|
40745
|
-
if (e.shiftKey && !pX) {
|
|
40746
|
-
// if user scrolls with shift he wants horizontal scroll
|
|
40747
|
-
pX = pY;
|
|
40748
|
-
pY = 0;
|
|
40749
|
-
}
|
|
40750
|
-
if ((pX || pY) && e.deltaMode) {
|
|
40751
|
-
if (e.deltaMode === 1) {
|
|
40752
|
-
// delta in LINE units
|
|
40753
|
-
pX *= LINE_HEIGHT;
|
|
40754
|
-
pY *= LINE_HEIGHT;
|
|
40755
|
-
} else {
|
|
40756
|
-
// delta in PAGE units
|
|
40757
|
-
pX *= PAGE_HEIGHT;
|
|
40758
|
-
pY *= PAGE_HEIGHT;
|
|
40759
|
-
}
|
|
40760
|
-
}
|
|
40761
|
-
|
|
40762
|
-
// Fall-back if spin cannot be determined
|
|
40763
|
-
if (pX && !sX) {
|
|
40764
|
-
sX = pX < 1 ? -1 : 1;
|
|
40765
|
-
}
|
|
40766
|
-
if (pY && !sY) {
|
|
40767
|
-
sY = pY < 1 ? -1 : 1;
|
|
40788
|
+
const getPathValues = urlOverride => {
|
|
40789
|
+
const window = getWindow();
|
|
40790
|
+
let location;
|
|
40791
|
+
if (urlOverride) {
|
|
40792
|
+
location = new URL(urlOverride);
|
|
40793
|
+
} else {
|
|
40794
|
+
location = window.location;
|
|
40768
40795
|
}
|
|
40796
|
+
const pathArray = location.pathname.slice(1).split('/').filter(part => part !== '');
|
|
40797
|
+
const total = pathArray.length;
|
|
40798
|
+
const key = pathArray[total - 2];
|
|
40799
|
+
const value = pathArray[total - 1];
|
|
40769
40800
|
return {
|
|
40770
|
-
|
|
40771
|
-
|
|
40772
|
-
pixelX: pX,
|
|
40773
|
-
pixelY: pY
|
|
40801
|
+
key,
|
|
40802
|
+
value
|
|
40774
40803
|
};
|
|
40775
|
-
}
|
|
40776
|
-
|
|
40777
|
-
|
|
40778
|
-
swiper.
|
|
40779
|
-
|
|
40780
|
-
|
|
40781
|
-
|
|
40782
|
-
|
|
40783
|
-
|
|
40784
|
-
function animateSlider(newEvent) {
|
|
40785
|
-
if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) {
|
|
40786
|
-
// Prevent if delta of wheel scroll delta is below configured threshold
|
|
40787
|
-
return false;
|
|
40788
|
-
}
|
|
40789
|
-
if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) {
|
|
40790
|
-
// Prevent if time between scrolls is below configured threshold
|
|
40791
|
-
return false;
|
|
40792
|
-
}
|
|
40793
|
-
|
|
40794
|
-
// If the movement is NOT big enough and
|
|
40795
|
-
// if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider):
|
|
40796
|
-
// Don't go any further (avoid insignificant scroll movement).
|
|
40797
|
-
if (newEvent.delta >= 6 && now() - lastScrollTime < 60) {
|
|
40798
|
-
// Return false as a default
|
|
40799
|
-
return true;
|
|
40800
|
-
}
|
|
40801
|
-
// If user is scrolling towards the end:
|
|
40802
|
-
// If the slider hasn't hit the latest slide or
|
|
40803
|
-
// if the slider is a loop and
|
|
40804
|
-
// if the slider isn't moving right now:
|
|
40805
|
-
// Go to next slide and
|
|
40806
|
-
// emit a scroll event.
|
|
40807
|
-
// Else (the user is scrolling towards the beginning) and
|
|
40808
|
-
// if the slider hasn't hit the first slide or
|
|
40809
|
-
// if the slider is a loop and
|
|
40810
|
-
// if the slider isn't moving right now:
|
|
40811
|
-
// Go to prev slide and
|
|
40812
|
-
// emit a scroll event.
|
|
40813
|
-
if (newEvent.direction < 0) {
|
|
40814
|
-
if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) {
|
|
40815
|
-
swiper.slideNext();
|
|
40816
|
-
emit('scroll', newEvent.raw);
|
|
40817
|
-
}
|
|
40818
|
-
} else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) {
|
|
40819
|
-
swiper.slidePrev();
|
|
40820
|
-
emit('scroll', newEvent.raw);
|
|
40804
|
+
};
|
|
40805
|
+
const setHistory = (key, index) => {
|
|
40806
|
+
const window = getWindow();
|
|
40807
|
+
if (!initialized || !swiper.params.history.enabled) return;
|
|
40808
|
+
let location;
|
|
40809
|
+
if (swiper.params.url) {
|
|
40810
|
+
location = new URL(swiper.params.url);
|
|
40811
|
+
} else {
|
|
40812
|
+
location = window.location;
|
|
40821
40813
|
}
|
|
40822
|
-
|
|
40823
|
-
|
|
40824
|
-
|
|
40825
|
-
|
|
40826
|
-
|
|
40827
|
-
|
|
40828
|
-
|
|
40829
|
-
|
|
40830
|
-
if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) {
|
|
40831
|
-
// Return true to animate scroll on edges
|
|
40832
|
-
return true;
|
|
40833
|
-
}
|
|
40834
|
-
} else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) {
|
|
40835
|
-
// Return true to animate scroll on edges
|
|
40836
|
-
return true;
|
|
40814
|
+
const slide = swiper.slides[index];
|
|
40815
|
+
let value = slugify(slide.getAttribute('data-history'));
|
|
40816
|
+
if (swiper.params.history.root.length > 0) {
|
|
40817
|
+
let root = swiper.params.history.root;
|
|
40818
|
+
if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1);
|
|
40819
|
+
value = `${root}/${key ? `${key}/` : ''}${value}`;
|
|
40820
|
+
} else if (!location.pathname.includes(key)) {
|
|
40821
|
+
value = `${key ? `${key}/` : ''}${value}`;
|
|
40837
40822
|
}
|
|
40838
|
-
|
|
40839
|
-
|
|
40840
|
-
function handle(event) {
|
|
40841
|
-
let e = event;
|
|
40842
|
-
let disableParentSwiper = true;
|
|
40843
|
-
if (!swiper.enabled) return;
|
|
40844
|
-
|
|
40845
|
-
// Ignore event if the target or its parents have the swiper-no-mousewheel class
|
|
40846
|
-
if (event.target.closest(`.${swiper.params.mousewheel.noMousewheelClass}`)) return;
|
|
40847
|
-
const params = swiper.params.mousewheel;
|
|
40848
|
-
if (swiper.params.cssMode) {
|
|
40849
|
-
e.preventDefault();
|
|
40823
|
+
if (swiper.params.history.keepQuery) {
|
|
40824
|
+
value += location.search;
|
|
40850
40825
|
}
|
|
40851
|
-
|
|
40852
|
-
if (
|
|
40853
|
-
|
|
40826
|
+
const currentState = window.history.state;
|
|
40827
|
+
if (currentState && currentState.value === value) {
|
|
40828
|
+
return;
|
|
40854
40829
|
}
|
|
40855
|
-
|
|
40856
|
-
|
|
40857
|
-
|
|
40858
|
-
|
|
40859
|
-
const rtlFactor = swiper.rtlTranslate ? -1 : 1;
|
|
40860
|
-
const data = normalize(e);
|
|
40861
|
-
if (params.forceToAxis) {
|
|
40862
|
-
if (swiper.isHorizontal()) {
|
|
40863
|
-
if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true;
|
|
40864
|
-
} else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true;
|
|
40830
|
+
if (swiper.params.history.replaceState) {
|
|
40831
|
+
window.history.replaceState({
|
|
40832
|
+
value
|
|
40833
|
+
}, null, value);
|
|
40865
40834
|
} else {
|
|
40866
|
-
|
|
40867
|
-
|
|
40868
|
-
|
|
40869
|
-
|
|
40870
|
-
|
|
40871
|
-
|
|
40872
|
-
|
|
40873
|
-
|
|
40874
|
-
|
|
40875
|
-
|
|
40876
|
-
|
|
40877
|
-
|
|
40878
|
-
|
|
40879
|
-
// if the scroll positions is not on edge,
|
|
40880
|
-
// then the disableParentSwiper will be true.
|
|
40881
|
-
// if the scroll on edge positions,
|
|
40882
|
-
// then the disableParentSwiper will be false.
|
|
40883
|
-
disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate());
|
|
40884
|
-
if (disableParentSwiper && swiper.params.nested) e.stopPropagation();
|
|
40885
|
-
if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) {
|
|
40886
|
-
// Register the new event in a variable which stores the relevant data
|
|
40887
|
-
const newEvent = {
|
|
40888
|
-
time: now(),
|
|
40889
|
-
delta: Math.abs(delta),
|
|
40890
|
-
direction: Math.sign(delta),
|
|
40891
|
-
raw: event
|
|
40892
|
-
};
|
|
40893
|
-
|
|
40894
|
-
// Keep the most recent events
|
|
40895
|
-
if (recentWheelEvents.length >= 2) {
|
|
40896
|
-
recentWheelEvents.shift(); // only store the last N events
|
|
40897
|
-
}
|
|
40898
|
-
|
|
40899
|
-
const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;
|
|
40900
|
-
recentWheelEvents.push(newEvent);
|
|
40901
|
-
|
|
40902
|
-
// If there is at least one previous recorded event:
|
|
40903
|
-
// If direction has changed or
|
|
40904
|
-
// if the scroll is quicker than the previous one:
|
|
40905
|
-
// Animate the slider.
|
|
40906
|
-
// Else (this is the first time the wheel is moved):
|
|
40907
|
-
// Animate the slider.
|
|
40908
|
-
if (prevEvent) {
|
|
40909
|
-
if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) {
|
|
40910
|
-
animateSlider(newEvent);
|
|
40835
|
+
window.history.pushState({
|
|
40836
|
+
value
|
|
40837
|
+
}, null, value);
|
|
40838
|
+
}
|
|
40839
|
+
};
|
|
40840
|
+
const scrollToSlide = (speed, value, runCallbacks) => {
|
|
40841
|
+
if (value) {
|
|
40842
|
+
for (let i = 0, length = swiper.slides.length; i < length; i += 1) {
|
|
40843
|
+
const slide = swiper.slides[i];
|
|
40844
|
+
const slideHistory = slugify(slide.getAttribute('data-history'));
|
|
40845
|
+
if (slideHistory === value) {
|
|
40846
|
+
const index = swiper.getSlideIndex(slide);
|
|
40847
|
+
swiper.slideTo(index, speed, runCallbacks);
|
|
40911
40848
|
}
|
|
40912
|
-
} else {
|
|
40913
|
-
animateSlider(newEvent);
|
|
40914
|
-
}
|
|
40915
|
-
|
|
40916
|
-
// If it's time to release the scroll:
|
|
40917
|
-
// Return now so you don't hit the preventDefault.
|
|
40918
|
-
if (releaseScroll(newEvent)) {
|
|
40919
|
-
return true;
|
|
40920
40849
|
}
|
|
40921
40850
|
} else {
|
|
40922
|
-
|
|
40923
|
-
|
|
40924
|
-
// If we recently snapped after a momentum scroll, then ignore wheel events
|
|
40925
|
-
// to give time for the deceleration to finish. Stop ignoring after 500 msecs
|
|
40926
|
-
// or if it's a new scroll (larger delta or inverse sign as last event before
|
|
40927
|
-
// an end-of-momentum snap).
|
|
40928
|
-
const newEvent = {
|
|
40929
|
-
time: now(),
|
|
40930
|
-
delta: Math.abs(delta),
|
|
40931
|
-
direction: Math.sign(delta)
|
|
40932
|
-
};
|
|
40933
|
-
const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction;
|
|
40934
|
-
if (!ignoreWheelEvents) {
|
|
40935
|
-
lastEventBeforeSnap = undefined;
|
|
40936
|
-
let position = swiper.getTranslate() + delta * params.sensitivity;
|
|
40937
|
-
const wasBeginning = swiper.isBeginning;
|
|
40938
|
-
const wasEnd = swiper.isEnd;
|
|
40939
|
-
if (position >= swiper.minTranslate()) position = swiper.minTranslate();
|
|
40940
|
-
if (position <= swiper.maxTranslate()) position = swiper.maxTranslate();
|
|
40941
|
-
swiper.setTransition(0);
|
|
40942
|
-
swiper.setTranslate(position);
|
|
40943
|
-
swiper.updateProgress();
|
|
40944
|
-
swiper.updateActiveIndex();
|
|
40945
|
-
swiper.updateSlidesClasses();
|
|
40946
|
-
if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) {
|
|
40947
|
-
swiper.updateSlidesClasses();
|
|
40948
|
-
}
|
|
40949
|
-
if (swiper.params.loop) {
|
|
40950
|
-
swiper.loopFix({
|
|
40951
|
-
direction: newEvent.direction < 0 ? 'next' : 'prev',
|
|
40952
|
-
byMousewheel: true
|
|
40953
|
-
});
|
|
40954
|
-
}
|
|
40955
|
-
if (swiper.params.freeMode.sticky) {
|
|
40956
|
-
// When wheel scrolling starts with sticky (aka snap) enabled, then detect
|
|
40957
|
-
// the end of a momentum scroll by storing recent (N=15?) wheel events.
|
|
40958
|
-
// 1. do all N events have decreasing or same (absolute value) delta?
|
|
40959
|
-
// 2. did all N events arrive in the last M (M=500?) msecs?
|
|
40960
|
-
// 3. does the earliest event have an (absolute value) delta that's
|
|
40961
|
-
// at least P (P=1?) larger than the most recent event's delta?
|
|
40962
|
-
// 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels?
|
|
40963
|
-
// If 1-4 are "yes" then we're near the end of a momentum scroll deceleration.
|
|
40964
|
-
// Snap immediately and ignore remaining wheel events in this scroll.
|
|
40965
|
-
// See comment above for "remaining wheel events in this scroll" determination.
|
|
40966
|
-
// If 1-4 aren't satisfied, then wait to snap until 500ms after the last event.
|
|
40967
|
-
clearTimeout(timeout);
|
|
40968
|
-
timeout = undefined;
|
|
40969
|
-
if (recentWheelEvents.length >= 15) {
|
|
40970
|
-
recentWheelEvents.shift(); // only store the last N events
|
|
40971
|
-
}
|
|
40972
|
-
|
|
40973
|
-
const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;
|
|
40974
|
-
const firstEvent = recentWheelEvents[0];
|
|
40975
|
-
recentWheelEvents.push(newEvent);
|
|
40976
|
-
if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) {
|
|
40977
|
-
// Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log.
|
|
40978
|
-
recentWheelEvents.splice(0);
|
|
40979
|
-
} else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) {
|
|
40980
|
-
// We're at the end of the deceleration of a momentum scroll, so there's no need
|
|
40981
|
-
// to wait for more events. Snap ASAP on the next tick.
|
|
40982
|
-
// Also, because there's some remaining momentum we'll bias the snap in the
|
|
40983
|
-
// direction of the ongoing scroll because it's better UX for the scroll to snap
|
|
40984
|
-
// in the same direction as the scroll instead of reversing to snap. Therefore,
|
|
40985
|
-
// if it's already scrolled more than 20% in the current direction, keep going.
|
|
40986
|
-
const snapToThreshold = delta > 0 ? 0.8 : 0.2;
|
|
40987
|
-
lastEventBeforeSnap = newEvent;
|
|
40988
|
-
recentWheelEvents.splice(0);
|
|
40989
|
-
timeout = nextTick(() => {
|
|
40990
|
-
swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
|
|
40991
|
-
}, 0); // no delay; move on next tick
|
|
40992
|
-
}
|
|
40993
|
-
|
|
40994
|
-
if (!timeout) {
|
|
40995
|
-
// if we get here, then we haven't detected the end of a momentum scroll, so
|
|
40996
|
-
// we'll consider a scroll "complete" when there haven't been any wheel events
|
|
40997
|
-
// for 500ms.
|
|
40998
|
-
timeout = nextTick(() => {
|
|
40999
|
-
const snapToThreshold = 0.5;
|
|
41000
|
-
lastEventBeforeSnap = newEvent;
|
|
41001
|
-
recentWheelEvents.splice(0);
|
|
41002
|
-
swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
|
|
41003
|
-
}, 500);
|
|
41004
|
-
}
|
|
41005
|
-
}
|
|
41006
|
-
|
|
41007
|
-
// Emit event
|
|
41008
|
-
if (!ignoreWheelEvents) emit('scroll', e);
|
|
41009
|
-
|
|
41010
|
-
// Stop autoplay
|
|
41011
|
-
if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop();
|
|
41012
|
-
// Return page scroll on edge positions
|
|
41013
|
-
if (params.releaseOnEdges && (position === swiper.minTranslate() || position === swiper.maxTranslate())) {
|
|
41014
|
-
return true;
|
|
41015
|
-
}
|
|
41016
|
-
}
|
|
40851
|
+
swiper.slideTo(0, speed, runCallbacks);
|
|
41017
40852
|
}
|
|
41018
|
-
|
|
41019
|
-
|
|
41020
|
-
|
|
41021
|
-
|
|
41022
|
-
|
|
41023
|
-
|
|
41024
|
-
|
|
40853
|
+
};
|
|
40854
|
+
const setHistoryPopState = () => {
|
|
40855
|
+
paths = getPathValues(swiper.params.url);
|
|
40856
|
+
scrollToSlide(swiper.params.speed, paths.value, false);
|
|
40857
|
+
};
|
|
40858
|
+
const init = () => {
|
|
40859
|
+
const window = getWindow();
|
|
40860
|
+
if (!swiper.params.history) return;
|
|
40861
|
+
if (!window.history || !window.history.pushState) {
|
|
40862
|
+
swiper.params.history.enabled = false;
|
|
40863
|
+
swiper.params.hashNavigation.enabled = true;
|
|
40864
|
+
return;
|
|
41025
40865
|
}
|
|
41026
|
-
|
|
41027
|
-
|
|
41028
|
-
|
|
41029
|
-
|
|
41030
|
-
|
|
41031
|
-
|
|
41032
|
-
|
|
41033
|
-
return true;
|
|
40866
|
+
initialized = true;
|
|
40867
|
+
paths = getPathValues(swiper.params.url);
|
|
40868
|
+
if (!paths.key && !paths.value) {
|
|
40869
|
+
if (!swiper.params.history.replaceState) {
|
|
40870
|
+
window.addEventListener('popstate', setHistoryPopState);
|
|
40871
|
+
}
|
|
40872
|
+
return;
|
|
41034
40873
|
}
|
|
41035
|
-
|
|
41036
|
-
|
|
41037
|
-
|
|
41038
|
-
return true;
|
|
41039
|
-
}
|
|
41040
|
-
function disable() {
|
|
41041
|
-
if (swiper.params.cssMode) {
|
|
41042
|
-
swiper.wrapperEl.addEventListener(event, handle);
|
|
41043
|
-
return true;
|
|
41044
|
-
}
|
|
41045
|
-
if (!swiper.mousewheel.enabled) return false;
|
|
41046
|
-
events('removeEventListener');
|
|
41047
|
-
swiper.mousewheel.enabled = false;
|
|
41048
|
-
return true;
|
|
41049
|
-
}
|
|
41050
|
-
on('init', () => {
|
|
41051
|
-
if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) {
|
|
41052
|
-
disable();
|
|
41053
|
-
}
|
|
41054
|
-
if (swiper.params.mousewheel.enabled) enable();
|
|
41055
|
-
});
|
|
41056
|
-
on('destroy', () => {
|
|
41057
|
-
if (swiper.params.cssMode) {
|
|
41058
|
-
enable();
|
|
41059
|
-
}
|
|
41060
|
-
if (swiper.mousewheel.enabled) disable();
|
|
41061
|
-
});
|
|
41062
|
-
Object.assign(swiper.mousewheel, {
|
|
41063
|
-
enable,
|
|
41064
|
-
disable
|
|
41065
|
-
});
|
|
41066
|
-
}
|
|
41067
|
-
|
|
41068
|
-
function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
|
|
41069
|
-
if (swiper.params.createElements) {
|
|
41070
|
-
Object.keys(checkProps).forEach(key => {
|
|
41071
|
-
if (!params[key] && params.auto === true) {
|
|
41072
|
-
let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];
|
|
41073
|
-
if (!element) {
|
|
41074
|
-
element = createElement('div', checkProps[key]);
|
|
41075
|
-
element.className = checkProps[key];
|
|
41076
|
-
swiper.el.append(element);
|
|
41077
|
-
}
|
|
41078
|
-
params[key] = element;
|
|
41079
|
-
originalParams[key] = element;
|
|
41080
|
-
}
|
|
41081
|
-
});
|
|
41082
|
-
}
|
|
41083
|
-
return params;
|
|
41084
|
-
}
|
|
41085
|
-
|
|
41086
|
-
function classesToSelector(classes) {
|
|
41087
|
-
if (classes === void 0) {
|
|
41088
|
-
classes = '';
|
|
41089
|
-
}
|
|
41090
|
-
return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line
|
|
41091
|
-
.replace(/ /g, '.')}`;
|
|
41092
|
-
}
|
|
41093
|
-
|
|
41094
|
-
function Pagination(_ref) {
|
|
41095
|
-
let {
|
|
41096
|
-
swiper,
|
|
41097
|
-
extendParams,
|
|
41098
|
-
on,
|
|
41099
|
-
emit
|
|
41100
|
-
} = _ref;
|
|
41101
|
-
const pfx = 'swiper-pagination';
|
|
41102
|
-
extendParams({
|
|
41103
|
-
pagination: {
|
|
41104
|
-
el: null,
|
|
41105
|
-
bulletElement: 'span',
|
|
41106
|
-
clickable: false,
|
|
41107
|
-
hideOnClick: false,
|
|
41108
|
-
renderBullet: null,
|
|
41109
|
-
renderProgressbar: null,
|
|
41110
|
-
renderFraction: null,
|
|
41111
|
-
renderCustom: null,
|
|
41112
|
-
progressbarOpposite: false,
|
|
41113
|
-
type: 'bullets',
|
|
41114
|
-
// 'bullets' or 'progressbar' or 'fraction' or 'custom'
|
|
41115
|
-
dynamicBullets: false,
|
|
41116
|
-
dynamicMainBullets: 1,
|
|
41117
|
-
formatFractionCurrent: number => number,
|
|
41118
|
-
formatFractionTotal: number => number,
|
|
41119
|
-
bulletClass: `${pfx}-bullet`,
|
|
41120
|
-
bulletActiveClass: `${pfx}-bullet-active`,
|
|
41121
|
-
modifierClass: `${pfx}-`,
|
|
41122
|
-
currentClass: `${pfx}-current`,
|
|
41123
|
-
totalClass: `${pfx}-total`,
|
|
41124
|
-
hiddenClass: `${pfx}-hidden`,
|
|
41125
|
-
progressbarFillClass: `${pfx}-progressbar-fill`,
|
|
41126
|
-
progressbarOppositeClass: `${pfx}-progressbar-opposite`,
|
|
41127
|
-
clickableClass: `${pfx}-clickable`,
|
|
41128
|
-
lockClass: `${pfx}-lock`,
|
|
41129
|
-
horizontalClass: `${pfx}-horizontal`,
|
|
41130
|
-
verticalClass: `${pfx}-vertical`,
|
|
41131
|
-
paginationDisabledClass: `${pfx}-disabled`
|
|
41132
|
-
}
|
|
41133
|
-
});
|
|
41134
|
-
swiper.pagination = {
|
|
41135
|
-
el: null,
|
|
41136
|
-
bullets: []
|
|
41137
|
-
};
|
|
41138
|
-
let bulletSize;
|
|
41139
|
-
let dynamicBulletIndex = 0;
|
|
41140
|
-
const makeElementsArray = el => (Array.isArray(el) ? el : [el]).filter(e => !!e);
|
|
41141
|
-
function isPaginationDisabled() {
|
|
41142
|
-
return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
|
|
41143
|
-
}
|
|
41144
|
-
function setSideBullets(bulletEl, position) {
|
|
41145
|
-
const {
|
|
41146
|
-
bulletActiveClass
|
|
41147
|
-
} = swiper.params.pagination;
|
|
41148
|
-
if (!bulletEl) return;
|
|
41149
|
-
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
41150
|
-
if (bulletEl) {
|
|
41151
|
-
bulletEl.classList.add(`${bulletActiveClass}-${position}`);
|
|
41152
|
-
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
41153
|
-
if (bulletEl) {
|
|
41154
|
-
bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);
|
|
41155
|
-
}
|
|
41156
|
-
}
|
|
41157
|
-
}
|
|
41158
|
-
function onBulletClick(e) {
|
|
41159
|
-
const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
|
|
41160
|
-
if (!bulletEl) {
|
|
41161
|
-
return;
|
|
41162
|
-
}
|
|
41163
|
-
e.preventDefault();
|
|
41164
|
-
const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;
|
|
41165
|
-
if (swiper.params.loop) {
|
|
41166
|
-
if (swiper.realIndex === index) return;
|
|
41167
|
-
const realIndex = swiper.realIndex;
|
|
41168
|
-
const newSlideIndex = swiper.getSlideIndexByData(index);
|
|
41169
|
-
const currentSlideIndex = swiper.getSlideIndexByData(swiper.realIndex);
|
|
41170
|
-
const loopFix = dir => {
|
|
41171
|
-
const indexBeforeLoopFix = swiper.activeIndex;
|
|
41172
|
-
swiper.loopFix({
|
|
41173
|
-
direction: dir,
|
|
41174
|
-
activeSlideIndex: newSlideIndex,
|
|
41175
|
-
slideTo: false
|
|
41176
|
-
});
|
|
41177
|
-
const indexAfterFix = swiper.activeIndex;
|
|
41178
|
-
if (indexBeforeLoopFix === indexAfterFix) {
|
|
41179
|
-
swiper.slideToLoop(realIndex, 0, false, true);
|
|
41180
|
-
}
|
|
41181
|
-
};
|
|
41182
|
-
if (newSlideIndex > swiper.slides.length - swiper.loopedSlides) {
|
|
41183
|
-
loopFix(newSlideIndex > currentSlideIndex ? 'next' : 'prev');
|
|
41184
|
-
} else if (swiper.params.centeredSlides) {
|
|
41185
|
-
const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
41186
|
-
if (newSlideIndex < Math.floor(slidesPerView / 2)) {
|
|
41187
|
-
loopFix('prev');
|
|
41188
|
-
}
|
|
41189
|
-
}
|
|
41190
|
-
swiper.slideToLoop(index);
|
|
41191
|
-
} else {
|
|
41192
|
-
swiper.slideTo(index);
|
|
41193
|
-
}
|
|
41194
|
-
}
|
|
41195
|
-
function update() {
|
|
41196
|
-
// Render || Update Pagination bullets/items
|
|
41197
|
-
const rtl = swiper.rtl;
|
|
41198
|
-
const params = swiper.params.pagination;
|
|
41199
|
-
if (isPaginationDisabled()) return;
|
|
41200
|
-
let el = swiper.pagination.el;
|
|
41201
|
-
el = makeElementsArray(el);
|
|
41202
|
-
// Current/Total
|
|
41203
|
-
let current;
|
|
41204
|
-
let previousIndex;
|
|
41205
|
-
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
41206
|
-
const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
41207
|
-
if (swiper.params.loop) {
|
|
41208
|
-
previousIndex = swiper.previousRealIndex || 0;
|
|
41209
|
-
current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;
|
|
41210
|
-
} else if (typeof swiper.snapIndex !== 'undefined') {
|
|
41211
|
-
current = swiper.snapIndex;
|
|
41212
|
-
previousIndex = swiper.previousSnapIndex;
|
|
41213
|
-
} else {
|
|
41214
|
-
previousIndex = swiper.previousIndex || 0;
|
|
41215
|
-
current = swiper.activeIndex || 0;
|
|
41216
|
-
}
|
|
41217
|
-
// Types
|
|
41218
|
-
if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
|
|
41219
|
-
const bullets = swiper.pagination.bullets;
|
|
41220
|
-
let firstIndex;
|
|
41221
|
-
let lastIndex;
|
|
41222
|
-
let midIndex;
|
|
41223
|
-
if (params.dynamicBullets) {
|
|
41224
|
-
bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true);
|
|
41225
|
-
el.forEach(subEl => {
|
|
41226
|
-
subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;
|
|
41227
|
-
});
|
|
41228
|
-
if (params.dynamicMainBullets > 1 && previousIndex !== undefined) {
|
|
41229
|
-
dynamicBulletIndex += current - (previousIndex || 0);
|
|
41230
|
-
if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
|
|
41231
|
-
dynamicBulletIndex = params.dynamicMainBullets - 1;
|
|
41232
|
-
} else if (dynamicBulletIndex < 0) {
|
|
41233
|
-
dynamicBulletIndex = 0;
|
|
41234
|
-
}
|
|
41235
|
-
}
|
|
41236
|
-
firstIndex = Math.max(current - dynamicBulletIndex, 0);
|
|
41237
|
-
lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
|
|
41238
|
-
midIndex = (lastIndex + firstIndex) / 2;
|
|
41239
|
-
}
|
|
41240
|
-
bullets.forEach(bulletEl => {
|
|
41241
|
-
const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat();
|
|
41242
|
-
bulletEl.classList.remove(...classesToRemove);
|
|
41243
|
-
});
|
|
41244
|
-
if (el.length > 1) {
|
|
41245
|
-
bullets.forEach(bullet => {
|
|
41246
|
-
const bulletIndex = elementIndex(bullet);
|
|
41247
|
-
if (bulletIndex === current) {
|
|
41248
|
-
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
41249
|
-
} else if (swiper.isElement) {
|
|
41250
|
-
bullet.setAttribute('part', 'bullet');
|
|
41251
|
-
}
|
|
41252
|
-
if (params.dynamicBullets) {
|
|
41253
|
-
if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
|
|
41254
|
-
bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
41255
|
-
}
|
|
41256
|
-
if (bulletIndex === firstIndex) {
|
|
41257
|
-
setSideBullets(bullet, 'prev');
|
|
41258
|
-
}
|
|
41259
|
-
if (bulletIndex === lastIndex) {
|
|
41260
|
-
setSideBullets(bullet, 'next');
|
|
41261
|
-
}
|
|
41262
|
-
}
|
|
41263
|
-
});
|
|
41264
|
-
} else {
|
|
41265
|
-
const bullet = bullets[current];
|
|
41266
|
-
if (bullet) {
|
|
41267
|
-
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
41268
|
-
}
|
|
41269
|
-
if (swiper.isElement) {
|
|
41270
|
-
bullets.forEach((bulletEl, bulletIndex) => {
|
|
41271
|
-
bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet');
|
|
41272
|
-
});
|
|
41273
|
-
}
|
|
41274
|
-
if (params.dynamicBullets) {
|
|
41275
|
-
const firstDisplayedBullet = bullets[firstIndex];
|
|
41276
|
-
const lastDisplayedBullet = bullets[lastIndex];
|
|
41277
|
-
for (let i = firstIndex; i <= lastIndex; i += 1) {
|
|
41278
|
-
if (bullets[i]) {
|
|
41279
|
-
bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
41280
|
-
}
|
|
41281
|
-
}
|
|
41282
|
-
setSideBullets(firstDisplayedBullet, 'prev');
|
|
41283
|
-
setSideBullets(lastDisplayedBullet, 'next');
|
|
41284
|
-
}
|
|
41285
|
-
}
|
|
41286
|
-
if (params.dynamicBullets) {
|
|
41287
|
-
const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
|
|
41288
|
-
const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
|
|
41289
|
-
const offsetProp = rtl ? 'right' : 'left';
|
|
41290
|
-
bullets.forEach(bullet => {
|
|
41291
|
-
bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;
|
|
41292
|
-
});
|
|
41293
|
-
}
|
|
41294
|
-
}
|
|
41295
|
-
el.forEach((subEl, subElIndex) => {
|
|
41296
|
-
if (params.type === 'fraction') {
|
|
41297
|
-
subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {
|
|
41298
|
-
fractionEl.textContent = params.formatFractionCurrent(current + 1);
|
|
41299
|
-
});
|
|
41300
|
-
subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {
|
|
41301
|
-
totalEl.textContent = params.formatFractionTotal(total);
|
|
41302
|
-
});
|
|
41303
|
-
}
|
|
41304
|
-
if (params.type === 'progressbar') {
|
|
41305
|
-
let progressbarDirection;
|
|
41306
|
-
if (params.progressbarOpposite) {
|
|
41307
|
-
progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
|
|
41308
|
-
} else {
|
|
41309
|
-
progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
|
|
41310
|
-
}
|
|
41311
|
-
const scale = (current + 1) / total;
|
|
41312
|
-
let scaleX = 1;
|
|
41313
|
-
let scaleY = 1;
|
|
41314
|
-
if (progressbarDirection === 'horizontal') {
|
|
41315
|
-
scaleX = scale;
|
|
41316
|
-
} else {
|
|
41317
|
-
scaleY = scale;
|
|
41318
|
-
}
|
|
41319
|
-
subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {
|
|
41320
|
-
progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;
|
|
41321
|
-
progressEl.style.transitionDuration = `${swiper.params.speed}ms`;
|
|
41322
|
-
});
|
|
41323
|
-
}
|
|
41324
|
-
if (params.type === 'custom' && params.renderCustom) {
|
|
41325
|
-
subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
|
|
41326
|
-
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
41327
|
-
} else {
|
|
41328
|
-
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
41329
|
-
emit('paginationUpdate', subEl);
|
|
41330
|
-
}
|
|
41331
|
-
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
41332
|
-
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
|
|
41333
|
-
}
|
|
41334
|
-
});
|
|
41335
|
-
}
|
|
41336
|
-
function render() {
|
|
41337
|
-
// Render Container
|
|
41338
|
-
const params = swiper.params.pagination;
|
|
41339
|
-
if (isPaginationDisabled()) return;
|
|
41340
|
-
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
41341
|
-
let el = swiper.pagination.el;
|
|
41342
|
-
el = makeElementsArray(el);
|
|
41343
|
-
let paginationHTML = '';
|
|
41344
|
-
if (params.type === 'bullets') {
|
|
41345
|
-
let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
41346
|
-
if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {
|
|
41347
|
-
numberOfBullets = slidesLength;
|
|
41348
|
-
}
|
|
41349
|
-
for (let i = 0; i < numberOfBullets; i += 1) {
|
|
41350
|
-
if (params.renderBullet) {
|
|
41351
|
-
paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
|
|
41352
|
-
} else {
|
|
41353
|
-
// prettier-ignore
|
|
41354
|
-
paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`;
|
|
41355
|
-
}
|
|
41356
|
-
}
|
|
41357
|
-
}
|
|
41358
|
-
if (params.type === 'fraction') {
|
|
41359
|
-
if (params.renderFraction) {
|
|
41360
|
-
paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
|
|
41361
|
-
} else {
|
|
41362
|
-
paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`;
|
|
41363
|
-
}
|
|
41364
|
-
}
|
|
41365
|
-
if (params.type === 'progressbar') {
|
|
41366
|
-
if (params.renderProgressbar) {
|
|
41367
|
-
paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
|
|
41368
|
-
} else {
|
|
41369
|
-
paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
|
|
41370
|
-
}
|
|
41371
|
-
}
|
|
41372
|
-
swiper.pagination.bullets = [];
|
|
41373
|
-
el.forEach(subEl => {
|
|
41374
|
-
if (params.type !== 'custom') {
|
|
41375
|
-
subEl.innerHTML = paginationHTML || '';
|
|
41376
|
-
}
|
|
41377
|
-
if (params.type === 'bullets') {
|
|
41378
|
-
swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
|
|
41379
|
-
}
|
|
41380
|
-
});
|
|
41381
|
-
if (params.type !== 'custom') {
|
|
41382
|
-
emit('paginationRender', el[0]);
|
|
41383
|
-
}
|
|
41384
|
-
}
|
|
41385
|
-
function init() {
|
|
41386
|
-
swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
|
|
41387
|
-
el: 'swiper-pagination'
|
|
41388
|
-
});
|
|
41389
|
-
const params = swiper.params.pagination;
|
|
41390
|
-
if (!params.el) return;
|
|
41391
|
-
let el;
|
|
41392
|
-
if (typeof params.el === 'string' && swiper.isElement) {
|
|
41393
|
-
el = swiper.el.querySelector(params.el);
|
|
41394
|
-
}
|
|
41395
|
-
if (!el && typeof params.el === 'string') {
|
|
41396
|
-
el = [...document.querySelectorAll(params.el)];
|
|
41397
|
-
}
|
|
41398
|
-
if (!el) {
|
|
41399
|
-
el = params.el;
|
|
41400
|
-
}
|
|
41401
|
-
if (!el || el.length === 0) return;
|
|
41402
|
-
if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {
|
|
41403
|
-
el = [...swiper.el.querySelectorAll(params.el)];
|
|
41404
|
-
// check if it belongs to another nested Swiper
|
|
41405
|
-
if (el.length > 1) {
|
|
41406
|
-
el = el.filter(subEl => {
|
|
41407
|
-
if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false;
|
|
41408
|
-
return true;
|
|
41409
|
-
})[0];
|
|
41410
|
-
}
|
|
41411
|
-
}
|
|
41412
|
-
if (Array.isArray(el) && el.length === 1) el = el[0];
|
|
41413
|
-
Object.assign(swiper.pagination, {
|
|
41414
|
-
el
|
|
41415
|
-
});
|
|
41416
|
-
el = makeElementsArray(el);
|
|
41417
|
-
el.forEach(subEl => {
|
|
41418
|
-
if (params.type === 'bullets' && params.clickable) {
|
|
41419
|
-
subEl.classList.add(...(params.clickableClass || '').split(' '));
|
|
41420
|
-
}
|
|
41421
|
-
subEl.classList.add(params.modifierClass + params.type);
|
|
41422
|
-
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
41423
|
-
if (params.type === 'bullets' && params.dynamicBullets) {
|
|
41424
|
-
subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);
|
|
41425
|
-
dynamicBulletIndex = 0;
|
|
41426
|
-
if (params.dynamicMainBullets < 1) {
|
|
41427
|
-
params.dynamicMainBullets = 1;
|
|
41428
|
-
}
|
|
41429
|
-
}
|
|
41430
|
-
if (params.type === 'progressbar' && params.progressbarOpposite) {
|
|
41431
|
-
subEl.classList.add(params.progressbarOppositeClass);
|
|
41432
|
-
}
|
|
41433
|
-
if (params.clickable) {
|
|
41434
|
-
subEl.addEventListener('click', onBulletClick);
|
|
41435
|
-
}
|
|
41436
|
-
if (!swiper.enabled) {
|
|
41437
|
-
subEl.classList.add(params.lockClass);
|
|
41438
|
-
}
|
|
41439
|
-
});
|
|
41440
|
-
}
|
|
41441
|
-
function destroy() {
|
|
41442
|
-
const params = swiper.params.pagination;
|
|
41443
|
-
if (isPaginationDisabled()) return;
|
|
41444
|
-
let el = swiper.pagination.el;
|
|
41445
|
-
if (el) {
|
|
41446
|
-
el = makeElementsArray(el);
|
|
41447
|
-
el.forEach(subEl => {
|
|
41448
|
-
subEl.classList.remove(params.hiddenClass);
|
|
41449
|
-
subEl.classList.remove(params.modifierClass + params.type);
|
|
41450
|
-
subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
41451
|
-
if (params.clickable) {
|
|
41452
|
-
subEl.classList.remove(...(params.clickableClass || '').split(' '));
|
|
41453
|
-
subEl.removeEventListener('click', onBulletClick);
|
|
41454
|
-
}
|
|
41455
|
-
});
|
|
41456
|
-
}
|
|
41457
|
-
if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));
|
|
41458
|
-
}
|
|
41459
|
-
on('changeDirection', () => {
|
|
41460
|
-
if (!swiper.pagination || !swiper.pagination.el) return;
|
|
41461
|
-
const params = swiper.params.pagination;
|
|
41462
|
-
let {
|
|
41463
|
-
el
|
|
41464
|
-
} = swiper.pagination;
|
|
41465
|
-
el = makeElementsArray(el);
|
|
41466
|
-
el.forEach(subEl => {
|
|
41467
|
-
subEl.classList.remove(params.horizontalClass, params.verticalClass);
|
|
41468
|
-
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
41469
|
-
});
|
|
41470
|
-
});
|
|
41471
|
-
on('init', () => {
|
|
41472
|
-
if (swiper.params.pagination.enabled === false) {
|
|
41473
|
-
// eslint-disable-next-line
|
|
41474
|
-
disable();
|
|
41475
|
-
} else {
|
|
41476
|
-
init();
|
|
41477
|
-
render();
|
|
41478
|
-
update();
|
|
41479
|
-
}
|
|
41480
|
-
});
|
|
41481
|
-
on('activeIndexChange', () => {
|
|
41482
|
-
if (typeof swiper.snapIndex === 'undefined') {
|
|
41483
|
-
update();
|
|
41484
|
-
}
|
|
41485
|
-
});
|
|
41486
|
-
on('snapIndexChange', () => {
|
|
41487
|
-
update();
|
|
41488
|
-
});
|
|
41489
|
-
on('snapGridLengthChange', () => {
|
|
41490
|
-
render();
|
|
41491
|
-
update();
|
|
41492
|
-
});
|
|
41493
|
-
on('destroy', () => {
|
|
41494
|
-
destroy();
|
|
41495
|
-
});
|
|
41496
|
-
on('enable disable', () => {
|
|
41497
|
-
let {
|
|
41498
|
-
el
|
|
41499
|
-
} = swiper.pagination;
|
|
41500
|
-
if (el) {
|
|
41501
|
-
el = makeElementsArray(el);
|
|
41502
|
-
el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));
|
|
41503
|
-
}
|
|
41504
|
-
});
|
|
41505
|
-
on('lock unlock', () => {
|
|
41506
|
-
update();
|
|
41507
|
-
});
|
|
41508
|
-
on('click', (_s, e) => {
|
|
41509
|
-
const targetEl = e.target;
|
|
41510
|
-
const el = makeElementsArray(swiper.pagination.el);
|
|
41511
|
-
if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {
|
|
41512
|
-
if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
|
|
41513
|
-
const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);
|
|
41514
|
-
if (isHidden === true) {
|
|
41515
|
-
emit('paginationShow');
|
|
41516
|
-
} else {
|
|
41517
|
-
emit('paginationHide');
|
|
41518
|
-
}
|
|
41519
|
-
el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));
|
|
41520
|
-
}
|
|
41521
|
-
});
|
|
41522
|
-
const enable = () => {
|
|
41523
|
-
swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);
|
|
41524
|
-
let {
|
|
41525
|
-
el
|
|
41526
|
-
} = swiper.pagination;
|
|
41527
|
-
if (el) {
|
|
41528
|
-
el = makeElementsArray(el);
|
|
41529
|
-
el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));
|
|
41530
|
-
}
|
|
41531
|
-
init();
|
|
41532
|
-
render();
|
|
41533
|
-
update();
|
|
41534
|
-
};
|
|
41535
|
-
const disable = () => {
|
|
41536
|
-
swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);
|
|
41537
|
-
let {
|
|
41538
|
-
el
|
|
41539
|
-
} = swiper.pagination;
|
|
41540
|
-
if (el) {
|
|
41541
|
-
el = makeElementsArray(el);
|
|
41542
|
-
el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));
|
|
41543
|
-
}
|
|
41544
|
-
destroy();
|
|
41545
|
-
};
|
|
41546
|
-
Object.assign(swiper.pagination, {
|
|
41547
|
-
enable,
|
|
41548
|
-
disable,
|
|
41549
|
-
render,
|
|
41550
|
-
update,
|
|
41551
|
-
init,
|
|
41552
|
-
destroy
|
|
41553
|
-
});
|
|
41554
|
-
}
|
|
41555
|
-
|
|
41556
|
-
function History(_ref) {
|
|
41557
|
-
let {
|
|
41558
|
-
swiper,
|
|
41559
|
-
extendParams,
|
|
41560
|
-
on
|
|
41561
|
-
} = _ref;
|
|
41562
|
-
extendParams({
|
|
41563
|
-
history: {
|
|
41564
|
-
enabled: false,
|
|
41565
|
-
root: '',
|
|
41566
|
-
replaceState: false,
|
|
41567
|
-
key: 'slides',
|
|
41568
|
-
keepQuery: false
|
|
41569
|
-
}
|
|
41570
|
-
});
|
|
41571
|
-
let initialized = false;
|
|
41572
|
-
let paths = {};
|
|
41573
|
-
const slugify = text => {
|
|
41574
|
-
return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
|
|
41575
|
-
};
|
|
41576
|
-
const getPathValues = urlOverride => {
|
|
41577
|
-
const window = getWindow();
|
|
41578
|
-
let location;
|
|
41579
|
-
if (urlOverride) {
|
|
41580
|
-
location = new URL(urlOverride);
|
|
41581
|
-
} else {
|
|
41582
|
-
location = window.location;
|
|
41583
|
-
}
|
|
41584
|
-
const pathArray = location.pathname.slice(1).split('/').filter(part => part !== '');
|
|
41585
|
-
const total = pathArray.length;
|
|
41586
|
-
const key = pathArray[total - 2];
|
|
41587
|
-
const value = pathArray[total - 1];
|
|
41588
|
-
return {
|
|
41589
|
-
key,
|
|
41590
|
-
value
|
|
41591
|
-
};
|
|
41592
|
-
};
|
|
41593
|
-
const setHistory = (key, index) => {
|
|
41594
|
-
const window = getWindow();
|
|
41595
|
-
if (!initialized || !swiper.params.history.enabled) return;
|
|
41596
|
-
let location;
|
|
41597
|
-
if (swiper.params.url) {
|
|
41598
|
-
location = new URL(swiper.params.url);
|
|
41599
|
-
} else {
|
|
41600
|
-
location = window.location;
|
|
41601
|
-
}
|
|
41602
|
-
const slide = swiper.slides[index];
|
|
41603
|
-
let value = slugify(slide.getAttribute('data-history'));
|
|
41604
|
-
if (swiper.params.history.root.length > 0) {
|
|
41605
|
-
let root = swiper.params.history.root;
|
|
41606
|
-
if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1);
|
|
41607
|
-
value = `${root}/${key ? `${key}/` : ''}${value}`;
|
|
41608
|
-
} else if (!location.pathname.includes(key)) {
|
|
41609
|
-
value = `${key ? `${key}/` : ''}${value}`;
|
|
41610
|
-
}
|
|
41611
|
-
if (swiper.params.history.keepQuery) {
|
|
41612
|
-
value += location.search;
|
|
41613
|
-
}
|
|
41614
|
-
const currentState = window.history.state;
|
|
41615
|
-
if (currentState && currentState.value === value) {
|
|
41616
|
-
return;
|
|
41617
|
-
}
|
|
41618
|
-
if (swiper.params.history.replaceState) {
|
|
41619
|
-
window.history.replaceState({
|
|
41620
|
-
value
|
|
41621
|
-
}, null, value);
|
|
41622
|
-
} else {
|
|
41623
|
-
window.history.pushState({
|
|
41624
|
-
value
|
|
41625
|
-
}, null, value);
|
|
41626
|
-
}
|
|
41627
|
-
};
|
|
41628
|
-
const scrollToSlide = (speed, value, runCallbacks) => {
|
|
41629
|
-
if (value) {
|
|
41630
|
-
for (let i = 0, length = swiper.slides.length; i < length; i += 1) {
|
|
41631
|
-
const slide = swiper.slides[i];
|
|
41632
|
-
const slideHistory = slugify(slide.getAttribute('data-history'));
|
|
41633
|
-
if (slideHistory === value) {
|
|
41634
|
-
const index = swiper.getSlideIndex(slide);
|
|
41635
|
-
swiper.slideTo(index, speed, runCallbacks);
|
|
41636
|
-
}
|
|
41637
|
-
}
|
|
41638
|
-
} else {
|
|
41639
|
-
swiper.slideTo(0, speed, runCallbacks);
|
|
41640
|
-
}
|
|
41641
|
-
};
|
|
41642
|
-
const setHistoryPopState = () => {
|
|
41643
|
-
paths = getPathValues(swiper.params.url);
|
|
41644
|
-
scrollToSlide(swiper.params.speed, paths.value, false);
|
|
41645
|
-
};
|
|
41646
|
-
const init = () => {
|
|
41647
|
-
const window = getWindow();
|
|
41648
|
-
if (!swiper.params.history) return;
|
|
41649
|
-
if (!window.history || !window.history.pushState) {
|
|
41650
|
-
swiper.params.history.enabled = false;
|
|
41651
|
-
swiper.params.hashNavigation.enabled = true;
|
|
41652
|
-
return;
|
|
41653
|
-
}
|
|
41654
|
-
initialized = true;
|
|
41655
|
-
paths = getPathValues(swiper.params.url);
|
|
41656
|
-
if (!paths.key && !paths.value) {
|
|
41657
|
-
if (!swiper.params.history.replaceState) {
|
|
41658
|
-
window.addEventListener('popstate', setHistoryPopState);
|
|
41659
|
-
}
|
|
41660
|
-
return;
|
|
41661
|
-
}
|
|
41662
|
-
scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit);
|
|
41663
|
-
if (!swiper.params.history.replaceState) {
|
|
41664
|
-
window.addEventListener('popstate', setHistoryPopState);
|
|
40874
|
+
scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit);
|
|
40875
|
+
if (!swiper.params.history.replaceState) {
|
|
40876
|
+
window.addEventListener('popstate', setHistoryPopState);
|
|
41665
40877
|
}
|
|
41666
40878
|
};
|
|
41667
40879
|
const destroy = () => {
|
|
@@ -42161,342 +41373,6 @@ function Thumb(_ref) {
|
|
|
42161
41373
|
});
|
|
42162
41374
|
}
|
|
42163
41375
|
|
|
42164
|
-
function freeMode(_ref) {
|
|
42165
|
-
let {
|
|
42166
|
-
swiper,
|
|
42167
|
-
extendParams,
|
|
42168
|
-
emit,
|
|
42169
|
-
once
|
|
42170
|
-
} = _ref;
|
|
42171
|
-
extendParams({
|
|
42172
|
-
freeMode: {
|
|
42173
|
-
enabled: false,
|
|
42174
|
-
momentum: true,
|
|
42175
|
-
momentumRatio: 1,
|
|
42176
|
-
momentumBounce: true,
|
|
42177
|
-
momentumBounceRatio: 1,
|
|
42178
|
-
momentumVelocityRatio: 1,
|
|
42179
|
-
sticky: false,
|
|
42180
|
-
minimumVelocity: 0.02
|
|
42181
|
-
}
|
|
42182
|
-
});
|
|
42183
|
-
function onTouchStart() {
|
|
42184
|
-
if (swiper.params.cssMode) return;
|
|
42185
|
-
const translate = swiper.getTranslate();
|
|
42186
|
-
swiper.setTranslate(translate);
|
|
42187
|
-
swiper.setTransition(0);
|
|
42188
|
-
swiper.touchEventsData.velocities.length = 0;
|
|
42189
|
-
swiper.freeMode.onTouchEnd({
|
|
42190
|
-
currentPos: swiper.rtl ? swiper.translate : -swiper.translate
|
|
42191
|
-
});
|
|
42192
|
-
}
|
|
42193
|
-
function onTouchMove() {
|
|
42194
|
-
if (swiper.params.cssMode) return;
|
|
42195
|
-
const {
|
|
42196
|
-
touchEventsData: data,
|
|
42197
|
-
touches
|
|
42198
|
-
} = swiper;
|
|
42199
|
-
// Velocity
|
|
42200
|
-
if (data.velocities.length === 0) {
|
|
42201
|
-
data.velocities.push({
|
|
42202
|
-
position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
|
|
42203
|
-
time: data.touchStartTime
|
|
42204
|
-
});
|
|
42205
|
-
}
|
|
42206
|
-
data.velocities.push({
|
|
42207
|
-
position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
|
|
42208
|
-
time: now()
|
|
42209
|
-
});
|
|
42210
|
-
}
|
|
42211
|
-
function onTouchEnd(_ref2) {
|
|
42212
|
-
let {
|
|
42213
|
-
currentPos
|
|
42214
|
-
} = _ref2;
|
|
42215
|
-
if (swiper.params.cssMode) return;
|
|
42216
|
-
const {
|
|
42217
|
-
params,
|
|
42218
|
-
wrapperEl,
|
|
42219
|
-
rtlTranslate: rtl,
|
|
42220
|
-
snapGrid,
|
|
42221
|
-
touchEventsData: data
|
|
42222
|
-
} = swiper;
|
|
42223
|
-
// Time diff
|
|
42224
|
-
const touchEndTime = now();
|
|
42225
|
-
const timeDiff = touchEndTime - data.touchStartTime;
|
|
42226
|
-
if (currentPos < -swiper.minTranslate()) {
|
|
42227
|
-
swiper.slideTo(swiper.activeIndex);
|
|
42228
|
-
return;
|
|
42229
|
-
}
|
|
42230
|
-
if (currentPos > -swiper.maxTranslate()) {
|
|
42231
|
-
if (swiper.slides.length < snapGrid.length) {
|
|
42232
|
-
swiper.slideTo(snapGrid.length - 1);
|
|
42233
|
-
} else {
|
|
42234
|
-
swiper.slideTo(swiper.slides.length - 1);
|
|
42235
|
-
}
|
|
42236
|
-
return;
|
|
42237
|
-
}
|
|
42238
|
-
if (params.freeMode.momentum) {
|
|
42239
|
-
if (data.velocities.length > 1) {
|
|
42240
|
-
const lastMoveEvent = data.velocities.pop();
|
|
42241
|
-
const velocityEvent = data.velocities.pop();
|
|
42242
|
-
const distance = lastMoveEvent.position - velocityEvent.position;
|
|
42243
|
-
const time = lastMoveEvent.time - velocityEvent.time;
|
|
42244
|
-
swiper.velocity = distance / time;
|
|
42245
|
-
swiper.velocity /= 2;
|
|
42246
|
-
if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {
|
|
42247
|
-
swiper.velocity = 0;
|
|
42248
|
-
}
|
|
42249
|
-
// this implies that the user stopped moving a finger then released.
|
|
42250
|
-
// There would be no events with distance zero, so the last event is stale.
|
|
42251
|
-
if (time > 150 || now() - lastMoveEvent.time > 300) {
|
|
42252
|
-
swiper.velocity = 0;
|
|
42253
|
-
}
|
|
42254
|
-
} else {
|
|
42255
|
-
swiper.velocity = 0;
|
|
42256
|
-
}
|
|
42257
|
-
swiper.velocity *= params.freeMode.momentumVelocityRatio;
|
|
42258
|
-
data.velocities.length = 0;
|
|
42259
|
-
let momentumDuration = 1000 * params.freeMode.momentumRatio;
|
|
42260
|
-
const momentumDistance = swiper.velocity * momentumDuration;
|
|
42261
|
-
let newPosition = swiper.translate + momentumDistance;
|
|
42262
|
-
if (rtl) newPosition = -newPosition;
|
|
42263
|
-
let doBounce = false;
|
|
42264
|
-
let afterBouncePosition;
|
|
42265
|
-
const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;
|
|
42266
|
-
let needsLoopFix;
|
|
42267
|
-
if (newPosition < swiper.maxTranslate()) {
|
|
42268
|
-
if (params.freeMode.momentumBounce) {
|
|
42269
|
-
if (newPosition + swiper.maxTranslate() < -bounceAmount) {
|
|
42270
|
-
newPosition = swiper.maxTranslate() - bounceAmount;
|
|
42271
|
-
}
|
|
42272
|
-
afterBouncePosition = swiper.maxTranslate();
|
|
42273
|
-
doBounce = true;
|
|
42274
|
-
data.allowMomentumBounce = true;
|
|
42275
|
-
} else {
|
|
42276
|
-
newPosition = swiper.maxTranslate();
|
|
42277
|
-
}
|
|
42278
|
-
if (params.loop && params.centeredSlides) needsLoopFix = true;
|
|
42279
|
-
} else if (newPosition > swiper.minTranslate()) {
|
|
42280
|
-
if (params.freeMode.momentumBounce) {
|
|
42281
|
-
if (newPosition - swiper.minTranslate() > bounceAmount) {
|
|
42282
|
-
newPosition = swiper.minTranslate() + bounceAmount;
|
|
42283
|
-
}
|
|
42284
|
-
afterBouncePosition = swiper.minTranslate();
|
|
42285
|
-
doBounce = true;
|
|
42286
|
-
data.allowMomentumBounce = true;
|
|
42287
|
-
} else {
|
|
42288
|
-
newPosition = swiper.minTranslate();
|
|
42289
|
-
}
|
|
42290
|
-
if (params.loop && params.centeredSlides) needsLoopFix = true;
|
|
42291
|
-
} else if (params.freeMode.sticky) {
|
|
42292
|
-
let nextSlide;
|
|
42293
|
-
for (let j = 0; j < snapGrid.length; j += 1) {
|
|
42294
|
-
if (snapGrid[j] > -newPosition) {
|
|
42295
|
-
nextSlide = j;
|
|
42296
|
-
break;
|
|
42297
|
-
}
|
|
42298
|
-
}
|
|
42299
|
-
if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
|
|
42300
|
-
newPosition = snapGrid[nextSlide];
|
|
42301
|
-
} else {
|
|
42302
|
-
newPosition = snapGrid[nextSlide - 1];
|
|
42303
|
-
}
|
|
42304
|
-
newPosition = -newPosition;
|
|
42305
|
-
}
|
|
42306
|
-
if (needsLoopFix) {
|
|
42307
|
-
once('transitionEnd', () => {
|
|
42308
|
-
swiper.loopFix();
|
|
42309
|
-
});
|
|
42310
|
-
}
|
|
42311
|
-
// Fix duration
|
|
42312
|
-
if (swiper.velocity !== 0) {
|
|
42313
|
-
if (rtl) {
|
|
42314
|
-
momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
|
|
42315
|
-
} else {
|
|
42316
|
-
momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
|
|
42317
|
-
}
|
|
42318
|
-
if (params.freeMode.sticky) {
|
|
42319
|
-
// If freeMode.sticky is active and the user ends a swipe with a slow-velocity
|
|
42320
|
-
// event, then durations can be 20+ seconds to slide one (or zero!) slides.
|
|
42321
|
-
// It's easy to see this when simulating touch with mouse events. To fix this,
|
|
42322
|
-
// limit single-slide swipes to the default slide duration. This also has the
|
|
42323
|
-
// nice side effect of matching slide speed if the user stopped moving before
|
|
42324
|
-
// lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
|
|
42325
|
-
// For faster swipes, also apply limits (albeit higher ones).
|
|
42326
|
-
const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
|
|
42327
|
-
const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
|
|
42328
|
-
if (moveDistance < currentSlideSize) {
|
|
42329
|
-
momentumDuration = params.speed;
|
|
42330
|
-
} else if (moveDistance < 2 * currentSlideSize) {
|
|
42331
|
-
momentumDuration = params.speed * 1.5;
|
|
42332
|
-
} else {
|
|
42333
|
-
momentumDuration = params.speed * 2.5;
|
|
42334
|
-
}
|
|
42335
|
-
}
|
|
42336
|
-
} else if (params.freeMode.sticky) {
|
|
42337
|
-
swiper.slideToClosest();
|
|
42338
|
-
return;
|
|
42339
|
-
}
|
|
42340
|
-
if (params.freeMode.momentumBounce && doBounce) {
|
|
42341
|
-
swiper.updateProgress(afterBouncePosition);
|
|
42342
|
-
swiper.setTransition(momentumDuration);
|
|
42343
|
-
swiper.setTranslate(newPosition);
|
|
42344
|
-
swiper.transitionStart(true, swiper.swipeDirection);
|
|
42345
|
-
swiper.animating = true;
|
|
42346
|
-
elementTransitionEnd(wrapperEl, () => {
|
|
42347
|
-
if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
|
|
42348
|
-
emit('momentumBounce');
|
|
42349
|
-
swiper.setTransition(params.speed);
|
|
42350
|
-
setTimeout(() => {
|
|
42351
|
-
swiper.setTranslate(afterBouncePosition);
|
|
42352
|
-
elementTransitionEnd(wrapperEl, () => {
|
|
42353
|
-
if (!swiper || swiper.destroyed) return;
|
|
42354
|
-
swiper.transitionEnd();
|
|
42355
|
-
});
|
|
42356
|
-
}, 0);
|
|
42357
|
-
});
|
|
42358
|
-
} else if (swiper.velocity) {
|
|
42359
|
-
emit('_freeModeNoMomentumRelease');
|
|
42360
|
-
swiper.updateProgress(newPosition);
|
|
42361
|
-
swiper.setTransition(momentumDuration);
|
|
42362
|
-
swiper.setTranslate(newPosition);
|
|
42363
|
-
swiper.transitionStart(true, swiper.swipeDirection);
|
|
42364
|
-
if (!swiper.animating) {
|
|
42365
|
-
swiper.animating = true;
|
|
42366
|
-
elementTransitionEnd(wrapperEl, () => {
|
|
42367
|
-
if (!swiper || swiper.destroyed) return;
|
|
42368
|
-
swiper.transitionEnd();
|
|
42369
|
-
});
|
|
42370
|
-
}
|
|
42371
|
-
} else {
|
|
42372
|
-
swiper.updateProgress(newPosition);
|
|
42373
|
-
}
|
|
42374
|
-
swiper.updateActiveIndex();
|
|
42375
|
-
swiper.updateSlidesClasses();
|
|
42376
|
-
} else if (params.freeMode.sticky) {
|
|
42377
|
-
swiper.slideToClosest();
|
|
42378
|
-
return;
|
|
42379
|
-
} else if (params.freeMode) {
|
|
42380
|
-
emit('_freeModeNoMomentumRelease');
|
|
42381
|
-
}
|
|
42382
|
-
if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {
|
|
42383
|
-
swiper.updateProgress();
|
|
42384
|
-
swiper.updateActiveIndex();
|
|
42385
|
-
swiper.updateSlidesClasses();
|
|
42386
|
-
}
|
|
42387
|
-
}
|
|
42388
|
-
Object.assign(swiper, {
|
|
42389
|
-
freeMode: {
|
|
42390
|
-
onTouchStart,
|
|
42391
|
-
onTouchMove,
|
|
42392
|
-
onTouchEnd
|
|
42393
|
-
}
|
|
42394
|
-
});
|
|
42395
|
-
}
|
|
42396
|
-
|
|
42397
|
-
var GalleryClassic = function GalleryClassic(_ref) {
|
|
42398
|
-
var configurations = _ref.configurations,
|
|
42399
|
-
_ref$className = _ref.className,
|
|
42400
|
-
className = _ref$className === void 0 ? "" : _ref$className,
|
|
42401
|
-
id = _ref.id,
|
|
42402
|
-
disableButtonAndLinks = _ref.disableButtonAndLinks,
|
|
42403
|
-
image = _ref.image;
|
|
42404
|
-
var swiperRef = React.useRef(null);
|
|
42405
|
-
var properties = configurations.properties,
|
|
42406
|
-
design = configurations.design;
|
|
42407
|
-
var _properties$content = properties.content,
|
|
42408
|
-
title = _properties$content.title,
|
|
42409
|
-
description = _properties$content.description,
|
|
42410
|
-
enableAnimation = properties.enableAnimation,
|
|
42411
|
-
_properties$images = properties.images,
|
|
42412
|
-
images = _properties$images === void 0 ? [] : _properties$images,
|
|
42413
|
-
src = properties.backgroundImage.src;
|
|
42414
|
-
var baseClasses = "grid grid-cols-12 items-center gap-y-8";
|
|
42415
|
-
return /*#__PURE__*/React__default["default"].createElement(BlockWrapper, {
|
|
42416
|
-
className: className,
|
|
42417
|
-
enableAnimation: enableAnimation,
|
|
42418
|
-
id: id,
|
|
42419
|
-
backgroundImage: mergeLeft({
|
|
42420
|
-
src: src
|
|
42421
|
-
}, design.backgroundImage),
|
|
42422
|
-
design: design.body,
|
|
42423
|
-
nestedClassName: baseClasses
|
|
42424
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
42425
|
-
className: "col-span-12 col-start-1 sm:col-span-6 sm:col-start-4"
|
|
42426
|
-
}, /*#__PURE__*/React__default["default"].createElement(Typography$1, {
|
|
42427
|
-
disableButtonAndLinks: disableButtonAndLinks,
|
|
42428
|
-
isTitle: true,
|
|
42429
|
-
component: "h3",
|
|
42430
|
-
id: "gallery-classic-title",
|
|
42431
|
-
style: design.title
|
|
42432
|
-
}, title), /*#__PURE__*/React__default["default"].createElement(Typography$1, {
|
|
42433
|
-
disableButtonAndLinks: disableButtonAndLinks,
|
|
42434
|
-
id: "gallery-classic-description",
|
|
42435
|
-
style: design.description
|
|
42436
|
-
}, description)), /*#__PURE__*/React__default["default"].createElement(ArrowButton, {
|
|
42437
|
-
isStart: true,
|
|
42438
|
-
Icon: ArrowLeft$1,
|
|
42439
|
-
className: "hidden sm:flex",
|
|
42440
|
-
design: design.navigationButtons,
|
|
42441
|
-
onClick: function onClick() {
|
|
42442
|
-
var _swiperRef$current;
|
|
42443
|
-
return (_swiperRef$current = swiperRef.current) === null || _swiperRef$current === void 0 ? void 0 : _swiperRef$current.slidePrev();
|
|
42444
|
-
}
|
|
42445
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
42446
|
-
className: "ns-gallery-with-multiple-images col-span-10 col-start-2"
|
|
42447
|
-
}, /*#__PURE__*/React__default["default"].createElement(Swiper, {
|
|
42448
|
-
freeMode: true,
|
|
42449
|
-
grabCursor: true,
|
|
42450
|
-
loop: true,
|
|
42451
|
-
breakpointsBase: "container",
|
|
42452
|
-
modules: [Pagination, Mousewheel, freeMode],
|
|
42453
|
-
mousewheel: {
|
|
42454
|
-
sensitivity: 0.5
|
|
42455
|
-
},
|
|
42456
|
-
pagination: {
|
|
42457
|
-
clickable: true
|
|
42458
|
-
},
|
|
42459
|
-
slidesPerView: 1,
|
|
42460
|
-
spaceBetween: 10,
|
|
42461
|
-
breakpoints: {
|
|
42462
|
-
640: {
|
|
42463
|
-
slidesPerView: 2,
|
|
42464
|
-
spaceBetween: 10
|
|
42465
|
-
}
|
|
42466
|
-
},
|
|
42467
|
-
onSwiper: function onSwiper(swiper) {
|
|
42468
|
-
swiperRef.current = swiper;
|
|
42469
|
-
}
|
|
42470
|
-
}, images.map(function (_ref2, index) {
|
|
42471
|
-
var src = _ref2.src,
|
|
42472
|
-
caption = _ref2.title,
|
|
42473
|
-
style = _ref2.style;
|
|
42474
|
-
return /*#__PURE__*/React__default["default"].createElement(SwiperSlide, {
|
|
42475
|
-
className: "swiper__wrapper",
|
|
42476
|
-
key: getUniqueKey(src, title, index)
|
|
42477
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
|
|
42478
|
-
disableButtonAndLinks: disableButtonAndLinks,
|
|
42479
|
-
image: image,
|
|
42480
|
-
index: index,
|
|
42481
|
-
src: src,
|
|
42482
|
-
alt: caption,
|
|
42483
|
-
className: "sliding-image",
|
|
42484
|
-
design: style,
|
|
42485
|
-
id: "gallery-classic-images-".concat(index, "-image"),
|
|
42486
|
-
title: caption,
|
|
42487
|
-
wrapperClassName: "h-full w-full"
|
|
42488
|
-
}));
|
|
42489
|
-
}))), /*#__PURE__*/React__default["default"].createElement(ArrowButton, {
|
|
42490
|
-
Icon: ArrowRight$1,
|
|
42491
|
-
className: "hidden sm:flex",
|
|
42492
|
-
design: design.navigationButtons,
|
|
42493
|
-
onClick: function onClick() {
|
|
42494
|
-
var _swiperRef$current2;
|
|
42495
|
-
return (_swiperRef$current2 = swiperRef.current) === null || _swiperRef$current2 === void 0 ? void 0 : _swiperRef$current2.slideNext();
|
|
42496
|
-
}
|
|
42497
|
-
}));
|
|
42498
|
-
};
|
|
42499
|
-
|
|
42500
41376
|
var _excluded$a = ["configurations", "className", "id", "image"];
|
|
42501
41377
|
var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
42502
41378
|
var configurations = _ref.configurations,
|
|
@@ -42509,6 +41385,10 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
42509
41385
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
42510
41386
|
thumbsSwiper = _useState2[0],
|
|
42511
41387
|
setThumbsSwiper = _useState2[1];
|
|
41388
|
+
var _useState3 = React.useState(null),
|
|
41389
|
+
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
41390
|
+
swiper = _useState4[0],
|
|
41391
|
+
setSwiper = _useState4[1];
|
|
42512
41392
|
var properties = configurations.properties,
|
|
42513
41393
|
design = configurations.design;
|
|
42514
41394
|
var _properties$content = properties.content,
|
|
@@ -42524,7 +41404,6 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
42524
41404
|
className: className,
|
|
42525
41405
|
enableAnimation: enableAnimation,
|
|
42526
41406
|
id: id,
|
|
42527
|
-
as: "footer",
|
|
42528
41407
|
backgroundImage: mergeLeft({
|
|
42529
41408
|
src: src
|
|
42530
41409
|
}, design.backgroundImage),
|
|
@@ -42548,17 +41427,15 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
42548
41427
|
delay: 5000,
|
|
42549
41428
|
disableOnInteraction: false
|
|
42550
41429
|
},
|
|
42551
|
-
modules: [Thumb, Autoplay
|
|
42552
|
-
mousewheel: {
|
|
42553
|
-
sensitivity: 0.5
|
|
42554
|
-
},
|
|
41430
|
+
modules: [Thumb, Autoplay],
|
|
42555
41431
|
pagination: !isThumbsView && {
|
|
42556
41432
|
clickable: true
|
|
42557
41433
|
},
|
|
42558
41434
|
spaceBetween: 10,
|
|
42559
41435
|
thumbs: {
|
|
42560
41436
|
swiper: thumbsSwiper
|
|
42561
|
-
}
|
|
41437
|
+
},
|
|
41438
|
+
onSwiper: setSwiper
|
|
42562
41439
|
}, images.map(function (_ref2, index) {
|
|
42563
41440
|
var src = _ref2.src,
|
|
42564
41441
|
caption = _ref2.title,
|
|
@@ -42580,18 +41457,14 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
42580
41457
|
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
42581
41458
|
className: "ns-gallery-with-sliding-images sm:col-span-6 sm:col-start-4"
|
|
42582
41459
|
}, isThumbsView && /*#__PURE__*/React__default["default"].createElement(Swiper, {
|
|
42583
|
-
freeMode: true,
|
|
42584
41460
|
watchSlidesProgress: true,
|
|
42585
|
-
modules: [Thumb
|
|
42586
|
-
mousewheel: {
|
|
42587
|
-
sensitivity: 0.5
|
|
42588
|
-
},
|
|
41461
|
+
modules: [Thumb],
|
|
42589
41462
|
pagination: {
|
|
42590
41463
|
clickable: true
|
|
42591
41464
|
},
|
|
42592
41465
|
slidesPerView: 4,
|
|
42593
41466
|
spaceBetween: 12,
|
|
42594
|
-
className: classnames("hidden sm:block", {
|
|
41467
|
+
className: classnames("pointer-events-none hidden sm:block", {
|
|
42595
41468
|
swiper__thumbs__slide: images.length <= 3
|
|
42596
41469
|
}),
|
|
42597
41470
|
onSwiper: setThumbsSwiper
|
|
@@ -42600,8 +41473,11 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
42600
41473
|
alt = _ref3.alt,
|
|
42601
41474
|
title = _ref3.title;
|
|
42602
41475
|
return /*#__PURE__*/React__default["default"].createElement(SwiperSlide, {
|
|
42603
|
-
className: "cursor-pointer",
|
|
42604
|
-
key: getUniqueKey(src, title, index)
|
|
41476
|
+
className: "!pointer-events-auto cursor-pointer",
|
|
41477
|
+
key: getUniqueKey(src, title, index),
|
|
41478
|
+
onClick: function onClick() {
|
|
41479
|
+
return swiper === null || swiper === void 0 ? void 0 : swiper.slideTo(index);
|
|
41480
|
+
}
|
|
42605
41481
|
}, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
|
|
42606
41482
|
alt: alt,
|
|
42607
41483
|
image: image,
|
|
@@ -42610,6 +41486,10 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
42610
41486
|
title: title,
|
|
42611
41487
|
className: "clickable-image"
|
|
42612
41488
|
}));
|
|
41489
|
+
}), /*#__PURE__*/React__default["default"].createElement(Pagination, {
|
|
41490
|
+
swiper: swiper,
|
|
41491
|
+
className: "!pointer-events-auto",
|
|
41492
|
+
design: design.button
|
|
42613
41493
|
}))));
|
|
42614
41494
|
};
|
|
42615
41495
|
|
|
@@ -43347,7 +42227,7 @@ var HeroWithGallery = function HeroWithGallery(_ref) {
|
|
|
43347
42227
|
media: media,
|
|
43348
42228
|
index: index
|
|
43349
42229
|
}));
|
|
43350
|
-
}), /*#__PURE__*/React__default["default"].createElement(Pagination
|
|
42230
|
+
}), /*#__PURE__*/React__default["default"].createElement(Pagination, {
|
|
43351
42231
|
swiper: swiper,
|
|
43352
42232
|
className: "!relative"
|
|
43353
42233
|
})), /*#__PURE__*/React__default["default"].createElement(ArrowButton, {
|
|
@@ -43877,7 +42757,7 @@ var TestimonialWithSlider = function TestimonialWithSlider(_ref) {
|
|
|
43877
42757
|
disableButtonAndLinks: otherProps.disableButtonAndLinks,
|
|
43878
42758
|
id: "testimonial-with-slider-".concat(index, "-description")
|
|
43879
42759
|
}), testimonialDescription))));
|
|
43880
|
-
}), /*#__PURE__*/React__default["default"].createElement(Pagination
|
|
42760
|
+
}), /*#__PURE__*/React__default["default"].createElement(Pagination, {
|
|
43881
42761
|
swiper: swiper,
|
|
43882
42762
|
hasNavigation: true,
|
|
43883
42763
|
design: design.buttons
|