@vueuse/components 10.0.0-beta.2 → 10.0.0-beta.3
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/index.cjs +246 -144
- package/index.iife.js +246 -144
- package/index.iife.min.js +1 -1
- package/index.mjs +247 -145
- package/package.json +3 -3
package/index.iife.js
CHANGED
|
@@ -165,14 +165,20 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
165
165
|
el.addEventListener(event, listener, options2);
|
|
166
166
|
return () => el.removeEventListener(event, listener, options2);
|
|
167
167
|
};
|
|
168
|
-
const stopWatch = vueDemi.watch(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
const stopWatch = vueDemi.watch(
|
|
169
|
+
() => [unrefElement(target), shared.resolveUnref(options)],
|
|
170
|
+
([el, options2]) => {
|
|
171
|
+
cleanup();
|
|
172
|
+
if (!el)
|
|
173
|
+
return;
|
|
174
|
+
cleanups.push(
|
|
175
|
+
...events.flatMap((event) => {
|
|
176
|
+
return listeners.map((listener) => register(el, event, listener, options2));
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
},
|
|
180
|
+
{ immediate: true, flush: "post" }
|
|
181
|
+
);
|
|
176
182
|
const stop = () => {
|
|
177
183
|
stopWatch();
|
|
178
184
|
cleanup();
|
|
@@ -246,7 +252,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
246
252
|
}
|
|
247
253
|
};
|
|
248
254
|
|
|
249
|
-
|
|
255
|
+
function createKeyPredicate(keyFilter) {
|
|
250
256
|
if (typeof keyFilter === "function")
|
|
251
257
|
return keyFilter;
|
|
252
258
|
else if (typeof keyFilter === "string")
|
|
@@ -254,7 +260,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
254
260
|
else if (Array.isArray(keyFilter))
|
|
255
261
|
return (event) => keyFilter.includes(event.key);
|
|
256
262
|
return () => true;
|
|
257
|
-
}
|
|
263
|
+
}
|
|
258
264
|
function onKeyStroke(...args) {
|
|
259
265
|
let key;
|
|
260
266
|
let handler;
|
|
@@ -345,7 +351,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
345
351
|
ev.preventDefault();
|
|
346
352
|
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
347
353
|
ev.stopPropagation();
|
|
348
|
-
timeout = setTimeout(
|
|
354
|
+
timeout = setTimeout(
|
|
355
|
+
() => handler(ev),
|
|
356
|
+
(_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
|
|
357
|
+
);
|
|
349
358
|
}
|
|
350
359
|
const listenerOptions = {
|
|
351
360
|
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
@@ -362,9 +371,13 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
362
371
|
emits: ["trigger"],
|
|
363
372
|
setup(props, { slots, emit }) {
|
|
364
373
|
const target = vueDemi.ref();
|
|
365
|
-
onLongPress(
|
|
366
|
-
|
|
367
|
-
|
|
374
|
+
onLongPress(
|
|
375
|
+
target,
|
|
376
|
+
(e) => {
|
|
377
|
+
emit("trigger", e);
|
|
378
|
+
},
|
|
379
|
+
props.options
|
|
380
|
+
);
|
|
368
381
|
return () => {
|
|
369
382
|
if (slots.default)
|
|
370
383
|
return vueDemi.h(props.as || "div", { ref: target }, slots.default());
|
|
@@ -510,7 +523,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
510
523
|
const rawInit = shared.resolveUnref(defaults);
|
|
511
524
|
const type = guessSerializerType(rawInit);
|
|
512
525
|
const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
|
|
513
|
-
const { pause: pauseWatch, resume: resumeWatch } = shared.pausableWatch(
|
|
526
|
+
const { pause: pauseWatch, resume: resumeWatch } = shared.pausableWatch(
|
|
527
|
+
data,
|
|
528
|
+
() => write(data.value),
|
|
529
|
+
{ flush, deep, eventFilter }
|
|
530
|
+
);
|
|
514
531
|
if (window && listenToStorageChanges) {
|
|
515
532
|
useEventListener(window, "storage", update);
|
|
516
533
|
useEventListener(window, customStorageEventName, updateFromCustomEvent);
|
|
@@ -589,9 +606,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
589
606
|
|
|
590
607
|
function useMounted() {
|
|
591
608
|
const isMounted = vueDemi.ref(false);
|
|
592
|
-
vueDemi.
|
|
593
|
-
|
|
594
|
-
|
|
609
|
+
if (vueDemi.getCurrentInstance()) {
|
|
610
|
+
vueDemi.onMounted(() => {
|
|
611
|
+
isMounted.value = true;
|
|
612
|
+
});
|
|
613
|
+
}
|
|
595
614
|
return isMounted;
|
|
596
615
|
}
|
|
597
616
|
|
|
@@ -621,7 +640,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
621
640
|
return;
|
|
622
641
|
cleanup();
|
|
623
642
|
mediaQuery = window.matchMedia(shared.resolveRef(query).value);
|
|
624
|
-
matches.value = mediaQuery.matches;
|
|
643
|
+
matches.value = !!(mediaQuery == null ? void 0 : mediaQuery.matches);
|
|
644
|
+
if (!mediaQuery)
|
|
645
|
+
return;
|
|
625
646
|
if ("addEventListener" in mediaQuery)
|
|
626
647
|
mediaQuery.addEventListener("change", update);
|
|
627
648
|
else
|
|
@@ -663,6 +684,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
663
684
|
listenToStorageChanges = true,
|
|
664
685
|
storageRef,
|
|
665
686
|
emitAuto,
|
|
687
|
+
// TODO: switch to true in v10
|
|
666
688
|
disableTransition = false
|
|
667
689
|
} = options;
|
|
668
690
|
const modes = __spreadValues$b({
|
|
@@ -681,33 +703,36 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
681
703
|
store.value = v;
|
|
682
704
|
}
|
|
683
705
|
});
|
|
684
|
-
const updateHTMLAttrs = getSSRHandler(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
706
|
+
const updateHTMLAttrs = getSSRHandler(
|
|
707
|
+
"updateHTMLAttrs",
|
|
708
|
+
(selector2, attribute2, value) => {
|
|
709
|
+
const el = window == null ? void 0 : window.document.querySelector(selector2);
|
|
710
|
+
if (!el)
|
|
711
|
+
return;
|
|
712
|
+
let style;
|
|
713
|
+
if (disableTransition) {
|
|
714
|
+
style = window.document.createElement("style");
|
|
715
|
+
style.type = "text/css";
|
|
716
|
+
style.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}"));
|
|
717
|
+
window.document.head.appendChild(style);
|
|
718
|
+
}
|
|
719
|
+
if (attribute2 === "class") {
|
|
720
|
+
const current = value.split(/\s/g);
|
|
721
|
+
Object.values(modes).flatMap((i) => (i || "").split(/\s/g)).filter(Boolean).forEach((v) => {
|
|
722
|
+
if (current.includes(v))
|
|
723
|
+
el.classList.add(v);
|
|
724
|
+
else
|
|
725
|
+
el.classList.remove(v);
|
|
726
|
+
});
|
|
727
|
+
} else {
|
|
728
|
+
el.setAttribute(attribute2, value);
|
|
729
|
+
}
|
|
730
|
+
if (disableTransition) {
|
|
731
|
+
window.getComputedStyle(style).opacity;
|
|
732
|
+
document.head.removeChild(style);
|
|
733
|
+
}
|
|
709
734
|
}
|
|
710
|
-
|
|
735
|
+
);
|
|
711
736
|
function defaultOnChanged(mode) {
|
|
712
737
|
var _a;
|
|
713
738
|
const resolvedMode = mode === "auto" ? preferredMode.value : mode;
|
|
@@ -847,7 +872,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
847
872
|
"stopPropagation",
|
|
848
873
|
"pointerTypes",
|
|
849
874
|
"as",
|
|
850
|
-
"handle"
|
|
875
|
+
"handle",
|
|
876
|
+
"axis"
|
|
851
877
|
],
|
|
852
878
|
setup(props, { slots }) {
|
|
853
879
|
const target = vueDemi.ref();
|
|
@@ -855,7 +881,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
855
881
|
var _a;
|
|
856
882
|
return (_a = props.handle) != null ? _a : target.value;
|
|
857
883
|
});
|
|
858
|
-
const storageValue = props.storageKey && core.useStorage(
|
|
884
|
+
const storageValue = props.storageKey && core.useStorage(
|
|
885
|
+
props.storageKey,
|
|
886
|
+
shared.resolveUnref(props.initialValue) || { x: 0, y: 0 },
|
|
887
|
+
core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : void 0
|
|
888
|
+
);
|
|
859
889
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
860
890
|
const onEnd = (position) => {
|
|
861
891
|
if (!storageValue)
|
|
@@ -961,15 +991,21 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
961
991
|
observer = void 0;
|
|
962
992
|
}
|
|
963
993
|
};
|
|
964
|
-
const targets = vueDemi.computed(
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
994
|
+
const targets = vueDemi.computed(
|
|
995
|
+
() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]
|
|
996
|
+
);
|
|
997
|
+
const stopWatch = vueDemi.watch(
|
|
998
|
+
targets,
|
|
999
|
+
(els) => {
|
|
1000
|
+
cleanup();
|
|
1001
|
+
if (isSupported.value && window) {
|
|
1002
|
+
observer = new ResizeObserver(callback);
|
|
1003
|
+
for (const _el of els)
|
|
1004
|
+
_el && observer.observe(_el, observerOptions);
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
{ immediate: true, flush: "post", deep: true }
|
|
1008
|
+
);
|
|
973
1009
|
const stop = () => {
|
|
974
1010
|
cleanup();
|
|
975
1011
|
stopWatch();
|
|
@@ -989,30 +1025,37 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
989
1025
|
});
|
|
990
1026
|
const width = vueDemi.ref(initialSize.width);
|
|
991
1027
|
const height = vueDemi.ref(initialSize.height);
|
|
992
|
-
useResizeObserver(
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
const
|
|
996
|
-
if (
|
|
997
|
-
const
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
|
|
1004
|
-
width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
|
|
1005
|
-
height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
|
|
1028
|
+
useResizeObserver(
|
|
1029
|
+
target,
|
|
1030
|
+
([entry]) => {
|
|
1031
|
+
const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
|
|
1032
|
+
if (window && isSVG.value) {
|
|
1033
|
+
const $elem = unrefElement(target);
|
|
1034
|
+
if ($elem) {
|
|
1035
|
+
const styles = window.getComputedStyle($elem);
|
|
1036
|
+
width.value = parseFloat(styles.width);
|
|
1037
|
+
height.value = parseFloat(styles.height);
|
|
1038
|
+
}
|
|
1006
1039
|
} else {
|
|
1007
|
-
|
|
1008
|
-
|
|
1040
|
+
if (boxSize) {
|
|
1041
|
+
const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
|
|
1042
|
+
width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
|
|
1043
|
+
height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
|
|
1044
|
+
} else {
|
|
1045
|
+
width.value = entry.contentRect.width;
|
|
1046
|
+
height.value = entry.contentRect.height;
|
|
1047
|
+
}
|
|
1009
1048
|
}
|
|
1049
|
+
},
|
|
1050
|
+
options
|
|
1051
|
+
);
|
|
1052
|
+
vueDemi.watch(
|
|
1053
|
+
() => unrefElement(target),
|
|
1054
|
+
(ele) => {
|
|
1055
|
+
width.value = ele ? initialSize.width : 0;
|
|
1056
|
+
height.value = ele ? initialSize.height : 0;
|
|
1010
1057
|
}
|
|
1011
|
-
|
|
1012
|
-
vueDemi.watch(() => unrefElement(target), (ele) => {
|
|
1013
|
-
width.value = ele ? initialSize.width : 0;
|
|
1014
|
-
height.value = ele ? initialSize.height : 0;
|
|
1015
|
-
});
|
|
1058
|
+
);
|
|
1016
1059
|
return {
|
|
1017
1060
|
width,
|
|
1018
1061
|
height
|
|
@@ -1053,24 +1096,31 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1053
1096
|
} = options;
|
|
1054
1097
|
const isSupported = useSupported(() => window && "IntersectionObserver" in window);
|
|
1055
1098
|
let cleanup = shared.noop;
|
|
1056
|
-
const stopWatch = isSupported.value ? vueDemi.watch(
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1099
|
+
const stopWatch = isSupported.value ? vueDemi.watch(
|
|
1100
|
+
() => ({
|
|
1101
|
+
el: unrefElement(target),
|
|
1102
|
+
root: unrefElement(root)
|
|
1103
|
+
}),
|
|
1104
|
+
({ el, root: root2 }) => {
|
|
1105
|
+
cleanup();
|
|
1106
|
+
if (!el)
|
|
1107
|
+
return;
|
|
1108
|
+
const observer = new IntersectionObserver(
|
|
1109
|
+
callback,
|
|
1110
|
+
{
|
|
1111
|
+
root: root2,
|
|
1112
|
+
rootMargin,
|
|
1113
|
+
threshold
|
|
1114
|
+
}
|
|
1115
|
+
);
|
|
1116
|
+
observer.observe(el);
|
|
1117
|
+
cleanup = () => {
|
|
1118
|
+
observer.disconnect();
|
|
1119
|
+
cleanup = shared.noop;
|
|
1120
|
+
};
|
|
1121
|
+
},
|
|
1122
|
+
{ immediate: true, flush: "post" }
|
|
1123
|
+
) : shared.noop;
|
|
1074
1124
|
const stop = () => {
|
|
1075
1125
|
cleanup();
|
|
1076
1126
|
stopWatch();
|
|
@@ -1084,12 +1134,16 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1084
1134
|
|
|
1085
1135
|
function useElementVisibility(element, { window = defaultWindow, scrollTarget } = {}) {
|
|
1086
1136
|
const elementIsVisible = vueDemi.ref(false);
|
|
1087
|
-
useIntersectionObserver(
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1137
|
+
useIntersectionObserver(
|
|
1138
|
+
element,
|
|
1139
|
+
([{ isIntersecting }]) => {
|
|
1140
|
+
elementIsVisible.value = isIntersecting;
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
root: scrollTarget,
|
|
1144
|
+
window
|
|
1145
|
+
}
|
|
1146
|
+
);
|
|
1093
1147
|
return elementIsVisible;
|
|
1094
1148
|
}
|
|
1095
1149
|
|
|
@@ -1236,13 +1290,21 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1236
1290
|
img.onerror = reject;
|
|
1237
1291
|
});
|
|
1238
1292
|
}
|
|
1239
|
-
|
|
1240
|
-
const state = useAsyncState(
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1293
|
+
function useImage(options, asyncStateOptions = {}) {
|
|
1294
|
+
const state = useAsyncState(
|
|
1295
|
+
() => loadImage(shared.resolveUnref(options)),
|
|
1296
|
+
void 0,
|
|
1297
|
+
__spreadValues$9({
|
|
1298
|
+
resetOnExecute: true
|
|
1299
|
+
}, asyncStateOptions)
|
|
1300
|
+
);
|
|
1301
|
+
vueDemi.watch(
|
|
1302
|
+
() => shared.resolveUnref(options),
|
|
1303
|
+
() => state.execute(asyncStateOptions.delay),
|
|
1304
|
+
{ deep: true }
|
|
1305
|
+
);
|
|
1244
1306
|
return state;
|
|
1245
|
-
}
|
|
1307
|
+
}
|
|
1246
1308
|
|
|
1247
1309
|
const UseImage = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1248
1310
|
name: "UseImage",
|
|
@@ -1358,8 +1420,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1358
1420
|
onScrollEndDebounced(e);
|
|
1359
1421
|
onScroll(e);
|
|
1360
1422
|
};
|
|
1361
|
-
useEventListener(
|
|
1362
|
-
|
|
1423
|
+
useEventListener(
|
|
1424
|
+
element,
|
|
1425
|
+
"scroll",
|
|
1426
|
+
throttle ? shared.useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler,
|
|
1427
|
+
eventListenerOptions
|
|
1428
|
+
);
|
|
1429
|
+
useEventListener(
|
|
1430
|
+
element,
|
|
1431
|
+
"scrollend",
|
|
1432
|
+
onScrollEnd,
|
|
1433
|
+
eventListenerOptions
|
|
1434
|
+
);
|
|
1363
1435
|
return {
|
|
1364
1436
|
x,
|
|
1365
1437
|
y,
|
|
@@ -1391,30 +1463,36 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1391
1463
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1392
1464
|
var _a, _b;
|
|
1393
1465
|
const direction = (_a = options.direction) != null ? _a : "bottom";
|
|
1394
|
-
const state = vueDemi.reactive(useScroll(
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
elem.
|
|
1411
|
-
|
|
1412
|
-
|
|
1466
|
+
const state = vueDemi.reactive(useScroll(
|
|
1467
|
+
element,
|
|
1468
|
+
__spreadProps$7(__spreadValues$8({}, options), {
|
|
1469
|
+
offset: __spreadValues$8({
|
|
1470
|
+
[direction]: (_b = options.distance) != null ? _b : 0
|
|
1471
|
+
}, options.offset)
|
|
1472
|
+
})
|
|
1473
|
+
));
|
|
1474
|
+
vueDemi.watch(
|
|
1475
|
+
() => state.arrivedState[direction],
|
|
1476
|
+
async (v) => {
|
|
1477
|
+
var _a2, _b2;
|
|
1478
|
+
if (v) {
|
|
1479
|
+
const elem = shared.resolveUnref(element);
|
|
1480
|
+
const previous = {
|
|
1481
|
+
height: (_a2 = elem == null ? void 0 : elem.scrollHeight) != null ? _a2 : 0,
|
|
1482
|
+
width: (_b2 = elem == null ? void 0 : elem.scrollWidth) != null ? _b2 : 0
|
|
1483
|
+
};
|
|
1484
|
+
await onLoadMore(state);
|
|
1485
|
+
if (options.preserveScrollPosition && elem) {
|
|
1486
|
+
vueDemi.nextTick(() => {
|
|
1487
|
+
elem.scrollTo({
|
|
1488
|
+
top: elem.scrollHeight - previous.height,
|
|
1489
|
+
left: elem.scrollWidth - previous.width
|
|
1490
|
+
});
|
|
1413
1491
|
});
|
|
1414
|
-
}
|
|
1492
|
+
}
|
|
1415
1493
|
}
|
|
1416
1494
|
}
|
|
1417
|
-
|
|
1495
|
+
);
|
|
1418
1496
|
}
|
|
1419
1497
|
|
|
1420
1498
|
const vInfiniteScroll = {
|
|
@@ -1772,12 +1850,19 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1772
1850
|
window
|
|
1773
1851
|
});
|
|
1774
1852
|
}
|
|
1775
|
-
vueDemi.watch(
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1853
|
+
vueDemi.watch(
|
|
1854
|
+
[elRef, () => shared.resolveUnref(prop)],
|
|
1855
|
+
updateCssVar,
|
|
1856
|
+
{ immediate: true }
|
|
1857
|
+
);
|
|
1858
|
+
vueDemi.watch(
|
|
1859
|
+
variable,
|
|
1860
|
+
(val) => {
|
|
1861
|
+
var _a;
|
|
1862
|
+
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
1863
|
+
elRef.value.style.setProperty(shared.resolveUnref(prop), val);
|
|
1864
|
+
}
|
|
1865
|
+
);
|
|
1781
1866
|
return variable;
|
|
1782
1867
|
}
|
|
1783
1868
|
|
|
@@ -1944,9 +2029,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1944
2029
|
if (!ele || isLocked.value)
|
|
1945
2030
|
return;
|
|
1946
2031
|
if (shared.isIOS) {
|
|
1947
|
-
stopTouchMoveListener = useEventListener(
|
|
1948
|
-
|
|
1949
|
-
|
|
2032
|
+
stopTouchMoveListener = useEventListener(
|
|
2033
|
+
ele,
|
|
2034
|
+
"touchmove",
|
|
2035
|
+
(e) => {
|
|
2036
|
+
preventDefault(e);
|
|
2037
|
+
},
|
|
2038
|
+
{ passive: false }
|
|
2039
|
+
);
|
|
1950
2040
|
}
|
|
1951
2041
|
ele.style.overflow = "hidden";
|
|
1952
2042
|
isLocked.value = true;
|
|
@@ -1973,7 +2063,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1973
2063
|
});
|
|
1974
2064
|
}
|
|
1975
2065
|
|
|
1976
|
-
|
|
2066
|
+
function onScrollLock() {
|
|
1977
2067
|
let isMounted = false;
|
|
1978
2068
|
const state = vueDemi.ref(false);
|
|
1979
2069
|
return (el, binding) => {
|
|
@@ -1984,7 +2074,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1984
2074
|
const isLocked = useScrollLock(el, binding.value);
|
|
1985
2075
|
vueDemi.watch(state, (v) => isLocked.value = v);
|
|
1986
2076
|
};
|
|
1987
|
-
}
|
|
2077
|
+
}
|
|
1988
2078
|
const vScrollLock = onScrollLock();
|
|
1989
2079
|
|
|
1990
2080
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -2077,9 +2167,21 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
2077
2167
|
const { list, containerProps, wrapperProps, scrollTo } = core.useVirtualList(listRef, props.options);
|
|
2078
2168
|
expose({ scrollTo });
|
|
2079
2169
|
typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
|
|
2080
|
-
return () => vueDemi.h(
|
|
2081
|
-
|
|
2082
|
-
|
|
2170
|
+
return () => vueDemi.h(
|
|
2171
|
+
"div",
|
|
2172
|
+
__spreadValues({}, containerProps),
|
|
2173
|
+
[
|
|
2174
|
+
vueDemi.h(
|
|
2175
|
+
"div",
|
|
2176
|
+
__spreadValues({}, wrapperProps.value),
|
|
2177
|
+
list.value.map((item) => vueDemi.h(
|
|
2178
|
+
"div",
|
|
2179
|
+
{ style: { overFlow: "hidden", height: item.height } },
|
|
2180
|
+
slots.default ? slots.default(item) : "Please set content!"
|
|
2181
|
+
))
|
|
2182
|
+
)
|
|
2183
|
+
]
|
|
2184
|
+
);
|
|
2083
2185
|
}
|
|
2084
2186
|
});
|
|
2085
2187
|
|