@vueuse/shared 9.11.1 → 9.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +25 -7
- package/index.d.ts +23 -10
- package/index.iife.js +25 -7
- package/index.iife.min.js +1 -1
- package/index.mjs +25 -8
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -144,14 +144,14 @@ function throttleFilter(ms, trailing = true, leading = true, rejectOnCancel = fa
|
|
|
144
144
|
lastExec = Date.now();
|
|
145
145
|
invoke();
|
|
146
146
|
} else if (trailing) {
|
|
147
|
-
|
|
147
|
+
lastValue = new Promise((resolve, reject) => {
|
|
148
148
|
lastRejector = rejectOnCancel ? reject : resolve;
|
|
149
149
|
timer = setTimeout(() => {
|
|
150
150
|
lastExec = Date.now();
|
|
151
151
|
isLeading = true;
|
|
152
152
|
resolve(invoke());
|
|
153
153
|
clear();
|
|
154
|
-
}, duration - elapsed);
|
|
154
|
+
}, Math.max(0, duration - elapsed));
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
if (!leading && !timer)
|
|
@@ -173,7 +173,7 @@ function pausableFilter(extendFilter = bypassFilter) {
|
|
|
173
173
|
if (isActive.value)
|
|
174
174
|
extendFilter(...args);
|
|
175
175
|
};
|
|
176
|
-
return { isActive, pause, resume, eventFilter };
|
|
176
|
+
return { isActive: vueDemi.readonly(isActive), pause, resume, eventFilter };
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
function __onlyVue3(name = "this function") {
|
|
@@ -867,6 +867,18 @@ function useArrayFindIndex(list, fn) {
|
|
|
867
867
|
return vueDemi.computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
868
868
|
}
|
|
869
869
|
|
|
870
|
+
function findLast(arr, cb) {
|
|
871
|
+
let index = arr.length;
|
|
872
|
+
while (index-- > 0) {
|
|
873
|
+
if (cb(arr[index], index, arr))
|
|
874
|
+
return arr[index];
|
|
875
|
+
}
|
|
876
|
+
return void 0;
|
|
877
|
+
}
|
|
878
|
+
function useArrayFindLast(list, fn) {
|
|
879
|
+
return vueDemi.computed(() => resolveUnref(!Array.prototype.findLast ? findLast(resolveUnref(list), (element, index, array) => fn(resolveUnref(element), index, array)) : resolveUnref(list).findLast((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
880
|
+
}
|
|
881
|
+
|
|
870
882
|
function useArrayJoin(list, separator) {
|
|
871
883
|
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
872
884
|
}
|
|
@@ -995,13 +1007,14 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
995
1007
|
clean();
|
|
996
1008
|
}
|
|
997
1009
|
function resume() {
|
|
998
|
-
|
|
1010
|
+
const intervalValue = resolveUnref(interval);
|
|
1011
|
+
if (intervalValue <= 0)
|
|
999
1012
|
return;
|
|
1000
1013
|
isActive.value = true;
|
|
1001
1014
|
if (immediateCallback)
|
|
1002
1015
|
cb();
|
|
1003
1016
|
clean();
|
|
1004
|
-
timer = setInterval(cb,
|
|
1017
|
+
timer = setInterval(cb, intervalValue);
|
|
1005
1018
|
}
|
|
1006
1019
|
if (immediate && isClient)
|
|
1007
1020
|
resume();
|
|
@@ -1044,13 +1057,17 @@ function useInterval(interval = 1e3, options = {}) {
|
|
|
1044
1057
|
} = options;
|
|
1045
1058
|
const counter = vueDemi.ref(0);
|
|
1046
1059
|
const update = () => counter.value += 1;
|
|
1060
|
+
const reset = () => {
|
|
1061
|
+
counter.value = 0;
|
|
1062
|
+
};
|
|
1047
1063
|
const controls = useIntervalFn(callback ? () => {
|
|
1048
1064
|
update();
|
|
1049
1065
|
callback(counter.value);
|
|
1050
1066
|
} : update, interval, { immediate });
|
|
1051
1067
|
if (exposeControls) {
|
|
1052
1068
|
return __spreadValues$6({
|
|
1053
|
-
counter
|
|
1069
|
+
counter,
|
|
1070
|
+
reset
|
|
1054
1071
|
}, controls);
|
|
1055
1072
|
} else {
|
|
1056
1073
|
return counter;
|
|
@@ -1096,7 +1113,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1096
1113
|
}
|
|
1097
1114
|
tryOnScopeDispose(stop);
|
|
1098
1115
|
return {
|
|
1099
|
-
isPending,
|
|
1116
|
+
isPending: vueDemi.readonly(isPending),
|
|
1100
1117
|
start,
|
|
1101
1118
|
stop
|
|
1102
1119
|
};
|
|
@@ -1632,6 +1649,7 @@ exports.useArrayEvery = useArrayEvery;
|
|
|
1632
1649
|
exports.useArrayFilter = useArrayFilter;
|
|
1633
1650
|
exports.useArrayFind = useArrayFind;
|
|
1634
1651
|
exports.useArrayFindIndex = useArrayFindIndex;
|
|
1652
|
+
exports.useArrayFindLast = useArrayFindLast;
|
|
1635
1653
|
exports.useArrayJoin = useArrayJoin;
|
|
1636
1654
|
exports.useArrayMap = useArrayMap;
|
|
1637
1655
|
exports.useArrayReduce = useArrayReduce;
|
package/index.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ interface Pausable {
|
|
|
165
165
|
/**
|
|
166
166
|
* A ref indicate whether a pausable instance is active
|
|
167
167
|
*/
|
|
168
|
-
isActive: Ref<boolean
|
|
168
|
+
isActive: Readonly<Ref<boolean>>;
|
|
169
169
|
/**
|
|
170
170
|
* Temporary pause the effect from executing
|
|
171
171
|
*/
|
|
@@ -175,11 +175,11 @@ interface Pausable {
|
|
|
175
175
|
*/
|
|
176
176
|
resume: Fn;
|
|
177
177
|
}
|
|
178
|
-
interface Stoppable {
|
|
178
|
+
interface Stoppable<StartFnArgs extends any[] = any[]> {
|
|
179
179
|
/**
|
|
180
180
|
* A ref indicate whether a stoppable instance is executing
|
|
181
181
|
*/
|
|
182
|
-
isPending: Ref<boolean
|
|
182
|
+
isPending: Readonly<Ref<boolean>>;
|
|
183
183
|
/**
|
|
184
184
|
* Stop the effect from executing
|
|
185
185
|
*/
|
|
@@ -187,7 +187,7 @@ interface Stoppable {
|
|
|
187
187
|
/**
|
|
188
188
|
* Start the effects
|
|
189
189
|
*/
|
|
190
|
-
start:
|
|
190
|
+
start: (...args: StartFnArgs) => void;
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
193
|
* @deprecated Use `Stoppable`
|
|
@@ -575,7 +575,7 @@ declare function tryOnBeforeUnmount(fn: Fn): void;
|
|
|
575
575
|
declare function tryOnMounted(fn: Fn, sync?: boolean): void;
|
|
576
576
|
|
|
577
577
|
/**
|
|
578
|
-
* Call onScopeDispose() if it's inside
|
|
578
|
+
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
|
579
579
|
*
|
|
580
580
|
* @param fn
|
|
581
581
|
*/
|
|
@@ -694,6 +694,17 @@ declare function useArrayFind<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>,
|
|
|
694
694
|
*/
|
|
695
695
|
declare function useArrayFindIndex<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<number>;
|
|
696
696
|
|
|
697
|
+
/**
|
|
698
|
+
* Reactive `Array.findLast`
|
|
699
|
+
*
|
|
700
|
+
* @see https://vueuse.org/useArrayFindLast
|
|
701
|
+
* @param {Array} list - the array was called upon.
|
|
702
|
+
* @param fn - a function to test each element.
|
|
703
|
+
*
|
|
704
|
+
* @returns the last element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
705
|
+
*/
|
|
706
|
+
declare function useArrayFindLast<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
707
|
+
|
|
697
708
|
/**
|
|
698
709
|
* Reactive `Array.join`
|
|
699
710
|
*
|
|
@@ -835,6 +846,10 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
835
846
|
*/
|
|
836
847
|
callback?: (count: number) => void;
|
|
837
848
|
}
|
|
849
|
+
interface UseIntervalControls {
|
|
850
|
+
counter: Ref<number>;
|
|
851
|
+
reset: () => void;
|
|
852
|
+
}
|
|
838
853
|
/**
|
|
839
854
|
* Reactive counter increases on every interval
|
|
840
855
|
*
|
|
@@ -843,9 +858,7 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
843
858
|
* @param options
|
|
844
859
|
*/
|
|
845
860
|
declare function useInterval(interval?: MaybeComputedRef<number>, options?: UseIntervalOptions<false>): Ref<number>;
|
|
846
|
-
declare function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>):
|
|
847
|
-
counter: Ref<number>;
|
|
848
|
-
} & Pausable;
|
|
861
|
+
declare function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>): UseIntervalControls & Pausable;
|
|
849
862
|
|
|
850
863
|
interface UseIntervalFnOptions {
|
|
851
864
|
/**
|
|
@@ -915,7 +928,7 @@ interface UseTimeoutFnOptions {
|
|
|
915
928
|
* @param interval
|
|
916
929
|
* @param options
|
|
917
930
|
*/
|
|
918
|
-
declare function useTimeoutFn
|
|
931
|
+
declare function useTimeoutFn<CallbackFn extends (...args: any[]) => any>(cb: CallbackFn, interval: MaybeComputedRef<number>, options?: UseTimeoutFnOptions): Stoppable<Parameters<CallbackFn> | []>;
|
|
919
932
|
|
|
920
933
|
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
921
934
|
/**
|
|
@@ -1056,4 +1069,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
|
|
|
1056
1069
|
*/
|
|
1057
1070
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
|
|
1058
1071
|
|
|
1059
|
-
export { AnyFn, ArgumentsType, Arrayable, 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, PromisifyFn, 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, __onlyVue27Plus, __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, useArrayUnique, 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 };
|
|
1072
|
+
export { AnyFn, ArgumentsType, Arrayable, 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, PromisifyFn, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalControls, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToNumberOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue27Plus, __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, useArrayFindLast, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, 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
|
@@ -257,14 +257,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
257
257
|
lastExec = Date.now();
|
|
258
258
|
invoke();
|
|
259
259
|
} else if (trailing) {
|
|
260
|
-
|
|
260
|
+
lastValue = new Promise((resolve, reject) => {
|
|
261
261
|
lastRejector = rejectOnCancel ? reject : resolve;
|
|
262
262
|
timer = setTimeout(() => {
|
|
263
263
|
lastExec = Date.now();
|
|
264
264
|
isLeading = true;
|
|
265
265
|
resolve(invoke());
|
|
266
266
|
clear();
|
|
267
|
-
}, duration - elapsed);
|
|
267
|
+
}, Math.max(0, duration - elapsed));
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
if (!leading && !timer)
|
|
@@ -286,7 +286,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
286
286
|
if (isActive.value)
|
|
287
287
|
extendFilter(...args);
|
|
288
288
|
};
|
|
289
|
-
return { isActive, pause, resume, eventFilter };
|
|
289
|
+
return { isActive: vueDemi.readonly(isActive), pause, resume, eventFilter };
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
function __onlyVue3(name = "this function") {
|
|
@@ -980,6 +980,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
980
980
|
return vueDemi.computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
981
981
|
}
|
|
982
982
|
|
|
983
|
+
function findLast(arr, cb) {
|
|
984
|
+
let index = arr.length;
|
|
985
|
+
while (index-- > 0) {
|
|
986
|
+
if (cb(arr[index], index, arr))
|
|
987
|
+
return arr[index];
|
|
988
|
+
}
|
|
989
|
+
return void 0;
|
|
990
|
+
}
|
|
991
|
+
function useArrayFindLast(list, fn) {
|
|
992
|
+
return vueDemi.computed(() => resolveUnref(!Array.prototype.findLast ? findLast(resolveUnref(list), (element, index, array) => fn(resolveUnref(element), index, array)) : resolveUnref(list).findLast((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
993
|
+
}
|
|
994
|
+
|
|
983
995
|
function useArrayJoin(list, separator) {
|
|
984
996
|
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
985
997
|
}
|
|
@@ -1108,13 +1120,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1108
1120
|
clean();
|
|
1109
1121
|
}
|
|
1110
1122
|
function resume() {
|
|
1111
|
-
|
|
1123
|
+
const intervalValue = resolveUnref(interval);
|
|
1124
|
+
if (intervalValue <= 0)
|
|
1112
1125
|
return;
|
|
1113
1126
|
isActive.value = true;
|
|
1114
1127
|
if (immediateCallback)
|
|
1115
1128
|
cb();
|
|
1116
1129
|
clean();
|
|
1117
|
-
timer = setInterval(cb,
|
|
1130
|
+
timer = setInterval(cb, intervalValue);
|
|
1118
1131
|
}
|
|
1119
1132
|
if (immediate && isClient)
|
|
1120
1133
|
resume();
|
|
@@ -1157,13 +1170,17 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1157
1170
|
} = options;
|
|
1158
1171
|
const counter = vueDemi.ref(0);
|
|
1159
1172
|
const update = () => counter.value += 1;
|
|
1173
|
+
const reset = () => {
|
|
1174
|
+
counter.value = 0;
|
|
1175
|
+
};
|
|
1160
1176
|
const controls = useIntervalFn(callback ? () => {
|
|
1161
1177
|
update();
|
|
1162
1178
|
callback(counter.value);
|
|
1163
1179
|
} : update, interval, { immediate });
|
|
1164
1180
|
if (exposeControls) {
|
|
1165
1181
|
return __spreadValues$6({
|
|
1166
|
-
counter
|
|
1182
|
+
counter,
|
|
1183
|
+
reset
|
|
1167
1184
|
}, controls);
|
|
1168
1185
|
} else {
|
|
1169
1186
|
return counter;
|
|
@@ -1209,7 +1226,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1209
1226
|
}
|
|
1210
1227
|
tryOnScopeDispose(stop);
|
|
1211
1228
|
return {
|
|
1212
|
-
isPending,
|
|
1229
|
+
isPending: vueDemi.readonly(isPending),
|
|
1213
1230
|
start,
|
|
1214
1231
|
stop
|
|
1215
1232
|
};
|
|
@@ -1745,6 +1762,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
1745
1762
|
exports.useArrayFilter = useArrayFilter;
|
|
1746
1763
|
exports.useArrayFind = useArrayFind;
|
|
1747
1764
|
exports.useArrayFindIndex = useArrayFindIndex;
|
|
1765
|
+
exports.useArrayFindLast = useArrayFindLast;
|
|
1748
1766
|
exports.useArrayJoin = useArrayJoin;
|
|
1749
1767
|
exports.useArrayMap = useArrayMap;
|
|
1750
1768
|
exports.useArrayReduce = useArrayReduce;
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(a,i,E){if(a.install)return a;if(!i)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),a;if(i.version.slice(0,4)==="2.7."){let O=function(P,A){var m,N={},W={config:i.config,use:i.use.bind(i),mixin:i.mixin.bind(i),component:i.component.bind(i),provide:function($,S){return N[$]=S,this},directive:function($,S){return S?(i.directive($,S),W):i.directive($)},mount:function($,S){return m||(m=new i(Object.assign({propsData:A},P,{provide:Object.assign(N,P.provide)})),m.$mount($,S),m)},unmount:function(){m&&(m.$destroy(),m=void 0)}};return W};var zt=O;for(var b in i)a[b]=i[b];a.isVue2=!0,a.isVue3=!1,a.install=function(){},a.Vue=i,a.Vue2=i,a.version=i.version,a.warn=i.util.warn,a.createApp=O}else if(i.version.slice(0,2)==="2.")if(E){for(var b in E)a[b]=E[b];a.isVue2=!0,a.isVue3=!1,a.install=function(){},a.Vue=i,a.Vue2=i,a.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 b in i)a[b]=i[b];a.isVue2=!1,a.isVue3=!0,a.install=function(){},a.Vue=i,a.Vue2=void 0,a.version=i.version,a.set=function(O,P,A){return Array.isArray(O)?(O.length=Math.max(O.length,P),O.splice(P,1,A),A):(O[P]=A,A)},a.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.");return a}(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(a,i){"use strict";var E=Object.defineProperty,b=Object.defineProperties,zt=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,m=(t,e,r)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N=(t,e)=>{for(var r in e||(e={}))P.call(e,r)&&m(t,r,e[r]);if(O)for(var r of O(e))A.call(e,r)&&m(t,r,e[r]);return t},W=(t,e)=>b(t,zt(e));function $(t,e){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=t()},W(N({},e),{flush:(r=e==null?void 0:e.flush)!=null?r:"sync"})),i.readonly(n)}var S;const M=typeof window!="undefined",Zt=t=>typeof t!="undefined",qt=(t,...e)=>{t||console.warn(...e)},x=Object.prototype.toString,Jt=t=>typeof t=="boolean",U=t=>typeof t=="function",Xt=t=>typeof t=="number",Kt=t=>typeof t=="string",Qt=t=>x.call(t)==="[object Object]",Vt=t=>typeof window!="undefined"&&x.call(t)==="[object Window]",Dt=()=>Date.now(),tt=()=>+Date.now(),xt=(t,e,r)=>Math.min(r,Math.max(e,t)),I=()=>{},te=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),ee=M&&((S=window==null?void 0:window.navigator)==null?void 0:S.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent),re=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function y(t){return typeof t=="function"?t():i.unref(t)}function R(t,e){function r(...n){return new Promise((o,l)=>{Promise.resolve(t(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})).then(o).catch(l)})}return r}const B=t=>t();function z(t,e={}){let r,n,o=I;const l=c=>{clearTimeout(c),o(),o=I};return c=>{const p=y(t),_=y(e.maxWait);return r&&l(r),p<=0||_!==void 0&&_<=0?(n&&(l(n),n=null),Promise.resolve(c())):new Promise((d,s)=>{o=e.rejectOnCancel?s:d,_&&!n&&(n=setTimeout(()=>{r&&l(r),n=null,d(c())},_)),r=setTimeout(()=>{n&&l(n),n=null,d(c())},p)})}}function Z(t,e=!0,r=!0,n=!1){let o=0,l,u=!0,c=I,p;const _=()=>{l&&(clearTimeout(l),l=void 0,c(),c=I)};return s=>{const f=y(t),h=Date.now()-o,v=()=>p=s();if(_(),f<=0)return o=Date.now(),v();if(h>f&&(r||!u))o=Date.now(),v();else if(e)return new Promise((w,g)=>{c=n?g:w,l=setTimeout(()=>{o=Date.now(),u=!0,w(v()),_()},f-h)});return!r&&!l&&(l=setTimeout(()=>u=!0,f)),u=!1,p}}function et(t=B){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 ne(t="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}function rt(t="this function"){if(!(i.isVue3||i.version.startsWith("2.7.")))throw new Error(`[VueUse] ${t} is only works on Vue 2.7 or above.`)}const oe={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function q(t,e=!1,r="Timeout"){return new Promise((n,o)=>{setTimeout(e?()=>o(r):n,t)})}function ae(t){return t}function ie(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 le(t){return t()}function ue(t,...e){return e.some(r=>r in t)}function ce(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])||"",o=t.slice(n.length),l=parseFloat(n)+e;return Number.isNaN(l)?t:l+o}function se(t,e,r=!1){return e.reduce((n,o)=>(o in t&&(!r||t[o]!==void 0)&&(n[o]=t[o]),n),{})}function nt(t,e){let r,n,o;const l=i.ref(!0),u=()=>{l.value=!0,o()};i.watch(t,u,{flush:"sync"});const c=U(e)?e:e.get,p=U(e)?void 0:e.set,_=i.customRef((d,s)=>(n=d,o=s,{get(){return l.value&&(r=c(),l.value=!1),n(),r},set(f){p==null||p(f)}}));return Object.isExtensible(_)&&(_.trigger=u),_}function j(t){return i.getCurrentScope()?(i.onScopeDispose(t),!0):!1}function fe(){const t=[],e=o=>{const l=t.indexOf(o);l!==-1&&t.splice(l,1)};return{on:o=>{t.push(o);const l=()=>e(o);return j(l),{off:l}},off:e,trigger:o=>{t.forEach(l=>l(o))}}}function de(t){let e=!1,r;const n=i.effectScope(!0);return()=>(e||(r=n.run(t),e=!0),r)}function pe(t){const e=Symbol("InjectionState");return[(...o)=>{const l=t(...o);return i.provide(e,l),l},()=>i.inject(e)]}function ye(t){let e=0,r,n;const o=()=>{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))),j(o),r)}function ot(t,e,{enumerable:r=!1,unwrap:n=!0}={}){rt();for(const[o,l]of Object.entries(e))o!=="value"&&(i.isRef(l)&&n?Object.defineProperty(t,o,{get(){return l.value},set(u){l.value=u},enumerable:r}):Object.defineProperty(t,o,{value:l,enumerable:r}));return t}function _e(t,e){return e==null?i.unref(t):i.unref(t)[e]}function ve(t){return i.unref(t)!=null}var he=Object.defineProperty,at=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,it=(t,e,r)=>e in t?he(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ge=(t,e)=>{for(var r in e||(e={}))Oe.call(e,r)&&it(t,r,e[r]);if(at)for(var r of at(e))we.call(e,r)&&it(t,r,e[r]);return t};function Pe(t,e){if(typeof Symbol!="undefined"){const r=ge({},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 J(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(o=>r(o))))}}function me(t,e={}){let r=[],n;if(Array.isArray(e))r=e;else{n=e;const{includeOwnProperties:o=!0}=e;r.push(...Object.keys(t)),o&&r.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(r.map(o=>{const l=t[o];return[o,typeof l=="function"?J(l.bind(t),n):l]}))}function lt(t){if(!i.isRef(t))return i.reactive(t);const e=new Proxy({},{get(r,n,o){return i.unref(Reflect.get(t.value,n,o))},set(r,n,o){return i.isRef(t.value[n])&&!i.isRef(o)?t.value[n].value=o:t.value[n]=o,!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 ut(t){return lt(i.computed(t))}function be(t,...e){const r=e.flat();return ut(()=>Object.fromEntries(Object.entries(i.toRefs(t)).filter(n=>!r.includes(n[0]))))}function $e(t,...e){const r=e.flat();return i.reactive(Object.fromEntries(r.map(n=>[n,i.toRef(t,n)])))}function ct(t,e=1e4){return i.customRef((r,n)=>{let o=t,l;const u=()=>setTimeout(()=>{o=t,n()},y(e));return j(()=>{clearTimeout(l)}),{get(){return r(),o},set(c){o=c,n(),clearTimeout(l),l=u()}}})}function st(t,e=200,r={}){return R(z(e,r),t)}function X(t,e=200,r={}){const n=i.ref(t.value),o=st(()=>{n.value=t.value},e,r);return i.watch(t,()=>o()),n}function Se(t,e){return i.computed({get(){var r;return(r=t.value)!=null?r:e},set(r){t.value=r}})}function ft(t,e=200,r=!1,n=!0,o=!1){return R(Z(e,r,n,o),t)}function K(t,e=200,r=!0,n=!0){if(e<=0)return t;const o=i.ref(t.value),l=ft(()=>{o.value=t.value},e,r,n);return i.watch(t,()=>l()),o}function dt(t,e={}){let r=t,n,o;const l=i.customRef((f,h)=>(n=f,o=h,{get(){return u()},set(v){c(v)}}));function u(f=!0){return f&&n(),r}function c(f,h=!0){var v,w;if(f===r)return;const g=r;((v=e.onBeforeChange)==null?void 0:v.call(e,f,g))!==!1&&(r=f,(w=e.onChanged)==null||w.call(e,f,g),h&&o())}return ot(l,{get:u,set:c,untrackedGet:()=>u(!1),silentSet:f=>c(f,!1),peek:()=>u(!1),lay:f=>c(f,!1)},{enumerable:!0})}const Ae=dt;function je(t){return typeof t=="function"?i.computed(t):i.ref(t)}function Ie(...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 Fe(t,e,r={}){var n,o;const{flush:l="sync",deep:u=!1,immediate:c=!0,direction:p="both",transform:_={}}=r;let d,s;const f=(n=_.ltr)!=null?n:v=>v,h=(o=_.rtl)!=null?o:v=>v;return(p==="both"||p==="ltr")&&(d=i.watch(t,v=>e.value=f(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})),()=>{d==null||d(),s==null||s()}}function Te(t,e,r={}){const{flush:n="sync",deep:o=!1,immediate:l=!0}=r;return Array.isArray(e)||(e=[e]),i.watch(t,u=>e.forEach(c=>c.value=u),{flush:n,deep:o,immediate:l})}var Ee=Object.defineProperty,Me=Object.defineProperties,Re=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable,yt=(t,e,r)=>e in t?Ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,We=(t,e)=>{for(var r in e||(e={}))Ce.call(e,r)&&yt(t,r,e[r]);if(pt)for(var r of pt(e))Ne.call(e,r)&&yt(t,r,e[r]);return t},Ue=(t,e)=>Me(t,Re(e));function Be(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 o=[...t.value];o[r]=n,t.value=o}else{const o=Ue(We({},t.value),{[r]:n});Object.setPrototypeOf(o,t.value),t.value=o}}}));return e}function Le(t,e=!0){i.getCurrentInstance()?i.onBeforeMount(t):e?t():i.nextTick(t)}function He(t){i.getCurrentInstance()&&i.onBeforeUnmount(t)}function ke(t,e=!0){i.getCurrentInstance()?i.onMounted(t):e?t():i.nextTick(t)}function Ye(t){i.getCurrentInstance()&&i.onUnmounted(t)}function Q(t,e=!1){function r(s,{flush:f="sync",deep:h=!1,timeout:v,throwOnTimeout:w}={}){let g=null;const D=[new Promise(G=>{g=i.watch(t,T=>{s(T)!==e&&(g==null||g(),G(T))},{flush:f,deep:h,immediate:!0})})];return v!=null&&D.push(q(v,w).then(()=>y(t)).finally(()=>g==null?void 0:g())),Promise.race(D)}function n(s,f){if(!i.isRef(s))return r(T=>T===s,f);const{flush:h="sync",deep:v=!1,timeout:w,throwOnTimeout:g}=f??{};let F=null;const G=[new Promise(T=>{F=i.watch([t,s],([Gt,cn])=>{e!==(Gt===cn)&&(F==null||F(),T(Gt))},{flush:h,deep:v,immediate:!0})})];return w!=null&&G.push(q(w,g).then(()=>y(t)).finally(()=>(F==null||F(),y(t)))),Promise.race(G)}function o(s){return r(f=>Boolean(f),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,f){return r(h=>{const v=Array.from(h);return v.includes(s)||v.includes(y(s))},f)}function _(s){return d(1,s)}function d(s=1,f){let h=-1;return r(()=>(h+=1,h>=s),f)}return Array.isArray(y(t))?{toMatch:r,toContains:p,changed:_,changedTimes:d,get not(){return Q(t,!e)}}:{toMatch:r,toBe:n,toBeTruthy:o,toBeNull:l,toBeNaN:c,toBeUndefined:u,changed:_,changedTimes:d,get not(){return Q(t,!e)}}}function Ge(t){return Q(t)}function ze(t,e){return i.computed(()=>y(t).every((r,n,o)=>e(y(r),n,o)))}function Ze(t,e){return i.computed(()=>y(t).map(r=>y(r)).filter(e))}function qe(t,e){return i.computed(()=>y(y(t).find((r,n,o)=>e(y(r),n,o))))}function Je(t,e){return i.computed(()=>y(t).findIndex((r,n,o)=>e(y(r),n,o)))}function Xe(t,e){return i.computed(()=>y(t).map(r=>y(r)).join(y(e)))}function Ke(t,e){return i.computed(()=>y(t).map(r=>y(r)).map(e))}function Qe(t,e,...r){const n=(o,l,u)=>e(y(o),y(l),u);return i.computed(()=>{const o=y(t);return r.length?o.reduce(n,y(r[0])):o.reduce(n)})}function Ve(t,e){return i.computed(()=>y(t).some((r,n,o)=>e(y(r),n,o)))}function De(t){return i.computed(()=>[...new Set(y(t).map(e=>y(e)))])}function xe(t=0,e={}){const r=i.ref(t),{max:n=1/0,min:o=-1/0}=e,l=(d=1)=>r.value=Math.min(n,r.value+d),u=(d=1)=>r.value=Math.max(o,r.value-d),c=()=>r.value,p=d=>r.value=Math.max(o,Math.min(n,d));return{count:r,inc:l,dec:u,get:c,set:p,reset:(d=t)=>(t=d,p(d))}}const tr=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,er=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g,rr=(t,e,r,n)=>{let o=t<12?"AM":"PM";return n&&(o=o.split("").reduce((l,u)=>l+=`${u}.`,"")),r?o.toLowerCase():o},_t=(t,e,r={})=>{var n;const o=t.getFullYear(),l=t.getMonth(),u=t.getDate(),c=t.getHours(),p=t.getMinutes(),_=t.getSeconds(),d=t.getMilliseconds(),s=t.getDay(),f=(n=r.customMeridiem)!=null?n:rr,h={YY:()=>String(o).slice(-2),YYYY:()=>o,M:()=>l+1,MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(r.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(r.locales,{month:"long"}),D:()=>String(u),DD:()=>`${u}`.padStart(2,"0"),H:()=>String(c),HH:()=>`${c}`.padStart(2,"0"),h:()=>`${c%12||12}`.padStart(1,"0"),hh:()=>`${c%12||12}`.padStart(2,"0"),m:()=>String(p),mm:()=>`${p}`.padStart(2,"0"),s:()=>String(_),ss:()=>`${_}`.padStart(2,"0"),SSS:()=>`${d}`.padStart(3,"0"),d:()=>s,dd:()=>t.toLocaleDateString(r.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(r.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(r.locales,{weekday:"long"}),A:()=>f(c,p),AA:()=>f(c,p,!1,!0),a:()=>f(c,p,!0),aa:()=>f(c,p,!0,!0)};return e.replace(er,(v,w)=>w||h[v]())},vt=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(tr);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 nr(t,e="HH:mm:ss",r={}){return i.computed(()=>_t(vt(y(t)),y(e),r))}function ht(t,e=1e3,r={}){const{immediate:n=!0,immediateCallback:o=!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,o&&t(),c(),l=setInterval(t,y(e)))}if(n&&M&&_(),i.isRef(e)||U(e)){const d=i.watch(e,()=>{u.value&&M&&_()});j(d)}return j(p),{isActive:u,pause:p,resume:_}}var or=Object.defineProperty,Ot=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,wt=(t,e,r)=>e in t?or(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lr=(t,e)=>{for(var r in e||(e={}))ar.call(e,r)&&wt(t,r,e[r]);if(Ot)for(var r of Ot(e))ir.call(e,r)&&wt(t,r,e[r]);return t};function ur(t=1e3,e={}){const{controls:r=!1,immediate:n=!0,callback:o}=e,l=i.ref(0),u=()=>l.value+=1,c=ht(o?()=>{u(),o(l.value)}:u,t,{immediate:n});return r?lr({counter:l},c):l}function cr(t,e={}){var r;const n=i.ref((r=e.initialValue)!=null?r:null);return i.watch(t,()=>n.value=tt(),e),n}function gt(t,e,r={}){const{immediate:n=!0}=r,o=i.ref(!1);let l=null;function u(){l&&(clearTimeout(l),l=null)}function c(){o.value=!1,u()}function p(..._){u(),o.value=!0,l=setTimeout(()=>{o.value=!1,l=null,t(..._)},y(e))}return n&&(o.value=!0,M&&p()),j(c),{isPending:o,start:p,stop:c}}var sr=Object.defineProperty,Pt=Object.getOwnPropertySymbols,fr=Object.prototype.hasOwnProperty,dr=Object.prototype.propertyIsEnumerable,mt=(t,e,r)=>e in t?sr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pr=(t,e)=>{for(var r in e||(e={}))fr.call(e,r)&&mt(t,r,e[r]);if(Pt)for(var r of Pt(e))dr.call(e,r)&&mt(t,r,e[r]);return t};function yr(t=1e3,e={}){const{controls:r=!1,callback:n}=e,o=gt(n??I,t,e),l=i.computed(()=>!o.isPending.value);return r?pr({ready:l},o):l}function _r(t,e={}){const{method:r="parseFloat",radix:n,nanToZero:o}=e;return i.computed(()=>{let l=y(t);return typeof l=="string"&&(l=Number[r](l,n)),o&&isNaN(l)&&(l=0),l})}function vr(t){return i.computed(()=>`${y(t)}`)}function hr(t=!1,e={}){const{truthyValue:r=!0,falsyValue:n=!1}=e,o=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 o?u:[l,u]}function Or(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,(o,l,u)=>{const c=new Array(n.length),p=[];for(const d of o){let s=!1;for(let f=0;f<n.length;f++)if(!c[f]&&d===n[f]){c[f]=!0,s=!0;break}s||p.push(d)}const _=n.filter((d,s)=>!c[s]);e(o,n,p,_,u),n=[...o]},r)}var bt=Object.getOwnPropertySymbols,wr=Object.prototype.hasOwnProperty,gr=Object.prototype.propertyIsEnumerable,Pr=(t,e)=>{var r={};for(var n in t)wr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&bt)for(var n of bt(t))e.indexOf(n)<0&&gr.call(t,n)&&(r[n]=t[n]);return r};function C(t,e,r={}){const n=r,{eventFilter:o=B}=n,l=Pr(n,["eventFilter"]);return i.watch(t,R(o,e),l)}var $t=Object.getOwnPropertySymbols,mr=Object.prototype.hasOwnProperty,br=Object.prototype.propertyIsEnumerable,$r=(t,e)=>{var r={};for(var n in t)mr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&$t)for(var n of $t(t))e.indexOf(n)<0&&br.call(t,n)&&(r[n]=t[n]);return r};function Sr(t,e,r){const n=r,{count:o}=n,l=$r(n,["count"]),u=i.ref(0),c=C(t,(...p)=>{u.value+=1,u.value>=y(o)&&i.nextTick(()=>c()),e(...p)},l);return{count:u,stop:c}}var Ar=Object.defineProperty,jr=Object.defineProperties,Ir=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,jt=(t,e,r)=>e in t?Ar(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fr=(t,e)=>{for(var r in e||(e={}))St.call(e,r)&&jt(t,r,e[r]);if(L)for(var r of L(e))At.call(e,r)&&jt(t,r,e[r]);return t},Tr=(t,e)=>jr(t,Ir(e)),Er=(t,e)=>{var r={};for(var n in t)St.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&L)for(var n of L(t))e.indexOf(n)<0&&At.call(t,n)&&(r[n]=t[n]);return r};function It(t,e,r={}){const n=r,{debounce:o=0,maxWait:l=void 0}=n,u=Er(n,["debounce","maxWait"]);return C(t,e,Tr(Fr({},u),{eventFilter:z(o,{maxWait:l})}))}var Mr=Object.defineProperty,Rr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable,Et=(t,e,r)=>e in t?Mr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nr=(t,e)=>{for(var r in e||(e={}))Ft.call(e,r)&&Et(t,r,e[r]);if(H)for(var r of H(e))Tt.call(e,r)&&Et(t,r,e[r]);return t},Wr=(t,e)=>Rr(t,Cr(e)),Ur=(t,e)=>{var r={};for(var n in t)Ft.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&H)for(var n of H(t))e.indexOf(n)<0&&Tt.call(t,n)&&(r[n]=t[n]);return r};function V(t,e,r={}){const n=r,{eventFilter:o=B}=n,l=Ur(n,["eventFilter"]),u=R(o,e);let c,p,_;if(l.flush==="sync"){const d=i.ref(!1);p=()=>{},c=s=>{d.value=!0,s(),d.value=!1},_=i.watch(t,(...s)=>{d.value||u(...s)},l)}else{const d=[],s=i.ref(0),f=i.ref(0);p=()=>{s.value=f.value},d.push(i.watch(t,()=>{f.value++},Wr(Nr({},l),{flush:"sync"}))),c=h=>{const v=f.value;h(),s.value+=f.value-v},d.push(i.watch(t,(...h)=>{const v=s.value>0&&s.value===f.value;s.value=0,f.value=0,!v&&u(...h)},l)),_=()=>{d.forEach(h=>h())}}return{stop:_,ignoreUpdates:c,ignorePrevAsyncUpdates:p}}function Br(t,e,r){const n=i.watch(t,(...o)=>(i.nextTick(()=>n()),e(...o)),r)}var Lr=Object.defineProperty,Hr=Object.defineProperties,kr=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,Ct=(t,e,r)=>e in t?Lr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Yr=(t,e)=>{for(var r in e||(e={}))Mt.call(e,r)&&Ct(t,r,e[r]);if(k)for(var r of k(e))Rt.call(e,r)&&Ct(t,r,e[r]);return t},Gr=(t,e)=>Hr(t,kr(e)),zr=(t,e)=>{var r={};for(var n in t)Mt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&k)for(var n of k(t))e.indexOf(n)<0&&Rt.call(t,n)&&(r[n]=t[n]);return r};function Nt(t,e,r={}){const n=r,{eventFilter:o}=n,l=zr(n,["eventFilter"]),{eventFilter:u,pause:c,resume:p,isActive:_}=et(o);return{stop:C(t,e,Gr(Yr({},l),{eventFilter:u})),pause:c,resume:p,isActive:_}}var Zr=Object.defineProperty,qr=Object.defineProperties,Jr=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,Wt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,Bt=(t,e,r)=>e in t?Zr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xr=(t,e)=>{for(var r in e||(e={}))Wt.call(e,r)&&Bt(t,r,e[r]);if(Y)for(var r of Y(e))Ut.call(e,r)&&Bt(t,r,e[r]);return t},Kr=(t,e)=>qr(t,Jr(e)),Qr=(t,e)=>{var r={};for(var n in t)Wt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Y)for(var n of Y(t))e.indexOf(n)<0&&Ut.call(t,n)&&(r[n]=t[n]);return r};function Lt(t,e,r={}){const n=r,{throttle:o=0,trailing:l=!0,leading:u=!0}=n,c=Qr(n,["throttle","trailing","leading"]);return C(t,e,Kr(Xr({},c),{eventFilter:Z(o,l,u)}))}var Vr=Object.defineProperty,Dr=Object.defineProperties,xr=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,tn=Object.prototype.hasOwnProperty,en=Object.prototype.propertyIsEnumerable,kt=(t,e,r)=>e in t?Vr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rn=(t,e)=>{for(var r in e||(e={}))tn.call(e,r)&&kt(t,r,e[r]);if(Ht)for(var r of Ht(e))en.call(e,r)&&kt(t,r,e[r]);return t},nn=(t,e)=>Dr(t,xr(e));function on(t,e,r={}){let n;function o(){if(!n)return;const d=n;n=void 0,d()}function l(d){n=d}const u=(d,s)=>(o(),e(d,s,l)),c=V(t,u,r),{ignoreUpdates:p}=c,_=()=>{let d;return p(()=>{d=u(an(t),ln(t))}),d};return nn(rn({},c),{trigger:_})}function an(t){return i.isReactive(t)?t:Array.isArray(t)?t.map(e=>Yt(e)):Yt(t)}function Yt(t){return typeof t=="function"?t():i.unref(t)}function ln(t){return Array.isArray(t)?t.map(()=>{}):void 0}function un(t,e,r){return i.watch(t,(n,o,l)=>{n&&e(n,o,l)},r)}a.__onlyVue27Plus=rt,a.__onlyVue3=ne,a.assert=qt,a.autoResetRef=ct,a.bypassFilter=B,a.clamp=xt,a.computedEager=$,a.computedWithControl=nt,a.containsProp=ue,a.controlledComputed=nt,a.controlledRef=Ae,a.createEventHook=fe,a.createFilterWrapper=R,a.createGlobalState=de,a.createInjectionState=pe,a.createReactiveFn=J,a.createSharedComposable=ye,a.createSingletonPromise=ie,a.debounceFilter=z,a.debouncedRef=X,a.debouncedWatch=It,a.directiveHooks=oe,a.eagerComputed=$,a.extendRef=ot,a.formatDate=_t,a.get=_e,a.hasOwn=re,a.identity=ae,a.ignorableWatch=V,a.increaseWithUnit=ce,a.invoke=le,a.isBoolean=Jt,a.isClient=M,a.isDef=Zt,a.isDefined=ve,a.isFunction=U,a.isIOS=ee,a.isNumber=Xt,a.isObject=Qt,a.isString=Kt,a.isWindow=Vt,a.makeDestructurable=Pe,a.noop=I,a.normalizeDate=vt,a.now=Dt,a.objectPick=se,a.pausableFilter=et,a.pausableWatch=Nt,a.promiseTimeout=q,a.rand=te,a.reactify=J,a.reactifyObject=me,a.reactiveComputed=ut,a.reactiveOmit=be,a.reactivePick=$e,a.refAutoReset=ct,a.refDebounced=X,a.refDefault=Se,a.refThrottled=K,a.refWithControl=dt,a.resolveRef=je,a.resolveUnref=y,a.set=Ie,a.syncRef=Fe,a.syncRefs=Te,a.throttleFilter=Z,a.throttledRef=K,a.throttledWatch=Lt,a.timestamp=tt,a.toReactive=lt,a.toRefs=Be,a.tryOnBeforeMount=Le,a.tryOnBeforeUnmount=He,a.tryOnMounted=ke,a.tryOnScopeDispose=j,a.tryOnUnmounted=Ye,a.until=Ge,a.useArrayEvery=ze,a.useArrayFilter=Ze,a.useArrayFind=qe,a.useArrayFindIndex=Je,a.useArrayJoin=Xe,a.useArrayMap=Ke,a.useArrayReduce=Qe,a.useArraySome=Ve,a.useArrayUnique=De,a.useCounter=xe,a.useDateFormat=nr,a.useDebounce=X,a.useDebounceFn=st,a.useInterval=ur,a.useIntervalFn=ht,a.useLastChanged=cr,a.useThrottle=K,a.useThrottleFn=ft,a.useTimeout=yr,a.useTimeoutFn=gt,a.useToNumber=_r,a.useToString=vr,a.useToggle=hr,a.watchArray=Or,a.watchAtMost=Sr,a.watchDebounced=It,a.watchIgnorable=V,a.watchOnce=Br,a.watchPausable=Nt,a.watchThrottled=Lt,a.watchTriggerable=on,a.watchWithFilter=C,a.whenever=un})(this.VueUse=this.VueUse||{},VueDemi);
|
|
1
|
+
var VueDemi=function(a,i,E){if(a.install)return a;if(!i)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),a;if(i.version.slice(0,4)==="2.7."){let O=function(P,A){var m,N={},W={config:i.config,use:i.use.bind(i),mixin:i.mixin.bind(i),component:i.component.bind(i),provide:function($,S){return N[$]=S,this},directive:function($,S){return S?(i.directive($,S),W):i.directive($)},mount:function($,S){return m||(m=new i(Object.assign({propsData:A},P,{provide:Object.assign(N,P.provide)})),m.$mount($,S),m)},unmount:function(){m&&(m.$destroy(),m=void 0)}};return W};var zt=O;for(var b in i)a[b]=i[b];a.isVue2=!0,a.isVue3=!1,a.install=function(){},a.Vue=i,a.Vue2=i,a.version=i.version,a.warn=i.util.warn,a.createApp=O}else if(i.version.slice(0,2)==="2.")if(E){for(var b in E)a[b]=E[b];a.isVue2=!0,a.isVue3=!1,a.install=function(){},a.Vue=i,a.Vue2=i,a.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 b in i)a[b]=i[b];a.isVue2=!1,a.isVue3=!0,a.install=function(){},a.Vue=i,a.Vue2=void 0,a.version=i.version,a.set=function(O,P,A){return Array.isArray(O)?(O.length=Math.max(O.length,P),O.splice(P,1,A),A):(O[P]=A,A)},a.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.");return a}(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(a,i){"use strict";var E=Object.defineProperty,b=Object.defineProperties,zt=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,m=(t,e,n)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,N=(t,e)=>{for(var n in e||(e={}))P.call(e,n)&&m(t,n,e[n]);if(O)for(var n of O(e))A.call(e,n)&&m(t,n,e[n]);return t},W=(t,e)=>b(t,zt(e));function $(t,e){var n;const r=i.shallowRef();return i.watchEffect(()=>{r.value=t()},W(N({},e),{flush:(n=e==null?void 0:e.flush)!=null?n:"sync"})),i.readonly(r)}var S;const M=typeof window!="undefined",Zt=t=>typeof t!="undefined",qt=(t,...e)=>{t||console.warn(...e)},x=Object.prototype.toString,Jt=t=>typeof t=="boolean",U=t=>typeof t=="function",Xt=t=>typeof t=="number",Kt=t=>typeof t=="string",Qt=t=>x.call(t)==="[object Object]",Vt=t=>typeof window!="undefined"&&x.call(t)==="[object Window]",Dt=()=>Date.now(),tt=()=>+Date.now(),xt=(t,e,n)=>Math.min(n,Math.max(e,t)),F=()=>{},te=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),ee=M&&((S=window==null?void 0:window.navigator)==null?void 0:S.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent),ne=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function y(t){return typeof t=="function"?t():i.unref(t)}function R(t,e){function n(...r){return new Promise((o,l)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(o).catch(l)})}return n}const L=t=>t();function z(t,e={}){let n,r,o=F;const l=c=>{clearTimeout(c),o(),o=F};return c=>{const d=y(t),_=y(e.maxWait);return n&&l(n),d<=0||_!==void 0&&_<=0?(r&&(l(r),r=null),Promise.resolve(c())):new Promise((s,f)=>{o=e.rejectOnCancel?f:s,_&&!r&&(r=setTimeout(()=>{n&&l(n),r=null,s(c())},_)),n=setTimeout(()=>{r&&l(r),r=null,s(c())},d)})}}function Z(t,e=!0,n=!0,r=!1){let o=0,l,u=!0,c=F,d;const _=()=>{l&&(clearTimeout(l),l=void 0,c(),c=F)};return f=>{const p=y(t),h=Date.now()-o,v=()=>d=f();return _(),p<=0?(o=Date.now(),v()):(h>p&&(n||!u)?(o=Date.now(),v()):e&&(d=new Promise((w,g)=>{c=r?g:w,l=setTimeout(()=>{o=Date.now(),u=!0,w(v()),_()},Math.max(0,p-h))})),!n&&!l&&(l=setTimeout(()=>u=!0,p)),u=!1,d)}}function et(t=L){const e=i.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const o=(...l)=>{e.value&&t(...l)};return{isActive:i.readonly(e),pause:n,resume:r,eventFilter:o}}function re(t="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}function nt(t="this function"){if(!(i.isVue3||i.version.startsWith("2.7.")))throw new Error(`[VueUse] ${t} is only works on Vue 2.7 or above.`)}const oe={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function q(t,e=!1,n="Timeout"){return new Promise((r,o)=>{setTimeout(e?()=>o(n):r,t)})}function ae(t){return t}function ie(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function le(t){return t()}function ue(t,...e){return e.some(n=>n in t)}function ce(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:n[0])||"",o=t.slice(r.length),l=parseFloat(r)+e;return Number.isNaN(l)?t:l+o}function se(t,e,n=!1){return e.reduce((r,o)=>(o in t&&(!n||t[o]!==void 0)&&(r[o]=t[o]),r),{})}function rt(t,e){let n,r,o;const l=i.ref(!0),u=()=>{l.value=!0,o()};i.watch(t,u,{flush:"sync"});const c=U(e)?e:e.get,d=U(e)?void 0:e.set,_=i.customRef((s,f)=>(r=s,o=f,{get(){return l.value&&(n=c(),l.value=!1),r(),n},set(p){d==null||d(p)}}));return Object.isExtensible(_)&&(_.trigger=u),_}function j(t){return i.getCurrentScope()?(i.onScopeDispose(t),!0):!1}function fe(){const t=[],e=o=>{const l=t.indexOf(o);l!==-1&&t.splice(l,1)};return{on:o=>{t.push(o);const l=()=>e(o);return j(l),{off:l}},off:e,trigger:o=>{t.forEach(l=>l(o))}}}function de(t){let e=!1,n;const r=i.effectScope(!0);return()=>(e||(n=r.run(t),e=!0),n)}function pe(t){const e=Symbol("InjectionState");return[(...o)=>{const l=t(...o);return i.provide(e,l),l},()=>i.inject(e)]}function ye(t){let e=0,n,r;const o=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...l)=>(e+=1,n||(r=i.effectScope(!0),n=r.run(()=>t(...l))),j(o),n)}function ot(t,e,{enumerable:n=!1,unwrap:r=!0}={}){nt();for(const[o,l]of Object.entries(e))o!=="value"&&(i.isRef(l)&&r?Object.defineProperty(t,o,{get(){return l.value},set(u){l.value=u},enumerable:n}):Object.defineProperty(t,o,{value:l,enumerable:n}));return t}function _e(t,e){return e==null?i.unref(t):i.unref(t)[e]}function ve(t){return i.unref(t)!=null}var he=Object.defineProperty,at=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,it=(t,e,n)=>e in t?he(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ge=(t,e)=>{for(var n in e||(e={}))Oe.call(e,n)&&it(t,n,e[n]);if(at)for(var n of at(e))we.call(e,n)&&it(t,n,e[n]);return t};function Pe(t,e){if(typeof Symbol!="undefined"){const n=ge({},t);return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function J(t,e){const n=(e==null?void 0:e.computedGetter)===!1?i.unref:y;return function(...r){return i.computed(()=>t.apply(this,r.map(o=>n(o))))}}function me(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:o=!0}=e;n.push(...Object.keys(t)),o&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(o=>{const l=t[o];return[o,typeof l=="function"?J(l.bind(t),r):l]}))}function lt(t){if(!i.isRef(t))return i.reactive(t);const e=new Proxy({},{get(n,r,o){return i.unref(Reflect.get(t.value,r,o))},set(n,r,o){return i.isRef(t.value[r])&&!i.isRef(o)?t.value[r].value=o:t.value[r]=o,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return i.reactive(e)}function ut(t){return lt(i.computed(t))}function be(t,...e){const n=e.flat();return ut(()=>Object.fromEntries(Object.entries(i.toRefs(t)).filter(r=>!n.includes(r[0]))))}function $e(t,...e){const n=e.flat();return i.reactive(Object.fromEntries(n.map(r=>[r,i.toRef(t,r)])))}function ct(t,e=1e4){return i.customRef((n,r)=>{let o=t,l;const u=()=>setTimeout(()=>{o=t,r()},y(e));return j(()=>{clearTimeout(l)}),{get(){return n(),o},set(c){o=c,r(),clearTimeout(l),l=u()}}})}function st(t,e=200,n={}){return R(z(e,n),t)}function X(t,e=200,n={}){const r=i.ref(t.value),o=st(()=>{r.value=t.value},e,n);return i.watch(t,()=>o()),r}function Se(t,e){return i.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function ft(t,e=200,n=!1,r=!0,o=!1){return R(Z(e,n,r,o),t)}function K(t,e=200,n=!0,r=!0){if(e<=0)return t;const o=i.ref(t.value),l=ft(()=>{o.value=t.value},e,n,r);return i.watch(t,()=>l()),o}function dt(t,e={}){let n=t,r,o;const l=i.customRef((p,h)=>(r=p,o=h,{get(){return u()},set(v){c(v)}}));function u(p=!0){return p&&r(),n}function c(p,h=!0){var v,w;if(p===n)return;const g=n;((v=e.onBeforeChange)==null?void 0:v.call(e,p,g))!==!1&&(n=p,(w=e.onChanged)==null||w.call(e,p,g),h&&o())}return ot(l,{get:u,set:c,untrackedGet:()=>u(!1),silentSet:p=>c(p,!1),peek:()=>u(!1),lay:p=>c(p,!1)},{enumerable:!0})}const Ae=dt;function je(t){return typeof t=="function"?i.computed(t):i.ref(t)}function Fe(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3)if(i.isVue2)i.set(...t);else{const[e,n,r]=t;e[n]=r}}function Ie(t,e,n={}){var r,o;const{flush:l="sync",deep:u=!1,immediate:c=!0,direction:d="both",transform:_={}}=n;let s,f;const p=(r=_.ltr)!=null?r:v=>v,h=(o=_.rtl)!=null?o:v=>v;return(d==="both"||d==="ltr")&&(s=i.watch(t,v=>e.value=p(v),{flush:l,deep:u,immediate:c})),(d==="both"||d==="rtl")&&(f=i.watch(e,v=>t.value=h(v),{flush:l,deep:u,immediate:c})),()=>{s==null||s(),f==null||f()}}function Te(t,e,n={}){const{flush:r="sync",deep:o=!1,immediate:l=!0}=n;return Array.isArray(e)||(e=[e]),i.watch(t,u=>e.forEach(c=>c.value=u),{flush:r,deep:o,immediate:l})}var Ee=Object.defineProperty,Me=Object.defineProperties,Re=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable,yt=(t,e,n)=>e in t?Ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,We=(t,e)=>{for(var n in e||(e={}))Ce.call(e,n)&&yt(t,n,e[n]);if(pt)for(var n of pt(e))Ne.call(e,n)&&yt(t,n,e[n]);return t},Ue=(t,e)=>Me(t,Re(e));function Le(t){if(!i.isRef(t))return i.toRefs(t);const e=Array.isArray(t.value)?new Array(t.value.length):{};for(const n in t.value)e[n]=i.customRef(()=>({get(){return t.value[n]},set(r){if(Array.isArray(t.value)){const o=[...t.value];o[n]=r,t.value=o}else{const o=Ue(We({},t.value),{[n]:r});Object.setPrototypeOf(o,t.value),t.value=o}}}));return e}function Be(t,e=!0){i.getCurrentInstance()?i.onBeforeMount(t):e?t():i.nextTick(t)}function He(t){i.getCurrentInstance()&&i.onBeforeUnmount(t)}function ke(t,e=!0){i.getCurrentInstance()?i.onMounted(t):e?t():i.nextTick(t)}function Ye(t){i.getCurrentInstance()&&i.onUnmounted(t)}function Q(t,e=!1){function n(f,{flush:p="sync",deep:h=!1,timeout:v,throwOnTimeout:w}={}){let g=null;const D=[new Promise(G=>{g=i.watch(t,T=>{f(T)!==e&&(g==null||g(),G(T))},{flush:p,deep:h,immediate:!0})})];return v!=null&&D.push(q(v,w).then(()=>y(t)).finally(()=>g==null?void 0:g())),Promise.race(D)}function r(f,p){if(!i.isRef(f))return n(T=>T===f,p);const{flush:h="sync",deep:v=!1,timeout:w,throwOnTimeout:g}=p??{};let I=null;const G=[new Promise(T=>{I=i.watch([t,f],([Gt,fr])=>{e!==(Gt===fr)&&(I==null||I(),T(Gt))},{flush:h,deep:v,immediate:!0})})];return w!=null&&G.push(q(w,g).then(()=>y(t)).finally(()=>(I==null||I(),y(t)))),Promise.race(G)}function o(f){return n(p=>Boolean(p),f)}function l(f){return r(null,f)}function u(f){return r(void 0,f)}function c(f){return n(Number.isNaN,f)}function d(f,p){return n(h=>{const v=Array.from(h);return v.includes(f)||v.includes(y(f))},p)}function _(f){return s(1,f)}function s(f=1,p){let h=-1;return n(()=>(h+=1,h>=f),p)}return Array.isArray(y(t))?{toMatch:n,toContains:d,changed:_,changedTimes:s,get not(){return Q(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:o,toBeNull:l,toBeNaN:c,toBeUndefined:u,changed:_,changedTimes:s,get not(){return Q(t,!e)}}}function Ge(t){return Q(t)}function ze(t,e){return i.computed(()=>y(t).every((n,r,o)=>e(y(n),r,o)))}function Ze(t,e){return i.computed(()=>y(t).map(n=>y(n)).filter(e))}function qe(t,e){return i.computed(()=>y(y(t).find((n,r,o)=>e(y(n),r,o))))}function Je(t,e){return i.computed(()=>y(t).findIndex((n,r,o)=>e(y(n),r,o)))}function Xe(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function Ke(t,e){return i.computed(()=>y(Array.prototype.findLast?y(t).findLast((n,r,o)=>e(y(n),r,o)):Xe(y(t),(n,r,o)=>e(y(n),r,o))))}function Qe(t,e){return i.computed(()=>y(t).map(n=>y(n)).join(y(e)))}function Ve(t,e){return i.computed(()=>y(t).map(n=>y(n)).map(e))}function De(t,e,...n){const r=(o,l,u)=>e(y(o),y(l),u);return i.computed(()=>{const o=y(t);return n.length?o.reduce(r,y(n[0])):o.reduce(r)})}function xe(t,e){return i.computed(()=>y(t).some((n,r,o)=>e(y(n),r,o)))}function tn(t){return i.computed(()=>[...new Set(y(t).map(e=>y(e)))])}function en(t=0,e={}){const n=i.ref(t),{max:r=1/0,min:o=-1/0}=e,l=(s=1)=>n.value=Math.min(r,n.value+s),u=(s=1)=>n.value=Math.max(o,n.value-s),c=()=>n.value,d=s=>n.value=Math.max(o,Math.min(r,s));return{count:n,inc:l,dec:u,get:c,set:d,reset:(s=t)=>(t=s,d(s))}}const nn=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rn=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g,on=(t,e,n,r)=>{let o=t<12?"AM":"PM";return r&&(o=o.split("").reduce((l,u)=>l+=`${u}.`,"")),n?o.toLowerCase():o},_t=(t,e,n={})=>{var r;const o=t.getFullYear(),l=t.getMonth(),u=t.getDate(),c=t.getHours(),d=t.getMinutes(),_=t.getSeconds(),s=t.getMilliseconds(),f=t.getDay(),p=(r=n.customMeridiem)!=null?r:on,h={YY:()=>String(o).slice(-2),YYYY:()=>o,M:()=>l+1,MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(n.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(n.locales,{month:"long"}),D:()=>String(u),DD:()=>`${u}`.padStart(2,"0"),H:()=>String(c),HH:()=>`${c}`.padStart(2,"0"),h:()=>`${c%12||12}`.padStart(1,"0"),hh:()=>`${c%12||12}`.padStart(2,"0"),m:()=>String(d),mm:()=>`${d}`.padStart(2,"0"),s:()=>String(_),ss:()=>`${_}`.padStart(2,"0"),SSS:()=>`${s}`.padStart(3,"0"),d:()=>f,dd:()=>t.toLocaleDateString(n.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(n.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(n.locales,{weekday:"long"}),A:()=>p(c,d),AA:()=>p(c,d,!1,!0),a:()=>p(c,d,!0),aa:()=>p(c,d,!0,!0)};return e.replace(rn,(v,w)=>w||h[v]())},vt=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(nn);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)};function an(t,e="HH:mm:ss",n={}){return i.computed(()=>_t(vt(y(t)),y(e),n))}function ht(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:o=!1}=n;let l=null;const u=i.ref(!1);function c(){l&&(clearInterval(l),l=null)}function d(){u.value=!1,c()}function _(){const s=y(e);s<=0||(u.value=!0,o&&t(),c(),l=setInterval(t,s))}if(r&&M&&_(),i.isRef(e)||U(e)){const s=i.watch(e,()=>{u.value&&M&&_()});j(s)}return j(d),{isActive:u,pause:d,resume:_}}var ln=Object.defineProperty,Ot=Object.getOwnPropertySymbols,un=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable,wt=(t,e,n)=>e in t?ln(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sn=(t,e)=>{for(var n in e||(e={}))un.call(e,n)&&wt(t,n,e[n]);if(Ot)for(var n of Ot(e))cn.call(e,n)&&wt(t,n,e[n]);return t};function fn(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:o}=e,l=i.ref(0),u=()=>l.value+=1,c=()=>{l.value=0},d=ht(o?()=>{u(),o(l.value)}:u,t,{immediate:r});return n?sn({counter:l,reset:c},d):l}function dn(t,e={}){var n;const r=i.ref((n=e.initialValue)!=null?n:null);return i.watch(t,()=>r.value=tt(),e),r}function gt(t,e,n={}){const{immediate:r=!0}=n,o=i.ref(!1);let l=null;function u(){l&&(clearTimeout(l),l=null)}function c(){o.value=!1,u()}function d(..._){u(),o.value=!0,l=setTimeout(()=>{o.value=!1,l=null,t(..._)},y(e))}return r&&(o.value=!0,M&&d()),j(c),{isPending:i.readonly(o),start:d,stop:c}}var pn=Object.defineProperty,Pt=Object.getOwnPropertySymbols,yn=Object.prototype.hasOwnProperty,_n=Object.prototype.propertyIsEnumerable,mt=(t,e,n)=>e in t?pn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vn=(t,e)=>{for(var n in e||(e={}))yn.call(e,n)&&mt(t,n,e[n]);if(Pt)for(var n of Pt(e))_n.call(e,n)&&mt(t,n,e[n]);return t};function hn(t=1e3,e={}){const{controls:n=!1,callback:r}=e,o=gt(r??F,t,e),l=i.computed(()=>!o.isPending.value);return n?vn({ready:l},o):l}function On(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:o}=e;return i.computed(()=>{let l=y(t);return typeof l=="string"&&(l=Number[n](l,r)),o&&isNaN(l)&&(l=0),l})}function wn(t){return i.computed(()=>`${y(t)}`)}function gn(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,o=i.isRef(t),l=i.ref(t);function u(c){if(arguments.length)return l.value=c,l.value;{const d=y(n);return l.value=l.value===d?y(r):d,l.value}}return o?u:[l,u]}function Pn(t,e,n){let r=(n==null?void 0:n.immediate)?[]:[...t instanceof Function?t():Array.isArray(t)?t:i.unref(t)];return i.watch(t,(o,l,u)=>{const c=new Array(r.length),d=[];for(const s of o){let f=!1;for(let p=0;p<r.length;p++)if(!c[p]&&s===r[p]){c[p]=!0,f=!0;break}f||d.push(s)}const _=r.filter((s,f)=>!c[f]);e(o,r,d,_,u),r=[...o]},n)}var bt=Object.getOwnPropertySymbols,mn=Object.prototype.hasOwnProperty,bn=Object.prototype.propertyIsEnumerable,$n=(t,e)=>{var n={};for(var r in t)mn.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&bt)for(var r of bt(t))e.indexOf(r)<0&&bn.call(t,r)&&(n[r]=t[r]);return n};function C(t,e,n={}){const r=n,{eventFilter:o=L}=r,l=$n(r,["eventFilter"]);return i.watch(t,R(o,e),l)}var $t=Object.getOwnPropertySymbols,Sn=Object.prototype.hasOwnProperty,An=Object.prototype.propertyIsEnumerable,jn=(t,e)=>{var n={};for(var r in t)Sn.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&$t)for(var r of $t(t))e.indexOf(r)<0&&An.call(t,r)&&(n[r]=t[r]);return n};function Fn(t,e,n){const r=n,{count:o}=r,l=jn(r,["count"]),u=i.ref(0),c=C(t,(...d)=>{u.value+=1,u.value>=y(o)&&i.nextTick(()=>c()),e(...d)},l);return{count:u,stop:c}}var In=Object.defineProperty,Tn=Object.defineProperties,En=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,jt=(t,e,n)=>e in t?In(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Mn=(t,e)=>{for(var n in e||(e={}))St.call(e,n)&&jt(t,n,e[n]);if(B)for(var n of B(e))At.call(e,n)&&jt(t,n,e[n]);return t},Rn=(t,e)=>Tn(t,En(e)),Cn=(t,e)=>{var n={};for(var r in t)St.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&B)for(var r of B(t))e.indexOf(r)<0&&At.call(t,r)&&(n[r]=t[r]);return n};function Ft(t,e,n={}){const r=n,{debounce:o=0,maxWait:l=void 0}=r,u=Cn(r,["debounce","maxWait"]);return C(t,e,Rn(Mn({},u),{eventFilter:z(o,{maxWait:l})}))}var Nn=Object.defineProperty,Wn=Object.defineProperties,Un=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,It=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable,Et=(t,e,n)=>e in t?Nn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ln=(t,e)=>{for(var n in e||(e={}))It.call(e,n)&&Et(t,n,e[n]);if(H)for(var n of H(e))Tt.call(e,n)&&Et(t,n,e[n]);return t},Bn=(t,e)=>Wn(t,Un(e)),Hn=(t,e)=>{var n={};for(var r in t)It.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&H)for(var r of H(t))e.indexOf(r)<0&&Tt.call(t,r)&&(n[r]=t[r]);return n};function V(t,e,n={}){const r=n,{eventFilter:o=L}=r,l=Hn(r,["eventFilter"]),u=R(o,e);let c,d,_;if(l.flush==="sync"){const s=i.ref(!1);d=()=>{},c=f=>{s.value=!0,f(),s.value=!1},_=i.watch(t,(...f)=>{s.value||u(...f)},l)}else{const s=[],f=i.ref(0),p=i.ref(0);d=()=>{f.value=p.value},s.push(i.watch(t,()=>{p.value++},Bn(Ln({},l),{flush:"sync"}))),c=h=>{const v=p.value;h(),f.value+=p.value-v},s.push(i.watch(t,(...h)=>{const v=f.value>0&&f.value===p.value;f.value=0,p.value=0,!v&&u(...h)},l)),_=()=>{s.forEach(h=>h())}}return{stop:_,ignoreUpdates:c,ignorePrevAsyncUpdates:d}}function kn(t,e,n){const r=i.watch(t,(...o)=>(i.nextTick(()=>r()),e(...o)),n)}var Yn=Object.defineProperty,Gn=Object.defineProperties,zn=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,Ct=(t,e,n)=>e in t?Yn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zn=(t,e)=>{for(var n in e||(e={}))Mt.call(e,n)&&Ct(t,n,e[n]);if(k)for(var n of k(e))Rt.call(e,n)&&Ct(t,n,e[n]);return t},qn=(t,e)=>Gn(t,zn(e)),Jn=(t,e)=>{var n={};for(var r in t)Mt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&k)for(var r of k(t))e.indexOf(r)<0&&Rt.call(t,r)&&(n[r]=t[r]);return n};function Nt(t,e,n={}){const r=n,{eventFilter:o}=r,l=Jn(r,["eventFilter"]),{eventFilter:u,pause:c,resume:d,isActive:_}=et(o);return{stop:C(t,e,qn(Zn({},l),{eventFilter:u})),pause:c,resume:d,isActive:_}}var Xn=Object.defineProperty,Kn=Object.defineProperties,Qn=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,Wt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,Lt=(t,e,n)=>e in t?Xn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Vn=(t,e)=>{for(var n in e||(e={}))Wt.call(e,n)&&Lt(t,n,e[n]);if(Y)for(var n of Y(e))Ut.call(e,n)&&Lt(t,n,e[n]);return t},Dn=(t,e)=>Kn(t,Qn(e)),xn=(t,e)=>{var n={};for(var r in t)Wt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Y)for(var r of Y(t))e.indexOf(r)<0&&Ut.call(t,r)&&(n[r]=t[r]);return n};function Bt(t,e,n={}){const r=n,{throttle:o=0,trailing:l=!0,leading:u=!0}=r,c=xn(r,["throttle","trailing","leading"]);return C(t,e,Dn(Vn({},c),{eventFilter:Z(o,l,u)}))}var tr=Object.defineProperty,er=Object.defineProperties,nr=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,rr=Object.prototype.hasOwnProperty,or=Object.prototype.propertyIsEnumerable,kt=(t,e,n)=>e in t?tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ar=(t,e)=>{for(var n in e||(e={}))rr.call(e,n)&&kt(t,n,e[n]);if(Ht)for(var n of Ht(e))or.call(e,n)&&kt(t,n,e[n]);return t},ir=(t,e)=>er(t,nr(e));function lr(t,e,n={}){let r;function o(){if(!r)return;const s=r;r=void 0,s()}function l(s){r=s}const u=(s,f)=>(o(),e(s,f,l)),c=V(t,u,n),{ignoreUpdates:d}=c,_=()=>{let s;return d(()=>{s=u(ur(t),cr(t))}),s};return ir(ar({},c),{trigger:_})}function ur(t){return i.isReactive(t)?t:Array.isArray(t)?t.map(e=>Yt(e)):Yt(t)}function Yt(t){return typeof t=="function"?t():i.unref(t)}function cr(t){return Array.isArray(t)?t.map(()=>{}):void 0}function sr(t,e,n){return i.watch(t,(r,o,l)=>{r&&e(r,o,l)},n)}a.__onlyVue27Plus=nt,a.__onlyVue3=re,a.assert=qt,a.autoResetRef=ct,a.bypassFilter=L,a.clamp=xt,a.computedEager=$,a.computedWithControl=rt,a.containsProp=ue,a.controlledComputed=rt,a.controlledRef=Ae,a.createEventHook=fe,a.createFilterWrapper=R,a.createGlobalState=de,a.createInjectionState=pe,a.createReactiveFn=J,a.createSharedComposable=ye,a.createSingletonPromise=ie,a.debounceFilter=z,a.debouncedRef=X,a.debouncedWatch=Ft,a.directiveHooks=oe,a.eagerComputed=$,a.extendRef=ot,a.formatDate=_t,a.get=_e,a.hasOwn=ne,a.identity=ae,a.ignorableWatch=V,a.increaseWithUnit=ce,a.invoke=le,a.isBoolean=Jt,a.isClient=M,a.isDef=Zt,a.isDefined=ve,a.isFunction=U,a.isIOS=ee,a.isNumber=Xt,a.isObject=Qt,a.isString=Kt,a.isWindow=Vt,a.makeDestructurable=Pe,a.noop=F,a.normalizeDate=vt,a.now=Dt,a.objectPick=se,a.pausableFilter=et,a.pausableWatch=Nt,a.promiseTimeout=q,a.rand=te,a.reactify=J,a.reactifyObject=me,a.reactiveComputed=ut,a.reactiveOmit=be,a.reactivePick=$e,a.refAutoReset=ct,a.refDebounced=X,a.refDefault=Se,a.refThrottled=K,a.refWithControl=dt,a.resolveRef=je,a.resolveUnref=y,a.set=Fe,a.syncRef=Ie,a.syncRefs=Te,a.throttleFilter=Z,a.throttledRef=K,a.throttledWatch=Bt,a.timestamp=tt,a.toReactive=lt,a.toRefs=Le,a.tryOnBeforeMount=Be,a.tryOnBeforeUnmount=He,a.tryOnMounted=ke,a.tryOnScopeDispose=j,a.tryOnUnmounted=Ye,a.until=Ge,a.useArrayEvery=ze,a.useArrayFilter=Ze,a.useArrayFind=qe,a.useArrayFindIndex=Je,a.useArrayFindLast=Ke,a.useArrayJoin=Qe,a.useArrayMap=Ve,a.useArrayReduce=De,a.useArraySome=xe,a.useArrayUnique=tn,a.useCounter=en,a.useDateFormat=an,a.useDebounce=X,a.useDebounceFn=st,a.useInterval=fn,a.useIntervalFn=ht,a.useLastChanged=dn,a.useThrottle=K,a.useThrottleFn=ft,a.useTimeout=hn,a.useTimeoutFn=gt,a.useToNumber=On,a.useToString=wn,a.useToggle=gn,a.watchArray=Pn,a.watchAtMost=Fn,a.watchDebounced=Ft,a.watchIgnorable=V,a.watchOnce=kn,a.watchPausable=Nt,a.watchThrottled=Bt,a.watchTriggerable=lr,a.watchWithFilter=C,a.whenever=sr})(this.VueUse=this.VueUse||{},VueDemi);
|
package/index.mjs
CHANGED
|
@@ -142,14 +142,14 @@ function throttleFilter(ms, trailing = true, leading = true, rejectOnCancel = fa
|
|
|
142
142
|
lastExec = Date.now();
|
|
143
143
|
invoke();
|
|
144
144
|
} else if (trailing) {
|
|
145
|
-
|
|
145
|
+
lastValue = new Promise((resolve, reject) => {
|
|
146
146
|
lastRejector = rejectOnCancel ? reject : resolve;
|
|
147
147
|
timer = setTimeout(() => {
|
|
148
148
|
lastExec = Date.now();
|
|
149
149
|
isLeading = true;
|
|
150
150
|
resolve(invoke());
|
|
151
151
|
clear();
|
|
152
|
-
}, duration - elapsed);
|
|
152
|
+
}, Math.max(0, duration - elapsed));
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
if (!leading && !timer)
|
|
@@ -171,7 +171,7 @@ function pausableFilter(extendFilter = bypassFilter) {
|
|
|
171
171
|
if (isActive.value)
|
|
172
172
|
extendFilter(...args);
|
|
173
173
|
};
|
|
174
|
-
return { isActive, pause, resume, eventFilter };
|
|
174
|
+
return { isActive: readonly(isActive), pause, resume, eventFilter };
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
function __onlyVue3(name = "this function") {
|
|
@@ -865,6 +865,18 @@ function useArrayFindIndex(list, fn) {
|
|
|
865
865
|
return computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
866
866
|
}
|
|
867
867
|
|
|
868
|
+
function findLast(arr, cb) {
|
|
869
|
+
let index = arr.length;
|
|
870
|
+
while (index-- > 0) {
|
|
871
|
+
if (cb(arr[index], index, arr))
|
|
872
|
+
return arr[index];
|
|
873
|
+
}
|
|
874
|
+
return void 0;
|
|
875
|
+
}
|
|
876
|
+
function useArrayFindLast(list, fn) {
|
|
877
|
+
return computed(() => resolveUnref(!Array.prototype.findLast ? findLast(resolveUnref(list), (element, index, array) => fn(resolveUnref(element), index, array)) : resolveUnref(list).findLast((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
878
|
+
}
|
|
879
|
+
|
|
868
880
|
function useArrayJoin(list, separator) {
|
|
869
881
|
return computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
870
882
|
}
|
|
@@ -993,13 +1005,14 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
993
1005
|
clean();
|
|
994
1006
|
}
|
|
995
1007
|
function resume() {
|
|
996
|
-
|
|
1008
|
+
const intervalValue = resolveUnref(interval);
|
|
1009
|
+
if (intervalValue <= 0)
|
|
997
1010
|
return;
|
|
998
1011
|
isActive.value = true;
|
|
999
1012
|
if (immediateCallback)
|
|
1000
1013
|
cb();
|
|
1001
1014
|
clean();
|
|
1002
|
-
timer = setInterval(cb,
|
|
1015
|
+
timer = setInterval(cb, intervalValue);
|
|
1003
1016
|
}
|
|
1004
1017
|
if (immediate && isClient)
|
|
1005
1018
|
resume();
|
|
@@ -1042,13 +1055,17 @@ function useInterval(interval = 1e3, options = {}) {
|
|
|
1042
1055
|
} = options;
|
|
1043
1056
|
const counter = ref(0);
|
|
1044
1057
|
const update = () => counter.value += 1;
|
|
1058
|
+
const reset = () => {
|
|
1059
|
+
counter.value = 0;
|
|
1060
|
+
};
|
|
1045
1061
|
const controls = useIntervalFn(callback ? () => {
|
|
1046
1062
|
update();
|
|
1047
1063
|
callback(counter.value);
|
|
1048
1064
|
} : update, interval, { immediate });
|
|
1049
1065
|
if (exposeControls) {
|
|
1050
1066
|
return __spreadValues$6({
|
|
1051
|
-
counter
|
|
1067
|
+
counter,
|
|
1068
|
+
reset
|
|
1052
1069
|
}, controls);
|
|
1053
1070
|
} else {
|
|
1054
1071
|
return counter;
|
|
@@ -1094,7 +1111,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1094
1111
|
}
|
|
1095
1112
|
tryOnScopeDispose(stop);
|
|
1096
1113
|
return {
|
|
1097
|
-
isPending,
|
|
1114
|
+
isPending: readonly(isPending),
|
|
1098
1115
|
start,
|
|
1099
1116
|
stop
|
|
1100
1117
|
};
|
|
@@ -1549,4 +1566,4 @@ function whenever(source, cb, options) {
|
|
|
1549
1566
|
}, options);
|
|
1550
1567
|
}
|
|
1551
1568
|
|
|
1552
|
-
export { __onlyVue27Plus, __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, useArrayUnique, 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 };
|
|
1569
|
+
export { __onlyVue27Plus, __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, useArrayFindLast, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, 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 };
|