@vueuse/components 9.12.0 → 10.0.0-beta.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 +124 -75
- package/index.d.ts +7 -0
- package/index.iife.js +124 -75
- package/index.iife.min.js +1 -1
- package/index.mjs +126 -77
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var vueDemi = require('vue-demi');
|
|
|
4
4
|
var core = require('@vueuse/core');
|
|
5
5
|
var shared = require('@vueuse/shared');
|
|
6
6
|
|
|
7
|
-
const OnClickOutside = /* @__PURE__ */ vueDemi.defineComponent({
|
|
7
|
+
const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
8
8
|
name: "OnClickOutside",
|
|
9
9
|
props: ["as", "options"],
|
|
10
10
|
emits: ["trigger"],
|
|
@@ -50,16 +50,16 @@ function useEventListener(...args) {
|
|
|
50
50
|
cleanups.forEach((fn) => fn());
|
|
51
51
|
cleanups.length = 0;
|
|
52
52
|
};
|
|
53
|
-
const register = (el, event, listener) => {
|
|
54
|
-
el.addEventListener(event, listener,
|
|
55
|
-
return () => el.removeEventListener(event, listener,
|
|
53
|
+
const register = (el, event, listener, options2) => {
|
|
54
|
+
el.addEventListener(event, listener, options2);
|
|
55
|
+
return () => el.removeEventListener(event, listener, options2);
|
|
56
56
|
};
|
|
57
|
-
const stopWatch = vueDemi.watch(() => unrefElement(target), (el) => {
|
|
57
|
+
const stopWatch = vueDemi.watch(() => [unrefElement(target), shared.resolveUnref(options)], ([el, options2]) => {
|
|
58
58
|
cleanup();
|
|
59
59
|
if (!el)
|
|
60
60
|
return;
|
|
61
61
|
cleanups.push(...events.flatMap((event) => {
|
|
62
|
-
return listeners.map((listener) => register(el, event, listener));
|
|
62
|
+
return listeners.map((listener) => register(el, event, listener, options2));
|
|
63
63
|
}));
|
|
64
64
|
}, { immediate: true, flush: "post" });
|
|
65
65
|
const stop = () => {
|
|
@@ -70,12 +70,16 @@ function useEventListener(...args) {
|
|
|
70
70
|
return stop;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
let _iOSWorkaround = false;
|
|
73
74
|
function onClickOutside(target, handler, options = {}) {
|
|
74
75
|
const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
|
|
75
76
|
if (!window)
|
|
76
77
|
return;
|
|
78
|
+
if (shared.isIOS && !_iOSWorkaround) {
|
|
79
|
+
_iOSWorkaround = true;
|
|
80
|
+
Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", shared.noop));
|
|
81
|
+
}
|
|
77
82
|
let shouldListen = true;
|
|
78
|
-
let fallback;
|
|
79
83
|
const shouldIgnore = (event) => {
|
|
80
84
|
return ignore.some((target2) => {
|
|
81
85
|
if (typeof target2 === "string") {
|
|
@@ -87,7 +91,6 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
87
91
|
});
|
|
88
92
|
};
|
|
89
93
|
const listener = (event) => {
|
|
90
|
-
window.clearTimeout(fallback);
|
|
91
94
|
const el = unrefElement(target);
|
|
92
95
|
if (!el || el === event.target || event.composedPath().includes(el))
|
|
93
96
|
return;
|
|
@@ -106,13 +109,6 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
106
109
|
if (el)
|
|
107
110
|
shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
|
|
108
111
|
}, { passive: true }),
|
|
109
|
-
useEventListener(window, "pointerup", (e) => {
|
|
110
|
-
if (e.button === 0) {
|
|
111
|
-
const path = e.composedPath();
|
|
112
|
-
e.composedPath = () => path;
|
|
113
|
-
fallback = window.setTimeout(() => listener(e), 50);
|
|
114
|
-
}
|
|
115
|
-
}, { passive: true }),
|
|
116
112
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
117
113
|
var _a;
|
|
118
114
|
const el = unrefElement(target);
|
|
@@ -242,7 +238,7 @@ function onLongPress(target, handler, options) {
|
|
|
242
238
|
useEventListener(elementRef, "pointerleave", clear, listenerOptions);
|
|
243
239
|
}
|
|
244
240
|
|
|
245
|
-
const OnLongPress = /* @__PURE__ */ vueDemi.defineComponent({
|
|
241
|
+
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
246
242
|
name: "OnLongPress",
|
|
247
243
|
props: ["as", "options"],
|
|
248
244
|
emits: ["trigger"],
|
|
@@ -267,7 +263,7 @@ const vOnLongPress = {
|
|
|
267
263
|
}
|
|
268
264
|
};
|
|
269
265
|
|
|
270
|
-
const UseActiveElement = /* @__PURE__ */ vueDemi.defineComponent({
|
|
266
|
+
const UseActiveElement = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
271
267
|
name: "UseActiveElement",
|
|
272
268
|
setup(props, { slots }) {
|
|
273
269
|
const data = vueDemi.reactive({
|
|
@@ -280,7 +276,7 @@ const UseActiveElement = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
280
276
|
}
|
|
281
277
|
});
|
|
282
278
|
|
|
283
|
-
const UseBattery = /* @__PURE__ */ vueDemi.defineComponent({
|
|
279
|
+
const UseBattery = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
284
280
|
name: "UseBattery",
|
|
285
281
|
setup(props, { slots }) {
|
|
286
282
|
const data = vueDemi.reactive(core.useBattery(props));
|
|
@@ -291,7 +287,7 @@ const UseBattery = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
291
287
|
}
|
|
292
288
|
});
|
|
293
289
|
|
|
294
|
-
const UseBrowserLocation = /* @__PURE__ */ vueDemi.defineComponent({
|
|
290
|
+
const UseBrowserLocation = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
295
291
|
name: "UseBrowserLocation",
|
|
296
292
|
setup(props, { slots }) {
|
|
297
293
|
const data = vueDemi.reactive(core.useBrowserLocation());
|
|
@@ -364,6 +360,7 @@ const StorageSerializers = {
|
|
|
364
360
|
write: (v) => v.toISOString()
|
|
365
361
|
}
|
|
366
362
|
};
|
|
363
|
+
const customStorageEventName = "vueuse-storage";
|
|
367
364
|
function useStorage(key, defaults, storage, options = {}) {
|
|
368
365
|
var _a;
|
|
369
366
|
const {
|
|
@@ -396,8 +393,10 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
396
393
|
const type = guessSerializerType(rawInit);
|
|
397
394
|
const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];
|
|
398
395
|
const { pause: pauseWatch, resume: resumeWatch } = shared.pausableWatch(data, () => write(data.value), { flush, deep, eventFilter });
|
|
399
|
-
if (window && listenToStorageChanges)
|
|
396
|
+
if (window && listenToStorageChanges) {
|
|
400
397
|
useEventListener(window, "storage", update);
|
|
398
|
+
useEventListener(window, customStorageEventName, updateFromCustomEvent);
|
|
399
|
+
}
|
|
401
400
|
update();
|
|
402
401
|
return data;
|
|
403
402
|
function write(v) {
|
|
@@ -410,11 +409,13 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
410
409
|
if (oldValue !== serialized) {
|
|
411
410
|
storage.setItem(key, serialized);
|
|
412
411
|
if (window) {
|
|
413
|
-
window
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
412
|
+
window.dispatchEvent(new CustomEvent(customStorageEventName, {
|
|
413
|
+
detail: {
|
|
414
|
+
key,
|
|
415
|
+
oldValue,
|
|
416
|
+
newValue: serialized,
|
|
417
|
+
storageArea: storage
|
|
418
|
+
}
|
|
418
419
|
}));
|
|
419
420
|
}
|
|
420
421
|
}
|
|
@@ -442,6 +443,9 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
442
443
|
return serializer.read(rawValue);
|
|
443
444
|
}
|
|
444
445
|
}
|
|
446
|
+
function updateFromCustomEvent(event) {
|
|
447
|
+
update(event.detail);
|
|
448
|
+
}
|
|
445
449
|
function update(event) {
|
|
446
450
|
if (event && event.storageArea !== storage)
|
|
447
451
|
return;
|
|
@@ -532,7 +536,8 @@ function useColorMode(options = {}) {
|
|
|
532
536
|
storageKey = "vueuse-color-scheme",
|
|
533
537
|
listenToStorageChanges = true,
|
|
534
538
|
storageRef,
|
|
535
|
-
emitAuto
|
|
539
|
+
emitAuto,
|
|
540
|
+
disableTransition = false
|
|
536
541
|
} = options;
|
|
537
542
|
const modes = __spreadValues$b({
|
|
538
543
|
auto: "",
|
|
@@ -554,6 +559,13 @@ function useColorMode(options = {}) {
|
|
|
554
559
|
const el = window == null ? void 0 : window.document.querySelector(selector2);
|
|
555
560
|
if (!el)
|
|
556
561
|
return;
|
|
562
|
+
let style;
|
|
563
|
+
if (disableTransition) {
|
|
564
|
+
style = window.document.createElement("style");
|
|
565
|
+
style.type = "text/css";
|
|
566
|
+
style.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}"));
|
|
567
|
+
window.document.head.appendChild(style);
|
|
568
|
+
}
|
|
557
569
|
if (attribute2 === "class") {
|
|
558
570
|
const current = value.split(/\s/g);
|
|
559
571
|
Object.values(modes).flatMap((i) => (i || "").split(/\s/g)).filter(Boolean).forEach((v) => {
|
|
@@ -565,6 +577,10 @@ function useColorMode(options = {}) {
|
|
|
565
577
|
} else {
|
|
566
578
|
el.setAttribute(attribute2, value);
|
|
567
579
|
}
|
|
580
|
+
if (disableTransition) {
|
|
581
|
+
window.getComputedStyle(style).opacity;
|
|
582
|
+
document.head.removeChild(style);
|
|
583
|
+
}
|
|
568
584
|
});
|
|
569
585
|
function defaultOnChanged(mode) {
|
|
570
586
|
var _a;
|
|
@@ -584,7 +600,7 @@ function useColorMode(options = {}) {
|
|
|
584
600
|
return state;
|
|
585
601
|
}
|
|
586
602
|
|
|
587
|
-
const UseColorMode = /* @__PURE__ */ vueDemi.defineComponent({
|
|
603
|
+
const UseColorMode = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
588
604
|
name: "UseColorMode",
|
|
589
605
|
props: ["selector", "attribute", "modes", "onChanged", "storageKey", "storage", "emitAuto"],
|
|
590
606
|
setup(props, { slots }) {
|
|
@@ -599,7 +615,7 @@ const UseColorMode = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
599
615
|
}
|
|
600
616
|
});
|
|
601
617
|
|
|
602
|
-
const UseDark = /* @__PURE__ */ vueDemi.defineComponent({
|
|
618
|
+
const UseDark = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
603
619
|
name: "UseDark",
|
|
604
620
|
props: ["selector", "attribute", "valueDark", "valueLight", "onChanged", "storageKey", "storage"],
|
|
605
621
|
setup(props, { slots }) {
|
|
@@ -615,7 +631,7 @@ const UseDark = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
615
631
|
}
|
|
616
632
|
});
|
|
617
633
|
|
|
618
|
-
const UseDeviceMotion = /* @__PURE__ */ vueDemi.defineComponent({
|
|
634
|
+
const UseDeviceMotion = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
619
635
|
name: "UseDeviceMotion",
|
|
620
636
|
setup(props, { slots }) {
|
|
621
637
|
const data = vueDemi.reactive(core.useDeviceMotion());
|
|
@@ -626,7 +642,7 @@ const UseDeviceMotion = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
626
642
|
}
|
|
627
643
|
});
|
|
628
644
|
|
|
629
|
-
const UseDeviceOrientation = /* @__PURE__ */ vueDemi.defineComponent({
|
|
645
|
+
const UseDeviceOrientation = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
630
646
|
name: "UseDeviceOrientation",
|
|
631
647
|
setup(props, { slots }) {
|
|
632
648
|
const data = vueDemi.reactive(core.useDeviceOrientation());
|
|
@@ -637,7 +653,7 @@ const UseDeviceOrientation = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
637
653
|
}
|
|
638
654
|
});
|
|
639
655
|
|
|
640
|
-
const UseDevicePixelRatio = /* @__PURE__ */ vueDemi.defineComponent({
|
|
656
|
+
const UseDevicePixelRatio = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
641
657
|
name: "UseDevicePixelRatio",
|
|
642
658
|
setup(props, { slots }) {
|
|
643
659
|
const data = vueDemi.reactive({
|
|
@@ -650,7 +666,7 @@ const UseDevicePixelRatio = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
650
666
|
}
|
|
651
667
|
});
|
|
652
668
|
|
|
653
|
-
const UseDevicesList = /* @__PURE__ */ vueDemi.defineComponent({
|
|
669
|
+
const UseDevicesList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
654
670
|
name: "UseDevicesList",
|
|
655
671
|
props: ["onUpdated", "requestPermissions", "constraints"],
|
|
656
672
|
setup(props, { slots }) {
|
|
@@ -662,7 +678,7 @@ const UseDevicesList = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
662
678
|
}
|
|
663
679
|
});
|
|
664
680
|
|
|
665
|
-
const UseDocumentVisibility = /* @__PURE__ */ vueDemi.defineComponent({
|
|
681
|
+
const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
666
682
|
name: "UseDocumentVisibility",
|
|
667
683
|
setup(props, { slots }) {
|
|
668
684
|
const data = vueDemi.reactive({
|
|
@@ -694,7 +710,7 @@ var __spreadValues$a = (a, b) => {
|
|
|
694
710
|
return a;
|
|
695
711
|
};
|
|
696
712
|
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
697
|
-
const UseDraggable = /* @__PURE__ */ vueDemi.defineComponent({
|
|
713
|
+
const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
698
714
|
name: "UseDraggable",
|
|
699
715
|
props: [
|
|
700
716
|
"storageKey",
|
|
@@ -733,7 +749,7 @@ const UseDraggable = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
733
749
|
}
|
|
734
750
|
});
|
|
735
751
|
|
|
736
|
-
const UseElementBounding = /* @__PURE__ */ vueDemi.defineComponent({
|
|
752
|
+
const UseElementBounding = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
737
753
|
name: "UseElementBounding",
|
|
738
754
|
props: ["box", "as"],
|
|
739
755
|
setup(props, { slots }) {
|
|
@@ -746,10 +762,29 @@ const UseElementBounding = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
746
762
|
}
|
|
747
763
|
});
|
|
748
764
|
|
|
749
|
-
function useElementHover(el) {
|
|
765
|
+
function useElementHover(el, options = {}) {
|
|
766
|
+
const {
|
|
767
|
+
delayEnter = 0,
|
|
768
|
+
delayLeave = 0,
|
|
769
|
+
window = defaultWindow
|
|
770
|
+
} = options;
|
|
750
771
|
const isHovered = vueDemi.ref(false);
|
|
751
|
-
|
|
752
|
-
|
|
772
|
+
let timer;
|
|
773
|
+
const toggle = (entering) => {
|
|
774
|
+
const delay = entering ? delayEnter : delayLeave;
|
|
775
|
+
if (timer) {
|
|
776
|
+
clearTimeout(timer);
|
|
777
|
+
timer = void 0;
|
|
778
|
+
}
|
|
779
|
+
if (delay)
|
|
780
|
+
timer = setTimeout(() => isHovered.value = entering, delay);
|
|
781
|
+
else
|
|
782
|
+
isHovered.value = entering;
|
|
783
|
+
};
|
|
784
|
+
if (!window)
|
|
785
|
+
return isHovered;
|
|
786
|
+
useEventListener(el, "mouseenter", () => toggle(true), { passive: true });
|
|
787
|
+
useEventListener(el, "mouseleave", () => toggle(false), { passive: true });
|
|
753
788
|
return isHovered;
|
|
754
789
|
}
|
|
755
790
|
|
|
@@ -762,7 +797,7 @@ const vElementHover = {
|
|
|
762
797
|
}
|
|
763
798
|
};
|
|
764
799
|
|
|
765
|
-
const UseElementSize = /* @__PURE__ */ vueDemi.defineComponent({
|
|
800
|
+
const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
766
801
|
name: "UseElementSize",
|
|
767
802
|
props: ["width", "height", "box"],
|
|
768
803
|
setup(props, { slots }) {
|
|
@@ -866,7 +901,7 @@ const vElementSize = {
|
|
|
866
901
|
}
|
|
867
902
|
};
|
|
868
903
|
|
|
869
|
-
const UseElementVisibility = /* @__PURE__ */ vueDemi.defineComponent({
|
|
904
|
+
const UseElementVisibility = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
870
905
|
name: "UseElementVisibility",
|
|
871
906
|
props: ["as"],
|
|
872
907
|
setup(props, { slots }) {
|
|
@@ -919,7 +954,7 @@ const vElementVisibility = {
|
|
|
919
954
|
}
|
|
920
955
|
};
|
|
921
956
|
|
|
922
|
-
const UseEyeDropper = /* @__PURE__ */ vueDemi.defineComponent({
|
|
957
|
+
const UseEyeDropper = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
923
958
|
name: "UseEyeDropper",
|
|
924
959
|
props: {
|
|
925
960
|
sRGBHex: String
|
|
@@ -933,7 +968,7 @@ const UseEyeDropper = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
933
968
|
}
|
|
934
969
|
});
|
|
935
970
|
|
|
936
|
-
const UseFullscreen = /* @__PURE__ */ vueDemi.defineComponent({
|
|
971
|
+
const UseFullscreen = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
937
972
|
name: "UseFullscreen",
|
|
938
973
|
props: ["as"],
|
|
939
974
|
setup(props, { slots }) {
|
|
@@ -946,7 +981,7 @@ const UseFullscreen = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
946
981
|
}
|
|
947
982
|
});
|
|
948
983
|
|
|
949
|
-
const UseGeolocation = /* @__PURE__ */ vueDemi.defineComponent({
|
|
984
|
+
const UseGeolocation = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
950
985
|
name: "UseGeolocation",
|
|
951
986
|
props: ["enableHighAccuracy", "maximumAge", "timeout", "navigator"],
|
|
952
987
|
setup(props, { slots }) {
|
|
@@ -958,7 +993,7 @@ const UseGeolocation = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
958
993
|
}
|
|
959
994
|
});
|
|
960
995
|
|
|
961
|
-
const UseIdle = /* @__PURE__ */ vueDemi.defineComponent({
|
|
996
|
+
const UseIdle = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
962
997
|
name: "UseIdle",
|
|
963
998
|
props: ["timeout", "events", "listenForVisibilityChange", "initialState"],
|
|
964
999
|
setup(props, { slots }) {
|
|
@@ -1056,7 +1091,7 @@ const useImage = (options, asyncStateOptions = {}) => {
|
|
|
1056
1091
|
return state;
|
|
1057
1092
|
};
|
|
1058
1093
|
|
|
1059
|
-
const UseImage = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1094
|
+
const UseImage = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1060
1095
|
name: "UseImage",
|
|
1061
1096
|
props: [
|
|
1062
1097
|
"src",
|
|
@@ -1139,14 +1174,17 @@ function useScroll(element, options = {}) {
|
|
|
1139
1174
|
top: false,
|
|
1140
1175
|
bottom: false
|
|
1141
1176
|
});
|
|
1142
|
-
const onScrollEnd =
|
|
1177
|
+
const onScrollEnd = (e) => {
|
|
1178
|
+
if (!isScrolling.value)
|
|
1179
|
+
return;
|
|
1143
1180
|
isScrolling.value = false;
|
|
1144
1181
|
directions.left = false;
|
|
1145
1182
|
directions.right = false;
|
|
1146
1183
|
directions.top = false;
|
|
1147
1184
|
directions.bottom = false;
|
|
1148
1185
|
onStop(e);
|
|
1149
|
-
}
|
|
1186
|
+
};
|
|
1187
|
+
const onScrollEndDebounced = shared.useDebounceFn(onScrollEnd, throttle + idle);
|
|
1150
1188
|
const onScrollHandler = (e) => {
|
|
1151
1189
|
const eventTarget = e.target === document ? e.target.documentElement : e.target;
|
|
1152
1190
|
const scrollLeft = eventTarget.scrollLeft;
|
|
@@ -1164,10 +1202,11 @@ function useScroll(element, options = {}) {
|
|
|
1164
1202
|
arrivedState.bottom = scrollTop + eventTarget.clientHeight >= eventTarget.scrollHeight - (offset.bottom || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;
|
|
1165
1203
|
internalY.value = scrollTop;
|
|
1166
1204
|
isScrolling.value = true;
|
|
1167
|
-
|
|
1205
|
+
onScrollEndDebounced(e);
|
|
1168
1206
|
onScroll(e);
|
|
1169
1207
|
};
|
|
1170
1208
|
useEventListener(element, "scroll", throttle ? shared.useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler, eventListenerOptions);
|
|
1209
|
+
useEventListener(element, "scrollend", onScrollEnd, eventListenerOptions);
|
|
1171
1210
|
return {
|
|
1172
1211
|
x,
|
|
1173
1212
|
y,
|
|
@@ -1281,7 +1320,7 @@ const vIntersectionObserver = {
|
|
|
1281
1320
|
}
|
|
1282
1321
|
};
|
|
1283
1322
|
|
|
1284
|
-
const UseMouse = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1323
|
+
const UseMouse = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1285
1324
|
name: "UseMouse",
|
|
1286
1325
|
props: ["touch", "resetOnTouchEnds", "initialValue"],
|
|
1287
1326
|
setup(props, { slots }) {
|
|
@@ -1293,7 +1332,7 @@ const UseMouse = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1293
1332
|
}
|
|
1294
1333
|
});
|
|
1295
1334
|
|
|
1296
|
-
const UseMouseInElement = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1335
|
+
const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1297
1336
|
name: "UseMouseElement",
|
|
1298
1337
|
props: ["handleOutside", "as"],
|
|
1299
1338
|
setup(props, { slots }) {
|
|
@@ -1325,7 +1364,7 @@ var __spreadValues$7 = (a, b) => {
|
|
|
1325
1364
|
return a;
|
|
1326
1365
|
};
|
|
1327
1366
|
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1328
|
-
const UseMousePressed = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1367
|
+
const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1329
1368
|
name: "UseMousePressed",
|
|
1330
1369
|
props: ["touch", "initialValue", "as"],
|
|
1331
1370
|
setup(props, { slots }) {
|
|
@@ -1338,7 +1377,7 @@ const UseMousePressed = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1338
1377
|
}
|
|
1339
1378
|
});
|
|
1340
1379
|
|
|
1341
|
-
const UseNetwork = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1380
|
+
const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1342
1381
|
name: "UseNetwork",
|
|
1343
1382
|
setup(props, { slots }) {
|
|
1344
1383
|
const data = vueDemi.reactive(core.useNetwork());
|
|
@@ -1368,7 +1407,7 @@ var __spreadValues$6 = (a, b) => {
|
|
|
1368
1407
|
return a;
|
|
1369
1408
|
};
|
|
1370
1409
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1371
|
-
const UseNow = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1410
|
+
const UseNow = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1372
1411
|
name: "UseNow",
|
|
1373
1412
|
props: ["interval"],
|
|
1374
1413
|
setup(props, { slots }) {
|
|
@@ -1380,7 +1419,7 @@ const UseNow = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1380
1419
|
}
|
|
1381
1420
|
});
|
|
1382
1421
|
|
|
1383
|
-
const UseObjectUrl = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1422
|
+
const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1384
1423
|
name: "UseObjectUrl",
|
|
1385
1424
|
props: [
|
|
1386
1425
|
"object"
|
|
@@ -1414,7 +1453,7 @@ var __spreadValues$5 = (a, b) => {
|
|
|
1414
1453
|
return a;
|
|
1415
1454
|
};
|
|
1416
1455
|
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1417
|
-
const UseOffsetPagination = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1456
|
+
const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1418
1457
|
name: "UseOffsetPagination",
|
|
1419
1458
|
props: [
|
|
1420
1459
|
"total",
|
|
@@ -1454,7 +1493,7 @@ const UseOffsetPagination = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1454
1493
|
}
|
|
1455
1494
|
});
|
|
1456
1495
|
|
|
1457
|
-
const UseOnline = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1496
|
+
const UseOnline = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1458
1497
|
name: "UseOnline",
|
|
1459
1498
|
setup(props, { slots }) {
|
|
1460
1499
|
const data = vueDemi.reactive({
|
|
@@ -1467,7 +1506,7 @@ const UseOnline = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1467
1506
|
}
|
|
1468
1507
|
});
|
|
1469
1508
|
|
|
1470
|
-
const UsePageLeave = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1509
|
+
const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1471
1510
|
name: "UsePageLeave",
|
|
1472
1511
|
setup(props, { slots }) {
|
|
1473
1512
|
const data = vueDemi.reactive({
|
|
@@ -1499,7 +1538,7 @@ var __spreadValues$4 = (a, b) => {
|
|
|
1499
1538
|
return a;
|
|
1500
1539
|
};
|
|
1501
1540
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1502
|
-
const UsePointer = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1541
|
+
const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1503
1542
|
name: "UsePointer",
|
|
1504
1543
|
props: [
|
|
1505
1544
|
"pointerTypes",
|
|
@@ -1518,7 +1557,7 @@ const UsePointer = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1518
1557
|
}
|
|
1519
1558
|
});
|
|
1520
1559
|
|
|
1521
|
-
const UsePointerLock = vueDemi.defineComponent({
|
|
1560
|
+
const UsePointerLock = /* #__PURE__ */ vueDemi.defineComponent({
|
|
1522
1561
|
name: "UsePointerLock",
|
|
1523
1562
|
props: ["as"],
|
|
1524
1563
|
setup(props, { slots }) {
|
|
@@ -1531,7 +1570,7 @@ const UsePointerLock = vueDemi.defineComponent({
|
|
|
1531
1570
|
}
|
|
1532
1571
|
});
|
|
1533
1572
|
|
|
1534
|
-
const UsePreferredColorScheme = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1573
|
+
const UsePreferredColorScheme = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1535
1574
|
name: "UsePreferredColorScheme",
|
|
1536
1575
|
setup(props, { slots }) {
|
|
1537
1576
|
const data = vueDemi.reactive({
|
|
@@ -1544,7 +1583,7 @@ const UsePreferredColorScheme = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1544
1583
|
}
|
|
1545
1584
|
});
|
|
1546
1585
|
|
|
1547
|
-
const UsePreferredContrast = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1586
|
+
const UsePreferredContrast = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1548
1587
|
name: "UsePreferredContrast",
|
|
1549
1588
|
setup(props, { slots }) {
|
|
1550
1589
|
const data = vueDemi.reactive({
|
|
@@ -1557,7 +1596,7 @@ const UsePreferredContrast = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1557
1596
|
}
|
|
1558
1597
|
});
|
|
1559
1598
|
|
|
1560
|
-
const UsePreferredDark = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1599
|
+
const UsePreferredDark = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1561
1600
|
name: "UsePreferredDark",
|
|
1562
1601
|
setup(props, { slots }) {
|
|
1563
1602
|
const data = vueDemi.reactive({
|
|
@@ -1570,7 +1609,7 @@ const UsePreferredDark = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1570
1609
|
}
|
|
1571
1610
|
});
|
|
1572
1611
|
|
|
1573
|
-
const UsePreferredLanguages = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1612
|
+
const UsePreferredLanguages = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1574
1613
|
name: "UsePreferredLanguages",
|
|
1575
1614
|
setup(props, { slots }) {
|
|
1576
1615
|
const data = vueDemi.reactive({
|
|
@@ -1583,7 +1622,7 @@ const UsePreferredLanguages = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1583
1622
|
}
|
|
1584
1623
|
});
|
|
1585
1624
|
|
|
1586
|
-
const UsePreferredReducedMotion = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1625
|
+
const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1587
1626
|
name: "UsePreferredReducedMotion",
|
|
1588
1627
|
setup(props, { slots }) {
|
|
1589
1628
|
const data = vueDemi.reactive({
|
|
@@ -1596,19 +1635,29 @@ const UsePreferredReducedMotion = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1596
1635
|
}
|
|
1597
1636
|
});
|
|
1598
1637
|
|
|
1599
|
-
function useCssVar(prop, target,
|
|
1638
|
+
function useCssVar(prop, target, options = {}) {
|
|
1639
|
+
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1600
1640
|
const variable = vueDemi.ref(initialValue);
|
|
1601
1641
|
const elRef = vueDemi.computed(() => {
|
|
1602
1642
|
var _a;
|
|
1603
1643
|
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1604
1644
|
});
|
|
1605
|
-
|
|
1645
|
+
function updateCssVar() {
|
|
1606
1646
|
var _a;
|
|
1647
|
+
const key = shared.resolveUnref(prop);
|
|
1648
|
+
const el = shared.resolveUnref(elRef);
|
|
1607
1649
|
if (el && window) {
|
|
1608
|
-
const value = (_a = window.getComputedStyle(el).getPropertyValue(
|
|
1650
|
+
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
|
|
1609
1651
|
variable.value = value || initialValue;
|
|
1610
1652
|
}
|
|
1611
|
-
}
|
|
1653
|
+
}
|
|
1654
|
+
if (observe) {
|
|
1655
|
+
core.useMutationObserver(elRef, updateCssVar, {
|
|
1656
|
+
attributes: true,
|
|
1657
|
+
window
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
vueDemi.watch([elRef, () => shared.resolveUnref(prop)], updateCssVar, { immediate: true });
|
|
1612
1661
|
vueDemi.watch(variable, (val) => {
|
|
1613
1662
|
var _a;
|
|
1614
1663
|
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
@@ -1656,7 +1705,7 @@ function getValue(position) {
|
|
|
1656
1705
|
return getComputedStyle(document.documentElement).getPropertyValue(position);
|
|
1657
1706
|
}
|
|
1658
1707
|
|
|
1659
|
-
const UseScreenSafeArea = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1708
|
+
const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1660
1709
|
name: "UseScreenSafeArea",
|
|
1661
1710
|
props: {
|
|
1662
1711
|
top: Boolean,
|
|
@@ -1741,7 +1790,7 @@ const vScroll = {
|
|
|
1741
1790
|
|
|
1742
1791
|
function checkOverflowScroll(ele) {
|
|
1743
1792
|
const style = window.getComputedStyle(ele);
|
|
1744
|
-
if (style.overflowX === "scroll" || style.overflowY === "scroll") {
|
|
1793
|
+
if (style.overflowX === "scroll" || style.overflowY === "scroll" || style.overflowX === "auto" && ele.clientHeight < ele.scrollHeight || style.overflowY === "auto" && ele.clientWidth < ele.scrollWidth) {
|
|
1745
1794
|
return true;
|
|
1746
1795
|
} else {
|
|
1747
1796
|
const parent = ele.parentNode;
|
|
@@ -1842,7 +1891,7 @@ var __spreadValues$2 = (a, b) => {
|
|
|
1842
1891
|
return a;
|
|
1843
1892
|
};
|
|
1844
1893
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1845
|
-
const UseTimeAgo = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1894
|
+
const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1846
1895
|
name: "UseTimeAgo",
|
|
1847
1896
|
props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
|
|
1848
1897
|
setup(props, { slots }) {
|
|
@@ -1873,7 +1922,7 @@ var __spreadValues$1 = (a, b) => {
|
|
|
1873
1922
|
return a;
|
|
1874
1923
|
};
|
|
1875
1924
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1876
|
-
const UseTimestamp = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1925
|
+
const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1877
1926
|
name: "UseTimestamp",
|
|
1878
1927
|
props: ["immediate", "interval", "offset"],
|
|
1879
1928
|
setup(props, { slots }) {
|
|
@@ -1901,7 +1950,7 @@ var __spreadValues = (a, b) => {
|
|
|
1901
1950
|
}
|
|
1902
1951
|
return a;
|
|
1903
1952
|
};
|
|
1904
|
-
const UseVirtualList = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1953
|
+
const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1905
1954
|
name: "UseVirtualList",
|
|
1906
1955
|
props: [
|
|
1907
1956
|
"list",
|
|
@@ -1919,7 +1968,7 @@ const UseVirtualList = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1919
1968
|
}
|
|
1920
1969
|
});
|
|
1921
1970
|
|
|
1922
|
-
const UseWindowFocus = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1971
|
+
const UseWindowFocus = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1923
1972
|
name: "UseWindowFocus",
|
|
1924
1973
|
setup(props, { slots }) {
|
|
1925
1974
|
const data = vueDemi.reactive({
|
|
@@ -1932,7 +1981,7 @@ const UseWindowFocus = /* @__PURE__ */ vueDemi.defineComponent({
|
|
|
1932
1981
|
}
|
|
1933
1982
|
});
|
|
1934
1983
|
|
|
1935
|
-
const UseWindowSize = /* @__PURE__ */ vueDemi.defineComponent({
|
|
1984
|
+
const UseWindowSize = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1936
1985
|
name: "UseWindowSize",
|
|
1937
1986
|
props: ["initialWidth", "initialHeight"],
|
|
1938
1987
|
setup(props, { slots }) {
|
package/index.d.ts
CHANGED
|
@@ -218,6 +218,13 @@ interface UseColorModeOptions<T extends string = BasicColorSchema> extends UseSt
|
|
|
218
218
|
* @default undefined
|
|
219
219
|
*/
|
|
220
220
|
emitAuto?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Disable transition on switch
|
|
223
|
+
*
|
|
224
|
+
* @see https://paco.me/writing/disable-theme-transitions
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
227
|
+
disableTransition?: boolean;
|
|
221
228
|
}
|
|
222
229
|
|
|
223
230
|
declare const UseColorMode: vue_demi.DefineComponent<UseColorModeOptions<BasicColorSchema>, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<UseColorModeOptions<BasicColorSchema>>, {}>;
|