@vueuse/shared 12.2.0-beta.4 → 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.cjs
CHANGED
|
@@ -208,13 +208,8 @@ function makeDestructurable(obj, arr) {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
function toValue(r) {
|
|
212
|
-
return typeof r === "function" ? r() : vue.unref(r);
|
|
213
|
-
}
|
|
214
|
-
const resolveUnref = toValue;
|
|
215
|
-
|
|
216
211
|
function reactify(fn, options) {
|
|
217
|
-
const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? vue.unref : toValue;
|
|
212
|
+
const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? vue.unref : vue.toValue;
|
|
218
213
|
return function(...args) {
|
|
219
214
|
return vue.computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
220
215
|
};
|
|
@@ -283,7 +278,7 @@ function reactiveComputed(fn) {
|
|
|
283
278
|
function reactiveOmit(obj, ...keys) {
|
|
284
279
|
const flatKeys = keys.flat();
|
|
285
280
|
const predicate = flatKeys[0];
|
|
286
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => !predicate(toValue(v), k))) : Object.fromEntries(Object.entries(vue.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
281
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => !predicate(vue.toValue(v), k))) : Object.fromEntries(Object.entries(vue.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
287
282
|
}
|
|
288
283
|
|
|
289
284
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
@@ -334,8 +329,8 @@ function debounceFilter(ms, options = {}) {
|
|
|
334
329
|
lastRejector = noop;
|
|
335
330
|
};
|
|
336
331
|
const filter = (invoke) => {
|
|
337
|
-
const duration = toValue(ms);
|
|
338
|
-
const maxDuration = toValue(options.maxWait);
|
|
332
|
+
const duration = vue.toValue(ms);
|
|
333
|
+
const maxDuration = vue.toValue(options.maxWait);
|
|
339
334
|
if (timer)
|
|
340
335
|
_clearTimeout(timer);
|
|
341
336
|
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
@@ -388,7 +383,7 @@ function throttleFilter(...args) {
|
|
|
388
383
|
}
|
|
389
384
|
};
|
|
390
385
|
const filter = (_invoke) => {
|
|
391
|
-
const duration = toValue(ms);
|
|
386
|
+
const duration = vue.toValue(ms);
|
|
392
387
|
const elapsed = Date.now() - lastExec;
|
|
393
388
|
const invoke = () => {
|
|
394
389
|
return lastValue = _invoke();
|
|
@@ -514,6 +509,9 @@ function objectEntries(obj) {
|
|
|
514
509
|
function getLifeCycleTarget(target) {
|
|
515
510
|
return target || vue.getCurrentInstance();
|
|
516
511
|
}
|
|
512
|
+
function toArray(value) {
|
|
513
|
+
return Array.isArray(value) ? value : [value];
|
|
514
|
+
}
|
|
517
515
|
|
|
518
516
|
function toRef(...args) {
|
|
519
517
|
if (args.length !== 1)
|
|
@@ -526,17 +524,17 @@ const resolveRef = toRef;
|
|
|
526
524
|
function reactivePick(obj, ...keys) {
|
|
527
525
|
const flatKeys = keys.flat();
|
|
528
526
|
const predicate = flatKeys[0];
|
|
529
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => predicate(toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
527
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => predicate(vue.toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
530
528
|
}
|
|
531
529
|
|
|
532
530
|
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
533
531
|
return vue.customRef((track, trigger) => {
|
|
534
|
-
let value = toValue(defaultValue);
|
|
532
|
+
let value = vue.toValue(defaultValue);
|
|
535
533
|
let timer;
|
|
536
534
|
const resetAfter = () => setTimeout(() => {
|
|
537
|
-
value = toValue(defaultValue);
|
|
535
|
+
value = vue.toValue(defaultValue);
|
|
538
536
|
trigger();
|
|
539
|
-
}, toValue(afterMs));
|
|
537
|
+
}, vue.toValue(afterMs));
|
|
540
538
|
tryOnScopeDispose(() => {
|
|
541
539
|
clearTimeout(timer);
|
|
542
540
|
});
|
|
@@ -741,8 +739,7 @@ function syncRefs(source, targets, options = {}) {
|
|
|
741
739
|
deep = false,
|
|
742
740
|
immediate = true
|
|
743
741
|
} = options;
|
|
744
|
-
|
|
745
|
-
targets = [targets];
|
|
742
|
+
targets = toArray(targets);
|
|
746
743
|
return vue.watch(
|
|
747
744
|
source,
|
|
748
745
|
(newValue) => targets.forEach((target) => target.value = newValue),
|
|
@@ -761,7 +758,7 @@ function toRefs(objectRef, options = {}) {
|
|
|
761
758
|
},
|
|
762
759
|
set(v) {
|
|
763
760
|
var _a;
|
|
764
|
-
const replaceRef = (_a = toValue(options.replaceRef)) != null ? _a : true;
|
|
761
|
+
const replaceRef = (_a = vue.toValue(options.replaceRef)) != null ? _a : true;
|
|
765
762
|
if (replaceRef) {
|
|
766
763
|
if (Array.isArray(objectRef.value)) {
|
|
767
764
|
const copy = [...objectRef.value];
|
|
@@ -781,6 +778,9 @@ function toRefs(objectRef, options = {}) {
|
|
|
781
778
|
return result;
|
|
782
779
|
}
|
|
783
780
|
|
|
781
|
+
const toValue = vue.toValue;
|
|
782
|
+
const resolveUnref = vue.toValue;
|
|
783
|
+
|
|
784
784
|
function tryOnBeforeMount(fn, sync = true, target) {
|
|
785
785
|
const instance = getLifeCycleTarget(target);
|
|
786
786
|
if (instance)
|
|
@@ -838,7 +838,7 @@ function createUntil(r, isNot = false) {
|
|
|
838
838
|
const promises = [watcher];
|
|
839
839
|
if (timeout != null) {
|
|
840
840
|
promises.push(
|
|
841
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop == null ? void 0 : stop())
|
|
841
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => stop == null ? void 0 : stop())
|
|
842
842
|
);
|
|
843
843
|
}
|
|
844
844
|
return Promise.race(promises);
|
|
@@ -870,9 +870,9 @@ function createUntil(r, isNot = false) {
|
|
|
870
870
|
const promises = [watcher];
|
|
871
871
|
if (timeout != null) {
|
|
872
872
|
promises.push(
|
|
873
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
|
|
873
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => {
|
|
874
874
|
stop == null ? void 0 : stop();
|
|
875
|
-
return toValue(r);
|
|
875
|
+
return vue.toValue(r);
|
|
876
876
|
})
|
|
877
877
|
);
|
|
878
878
|
}
|
|
@@ -893,7 +893,7 @@ function createUntil(r, isNot = false) {
|
|
|
893
893
|
function toContains(value, options) {
|
|
894
894
|
return toMatch((v) => {
|
|
895
895
|
const array = Array.from(v);
|
|
896
|
-
return array.includes(value) || array.includes(toValue(value));
|
|
896
|
+
return array.includes(value) || array.includes(vue.toValue(value));
|
|
897
897
|
}, options);
|
|
898
898
|
}
|
|
899
899
|
function changed(options) {
|
|
@@ -906,7 +906,7 @@ function createUntil(r, isNot = false) {
|
|
|
906
906
|
return count >= n;
|
|
907
907
|
}, options);
|
|
908
908
|
}
|
|
909
|
-
if (Array.isArray(toValue(r))) {
|
|
909
|
+
if (Array.isArray(vue.toValue(r))) {
|
|
910
910
|
const instance = {
|
|
911
911
|
toMatch,
|
|
912
912
|
toContains,
|
|
@@ -953,31 +953,31 @@ function useArrayDifference(...args) {
|
|
|
953
953
|
const key = compareFn;
|
|
954
954
|
compareFn = (value, othVal) => value[key] === othVal[key];
|
|
955
955
|
}
|
|
956
|
-
const diff1 = vue.computed(() => toValue(list).filter((x) => toValue(values).findIndex((y) => compareFn(x, y)) === -1));
|
|
956
|
+
const diff1 = vue.computed(() => vue.toValue(list).filter((x) => vue.toValue(values).findIndex((y) => compareFn(x, y)) === -1));
|
|
957
957
|
if (symmetric) {
|
|
958
|
-
const diff2 = vue.computed(() => toValue(values).filter((x) => toValue(list).findIndex((y) => compareFn(x, y)) === -1));
|
|
959
|
-
return vue.computed(() => symmetric ? [...toValue(diff1), ...toValue(diff2)] : toValue(diff1));
|
|
958
|
+
const diff2 = vue.computed(() => vue.toValue(values).filter((x) => vue.toValue(list).findIndex((y) => compareFn(x, y)) === -1));
|
|
959
|
+
return vue.computed(() => symmetric ? [...vue.toValue(diff1), ...vue.toValue(diff2)] : vue.toValue(diff1));
|
|
960
960
|
} else {
|
|
961
961
|
return diff1;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
964
|
|
|
965
965
|
function useArrayEvery(list, fn) {
|
|
966
|
-
return vue.computed(() => toValue(list).every((element, index, array) => fn(toValue(element), index, array)));
|
|
966
|
+
return vue.computed(() => vue.toValue(list).every((element, index, array) => fn(vue.toValue(element), index, array)));
|
|
967
967
|
}
|
|
968
968
|
|
|
969
969
|
function useArrayFilter(list, fn) {
|
|
970
|
-
return vue.computed(() => toValue(list).map((i) => toValue(i)).filter(fn));
|
|
970
|
+
return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).filter(fn));
|
|
971
971
|
}
|
|
972
972
|
|
|
973
973
|
function useArrayFind(list, fn) {
|
|
974
|
-
return vue.computed(() => toValue(
|
|
975
|
-
toValue(list).find((element, index, array) => fn(toValue(element), index, array))
|
|
974
|
+
return vue.computed(() => vue.toValue(
|
|
975
|
+
vue.toValue(list).find((element, index, array) => fn(vue.toValue(element), index, array))
|
|
976
976
|
));
|
|
977
977
|
}
|
|
978
978
|
|
|
979
979
|
function useArrayFindIndex(list, fn) {
|
|
980
|
-
return vue.computed(() => toValue(list).findIndex((element, index, array) => fn(toValue(element), index, array)));
|
|
980
|
+
return vue.computed(() => vue.toValue(list).findIndex((element, index, array) => fn(vue.toValue(element), index, array)));
|
|
981
981
|
}
|
|
982
982
|
|
|
983
983
|
function findLast(arr, cb) {
|
|
@@ -989,8 +989,8 @@ function findLast(arr, cb) {
|
|
|
989
989
|
return void 0;
|
|
990
990
|
}
|
|
991
991
|
function useArrayFindLast(list, fn) {
|
|
992
|
-
return vue.computed(() => toValue(
|
|
993
|
-
!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))
|
|
992
|
+
return vue.computed(() => vue.toValue(
|
|
993
|
+
!Array.prototype.findLast ? findLast(vue.toValue(list), (element, index, array) => fn(vue.toValue(element), index, array)) : vue.toValue(list).findLast((element, index, array) => fn(vue.toValue(element), index, array))
|
|
994
994
|
));
|
|
995
995
|
}
|
|
996
996
|
|
|
@@ -1009,35 +1009,35 @@ function useArrayIncludes(...args) {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
if (typeof comparator === "string") {
|
|
1011
1011
|
const key = comparator;
|
|
1012
|
-
comparator = (element, value2) => element[key] === toValue(value2);
|
|
1012
|
+
comparator = (element, value2) => element[key] === vue.toValue(value2);
|
|
1013
1013
|
}
|
|
1014
|
-
comparator = comparator != null ? comparator : (element, value2) => element === toValue(value2);
|
|
1015
|
-
return vue.computed(() => toValue(list).slice(formIndex).some((element, index, array) => comparator(
|
|
1016
|
-
toValue(element),
|
|
1017
|
-
toValue(value),
|
|
1014
|
+
comparator = comparator != null ? comparator : (element, value2) => element === vue.toValue(value2);
|
|
1015
|
+
return vue.computed(() => vue.toValue(list).slice(formIndex).some((element, index, array) => comparator(
|
|
1016
|
+
vue.toValue(element),
|
|
1017
|
+
vue.toValue(value),
|
|
1018
1018
|
index,
|
|
1019
|
-
toValue(array)
|
|
1019
|
+
vue.toValue(array)
|
|
1020
1020
|
)));
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
1023
|
function useArrayJoin(list, separator) {
|
|
1024
|
-
return vue.computed(() => toValue(list).map((i) => toValue(i)).join(toValue(separator)));
|
|
1024
|
+
return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).join(vue.toValue(separator)));
|
|
1025
1025
|
}
|
|
1026
1026
|
|
|
1027
1027
|
function useArrayMap(list, fn) {
|
|
1028
|
-
return vue.computed(() => toValue(list).map((i) => toValue(i)).map(fn));
|
|
1028
|
+
return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).map(fn));
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
1031
1031
|
function useArrayReduce(list, reducer, ...args) {
|
|
1032
|
-
const reduceCallback = (sum, value, index) => reducer(toValue(sum), toValue(value), index);
|
|
1032
|
+
const reduceCallback = (sum, value, index) => reducer(vue.toValue(sum), vue.toValue(value), index);
|
|
1033
1033
|
return vue.computed(() => {
|
|
1034
|
-
const resolved = toValue(list);
|
|
1035
|
-
return args.length ? resolved.reduce(reduceCallback, typeof args[0] === "function" ? toValue(args[0]()) : toValue(args[0])) : resolved.reduce(reduceCallback);
|
|
1034
|
+
const resolved = vue.toValue(list);
|
|
1035
|
+
return args.length ? resolved.reduce(reduceCallback, typeof args[0] === "function" ? vue.toValue(args[0]()) : vue.toValue(args[0])) : resolved.reduce(reduceCallback);
|
|
1036
1036
|
});
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
1039
|
function useArraySome(list, fn) {
|
|
1040
|
-
return vue.computed(() => toValue(list).some((element, index, array) => fn(toValue(element), index, array)));
|
|
1040
|
+
return vue.computed(() => vue.toValue(list).some((element, index, array) => fn(vue.toValue(element), index, array)));
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
1043
|
function uniq(array) {
|
|
@@ -1052,7 +1052,7 @@ function uniqueElementsBy(array, fn) {
|
|
|
1052
1052
|
}
|
|
1053
1053
|
function useArrayUnique(list, compareFn) {
|
|
1054
1054
|
return vue.computed(() => {
|
|
1055
|
-
const resolvedList = toValue(list).map((element) => toValue(element));
|
|
1055
|
+
const resolvedList = vue.toValue(list).map((element) => vue.toValue(element));
|
|
1056
1056
|
return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);
|
|
1057
1057
|
});
|
|
1058
1058
|
}
|
|
@@ -1106,8 +1106,8 @@ function formatDate(date, formatStr, options = {}) {
|
|
|
1106
1106
|
M: () => month + 1,
|
|
1107
1107
|
Mo: () => formatOrdinal(month + 1),
|
|
1108
1108
|
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
1109
|
-
MMM: () => date.toLocaleDateString(toValue(options.locales), { month: "short" }),
|
|
1110
|
-
MMMM: () => date.toLocaleDateString(toValue(options.locales), { month: "long" }),
|
|
1109
|
+
MMM: () => date.toLocaleDateString(vue.toValue(options.locales), { month: "short" }),
|
|
1110
|
+
MMMM: () => date.toLocaleDateString(vue.toValue(options.locales), { month: "long" }),
|
|
1111
1111
|
D: () => String(days),
|
|
1112
1112
|
Do: () => formatOrdinal(days),
|
|
1113
1113
|
DD: () => `${days}`.padStart(2, "0"),
|
|
@@ -1125,9 +1125,9 @@ function formatDate(date, formatStr, options = {}) {
|
|
|
1125
1125
|
ss: () => `${seconds}`.padStart(2, "0"),
|
|
1126
1126
|
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
1127
1127
|
d: () => day,
|
|
1128
|
-
dd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "narrow" }),
|
|
1129
|
-
ddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "short" }),
|
|
1130
|
-
dddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "long" }),
|
|
1128
|
+
dd: () => date.toLocaleDateString(vue.toValue(options.locales), { weekday: "narrow" }),
|
|
1129
|
+
ddd: () => date.toLocaleDateString(vue.toValue(options.locales), { weekday: "short" }),
|
|
1130
|
+
dddd: () => date.toLocaleDateString(vue.toValue(options.locales), { weekday: "long" }),
|
|
1131
1131
|
A: () => meridiem(hours, minutes),
|
|
1132
1132
|
AA: () => meridiem(hours, minutes, false, true),
|
|
1133
1133
|
a: () => meridiem(hours, minutes, true),
|
|
@@ -1156,7 +1156,7 @@ function normalizeDate(date) {
|
|
|
1156
1156
|
return new Date(date);
|
|
1157
1157
|
}
|
|
1158
1158
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
1159
|
-
return vue.computed(() => formatDate(normalizeDate(toValue(date)), toValue(formatStr), options));
|
|
1159
|
+
return vue.computed(() => formatDate(normalizeDate(vue.toValue(date)), vue.toValue(formatStr), options));
|
|
1160
1160
|
}
|
|
1161
1161
|
|
|
1162
1162
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1177,7 +1177,7 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
1177
1177
|
clean();
|
|
1178
1178
|
}
|
|
1179
1179
|
function resume() {
|
|
1180
|
-
const intervalValue = toValue(interval);
|
|
1180
|
+
const intervalValue = vue.toValue(interval);
|
|
1181
1181
|
if (intervalValue <= 0)
|
|
1182
1182
|
return;
|
|
1183
1183
|
isActive.value = true;
|
|
@@ -1268,7 +1268,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1268
1268
|
isPending.value = false;
|
|
1269
1269
|
timer = null;
|
|
1270
1270
|
cb(...args);
|
|
1271
|
-
}, toValue(interval));
|
|
1271
|
+
}, vue.toValue(interval));
|
|
1272
1272
|
}
|
|
1273
1273
|
if (immediate) {
|
|
1274
1274
|
isPending.value = true;
|
|
@@ -1311,8 +1311,10 @@ function useToNumber(value, options = {}) {
|
|
|
1311
1311
|
nanToZero
|
|
1312
1312
|
} = options;
|
|
1313
1313
|
return vue.computed(() => {
|
|
1314
|
-
let resolved = toValue(value);
|
|
1315
|
-
if (typeof
|
|
1314
|
+
let resolved = vue.toValue(value);
|
|
1315
|
+
if (typeof method === "function")
|
|
1316
|
+
resolved = method(resolved);
|
|
1317
|
+
else if (typeof resolved === "string")
|
|
1316
1318
|
resolved = Number[method](resolved, radix);
|
|
1317
1319
|
if (nanToZero && Number.isNaN(resolved))
|
|
1318
1320
|
resolved = 0;
|
|
@@ -1321,7 +1323,7 @@ function useToNumber(value, options = {}) {
|
|
|
1321
1323
|
}
|
|
1322
1324
|
|
|
1323
1325
|
function useToString(value) {
|
|
1324
|
-
return vue.computed(() => `${toValue(value)}`);
|
|
1326
|
+
return vue.computed(() => `${vue.toValue(value)}`);
|
|
1325
1327
|
}
|
|
1326
1328
|
|
|
1327
1329
|
function useToggle(initialValue = false, options = {}) {
|
|
@@ -1336,8 +1338,8 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1336
1338
|
_value.value = value;
|
|
1337
1339
|
return _value.value;
|
|
1338
1340
|
} else {
|
|
1339
|
-
const truthy = toValue(truthyValue);
|
|
1340
|
-
_value.value = _value.value === truthy ? toValue(falsyValue) : truthy;
|
|
1341
|
+
const truthy = vue.toValue(truthyValue);
|
|
1342
|
+
_value.value = _value.value === truthy ? vue.toValue(falsyValue) : truthy;
|
|
1341
1343
|
return _value.value;
|
|
1342
1344
|
}
|
|
1343
1345
|
}
|
|
@@ -1348,7 +1350,7 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1348
1350
|
}
|
|
1349
1351
|
|
|
1350
1352
|
function watchArray(source, cb, options) {
|
|
1351
|
-
let oldList = (options == null ? void 0 : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : toValue(source)];
|
|
1353
|
+
let oldList = (options == null ? void 0 : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : vue.toValue(source)];
|
|
1352
1354
|
return vue.watch(source, (newList, _, onCleanup) => {
|
|
1353
1355
|
const oldListRemains = Array.from({ length: oldList.length });
|
|
1354
1356
|
const added = [];
|
|
@@ -1380,7 +1382,7 @@ function watchAtMost(source, cb, options) {
|
|
|
1380
1382
|
source,
|
|
1381
1383
|
(...args) => {
|
|
1382
1384
|
current.value += 1;
|
|
1383
|
-
if (current.value >= toValue(count))
|
|
1385
|
+
if (current.value >= vue.toValue(count))
|
|
1384
1386
|
vue.nextTick(() => stop());
|
|
1385
1387
|
cb(...args);
|
|
1386
1388
|
},
|
|
@@ -1557,8 +1559,8 @@ function getWatchSources(sources) {
|
|
|
1557
1559
|
if (vue.isReactive(sources))
|
|
1558
1560
|
return sources;
|
|
1559
1561
|
if (Array.isArray(sources))
|
|
1560
|
-
return sources.map((item) => toValue(item));
|
|
1561
|
-
return toValue(sources);
|
|
1562
|
+
return sources.map((item) => vue.toValue(item));
|
|
1563
|
+
return vue.toValue(sources);
|
|
1562
1564
|
}
|
|
1563
1565
|
function getOldValue(source) {
|
|
1564
1566
|
return Array.isArray(source) ? source.map(() => void 0) : void 0;
|
|
@@ -1653,6 +1655,7 @@ exports.throttleFilter = throttleFilter;
|
|
|
1653
1655
|
exports.throttledRef = refThrottled;
|
|
1654
1656
|
exports.throttledWatch = watchThrottled;
|
|
1655
1657
|
exports.timestamp = timestamp;
|
|
1658
|
+
exports.toArray = toArray;
|
|
1656
1659
|
exports.toReactive = toReactive;
|
|
1657
1660
|
exports.toRef = toRef;
|
|
1658
1661
|
exports.toRefs = toRefs;
|
package/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, MaybeRef, WatchOptions, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue';
|
|
2
|
+
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, MaybeRef, WatchOptions, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
3
|
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -301,6 +301,7 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
301
301
|
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
302
302
|
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
303
303
|
declare function getLifeCycleTarget(target?: any): any;
|
|
304
|
+
declare function toArray<T>(value: T): T extends readonly any[] ? T : [T];
|
|
304
305
|
|
|
305
306
|
/**
|
|
306
307
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
@@ -644,12 +645,14 @@ declare function toRefs<T extends object>(objectRef: MaybeRef<T>, options?: ToRe
|
|
|
644
645
|
|
|
645
646
|
/**
|
|
646
647
|
* Get the value of value/ref/getter.
|
|
648
|
+
*
|
|
649
|
+
* @deprecated use `toValue` from `vue` instead
|
|
647
650
|
*/
|
|
648
|
-
declare
|
|
651
|
+
declare const toValue: typeof toValue$1;
|
|
649
652
|
/**
|
|
650
653
|
* @deprecated use `toValue` instead
|
|
651
654
|
*/
|
|
652
|
-
declare const resolveUnref: typeof toValue;
|
|
655
|
+
declare const resolveUnref: typeof toValue$1;
|
|
653
656
|
|
|
654
657
|
/**
|
|
655
658
|
* Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
|
|
@@ -1091,9 +1094,11 @@ interface UseToNumberOptions {
|
|
|
1091
1094
|
/**
|
|
1092
1095
|
* Method to use to convert the value to a number.
|
|
1093
1096
|
*
|
|
1097
|
+
* Or a custom function for the conversion.
|
|
1098
|
+
*
|
|
1094
1099
|
* @default 'parseFloat'
|
|
1095
1100
|
*/
|
|
1096
|
-
method?: 'parseFloat' | 'parseInt';
|
|
1101
|
+
method?: 'parseFloat' | 'parseInt' | ((value: string | number) => number);
|
|
1097
1102
|
/**
|
|
1098
1103
|
* The base in mathematical numeral systems passed to `parseInt`.
|
|
1099
1104
|
* Only works with `method: 'parseInt'`
|
|
@@ -1220,4 +1225,4 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1220
1225
|
*/
|
|
1221
1226
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1222
1227
|
|
|
1223
|
-
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|
|
1228
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, MaybeRef, WatchOptions, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue';
|
|
2
|
+
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, MaybeRef, WatchOptions, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
3
|
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -301,6 +301,7 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
301
301
|
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
302
302
|
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
303
303
|
declare function getLifeCycleTarget(target?: any): any;
|
|
304
|
+
declare function toArray<T>(value: T): T extends readonly any[] ? T : [T];
|
|
304
305
|
|
|
305
306
|
/**
|
|
306
307
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
@@ -644,12 +645,14 @@ declare function toRefs<T extends object>(objectRef: MaybeRef<T>, options?: ToRe
|
|
|
644
645
|
|
|
645
646
|
/**
|
|
646
647
|
* Get the value of value/ref/getter.
|
|
648
|
+
*
|
|
649
|
+
* @deprecated use `toValue` from `vue` instead
|
|
647
650
|
*/
|
|
648
|
-
declare
|
|
651
|
+
declare const toValue: typeof toValue$1;
|
|
649
652
|
/**
|
|
650
653
|
* @deprecated use `toValue` instead
|
|
651
654
|
*/
|
|
652
|
-
declare const resolveUnref: typeof toValue;
|
|
655
|
+
declare const resolveUnref: typeof toValue$1;
|
|
653
656
|
|
|
654
657
|
/**
|
|
655
658
|
* Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
|
|
@@ -1091,9 +1094,11 @@ interface UseToNumberOptions {
|
|
|
1091
1094
|
/**
|
|
1092
1095
|
* Method to use to convert the value to a number.
|
|
1093
1096
|
*
|
|
1097
|
+
* Or a custom function for the conversion.
|
|
1098
|
+
*
|
|
1094
1099
|
* @default 'parseFloat'
|
|
1095
1100
|
*/
|
|
1096
|
-
method?: 'parseFloat' | 'parseInt';
|
|
1101
|
+
method?: 'parseFloat' | 'parseInt' | ((value: string | number) => number);
|
|
1097
1102
|
/**
|
|
1098
1103
|
* The base in mathematical numeral systems passed to `parseInt`.
|
|
1099
1104
|
* Only works with `method: 'parseInt'`
|
|
@@ -1220,4 +1225,4 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1220
1225
|
*/
|
|
1221
1226
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1222
1227
|
|
|
1223
|
-
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|
|
1228
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, MaybeRef, WatchOptions, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue';
|
|
2
|
+
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, MaybeRef, WatchOptions, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
3
|
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -301,6 +301,7 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
301
301
|
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
302
302
|
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
303
303
|
declare function getLifeCycleTarget(target?: any): any;
|
|
304
|
+
declare function toArray<T>(value: T): T extends readonly any[] ? T : [T];
|
|
304
305
|
|
|
305
306
|
/**
|
|
306
307
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
@@ -644,12 +645,14 @@ declare function toRefs<T extends object>(objectRef: MaybeRef<T>, options?: ToRe
|
|
|
644
645
|
|
|
645
646
|
/**
|
|
646
647
|
* Get the value of value/ref/getter.
|
|
648
|
+
*
|
|
649
|
+
* @deprecated use `toValue` from `vue` instead
|
|
647
650
|
*/
|
|
648
|
-
declare
|
|
651
|
+
declare const toValue: typeof toValue$1;
|
|
649
652
|
/**
|
|
650
653
|
* @deprecated use `toValue` instead
|
|
651
654
|
*/
|
|
652
|
-
declare const resolveUnref: typeof toValue;
|
|
655
|
+
declare const resolveUnref: typeof toValue$1;
|
|
653
656
|
|
|
654
657
|
/**
|
|
655
658
|
* Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
|
|
@@ -1091,9 +1094,11 @@ interface UseToNumberOptions {
|
|
|
1091
1094
|
/**
|
|
1092
1095
|
* Method to use to convert the value to a number.
|
|
1093
1096
|
*
|
|
1097
|
+
* Or a custom function for the conversion.
|
|
1098
|
+
*
|
|
1094
1099
|
* @default 'parseFloat'
|
|
1095
1100
|
*/
|
|
1096
|
-
method?: 'parseFloat' | 'parseInt';
|
|
1101
|
+
method?: 'parseFloat' | 'parseInt' | ((value: string | number) => number);
|
|
1097
1102
|
/**
|
|
1098
1103
|
* The base in mathematical numeral systems passed to `parseInt`.
|
|
1099
1104
|
* Only works with `method: 'parseInt'`
|
|
@@ -1220,4 +1225,4 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1220
1225
|
*/
|
|
1221
1226
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1222
1227
|
|
|
1223
|
-
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|
|
1228
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|