@vueuse/shared 12.2.0 → 12.3.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 +65 -62
- package/index.d.cts +10 -5
- package/index.d.mts +10 -5
- package/index.d.ts +10 -5
- package/index.iife.js +65 -62
- package/index.iife.min.js +1 -1
- package/index.mjs +66 -64
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, isRef, unref, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue';
|
|
1
|
+
import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, isRef, unref, toValue as toValue$1, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue';
|
|
2
2
|
|
|
3
3
|
function computedEager(fn, options) {
|
|
4
4
|
var _a;
|
|
@@ -206,13 +206,8 @@ function makeDestructurable(obj, arr) {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
function toValue(r) {
|
|
210
|
-
return typeof r === "function" ? r() : unref(r);
|
|
211
|
-
}
|
|
212
|
-
const resolveUnref = toValue;
|
|
213
|
-
|
|
214
209
|
function reactify(fn, options) {
|
|
215
|
-
const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : toValue;
|
|
210
|
+
const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : toValue$1;
|
|
216
211
|
return function(...args) {
|
|
217
212
|
return computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
218
213
|
};
|
|
@@ -281,7 +276,7 @@ function reactiveComputed(fn) {
|
|
|
281
276
|
function reactiveOmit(obj, ...keys) {
|
|
282
277
|
const flatKeys = keys.flat();
|
|
283
278
|
const predicate = flatKeys[0];
|
|
284
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => !predicate(toValue(v), k))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
279
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => !predicate(toValue$1(v), k))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
285
280
|
}
|
|
286
281
|
|
|
287
282
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
@@ -332,8 +327,8 @@ function debounceFilter(ms, options = {}) {
|
|
|
332
327
|
lastRejector = noop;
|
|
333
328
|
};
|
|
334
329
|
const filter = (invoke) => {
|
|
335
|
-
const duration = toValue(ms);
|
|
336
|
-
const maxDuration = toValue(options.maxWait);
|
|
330
|
+
const duration = toValue$1(ms);
|
|
331
|
+
const maxDuration = toValue$1(options.maxWait);
|
|
337
332
|
if (timer)
|
|
338
333
|
_clearTimeout(timer);
|
|
339
334
|
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
@@ -386,7 +381,7 @@ function throttleFilter(...args) {
|
|
|
386
381
|
}
|
|
387
382
|
};
|
|
388
383
|
const filter = (_invoke) => {
|
|
389
|
-
const duration = toValue(ms);
|
|
384
|
+
const duration = toValue$1(ms);
|
|
390
385
|
const elapsed = Date.now() - lastExec;
|
|
391
386
|
const invoke = () => {
|
|
392
387
|
return lastValue = _invoke();
|
|
@@ -512,6 +507,9 @@ function objectEntries(obj) {
|
|
|
512
507
|
function getLifeCycleTarget(target) {
|
|
513
508
|
return target || getCurrentInstance();
|
|
514
509
|
}
|
|
510
|
+
function toArray(value) {
|
|
511
|
+
return Array.isArray(value) ? value : [value];
|
|
512
|
+
}
|
|
515
513
|
|
|
516
514
|
function toRef(...args) {
|
|
517
515
|
if (args.length !== 1)
|
|
@@ -524,17 +522,17 @@ const resolveRef = toRef;
|
|
|
524
522
|
function reactivePick(obj, ...keys) {
|
|
525
523
|
const flatKeys = keys.flat();
|
|
526
524
|
const predicate = flatKeys[0];
|
|
527
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
525
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue$1(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
528
526
|
}
|
|
529
527
|
|
|
530
528
|
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
531
529
|
return customRef((track, trigger) => {
|
|
532
|
-
let value = toValue(defaultValue);
|
|
530
|
+
let value = toValue$1(defaultValue);
|
|
533
531
|
let timer;
|
|
534
532
|
const resetAfter = () => setTimeout(() => {
|
|
535
|
-
value = toValue(defaultValue);
|
|
533
|
+
value = toValue$1(defaultValue);
|
|
536
534
|
trigger();
|
|
537
|
-
}, toValue(afterMs));
|
|
535
|
+
}, toValue$1(afterMs));
|
|
538
536
|
tryOnScopeDispose(() => {
|
|
539
537
|
clearTimeout(timer);
|
|
540
538
|
});
|
|
@@ -739,8 +737,7 @@ function syncRefs(source, targets, options = {}) {
|
|
|
739
737
|
deep = false,
|
|
740
738
|
immediate = true
|
|
741
739
|
} = options;
|
|
742
|
-
|
|
743
|
-
targets = [targets];
|
|
740
|
+
targets = toArray(targets);
|
|
744
741
|
return watch(
|
|
745
742
|
source,
|
|
746
743
|
(newValue) => targets.forEach((target) => target.value = newValue),
|
|
@@ -759,7 +756,7 @@ function toRefs(objectRef, options = {}) {
|
|
|
759
756
|
},
|
|
760
757
|
set(v) {
|
|
761
758
|
var _a;
|
|
762
|
-
const replaceRef = (_a = toValue(options.replaceRef)) != null ? _a : true;
|
|
759
|
+
const replaceRef = (_a = toValue$1(options.replaceRef)) != null ? _a : true;
|
|
763
760
|
if (replaceRef) {
|
|
764
761
|
if (Array.isArray(objectRef.value)) {
|
|
765
762
|
const copy = [...objectRef.value];
|
|
@@ -779,6 +776,9 @@ function toRefs(objectRef, options = {}) {
|
|
|
779
776
|
return result;
|
|
780
777
|
}
|
|
781
778
|
|
|
779
|
+
const toValue = toValue$1;
|
|
780
|
+
const resolveUnref = toValue$1;
|
|
781
|
+
|
|
782
782
|
function tryOnBeforeMount(fn, sync = true, target) {
|
|
783
783
|
const instance = getLifeCycleTarget(target);
|
|
784
784
|
if (instance)
|
|
@@ -836,7 +836,7 @@ function createUntil(r, isNot = false) {
|
|
|
836
836
|
const promises = [watcher];
|
|
837
837
|
if (timeout != null) {
|
|
838
838
|
promises.push(
|
|
839
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop == null ? void 0 : stop())
|
|
839
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => stop == null ? void 0 : stop())
|
|
840
840
|
);
|
|
841
841
|
}
|
|
842
842
|
return Promise.race(promises);
|
|
@@ -868,9 +868,9 @@ function createUntil(r, isNot = false) {
|
|
|
868
868
|
const promises = [watcher];
|
|
869
869
|
if (timeout != null) {
|
|
870
870
|
promises.push(
|
|
871
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
|
|
871
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => {
|
|
872
872
|
stop == null ? void 0 : stop();
|
|
873
|
-
return toValue(r);
|
|
873
|
+
return toValue$1(r);
|
|
874
874
|
})
|
|
875
875
|
);
|
|
876
876
|
}
|
|
@@ -891,7 +891,7 @@ function createUntil(r, isNot = false) {
|
|
|
891
891
|
function toContains(value, options) {
|
|
892
892
|
return toMatch((v) => {
|
|
893
893
|
const array = Array.from(v);
|
|
894
|
-
return array.includes(value) || array.includes(toValue(value));
|
|
894
|
+
return array.includes(value) || array.includes(toValue$1(value));
|
|
895
895
|
}, options);
|
|
896
896
|
}
|
|
897
897
|
function changed(options) {
|
|
@@ -904,7 +904,7 @@ function createUntil(r, isNot = false) {
|
|
|
904
904
|
return count >= n;
|
|
905
905
|
}, options);
|
|
906
906
|
}
|
|
907
|
-
if (Array.isArray(toValue(r))) {
|
|
907
|
+
if (Array.isArray(toValue$1(r))) {
|
|
908
908
|
const instance = {
|
|
909
909
|
toMatch,
|
|
910
910
|
toContains,
|
|
@@ -951,31 +951,31 @@ function useArrayDifference(...args) {
|
|
|
951
951
|
const key = compareFn;
|
|
952
952
|
compareFn = (value, othVal) => value[key] === othVal[key];
|
|
953
953
|
}
|
|
954
|
-
const diff1 = computed(() => toValue(list).filter((x) => toValue(values).findIndex((y) => compareFn(x, y)) === -1));
|
|
954
|
+
const diff1 = computed(() => toValue$1(list).filter((x) => toValue$1(values).findIndex((y) => compareFn(x, y)) === -1));
|
|
955
955
|
if (symmetric) {
|
|
956
|
-
const diff2 = computed(() => toValue(values).filter((x) => toValue(list).findIndex((y) => compareFn(x, y)) === -1));
|
|
957
|
-
return computed(() => symmetric ? [...toValue(diff1), ...toValue(diff2)] : toValue(diff1));
|
|
956
|
+
const diff2 = computed(() => toValue$1(values).filter((x) => toValue$1(list).findIndex((y) => compareFn(x, y)) === -1));
|
|
957
|
+
return computed(() => symmetric ? [...toValue$1(diff1), ...toValue$1(diff2)] : toValue$1(diff1));
|
|
958
958
|
} else {
|
|
959
959
|
return diff1;
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
|
|
963
963
|
function useArrayEvery(list, fn) {
|
|
964
|
-
return computed(() => toValue(list).every((element, index, array) => fn(toValue(element), index, array)));
|
|
964
|
+
return computed(() => toValue$1(list).every((element, index, array) => fn(toValue$1(element), index, array)));
|
|
965
965
|
}
|
|
966
966
|
|
|
967
967
|
function useArrayFilter(list, fn) {
|
|
968
|
-
return computed(() => toValue(list).map((i) => toValue(i)).filter(fn));
|
|
968
|
+
return computed(() => toValue$1(list).map((i) => toValue$1(i)).filter(fn));
|
|
969
969
|
}
|
|
970
970
|
|
|
971
971
|
function useArrayFind(list, fn) {
|
|
972
|
-
return computed(() => toValue(
|
|
973
|
-
toValue(list).find((element, index, array) => fn(toValue(element), index, array))
|
|
972
|
+
return computed(() => toValue$1(
|
|
973
|
+
toValue$1(list).find((element, index, array) => fn(toValue$1(element), index, array))
|
|
974
974
|
));
|
|
975
975
|
}
|
|
976
976
|
|
|
977
977
|
function useArrayFindIndex(list, fn) {
|
|
978
|
-
return computed(() => toValue(list).findIndex((element, index, array) => fn(toValue(element), index, array)));
|
|
978
|
+
return computed(() => toValue$1(list).findIndex((element, index, array) => fn(toValue$1(element), index, array)));
|
|
979
979
|
}
|
|
980
980
|
|
|
981
981
|
function findLast(arr, cb) {
|
|
@@ -987,8 +987,8 @@ function findLast(arr, cb) {
|
|
|
987
987
|
return void 0;
|
|
988
988
|
}
|
|
989
989
|
function useArrayFindLast(list, fn) {
|
|
990
|
-
return computed(() => toValue(
|
|
991
|
-
!Array.prototype.findLast ? findLast(toValue(list), (element, index, array) => fn(toValue(element), index, array)) : toValue(list).findLast((element, index, array) => fn(toValue(element), index, array))
|
|
990
|
+
return computed(() => toValue$1(
|
|
991
|
+
!Array.prototype.findLast ? findLast(toValue$1(list), (element, index, array) => fn(toValue$1(element), index, array)) : toValue$1(list).findLast((element, index, array) => fn(toValue$1(element), index, array))
|
|
992
992
|
));
|
|
993
993
|
}
|
|
994
994
|
|
|
@@ -1007,35 +1007,35 @@ function useArrayIncludes(...args) {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
if (typeof comparator === "string") {
|
|
1009
1009
|
const key = comparator;
|
|
1010
|
-
comparator = (element, value2) => element[key] === toValue(value2);
|
|
1010
|
+
comparator = (element, value2) => element[key] === toValue$1(value2);
|
|
1011
1011
|
}
|
|
1012
|
-
comparator = comparator != null ? comparator : (element, value2) => element === toValue(value2);
|
|
1013
|
-
return computed(() => toValue(list).slice(formIndex).some((element, index, array) => comparator(
|
|
1014
|
-
toValue(element),
|
|
1015
|
-
toValue(value),
|
|
1012
|
+
comparator = comparator != null ? comparator : (element, value2) => element === toValue$1(value2);
|
|
1013
|
+
return computed(() => toValue$1(list).slice(formIndex).some((element, index, array) => comparator(
|
|
1014
|
+
toValue$1(element),
|
|
1015
|
+
toValue$1(value),
|
|
1016
1016
|
index,
|
|
1017
|
-
toValue(array)
|
|
1017
|
+
toValue$1(array)
|
|
1018
1018
|
)));
|
|
1019
1019
|
}
|
|
1020
1020
|
|
|
1021
1021
|
function useArrayJoin(list, separator) {
|
|
1022
|
-
return computed(() => toValue(list).map((i) => toValue(i)).join(toValue(separator)));
|
|
1022
|
+
return computed(() => toValue$1(list).map((i) => toValue$1(i)).join(toValue$1(separator)));
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
1025
|
function useArrayMap(list, fn) {
|
|
1026
|
-
return computed(() => toValue(list).map((i) => toValue(i)).map(fn));
|
|
1026
|
+
return computed(() => toValue$1(list).map((i) => toValue$1(i)).map(fn));
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
1029
|
function useArrayReduce(list, reducer, ...args) {
|
|
1030
|
-
const reduceCallback = (sum, value, index) => reducer(toValue(sum), toValue(value), index);
|
|
1030
|
+
const reduceCallback = (sum, value, index) => reducer(toValue$1(sum), toValue$1(value), index);
|
|
1031
1031
|
return computed(() => {
|
|
1032
|
-
const resolved = toValue(list);
|
|
1033
|
-
return args.length ? resolved.reduce(reduceCallback, typeof args[0] === "function" ? toValue(args[0]()) : toValue(args[0])) : resolved.reduce(reduceCallback);
|
|
1032
|
+
const resolved = toValue$1(list);
|
|
1033
|
+
return args.length ? resolved.reduce(reduceCallback, typeof args[0] === "function" ? toValue$1(args[0]()) : toValue$1(args[0])) : resolved.reduce(reduceCallback);
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
1036
1036
|
|
|
1037
1037
|
function useArraySome(list, fn) {
|
|
1038
|
-
return computed(() => toValue(list).some((element, index, array) => fn(toValue(element), index, array)));
|
|
1038
|
+
return computed(() => toValue$1(list).some((element, index, array) => fn(toValue$1(element), index, array)));
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
1041
|
function uniq(array) {
|
|
@@ -1050,7 +1050,7 @@ function uniqueElementsBy(array, fn) {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
function useArrayUnique(list, compareFn) {
|
|
1052
1052
|
return computed(() => {
|
|
1053
|
-
const resolvedList = toValue(list).map((element) => toValue(element));
|
|
1053
|
+
const resolvedList = toValue$1(list).map((element) => toValue$1(element));
|
|
1054
1054
|
return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
@@ -1104,8 +1104,8 @@ function formatDate(date, formatStr, options = {}) {
|
|
|
1104
1104
|
M: () => month + 1,
|
|
1105
1105
|
Mo: () => formatOrdinal(month + 1),
|
|
1106
1106
|
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
1107
|
-
MMM: () => date.toLocaleDateString(toValue(options.locales), { month: "short" }),
|
|
1108
|
-
MMMM: () => date.toLocaleDateString(toValue(options.locales), { month: "long" }),
|
|
1107
|
+
MMM: () => date.toLocaleDateString(toValue$1(options.locales), { month: "short" }),
|
|
1108
|
+
MMMM: () => date.toLocaleDateString(toValue$1(options.locales), { month: "long" }),
|
|
1109
1109
|
D: () => String(days),
|
|
1110
1110
|
Do: () => formatOrdinal(days),
|
|
1111
1111
|
DD: () => `${days}`.padStart(2, "0"),
|
|
@@ -1123,9 +1123,9 @@ function formatDate(date, formatStr, options = {}) {
|
|
|
1123
1123
|
ss: () => `${seconds}`.padStart(2, "0"),
|
|
1124
1124
|
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
1125
1125
|
d: () => day,
|
|
1126
|
-
dd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "narrow" }),
|
|
1127
|
-
ddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "short" }),
|
|
1128
|
-
dddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "long" }),
|
|
1126
|
+
dd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: "narrow" }),
|
|
1127
|
+
ddd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: "short" }),
|
|
1128
|
+
dddd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: "long" }),
|
|
1129
1129
|
A: () => meridiem(hours, minutes),
|
|
1130
1130
|
AA: () => meridiem(hours, minutes, false, true),
|
|
1131
1131
|
a: () => meridiem(hours, minutes, true),
|
|
@@ -1154,7 +1154,7 @@ function normalizeDate(date) {
|
|
|
1154
1154
|
return new Date(date);
|
|
1155
1155
|
}
|
|
1156
1156
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
1157
|
-
return computed(() => formatDate(normalizeDate(toValue(date)), toValue(formatStr), options));
|
|
1157
|
+
return computed(() => formatDate(normalizeDate(toValue$1(date)), toValue$1(formatStr), options));
|
|
1158
1158
|
}
|
|
1159
1159
|
|
|
1160
1160
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1175,7 +1175,7 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
1175
1175
|
clean();
|
|
1176
1176
|
}
|
|
1177
1177
|
function resume() {
|
|
1178
|
-
const intervalValue = toValue(interval);
|
|
1178
|
+
const intervalValue = toValue$1(interval);
|
|
1179
1179
|
if (intervalValue <= 0)
|
|
1180
1180
|
return;
|
|
1181
1181
|
isActive.value = true;
|
|
@@ -1266,7 +1266,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1266
1266
|
isPending.value = false;
|
|
1267
1267
|
timer = null;
|
|
1268
1268
|
cb(...args);
|
|
1269
|
-
}, toValue(interval));
|
|
1269
|
+
}, toValue$1(interval));
|
|
1270
1270
|
}
|
|
1271
1271
|
if (immediate) {
|
|
1272
1272
|
isPending.value = true;
|
|
@@ -1309,8 +1309,10 @@ function useToNumber(value, options = {}) {
|
|
|
1309
1309
|
nanToZero
|
|
1310
1310
|
} = options;
|
|
1311
1311
|
return computed(() => {
|
|
1312
|
-
let resolved = toValue(value);
|
|
1313
|
-
if (typeof
|
|
1312
|
+
let resolved = toValue$1(value);
|
|
1313
|
+
if (typeof method === "function")
|
|
1314
|
+
resolved = method(resolved);
|
|
1315
|
+
else if (typeof resolved === "string")
|
|
1314
1316
|
resolved = Number[method](resolved, radix);
|
|
1315
1317
|
if (nanToZero && Number.isNaN(resolved))
|
|
1316
1318
|
resolved = 0;
|
|
@@ -1319,7 +1321,7 @@ function useToNumber(value, options = {}) {
|
|
|
1319
1321
|
}
|
|
1320
1322
|
|
|
1321
1323
|
function useToString(value) {
|
|
1322
|
-
return computed(() => `${toValue(value)}`);
|
|
1324
|
+
return computed(() => `${toValue$1(value)}`);
|
|
1323
1325
|
}
|
|
1324
1326
|
|
|
1325
1327
|
function useToggle(initialValue = false, options = {}) {
|
|
@@ -1334,8 +1336,8 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1334
1336
|
_value.value = value;
|
|
1335
1337
|
return _value.value;
|
|
1336
1338
|
} else {
|
|
1337
|
-
const truthy = toValue(truthyValue);
|
|
1338
|
-
_value.value = _value.value === truthy ? toValue(falsyValue) : truthy;
|
|
1339
|
+
const truthy = toValue$1(truthyValue);
|
|
1340
|
+
_value.value = _value.value === truthy ? toValue$1(falsyValue) : truthy;
|
|
1339
1341
|
return _value.value;
|
|
1340
1342
|
}
|
|
1341
1343
|
}
|
|
@@ -1346,7 +1348,7 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1346
1348
|
}
|
|
1347
1349
|
|
|
1348
1350
|
function watchArray(source, cb, options) {
|
|
1349
|
-
let oldList = (options == null ? void 0 : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : toValue(source)];
|
|
1351
|
+
let oldList = (options == null ? void 0 : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : toValue$1(source)];
|
|
1350
1352
|
return watch(source, (newList, _, onCleanup) => {
|
|
1351
1353
|
const oldListRemains = Array.from({ length: oldList.length });
|
|
1352
1354
|
const added = [];
|
|
@@ -1378,7 +1380,7 @@ function watchAtMost(source, cb, options) {
|
|
|
1378
1380
|
source,
|
|
1379
1381
|
(...args) => {
|
|
1380
1382
|
current.value += 1;
|
|
1381
|
-
if (current.value >= toValue(count))
|
|
1383
|
+
if (current.value >= toValue$1(count))
|
|
1382
1384
|
nextTick(() => stop());
|
|
1383
1385
|
cb(...args);
|
|
1384
1386
|
},
|
|
@@ -1555,8 +1557,8 @@ function getWatchSources(sources) {
|
|
|
1555
1557
|
if (isReactive(sources))
|
|
1556
1558
|
return sources;
|
|
1557
1559
|
if (Array.isArray(sources))
|
|
1558
|
-
return sources.map((item) => toValue(item));
|
|
1559
|
-
return toValue(sources);
|
|
1560
|
+
return sources.map((item) => toValue$1(item));
|
|
1561
|
+
return toValue$1(sources);
|
|
1560
1562
|
}
|
|
1561
1563
|
function getOldValue(source) {
|
|
1562
1564
|
return Array.isArray(source) ? source.map(() => void 0) : void 0;
|
|
@@ -1580,4 +1582,4 @@ function whenever(source, cb, options) {
|
|
|
1580
1582
|
return stop;
|
|
1581
1583
|
}
|
|
1582
1584
|
|
|
1583
|
-
export { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, pxValue, 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, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, 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, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
|
1585
|
+
export { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, 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, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|