@vueuse/shared 10.3.0 → 10.4.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 +122 -426
- package/index.d.cts +2 -2
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.iife.js +122 -426
- package/index.iife.min.js +1 -1
- package/index.mjs +122 -426
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -2,33 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var vueDemi = require('vue-demi');
|
|
4
4
|
|
|
5
|
-
var __defProp$b = Object.defineProperty;
|
|
6
|
-
var __defProps$8 = Object.defineProperties;
|
|
7
|
-
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
8
|
-
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
9
|
-
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues$b = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp$d.call(b, prop))
|
|
15
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols$d)
|
|
17
|
-
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
18
|
-
if (__propIsEnum$d.call(b, prop))
|
|
19
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
24
5
|
function computedEager(fn, options) {
|
|
25
|
-
var _a;
|
|
26
6
|
const result = vueDemi.shallowRef();
|
|
27
7
|
vueDemi.watchEffect(() => {
|
|
28
8
|
result.value = fn();
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
9
|
+
}, {
|
|
10
|
+
...options,
|
|
11
|
+
flush: options?.flush ?? "sync"
|
|
12
|
+
});
|
|
32
13
|
return vueDemi.readonly(result);
|
|
33
14
|
}
|
|
34
15
|
|
|
@@ -57,7 +38,7 @@ function computedWithControl(source, fn) {
|
|
|
57
38
|
return v;
|
|
58
39
|
},
|
|
59
40
|
set(v2) {
|
|
60
|
-
set
|
|
41
|
+
set?.(v2);
|
|
61
42
|
}
|
|
62
43
|
};
|
|
63
44
|
});
|
|
@@ -180,25 +161,9 @@ function isDefined(v) {
|
|
|
180
161
|
return vueDemi.unref(v) != null;
|
|
181
162
|
}
|
|
182
163
|
|
|
183
|
-
var __defProp$a = Object.defineProperty;
|
|
184
|
-
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
185
|
-
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
186
|
-
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
187
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
188
|
-
var __spreadValues$a = (a, b) => {
|
|
189
|
-
for (var prop in b || (b = {}))
|
|
190
|
-
if (__hasOwnProp$c.call(b, prop))
|
|
191
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
192
|
-
if (__getOwnPropSymbols$c)
|
|
193
|
-
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
194
|
-
if (__propIsEnum$c.call(b, prop))
|
|
195
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
196
|
-
}
|
|
197
|
-
return a;
|
|
198
|
-
};
|
|
199
164
|
function makeDestructurable(obj, arr) {
|
|
200
165
|
if (typeof Symbol !== "undefined") {
|
|
201
|
-
const clone =
|
|
166
|
+
const clone = { ...obj };
|
|
202
167
|
Object.defineProperty(clone, Symbol.iterator, {
|
|
203
168
|
enumerable: false,
|
|
204
169
|
value() {
|
|
@@ -223,7 +188,7 @@ function toValue(r) {
|
|
|
223
188
|
const resolveUnref = toValue;
|
|
224
189
|
|
|
225
190
|
function reactify(fn, options) {
|
|
226
|
-
const unrefFn =
|
|
191
|
+
const unrefFn = options?.computedGetter === false ? vueDemi.unref : toValue;
|
|
227
192
|
return function(...args) {
|
|
228
193
|
return vueDemi.computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
229
194
|
};
|
|
@@ -297,7 +262,7 @@ function reactiveOmit(obj, ...keys) {
|
|
|
297
262
|
);
|
|
298
263
|
}
|
|
299
264
|
|
|
300
|
-
const isClient = typeof window !== "undefined";
|
|
265
|
+
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
301
266
|
const isDef = (val) => typeof val !== "undefined";
|
|
302
267
|
const notNullish = (val) => val != null;
|
|
303
268
|
const assert = (condition, ...infos) => {
|
|
@@ -319,8 +284,7 @@ const rand = (min, max) => {
|
|
|
319
284
|
const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
|
|
320
285
|
const isIOS = /* @__PURE__ */ getIsIOS();
|
|
321
286
|
function getIsIOS() {
|
|
322
|
-
|
|
323
|
-
return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
287
|
+
return isClient && window?.navigator?.userAgent && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
324
288
|
}
|
|
325
289
|
|
|
326
290
|
function createFilterWrapper(filter, fn) {
|
|
@@ -491,10 +455,9 @@ function containsProp(obj, ...props) {
|
|
|
491
455
|
return props.some((k) => k in obj);
|
|
492
456
|
}
|
|
493
457
|
function increaseWithUnit(target, delta) {
|
|
494
|
-
var _a;
|
|
495
458
|
if (typeof target === "number")
|
|
496
459
|
return target + delta;
|
|
497
|
-
const value =
|
|
460
|
+
const value = target.match(/^-?[0-9]+\.?[0-9]*/)?.[0] || "";
|
|
498
461
|
const unit = target.slice(value.length);
|
|
499
462
|
const result = Number.parseFloat(value) + delta;
|
|
500
463
|
if (Number.isNaN(result))
|
|
@@ -535,10 +498,10 @@ function reactivePick(obj, ...keys) {
|
|
|
535
498
|
|
|
536
499
|
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
537
500
|
return vueDemi.customRef((track, trigger) => {
|
|
538
|
-
let value = defaultValue;
|
|
501
|
+
let value = toValue(defaultValue);
|
|
539
502
|
let timer;
|
|
540
503
|
const resetAfter = () => setTimeout(() => {
|
|
541
|
-
value = defaultValue;
|
|
504
|
+
value = toValue(defaultValue);
|
|
542
505
|
trigger();
|
|
543
506
|
}, toValue(afterMs));
|
|
544
507
|
tryOnScopeDispose(() => {
|
|
@@ -578,8 +541,7 @@ function refDebounced(value, ms = 200, options = {}) {
|
|
|
578
541
|
function refDefault(source, defaultValue) {
|
|
579
542
|
return vueDemi.computed({
|
|
580
543
|
get() {
|
|
581
|
-
|
|
582
|
-
return (_a = source.value) != null ? _a : defaultValue;
|
|
544
|
+
return source.value ?? defaultValue;
|
|
583
545
|
},
|
|
584
546
|
set(value) {
|
|
585
547
|
source.value = value;
|
|
@@ -627,14 +589,13 @@ function refWithControl(initial, options = {}) {
|
|
|
627
589
|
return source;
|
|
628
590
|
}
|
|
629
591
|
function set(value, triggering = true) {
|
|
630
|
-
var _a, _b;
|
|
631
592
|
if (value === source)
|
|
632
593
|
return;
|
|
633
594
|
const old = source;
|
|
634
|
-
if (
|
|
595
|
+
if (options.onBeforeChange?.(value, old) === false)
|
|
635
596
|
return;
|
|
636
597
|
source = value;
|
|
637
|
-
|
|
598
|
+
options.onChanged?.(value, old);
|
|
638
599
|
if (triggering)
|
|
639
600
|
trigger();
|
|
640
601
|
}
|
|
@@ -672,8 +633,39 @@ function set(...args) {
|
|
|
672
633
|
}
|
|
673
634
|
}
|
|
674
635
|
|
|
636
|
+
function watchWithFilter(source, cb, options = {}) {
|
|
637
|
+
const {
|
|
638
|
+
eventFilter = bypassFilter,
|
|
639
|
+
...watchOptions
|
|
640
|
+
} = options;
|
|
641
|
+
return vueDemi.watch(
|
|
642
|
+
source,
|
|
643
|
+
createFilterWrapper(
|
|
644
|
+
eventFilter,
|
|
645
|
+
cb
|
|
646
|
+
),
|
|
647
|
+
watchOptions
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function watchPausable(source, cb, options = {}) {
|
|
652
|
+
const {
|
|
653
|
+
eventFilter: filter,
|
|
654
|
+
...watchOptions
|
|
655
|
+
} = options;
|
|
656
|
+
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
657
|
+
const stop = watchWithFilter(
|
|
658
|
+
source,
|
|
659
|
+
cb,
|
|
660
|
+
{
|
|
661
|
+
...watchOptions,
|
|
662
|
+
eventFilter
|
|
663
|
+
}
|
|
664
|
+
);
|
|
665
|
+
return { stop, pause, resume, isActive };
|
|
666
|
+
}
|
|
667
|
+
|
|
675
668
|
function syncRef(left, right, options = {}) {
|
|
676
|
-
var _a, _b;
|
|
677
669
|
const {
|
|
678
670
|
flush = "sync",
|
|
679
671
|
deep = false,
|
|
@@ -681,28 +673,35 @@ function syncRef(left, right, options = {}) {
|
|
|
681
673
|
direction = "both",
|
|
682
674
|
transform = {}
|
|
683
675
|
} = options;
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
const
|
|
687
|
-
const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
|
|
676
|
+
const watchers = [];
|
|
677
|
+
const transformLTR = transform.ltr ?? ((v) => v);
|
|
678
|
+
const transformRTL = transform.rtl ?? ((v) => v);
|
|
688
679
|
if (direction === "both" || direction === "ltr") {
|
|
689
|
-
|
|
680
|
+
watchers.push(watchPausable(
|
|
690
681
|
left,
|
|
691
|
-
(newValue) =>
|
|
682
|
+
(newValue) => {
|
|
683
|
+
watchers.forEach((w) => w.pause());
|
|
684
|
+
right.value = transformLTR(newValue);
|
|
685
|
+
watchers.forEach((w) => w.resume());
|
|
686
|
+
},
|
|
692
687
|
{ flush, deep, immediate }
|
|
693
|
-
);
|
|
688
|
+
));
|
|
694
689
|
}
|
|
695
690
|
if (direction === "both" || direction === "rtl") {
|
|
696
|
-
|
|
691
|
+
watchers.push(watchPausable(
|
|
697
692
|
right,
|
|
698
|
-
(newValue) =>
|
|
693
|
+
(newValue) => {
|
|
694
|
+
watchers.forEach((w) => w.pause());
|
|
695
|
+
left.value = transformRTL(newValue);
|
|
696
|
+
watchers.forEach((w) => w.resume());
|
|
697
|
+
},
|
|
699
698
|
{ flush, deep, immediate }
|
|
700
|
-
);
|
|
699
|
+
));
|
|
701
700
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
watchRight == null ? void 0 : watchRight();
|
|
701
|
+
const stop = () => {
|
|
702
|
+
watchers.forEach((w) => w.stop());
|
|
705
703
|
};
|
|
704
|
+
return stop;
|
|
706
705
|
}
|
|
707
706
|
|
|
708
707
|
function syncRefs(source, targets, options = {}) {
|
|
@@ -720,25 +719,6 @@ function syncRefs(source, targets, options = {}) {
|
|
|
720
719
|
);
|
|
721
720
|
}
|
|
722
721
|
|
|
723
|
-
var __defProp$9 = Object.defineProperty;
|
|
724
|
-
var __defProps$7 = Object.defineProperties;
|
|
725
|
-
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
726
|
-
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
727
|
-
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
728
|
-
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
729
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
730
|
-
var __spreadValues$9 = (a, b) => {
|
|
731
|
-
for (var prop in b || (b = {}))
|
|
732
|
-
if (__hasOwnProp$b.call(b, prop))
|
|
733
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
734
|
-
if (__getOwnPropSymbols$b)
|
|
735
|
-
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
736
|
-
if (__propIsEnum$b.call(b, prop))
|
|
737
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
738
|
-
}
|
|
739
|
-
return a;
|
|
740
|
-
};
|
|
741
|
-
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
742
722
|
function toRefs(objectRef, options = {}) {
|
|
743
723
|
if (!vueDemi.isRef(objectRef))
|
|
744
724
|
return vueDemi.toRefs(objectRef);
|
|
@@ -749,15 +729,14 @@ function toRefs(objectRef, options = {}) {
|
|
|
749
729
|
return objectRef.value[key];
|
|
750
730
|
},
|
|
751
731
|
set(v) {
|
|
752
|
-
|
|
753
|
-
const replaceRef = (_a = toValue(options.replaceRef)) != null ? _a : true;
|
|
732
|
+
const replaceRef = toValue(options.replaceRef) ?? true;
|
|
754
733
|
if (replaceRef) {
|
|
755
734
|
if (Array.isArray(objectRef.value)) {
|
|
756
735
|
const copy = [...objectRef.value];
|
|
757
736
|
copy[key] = v;
|
|
758
737
|
objectRef.value = copy;
|
|
759
738
|
} else {
|
|
760
|
-
const newObject =
|
|
739
|
+
const newObject = { ...objectRef.value, [key]: v };
|
|
761
740
|
Object.setPrototypeOf(newObject, Object.getPrototypeOf(objectRef.value));
|
|
762
741
|
objectRef.value = newObject;
|
|
763
742
|
}
|
|
@@ -806,7 +785,7 @@ function createUntil(r, isNot = false) {
|
|
|
806
785
|
r,
|
|
807
786
|
(v) => {
|
|
808
787
|
if (condition(v) !== isNot) {
|
|
809
|
-
stop
|
|
788
|
+
stop?.();
|
|
810
789
|
resolve(v);
|
|
811
790
|
}
|
|
812
791
|
},
|
|
@@ -820,7 +799,7 @@ function createUntil(r, isNot = false) {
|
|
|
820
799
|
const promises = [watcher];
|
|
821
800
|
if (timeout != null) {
|
|
822
801
|
promises.push(
|
|
823
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop
|
|
802
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop?.())
|
|
824
803
|
);
|
|
825
804
|
}
|
|
826
805
|
return Promise.race(promises);
|
|
@@ -828,14 +807,14 @@ function createUntil(r, isNot = false) {
|
|
|
828
807
|
function toBe(value, options) {
|
|
829
808
|
if (!vueDemi.isRef(value))
|
|
830
809
|
return toMatch((v) => v === value, options);
|
|
831
|
-
const { flush = "sync", deep = false, timeout, throwOnTimeout } = options
|
|
810
|
+
const { flush = "sync", deep = false, timeout, throwOnTimeout } = options ?? {};
|
|
832
811
|
let stop = null;
|
|
833
812
|
const watcher = new Promise((resolve) => {
|
|
834
813
|
stop = vueDemi.watch(
|
|
835
814
|
[r, value],
|
|
836
815
|
([v1, v2]) => {
|
|
837
816
|
if (isNot !== (v1 === v2)) {
|
|
838
|
-
stop
|
|
817
|
+
stop?.();
|
|
839
818
|
resolve(v1);
|
|
840
819
|
}
|
|
841
820
|
},
|
|
@@ -850,7 +829,7 @@ function createUntil(r, isNot = false) {
|
|
|
850
829
|
if (timeout != null) {
|
|
851
830
|
promises.push(
|
|
852
831
|
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
|
|
853
|
-
stop
|
|
832
|
+
stop?.();
|
|
854
833
|
return toValue(r);
|
|
855
834
|
})
|
|
856
835
|
);
|
|
@@ -921,10 +900,9 @@ function defaultComparator(value, othVal) {
|
|
|
921
900
|
return value === othVal;
|
|
922
901
|
}
|
|
923
902
|
function useArrayDifference(...args) {
|
|
924
|
-
var _a;
|
|
925
903
|
const list = args[0];
|
|
926
904
|
const values = args[1];
|
|
927
|
-
let compareFn =
|
|
905
|
+
let compareFn = args[2] ?? defaultComparator;
|
|
928
906
|
if (typeof compareFn === "string") {
|
|
929
907
|
const key = compareFn;
|
|
930
908
|
compareFn = (value, othVal) => value[key] === othVal[key];
|
|
@@ -972,20 +950,19 @@ function isArrayIncludesOptions(obj) {
|
|
|
972
950
|
return isObject(obj) && containsProp(obj, "formIndex", "comparator");
|
|
973
951
|
}
|
|
974
952
|
function useArrayIncludes(...args) {
|
|
975
|
-
var _a;
|
|
976
953
|
const list = args[0];
|
|
977
954
|
const value = args[1];
|
|
978
955
|
let comparator = args[2];
|
|
979
956
|
let formIndex = 0;
|
|
980
957
|
if (isArrayIncludesOptions(comparator)) {
|
|
981
|
-
formIndex =
|
|
958
|
+
formIndex = comparator.fromIndex ?? 0;
|
|
982
959
|
comparator = comparator.comparator;
|
|
983
960
|
}
|
|
984
961
|
if (typeof comparator === "string") {
|
|
985
962
|
const key = comparator;
|
|
986
963
|
comparator = (element, value2) => element[key] === toValue(value2);
|
|
987
964
|
}
|
|
988
|
-
comparator = comparator
|
|
965
|
+
comparator = comparator ?? ((element, value2) => element === toValue(value2));
|
|
989
966
|
return vueDemi.computed(
|
|
990
967
|
() => toValue(list).slice(formIndex).some(
|
|
991
968
|
(element, index, array) => comparator(toValue(element), toValue(value), index, toValue(array))
|
|
@@ -1057,7 +1034,6 @@ function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
|
|
|
1057
1034
|
return isLowercase ? m.toLowerCase() : m;
|
|
1058
1035
|
}
|
|
1059
1036
|
function formatDate(date, formatStr, options = {}) {
|
|
1060
|
-
var _a;
|
|
1061
1037
|
const years = date.getFullYear();
|
|
1062
1038
|
const month = date.getMonth();
|
|
1063
1039
|
const days = date.getDate();
|
|
@@ -1066,7 +1042,7 @@ function formatDate(date, formatStr, options = {}) {
|
|
|
1066
1042
|
const seconds = date.getSeconds();
|
|
1067
1043
|
const milliseconds = date.getMilliseconds();
|
|
1068
1044
|
const day = date.getDay();
|
|
1069
|
-
const meridiem =
|
|
1045
|
+
const meridiem = options.customMeridiem ?? defaultMeridiem;
|
|
1070
1046
|
const matches = {
|
|
1071
1047
|
YY: () => String(years).slice(-2),
|
|
1072
1048
|
YYYY: () => years,
|
|
@@ -1094,10 +1070,7 @@ function formatDate(date, formatStr, options = {}) {
|
|
|
1094
1070
|
a: () => meridiem(hours, minutes, true),
|
|
1095
1071
|
aa: () => meridiem(hours, minutes, true, true)
|
|
1096
1072
|
};
|
|
1097
|
-
return formatStr.replace(REGEX_FORMAT, (match, $1) =>
|
|
1098
|
-
var _a2, _b;
|
|
1099
|
-
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? void 0 : _a2.call(matches)) != null ? _b : match;
|
|
1100
|
-
});
|
|
1073
|
+
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 ?? matches[match]?.() ?? match);
|
|
1101
1074
|
}
|
|
1102
1075
|
function normalizeDate(date) {
|
|
1103
1076
|
if (date === null)
|
|
@@ -1164,22 +1137,6 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
1164
1137
|
};
|
|
1165
1138
|
}
|
|
1166
1139
|
|
|
1167
|
-
var __defProp$8 = Object.defineProperty;
|
|
1168
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
1169
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
1170
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
1171
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1172
|
-
var __spreadValues$8 = (a, b) => {
|
|
1173
|
-
for (var prop in b || (b = {}))
|
|
1174
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
1175
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1176
|
-
if (__getOwnPropSymbols$a)
|
|
1177
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
1178
|
-
if (__propIsEnum$a.call(b, prop))
|
|
1179
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1180
|
-
}
|
|
1181
|
-
return a;
|
|
1182
|
-
};
|
|
1183
1140
|
function useInterval(interval = 1e3, options = {}) {
|
|
1184
1141
|
const {
|
|
1185
1142
|
controls: exposeControls = false,
|
|
@@ -1200,18 +1157,18 @@ function useInterval(interval = 1e3, options = {}) {
|
|
|
1200
1157
|
{ immediate }
|
|
1201
1158
|
);
|
|
1202
1159
|
if (exposeControls) {
|
|
1203
|
-
return
|
|
1160
|
+
return {
|
|
1204
1161
|
counter,
|
|
1205
|
-
reset
|
|
1206
|
-
|
|
1162
|
+
reset,
|
|
1163
|
+
...controls
|
|
1164
|
+
};
|
|
1207
1165
|
} else {
|
|
1208
1166
|
return counter;
|
|
1209
1167
|
}
|
|
1210
1168
|
}
|
|
1211
1169
|
|
|
1212
1170
|
function useLastChanged(source, options = {}) {
|
|
1213
|
-
|
|
1214
|
-
const ms = vueDemi.ref((_a = options.initialValue) != null ? _a : null);
|
|
1171
|
+
const ms = vueDemi.ref(options.initialValue ?? null);
|
|
1215
1172
|
vueDemi.watch(
|
|
1216
1173
|
source,
|
|
1217
1174
|
() => ms.value = timestamp(),
|
|
@@ -1258,37 +1215,22 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1258
1215
|
};
|
|
1259
1216
|
}
|
|
1260
1217
|
|
|
1261
|
-
var __defProp$7 = Object.defineProperty;
|
|
1262
|
-
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
1263
|
-
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
1264
|
-
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
1265
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1266
|
-
var __spreadValues$7 = (a, b) => {
|
|
1267
|
-
for (var prop in b || (b = {}))
|
|
1268
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
1269
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1270
|
-
if (__getOwnPropSymbols$9)
|
|
1271
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
1272
|
-
if (__propIsEnum$9.call(b, prop))
|
|
1273
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1274
|
-
}
|
|
1275
|
-
return a;
|
|
1276
|
-
};
|
|
1277
1218
|
function useTimeout(interval = 1e3, options = {}) {
|
|
1278
1219
|
const {
|
|
1279
1220
|
controls: exposeControls = false,
|
|
1280
1221
|
callback
|
|
1281
1222
|
} = options;
|
|
1282
1223
|
const controls = useTimeoutFn(
|
|
1283
|
-
callback
|
|
1224
|
+
callback ?? noop,
|
|
1284
1225
|
interval,
|
|
1285
1226
|
options
|
|
1286
1227
|
);
|
|
1287
1228
|
const ready = vueDemi.computed(() => !controls.isPending.value);
|
|
1288
1229
|
if (exposeControls) {
|
|
1289
|
-
return
|
|
1290
|
-
ready
|
|
1291
|
-
|
|
1230
|
+
return {
|
|
1231
|
+
ready,
|
|
1232
|
+
...controls
|
|
1233
|
+
};
|
|
1292
1234
|
} else {
|
|
1293
1235
|
return ready;
|
|
1294
1236
|
}
|
|
@@ -1338,7 +1280,7 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1338
1280
|
}
|
|
1339
1281
|
|
|
1340
1282
|
function watchArray(source, cb, options) {
|
|
1341
|
-
let oldList =
|
|
1283
|
+
let oldList = options?.immediate ? [] : [
|
|
1342
1284
|
...source instanceof Function ? source() : Array.isArray(source) ? source : toValue(source)
|
|
1343
1285
|
];
|
|
1344
1286
|
return vueDemi.watch(source, (newList, _, onCleanup) => {
|
|
@@ -1362,58 +1304,11 @@ function watchArray(source, cb, options) {
|
|
|
1362
1304
|
}, options);
|
|
1363
1305
|
}
|
|
1364
1306
|
|
|
1365
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1366
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1367
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1368
|
-
var __objRest$5 = (source, exclude) => {
|
|
1369
|
-
var target = {};
|
|
1370
|
-
for (var prop in source)
|
|
1371
|
-
if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1372
|
-
target[prop] = source[prop];
|
|
1373
|
-
if (source != null && __getOwnPropSymbols$8)
|
|
1374
|
-
for (var prop of __getOwnPropSymbols$8(source)) {
|
|
1375
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
|
|
1376
|
-
target[prop] = source[prop];
|
|
1377
|
-
}
|
|
1378
|
-
return target;
|
|
1379
|
-
};
|
|
1380
|
-
function watchWithFilter(source, cb, options = {}) {
|
|
1381
|
-
const _a = options, {
|
|
1382
|
-
eventFilter = bypassFilter
|
|
1383
|
-
} = _a, watchOptions = __objRest$5(_a, [
|
|
1384
|
-
"eventFilter"
|
|
1385
|
-
]);
|
|
1386
|
-
return vueDemi.watch(
|
|
1387
|
-
source,
|
|
1388
|
-
createFilterWrapper(
|
|
1389
|
-
eventFilter,
|
|
1390
|
-
cb
|
|
1391
|
-
),
|
|
1392
|
-
watchOptions
|
|
1393
|
-
);
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1397
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1398
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1399
|
-
var __objRest$4 = (source, exclude) => {
|
|
1400
|
-
var target = {};
|
|
1401
|
-
for (var prop in source)
|
|
1402
|
-
if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1403
|
-
target[prop] = source[prop];
|
|
1404
|
-
if (source != null && __getOwnPropSymbols$7)
|
|
1405
|
-
for (var prop of __getOwnPropSymbols$7(source)) {
|
|
1406
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
|
|
1407
|
-
target[prop] = source[prop];
|
|
1408
|
-
}
|
|
1409
|
-
return target;
|
|
1410
|
-
};
|
|
1411
1307
|
function watchAtMost(source, cb, options) {
|
|
1412
|
-
const
|
|
1413
|
-
count
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
]);
|
|
1308
|
+
const {
|
|
1309
|
+
count,
|
|
1310
|
+
...watchOptions
|
|
1311
|
+
} = options;
|
|
1417
1312
|
const current = vueDemi.ref(0);
|
|
1418
1313
|
const stop = watchWithFilter(
|
|
1419
1314
|
source,
|
|
@@ -1428,120 +1323,38 @@ function watchAtMost(source, cb, options) {
|
|
|
1428
1323
|
return { count: current, stop };
|
|
1429
1324
|
}
|
|
1430
1325
|
|
|
1431
|
-
var __defProp$6 = Object.defineProperty;
|
|
1432
|
-
var __defProps$6 = Object.defineProperties;
|
|
1433
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
1434
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1435
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1436
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1437
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1438
|
-
var __spreadValues$6 = (a, b) => {
|
|
1439
|
-
for (var prop in b || (b = {}))
|
|
1440
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
1441
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1442
|
-
if (__getOwnPropSymbols$6)
|
|
1443
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1444
|
-
if (__propIsEnum$6.call(b, prop))
|
|
1445
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1446
|
-
}
|
|
1447
|
-
return a;
|
|
1448
|
-
};
|
|
1449
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1450
|
-
var __objRest$3 = (source, exclude) => {
|
|
1451
|
-
var target = {};
|
|
1452
|
-
for (var prop in source)
|
|
1453
|
-
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1454
|
-
target[prop] = source[prop];
|
|
1455
|
-
if (source != null && __getOwnPropSymbols$6)
|
|
1456
|
-
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
1457
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
1458
|
-
target[prop] = source[prop];
|
|
1459
|
-
}
|
|
1460
|
-
return target;
|
|
1461
|
-
};
|
|
1462
1326
|
function watchDebounced(source, cb, options = {}) {
|
|
1463
|
-
const
|
|
1327
|
+
const {
|
|
1464
1328
|
debounce = 0,
|
|
1465
|
-
maxWait = void 0
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
"maxWait"
|
|
1469
|
-
]);
|
|
1329
|
+
maxWait = void 0,
|
|
1330
|
+
...watchOptions
|
|
1331
|
+
} = options;
|
|
1470
1332
|
return watchWithFilter(
|
|
1471
1333
|
source,
|
|
1472
1334
|
cb,
|
|
1473
|
-
|
|
1335
|
+
{
|
|
1336
|
+
...watchOptions,
|
|
1474
1337
|
eventFilter: debounceFilter(debounce, { maxWait })
|
|
1475
|
-
}
|
|
1338
|
+
}
|
|
1476
1339
|
);
|
|
1477
1340
|
}
|
|
1478
1341
|
|
|
1479
|
-
var __defProp$5 = Object.defineProperty;
|
|
1480
|
-
var __defProps$5 = Object.defineProperties;
|
|
1481
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
1482
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1483
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1484
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1485
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1486
|
-
var __spreadValues$5 = (a, b) => {
|
|
1487
|
-
for (var prop in b || (b = {}))
|
|
1488
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
1489
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1490
|
-
if (__getOwnPropSymbols$5)
|
|
1491
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1492
|
-
if (__propIsEnum$5.call(b, prop))
|
|
1493
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1494
|
-
}
|
|
1495
|
-
return a;
|
|
1496
|
-
};
|
|
1497
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1498
1342
|
function watchDeep(source, cb, options) {
|
|
1499
1343
|
return vueDemi.watch(
|
|
1500
1344
|
source,
|
|
1501
1345
|
cb,
|
|
1502
|
-
|
|
1346
|
+
{
|
|
1347
|
+
...options,
|
|
1503
1348
|
deep: true
|
|
1504
|
-
}
|
|
1349
|
+
}
|
|
1505
1350
|
);
|
|
1506
1351
|
}
|
|
1507
1352
|
|
|
1508
|
-
var __defProp$4 = Object.defineProperty;
|
|
1509
|
-
var __defProps$4 = Object.defineProperties;
|
|
1510
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1511
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1512
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1513
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1514
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1515
|
-
var __spreadValues$4 = (a, b) => {
|
|
1516
|
-
for (var prop in b || (b = {}))
|
|
1517
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
1518
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1519
|
-
if (__getOwnPropSymbols$4)
|
|
1520
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1521
|
-
if (__propIsEnum$4.call(b, prop))
|
|
1522
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1523
|
-
}
|
|
1524
|
-
return a;
|
|
1525
|
-
};
|
|
1526
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1527
|
-
var __objRest$2 = (source, exclude) => {
|
|
1528
|
-
var target = {};
|
|
1529
|
-
for (var prop in source)
|
|
1530
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1531
|
-
target[prop] = source[prop];
|
|
1532
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
1533
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1534
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1535
|
-
target[prop] = source[prop];
|
|
1536
|
-
}
|
|
1537
|
-
return target;
|
|
1538
|
-
};
|
|
1539
1353
|
function watchIgnorable(source, cb, options = {}) {
|
|
1540
|
-
const
|
|
1541
|
-
eventFilter = bypassFilter
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
]);
|
|
1354
|
+
const {
|
|
1355
|
+
eventFilter = bypassFilter,
|
|
1356
|
+
...watchOptions
|
|
1357
|
+
} = options;
|
|
1545
1358
|
const filteredCb = createFilterWrapper(
|
|
1546
1359
|
eventFilter,
|
|
1547
1360
|
cb
|
|
@@ -1579,7 +1392,7 @@ function watchIgnorable(source, cb, options = {}) {
|
|
|
1579
1392
|
() => {
|
|
1580
1393
|
syncCounter.value++;
|
|
1581
1394
|
},
|
|
1582
|
-
|
|
1395
|
+
{ ...watchOptions, flush: "sync" }
|
|
1583
1396
|
)
|
|
1584
1397
|
);
|
|
1585
1398
|
ignoreUpdates = (updater) => {
|
|
@@ -1608,32 +1421,14 @@ function watchIgnorable(source, cb, options = {}) {
|
|
|
1608
1421
|
return { stop, ignoreUpdates, ignorePrevAsyncUpdates };
|
|
1609
1422
|
}
|
|
1610
1423
|
|
|
1611
|
-
var __defProp$3 = Object.defineProperty;
|
|
1612
|
-
var __defProps$3 = Object.defineProperties;
|
|
1613
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1614
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1615
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1616
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1617
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1618
|
-
var __spreadValues$3 = (a, b) => {
|
|
1619
|
-
for (var prop in b || (b = {}))
|
|
1620
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
1621
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1622
|
-
if (__getOwnPropSymbols$3)
|
|
1623
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1624
|
-
if (__propIsEnum$3.call(b, prop))
|
|
1625
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1626
|
-
}
|
|
1627
|
-
return a;
|
|
1628
|
-
};
|
|
1629
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1630
1424
|
function watchImmediate(source, cb, options) {
|
|
1631
1425
|
return vueDemi.watch(
|
|
1632
1426
|
source,
|
|
1633
1427
|
cb,
|
|
1634
|
-
|
|
1428
|
+
{
|
|
1429
|
+
...options,
|
|
1635
1430
|
immediate: true
|
|
1636
|
-
}
|
|
1431
|
+
}
|
|
1637
1432
|
);
|
|
1638
1433
|
}
|
|
1639
1434
|
|
|
@@ -1644,123 +1439,23 @@ function watchOnce(source, cb, options) {
|
|
|
1644
1439
|
}, options);
|
|
1645
1440
|
}
|
|
1646
1441
|
|
|
1647
|
-
var __defProp$2 = Object.defineProperty;
|
|
1648
|
-
var __defProps$2 = Object.defineProperties;
|
|
1649
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1650
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1651
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1652
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1653
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1654
|
-
var __spreadValues$2 = (a, b) => {
|
|
1655
|
-
for (var prop in b || (b = {}))
|
|
1656
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
1657
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
1658
|
-
if (__getOwnPropSymbols$2)
|
|
1659
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1660
|
-
if (__propIsEnum$2.call(b, prop))
|
|
1661
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
1662
|
-
}
|
|
1663
|
-
return a;
|
|
1664
|
-
};
|
|
1665
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1666
|
-
var __objRest$1 = (source, exclude) => {
|
|
1667
|
-
var target = {};
|
|
1668
|
-
for (var prop in source)
|
|
1669
|
-
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1670
|
-
target[prop] = source[prop];
|
|
1671
|
-
if (source != null && __getOwnPropSymbols$2)
|
|
1672
|
-
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
1673
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
1674
|
-
target[prop] = source[prop];
|
|
1675
|
-
}
|
|
1676
|
-
return target;
|
|
1677
|
-
};
|
|
1678
|
-
function watchPausable(source, cb, options = {}) {
|
|
1679
|
-
const _a = options, {
|
|
1680
|
-
eventFilter: filter
|
|
1681
|
-
} = _a, watchOptions = __objRest$1(_a, [
|
|
1682
|
-
"eventFilter"
|
|
1683
|
-
]);
|
|
1684
|
-
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
1685
|
-
const stop = watchWithFilter(
|
|
1686
|
-
source,
|
|
1687
|
-
cb,
|
|
1688
|
-
__spreadProps$2(__spreadValues$2({}, watchOptions), {
|
|
1689
|
-
eventFilter
|
|
1690
|
-
})
|
|
1691
|
-
);
|
|
1692
|
-
return { stop, pause, resume, isActive };
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
var __defProp$1 = Object.defineProperty;
|
|
1696
|
-
var __defProps$1 = Object.defineProperties;
|
|
1697
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
1698
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
1699
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
1700
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
1701
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1702
|
-
var __spreadValues$1 = (a, b) => {
|
|
1703
|
-
for (var prop in b || (b = {}))
|
|
1704
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
1705
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
1706
|
-
if (__getOwnPropSymbols$1)
|
|
1707
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
1708
|
-
if (__propIsEnum$1.call(b, prop))
|
|
1709
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
1710
|
-
}
|
|
1711
|
-
return a;
|
|
1712
|
-
};
|
|
1713
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1714
|
-
var __objRest = (source, exclude) => {
|
|
1715
|
-
var target = {};
|
|
1716
|
-
for (var prop in source)
|
|
1717
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1718
|
-
target[prop] = source[prop];
|
|
1719
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
1720
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
1721
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
1722
|
-
target[prop] = source[prop];
|
|
1723
|
-
}
|
|
1724
|
-
return target;
|
|
1725
|
-
};
|
|
1726
1442
|
function watchThrottled(source, cb, options = {}) {
|
|
1727
|
-
const
|
|
1443
|
+
const {
|
|
1728
1444
|
throttle = 0,
|
|
1729
1445
|
trailing = true,
|
|
1730
|
-
leading = true
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
"trailing",
|
|
1734
|
-
"leading"
|
|
1735
|
-
]);
|
|
1446
|
+
leading = true,
|
|
1447
|
+
...watchOptions
|
|
1448
|
+
} = options;
|
|
1736
1449
|
return watchWithFilter(
|
|
1737
1450
|
source,
|
|
1738
1451
|
cb,
|
|
1739
|
-
|
|
1452
|
+
{
|
|
1453
|
+
...watchOptions,
|
|
1740
1454
|
eventFilter: throttleFilter(throttle, trailing, leading)
|
|
1741
|
-
}
|
|
1455
|
+
}
|
|
1742
1456
|
);
|
|
1743
1457
|
}
|
|
1744
1458
|
|
|
1745
|
-
var __defProp = Object.defineProperty;
|
|
1746
|
-
var __defProps = Object.defineProperties;
|
|
1747
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1748
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1749
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1750
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1751
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1752
|
-
var __spreadValues = (a, b) => {
|
|
1753
|
-
for (var prop in b || (b = {}))
|
|
1754
|
-
if (__hasOwnProp.call(b, prop))
|
|
1755
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1756
|
-
if (__getOwnPropSymbols)
|
|
1757
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
1758
|
-
if (__propIsEnum.call(b, prop))
|
|
1759
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1760
|
-
}
|
|
1761
|
-
return a;
|
|
1762
|
-
};
|
|
1763
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1764
1459
|
function watchTriggerable(source, cb, options = {}) {
|
|
1765
1460
|
let cleanupFn;
|
|
1766
1461
|
function onEffect() {
|
|
@@ -1786,9 +1481,10 @@ function watchTriggerable(source, cb, options = {}) {
|
|
|
1786
1481
|
});
|
|
1787
1482
|
return res2;
|
|
1788
1483
|
};
|
|
1789
|
-
return
|
|
1484
|
+
return {
|
|
1485
|
+
...res,
|
|
1790
1486
|
trigger
|
|
1791
|
-
}
|
|
1487
|
+
};
|
|
1792
1488
|
}
|
|
1793
1489
|
function getWatchSources(sources) {
|
|
1794
1490
|
if (vueDemi.isReactive(sources))
|