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