@vueuse/shared 9.0.2 → 9.2.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 +37 -14
- package/index.d.ts +62 -21
- package/index.iife.js +39 -15
- package/index.iife.min.js +1 -1
- package/index.mjs +35 -15
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var vueDemi = require('vue-demi');
|
|
6
|
-
var shared = require('@vueuse/shared');
|
|
7
6
|
|
|
8
7
|
var __defProp$9 = Object.defineProperty;
|
|
9
8
|
var __defProps$6 = Object.defineProperties;
|
|
@@ -60,6 +59,7 @@ const rand = (min, max) => {
|
|
|
60
59
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
61
60
|
};
|
|
62
61
|
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
62
|
+
const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
|
|
63
63
|
|
|
64
64
|
function resolveUnref(r) {
|
|
65
65
|
return typeof r === "function" ? r() : vueDemi.unref(r);
|
|
@@ -481,7 +481,7 @@ function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
|
481
481
|
const resetAfter = () => setTimeout(() => {
|
|
482
482
|
value = defaultValue;
|
|
483
483
|
trigger();
|
|
484
|
-
},
|
|
484
|
+
}, resolveUnref(afterMs));
|
|
485
485
|
tryOnScopeDispose(() => {
|
|
486
486
|
clearTimeout(timer);
|
|
487
487
|
});
|
|
@@ -825,39 +825,39 @@ function until(r) {
|
|
|
825
825
|
}
|
|
826
826
|
|
|
827
827
|
function useArrayEvery(list, fn) {
|
|
828
|
-
return vueDemi.computed(() =>
|
|
828
|
+
return vueDemi.computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
829
829
|
}
|
|
830
830
|
|
|
831
831
|
function useArrayFilter(list, fn) {
|
|
832
|
-
return vueDemi.computed(() =>
|
|
832
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).filter(fn));
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
function useArrayFind(list, fn) {
|
|
836
|
-
return vueDemi.computed(() =>
|
|
836
|
+
return vueDemi.computed(() => resolveUnref(resolveUnref(list).find((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
837
837
|
}
|
|
838
838
|
|
|
839
839
|
function useArrayFindIndex(list, fn) {
|
|
840
|
-
return vueDemi.computed(() =>
|
|
840
|
+
return vueDemi.computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
841
841
|
}
|
|
842
842
|
|
|
843
843
|
function useArrayJoin(list, separator) {
|
|
844
|
-
return vueDemi.computed(() =>
|
|
844
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
function useArrayMap(list, fn) {
|
|
848
|
-
return vueDemi.computed(() =>
|
|
848
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).map(fn));
|
|
849
849
|
}
|
|
850
850
|
|
|
851
851
|
function useArrayReduce(list, reducer, ...args) {
|
|
852
|
-
const reduceCallback = (sum, value, index) => reducer(
|
|
852
|
+
const reduceCallback = (sum, value, index) => reducer(resolveUnref(sum), resolveUnref(value), index);
|
|
853
853
|
return vueDemi.computed(() => {
|
|
854
|
-
const resolved =
|
|
855
|
-
return args.length ? resolved.reduce(reduceCallback,
|
|
854
|
+
const resolved = resolveUnref(list);
|
|
855
|
+
return args.length ? resolved.reduce(reduceCallback, resolveUnref(args[0])) : resolved.reduce(reduceCallback);
|
|
856
856
|
});
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
function useArraySome(list, fn) {
|
|
860
|
-
return vueDemi.computed(() =>
|
|
860
|
+
return vueDemi.computed(() => resolveUnref(list).some((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
861
861
|
}
|
|
862
862
|
|
|
863
863
|
function useCounter(initialValue = 0, options = {}) {
|
|
@@ -929,7 +929,7 @@ const normalizeDate = (date) => {
|
|
|
929
929
|
return new Date(date);
|
|
930
930
|
};
|
|
931
931
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
932
|
-
return vueDemi.computed(() => formatDate(normalizeDate(
|
|
932
|
+
return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
|
|
933
933
|
}
|
|
934
934
|
|
|
935
935
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1037,7 +1037,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1037
1037
|
isPending.value = false;
|
|
1038
1038
|
timer = null;
|
|
1039
1039
|
cb(...args);
|
|
1040
|
-
},
|
|
1040
|
+
}, resolveUnref(interval));
|
|
1041
1041
|
}
|
|
1042
1042
|
if (immediate) {
|
|
1043
1043
|
isPending.value = true;
|
|
@@ -1083,6 +1083,26 @@ function useTimeout(interval = 1e3, options = {}) {
|
|
|
1083
1083
|
}
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
1086
|
+
function useToNumber(value, options = {}) {
|
|
1087
|
+
const {
|
|
1088
|
+
method = "parseFloat",
|
|
1089
|
+
radix,
|
|
1090
|
+
nanToZero
|
|
1091
|
+
} = options;
|
|
1092
|
+
return vueDemi.computed(() => {
|
|
1093
|
+
let resolved = resolveUnref(value);
|
|
1094
|
+
if (typeof resolved === "string")
|
|
1095
|
+
resolved = Number[method](resolved, radix);
|
|
1096
|
+
if (nanToZero && isNaN(resolved))
|
|
1097
|
+
resolved = 0;
|
|
1098
|
+
return resolved;
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
function useToString(value) {
|
|
1103
|
+
return vueDemi.computed(() => `${resolveUnref(value)}`);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1086
1106
|
function useToggle(initialValue = false, options = {}) {
|
|
1087
1107
|
const {
|
|
1088
1108
|
truthyValue = true,
|
|
@@ -1505,6 +1525,7 @@ exports.eagerComputed = computedEager;
|
|
|
1505
1525
|
exports.extendRef = extendRef;
|
|
1506
1526
|
exports.formatDate = formatDate;
|
|
1507
1527
|
exports.get = get;
|
|
1528
|
+
exports.hasOwn = hasOwn;
|
|
1508
1529
|
exports.identity = identity;
|
|
1509
1530
|
exports.ignorableWatch = watchIgnorable;
|
|
1510
1531
|
exports.increaseWithUnit = increaseWithUnit;
|
|
@@ -1574,6 +1595,8 @@ exports.useThrottle = refThrottled;
|
|
|
1574
1595
|
exports.useThrottleFn = useThrottleFn;
|
|
1575
1596
|
exports.useTimeout = useTimeout;
|
|
1576
1597
|
exports.useTimeoutFn = useTimeoutFn;
|
|
1598
|
+
exports.useToNumber = useToNumber;
|
|
1599
|
+
exports.useToString = useToString;
|
|
1577
1600
|
exports.useToggle = useToggle;
|
|
1578
1601
|
exports.watchArray = watchArray;
|
|
1579
1602
|
exports.watchAtMost = watchAtMost;
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, ShallowUnwrapRef as ShallowUnwrapRef$1, WatchOptions, UnwrapRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue-demi';
|
|
3
|
-
import { MaybeComputedRef as MaybeComputedRef$1 } from '@vueuse/shared';
|
|
4
3
|
|
|
5
4
|
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<Ref<T>>;
|
|
6
5
|
|
|
@@ -100,6 +99,7 @@ declare const clamp: (n: number, min: number, max: number) => number;
|
|
|
100
99
|
declare const noop: () => void;
|
|
101
100
|
declare const rand: (min: number, max: number) => number;
|
|
102
101
|
declare const isIOS: boolean | "";
|
|
102
|
+
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Any function
|
|
@@ -128,10 +128,18 @@ declare type MaybeRef<T> = T | Ref<T>;
|
|
|
128
128
|
* Maybe it's a ref, or a plain value, or a getter function
|
|
129
129
|
*
|
|
130
130
|
* ```ts
|
|
131
|
-
* type MaybeComputedRef<T> = T | Ref<T> |
|
|
131
|
+
* type MaybeComputedRef<T> = (() => T) | T | Ref<T> | ComputedRef<T>
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
|
-
declare type MaybeComputedRef<T> = T
|
|
134
|
+
declare type MaybeComputedRef<T> = MaybeReadonlyRef<T> | MaybeRef<T>;
|
|
135
|
+
/**
|
|
136
|
+
* Maybe it's a computed ref, or a getter function
|
|
137
|
+
*
|
|
138
|
+
* ```ts
|
|
139
|
+
* type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
declare type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
|
135
143
|
/**
|
|
136
144
|
* Make all the nested attributes of an object or array to MaybeRef<T>
|
|
137
145
|
*
|
|
@@ -238,7 +246,7 @@ declare const bypassFilter: EventFilter;
|
|
|
238
246
|
* Create an EventFilter that debounce the events
|
|
239
247
|
*
|
|
240
248
|
* @param ms
|
|
241
|
-
* @param
|
|
249
|
+
* @param options
|
|
242
250
|
*/
|
|
243
251
|
declare function debounceFilter(ms: MaybeComputedRef<number>, options?: DebounceFilterOptions): EventFilter<any[], any>;
|
|
244
252
|
/**
|
|
@@ -384,7 +392,7 @@ declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...ke
|
|
|
384
392
|
* @param defaultValue The value which will be set.
|
|
385
393
|
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
386
394
|
*/
|
|
387
|
-
declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeComputedRef
|
|
395
|
+
declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeComputedRef<number>): Ref<T>;
|
|
388
396
|
|
|
389
397
|
/**
|
|
390
398
|
* Debounce updates of a ref.
|
|
@@ -641,7 +649,7 @@ declare function until<T>(r: WatchSource<T> | MaybeComputedRef<T>): UntilValueIn
|
|
|
641
649
|
*
|
|
642
650
|
* @returns {boolean} **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
|
|
643
651
|
*/
|
|
644
|
-
declare function useArrayEvery<T>(list: MaybeComputedRef
|
|
652
|
+
declare function useArrayEvery<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<boolean>;
|
|
645
653
|
|
|
646
654
|
/**
|
|
647
655
|
* Reactive `Array.filter`
|
|
@@ -652,7 +660,7 @@ declare function useArrayEvery<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>
|
|
|
652
660
|
*
|
|
653
661
|
* @returns {Array} a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
|
|
654
662
|
*/
|
|
655
|
-
declare function useArrayFilter<T>(list: MaybeComputedRef
|
|
663
|
+
declare function useArrayFilter<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => boolean): ComputedRef<T[]>;
|
|
656
664
|
|
|
657
665
|
/**
|
|
658
666
|
* Reactive `Array.find`
|
|
@@ -663,7 +671,7 @@ declare function useArrayFilter<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T
|
|
|
663
671
|
*
|
|
664
672
|
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
665
673
|
*/
|
|
666
|
-
declare function useArrayFind<T>(list: MaybeComputedRef
|
|
674
|
+
declare function useArrayFind<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
667
675
|
|
|
668
676
|
/**
|
|
669
677
|
* Reactive `Array.findIndex`
|
|
@@ -674,7 +682,7 @@ declare function useArrayFind<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[
|
|
|
674
682
|
*
|
|
675
683
|
* @returns {number} the index of the first element in the array that passes the test. Otherwise, "-1".
|
|
676
684
|
*/
|
|
677
|
-
declare function useArrayFindIndex<T>(list: MaybeComputedRef
|
|
685
|
+
declare function useArrayFindIndex<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<number>;
|
|
678
686
|
|
|
679
687
|
/**
|
|
680
688
|
* Reactive `Array.join`
|
|
@@ -685,7 +693,7 @@ declare function useArrayFindIndex<T>(list: MaybeComputedRef$1<MaybeComputedRef$
|
|
|
685
693
|
*
|
|
686
694
|
* @returns {string} a string with all array elements joined. If arr.length is 0, the empty string is returned.
|
|
687
695
|
*/
|
|
688
|
-
declare function useArrayJoin(list: MaybeComputedRef
|
|
696
|
+
declare function useArrayJoin(list: MaybeComputedRef<MaybeComputedRef<any>[]>, separator?: MaybeComputedRef<string>): ComputedRef<string>;
|
|
689
697
|
|
|
690
698
|
/**
|
|
691
699
|
* Reactive `Array.map`
|
|
@@ -696,7 +704,7 @@ declare function useArrayJoin(list: MaybeComputedRef$1<MaybeComputedRef$1<any>[]
|
|
|
696
704
|
*
|
|
697
705
|
* @returns {Array} a new array with each element being the result of the callback function.
|
|
698
706
|
*/
|
|
699
|
-
declare function useArrayMap<T>(list: MaybeComputedRef
|
|
707
|
+
declare function useArrayMap<T, U = T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => U): ComputedRef<U[]>;
|
|
700
708
|
|
|
701
709
|
declare type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
702
710
|
/**
|
|
@@ -708,7 +716,7 @@ declare type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV,
|
|
|
708
716
|
*
|
|
709
717
|
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
710
718
|
*/
|
|
711
|
-
declare function useArrayReduce<T>(list: MaybeComputedRef
|
|
719
|
+
declare function useArrayReduce<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
|
|
712
720
|
/**
|
|
713
721
|
* Reactive `Array.reduce`
|
|
714
722
|
*
|
|
@@ -719,7 +727,7 @@ declare function useArrayReduce<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T
|
|
|
719
727
|
*
|
|
720
728
|
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
721
729
|
*/
|
|
722
|
-
declare function useArrayReduce<T, U>(list: MaybeComputedRef
|
|
730
|
+
declare function useArrayReduce<T, U>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeComputedRef<U>): ComputedRef<U>;
|
|
723
731
|
|
|
724
732
|
/**
|
|
725
733
|
* Reactive `Array.some`
|
|
@@ -730,7 +738,7 @@ declare function useArrayReduce<T, U>(list: MaybeComputedRef$1<MaybeComputedRef$
|
|
|
730
738
|
*
|
|
731
739
|
* @returns {boolean} **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
|
|
732
740
|
*/
|
|
733
|
-
declare function useArraySome<T>(list: MaybeComputedRef
|
|
741
|
+
declare function useArraySome<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<boolean>;
|
|
734
742
|
|
|
735
743
|
interface UseCounterOptions {
|
|
736
744
|
min?: number;
|
|
@@ -771,7 +779,7 @@ declare const normalizeDate: (date: DateLike) => Date;
|
|
|
771
779
|
* @param formatStr
|
|
772
780
|
* @param options
|
|
773
781
|
*/
|
|
774
|
-
declare function useDateFormat(date: MaybeComputedRef
|
|
782
|
+
declare function useDateFormat(date: MaybeComputedRef<DateLike>, formatStr?: MaybeComputedRef<string>, options?: UseDateFormatOptions): vue_demi.ComputedRef<string>;
|
|
775
783
|
declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
776
784
|
|
|
777
785
|
/**
|
|
@@ -784,7 +792,7 @@ declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
|
784
792
|
*
|
|
785
793
|
* @return A new, debounce, function.
|
|
786
794
|
*/
|
|
787
|
-
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef
|
|
795
|
+
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef<number>, options?: DebounceFilterOptions): T;
|
|
788
796
|
|
|
789
797
|
interface UseIntervalOptions<Controls extends boolean> {
|
|
790
798
|
/**
|
|
@@ -794,7 +802,7 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
794
802
|
*/
|
|
795
803
|
controls?: Controls;
|
|
796
804
|
/**
|
|
797
|
-
*
|
|
805
|
+
* Execute the update immediately on calling
|
|
798
806
|
*
|
|
799
807
|
* @default true
|
|
800
808
|
*/
|
|
@@ -804,6 +812,8 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
804
812
|
* Reactive counter increases on every interval
|
|
805
813
|
*
|
|
806
814
|
* @see https://vueuse.org/useInterval
|
|
815
|
+
* @param interval
|
|
816
|
+
* @param options
|
|
807
817
|
*/
|
|
808
818
|
declare function useInterval(interval?: MaybeComputedRef<number>, options?: UseIntervalOptions<false>): Ref<number>;
|
|
809
819
|
declare function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>): {
|
|
@@ -874,9 +884,9 @@ interface UseTimeoutFnOptions {
|
|
|
874
884
|
*
|
|
875
885
|
* @param cb
|
|
876
886
|
* @param interval
|
|
877
|
-
* @param
|
|
887
|
+
* @param options
|
|
878
888
|
*/
|
|
879
|
-
declare function useTimeoutFn(cb: (...args: unknown[]) => any, interval: MaybeComputedRef
|
|
889
|
+
declare function useTimeoutFn(cb: (...args: unknown[]) => any, interval: MaybeComputedRef<number>, options?: UseTimeoutFnOptions): Stoppable;
|
|
880
890
|
|
|
881
891
|
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
882
892
|
/**
|
|
@@ -891,13 +901,44 @@ interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOption
|
|
|
891
901
|
*
|
|
892
902
|
* @see {@link https://vueuse.org/useTimeout}
|
|
893
903
|
* @param interval
|
|
894
|
-
* @param
|
|
904
|
+
* @param options
|
|
895
905
|
*/
|
|
896
906
|
declare function useTimeout(interval?: number, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
|
|
897
907
|
declare function useTimeout(interval: number, options: UseTimeoutOptions<true>): {
|
|
898
908
|
ready: ComputedRef<boolean>;
|
|
899
909
|
} & Stoppable;
|
|
900
910
|
|
|
911
|
+
interface UseToNumberOptions {
|
|
912
|
+
/**
|
|
913
|
+
* Method to use to convert the value to a number.
|
|
914
|
+
*
|
|
915
|
+
* @default 'parseFloat'
|
|
916
|
+
*/
|
|
917
|
+
method?: 'parseFloat' | 'parseInt';
|
|
918
|
+
/**
|
|
919
|
+
* The base in mathematical numeral systems passed to `parseInt`.
|
|
920
|
+
* Only works with `method: 'parseInt'`
|
|
921
|
+
*/
|
|
922
|
+
radix?: number;
|
|
923
|
+
/**
|
|
924
|
+
* Replace NaN with zero
|
|
925
|
+
*
|
|
926
|
+
* @default false
|
|
927
|
+
*/
|
|
928
|
+
nanToZero?: boolean;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Computed reactive object.
|
|
932
|
+
*/
|
|
933
|
+
declare function useToNumber(value: MaybeComputedRef<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Reactively convert a ref to string.
|
|
937
|
+
*
|
|
938
|
+
* @see https://vueuse.org/useToString
|
|
939
|
+
*/
|
|
940
|
+
declare function useToString(value: MaybeComputedRef<unknown>): ComputedRef<string>;
|
|
941
|
+
|
|
901
942
|
interface UseToggleOptions<Truthy, Falsy> {
|
|
902
943
|
truthyValue?: MaybeComputedRef<Truthy>;
|
|
903
944
|
falsyValue?: MaybeComputedRef<Falsy>;
|
|
@@ -982,4 +1023,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
|
|
|
982
1023
|
*/
|
|
983
1024
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
|
|
984
1025
|
|
|
985
|
-
export { ArgumentsType, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeRef, Pausable, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
|
1026
|
+
export { ArgumentsType, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeReadonlyRef, MaybeRef, Pausable, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToNumberOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
package/index.iife.js
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
this.VueCompositionAPI || (typeof VueCompositionAPI !== "undefined" ? VueCompositionAPI : undefined)
|
|
72
72
|
);
|
|
73
73
|
;
|
|
74
|
-
;(function (exports, vueDemi
|
|
74
|
+
;(function (exports, vueDemi) {
|
|
75
75
|
'use strict';
|
|
76
76
|
|
|
77
77
|
var __defProp$9 = Object.defineProperty;
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
130
130
|
};
|
|
131
131
|
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
132
|
+
const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
|
|
132
133
|
|
|
133
134
|
function resolveUnref(r) {
|
|
134
135
|
return typeof r === "function" ? r() : vueDemi.unref(r);
|
|
@@ -550,7 +551,7 @@
|
|
|
550
551
|
const resetAfter = () => setTimeout(() => {
|
|
551
552
|
value = defaultValue;
|
|
552
553
|
trigger();
|
|
553
|
-
},
|
|
554
|
+
}, resolveUnref(afterMs));
|
|
554
555
|
tryOnScopeDispose(() => {
|
|
555
556
|
clearTimeout(timer);
|
|
556
557
|
});
|
|
@@ -894,39 +895,39 @@
|
|
|
894
895
|
}
|
|
895
896
|
|
|
896
897
|
function useArrayEvery(list, fn) {
|
|
897
|
-
return vueDemi.computed(() =>
|
|
898
|
+
return vueDemi.computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
898
899
|
}
|
|
899
900
|
|
|
900
901
|
function useArrayFilter(list, fn) {
|
|
901
|
-
return vueDemi.computed(() =>
|
|
902
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).filter(fn));
|
|
902
903
|
}
|
|
903
904
|
|
|
904
905
|
function useArrayFind(list, fn) {
|
|
905
|
-
return vueDemi.computed(() =>
|
|
906
|
+
return vueDemi.computed(() => resolveUnref(resolveUnref(list).find((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
906
907
|
}
|
|
907
908
|
|
|
908
909
|
function useArrayFindIndex(list, fn) {
|
|
909
|
-
return vueDemi.computed(() =>
|
|
910
|
+
return vueDemi.computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
910
911
|
}
|
|
911
912
|
|
|
912
913
|
function useArrayJoin(list, separator) {
|
|
913
|
-
return vueDemi.computed(() =>
|
|
914
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
914
915
|
}
|
|
915
916
|
|
|
916
917
|
function useArrayMap(list, fn) {
|
|
917
|
-
return vueDemi.computed(() =>
|
|
918
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).map(fn));
|
|
918
919
|
}
|
|
919
920
|
|
|
920
921
|
function useArrayReduce(list, reducer, ...args) {
|
|
921
|
-
const reduceCallback = (sum, value, index) => reducer(
|
|
922
|
+
const reduceCallback = (sum, value, index) => reducer(resolveUnref(sum), resolveUnref(value), index);
|
|
922
923
|
return vueDemi.computed(() => {
|
|
923
|
-
const resolved =
|
|
924
|
-
return args.length ? resolved.reduce(reduceCallback,
|
|
924
|
+
const resolved = resolveUnref(list);
|
|
925
|
+
return args.length ? resolved.reduce(reduceCallback, resolveUnref(args[0])) : resolved.reduce(reduceCallback);
|
|
925
926
|
});
|
|
926
927
|
}
|
|
927
928
|
|
|
928
929
|
function useArraySome(list, fn) {
|
|
929
|
-
return vueDemi.computed(() =>
|
|
930
|
+
return vueDemi.computed(() => resolveUnref(list).some((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
930
931
|
}
|
|
931
932
|
|
|
932
933
|
function useCounter(initialValue = 0, options = {}) {
|
|
@@ -998,7 +999,7 @@
|
|
|
998
999
|
return new Date(date);
|
|
999
1000
|
};
|
|
1000
1001
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
1001
|
-
return vueDemi.computed(() => formatDate(normalizeDate(
|
|
1002
|
+
return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
|
|
1002
1003
|
}
|
|
1003
1004
|
|
|
1004
1005
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1106,7 +1107,7 @@
|
|
|
1106
1107
|
isPending.value = false;
|
|
1107
1108
|
timer = null;
|
|
1108
1109
|
cb(...args);
|
|
1109
|
-
},
|
|
1110
|
+
}, resolveUnref(interval));
|
|
1110
1111
|
}
|
|
1111
1112
|
if (immediate) {
|
|
1112
1113
|
isPending.value = true;
|
|
@@ -1152,6 +1153,26 @@
|
|
|
1152
1153
|
}
|
|
1153
1154
|
}
|
|
1154
1155
|
|
|
1156
|
+
function useToNumber(value, options = {}) {
|
|
1157
|
+
const {
|
|
1158
|
+
method = "parseFloat",
|
|
1159
|
+
radix,
|
|
1160
|
+
nanToZero
|
|
1161
|
+
} = options;
|
|
1162
|
+
return vueDemi.computed(() => {
|
|
1163
|
+
let resolved = resolveUnref(value);
|
|
1164
|
+
if (typeof resolved === "string")
|
|
1165
|
+
resolved = Number[method](resolved, radix);
|
|
1166
|
+
if (nanToZero && isNaN(resolved))
|
|
1167
|
+
resolved = 0;
|
|
1168
|
+
return resolved;
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
function useToString(value) {
|
|
1173
|
+
return vueDemi.computed(() => `${resolveUnref(value)}`);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1155
1176
|
function useToggle(initialValue = false, options = {}) {
|
|
1156
1177
|
const {
|
|
1157
1178
|
truthyValue = true,
|
|
@@ -1574,6 +1595,7 @@
|
|
|
1574
1595
|
exports.extendRef = extendRef;
|
|
1575
1596
|
exports.formatDate = formatDate;
|
|
1576
1597
|
exports.get = get;
|
|
1598
|
+
exports.hasOwn = hasOwn;
|
|
1577
1599
|
exports.identity = identity;
|
|
1578
1600
|
exports.ignorableWatch = watchIgnorable;
|
|
1579
1601
|
exports.increaseWithUnit = increaseWithUnit;
|
|
@@ -1643,6 +1665,8 @@
|
|
|
1643
1665
|
exports.useThrottleFn = useThrottleFn;
|
|
1644
1666
|
exports.useTimeout = useTimeout;
|
|
1645
1667
|
exports.useTimeoutFn = useTimeoutFn;
|
|
1668
|
+
exports.useToNumber = useToNumber;
|
|
1669
|
+
exports.useToString = useToString;
|
|
1646
1670
|
exports.useToggle = useToggle;
|
|
1647
1671
|
exports.watchArray = watchArray;
|
|
1648
1672
|
exports.watchAtMost = watchAtMost;
|
|
@@ -1657,4 +1681,4 @@
|
|
|
1657
1681
|
|
|
1658
1682
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1659
1683
|
|
|
1660
|
-
})(this.VueUse = this.VueUse || {}, VueDemi
|
|
1684
|
+
})(this.VueUse = this.VueUse || {}, VueDemi);
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(o,i,y){if(o.install)return o;if(i)if(i.version.slice(0,4)==="2.7."){for(var g in i)o[g]=i[g];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else if(i.version.slice(0,2)==="2.")if(y){for(var g in y)o[g]=y[g];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(i.version.slice(0,2)==="3."){for(var g in i)o[g]=i[g];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=i,o.Vue2=void 0,o.version=i.version,o.set=function(h,m,b){return Array.isArray(h)?(h.length=Math.max(h.length,m),h.splice(m,1,b),b):(h[m]=b,b)},o.del=function(h,m){if(Array.isArray(h)){h.splice(m,1);return}delete h[m]}}else console.error("[vue-demi] Vue version "+i.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return o}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(o,i,y){"use strict";var g=Object.defineProperty,h=Object.defineProperties,m=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,Ye=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,J=(e,t,r)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ke=(e,t)=>{for(var r in t||(t={}))Ye.call(t,r)&&J(e,r,t[r]);if(b)for(var r of b(t))Ge.call(t,r)&&J(e,r,t[r]);return e},ze=(e,t)=>h(e,m(t));function X(e,t){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=e()},ze(ke({},t),{flush:(r=t==null?void 0:t.flush)!=null?r:"sync"})),i.readonly(n)}var Z;const I=typeof window!="undefined",Ve=e=>typeof e!="undefined",Je=(e,...t)=>{e||console.warn(...t)},q=Object.prototype.toString,Xe=e=>typeof e=="boolean",W=e=>typeof e=="function",Ze=e=>typeof e=="number",qe=e=>typeof e=="string",Ke=e=>q.call(e)==="[object Object]",Qe=e=>typeof window!="undefined"&&q.call(e)==="[object Window]",De=()=>Date.now(),K=()=>+Date.now(),xe=(e,t,r)=>Math.min(r,Math.max(t,e)),Q=()=>{},et=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),tt=I&&((Z=window==null?void 0:window.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function w(e){return typeof e=="function"?e():i.unref(e)}function F(e,t){function r(...n){e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})}return r}const T=e=>e();function B(e,t={}){let r,n;return l=>{const u=w(e),c=w(t.maxWait);if(r&&clearTimeout(r),u<=0||c!==void 0&&c<=0)return n&&(clearTimeout(n),n=null),l();c&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,l()},c)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,l()},u)}}function H(e,t=!0,r=!0){let n=0,a,l=!0;const u=()=>{a&&(clearTimeout(a),a=void 0)};return p=>{const v=w(e),f=Date.now()-n;if(u(),v<=0)return n=Date.now(),p();f>v&&(r||!l)?(n=Date.now(),p()):t&&(a=setTimeout(()=>{n=Date.now(),l=!0,u(),p()},v)),!r&&!a&&(a=setTimeout(()=>l=!0,v)),l=!1}}function D(e=T){const t=i.ref(!0);function r(){t.value=!1}function n(){t.value=!0}return{isActive:t,pause:r,resume:n,eventFilter:(...l)=>{t.value&&e(...l)}}}function x(e="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${e} is only works on Vue 3.`)}const rt={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function L(e,t=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(t?()=>a(r):n,e)})}function nt(e){return e}function ot(e){let t;function r(){return t||(t=e()),t}return r.reset=async()=>{const n=t;t=void 0,n&&await n},r}function at(e){return e()}function it(e,...t){return t.some(r=>r in e)}function lt(e,t){var r;if(typeof e=="number")return e+t;const n=((r=e.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:r[0])||"",a=e.slice(n.length),l=parseFloat(n)+t;return Number.isNaN(l)?e:l+a}function ut(e,t,r=!1){return t.reduce((n,a)=>(a in e&&(!r||e[a]!==void 0)&&(n[a]=e[a]),n),{})}function ee(e,t){let r,n,a;const l=i.ref(!0),u=()=>{l.value=!0,a()};i.watch(e,u,{flush:"sync"});const c=W(t)?t:t.get,p=W(t)?void 0:t.set,v=i.customRef((f,s)=>(n=f,a=s,{get(){return l.value&&(r=c(),l.value=!1),n(),r},set(d){p==null||p(d)}}));return Object.isExtensible(v)&&(v.trigger=u),v}function ct(){const e=[],t=a=>{const l=e.indexOf(a);l!==-1&&e.splice(l,1)};return{on:a=>(e.push(a),{off:()=>t(a)}),off:t,trigger:a=>{e.forEach(l=>l(a))}}}function st(e){let t=!1,r;const n=i.effectScope(!0);return()=>(t||(r=n.run(e),t=!0),r)}function ft(e){const t=Symbol("InjectionState");return[(...a)=>{i.provide(t,e(...a))},()=>i.inject(t)]}function S(e){return i.getCurrentScope()?(i.onScopeDispose(e),!0):!1}function dt(e){let t=0,r,n;const a=()=>{t-=1,n&&t<=0&&(n.stop(),r=void 0,n=void 0)};return(...l)=>(t+=1,r||(n=i.effectScope(!0),r=n.run(()=>e(...l))),S(a),r)}function te(e,t,{enumerable:r=!1,unwrap:n=!0}={}){x();for(const[a,l]of Object.entries(t))a!=="value"&&(i.isRef(l)&&n?Object.defineProperty(e,a,{get(){return l.value},set(u){l.value=u},enumerable:r}):Object.defineProperty(e,a,{value:l,enumerable:r}));return e}function pt(e,t){return t==null?i.unref(e):i.unref(e)[t]}function vt(e){return i.unref(e)!=null}var yt=Object.defineProperty,re=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,ne=(e,t,r)=>t in e?yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wt=(e,t)=>{for(var r in t||(t={}))_t.call(t,r)&&ne(e,r,t[r]);if(re)for(var r of re(t))Ot.call(t,r)&&ne(e,r,t[r]);return e};function ht(e,t){if(typeof Symbol!="undefined"){const r=wt({},e);return Object.defineProperty(r,Symbol.iterator,{enumerable:!1,value(){let n=0;return{next:()=>({value:t[n++],done:n>t.length})}}}),r}else return Object.assign([...t],e)}function Y(e,t){const r=(t==null?void 0:t.computedGetter)===!1?i.unref:w;return function(...n){return i.computed(()=>e.apply(this,n.map(a=>r(a))))}}function gt(e,t={}){let r=[],n;if(Array.isArray(t))r=t;else{n=t;const{includeOwnProperties:a=!0}=t;r.push(...Object.keys(e)),a&&r.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(r.map(a=>{const l=e[a];return[a,typeof l=="function"?Y(l.bind(e),n):l]}))}function oe(e){if(!i.isRef(e))return i.reactive(e);const t=new Proxy({},{get(r,n,a){return i.unref(Reflect.get(e.value,n,a))},set(r,n,a){return i.isRef(e.value[n])&&!i.isRef(a)?e.value[n].value=a:e.value[n]=a,!0},deleteProperty(r,n){return Reflect.deleteProperty(e.value,n)},has(r,n){return Reflect.has(e.value,n)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return i.reactive(t)}function ae(e){return oe(i.computed(e))}function Pt(e,...t){const r=t.flat();return ae(()=>Object.fromEntries(Object.entries(i.toRefs(e)).filter(n=>!r.includes(n[0]))))}function mt(e,...t){const r=t.flat();return i.reactive(Object.fromEntries(r.map(n=>[n,i.toRef(e,n)])))}function ie(e,t=1e4){return i.customRef((r,n)=>{let a=e,l;const u=()=>setTimeout(()=>{a=e,n()},y.resolveUnref(t));return S(()=>{clearTimeout(l)}),{get(){return r(),a},set(c){a=c,n(),clearTimeout(l),l=u()}}})}function le(e,t=200,r={}){return F(B(t,r),e)}function G(e,t=200,r={}){if(t<=0)return e;const n=i.ref(e.value),a=le(()=>{n.value=e.value},t,r);return i.watch(e,()=>a()),n}function bt(e,t){return i.computed({get(){var r;return(r=e.value)!=null?r:t},set(r){e.value=r}})}function ue(e,t=200,r=!1,n=!0){return F(H(t,r,n),e)}function k(e,t=200,r=!0,n=!0){if(t<=0)return e;const a=i.ref(e.value),l=ue(()=>{a.value=e.value},t,r,n);return i.watch(e,()=>l()),a}function ce(e,t={}){let r=e,n,a;const l=i.customRef((d,O)=>(n=d,a=O,{get(){return u()},set(_){c(_)}}));function u(d=!0){return d&&n(),r}function c(d,O=!0){var _,$;if(d===r)return;const P=r;((_=t.onBeforeChange)==null?void 0:_.call(t,d,P))!==!1&&(r=d,($=t.onChanged)==null||$.call(t,d,P),O&&a())}return te(l,{get:u,set:c,untrackedGet:()=>u(!1),silentSet:d=>c(d,!1),peek:()=>u(!1),lay:d=>c(d,!1)},{enumerable:!0})}const $t=ce;function St(e){return typeof e=="function"?i.computed(e):i.ref(e)}function At(...e){if(e.length===2){const[t,r]=e;t.value=r}if(e.length===3)if(i.isVue2)i.set(...e);else{const[t,r,n]=e;t[r]=n}}function jt(e,t,r={}){var n,a;const{flush:l="sync",deep:u=!1,immediate:c=!0,direction:p="both",transform:v={}}=r;let f,s;const d=(n=v.ltr)!=null?n:_=>_,O=(a=v.rtl)!=null?a:_=>_;return(p==="both"||p==="ltr")&&(f=i.watch(e,_=>t.value=d(_),{flush:l,deep:u,immediate:c})),(p==="both"||p==="rtl")&&(s=i.watch(t,_=>e.value=O(_),{flush:l,deep:u,immediate:c})),()=>{f==null||f(),s==null||s()}}function It(e,t,r={}){const{flush:n="sync",deep:a=!1,immediate:l=!0}=r;return Array.isArray(t)||(t=[t]),i.watch(e,u=>t.forEach(c=>c.value=u),{flush:n,deep:a,immediate:l})}var Ft=Object.defineProperty,Et=Object.defineProperties,Tt=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertySymbols,Ut=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,fe=(e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ct=(e,t)=>{for(var r in t||(t={}))Ut.call(t,r)&&fe(e,r,t[r]);if(se)for(var r of se(t))Rt.call(t,r)&&fe(e,r,t[r]);return e},Mt=(e,t)=>Et(e,Tt(t));function Nt(e){if(!i.isRef(e))return i.toRefs(e);const t=Array.isArray(e.value)?new Array(e.value.length):{};for(const r in e.value)t[r]=i.customRef(()=>({get(){return e.value[r]},set(n){if(Array.isArray(e.value)){const a=[...e.value];a[r]=n,e.value=a}else{const a=Mt(Ct({},e.value),{[r]:n});Object.setPrototypeOf(a,e.value),e.value=a}}}));return t}function Wt(e,t=!0){i.getCurrentInstance()?i.onBeforeMount(e):t?e():i.nextTick(e)}function Bt(e){i.getCurrentInstance()&&i.onBeforeUnmount(e)}function Ht(e,t=!0){i.getCurrentInstance()?i.onMounted(e):t?e():i.nextTick(e)}function Lt(e){i.getCurrentInstance()&&i.onUnmounted(e)}function Yt(e){let t=!1;function r(s,{flush:d="sync",deep:O=!1,timeout:_,throwOnTimeout:$}={}){let P=null;const V=[new Promise(N=>{P=i.watch(e,j=>{s(j)!==t&&(P==null||P(),N(j))},{flush:d,deep:O,immediate:!0})})];return _!=null&&V.push(L(_,$).then(()=>w(e)).finally(()=>P==null?void 0:P())),Promise.race(V)}function n(s,d){if(!i.isRef(s))return r(j=>j===s,d);const{flush:O="sync",deep:_=!1,timeout:$,throwOnTimeout:P}=d??{};let A=null;const N=[new Promise(j=>{A=i.watch([e,s],([Le,rn])=>{t!==(Le===rn)&&(A==null||A(),j(Le))},{flush:O,deep:_,immediate:!0})})];return $!=null&&N.push(L($,P).then(()=>w(e)).finally(()=>(A==null||A(),w(e)))),Promise.race(N)}function a(s){return r(d=>Boolean(d),s)}function l(s){return n(null,s)}function u(s){return n(void 0,s)}function c(s){return r(Number.isNaN,s)}function p(s,d){return r(O=>{const _=Array.from(O);return _.includes(s)||_.includes(w(s))},d)}function v(s){return f(1,s)}function f(s=1,d){let O=-1;return r(()=>(O+=1,O>=s),d)}return Array.isArray(w(e))?{toMatch:r,toContains:p,changed:v,changedTimes:f,get not(){return t=!t,this}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:l,toBeNaN:c,toBeUndefined:u,changed:v,changedTimes:f,get not(){return t=!t,this}}}function Gt(e,t){return i.computed(()=>y.resolveUnref(e).every((r,n,a)=>t(y.resolveUnref(r),n,a)))}function kt(e,t){return i.computed(()=>y.resolveUnref(e).map(r=>y.resolveUnref(r)).filter(t))}function zt(e,t){return i.computed(()=>y.resolveUnref(y.resolveUnref(e).find((r,n,a)=>t(y.resolveUnref(r),n,a))))}function Vt(e,t){return i.computed(()=>y.resolveUnref(e).findIndex((r,n,a)=>t(y.resolveUnref(r),n,a)))}function Jt(e,t){return i.computed(()=>y.resolveUnref(e).map(r=>y.resolveUnref(r)).join(y.resolveUnref(t)))}function Xt(e,t){return i.computed(()=>y.resolveUnref(e).map(r=>y.resolveUnref(r)).map(t))}function Zt(e,t,...r){const n=(a,l,u)=>t(y.resolveUnref(a),y.resolveUnref(l),u);return i.computed(()=>{const a=y.resolveUnref(e);return r.length?a.reduce(n,y.resolveUnref(r[0])):a.reduce(n)})}function qt(e,t){return i.computed(()=>y.resolveUnref(e).some((r,n,a)=>t(y.resolveUnref(r),n,a)))}function Kt(e=0,t={}){const r=i.ref(e),{max:n=1/0,min:a=-1/0}=t,l=(f=1)=>r.value=Math.min(n,r.value+f),u=(f=1)=>r.value=Math.max(a,r.value-f),c=()=>r.value,p=f=>r.value=f;return{count:r,inc:l,dec:u,get:c,set:p,reset:(f=e)=>(e=f,p(f))}}const Qt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Dt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,de=(e,t,r)=>{const n=e.getFullYear(),a=e.getMonth(),l=e.getDate(),u=e.getHours(),c=e.getMinutes(),p=e.getSeconds(),v=e.getMilliseconds(),f=e.getDay(),s={YY:()=>String(n).slice(-2),YYYY:()=>n,M:()=>a+1,MM:()=>`${a+1}`.padStart(2,"0"),D:()=>String(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(c),mm:()=>`${c}`.padStart(2,"0"),s:()=>String(p),ss:()=>`${p}`.padStart(2,"0"),SSS:()=>`${v}`.padStart(3,"0"),d:()=>f,dd:()=>e.toLocaleDateString(r,{weekday:"narrow"}),ddd:()=>e.toLocaleDateString(r,{weekday:"short"}),dddd:()=>e.toLocaleDateString(r,{weekday:"long"})};return t.replace(Dt,(d,O)=>O||s[d]())},pe=e=>{if(e===null)return new Date(NaN);if(e===void 0)return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){const t=e.match(Qt);if(t){const r=t[2]-1||0,n=(t[7]||"0").substring(0,3);return new Date(t[1],r,t[3]||1,t[4]||0,t[5]||0,t[6]||0,n)}}return new Date(e)};function xt(e,t="HH:mm:ss",r={}){return i.computed(()=>de(pe(y.resolveUnref(e)),y.resolveUnref(t),r==null?void 0:r.locales))}function ve(e,t=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let l=null;const u=i.ref(!1);function c(){l&&(clearInterval(l),l=null)}function p(){u.value=!1,c()}function v(){i.unref(t)<=0||(u.value=!0,a&&e(),c(),l=setInterval(e,w(t)))}if(n&&I&&v(),i.isRef(t)){const f=i.watch(t,()=>{u.value&&I&&v()});S(f)}return S(p),{isActive:u,pause:p,resume:v}}var er=Object.defineProperty,ye=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,_e=(e,t,r)=>t in e?er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nr=(e,t)=>{for(var r in t||(t={}))tr.call(t,r)&&_e(e,r,t[r]);if(ye)for(var r of ye(t))rr.call(t,r)&&_e(e,r,t[r]);return e};function or(e=1e3,t={}){const{controls:r=!1,immediate:n=!0}=t,a=i.ref(0),l=ve(()=>a.value+=1,e,{immediate:n});return r?nr({counter:a},l):a}function ar(e,t={}){var r;const n=i.ref((r=t.initialValue)!=null?r:null);return i.watch(e,()=>n.value=K(),t),n}function Oe(e,t,r={}){const{immediate:n=!0}=r,a=i.ref(!1);let l=null;function u(){l&&(clearTimeout(l),l=null)}function c(){a.value=!1,u()}function p(...v){u(),a.value=!0,l=setTimeout(()=>{a.value=!1,l=null,e(...v)},y.resolveUnref(t))}return n&&(a.value=!0,I&&p()),S(c),{isPending:a,start:p,stop:c}}var ir=Object.defineProperty,we=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,ur=Object.prototype.propertyIsEnumerable,he=(e,t,r)=>t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cr=(e,t)=>{for(var r in t||(t={}))lr.call(t,r)&&he(e,r,t[r]);if(we)for(var r of we(t))ur.call(t,r)&&he(e,r,t[r]);return e};function sr(e=1e3,t={}){const{controls:r=!1}=t,n=Oe(Q,e,t),a=i.computed(()=>!n.isPending.value);return r?cr({ready:a},n):a}function fr(e=!1,t={}){const{truthyValue:r=!0,falsyValue:n=!1}=t,a=i.isRef(e),l=i.ref(e);function u(c){if(arguments.length)return l.value=c,l.value;{const p=w(r);return l.value=l.value===p?w(n):p,l.value}}return a?u:[l,u]}function dr(e,t,r){let n=(r==null?void 0:r.immediate)?[]:[...e instanceof Function?e():Array.isArray(e)?e:i.unref(e)];return i.watch(e,(a,l,u)=>{const c=new Array(n.length),p=[];for(const f of a){let s=!1;for(let d=0;d<n.length;d++)if(!c[d]&&f===n[d]){c[d]=!0,s=!0;break}s||p.push(f)}const v=n.filter((f,s)=>!c[s]);t(a,n,p,v,u),n=[...a]},r)}var ge=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,vr=Object.prototype.propertyIsEnumerable,yr=(e,t)=>{var r={};for(var n in e)pr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ge)for(var n of ge(e))t.indexOf(n)<0&&vr.call(e,n)&&(r[n]=e[n]);return r};function E(e,t,r={}){const n=r,{eventFilter:a=T}=n,l=yr(n,["eventFilter"]);return i.watch(e,F(a,t),l)}var Pe=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,wr=(e,t)=>{var r={};for(var n in e)_r.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pe)for(var n of Pe(e))t.indexOf(n)<0&&Or.call(e,n)&&(r[n]=e[n]);return r};function hr(e,t,r){const n=r,{count:a}=n,l=wr(n,["count"]),u=i.ref(0),c=E(e,(...p)=>{u.value+=1,u.value>=w(a)&&i.nextTick(()=>c()),t(...p)},l);return{count:u,stop:c}}var gr=Object.defineProperty,Pr=Object.defineProperties,mr=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,$e=(e,t,r)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,br=(e,t)=>{for(var r in t||(t={}))me.call(t,r)&&$e(e,r,t[r]);if(U)for(var r of U(t))be.call(t,r)&&$e(e,r,t[r]);return e},$r=(e,t)=>Pr(e,mr(t)),Sr=(e,t)=>{var r={};for(var n in e)me.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&U)for(var n of U(e))t.indexOf(n)<0&&be.call(e,n)&&(r[n]=e[n]);return r};function Se(e,t,r={}){const n=r,{debounce:a=0,maxWait:l=void 0}=n,u=Sr(n,["debounce","maxWait"]);return E(e,t,$r(br({},u),{eventFilter:B(a,{maxWait:l})}))}var Ar=Object.defineProperty,jr=Object.defineProperties,Ir=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,Ie=(e,t,r)=>t in e?Ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fr=(e,t)=>{for(var r in t||(t={}))Ae.call(t,r)&&Ie(e,r,t[r]);if(R)for(var r of R(t))je.call(t,r)&&Ie(e,r,t[r]);return e},Er=(e,t)=>jr(e,Ir(t)),Tr=(e,t)=>{var r={};for(var n in e)Ae.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&R)for(var n of R(e))t.indexOf(n)<0&&je.call(e,n)&&(r[n]=e[n]);return r};function z(e,t,r={}){const n=r,{eventFilter:a=T}=n,l=Tr(n,["eventFilter"]),u=F(a,t);let c,p,v;if(l.flush==="sync"){const f=i.ref(!1);p=()=>{},c=s=>{f.value=!0,s(),f.value=!1},v=i.watch(e,(...s)=>{f.value||u(...s)},l)}else{const f=[],s=i.ref(0),d=i.ref(0);p=()=>{s.value=d.value},f.push(i.watch(e,()=>{d.value++},Er(Fr({},l),{flush:"sync"}))),c=O=>{const _=d.value;O(),s.value+=d.value-_},f.push(i.watch(e,(...O)=>{const _=s.value>0&&s.value===d.value;s.value=0,d.value=0,!_&&u(...O)},l)),v=()=>{f.forEach(O=>O())}}return{stop:v,ignoreUpdates:c,ignorePrevAsyncUpdates:p}}function Ur(e,t,r){const n=i.watch(e,(...a)=>(i.nextTick(()=>n()),t(...a)),r)}var Rr=Object.defineProperty,Cr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Te=(e,t,r)=>t in e?Rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Nr=(e,t)=>{for(var r in t||(t={}))Fe.call(t,r)&&Te(e,r,t[r]);if(C)for(var r of C(t))Ee.call(t,r)&&Te(e,r,t[r]);return e},Wr=(e,t)=>Cr(e,Mr(t)),Br=(e,t)=>{var r={};for(var n in e)Fe.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&C)for(var n of C(e))t.indexOf(n)<0&&Ee.call(e,n)&&(r[n]=e[n]);return r};function Ue(e,t,r={}){const n=r,{eventFilter:a}=n,l=Br(n,["eventFilter"]),{eventFilter:u,pause:c,resume:p,isActive:v}=D(a);return{stop:E(e,t,Wr(Nr({},l),{eventFilter:u})),pause:c,resume:p,isActive:v}}var Hr=Object.defineProperty,Lr=Object.defineProperties,Yr=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,Me=(e,t,r)=>t in e?Hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Gr=(e,t)=>{for(var r in t||(t={}))Re.call(t,r)&&Me(e,r,t[r]);if(M)for(var r of M(t))Ce.call(t,r)&&Me(e,r,t[r]);return e},kr=(e,t)=>Lr(e,Yr(t)),zr=(e,t)=>{var r={};for(var n in e)Re.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&M)for(var n of M(e))t.indexOf(n)<0&&Ce.call(e,n)&&(r[n]=e[n]);return r};function Ne(e,t,r={}){const n=r,{throttle:a=0,trailing:l=!0,leading:u=!0}=n,c=zr(n,["throttle","trailing","leading"]);return E(e,t,kr(Gr({},c),{eventFilter:H(a,l,u)}))}var Vr=Object.defineProperty,Jr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,qr=Object.prototype.propertyIsEnumerable,Be=(e,t,r)=>t in e?Vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Kr=(e,t)=>{for(var r in t||(t={}))Zr.call(t,r)&&Be(e,r,t[r]);if(We)for(var r of We(t))qr.call(t,r)&&Be(e,r,t[r]);return e},Qr=(e,t)=>Jr(e,Xr(t));function Dr(e,t,r={}){let n;function a(){if(!n)return;const f=n;n=void 0,f()}function l(f){n=f}const u=(f,s)=>(a(),t(f,s,l)),c=z(e,u,r),{ignoreUpdates:p}=c,v=()=>{let f;return p(()=>{f=u(xr(e),en(e))}),f};return Qr(Kr({},c),{trigger:v})}function xr(e){return i.isReactive(e)?e:Array.isArray(e)?e.map(t=>He(t)):He(e)}function He(e){return typeof e=="function"?e():i.unref(e)}function en(e){return Array.isArray(e)?e.map(()=>{}):void 0}function tn(e,t,r){return i.watch(e,(n,a,l)=>{n&&t(n,a,l)},r)}o.__onlyVue3=x,o.assert=Je,o.autoResetRef=ie,o.bypassFilter=T,o.clamp=xe,o.computedEager=X,o.computedWithControl=ee,o.containsProp=it,o.controlledComputed=ee,o.controlledRef=$t,o.createEventHook=ct,o.createFilterWrapper=F,o.createGlobalState=st,o.createInjectionState=ft,o.createReactiveFn=Y,o.createSharedComposable=dt,o.createSingletonPromise=ot,o.debounceFilter=B,o.debouncedRef=G,o.debouncedWatch=Se,o.directiveHooks=rt,o.eagerComputed=X,o.extendRef=te,o.formatDate=de,o.get=pt,o.identity=nt,o.ignorableWatch=z,o.increaseWithUnit=lt,o.invoke=at,o.isBoolean=Xe,o.isClient=I,o.isDef=Ve,o.isDefined=vt,o.isFunction=W,o.isIOS=tt,o.isNumber=Ze,o.isObject=Ke,o.isString=qe,o.isWindow=Qe,o.makeDestructurable=ht,o.noop=Q,o.normalizeDate=pe,o.now=De,o.objectPick=ut,o.pausableFilter=D,o.pausableWatch=Ue,o.promiseTimeout=L,o.rand=et,o.reactify=Y,o.reactifyObject=gt,o.reactiveComputed=ae,o.reactiveOmit=Pt,o.reactivePick=mt,o.refAutoReset=ie,o.refDebounced=G,o.refDefault=bt,o.refThrottled=k,o.refWithControl=ce,o.resolveRef=St,o.resolveUnref=w,o.set=At,o.syncRef=jt,o.syncRefs=It,o.throttleFilter=H,o.throttledRef=k,o.throttledWatch=Ne,o.timestamp=K,o.toReactive=oe,o.toRefs=Nt,o.tryOnBeforeMount=Wt,o.tryOnBeforeUnmount=Bt,o.tryOnMounted=Ht,o.tryOnScopeDispose=S,o.tryOnUnmounted=Lt,o.until=Yt,o.useArrayEvery=Gt,o.useArrayFilter=kt,o.useArrayFind=zt,o.useArrayFindIndex=Vt,o.useArrayJoin=Jt,o.useArrayMap=Xt,o.useArrayReduce=Zt,o.useArraySome=qt,o.useCounter=Kt,o.useDateFormat=xt,o.useDebounce=G,o.useDebounceFn=le,o.useInterval=or,o.useIntervalFn=ve,o.useLastChanged=ar,o.useThrottle=k,o.useThrottleFn=ue,o.useTimeout=sr,o.useTimeoutFn=Oe,o.useToggle=fr,o.watchArray=dr,o.watchAtMost=hr,o.watchDebounced=Se,o.watchIgnorable=z,o.watchOnce=Ur,o.watchPausable=Ue,o.watchThrottled=Ne,o.watchTriggerable=Dr,o.watchWithFilter=E,o.whenever=tn,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi,VueUse);
|
|
1
|
+
var VueDemi=function(o,i,j){if(o.install)return o;if(i)if(i.version.slice(0,4)==="2.7."){for(var w in i)o[w]=i[w];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else if(i.version.slice(0,2)==="2.")if(j){for(var w in j)o[w]=j[w];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(i.version.slice(0,2)==="3."){for(var w in i)o[w]=i[w];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=i,o.Vue2=void 0,o.version=i.version,o.set=function(O,P,b){return Array.isArray(O)?(O.length=Math.max(O.length,P),O.splice(P,1,b),b):(O[P]=b,b)},o.del=function(O,P){if(Array.isArray(O)){O.splice(P,1);return}delete O[P]}}else console.error("[vue-demi] Vue version "+i.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return o}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(o,i){"use strict";var j=Object.defineProperty,w=Object.defineProperties,O=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,Yt=Object.prototype.propertyIsEnumerable,J=(t,e,r)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Gt=(t,e)=>{for(var r in e||(e={}))b.call(e,r)&&J(t,r,e[r]);if(P)for(var r of P(e))Yt.call(e,r)&&J(t,r,e[r]);return t},kt=(t,e)=>w(t,O(e));function V(t,e){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=t()},kt(Gt({},e),{flush:(r=e==null?void 0:e.flush)!=null?r:"sync"})),i.readonly(n)}var X;const I=typeof window!="undefined",zt=t=>typeof t!="undefined",Zt=(t,...e)=>{t||console.warn(...e)},q=Object.prototype.toString,Jt=t=>typeof t=="boolean",U=t=>typeof t=="function",Vt=t=>typeof t=="number",Xt=t=>typeof t=="string",qt=t=>q.call(t)==="[object Object]",Kt=t=>typeof window!="undefined"&&q.call(t)==="[object Window]",Qt=()=>Date.now(),K=()=>+Date.now(),Dt=(t,e,r)=>Math.min(r,Math.max(e,t)),Q=()=>{},xt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),te=I&&((X=window==null?void 0:window.navigator)==null?void 0:X.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent),ee=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function y(t){return typeof t=="function"?t():i.unref(t)}function T(t,e){function r(...n){t(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})}return r}const E=t=>t();function B(t,e={}){let r,n;return l=>{const u=y(t),c=y(e.maxWait);if(r&&clearTimeout(r),u<=0||c!==void 0&&c<=0)return n&&(clearTimeout(n),n=null),l();c&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,l()},c)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,l()},u)}}function H(t,e=!0,r=!0){let n=0,a,l=!0;const u=()=>{a&&(clearTimeout(a),a=void 0)};return p=>{const _=y(t),f=Date.now()-n;if(u(),_<=0)return n=Date.now(),p();f>_&&(r||!l)?(n=Date.now(),p()):e&&(a=setTimeout(()=>{n=Date.now(),l=!0,u(),p()},_)),!r&&!a&&(a=setTimeout(()=>l=!0,_)),l=!1}}function D(t=E){const e=i.ref(!0);function r(){e.value=!1}function n(){e.value=!0}return{isActive:e,pause:r,resume:n,eventFilter:(...l)=>{e.value&&t(...l)}}}function x(t="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}const re={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function L(t,e=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(e?()=>a(r):n,t)})}function ne(t){return t}function oe(t){let e;function r(){return e||(e=t()),e}return r.reset=async()=>{const n=e;e=void 0,n&&await n},r}function ae(t){return t()}function ie(t,...e){return e.some(r=>r in t)}function le(t,e){var r;if(typeof t=="number")return t+e;const n=((r=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:r[0])||"",a=t.slice(n.length),l=parseFloat(n)+e;return Number.isNaN(l)?t:l+a}function ue(t,e,r=!1){return e.reduce((n,a)=>(a in t&&(!r||t[a]!==void 0)&&(n[a]=t[a]),n),{})}function tt(t,e){let r,n,a;const l=i.ref(!0),u=()=>{l.value=!0,a()};i.watch(t,u,{flush:"sync"});const c=U(e)?e:e.get,p=U(e)?void 0:e.set,_=i.customRef((f,s)=>(n=f,a=s,{get(){return l.value&&(r=c(),l.value=!1),n(),r},set(d){p==null||p(d)}}));return Object.isExtensible(_)&&(_.trigger=u),_}function ce(){const t=[],e=a=>{const l=t.indexOf(a);l!==-1&&t.splice(l,1)};return{on:a=>(t.push(a),{off:()=>e(a)}),off:e,trigger:a=>{t.forEach(l=>l(a))}}}function se(t){let e=!1,r;const n=i.effectScope(!0);return()=>(e||(r=n.run(t),e=!0),r)}function fe(t){const e=Symbol("InjectionState");return[(...a)=>{i.provide(e,t(...a))},()=>i.inject(e)]}function $(t){return i.getCurrentScope()?(i.onScopeDispose(t),!0):!1}function de(t){let e=0,r,n;const a=()=>{e-=1,n&&e<=0&&(n.stop(),r=void 0,n=void 0)};return(...l)=>(e+=1,r||(n=i.effectScope(!0),r=n.run(()=>t(...l))),$(a),r)}function et(t,e,{enumerable:r=!1,unwrap:n=!0}={}){x();for(const[a,l]of Object.entries(e))a!=="value"&&(i.isRef(l)&&n?Object.defineProperty(t,a,{get(){return l.value},set(u){l.value=u},enumerable:r}):Object.defineProperty(t,a,{value:l,enumerable:r}));return t}function pe(t,e){return e==null?i.unref(t):i.unref(t)[e]}function ye(t){return i.unref(t)!=null}var _e=Object.defineProperty,rt=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,nt=(t,e,r)=>e in t?_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oe=(t,e)=>{for(var r in e||(e={}))ve.call(e,r)&&nt(t,r,e[r]);if(rt)for(var r of rt(e))he.call(e,r)&&nt(t,r,e[r]);return t};function we(t,e){if(typeof Symbol!="undefined"){const r=Oe({},t);return Object.defineProperty(r,Symbol.iterator,{enumerable:!1,value(){let n=0;return{next:()=>({value:e[n++],done:n>e.length})}}}),r}else return Object.assign([...e],t)}function Y(t,e){const r=(e==null?void 0:e.computedGetter)===!1?i.unref:y;return function(...n){return i.computed(()=>t.apply(this,n.map(a=>r(a))))}}function ge(t,e={}){let r=[],n;if(Array.isArray(e))r=e;else{n=e;const{includeOwnProperties:a=!0}=e;r.push(...Object.keys(t)),a&&r.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(r.map(a=>{const l=t[a];return[a,typeof l=="function"?Y(l.bind(t),n):l]}))}function ot(t){if(!i.isRef(t))return i.reactive(t);const e=new Proxy({},{get(r,n,a){return i.unref(Reflect.get(t.value,n,a))},set(r,n,a){return i.isRef(t.value[n])&&!i.isRef(a)?t.value[n].value=a:t.value[n]=a,!0},deleteProperty(r,n){return Reflect.deleteProperty(t.value,n)},has(r,n){return Reflect.has(t.value,n)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return i.reactive(e)}function at(t){return ot(i.computed(t))}function Pe(t,...e){const r=e.flat();return at(()=>Object.fromEntries(Object.entries(i.toRefs(t)).filter(n=>!r.includes(n[0]))))}function me(t,...e){const r=e.flat();return i.reactive(Object.fromEntries(r.map(n=>[n,i.toRef(t,n)])))}function it(t,e=1e4){return i.customRef((r,n)=>{let a=t,l;const u=()=>setTimeout(()=>{a=t,n()},y(e));return $(()=>{clearTimeout(l)}),{get(){return r(),a},set(c){a=c,n(),clearTimeout(l),l=u()}}})}function lt(t,e=200,r={}){return T(B(e,r),t)}function G(t,e=200,r={}){if(e<=0)return t;const n=i.ref(t.value),a=lt(()=>{n.value=t.value},e,r);return i.watch(t,()=>a()),n}function be(t,e){return i.computed({get(){var r;return(r=t.value)!=null?r:e},set(r){t.value=r}})}function ut(t,e=200,r=!1,n=!0){return T(H(e,r,n),t)}function k(t,e=200,r=!0,n=!0){if(e<=0)return t;const a=i.ref(t.value),l=ut(()=>{a.value=t.value},e,r,n);return i.watch(t,()=>l()),a}function ct(t,e={}){let r=t,n,a;const l=i.customRef((d,h)=>(n=d,a=h,{get(){return u()},set(v){c(v)}}));function u(d=!0){return d&&n(),r}function c(d,h=!0){var v,m;if(d===r)return;const g=r;((v=e.onBeforeChange)==null?void 0:v.call(e,d,g))!==!1&&(r=d,(m=e.onChanged)==null||m.call(e,d,g),h&&a())}return et(l,{get:u,set:c,untrackedGet:()=>u(!1),silentSet:d=>c(d,!1),peek:()=>u(!1),lay:d=>c(d,!1)},{enumerable:!0})}const $e=ct;function Se(t){return typeof t=="function"?i.computed(t):i.ref(t)}function Ae(...t){if(t.length===2){const[e,r]=t;e.value=r}if(t.length===3)if(i.isVue2)i.set(...t);else{const[e,r,n]=t;e[r]=n}}function je(t,e,r={}){var n,a;const{flush:l="sync",deep:u=!1,immediate:c=!0,direction:p="both",transform:_={}}=r;let f,s;const d=(n=_.ltr)!=null?n:v=>v,h=(a=_.rtl)!=null?a:v=>v;return(p==="both"||p==="ltr")&&(f=i.watch(t,v=>e.value=d(v),{flush:l,deep:u,immediate:c})),(p==="both"||p==="rtl")&&(s=i.watch(e,v=>t.value=h(v),{flush:l,deep:u,immediate:c})),()=>{f==null||f(),s==null||s()}}function Ie(t,e,r={}){const{flush:n="sync",deep:a=!1,immediate:l=!0}=r;return Array.isArray(e)||(e=[e]),i.watch(t,u=>e.forEach(c=>c.value=u),{flush:n,deep:a,immediate:l})}var Te=Object.defineProperty,Fe=Object.defineProperties,Ee=Object.getOwnPropertyDescriptors,st=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,ft=(t,e,r)=>e in t?Te(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ne=(t,e)=>{for(var r in e||(e={}))Re.call(e,r)&&ft(t,r,e[r]);if(st)for(var r of st(e))Ce.call(e,r)&&ft(t,r,e[r]);return t},Me=(t,e)=>Fe(t,Ee(e));function We(t){if(!i.isRef(t))return i.toRefs(t);const e=Array.isArray(t.value)?new Array(t.value.length):{};for(const r in t.value)e[r]=i.customRef(()=>({get(){return t.value[r]},set(n){if(Array.isArray(t.value)){const a=[...t.value];a[r]=n,t.value=a}else{const a=Me(Ne({},t.value),{[r]:n});Object.setPrototypeOf(a,t.value),t.value=a}}}));return e}function Ue(t,e=!0){i.getCurrentInstance()?i.onBeforeMount(t):e?t():i.nextTick(t)}function Be(t){i.getCurrentInstance()&&i.onBeforeUnmount(t)}function He(t,e=!0){i.getCurrentInstance()?i.onMounted(t):e?t():i.nextTick(t)}function Le(t){i.getCurrentInstance()&&i.onUnmounted(t)}function Ye(t){let e=!1;function r(s,{flush:d="sync",deep:h=!1,timeout:v,throwOnTimeout:m}={}){let g=null;const Z=[new Promise(W=>{g=i.watch(t,A=>{s(A)!==e&&(g==null||g(),W(A))},{flush:d,deep:h,immediate:!0})})];return v!=null&&Z.push(L(v,m).then(()=>y(t)).finally(()=>g==null?void 0:g())),Promise.race(Z)}function n(s,d){if(!i.isRef(s))return r(A=>A===s,d);const{flush:h="sync",deep:v=!1,timeout:m,throwOnTimeout:g}=d??{};let S=null;const W=[new Promise(A=>{S=i.watch([t,s],([Lt,on])=>{e!==(Lt===on)&&(S==null||S(),A(Lt))},{flush:h,deep:v,immediate:!0})})];return m!=null&&W.push(L(m,g).then(()=>y(t)).finally(()=>(S==null||S(),y(t)))),Promise.race(W)}function a(s){return r(d=>Boolean(d),s)}function l(s){return n(null,s)}function u(s){return n(void 0,s)}function c(s){return r(Number.isNaN,s)}function p(s,d){return r(h=>{const v=Array.from(h);return v.includes(s)||v.includes(y(s))},d)}function _(s){return f(1,s)}function f(s=1,d){let h=-1;return r(()=>(h+=1,h>=s),d)}return Array.isArray(y(t))?{toMatch:r,toContains:p,changed:_,changedTimes:f,get not(){return e=!e,this}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:l,toBeNaN:c,toBeUndefined:u,changed:_,changedTimes:f,get not(){return e=!e,this}}}function Ge(t,e){return i.computed(()=>y(t).every((r,n,a)=>e(y(r),n,a)))}function ke(t,e){return i.computed(()=>y(t).map(r=>y(r)).filter(e))}function ze(t,e){return i.computed(()=>y(y(t).find((r,n,a)=>e(y(r),n,a))))}function Ze(t,e){return i.computed(()=>y(t).findIndex((r,n,a)=>e(y(r),n,a)))}function Je(t,e){return i.computed(()=>y(t).map(r=>y(r)).join(y(e)))}function Ve(t,e){return i.computed(()=>y(t).map(r=>y(r)).map(e))}function Xe(t,e,...r){const n=(a,l,u)=>e(y(a),y(l),u);return i.computed(()=>{const a=y(t);return r.length?a.reduce(n,y(r[0])):a.reduce(n)})}function qe(t,e){return i.computed(()=>y(t).some((r,n,a)=>e(y(r),n,a)))}function Ke(t=0,e={}){const r=i.ref(t),{max:n=1/0,min:a=-1/0}=e,l=(f=1)=>r.value=Math.min(n,r.value+f),u=(f=1)=>r.value=Math.max(a,r.value-f),c=()=>r.value,p=f=>r.value=f;return{count:r,inc:l,dec:u,get:c,set:p,reset:(f=t)=>(t=f,p(f))}}const Qe=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,De=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,dt=(t,e,r)=>{const n=t.getFullYear(),a=t.getMonth(),l=t.getDate(),u=t.getHours(),c=t.getMinutes(),p=t.getSeconds(),_=t.getMilliseconds(),f=t.getDay(),s={YY:()=>String(n).slice(-2),YYYY:()=>n,M:()=>a+1,MM:()=>`${a+1}`.padStart(2,"0"),D:()=>String(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(c),mm:()=>`${c}`.padStart(2,"0"),s:()=>String(p),ss:()=>`${p}`.padStart(2,"0"),SSS:()=>`${_}`.padStart(3,"0"),d:()=>f,dd:()=>t.toLocaleDateString(r,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(r,{weekday:"short"}),dddd:()=>t.toLocaleDateString(r,{weekday:"long"})};return e.replace(De,(d,h)=>h||s[d]())},pt=t=>{if(t===null)return new Date(NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(Qe);if(e){const r=e[2]-1||0,n=(e[7]||"0").substring(0,3);return new Date(e[1],r,e[3]||1,e[4]||0,e[5]||0,e[6]||0,n)}}return new Date(t)};function xe(t,e="HH:mm:ss",r={}){return i.computed(()=>dt(pt(y(t)),y(e),r==null?void 0:r.locales))}function yt(t,e=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let l=null;const u=i.ref(!1);function c(){l&&(clearInterval(l),l=null)}function p(){u.value=!1,c()}function _(){i.unref(e)<=0||(u.value=!0,a&&t(),c(),l=setInterval(t,y(e)))}if(n&&I&&_(),i.isRef(e)){const f=i.watch(e,()=>{u.value&&I&&_()});$(f)}return $(p),{isActive:u,pause:p,resume:_}}var tr=Object.defineProperty,_t=Object.getOwnPropertySymbols,er=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,vt=(t,e,r)=>e in t?tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nr=(t,e)=>{for(var r in e||(e={}))er.call(e,r)&&vt(t,r,e[r]);if(_t)for(var r of _t(e))rr.call(e,r)&&vt(t,r,e[r]);return t};function or(t=1e3,e={}){const{controls:r=!1,immediate:n=!0}=e,a=i.ref(0),l=yt(()=>a.value+=1,t,{immediate:n});return r?nr({counter:a},l):a}function ar(t,e={}){var r;const n=i.ref((r=e.initialValue)!=null?r:null);return i.watch(t,()=>n.value=K(),e),n}function ht(t,e,r={}){const{immediate:n=!0}=r,a=i.ref(!1);let l=null;function u(){l&&(clearTimeout(l),l=null)}function c(){a.value=!1,u()}function p(..._){u(),a.value=!0,l=setTimeout(()=>{a.value=!1,l=null,t(..._)},y(e))}return n&&(a.value=!0,I&&p()),$(c),{isPending:a,start:p,stop:c}}var ir=Object.defineProperty,Ot=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,ur=Object.prototype.propertyIsEnumerable,wt=(t,e,r)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cr=(t,e)=>{for(var r in e||(e={}))lr.call(e,r)&&wt(t,r,e[r]);if(Ot)for(var r of Ot(e))ur.call(e,r)&&wt(t,r,e[r]);return t};function sr(t=1e3,e={}){const{controls:r=!1}=e,n=ht(Q,t,e),a=i.computed(()=>!n.isPending.value);return r?cr({ready:a},n):a}function fr(t,e={}){const{method:r="parseFloat",radix:n,nanToZero:a}=e;return i.computed(()=>{let l=y(t);return typeof l=="string"&&(l=Number[r](l,n)),a&&isNaN(l)&&(l=0),l})}function dr(t){return i.computed(()=>`${y(t)}`)}function pr(t=!1,e={}){const{truthyValue:r=!0,falsyValue:n=!1}=e,a=i.isRef(t),l=i.ref(t);function u(c){if(arguments.length)return l.value=c,l.value;{const p=y(r);return l.value=l.value===p?y(n):p,l.value}}return a?u:[l,u]}function yr(t,e,r){let n=(r==null?void 0:r.immediate)?[]:[...t instanceof Function?t():Array.isArray(t)?t:i.unref(t)];return i.watch(t,(a,l,u)=>{const c=new Array(n.length),p=[];for(const f of a){let s=!1;for(let d=0;d<n.length;d++)if(!c[d]&&f===n[d]){c[d]=!0,s=!0;break}s||p.push(f)}const _=n.filter((f,s)=>!c[s]);e(a,n,p,_,u),n=[...a]},r)}var gt=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,vr=Object.prototype.propertyIsEnumerable,hr=(t,e)=>{var r={};for(var n in t)_r.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&>)for(var n of gt(t))e.indexOf(n)<0&&vr.call(t,n)&&(r[n]=t[n]);return r};function F(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=hr(n,["eventFilter"]);return i.watch(t,T(a,e),l)}var Pt=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable,gr=(t,e)=>{var r={};for(var n in t)Or.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Pt)for(var n of Pt(t))e.indexOf(n)<0&&wr.call(t,n)&&(r[n]=t[n]);return r};function Pr(t,e,r){const n=r,{count:a}=n,l=gr(n,["count"]),u=i.ref(0),c=F(t,(...p)=>{u.value+=1,u.value>=y(a)&&i.nextTick(()=>c()),e(...p)},l);return{count:u,stop:c}}var mr=Object.defineProperty,br=Object.defineProperties,$r=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable,$t=(t,e,r)=>e in t?mr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Sr=(t,e)=>{for(var r in e||(e={}))mt.call(e,r)&&$t(t,r,e[r]);if(R)for(var r of R(e))bt.call(e,r)&&$t(t,r,e[r]);return t},Ar=(t,e)=>br(t,$r(e)),jr=(t,e)=>{var r={};for(var n in t)mt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&R)for(var n of R(t))e.indexOf(n)<0&&bt.call(t,n)&&(r[n]=t[n]);return r};function St(t,e,r={}){const n=r,{debounce:a=0,maxWait:l=void 0}=n,u=jr(n,["debounce","maxWait"]);return F(t,e,Ar(Sr({},u),{eventFilter:B(a,{maxWait:l})}))}var Ir=Object.defineProperty,Tr=Object.defineProperties,Fr=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,It=(t,e,r)=>e in t?Ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e)=>{for(var r in e||(e={}))At.call(e,r)&&It(t,r,e[r]);if(C)for(var r of C(e))jt.call(e,r)&&It(t,r,e[r]);return t},Rr=(t,e)=>Tr(t,Fr(e)),Cr=(t,e)=>{var r={};for(var n in t)At.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&C)for(var n of C(t))e.indexOf(n)<0&&jt.call(t,n)&&(r[n]=t[n]);return r};function z(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=Cr(n,["eventFilter"]),u=T(a,e);let c,p,_;if(l.flush==="sync"){const f=i.ref(!1);p=()=>{},c=s=>{f.value=!0,s(),f.value=!1},_=i.watch(t,(...s)=>{f.value||u(...s)},l)}else{const f=[],s=i.ref(0),d=i.ref(0);p=()=>{s.value=d.value},f.push(i.watch(t,()=>{d.value++},Rr(Er({},l),{flush:"sync"}))),c=h=>{const v=d.value;h(),s.value+=d.value-v},f.push(i.watch(t,(...h)=>{const v=s.value>0&&s.value===d.value;s.value=0,d.value=0,!v&&u(...h)},l)),_=()=>{f.forEach(h=>h())}}return{stop:_,ignoreUpdates:c,ignorePrevAsyncUpdates:p}}function Nr(t,e,r){const n=i.watch(t,(...a)=>(i.nextTick(()=>n()),e(...a)),r)}var Mr=Object.defineProperty,Wr=Object.defineProperties,Ur=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Tt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Et=(t,e,r)=>e in t?Mr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Br=(t,e)=>{for(var r in e||(e={}))Tt.call(e,r)&&Et(t,r,e[r]);if(N)for(var r of N(e))Ft.call(e,r)&&Et(t,r,e[r]);return t},Hr=(t,e)=>Wr(t,Ur(e)),Lr=(t,e)=>{var r={};for(var n in t)Tt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&N)for(var n of N(t))e.indexOf(n)<0&&Ft.call(t,n)&&(r[n]=t[n]);return r};function Rt(t,e,r={}){const n=r,{eventFilter:a}=n,l=Lr(n,["eventFilter"]),{eventFilter:u,pause:c,resume:p,isActive:_}=D(a);return{stop:F(t,e,Hr(Br({},l),{eventFilter:u})),pause:c,resume:p,isActive:_}}var Yr=Object.defineProperty,Gr=Object.defineProperties,kr=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,Mt=(t,e,r)=>e in t?Yr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zr=(t,e)=>{for(var r in e||(e={}))Ct.call(e,r)&&Mt(t,r,e[r]);if(M)for(var r of M(e))Nt.call(e,r)&&Mt(t,r,e[r]);return t},Zr=(t,e)=>Gr(t,kr(e)),Jr=(t,e)=>{var r={};for(var n in t)Ct.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&M)for(var n of M(t))e.indexOf(n)<0&&Nt.call(t,n)&&(r[n]=t[n]);return r};function Wt(t,e,r={}){const n=r,{throttle:a=0,trailing:l=!0,leading:u=!0}=n,c=Jr(n,["throttle","trailing","leading"]);return F(t,e,Zr(zr({},c),{eventFilter:H(a,l,u)}))}var Vr=Object.defineProperty,Xr=Object.defineProperties,qr=Object.getOwnPropertyDescriptors,Ut=Object.getOwnPropertySymbols,Kr=Object.prototype.hasOwnProperty,Qr=Object.prototype.propertyIsEnumerable,Bt=(t,e,r)=>e in t?Vr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dr=(t,e)=>{for(var r in e||(e={}))Kr.call(e,r)&&Bt(t,r,e[r]);if(Ut)for(var r of Ut(e))Qr.call(e,r)&&Bt(t,r,e[r]);return t},xr=(t,e)=>Xr(t,qr(e));function tn(t,e,r={}){let n;function a(){if(!n)return;const f=n;n=void 0,f()}function l(f){n=f}const u=(f,s)=>(a(),e(f,s,l)),c=z(t,u,r),{ignoreUpdates:p}=c,_=()=>{let f;return p(()=>{f=u(en(t),rn(t))}),f};return xr(Dr({},c),{trigger:_})}function en(t){return i.isReactive(t)?t:Array.isArray(t)?t.map(e=>Ht(e)):Ht(t)}function Ht(t){return typeof t=="function"?t():i.unref(t)}function rn(t){return Array.isArray(t)?t.map(()=>{}):void 0}function nn(t,e,r){return i.watch(t,(n,a,l)=>{n&&e(n,a,l)},r)}o.__onlyVue3=x,o.assert=Zt,o.autoResetRef=it,o.bypassFilter=E,o.clamp=Dt,o.computedEager=V,o.computedWithControl=tt,o.containsProp=ie,o.controlledComputed=tt,o.controlledRef=$e,o.createEventHook=ce,o.createFilterWrapper=T,o.createGlobalState=se,o.createInjectionState=fe,o.createReactiveFn=Y,o.createSharedComposable=de,o.createSingletonPromise=oe,o.debounceFilter=B,o.debouncedRef=G,o.debouncedWatch=St,o.directiveHooks=re,o.eagerComputed=V,o.extendRef=et,o.formatDate=dt,o.get=pe,o.hasOwn=ee,o.identity=ne,o.ignorableWatch=z,o.increaseWithUnit=le,o.invoke=ae,o.isBoolean=Jt,o.isClient=I,o.isDef=zt,o.isDefined=ye,o.isFunction=U,o.isIOS=te,o.isNumber=Vt,o.isObject=qt,o.isString=Xt,o.isWindow=Kt,o.makeDestructurable=we,o.noop=Q,o.normalizeDate=pt,o.now=Qt,o.objectPick=ue,o.pausableFilter=D,o.pausableWatch=Rt,o.promiseTimeout=L,o.rand=xt,o.reactify=Y,o.reactifyObject=ge,o.reactiveComputed=at,o.reactiveOmit=Pe,o.reactivePick=me,o.refAutoReset=it,o.refDebounced=G,o.refDefault=be,o.refThrottled=k,o.refWithControl=ct,o.resolveRef=Se,o.resolveUnref=y,o.set=Ae,o.syncRef=je,o.syncRefs=Ie,o.throttleFilter=H,o.throttledRef=k,o.throttledWatch=Wt,o.timestamp=K,o.toReactive=ot,o.toRefs=We,o.tryOnBeforeMount=Ue,o.tryOnBeforeUnmount=Be,o.tryOnMounted=He,o.tryOnScopeDispose=$,o.tryOnUnmounted=Le,o.until=Ye,o.useArrayEvery=Ge,o.useArrayFilter=ke,o.useArrayFind=ze,o.useArrayFindIndex=Ze,o.useArrayJoin=Je,o.useArrayMap=Ve,o.useArrayReduce=Xe,o.useArraySome=qe,o.useCounter=Ke,o.useDateFormat=xe,o.useDebounce=G,o.useDebounceFn=lt,o.useInterval=or,o.useIntervalFn=yt,o.useLastChanged=ar,o.useThrottle=k,o.useThrottleFn=ut,o.useTimeout=sr,o.useTimeoutFn=ht,o.useToNumber=fr,o.useToString=dr,o.useToggle=pr,o.watchArray=yr,o.watchAtMost=Pr,o.watchDebounced=St,o.watchIgnorable=z,o.watchOnce=Nr,o.watchPausable=Rt,o.watchThrottled=Wt,o.watchTriggerable=tn,o.watchWithFilter=F,o.whenever=nn,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi);
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { shallowRef, watchEffect, readonly, unref, ref, isVue3, watch, customRef, effectScope, provide, inject, getCurrentScope, onScopeDispose, isRef, computed, reactive, toRefs as toRefs$1, toRef, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue-demi';
|
|
2
|
-
import { resolveUnref as resolveUnref$1 } from '@vueuse/shared';
|
|
3
2
|
|
|
4
3
|
var __defProp$9 = Object.defineProperty;
|
|
5
4
|
var __defProps$6 = Object.defineProperties;
|
|
@@ -56,6 +55,7 @@ const rand = (min, max) => {
|
|
|
56
55
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
57
56
|
};
|
|
58
57
|
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
58
|
+
const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
|
|
59
59
|
|
|
60
60
|
function resolveUnref(r) {
|
|
61
61
|
return typeof r === "function" ? r() : unref(r);
|
|
@@ -477,7 +477,7 @@ function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
|
477
477
|
const resetAfter = () => setTimeout(() => {
|
|
478
478
|
value = defaultValue;
|
|
479
479
|
trigger();
|
|
480
|
-
}, resolveUnref
|
|
480
|
+
}, resolveUnref(afterMs));
|
|
481
481
|
tryOnScopeDispose(() => {
|
|
482
482
|
clearTimeout(timer);
|
|
483
483
|
});
|
|
@@ -821,39 +821,39 @@ function until(r) {
|
|
|
821
821
|
}
|
|
822
822
|
|
|
823
823
|
function useArrayEvery(list, fn) {
|
|
824
|
-
return computed(() => resolveUnref
|
|
824
|
+
return computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
825
825
|
}
|
|
826
826
|
|
|
827
827
|
function useArrayFilter(list, fn) {
|
|
828
|
-
return computed(() => resolveUnref
|
|
828
|
+
return computed(() => resolveUnref(list).map((i) => resolveUnref(i)).filter(fn));
|
|
829
829
|
}
|
|
830
830
|
|
|
831
831
|
function useArrayFind(list, fn) {
|
|
832
|
-
return computed(() => resolveUnref
|
|
832
|
+
return computed(() => resolveUnref(resolveUnref(list).find((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
function useArrayFindIndex(list, fn) {
|
|
836
|
-
return computed(() => resolveUnref
|
|
836
|
+
return computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
837
837
|
}
|
|
838
838
|
|
|
839
839
|
function useArrayJoin(list, separator) {
|
|
840
|
-
return computed(() => resolveUnref
|
|
840
|
+
return computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
841
841
|
}
|
|
842
842
|
|
|
843
843
|
function useArrayMap(list, fn) {
|
|
844
|
-
return computed(() => resolveUnref
|
|
844
|
+
return computed(() => resolveUnref(list).map((i) => resolveUnref(i)).map(fn));
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
function useArrayReduce(list, reducer, ...args) {
|
|
848
|
-
const reduceCallback = (sum, value, index) => reducer(resolveUnref
|
|
848
|
+
const reduceCallback = (sum, value, index) => reducer(resolveUnref(sum), resolveUnref(value), index);
|
|
849
849
|
return computed(() => {
|
|
850
|
-
const resolved = resolveUnref
|
|
851
|
-
return args.length ? resolved.reduce(reduceCallback, resolveUnref
|
|
850
|
+
const resolved = resolveUnref(list);
|
|
851
|
+
return args.length ? resolved.reduce(reduceCallback, resolveUnref(args[0])) : resolved.reduce(reduceCallback);
|
|
852
852
|
});
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
function useArraySome(list, fn) {
|
|
856
|
-
return computed(() => resolveUnref
|
|
856
|
+
return computed(() => resolveUnref(list).some((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
function useCounter(initialValue = 0, options = {}) {
|
|
@@ -925,7 +925,7 @@ const normalizeDate = (date) => {
|
|
|
925
925
|
return new Date(date);
|
|
926
926
|
};
|
|
927
927
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
928
|
-
return computed(() => formatDate(normalizeDate(resolveUnref
|
|
928
|
+
return computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
|
|
929
929
|
}
|
|
930
930
|
|
|
931
931
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1033,7 +1033,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1033
1033
|
isPending.value = false;
|
|
1034
1034
|
timer = null;
|
|
1035
1035
|
cb(...args);
|
|
1036
|
-
}, resolveUnref
|
|
1036
|
+
}, resolveUnref(interval));
|
|
1037
1037
|
}
|
|
1038
1038
|
if (immediate) {
|
|
1039
1039
|
isPending.value = true;
|
|
@@ -1079,6 +1079,26 @@ function useTimeout(interval = 1e3, options = {}) {
|
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
1081
|
|
|
1082
|
+
function useToNumber(value, options = {}) {
|
|
1083
|
+
const {
|
|
1084
|
+
method = "parseFloat",
|
|
1085
|
+
radix,
|
|
1086
|
+
nanToZero
|
|
1087
|
+
} = options;
|
|
1088
|
+
return computed(() => {
|
|
1089
|
+
let resolved = resolveUnref(value);
|
|
1090
|
+
if (typeof resolved === "string")
|
|
1091
|
+
resolved = Number[method](resolved, radix);
|
|
1092
|
+
if (nanToZero && isNaN(resolved))
|
|
1093
|
+
resolved = 0;
|
|
1094
|
+
return resolved;
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
function useToString(value) {
|
|
1099
|
+
return computed(() => `${resolveUnref(value)}`);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1082
1102
|
function useToggle(initialValue = false, options = {}) {
|
|
1083
1103
|
const {
|
|
1084
1104
|
truthyValue = true,
|
|
@@ -1476,4 +1496,4 @@ function whenever(source, cb, options) {
|
|
|
1476
1496
|
}, options);
|
|
1477
1497
|
}
|
|
1478
1498
|
|
|
1479
|
-
export { __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
|
1499
|
+
export { __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|