@bigbinary/neeto-site-blocks 1.1.0 → 1.1.1
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 +263 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +263 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -16024,6 +16024,16 @@ function elementParents(el, selector) {
|
|
|
16024
16024
|
}
|
|
16025
16025
|
return parents;
|
|
16026
16026
|
}
|
|
16027
|
+
function elementTransitionEnd(el, callback) {
|
|
16028
|
+
function fireCallBack(e) {
|
|
16029
|
+
if (e.target !== el) return;
|
|
16030
|
+
callback.call(el, e);
|
|
16031
|
+
el.removeEventListener('transitionend', fireCallBack);
|
|
16032
|
+
}
|
|
16033
|
+
if (callback) {
|
|
16034
|
+
el.addEventListener('transitionend', fireCallBack);
|
|
16035
|
+
}
|
|
16036
|
+
}
|
|
16027
16037
|
function elementOuterSize(el, size, includeMargins) {
|
|
16028
16038
|
const window = getWindow();
|
|
16029
16039
|
if (includeMargins) {
|
|
@@ -39976,6 +39986,239 @@ function Thumb(_ref) {
|
|
|
39976
39986
|
});
|
|
39977
39987
|
}
|
|
39978
39988
|
|
|
39989
|
+
function freeMode(_ref) {
|
|
39990
|
+
let {
|
|
39991
|
+
swiper,
|
|
39992
|
+
extendParams,
|
|
39993
|
+
emit,
|
|
39994
|
+
once
|
|
39995
|
+
} = _ref;
|
|
39996
|
+
extendParams({
|
|
39997
|
+
freeMode: {
|
|
39998
|
+
enabled: false,
|
|
39999
|
+
momentum: true,
|
|
40000
|
+
momentumRatio: 1,
|
|
40001
|
+
momentumBounce: true,
|
|
40002
|
+
momentumBounceRatio: 1,
|
|
40003
|
+
momentumVelocityRatio: 1,
|
|
40004
|
+
sticky: false,
|
|
40005
|
+
minimumVelocity: 0.02
|
|
40006
|
+
}
|
|
40007
|
+
});
|
|
40008
|
+
function onTouchStart() {
|
|
40009
|
+
if (swiper.params.cssMode) return;
|
|
40010
|
+
const translate = swiper.getTranslate();
|
|
40011
|
+
swiper.setTranslate(translate);
|
|
40012
|
+
swiper.setTransition(0);
|
|
40013
|
+
swiper.touchEventsData.velocities.length = 0;
|
|
40014
|
+
swiper.freeMode.onTouchEnd({
|
|
40015
|
+
currentPos: swiper.rtl ? swiper.translate : -swiper.translate
|
|
40016
|
+
});
|
|
40017
|
+
}
|
|
40018
|
+
function onTouchMove() {
|
|
40019
|
+
if (swiper.params.cssMode) return;
|
|
40020
|
+
const {
|
|
40021
|
+
touchEventsData: data,
|
|
40022
|
+
touches
|
|
40023
|
+
} = swiper;
|
|
40024
|
+
// Velocity
|
|
40025
|
+
if (data.velocities.length === 0) {
|
|
40026
|
+
data.velocities.push({
|
|
40027
|
+
position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
|
|
40028
|
+
time: data.touchStartTime
|
|
40029
|
+
});
|
|
40030
|
+
}
|
|
40031
|
+
data.velocities.push({
|
|
40032
|
+
position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
|
|
40033
|
+
time: now()
|
|
40034
|
+
});
|
|
40035
|
+
}
|
|
40036
|
+
function onTouchEnd(_ref2) {
|
|
40037
|
+
let {
|
|
40038
|
+
currentPos
|
|
40039
|
+
} = _ref2;
|
|
40040
|
+
if (swiper.params.cssMode) return;
|
|
40041
|
+
const {
|
|
40042
|
+
params,
|
|
40043
|
+
wrapperEl,
|
|
40044
|
+
rtlTranslate: rtl,
|
|
40045
|
+
snapGrid,
|
|
40046
|
+
touchEventsData: data
|
|
40047
|
+
} = swiper;
|
|
40048
|
+
// Time diff
|
|
40049
|
+
const touchEndTime = now();
|
|
40050
|
+
const timeDiff = touchEndTime - data.touchStartTime;
|
|
40051
|
+
if (currentPos < -swiper.minTranslate()) {
|
|
40052
|
+
swiper.slideTo(swiper.activeIndex);
|
|
40053
|
+
return;
|
|
40054
|
+
}
|
|
40055
|
+
if (currentPos > -swiper.maxTranslate()) {
|
|
40056
|
+
if (swiper.slides.length < snapGrid.length) {
|
|
40057
|
+
swiper.slideTo(snapGrid.length - 1);
|
|
40058
|
+
} else {
|
|
40059
|
+
swiper.slideTo(swiper.slides.length - 1);
|
|
40060
|
+
}
|
|
40061
|
+
return;
|
|
40062
|
+
}
|
|
40063
|
+
if (params.freeMode.momentum) {
|
|
40064
|
+
if (data.velocities.length > 1) {
|
|
40065
|
+
const lastMoveEvent = data.velocities.pop();
|
|
40066
|
+
const velocityEvent = data.velocities.pop();
|
|
40067
|
+
const distance = lastMoveEvent.position - velocityEvent.position;
|
|
40068
|
+
const time = lastMoveEvent.time - velocityEvent.time;
|
|
40069
|
+
swiper.velocity = distance / time;
|
|
40070
|
+
swiper.velocity /= 2;
|
|
40071
|
+
if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {
|
|
40072
|
+
swiper.velocity = 0;
|
|
40073
|
+
}
|
|
40074
|
+
// this implies that the user stopped moving a finger then released.
|
|
40075
|
+
// There would be no events with distance zero, so the last event is stale.
|
|
40076
|
+
if (time > 150 || now() - lastMoveEvent.time > 300) {
|
|
40077
|
+
swiper.velocity = 0;
|
|
40078
|
+
}
|
|
40079
|
+
} else {
|
|
40080
|
+
swiper.velocity = 0;
|
|
40081
|
+
}
|
|
40082
|
+
swiper.velocity *= params.freeMode.momentumVelocityRatio;
|
|
40083
|
+
data.velocities.length = 0;
|
|
40084
|
+
let momentumDuration = 1000 * params.freeMode.momentumRatio;
|
|
40085
|
+
const momentumDistance = swiper.velocity * momentumDuration;
|
|
40086
|
+
let newPosition = swiper.translate + momentumDistance;
|
|
40087
|
+
if (rtl) newPosition = -newPosition;
|
|
40088
|
+
let doBounce = false;
|
|
40089
|
+
let afterBouncePosition;
|
|
40090
|
+
const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;
|
|
40091
|
+
let needsLoopFix;
|
|
40092
|
+
if (newPosition < swiper.maxTranslate()) {
|
|
40093
|
+
if (params.freeMode.momentumBounce) {
|
|
40094
|
+
if (newPosition + swiper.maxTranslate() < -bounceAmount) {
|
|
40095
|
+
newPosition = swiper.maxTranslate() - bounceAmount;
|
|
40096
|
+
}
|
|
40097
|
+
afterBouncePosition = swiper.maxTranslate();
|
|
40098
|
+
doBounce = true;
|
|
40099
|
+
data.allowMomentumBounce = true;
|
|
40100
|
+
} else {
|
|
40101
|
+
newPosition = swiper.maxTranslate();
|
|
40102
|
+
}
|
|
40103
|
+
if (params.loop && params.centeredSlides) needsLoopFix = true;
|
|
40104
|
+
} else if (newPosition > swiper.minTranslate()) {
|
|
40105
|
+
if (params.freeMode.momentumBounce) {
|
|
40106
|
+
if (newPosition - swiper.minTranslate() > bounceAmount) {
|
|
40107
|
+
newPosition = swiper.minTranslate() + bounceAmount;
|
|
40108
|
+
}
|
|
40109
|
+
afterBouncePosition = swiper.minTranslate();
|
|
40110
|
+
doBounce = true;
|
|
40111
|
+
data.allowMomentumBounce = true;
|
|
40112
|
+
} else {
|
|
40113
|
+
newPosition = swiper.minTranslate();
|
|
40114
|
+
}
|
|
40115
|
+
if (params.loop && params.centeredSlides) needsLoopFix = true;
|
|
40116
|
+
} else if (params.freeMode.sticky) {
|
|
40117
|
+
let nextSlide;
|
|
40118
|
+
for (let j = 0; j < snapGrid.length; j += 1) {
|
|
40119
|
+
if (snapGrid[j] > -newPosition) {
|
|
40120
|
+
nextSlide = j;
|
|
40121
|
+
break;
|
|
40122
|
+
}
|
|
40123
|
+
}
|
|
40124
|
+
if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
|
|
40125
|
+
newPosition = snapGrid[nextSlide];
|
|
40126
|
+
} else {
|
|
40127
|
+
newPosition = snapGrid[nextSlide - 1];
|
|
40128
|
+
}
|
|
40129
|
+
newPosition = -newPosition;
|
|
40130
|
+
}
|
|
40131
|
+
if (needsLoopFix) {
|
|
40132
|
+
once('transitionEnd', () => {
|
|
40133
|
+
swiper.loopFix();
|
|
40134
|
+
});
|
|
40135
|
+
}
|
|
40136
|
+
// Fix duration
|
|
40137
|
+
if (swiper.velocity !== 0) {
|
|
40138
|
+
if (rtl) {
|
|
40139
|
+
momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
|
|
40140
|
+
} else {
|
|
40141
|
+
momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
|
|
40142
|
+
}
|
|
40143
|
+
if (params.freeMode.sticky) {
|
|
40144
|
+
// If freeMode.sticky is active and the user ends a swipe with a slow-velocity
|
|
40145
|
+
// event, then durations can be 20+ seconds to slide one (or zero!) slides.
|
|
40146
|
+
// It's easy to see this when simulating touch with mouse events. To fix this,
|
|
40147
|
+
// limit single-slide swipes to the default slide duration. This also has the
|
|
40148
|
+
// nice side effect of matching slide speed if the user stopped moving before
|
|
40149
|
+
// lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
|
|
40150
|
+
// For faster swipes, also apply limits (albeit higher ones).
|
|
40151
|
+
const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
|
|
40152
|
+
const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
|
|
40153
|
+
if (moveDistance < currentSlideSize) {
|
|
40154
|
+
momentumDuration = params.speed;
|
|
40155
|
+
} else if (moveDistance < 2 * currentSlideSize) {
|
|
40156
|
+
momentumDuration = params.speed * 1.5;
|
|
40157
|
+
} else {
|
|
40158
|
+
momentumDuration = params.speed * 2.5;
|
|
40159
|
+
}
|
|
40160
|
+
}
|
|
40161
|
+
} else if (params.freeMode.sticky) {
|
|
40162
|
+
swiper.slideToClosest();
|
|
40163
|
+
return;
|
|
40164
|
+
}
|
|
40165
|
+
if (params.freeMode.momentumBounce && doBounce) {
|
|
40166
|
+
swiper.updateProgress(afterBouncePosition);
|
|
40167
|
+
swiper.setTransition(momentumDuration);
|
|
40168
|
+
swiper.setTranslate(newPosition);
|
|
40169
|
+
swiper.transitionStart(true, swiper.swipeDirection);
|
|
40170
|
+
swiper.animating = true;
|
|
40171
|
+
elementTransitionEnd(wrapperEl, () => {
|
|
40172
|
+
if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
|
|
40173
|
+
emit('momentumBounce');
|
|
40174
|
+
swiper.setTransition(params.speed);
|
|
40175
|
+
setTimeout(() => {
|
|
40176
|
+
swiper.setTranslate(afterBouncePosition);
|
|
40177
|
+
elementTransitionEnd(wrapperEl, () => {
|
|
40178
|
+
if (!swiper || swiper.destroyed) return;
|
|
40179
|
+
swiper.transitionEnd();
|
|
40180
|
+
});
|
|
40181
|
+
}, 0);
|
|
40182
|
+
});
|
|
40183
|
+
} else if (swiper.velocity) {
|
|
40184
|
+
emit('_freeModeNoMomentumRelease');
|
|
40185
|
+
swiper.updateProgress(newPosition);
|
|
40186
|
+
swiper.setTransition(momentumDuration);
|
|
40187
|
+
swiper.setTranslate(newPosition);
|
|
40188
|
+
swiper.transitionStart(true, swiper.swipeDirection);
|
|
40189
|
+
if (!swiper.animating) {
|
|
40190
|
+
swiper.animating = true;
|
|
40191
|
+
elementTransitionEnd(wrapperEl, () => {
|
|
40192
|
+
if (!swiper || swiper.destroyed) return;
|
|
40193
|
+
swiper.transitionEnd();
|
|
40194
|
+
});
|
|
40195
|
+
}
|
|
40196
|
+
} else {
|
|
40197
|
+
swiper.updateProgress(newPosition);
|
|
40198
|
+
}
|
|
40199
|
+
swiper.updateActiveIndex();
|
|
40200
|
+
swiper.updateSlidesClasses();
|
|
40201
|
+
} else if (params.freeMode.sticky) {
|
|
40202
|
+
swiper.slideToClosest();
|
|
40203
|
+
return;
|
|
40204
|
+
} else if (params.freeMode) {
|
|
40205
|
+
emit('_freeModeNoMomentumRelease');
|
|
40206
|
+
}
|
|
40207
|
+
if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {
|
|
40208
|
+
swiper.updateProgress();
|
|
40209
|
+
swiper.updateActiveIndex();
|
|
40210
|
+
swiper.updateSlidesClasses();
|
|
40211
|
+
}
|
|
40212
|
+
}
|
|
40213
|
+
Object.assign(swiper, {
|
|
40214
|
+
freeMode: {
|
|
40215
|
+
onTouchStart,
|
|
40216
|
+
onTouchMove,
|
|
40217
|
+
onTouchEnd
|
|
40218
|
+
}
|
|
40219
|
+
});
|
|
40220
|
+
}
|
|
40221
|
+
|
|
39979
40222
|
var GalleryClassic = function GalleryClassic(_ref) {
|
|
39980
40223
|
var configurations = _ref.configurations,
|
|
39981
40224
|
_ref$className = _ref.className,
|
|
@@ -40088,14 +40331,14 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
40088
40331
|
src = properties.backgroundImage.src;
|
|
40089
40332
|
var baseClasses = "grid grid-cols-12 items-center gap-y-8";
|
|
40090
40333
|
return /*#__PURE__*/React__default["default"].createElement(BlockWrapper, {
|
|
40334
|
+
className: className,
|
|
40335
|
+
enableAnimation: enableAnimation,
|
|
40336
|
+
id: id,
|
|
40091
40337
|
as: "footer",
|
|
40092
40338
|
backgroundImage: mergeLeft({
|
|
40093
40339
|
src: src
|
|
40094
40340
|
}, design.backgroundImage),
|
|
40095
|
-
className: className,
|
|
40096
40341
|
design: design.body,
|
|
40097
|
-
enableAnimation: enableAnimation,
|
|
40098
|
-
id: id,
|
|
40099
40342
|
nestedClassName: baseClasses
|
|
40100
40343
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40101
40344
|
className: "col-span-12 col-start-1 sm:col-span-6 sm:col-start-4"
|
|
@@ -40109,50 +40352,49 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
40109
40352
|
}, description)), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40110
40353
|
className: "ns-gallery-with-sliding-images col-span-12 space-y-6 sm:col-span-10 sm:col-start-2"
|
|
40111
40354
|
}, /*#__PURE__*/React__default["default"].createElement(Swiper, {
|
|
40355
|
+
autoplay: {
|
|
40356
|
+
delay: 5000,
|
|
40357
|
+
disableOnInteraction: false
|
|
40358
|
+
},
|
|
40112
40359
|
modules: [Thumb, Autoplay, Mousewheel, Pagination],
|
|
40360
|
+
mousewheel: {
|
|
40361
|
+
sensitivity: 0.5
|
|
40362
|
+
},
|
|
40113
40363
|
pagination: !isThumbsView && {
|
|
40114
40364
|
clickable: true
|
|
40115
40365
|
},
|
|
40116
40366
|
spaceBetween: 10,
|
|
40117
40367
|
thumbs: {
|
|
40118
40368
|
swiper: thumbsSwiper
|
|
40119
|
-
},
|
|
40120
|
-
autoplay: {
|
|
40121
|
-
delay: 5000,
|
|
40122
|
-
enabled: true,
|
|
40123
|
-
disableOnInteraction: false
|
|
40124
|
-
},
|
|
40125
|
-
mouseWheel: {
|
|
40126
|
-
sensitivity: 0.5,
|
|
40127
|
-
enabled: true
|
|
40128
40369
|
}
|
|
40129
40370
|
}, images.map(function (_ref2, index) {
|
|
40130
40371
|
var src = _ref2.src,
|
|
40131
40372
|
alt = _ref2.alt,
|
|
40132
40373
|
title = _ref2.title;
|
|
40133
40374
|
return /*#__PURE__*/React__default["default"].createElement(SwiperSlide, {
|
|
40375
|
+
className: "swiper__wrapper",
|
|
40134
40376
|
key: getUniqueKey(src, title, index)
|
|
40135
40377
|
}, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
|
|
40136
40378
|
alt: alt,
|
|
40137
|
-
className: "sliding-image",
|
|
40138
40379
|
src: src,
|
|
40139
|
-
title: title
|
|
40380
|
+
title: title,
|
|
40381
|
+
className: "sliding-image"
|
|
40140
40382
|
}));
|
|
40141
40383
|
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40142
40384
|
className: "ns-gallery-with-sliding-images sm:col-span-6 sm:col-start-4"
|
|
40143
40385
|
}, isThumbsView && /*#__PURE__*/React__default["default"].createElement(Swiper, {
|
|
40386
|
+
freeMode: true,
|
|
40144
40387
|
watchSlidesProgress: true,
|
|
40145
40388
|
className: "hidden sm:block",
|
|
40146
|
-
modules: [Thumb, Pagination, Mousewheel],
|
|
40389
|
+
modules: [Thumb, Pagination, Mousewheel, freeMode],
|
|
40390
|
+
mousewheel: {
|
|
40391
|
+
sensitivity: 0.5
|
|
40392
|
+
},
|
|
40147
40393
|
pagination: {
|
|
40148
40394
|
clickable: true
|
|
40149
40395
|
},
|
|
40150
40396
|
slidesPerView: 4,
|
|
40151
40397
|
spaceBetween: 12,
|
|
40152
|
-
mouseWheel: {
|
|
40153
|
-
sensitivity: 0.5,
|
|
40154
|
-
enabled: true
|
|
40155
|
-
},
|
|
40156
40398
|
onSwiper: setThumbsSwiper
|
|
40157
40399
|
}, images.map(function (_ref3, index) {
|
|
40158
40400
|
var src = _ref3.src,
|
|
@@ -40163,9 +40405,9 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
40163
40405
|
key: getUniqueKey(src, title, index)
|
|
40164
40406
|
}, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
|
|
40165
40407
|
alt: alt,
|
|
40166
|
-
className: "clickable-image",
|
|
40167
40408
|
src: src,
|
|
40168
|
-
title: title
|
|
40409
|
+
title: title,
|
|
40410
|
+
className: "clickable-image"
|
|
40169
40411
|
}));
|
|
40170
40412
|
}))));
|
|
40171
40413
|
};
|