@vueuse/components 7.7.1 → 8.0.0-beta.2
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 +437 -94
- package/index.d.ts +142 -14
- package/index.iife.js +437 -94
- package/index.iife.min.js +1 -1
- package/index.mjs +433 -96
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -96,6 +96,59 @@ const VOnClickOutside = (el, binding) => {
|
|
|
96
96
|
onClickOutside(el, binding.value);
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
+
const createKeyPredicate = (keyFilter) => {
|
|
100
|
+
if (typeof keyFilter === "function")
|
|
101
|
+
return keyFilter;
|
|
102
|
+
else if (typeof keyFilter === "string")
|
|
103
|
+
return (event) => event.key === keyFilter;
|
|
104
|
+
else if (Array.isArray(keyFilter))
|
|
105
|
+
return (event) => keyFilter.includes(event.key);
|
|
106
|
+
else if (keyFilter)
|
|
107
|
+
return () => true;
|
|
108
|
+
else
|
|
109
|
+
return () => false;
|
|
110
|
+
};
|
|
111
|
+
function onKeyStroke(key, handler, options = {}) {
|
|
112
|
+
const { target = defaultWindow, eventName = "keydown", passive = false } = options;
|
|
113
|
+
const predicate = createKeyPredicate(key);
|
|
114
|
+
const listener = (e) => {
|
|
115
|
+
if (predicate(e))
|
|
116
|
+
handler(e);
|
|
117
|
+
};
|
|
118
|
+
return useEventListener(target, eventName, listener, passive);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var __defProp$b = Object.defineProperty;
|
|
122
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
123
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
124
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
125
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
126
|
+
var __spreadValues$b = (a, b) => {
|
|
127
|
+
for (var prop in b || (b = {}))
|
|
128
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
129
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
130
|
+
if (__getOwnPropSymbols$b)
|
|
131
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
132
|
+
if (__propIsEnum$b.call(b, prop))
|
|
133
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
134
|
+
}
|
|
135
|
+
return a;
|
|
136
|
+
};
|
|
137
|
+
const vOnKeyStroke = (el, binding) => {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : [];
|
|
140
|
+
if (typeof binding.value === "function") {
|
|
141
|
+
onKeyStroke(keys, binding.value, {
|
|
142
|
+
target: el
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
const [handler, options] = binding.value;
|
|
146
|
+
onKeyStroke(keys, handler, __spreadValues$b({
|
|
147
|
+
target: el
|
|
148
|
+
}, options));
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
99
152
|
const DEFAULT_DELAY = 500;
|
|
100
153
|
function onLongPress(target, handler, options) {
|
|
101
154
|
const elementRef = vueDemi.computed(() => core.unrefElement(target));
|
|
@@ -136,7 +189,7 @@ const VOnLongPress = (el, binding) => {
|
|
|
136
189
|
if (typeof binding.value === "function")
|
|
137
190
|
onLongPress(el, binding.value);
|
|
138
191
|
else
|
|
139
|
-
onLongPress(el, binding.value
|
|
192
|
+
onLongPress(el, ...binding.value);
|
|
140
193
|
};
|
|
141
194
|
|
|
142
195
|
const UseActiveElement = vueDemi.defineComponent({
|
|
@@ -317,19 +370,19 @@ function usePreferredDark(options) {
|
|
|
317
370
|
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
318
371
|
}
|
|
319
372
|
|
|
320
|
-
var __defProp$
|
|
321
|
-
var __getOwnPropSymbols$
|
|
322
|
-
var __hasOwnProp$
|
|
323
|
-
var __propIsEnum$
|
|
324
|
-
var __defNormalProp$
|
|
325
|
-
var __spreadValues$
|
|
373
|
+
var __defProp$a = Object.defineProperty;
|
|
374
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
375
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
376
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
377
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
378
|
+
var __spreadValues$a = (a, b) => {
|
|
326
379
|
for (var prop in b || (b = {}))
|
|
327
|
-
if (__hasOwnProp$
|
|
328
|
-
__defNormalProp$
|
|
329
|
-
if (__getOwnPropSymbols$
|
|
330
|
-
for (var prop of __getOwnPropSymbols$
|
|
331
|
-
if (__propIsEnum$
|
|
332
|
-
__defNormalProp$
|
|
380
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
381
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
382
|
+
if (__getOwnPropSymbols$a)
|
|
383
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
384
|
+
if (__propIsEnum$a.call(b, prop))
|
|
385
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
333
386
|
}
|
|
334
387
|
return a;
|
|
335
388
|
};
|
|
@@ -343,7 +396,7 @@ function useColorMode(options = {}) {
|
|
|
343
396
|
listenToStorageChanges = true,
|
|
344
397
|
storageRef
|
|
345
398
|
} = options;
|
|
346
|
-
const modes = __spreadValues$
|
|
399
|
+
const modes = __spreadValues$a({
|
|
347
400
|
auto: "",
|
|
348
401
|
light: "light",
|
|
349
402
|
dark: "dark"
|
|
@@ -481,25 +534,25 @@ const UseDocumentVisibility = vueDemi.defineComponent({
|
|
|
481
534
|
}
|
|
482
535
|
});
|
|
483
536
|
|
|
484
|
-
var __defProp$
|
|
485
|
-
var __defProps$
|
|
486
|
-
var __getOwnPropDescs$
|
|
487
|
-
var __getOwnPropSymbols$
|
|
488
|
-
var __hasOwnProp$
|
|
489
|
-
var __propIsEnum$
|
|
490
|
-
var __defNormalProp$
|
|
491
|
-
var __spreadValues$
|
|
537
|
+
var __defProp$9 = Object.defineProperty;
|
|
538
|
+
var __defProps$8 = Object.defineProperties;
|
|
539
|
+
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
540
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
541
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
542
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
543
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
544
|
+
var __spreadValues$9 = (a, b) => {
|
|
492
545
|
for (var prop in b || (b = {}))
|
|
493
|
-
if (__hasOwnProp$
|
|
494
|
-
__defNormalProp$
|
|
495
|
-
if (__getOwnPropSymbols$
|
|
496
|
-
for (var prop of __getOwnPropSymbols$
|
|
497
|
-
if (__propIsEnum$
|
|
498
|
-
__defNormalProp$
|
|
546
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
547
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
548
|
+
if (__getOwnPropSymbols$9)
|
|
549
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
550
|
+
if (__propIsEnum$9.call(b, prop))
|
|
551
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
499
552
|
}
|
|
500
553
|
return a;
|
|
501
554
|
};
|
|
502
|
-
var __spreadProps$
|
|
555
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
503
556
|
const UseDraggable = vueDemi.defineComponent({
|
|
504
557
|
name: "UseDraggable",
|
|
505
558
|
props: [
|
|
@@ -514,7 +567,7 @@ const UseDraggable = vueDemi.defineComponent({
|
|
|
514
567
|
setup(props, { slots }) {
|
|
515
568
|
const target = vueDemi.ref();
|
|
516
569
|
const initialValue = props.storageKey ? core.useStorage(props.storageKey, vueDemi.unref(props.initialValue) || { x: 0, y: 0 }, core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : void 0) : props.initialValue || { x: 0, y: 0 };
|
|
517
|
-
const data = vueDemi.reactive(core.useDraggable(target, __spreadProps$
|
|
570
|
+
const data = vueDemi.reactive(core.useDraggable(target, __spreadProps$8(__spreadValues$9({}, props), {
|
|
518
571
|
initialValue
|
|
519
572
|
})));
|
|
520
573
|
return () => {
|
|
@@ -537,6 +590,20 @@ const UseElementBounding = vueDemi.defineComponent({
|
|
|
537
590
|
}
|
|
538
591
|
});
|
|
539
592
|
|
|
593
|
+
function useElementHover(el) {
|
|
594
|
+
const isHovered = vueDemi.ref(false);
|
|
595
|
+
useEventListener(el, "mouseenter", () => isHovered.value = true);
|
|
596
|
+
useEventListener(el, "mouseleave", () => isHovered.value = false);
|
|
597
|
+
return isHovered;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const vElementHover = (el, binding) => {
|
|
601
|
+
if (typeof binding.value === "function") {
|
|
602
|
+
const isHovered = useElementHover(el);
|
|
603
|
+
vueDemi.watch(isHovered, (v) => binding.value(v));
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
|
|
540
607
|
const UseElementSize = vueDemi.defineComponent({
|
|
541
608
|
name: "UseElementSize",
|
|
542
609
|
props: ["width", "height", "box"],
|
|
@@ -616,6 +683,160 @@ const UseIdle = vueDemi.defineComponent({
|
|
|
616
683
|
}
|
|
617
684
|
});
|
|
618
685
|
|
|
686
|
+
function useScroll(element, options = {}) {
|
|
687
|
+
const {
|
|
688
|
+
throttle = 0,
|
|
689
|
+
idle = 200,
|
|
690
|
+
onStop = shared.noop,
|
|
691
|
+
onScroll = shared.noop,
|
|
692
|
+
offset = {
|
|
693
|
+
left: 0,
|
|
694
|
+
right: 0,
|
|
695
|
+
top: 0,
|
|
696
|
+
bottom: 0
|
|
697
|
+
},
|
|
698
|
+
eventListenerOptions = {
|
|
699
|
+
capture: false,
|
|
700
|
+
passive: true
|
|
701
|
+
}
|
|
702
|
+
} = options;
|
|
703
|
+
const x = vueDemi.ref(0);
|
|
704
|
+
const y = vueDemi.ref(0);
|
|
705
|
+
const isScrolling = vueDemi.ref(false);
|
|
706
|
+
const arrivedState = vueDemi.reactive({
|
|
707
|
+
left: true,
|
|
708
|
+
right: false,
|
|
709
|
+
top: true,
|
|
710
|
+
bottom: false
|
|
711
|
+
});
|
|
712
|
+
const directions = vueDemi.reactive({
|
|
713
|
+
left: false,
|
|
714
|
+
right: false,
|
|
715
|
+
top: false,
|
|
716
|
+
bottom: false
|
|
717
|
+
});
|
|
718
|
+
if (element) {
|
|
719
|
+
const onScrollEnd = shared.useDebounceFn((e) => {
|
|
720
|
+
isScrolling.value = false;
|
|
721
|
+
directions.left = false;
|
|
722
|
+
directions.right = false;
|
|
723
|
+
directions.top = false;
|
|
724
|
+
directions.bottom = false;
|
|
725
|
+
onStop(e);
|
|
726
|
+
}, throttle + idle);
|
|
727
|
+
const onScrollHandler = (e) => {
|
|
728
|
+
const eventTarget = e.target === document ? e.target.documentElement : e.target;
|
|
729
|
+
const scrollLeft = eventTarget.scrollLeft;
|
|
730
|
+
directions.left = scrollLeft < x.value;
|
|
731
|
+
directions.right = scrollLeft > x.value;
|
|
732
|
+
arrivedState.left = scrollLeft <= 0 + (offset.left || 0);
|
|
733
|
+
arrivedState.right = scrollLeft + eventTarget.clientWidth >= eventTarget.scrollWidth - (offset.right || 0);
|
|
734
|
+
x.value = scrollLeft;
|
|
735
|
+
const scrollTop = eventTarget.scrollTop;
|
|
736
|
+
directions.top = scrollTop < y.value;
|
|
737
|
+
directions.bottom = scrollTop > y.value;
|
|
738
|
+
arrivedState.top = scrollTop <= 0 + (offset.top || 0);
|
|
739
|
+
arrivedState.bottom = scrollTop + eventTarget.clientHeight >= eventTarget.scrollHeight - (offset.bottom || 0);
|
|
740
|
+
y.value = scrollTop;
|
|
741
|
+
isScrolling.value = true;
|
|
742
|
+
onScrollEnd(e);
|
|
743
|
+
onScroll(e);
|
|
744
|
+
};
|
|
745
|
+
useEventListener(element, "scroll", throttle ? shared.useThrottleFn(onScrollHandler, throttle) : onScrollHandler, eventListenerOptions);
|
|
746
|
+
}
|
|
747
|
+
return {
|
|
748
|
+
x,
|
|
749
|
+
y,
|
|
750
|
+
isScrolling,
|
|
751
|
+
arrivedState,
|
|
752
|
+
directions
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
var __defProp$8 = Object.defineProperty;
|
|
757
|
+
var __defProps$7 = Object.defineProperties;
|
|
758
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
759
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
760
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
761
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
762
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
763
|
+
var __spreadValues$8 = (a, b) => {
|
|
764
|
+
for (var prop in b || (b = {}))
|
|
765
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
766
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
767
|
+
if (__getOwnPropSymbols$8)
|
|
768
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
769
|
+
if (__propIsEnum$8.call(b, prop))
|
|
770
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
771
|
+
}
|
|
772
|
+
return a;
|
|
773
|
+
};
|
|
774
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
775
|
+
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
776
|
+
var _a;
|
|
777
|
+
const state = vueDemi.reactive(useScroll(element, __spreadProps$7(__spreadValues$8({}, options), {
|
|
778
|
+
offset: __spreadValues$8({
|
|
779
|
+
bottom: (_a = options.distance) != null ? _a : 0
|
|
780
|
+
}, options.offset)
|
|
781
|
+
})));
|
|
782
|
+
vueDemi.watch(() => state.arrivedState.bottom, (v) => {
|
|
783
|
+
if (v)
|
|
784
|
+
onLoadMore(state);
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
const vInfiniteScroll = (el, binding) => {
|
|
789
|
+
if (typeof binding.value === "function")
|
|
790
|
+
useInfiniteScroll(el, binding.value);
|
|
791
|
+
else
|
|
792
|
+
useInfiniteScroll(el, ...binding.value);
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
function useIntersectionObserver(target, callback, options = {}) {
|
|
796
|
+
const {
|
|
797
|
+
root,
|
|
798
|
+
rootMargin = "0px",
|
|
799
|
+
threshold = 0.1,
|
|
800
|
+
window = defaultWindow
|
|
801
|
+
} = options;
|
|
802
|
+
const isSupported = window && "IntersectionObserver" in window;
|
|
803
|
+
let cleanup = shared.noop;
|
|
804
|
+
const stopWatch = isSupported ? vueDemi.watch(() => ({
|
|
805
|
+
el: unrefElement(target),
|
|
806
|
+
root: unrefElement(root)
|
|
807
|
+
}), ({ el, root: root2 }) => {
|
|
808
|
+
cleanup();
|
|
809
|
+
if (!el)
|
|
810
|
+
return;
|
|
811
|
+
const observer = new window.IntersectionObserver(callback, {
|
|
812
|
+
root: root2,
|
|
813
|
+
rootMargin,
|
|
814
|
+
threshold
|
|
815
|
+
});
|
|
816
|
+
observer.observe(el);
|
|
817
|
+
cleanup = () => {
|
|
818
|
+
observer.disconnect();
|
|
819
|
+
cleanup = shared.noop;
|
|
820
|
+
};
|
|
821
|
+
}, { immediate: true, flush: "post" }) : shared.noop;
|
|
822
|
+
const stop = () => {
|
|
823
|
+
cleanup();
|
|
824
|
+
stopWatch();
|
|
825
|
+
};
|
|
826
|
+
shared.tryOnScopeDispose(stop);
|
|
827
|
+
return {
|
|
828
|
+
isSupported,
|
|
829
|
+
stop
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
const vIntersectionObserver = (el, binding) => {
|
|
834
|
+
if (typeof binding.value === "function")
|
|
835
|
+
useIntersectionObserver(el, binding.value);
|
|
836
|
+
else
|
|
837
|
+
useIntersectionObserver(el, ...binding.value);
|
|
838
|
+
};
|
|
839
|
+
|
|
619
840
|
const UseMouse = vueDemi.defineComponent({
|
|
620
841
|
name: "UseMouse",
|
|
621
842
|
props: ["touch", "resetOnTouchEnds", "initialValue"],
|
|
@@ -641,31 +862,31 @@ const UseMouseInElement = vueDemi.defineComponent({
|
|
|
641
862
|
}
|
|
642
863
|
});
|
|
643
864
|
|
|
644
|
-
var __defProp$
|
|
645
|
-
var __defProps$
|
|
646
|
-
var __getOwnPropDescs$
|
|
647
|
-
var __getOwnPropSymbols$
|
|
648
|
-
var __hasOwnProp$
|
|
649
|
-
var __propIsEnum$
|
|
650
|
-
var __defNormalProp$
|
|
651
|
-
var __spreadValues$
|
|
865
|
+
var __defProp$7 = Object.defineProperty;
|
|
866
|
+
var __defProps$6 = Object.defineProperties;
|
|
867
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
868
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
869
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
870
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
871
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
872
|
+
var __spreadValues$7 = (a, b) => {
|
|
652
873
|
for (var prop in b || (b = {}))
|
|
653
|
-
if (__hasOwnProp$
|
|
654
|
-
__defNormalProp$
|
|
655
|
-
if (__getOwnPropSymbols$
|
|
656
|
-
for (var prop of __getOwnPropSymbols$
|
|
657
|
-
if (__propIsEnum$
|
|
658
|
-
__defNormalProp$
|
|
874
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
875
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
876
|
+
if (__getOwnPropSymbols$7)
|
|
877
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
878
|
+
if (__propIsEnum$7.call(b, prop))
|
|
879
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
659
880
|
}
|
|
660
881
|
return a;
|
|
661
882
|
};
|
|
662
|
-
var __spreadProps$
|
|
883
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
663
884
|
const UseMousePressed = vueDemi.defineComponent({
|
|
664
885
|
name: "UseMousePressed",
|
|
665
886
|
props: ["touch", "initialValue", "as"],
|
|
666
887
|
setup(props, { slots }) {
|
|
667
888
|
const target = vueDemi.ref();
|
|
668
|
-
const data = vueDemi.reactive(core.useMousePressed(__spreadProps$
|
|
889
|
+
const data = vueDemi.reactive(core.useMousePressed(__spreadProps$6(__spreadValues$7({}, props), { target })));
|
|
669
890
|
return () => {
|
|
670
891
|
if (slots.default)
|
|
671
892
|
return vueDemi.h(props.as || "div", { ref: target }, slots.default(data));
|
|
@@ -684,30 +905,30 @@ const UseNetwork = vueDemi.defineComponent({
|
|
|
684
905
|
}
|
|
685
906
|
});
|
|
686
907
|
|
|
687
|
-
var __defProp$
|
|
688
|
-
var __defProps$
|
|
689
|
-
var __getOwnPropDescs$
|
|
690
|
-
var __getOwnPropSymbols$
|
|
691
|
-
var __hasOwnProp$
|
|
692
|
-
var __propIsEnum$
|
|
693
|
-
var __defNormalProp$
|
|
694
|
-
var __spreadValues$
|
|
908
|
+
var __defProp$6 = Object.defineProperty;
|
|
909
|
+
var __defProps$5 = Object.defineProperties;
|
|
910
|
+
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
911
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
912
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
913
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
914
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
915
|
+
var __spreadValues$6 = (a, b) => {
|
|
695
916
|
for (var prop in b || (b = {}))
|
|
696
|
-
if (__hasOwnProp$
|
|
697
|
-
__defNormalProp$
|
|
698
|
-
if (__getOwnPropSymbols$
|
|
699
|
-
for (var prop of __getOwnPropSymbols$
|
|
700
|
-
if (__propIsEnum$
|
|
701
|
-
__defNormalProp$
|
|
917
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
918
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
919
|
+
if (__getOwnPropSymbols$6)
|
|
920
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
921
|
+
if (__propIsEnum$6.call(b, prop))
|
|
922
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
702
923
|
}
|
|
703
924
|
return a;
|
|
704
925
|
};
|
|
705
|
-
var __spreadProps$
|
|
926
|
+
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
706
927
|
const UseNow = vueDemi.defineComponent({
|
|
707
928
|
name: "UseNow",
|
|
708
929
|
props: ["interval"],
|
|
709
930
|
setup(props, { slots }) {
|
|
710
|
-
const data = vueDemi.reactive(core.useNow(__spreadProps$
|
|
931
|
+
const data = vueDemi.reactive(core.useNow(__spreadProps$5(__spreadValues$6({}, props), { controls: true })));
|
|
711
932
|
return () => {
|
|
712
933
|
if (slots.default)
|
|
713
934
|
return slots.default(data);
|
|
@@ -715,25 +936,25 @@ const UseNow = vueDemi.defineComponent({
|
|
|
715
936
|
}
|
|
716
937
|
});
|
|
717
938
|
|
|
718
|
-
var __defProp$
|
|
719
|
-
var __defProps$
|
|
720
|
-
var __getOwnPropDescs$
|
|
721
|
-
var __getOwnPropSymbols$
|
|
722
|
-
var __hasOwnProp$
|
|
723
|
-
var __propIsEnum$
|
|
724
|
-
var __defNormalProp$
|
|
725
|
-
var __spreadValues$
|
|
939
|
+
var __defProp$5 = Object.defineProperty;
|
|
940
|
+
var __defProps$4 = Object.defineProperties;
|
|
941
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
942
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
943
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
944
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
945
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
946
|
+
var __spreadValues$5 = (a, b) => {
|
|
726
947
|
for (var prop in b || (b = {}))
|
|
727
|
-
if (__hasOwnProp$
|
|
728
|
-
__defNormalProp$
|
|
729
|
-
if (__getOwnPropSymbols$
|
|
730
|
-
for (var prop of __getOwnPropSymbols$
|
|
731
|
-
if (__propIsEnum$
|
|
732
|
-
__defNormalProp$
|
|
948
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
949
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
950
|
+
if (__getOwnPropSymbols$5)
|
|
951
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
952
|
+
if (__propIsEnum$5.call(b, prop))
|
|
953
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
733
954
|
}
|
|
734
955
|
return a;
|
|
735
956
|
};
|
|
736
|
-
var __spreadProps$
|
|
957
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
737
958
|
const UseOffsetPagination = vueDemi.defineComponent({
|
|
738
959
|
name: "UseOffsetPagination",
|
|
739
960
|
props: [
|
|
@@ -750,7 +971,7 @@ const UseOffsetPagination = vueDemi.defineComponent({
|
|
|
750
971
|
"page-count-change"
|
|
751
972
|
],
|
|
752
973
|
setup(props, { slots, emit }) {
|
|
753
|
-
const data = vueDemi.reactive(core.useOffsetPagination(__spreadProps$
|
|
974
|
+
const data = vueDemi.reactive(core.useOffsetPagination(__spreadProps$4(__spreadValues$5({}, props), {
|
|
754
975
|
onPageChange(...args) {
|
|
755
976
|
var _a;
|
|
756
977
|
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
@@ -800,25 +1021,25 @@ const UsePageLeave = vueDemi.defineComponent({
|
|
|
800
1021
|
}
|
|
801
1022
|
});
|
|
802
1023
|
|
|
803
|
-
var __defProp$
|
|
804
|
-
var __defProps$
|
|
805
|
-
var __getOwnPropDescs$
|
|
806
|
-
var __getOwnPropSymbols$
|
|
807
|
-
var __hasOwnProp$
|
|
808
|
-
var __propIsEnum$
|
|
809
|
-
var __defNormalProp$
|
|
810
|
-
var __spreadValues$
|
|
1024
|
+
var __defProp$4 = Object.defineProperty;
|
|
1025
|
+
var __defProps$3 = Object.defineProperties;
|
|
1026
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1027
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1028
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1029
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1030
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1031
|
+
var __spreadValues$4 = (a, b) => {
|
|
811
1032
|
for (var prop in b || (b = {}))
|
|
812
|
-
if (__hasOwnProp$
|
|
813
|
-
__defNormalProp$
|
|
814
|
-
if (__getOwnPropSymbols$
|
|
815
|
-
for (var prop of __getOwnPropSymbols$
|
|
816
|
-
if (__propIsEnum$
|
|
817
|
-
__defNormalProp$
|
|
1033
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
1034
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1035
|
+
if (__getOwnPropSymbols$4)
|
|
1036
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1037
|
+
if (__propIsEnum$4.call(b, prop))
|
|
1038
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
818
1039
|
}
|
|
819
1040
|
return a;
|
|
820
1041
|
};
|
|
821
|
-
var __spreadProps$
|
|
1042
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
822
1043
|
const UsePointer = vueDemi.defineComponent({
|
|
823
1044
|
name: "UsePointer",
|
|
824
1045
|
props: [
|
|
@@ -828,7 +1049,7 @@ const UsePointer = vueDemi.defineComponent({
|
|
|
828
1049
|
],
|
|
829
1050
|
setup(props, { slots }) {
|
|
830
1051
|
const el = vueDemi.ref(null);
|
|
831
|
-
const data = vueDemi.reactive(core.usePointer(__spreadProps$
|
|
1052
|
+
const data = vueDemi.reactive(core.usePointer(__spreadProps$3(__spreadValues$4({}, props), {
|
|
832
1053
|
target: props.target === "self" ? el : defaultWindow
|
|
833
1054
|
})));
|
|
834
1055
|
return () => {
|
|
@@ -968,6 +1189,122 @@ const UseScreenSafeArea = vueDemi.defineComponent({
|
|
|
968
1189
|
}
|
|
969
1190
|
});
|
|
970
1191
|
|
|
1192
|
+
var __defProp$3 = Object.defineProperty;
|
|
1193
|
+
var __defProps$2 = Object.defineProperties;
|
|
1194
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1195
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1196
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1197
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1198
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1199
|
+
var __spreadValues$3 = (a, b) => {
|
|
1200
|
+
for (var prop in b || (b = {}))
|
|
1201
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
1202
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1203
|
+
if (__getOwnPropSymbols$3)
|
|
1204
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1205
|
+
if (__propIsEnum$3.call(b, prop))
|
|
1206
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1207
|
+
}
|
|
1208
|
+
return a;
|
|
1209
|
+
};
|
|
1210
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1211
|
+
const vScroll = (el, binding) => {
|
|
1212
|
+
if (typeof binding.value === "function") {
|
|
1213
|
+
const handler = binding.value;
|
|
1214
|
+
const state = useScroll(el, {
|
|
1215
|
+
onScroll() {
|
|
1216
|
+
handler(state);
|
|
1217
|
+
},
|
|
1218
|
+
onStop() {
|
|
1219
|
+
handler(state);
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
} else {
|
|
1223
|
+
const [handler, options] = binding.value;
|
|
1224
|
+
const state = useScroll(el, __spreadProps$2(__spreadValues$3({}, options), {
|
|
1225
|
+
onScroll(e) {
|
|
1226
|
+
var _a;
|
|
1227
|
+
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
1228
|
+
handler(state);
|
|
1229
|
+
},
|
|
1230
|
+
onStop(e) {
|
|
1231
|
+
var _a;
|
|
1232
|
+
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
1233
|
+
handler(state);
|
|
1234
|
+
}
|
|
1235
|
+
}));
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1239
|
+
var _a, _b;
|
|
1240
|
+
function preventDefault(rawEvent) {
|
|
1241
|
+
const e = rawEvent || window.event;
|
|
1242
|
+
if (e.touches.length > 1)
|
|
1243
|
+
return true;
|
|
1244
|
+
if (e.preventDefault)
|
|
1245
|
+
e.preventDefault();
|
|
1246
|
+
return false;
|
|
1247
|
+
}
|
|
1248
|
+
const isIOS = shared.isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
|
|
1249
|
+
function useScrollLock(element, initialState = false) {
|
|
1250
|
+
const isLocked = vueDemi.ref(initialState);
|
|
1251
|
+
let touchMoveListener = null;
|
|
1252
|
+
let initialOverflow;
|
|
1253
|
+
vueDemi.watch(() => vueDemi.unref(element), (el) => {
|
|
1254
|
+
if (el) {
|
|
1255
|
+
const ele = el;
|
|
1256
|
+
initialOverflow = ele.style.overflow;
|
|
1257
|
+
if (isLocked.value)
|
|
1258
|
+
ele.style.overflow = "hidden";
|
|
1259
|
+
}
|
|
1260
|
+
}, {
|
|
1261
|
+
immediate: true
|
|
1262
|
+
});
|
|
1263
|
+
const lock = () => {
|
|
1264
|
+
const ele = vueDemi.unref(element);
|
|
1265
|
+
if (!ele || isLocked.value)
|
|
1266
|
+
return;
|
|
1267
|
+
if (isIOS) {
|
|
1268
|
+
touchMoveListener = useEventListener(document, "touchmove", preventDefault, { passive: false });
|
|
1269
|
+
}
|
|
1270
|
+
ele.style.overflow = "hidden";
|
|
1271
|
+
isLocked.value = true;
|
|
1272
|
+
};
|
|
1273
|
+
const unlock = () => {
|
|
1274
|
+
const ele = vueDemi.unref(element);
|
|
1275
|
+
if (!ele || !isLocked.value)
|
|
1276
|
+
return;
|
|
1277
|
+
isIOS && (touchMoveListener == null ? void 0 : touchMoveListener());
|
|
1278
|
+
ele.style.overflow = initialOverflow;
|
|
1279
|
+
isLocked.value = false;
|
|
1280
|
+
};
|
|
1281
|
+
return vueDemi.computed({
|
|
1282
|
+
get() {
|
|
1283
|
+
return isLocked.value;
|
|
1284
|
+
},
|
|
1285
|
+
set(v) {
|
|
1286
|
+
if (v)
|
|
1287
|
+
lock();
|
|
1288
|
+
else
|
|
1289
|
+
unlock();
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
const onScrollLock = () => {
|
|
1295
|
+
let isMounted = false;
|
|
1296
|
+
const state = vueDemi.ref(false);
|
|
1297
|
+
return (el, binding) => {
|
|
1298
|
+
state.value = binding.value;
|
|
1299
|
+
if (isMounted)
|
|
1300
|
+
return;
|
|
1301
|
+
isMounted = true;
|
|
1302
|
+
const isLocked = useScrollLock(el, binding.value);
|
|
1303
|
+
vueDemi.watch(state, (v) => isLocked.value = v);
|
|
1304
|
+
};
|
|
1305
|
+
};
|
|
1306
|
+
const vScrollLock = onScrollLock();
|
|
1307
|
+
|
|
971
1308
|
var __defProp$2 = Object.defineProperty;
|
|
972
1309
|
var __defProps$1 = Object.defineProperties;
|
|
973
1310
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
@@ -1129,3 +1466,9 @@ exports.UseWindowFocus = UseWindowFocus;
|
|
|
1129
1466
|
exports.UseWindowSize = UseWindowSize;
|
|
1130
1467
|
exports.VOnClickOutside = VOnClickOutside;
|
|
1131
1468
|
exports.VOnLongPress = VOnLongPress;
|
|
1469
|
+
exports.vElementHover = vElementHover;
|
|
1470
|
+
exports.vInfiniteScroll = vInfiniteScroll;
|
|
1471
|
+
exports.vIntersectionObserver = vIntersectionObserver;
|
|
1472
|
+
exports.vOnKeyStroke = vOnKeyStroke;
|
|
1473
|
+
exports.vScroll = vScroll;
|
|
1474
|
+
exports.vScrollLock = vScrollLock;
|