@vueuse/components 9.11.1 → 9.13.0
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 +114 -76
- package/index.iife.js +114 -76
- package/index.iife.min.js +1 -1
- package/index.mjs +115 -77
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent, ref, h, watch, computed, reactive, shallowRef, nextTick, watchEffect, toRef, toRefs } from 'vue-demi';
|
|
2
2
|
import { onClickOutside as onClickOutside$1, useActiveElement, useBattery, useBrowserLocation, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useStorage as useStorage$1, isClient as isClient$1, useDraggable, useElementBounding, useElementSize as useElementSize$1, useElementVisibility as useElementVisibility$1, useEyeDropper, useFullscreen, useGeolocation, useIdle, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark as usePreferredDark$1, usePreferredLanguages, usePreferredReducedMotion, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from '@vueuse/core';
|
|
3
|
-
import { resolveUnref, isClient, isString, noop, tryOnScopeDispose, directiveHooks, pausableWatch, isFunction, tryOnMounted, resolveRef, useToggle, promiseTimeout, useDebounceFn, useThrottleFn
|
|
3
|
+
import { resolveUnref, isClient, isString, noop, tryOnScopeDispose, isIOS, directiveHooks, pausableWatch, isFunction, tryOnMounted, resolveRef, useToggle, promiseTimeout, useDebounceFn, useThrottleFn } from '@vueuse/shared';
|
|
4
4
|
|
|
5
|
-
const OnClickOutside = /* @__PURE__ */ defineComponent({
|
|
5
|
+
const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
6
6
|
name: "OnClickOutside",
|
|
7
7
|
props: ["as", "options"],
|
|
8
8
|
emits: ["trigger"],
|
|
@@ -48,16 +48,16 @@ function useEventListener(...args) {
|
|
|
48
48
|
cleanups.forEach((fn) => fn());
|
|
49
49
|
cleanups.length = 0;
|
|
50
50
|
};
|
|
51
|
-
const register = (el, event, listener) => {
|
|
52
|
-
el.addEventListener(event, listener,
|
|
53
|
-
return () => el.removeEventListener(event, listener,
|
|
51
|
+
const register = (el, event, listener, options2) => {
|
|
52
|
+
el.addEventListener(event, listener, options2);
|
|
53
|
+
return () => el.removeEventListener(event, listener, options2);
|
|
54
54
|
};
|
|
55
|
-
const stopWatch = watch(() => unrefElement(target), (el) => {
|
|
55
|
+
const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
|
|
56
56
|
cleanup();
|
|
57
57
|
if (!el)
|
|
58
58
|
return;
|
|
59
59
|
cleanups.push(...events.flatMap((event) => {
|
|
60
|
-
return listeners.map((listener) => register(el, event, listener));
|
|
60
|
+
return listeners.map((listener) => register(el, event, listener, options2));
|
|
61
61
|
}));
|
|
62
62
|
}, { immediate: true, flush: "post" });
|
|
63
63
|
const stop = () => {
|
|
@@ -68,12 +68,16 @@ function useEventListener(...args) {
|
|
|
68
68
|
return stop;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
let _iOSWorkaround = false;
|
|
71
72
|
function onClickOutside(target, handler, options = {}) {
|
|
72
73
|
const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
|
|
73
74
|
if (!window)
|
|
74
75
|
return;
|
|
76
|
+
if (isIOS && !_iOSWorkaround) {
|
|
77
|
+
_iOSWorkaround = true;
|
|
78
|
+
Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop));
|
|
79
|
+
}
|
|
75
80
|
let shouldListen = true;
|
|
76
|
-
let fallback;
|
|
77
81
|
const shouldIgnore = (event) => {
|
|
78
82
|
return ignore.some((target2) => {
|
|
79
83
|
if (typeof target2 === "string") {
|
|
@@ -85,7 +89,6 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
85
89
|
});
|
|
86
90
|
};
|
|
87
91
|
const listener = (event) => {
|
|
88
|
-
window.clearTimeout(fallback);
|
|
89
92
|
const el = unrefElement(target);
|
|
90
93
|
if (!el || el === event.target || event.composedPath().includes(el))
|
|
91
94
|
return;
|
|
@@ -104,13 +107,6 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
104
107
|
if (el)
|
|
105
108
|
shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
|
|
106
109
|
}, { passive: true }),
|
|
107
|
-
useEventListener(window, "pointerup", (e) => {
|
|
108
|
-
if (e.button === 0) {
|
|
109
|
-
const path = e.composedPath();
|
|
110
|
-
e.composedPath = () => path;
|
|
111
|
-
fallback = window.setTimeout(() => listener(e), 50);
|
|
112
|
-
}
|
|
113
|
-
}, { passive: true }),
|
|
114
110
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
115
111
|
var _a;
|
|
116
112
|
const el = unrefElement(target);
|
|
@@ -240,7 +236,7 @@ function onLongPress(target, handler, options) {
|
|
|
240
236
|
useEventListener(elementRef, "pointerleave", clear, listenerOptions);
|
|
241
237
|
}
|
|
242
238
|
|
|
243
|
-
const OnLongPress = /* @__PURE__ */ defineComponent({
|
|
239
|
+
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
244
240
|
name: "OnLongPress",
|
|
245
241
|
props: ["as", "options"],
|
|
246
242
|
emits: ["trigger"],
|
|
@@ -265,7 +261,7 @@ const vOnLongPress = {
|
|
|
265
261
|
}
|
|
266
262
|
};
|
|
267
263
|
|
|
268
|
-
const UseActiveElement = /* @__PURE__ */ defineComponent({
|
|
264
|
+
const UseActiveElement = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
269
265
|
name: "UseActiveElement",
|
|
270
266
|
setup(props, { slots }) {
|
|
271
267
|
const data = reactive({
|
|
@@ -278,7 +274,7 @@ const UseActiveElement = /* @__PURE__ */ defineComponent({
|
|
|
278
274
|
}
|
|
279
275
|
});
|
|
280
276
|
|
|
281
|
-
const UseBattery = /* @__PURE__ */ defineComponent({
|
|
277
|
+
const UseBattery = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
282
278
|
name: "UseBattery",
|
|
283
279
|
setup(props, { slots }) {
|
|
284
280
|
const data = reactive(useBattery(props));
|
|
@@ -289,7 +285,7 @@ const UseBattery = /* @__PURE__ */ defineComponent({
|
|
|
289
285
|
}
|
|
290
286
|
});
|
|
291
287
|
|
|
292
|
-
const UseBrowserLocation = /* @__PURE__ */ defineComponent({
|
|
288
|
+
const UseBrowserLocation = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
293
289
|
name: "UseBrowserLocation",
|
|
294
290
|
setup(props, { slots }) {
|
|
295
291
|
const data = reactive(useBrowserLocation());
|
|
@@ -362,6 +358,7 @@ const StorageSerializers = {
|
|
|
362
358
|
write: (v) => v.toISOString()
|
|
363
359
|
}
|
|
364
360
|
};
|
|
361
|
+
const customStorageEventName = "vueuse-storage";
|
|
365
362
|
function useStorage(key, defaults, storage, options = {}) {
|
|
366
363
|
var _a;
|
|
367
364
|
const {
|
|
@@ -394,8 +391,10 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
394
391
|
const type = guessSerializerType(rawInit);
|
|
395
392
|
const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
|
|
396
393
|
const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(data, () => write(data.value), { flush, deep, eventFilter });
|
|
397
|
-
if (window && listenToStorageChanges)
|
|
394
|
+
if (window && listenToStorageChanges) {
|
|
398
395
|
useEventListener(window, "storage", update);
|
|
396
|
+
useEventListener(window, customStorageEventName, updateFromCustomEvent);
|
|
397
|
+
}
|
|
399
398
|
update();
|
|
400
399
|
return data;
|
|
401
400
|
function write(v) {
|
|
@@ -408,11 +407,13 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
408
407
|
if (oldValue !== serialized) {
|
|
409
408
|
storage.setItem(key, serialized);
|
|
410
409
|
if (window) {
|
|
411
|
-
window
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
410
|
+
window.dispatchEvent(new CustomEvent(customStorageEventName, {
|
|
411
|
+
detail: {
|
|
412
|
+
key,
|
|
413
|
+
oldValue,
|
|
414
|
+
newValue: serialized,
|
|
415
|
+
storageArea: storage
|
|
416
|
+
}
|
|
416
417
|
}));
|
|
417
418
|
}
|
|
418
419
|
}
|
|
@@ -440,6 +441,9 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
440
441
|
return serializer.read(rawValue);
|
|
441
442
|
}
|
|
442
443
|
}
|
|
444
|
+
function updateFromCustomEvent(event) {
|
|
445
|
+
update(event.detail);
|
|
446
|
+
}
|
|
443
447
|
function update(event) {
|
|
444
448
|
if (event && event.storageArea !== storage)
|
|
445
449
|
return;
|
|
@@ -582,7 +586,7 @@ function useColorMode(options = {}) {
|
|
|
582
586
|
return state;
|
|
583
587
|
}
|
|
584
588
|
|
|
585
|
-
const UseColorMode = /* @__PURE__ */ defineComponent({
|
|
589
|
+
const UseColorMode = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
586
590
|
name: "UseColorMode",
|
|
587
591
|
props: ["selector", "attribute", "modes", "onChanged", "storageKey", "storage", "emitAuto"],
|
|
588
592
|
setup(props, { slots }) {
|
|
@@ -597,7 +601,7 @@ const UseColorMode = /* @__PURE__ */ defineComponent({
|
|
|
597
601
|
}
|
|
598
602
|
});
|
|
599
603
|
|
|
600
|
-
const UseDark = /* @__PURE__ */ defineComponent({
|
|
604
|
+
const UseDark = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
601
605
|
name: "UseDark",
|
|
602
606
|
props: ["selector", "attribute", "valueDark", "valueLight", "onChanged", "storageKey", "storage"],
|
|
603
607
|
setup(props, { slots }) {
|
|
@@ -613,7 +617,7 @@ const UseDark = /* @__PURE__ */ defineComponent({
|
|
|
613
617
|
}
|
|
614
618
|
});
|
|
615
619
|
|
|
616
|
-
const UseDeviceMotion = /* @__PURE__ */ defineComponent({
|
|
620
|
+
const UseDeviceMotion = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
617
621
|
name: "UseDeviceMotion",
|
|
618
622
|
setup(props, { slots }) {
|
|
619
623
|
const data = reactive(useDeviceMotion());
|
|
@@ -624,7 +628,7 @@ const UseDeviceMotion = /* @__PURE__ */ defineComponent({
|
|
|
624
628
|
}
|
|
625
629
|
});
|
|
626
630
|
|
|
627
|
-
const UseDeviceOrientation = /* @__PURE__ */ defineComponent({
|
|
631
|
+
const UseDeviceOrientation = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
628
632
|
name: "UseDeviceOrientation",
|
|
629
633
|
setup(props, { slots }) {
|
|
630
634
|
const data = reactive(useDeviceOrientation());
|
|
@@ -635,7 +639,7 @@ const UseDeviceOrientation = /* @__PURE__ */ defineComponent({
|
|
|
635
639
|
}
|
|
636
640
|
});
|
|
637
641
|
|
|
638
|
-
const UseDevicePixelRatio = /* @__PURE__ */ defineComponent({
|
|
642
|
+
const UseDevicePixelRatio = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
639
643
|
name: "UseDevicePixelRatio",
|
|
640
644
|
setup(props, { slots }) {
|
|
641
645
|
const data = reactive({
|
|
@@ -648,7 +652,7 @@ const UseDevicePixelRatio = /* @__PURE__ */ defineComponent({
|
|
|
648
652
|
}
|
|
649
653
|
});
|
|
650
654
|
|
|
651
|
-
const UseDevicesList = /* @__PURE__ */ defineComponent({
|
|
655
|
+
const UseDevicesList = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
652
656
|
name: "UseDevicesList",
|
|
653
657
|
props: ["onUpdated", "requestPermissions", "constraints"],
|
|
654
658
|
setup(props, { slots }) {
|
|
@@ -660,7 +664,7 @@ const UseDevicesList = /* @__PURE__ */ defineComponent({
|
|
|
660
664
|
}
|
|
661
665
|
});
|
|
662
666
|
|
|
663
|
-
const UseDocumentVisibility = /* @__PURE__ */ defineComponent({
|
|
667
|
+
const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
664
668
|
name: "UseDocumentVisibility",
|
|
665
669
|
setup(props, { slots }) {
|
|
666
670
|
const data = reactive({
|
|
@@ -692,7 +696,7 @@ var __spreadValues$a = (a, b) => {
|
|
|
692
696
|
return a;
|
|
693
697
|
};
|
|
694
698
|
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
695
|
-
const UseDraggable = /* @__PURE__ */ defineComponent({
|
|
699
|
+
const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
696
700
|
name: "UseDraggable",
|
|
697
701
|
props: [
|
|
698
702
|
"storageKey",
|
|
@@ -731,7 +735,7 @@ const UseDraggable = /* @__PURE__ */ defineComponent({
|
|
|
731
735
|
}
|
|
732
736
|
});
|
|
733
737
|
|
|
734
|
-
const UseElementBounding = /* @__PURE__ */ defineComponent({
|
|
738
|
+
const UseElementBounding = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
735
739
|
name: "UseElementBounding",
|
|
736
740
|
props: ["box", "as"],
|
|
737
741
|
setup(props, { slots }) {
|
|
@@ -744,10 +748,26 @@ const UseElementBounding = /* @__PURE__ */ defineComponent({
|
|
|
744
748
|
}
|
|
745
749
|
});
|
|
746
750
|
|
|
747
|
-
function useElementHover(el) {
|
|
751
|
+
function useElementHover(el, options = {}) {
|
|
752
|
+
const delayEnter = options ? options.delayEnter : 0;
|
|
753
|
+
const delayLeave = options ? options.delayLeave : 0;
|
|
748
754
|
const isHovered = ref(false);
|
|
749
|
-
|
|
750
|
-
|
|
755
|
+
let timer;
|
|
756
|
+
const toggle = (entering) => {
|
|
757
|
+
const delay = entering ? delayEnter : delayLeave;
|
|
758
|
+
if (timer) {
|
|
759
|
+
clearTimeout(timer);
|
|
760
|
+
timer = void 0;
|
|
761
|
+
}
|
|
762
|
+
if (delay)
|
|
763
|
+
timer = setTimeout(() => isHovered.value = entering, delay);
|
|
764
|
+
else
|
|
765
|
+
isHovered.value = entering;
|
|
766
|
+
};
|
|
767
|
+
if (!window)
|
|
768
|
+
return isHovered;
|
|
769
|
+
useEventListener(el, "mouseenter", () => toggle(true), { passive: true });
|
|
770
|
+
useEventListener(el, "mouseleave", () => toggle(false), { passive: true });
|
|
751
771
|
return isHovered;
|
|
752
772
|
}
|
|
753
773
|
|
|
@@ -760,7 +780,7 @@ const vElementHover = {
|
|
|
760
780
|
}
|
|
761
781
|
};
|
|
762
782
|
|
|
763
|
-
const UseElementSize = /* @__PURE__ */ defineComponent({
|
|
783
|
+
const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
764
784
|
name: "UseElementSize",
|
|
765
785
|
props: ["width", "height", "box"],
|
|
766
786
|
setup(props, { slots }) {
|
|
@@ -817,17 +837,31 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
817
837
|
}
|
|
818
838
|
|
|
819
839
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
820
|
-
const { box = "content-box" } = options;
|
|
840
|
+
const { window = defaultWindow, box = "content-box" } = options;
|
|
841
|
+
const isSVG = computed(() => {
|
|
842
|
+
var _a, _b;
|
|
843
|
+
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
844
|
+
});
|
|
821
845
|
const width = ref(initialSize.width);
|
|
822
846
|
const height = ref(initialSize.height);
|
|
823
847
|
useResizeObserver(target, ([entry]) => {
|
|
824
848
|
const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
|
|
825
|
-
if (
|
|
826
|
-
|
|
827
|
-
|
|
849
|
+
if (window && isSVG.value) {
|
|
850
|
+
const $elem = unrefElement(target);
|
|
851
|
+
if ($elem) {
|
|
852
|
+
const styles = window.getComputedStyle($elem);
|
|
853
|
+
width.value = parseFloat(styles.width);
|
|
854
|
+
height.value = parseFloat(styles.height);
|
|
855
|
+
}
|
|
828
856
|
} else {
|
|
829
|
-
|
|
830
|
-
|
|
857
|
+
if (boxSize) {
|
|
858
|
+
const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
|
|
859
|
+
width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
|
|
860
|
+
height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
|
|
861
|
+
} else {
|
|
862
|
+
width.value = entry.contentRect.width;
|
|
863
|
+
height.value = entry.contentRect.height;
|
|
864
|
+
}
|
|
831
865
|
}
|
|
832
866
|
}, options);
|
|
833
867
|
watch(() => unrefElement(target), (ele) => {
|
|
@@ -850,7 +884,7 @@ const vElementSize = {
|
|
|
850
884
|
}
|
|
851
885
|
};
|
|
852
886
|
|
|
853
|
-
const UseElementVisibility = /* @__PURE__ */ defineComponent({
|
|
887
|
+
const UseElementVisibility = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
854
888
|
name: "UseElementVisibility",
|
|
855
889
|
props: ["as"],
|
|
856
890
|
setup(props, { slots }) {
|
|
@@ -903,7 +937,7 @@ const vElementVisibility = {
|
|
|
903
937
|
}
|
|
904
938
|
};
|
|
905
939
|
|
|
906
|
-
const UseEyeDropper = /* @__PURE__ */ defineComponent({
|
|
940
|
+
const UseEyeDropper = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
907
941
|
name: "UseEyeDropper",
|
|
908
942
|
props: {
|
|
909
943
|
sRGBHex: String
|
|
@@ -917,7 +951,7 @@ const UseEyeDropper = /* @__PURE__ */ defineComponent({
|
|
|
917
951
|
}
|
|
918
952
|
});
|
|
919
953
|
|
|
920
|
-
const UseFullscreen = /* @__PURE__ */ defineComponent({
|
|
954
|
+
const UseFullscreen = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
921
955
|
name: "UseFullscreen",
|
|
922
956
|
props: ["as"],
|
|
923
957
|
setup(props, { slots }) {
|
|
@@ -930,7 +964,7 @@ const UseFullscreen = /* @__PURE__ */ defineComponent({
|
|
|
930
964
|
}
|
|
931
965
|
});
|
|
932
966
|
|
|
933
|
-
const UseGeolocation = /* @__PURE__ */ defineComponent({
|
|
967
|
+
const UseGeolocation = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
934
968
|
name: "UseGeolocation",
|
|
935
969
|
props: ["enableHighAccuracy", "maximumAge", "timeout", "navigator"],
|
|
936
970
|
setup(props, { slots }) {
|
|
@@ -942,7 +976,7 @@ const UseGeolocation = /* @__PURE__ */ defineComponent({
|
|
|
942
976
|
}
|
|
943
977
|
});
|
|
944
978
|
|
|
945
|
-
const UseIdle = /* @__PURE__ */ defineComponent({
|
|
979
|
+
const UseIdle = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
946
980
|
name: "UseIdle",
|
|
947
981
|
props: ["timeout", "events", "listenForVisibilityChange", "initialState"],
|
|
948
982
|
setup(props, { slots }) {
|
|
@@ -1040,7 +1074,7 @@ const useImage = (options, asyncStateOptions = {}) => {
|
|
|
1040
1074
|
return state;
|
|
1041
1075
|
};
|
|
1042
1076
|
|
|
1043
|
-
const UseImage = /* @__PURE__ */ defineComponent({
|
|
1077
|
+
const UseImage = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1044
1078
|
name: "UseImage",
|
|
1045
1079
|
props: [
|
|
1046
1080
|
"src",
|
|
@@ -1123,14 +1157,17 @@ function useScroll(element, options = {}) {
|
|
|
1123
1157
|
top: false,
|
|
1124
1158
|
bottom: false
|
|
1125
1159
|
});
|
|
1126
|
-
const onScrollEnd =
|
|
1160
|
+
const onScrollEnd = (e) => {
|
|
1161
|
+
if (!isScrolling.value)
|
|
1162
|
+
return;
|
|
1127
1163
|
isScrolling.value = false;
|
|
1128
1164
|
directions.left = false;
|
|
1129
1165
|
directions.right = false;
|
|
1130
1166
|
directions.top = false;
|
|
1131
1167
|
directions.bottom = false;
|
|
1132
1168
|
onStop(e);
|
|
1133
|
-
}
|
|
1169
|
+
};
|
|
1170
|
+
const onScrollEndDebounced = useDebounceFn(onScrollEnd, throttle + idle);
|
|
1134
1171
|
const onScrollHandler = (e) => {
|
|
1135
1172
|
const eventTarget = e.target === document ? e.target.documentElement : e.target;
|
|
1136
1173
|
const scrollLeft = eventTarget.scrollLeft;
|
|
@@ -1148,10 +1185,11 @@ function useScroll(element, options = {}) {
|
|
|
1148
1185
|
arrivedState.bottom = scrollTop + eventTarget.clientHeight >= eventTarget.scrollHeight - (offset.bottom || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;
|
|
1149
1186
|
internalY.value = scrollTop;
|
|
1150
1187
|
isScrolling.value = true;
|
|
1151
|
-
|
|
1188
|
+
onScrollEndDebounced(e);
|
|
1152
1189
|
onScroll(e);
|
|
1153
1190
|
};
|
|
1154
1191
|
useEventListener(element, "scroll", throttle ? useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler, eventListenerOptions);
|
|
1192
|
+
useEventListener(element, "scrollend", onScrollEnd, eventListenerOptions);
|
|
1155
1193
|
return {
|
|
1156
1194
|
x,
|
|
1157
1195
|
y,
|
|
@@ -1265,7 +1303,7 @@ const vIntersectionObserver = {
|
|
|
1265
1303
|
}
|
|
1266
1304
|
};
|
|
1267
1305
|
|
|
1268
|
-
const UseMouse = /* @__PURE__ */ defineComponent({
|
|
1306
|
+
const UseMouse = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1269
1307
|
name: "UseMouse",
|
|
1270
1308
|
props: ["touch", "resetOnTouchEnds", "initialValue"],
|
|
1271
1309
|
setup(props, { slots }) {
|
|
@@ -1277,7 +1315,7 @@ const UseMouse = /* @__PURE__ */ defineComponent({
|
|
|
1277
1315
|
}
|
|
1278
1316
|
});
|
|
1279
1317
|
|
|
1280
|
-
const UseMouseInElement = /* @__PURE__ */ defineComponent({
|
|
1318
|
+
const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1281
1319
|
name: "UseMouseElement",
|
|
1282
1320
|
props: ["handleOutside", "as"],
|
|
1283
1321
|
setup(props, { slots }) {
|
|
@@ -1309,7 +1347,7 @@ var __spreadValues$7 = (a, b) => {
|
|
|
1309
1347
|
return a;
|
|
1310
1348
|
};
|
|
1311
1349
|
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1312
|
-
const UseMousePressed = /* @__PURE__ */ defineComponent({
|
|
1350
|
+
const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1313
1351
|
name: "UseMousePressed",
|
|
1314
1352
|
props: ["touch", "initialValue", "as"],
|
|
1315
1353
|
setup(props, { slots }) {
|
|
@@ -1322,7 +1360,7 @@ const UseMousePressed = /* @__PURE__ */ defineComponent({
|
|
|
1322
1360
|
}
|
|
1323
1361
|
});
|
|
1324
1362
|
|
|
1325
|
-
const UseNetwork = /* @__PURE__ */ defineComponent({
|
|
1363
|
+
const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1326
1364
|
name: "UseNetwork",
|
|
1327
1365
|
setup(props, { slots }) {
|
|
1328
1366
|
const data = reactive(useNetwork());
|
|
@@ -1352,7 +1390,7 @@ var __spreadValues$6 = (a, b) => {
|
|
|
1352
1390
|
return a;
|
|
1353
1391
|
};
|
|
1354
1392
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1355
|
-
const UseNow = /* @__PURE__ */ defineComponent({
|
|
1393
|
+
const UseNow = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1356
1394
|
name: "UseNow",
|
|
1357
1395
|
props: ["interval"],
|
|
1358
1396
|
setup(props, { slots }) {
|
|
@@ -1364,7 +1402,7 @@ const UseNow = /* @__PURE__ */ defineComponent({
|
|
|
1364
1402
|
}
|
|
1365
1403
|
});
|
|
1366
1404
|
|
|
1367
|
-
const UseObjectUrl = /* @__PURE__ */ defineComponent({
|
|
1405
|
+
const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1368
1406
|
name: "UseObjectUrl",
|
|
1369
1407
|
props: [
|
|
1370
1408
|
"object"
|
|
@@ -1398,7 +1436,7 @@ var __spreadValues$5 = (a, b) => {
|
|
|
1398
1436
|
return a;
|
|
1399
1437
|
};
|
|
1400
1438
|
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1401
|
-
const UseOffsetPagination = /* @__PURE__ */ defineComponent({
|
|
1439
|
+
const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1402
1440
|
name: "UseOffsetPagination",
|
|
1403
1441
|
props: [
|
|
1404
1442
|
"total",
|
|
@@ -1438,7 +1476,7 @@ const UseOffsetPagination = /* @__PURE__ */ defineComponent({
|
|
|
1438
1476
|
}
|
|
1439
1477
|
});
|
|
1440
1478
|
|
|
1441
|
-
const UseOnline = /* @__PURE__ */ defineComponent({
|
|
1479
|
+
const UseOnline = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1442
1480
|
name: "UseOnline",
|
|
1443
1481
|
setup(props, { slots }) {
|
|
1444
1482
|
const data = reactive({
|
|
@@ -1451,7 +1489,7 @@ const UseOnline = /* @__PURE__ */ defineComponent({
|
|
|
1451
1489
|
}
|
|
1452
1490
|
});
|
|
1453
1491
|
|
|
1454
|
-
const UsePageLeave = /* @__PURE__ */ defineComponent({
|
|
1492
|
+
const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1455
1493
|
name: "UsePageLeave",
|
|
1456
1494
|
setup(props, { slots }) {
|
|
1457
1495
|
const data = reactive({
|
|
@@ -1483,7 +1521,7 @@ var __spreadValues$4 = (a, b) => {
|
|
|
1483
1521
|
return a;
|
|
1484
1522
|
};
|
|
1485
1523
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1486
|
-
const UsePointer = /* @__PURE__ */ defineComponent({
|
|
1524
|
+
const UsePointer = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1487
1525
|
name: "UsePointer",
|
|
1488
1526
|
props: [
|
|
1489
1527
|
"pointerTypes",
|
|
@@ -1502,7 +1540,7 @@ const UsePointer = /* @__PURE__ */ defineComponent({
|
|
|
1502
1540
|
}
|
|
1503
1541
|
});
|
|
1504
1542
|
|
|
1505
|
-
const UsePointerLock = defineComponent({
|
|
1543
|
+
const UsePointerLock = /* #__PURE__ */ defineComponent({
|
|
1506
1544
|
name: "UsePointerLock",
|
|
1507
1545
|
props: ["as"],
|
|
1508
1546
|
setup(props, { slots }) {
|
|
@@ -1515,7 +1553,7 @@ const UsePointerLock = defineComponent({
|
|
|
1515
1553
|
}
|
|
1516
1554
|
});
|
|
1517
1555
|
|
|
1518
|
-
const UsePreferredColorScheme = /* @__PURE__ */ defineComponent({
|
|
1556
|
+
const UsePreferredColorScheme = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1519
1557
|
name: "UsePreferredColorScheme",
|
|
1520
1558
|
setup(props, { slots }) {
|
|
1521
1559
|
const data = reactive({
|
|
@@ -1528,7 +1566,7 @@ const UsePreferredColorScheme = /* @__PURE__ */ defineComponent({
|
|
|
1528
1566
|
}
|
|
1529
1567
|
});
|
|
1530
1568
|
|
|
1531
|
-
const UsePreferredContrast = /* @__PURE__ */ defineComponent({
|
|
1569
|
+
const UsePreferredContrast = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1532
1570
|
name: "UsePreferredContrast",
|
|
1533
1571
|
setup(props, { slots }) {
|
|
1534
1572
|
const data = reactive({
|
|
@@ -1541,7 +1579,7 @@ const UsePreferredContrast = /* @__PURE__ */ defineComponent({
|
|
|
1541
1579
|
}
|
|
1542
1580
|
});
|
|
1543
1581
|
|
|
1544
|
-
const UsePreferredDark = /* @__PURE__ */ defineComponent({
|
|
1582
|
+
const UsePreferredDark = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1545
1583
|
name: "UsePreferredDark",
|
|
1546
1584
|
setup(props, { slots }) {
|
|
1547
1585
|
const data = reactive({
|
|
@@ -1554,7 +1592,7 @@ const UsePreferredDark = /* @__PURE__ */ defineComponent({
|
|
|
1554
1592
|
}
|
|
1555
1593
|
});
|
|
1556
1594
|
|
|
1557
|
-
const UsePreferredLanguages = /* @__PURE__ */ defineComponent({
|
|
1595
|
+
const UsePreferredLanguages = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1558
1596
|
name: "UsePreferredLanguages",
|
|
1559
1597
|
setup(props, { slots }) {
|
|
1560
1598
|
const data = reactive({
|
|
@@ -1567,7 +1605,7 @@ const UsePreferredLanguages = /* @__PURE__ */ defineComponent({
|
|
|
1567
1605
|
}
|
|
1568
1606
|
});
|
|
1569
1607
|
|
|
1570
|
-
const UsePreferredReducedMotion = /* @__PURE__ */ defineComponent({
|
|
1608
|
+
const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1571
1609
|
name: "UsePreferredReducedMotion",
|
|
1572
1610
|
setup(props, { slots }) {
|
|
1573
1611
|
const data = reactive({
|
|
@@ -1640,7 +1678,7 @@ function getValue(position) {
|
|
|
1640
1678
|
return getComputedStyle(document.documentElement).getPropertyValue(position);
|
|
1641
1679
|
}
|
|
1642
1680
|
|
|
1643
|
-
const UseScreenSafeArea = /* @__PURE__ */ defineComponent({
|
|
1681
|
+
const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1644
1682
|
name: "UseScreenSafeArea",
|
|
1645
1683
|
props: {
|
|
1646
1684
|
top: Boolean,
|
|
@@ -1725,7 +1763,7 @@ const vScroll = {
|
|
|
1725
1763
|
|
|
1726
1764
|
function checkOverflowScroll(ele) {
|
|
1727
1765
|
const style = window.getComputedStyle(ele);
|
|
1728
|
-
if (style.overflowX === "scroll" || style.overflowY === "scroll") {
|
|
1766
|
+
if (style.overflowX === "scroll" || style.overflowY === "scroll" || style.overflowX === "auto" && ele.clientHeight < ele.scrollHeight || style.overflowY === "auto" && ele.clientWidth < ele.scrollWidth) {
|
|
1729
1767
|
return true;
|
|
1730
1768
|
} else {
|
|
1731
1769
|
const parent = ele.parentNode;
|
|
@@ -1826,7 +1864,7 @@ var __spreadValues$2 = (a, b) => {
|
|
|
1826
1864
|
return a;
|
|
1827
1865
|
};
|
|
1828
1866
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1829
|
-
const UseTimeAgo = /* @__PURE__ */ defineComponent({
|
|
1867
|
+
const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1830
1868
|
name: "UseTimeAgo",
|
|
1831
1869
|
props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
|
|
1832
1870
|
setup(props, { slots }) {
|
|
@@ -1857,7 +1895,7 @@ var __spreadValues$1 = (a, b) => {
|
|
|
1857
1895
|
return a;
|
|
1858
1896
|
};
|
|
1859
1897
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1860
|
-
const UseTimestamp = /* @__PURE__ */ defineComponent({
|
|
1898
|
+
const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1861
1899
|
name: "UseTimestamp",
|
|
1862
1900
|
props: ["immediate", "interval", "offset"],
|
|
1863
1901
|
setup(props, { slots }) {
|
|
@@ -1885,7 +1923,7 @@ var __spreadValues = (a, b) => {
|
|
|
1885
1923
|
}
|
|
1886
1924
|
return a;
|
|
1887
1925
|
};
|
|
1888
|
-
const UseVirtualList = /* @__PURE__ */ defineComponent({
|
|
1926
|
+
const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1889
1927
|
name: "UseVirtualList",
|
|
1890
1928
|
props: [
|
|
1891
1929
|
"list",
|
|
@@ -1903,7 +1941,7 @@ const UseVirtualList = /* @__PURE__ */ defineComponent({
|
|
|
1903
1941
|
}
|
|
1904
1942
|
});
|
|
1905
1943
|
|
|
1906
|
-
const UseWindowFocus = /* @__PURE__ */ defineComponent({
|
|
1944
|
+
const UseWindowFocus = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1907
1945
|
name: "UseWindowFocus",
|
|
1908
1946
|
setup(props, { slots }) {
|
|
1909
1947
|
const data = reactive({
|
|
@@ -1916,7 +1954,7 @@ const UseWindowFocus = /* @__PURE__ */ defineComponent({
|
|
|
1916
1954
|
}
|
|
1917
1955
|
});
|
|
1918
1956
|
|
|
1919
|
-
const UseWindowSize = /* @__PURE__ */ defineComponent({
|
|
1957
|
+
const UseWindowSize = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
|
|
1920
1958
|
name: "UseWindowSize",
|
|
1921
1959
|
props: ["initialWidth", "initialHeight"],
|
|
1922
1960
|
setup(props, { slots }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/components",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.13.0",
|
|
4
4
|
"description": "Renderless components for VueUse",
|
|
5
5
|
"author": "Jacob Clevenger<https://github.com/wheatjs>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"jsdelivr": "./index.iife.min.js",
|
|
34
34
|
"types": "./index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@vueuse/core": "9.
|
|
37
|
-
"@vueuse/shared": "9.
|
|
36
|
+
"@vueuse/core": "9.13.0",
|
|
37
|
+
"@vueuse/shared": "9.13.0",
|
|
38
38
|
"vue-demi": "*"
|
|
39
39
|
}
|
|
40
40
|
}
|