@deot/vc 1.0.64 → 1.0.65
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.iife.js +25 -2
- package/dist/index.umd.cjs +25 -2
- package/package.json +4 -4
package/dist/index.iife.js
CHANGED
|
@@ -10639,6 +10639,19 @@ var Vc = (function (exports, vue) {
|
|
|
10639
10639
|
}
|
|
10640
10640
|
});
|
|
10641
10641
|
const MCard = Card;
|
|
10642
|
+
const DRAG_CLICK_SUPPRESS_PX = 5;
|
|
10643
|
+
const swallowNextClickFromDrag = () => {
|
|
10644
|
+
let invoked = false;
|
|
10645
|
+
const options = { capture: true, once: true };
|
|
10646
|
+
const swallow = (e) => {
|
|
10647
|
+
invoked = true;
|
|
10648
|
+
e.preventDefault();
|
|
10649
|
+
e.stopPropagation();
|
|
10650
|
+
e.stopImmediatePropagation();
|
|
10651
|
+
};
|
|
10652
|
+
document.addEventListener("click", swallow, options);
|
|
10653
|
+
setTimeout(() => !invoked && document.removeEventListener("click", swallow, options), 0);
|
|
10654
|
+
};
|
|
10642
10655
|
const useCarousel = (wrapper, content, expose) => {
|
|
10643
10656
|
const instance = vue.getCurrentInstance();
|
|
10644
10657
|
const props2 = instance.props;
|
|
@@ -10651,6 +10664,7 @@ var Vc = (function (exports, vue) {
|
|
|
10651
10664
|
const start = vue.ref();
|
|
10652
10665
|
const startX = vue.ref();
|
|
10653
10666
|
const startY = vue.ref();
|
|
10667
|
+
const dragMovedPastThreshold = vue.ref(false);
|
|
10654
10668
|
const allowTransition = vue.ref(false);
|
|
10655
10669
|
const direction = vue.computed(() => {
|
|
10656
10670
|
return props2.vertical ? "vertical" : "horizontal";
|
|
@@ -10729,16 +10743,21 @@ var Vc = (function (exports, vue) {
|
|
|
10729
10743
|
if (!props2.draggable) return;
|
|
10730
10744
|
pauseTimer();
|
|
10731
10745
|
start.value = true;
|
|
10746
|
+
dragMovedPastThreshold.value = false;
|
|
10732
10747
|
startX.value = e.screenX;
|
|
10733
10748
|
startY.value = e.screenY;
|
|
10734
10749
|
};
|
|
10735
10750
|
const handleMove = (e) => {
|
|
10736
10751
|
if (!start.value || !props2.draggable) return;
|
|
10737
10752
|
offset.value = !props2.vertical ? e.screenX - startX.value : e.screenY - startY.value;
|
|
10753
|
+
if (Math.abs(offset.value) > DRAG_CLICK_SUPPRESS_PX) {
|
|
10754
|
+
dragMovedPastThreshold.value = true;
|
|
10755
|
+
}
|
|
10738
10756
|
resetItems();
|
|
10739
10757
|
};
|
|
10740
10758
|
const handleEnd = () => {
|
|
10741
10759
|
if (!props2.draggable) return;
|
|
10760
|
+
const shouldSwallowClick = dragMovedPastThreshold.value;
|
|
10742
10761
|
start.value = false;
|
|
10743
10762
|
startTimer();
|
|
10744
10763
|
const $offset = Math.abs(offset.value);
|
|
@@ -10750,6 +10769,10 @@ var Vc = (function (exports, vue) {
|
|
|
10750
10769
|
} else {
|
|
10751
10770
|
resetItems();
|
|
10752
10771
|
}
|
|
10772
|
+
if (shouldSwallowClick) {
|
|
10773
|
+
swallowNextClickFromDrag();
|
|
10774
|
+
}
|
|
10775
|
+
dragMovedPastThreshold.value = false;
|
|
10753
10776
|
};
|
|
10754
10777
|
vue.watch(
|
|
10755
10778
|
() => items.value,
|
|
@@ -11106,7 +11129,7 @@ var Vc = (function (exports, vue) {
|
|
|
11106
11129
|
};
|
|
11107
11130
|
const calcSlideOffset = (index, activeIndex, wrapperWidth) => {
|
|
11108
11131
|
const { length } = carousel.items.value;
|
|
11109
|
-
const offset = wrapperWidth - (
|
|
11132
|
+
const offset = wrapperWidth - (carousel.wrapper?.value?.offsetWidth || 0);
|
|
11110
11133
|
const gutter = itemGutter.value;
|
|
11111
11134
|
if (!gutter || isVertical.value) return 0;
|
|
11112
11135
|
let slideOffset = 0;
|
|
@@ -11139,7 +11162,7 @@ var Vc = (function (exports, vue) {
|
|
|
11139
11162
|
return slideOffset;
|
|
11140
11163
|
};
|
|
11141
11164
|
const calcTranslate = (index, activeIndex) => {
|
|
11142
|
-
const distance = carousel.
|
|
11165
|
+
const distance = carousel.wrapper.value[isVertical.value ? "offsetHeight" : "offsetWidth"];
|
|
11143
11166
|
const slideOffset = calcSlideOffset(index, activeIndex, distance);
|
|
11144
11167
|
return distance * (index - activeIndex) + carousel.offset.value + slideOffset;
|
|
11145
11168
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -10642,6 +10642,19 @@
|
|
|
10642
10642
|
}
|
|
10643
10643
|
});
|
|
10644
10644
|
const MCard = Card;
|
|
10645
|
+
const DRAG_CLICK_SUPPRESS_PX = 5;
|
|
10646
|
+
const swallowNextClickFromDrag = () => {
|
|
10647
|
+
let invoked = false;
|
|
10648
|
+
const options = { capture: true, once: true };
|
|
10649
|
+
const swallow = (e) => {
|
|
10650
|
+
invoked = true;
|
|
10651
|
+
e.preventDefault();
|
|
10652
|
+
e.stopPropagation();
|
|
10653
|
+
e.stopImmediatePropagation();
|
|
10654
|
+
};
|
|
10655
|
+
document.addEventListener("click", swallow, options);
|
|
10656
|
+
setTimeout(() => !invoked && document.removeEventListener("click", swallow, options), 0);
|
|
10657
|
+
};
|
|
10645
10658
|
const useCarousel = (wrapper, content, expose) => {
|
|
10646
10659
|
const instance = vue.getCurrentInstance();
|
|
10647
10660
|
const props2 = instance.props;
|
|
@@ -10654,6 +10667,7 @@
|
|
|
10654
10667
|
const start = vue.ref();
|
|
10655
10668
|
const startX = vue.ref();
|
|
10656
10669
|
const startY = vue.ref();
|
|
10670
|
+
const dragMovedPastThreshold = vue.ref(false);
|
|
10657
10671
|
const allowTransition = vue.ref(false);
|
|
10658
10672
|
const direction = vue.computed(() => {
|
|
10659
10673
|
return props2.vertical ? "vertical" : "horizontal";
|
|
@@ -10732,16 +10746,21 @@
|
|
|
10732
10746
|
if (!props2.draggable) return;
|
|
10733
10747
|
pauseTimer();
|
|
10734
10748
|
start.value = true;
|
|
10749
|
+
dragMovedPastThreshold.value = false;
|
|
10735
10750
|
startX.value = e.screenX;
|
|
10736
10751
|
startY.value = e.screenY;
|
|
10737
10752
|
};
|
|
10738
10753
|
const handleMove = (e) => {
|
|
10739
10754
|
if (!start.value || !props2.draggable) return;
|
|
10740
10755
|
offset.value = !props2.vertical ? e.screenX - startX.value : e.screenY - startY.value;
|
|
10756
|
+
if (Math.abs(offset.value) > DRAG_CLICK_SUPPRESS_PX) {
|
|
10757
|
+
dragMovedPastThreshold.value = true;
|
|
10758
|
+
}
|
|
10741
10759
|
resetItems();
|
|
10742
10760
|
};
|
|
10743
10761
|
const handleEnd = () => {
|
|
10744
10762
|
if (!props2.draggable) return;
|
|
10763
|
+
const shouldSwallowClick = dragMovedPastThreshold.value;
|
|
10745
10764
|
start.value = false;
|
|
10746
10765
|
startTimer();
|
|
10747
10766
|
const $offset = Math.abs(offset.value);
|
|
@@ -10753,6 +10772,10 @@
|
|
|
10753
10772
|
} else {
|
|
10754
10773
|
resetItems();
|
|
10755
10774
|
}
|
|
10775
|
+
if (shouldSwallowClick) {
|
|
10776
|
+
swallowNextClickFromDrag();
|
|
10777
|
+
}
|
|
10778
|
+
dragMovedPastThreshold.value = false;
|
|
10756
10779
|
};
|
|
10757
10780
|
vue.watch(
|
|
10758
10781
|
() => items.value,
|
|
@@ -11109,7 +11132,7 @@
|
|
|
11109
11132
|
};
|
|
11110
11133
|
const calcSlideOffset = (index, activeIndex, wrapperWidth) => {
|
|
11111
11134
|
const { length } = carousel.items.value;
|
|
11112
|
-
const offset = wrapperWidth - (
|
|
11135
|
+
const offset = wrapperWidth - (carousel.wrapper?.value?.offsetWidth || 0);
|
|
11113
11136
|
const gutter = itemGutter.value;
|
|
11114
11137
|
if (!gutter || isVertical.value) return 0;
|
|
11115
11138
|
let slideOffset = 0;
|
|
@@ -11142,7 +11165,7 @@
|
|
|
11142
11165
|
return slideOffset;
|
|
11143
11166
|
};
|
|
11144
11167
|
const calcTranslate = (index, activeIndex) => {
|
|
11145
|
-
const distance = carousel.
|
|
11168
|
+
const distance = carousel.wrapper.value[isVertical.value ? "offsetHeight" : "offsetWidth"];
|
|
11146
11169
|
const slideOffset = calcSlideOffset(index, activeIndex, distance);
|
|
11147
11170
|
return distance * (index - activeIndex) + carousel.offset.value + slideOffset;
|
|
11148
11171
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deot/vc",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.65",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@deot/vc-components": "^1.0.
|
|
23
|
-
"@deot/vc-hooks": "^1.0.
|
|
24
|
-
"@deot/vc-shared": "^1.0.
|
|
22
|
+
"@deot/vc-components": "^1.0.65",
|
|
23
|
+
"@deot/vc-hooks": "^1.0.65",
|
|
24
|
+
"@deot/vc-shared": "^1.0.65"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"vue": "*"
|