@vueuse/shared 10.0.0-beta.1 → 10.0.0-beta.3

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 CHANGED
@@ -56,8 +56,8 @@ const rand = (min, max) => {
56
56
  max = Math.floor(max);
57
57
  return Math.floor(Math.random() * (max - min + 1)) + min;
58
58
  };
59
- const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
60
59
  const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
60
+ const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
61
61
 
62
62
  function resolveUnref(r) {
63
63
  return typeof r === "function" ? r() : vueDemi.unref(r);
@@ -291,7 +291,7 @@ function tryOnScopeDispose(fn) {
291
291
  }
292
292
 
293
293
  function createEventHook() {
294
- const fns = new Set();
294
+ const fns = /* @__PURE__ */ new Set();
295
295
  const off = (fn) => {
296
296
  fns.delete(fn);
297
297
  };
@@ -448,13 +448,15 @@ function reactifyObject(obj, optionsOrKeys = {}) {
448
448
  if (includeOwnProperties)
449
449
  keys.push(...Object.getOwnPropertyNames(obj));
450
450
  }
451
- return Object.fromEntries(keys.map((key) => {
452
- const value = obj[key];
453
- return [
454
- key,
455
- typeof value === "function" ? reactify(value.bind(obj), options) : value
456
- ];
457
- }));
451
+ return Object.fromEntries(
452
+ keys.map((key) => {
453
+ const value = obj[key];
454
+ return [
455
+ key,
456
+ typeof value === "function" ? reactify(value.bind(obj), options) : value
457
+ ];
458
+ })
459
+ );
458
460
  }
459
461
 
460
462
  function toReactive(objectRef) {
@@ -496,12 +498,16 @@ function reactiveComputed(fn) {
496
498
 
497
499
  function reactiveOmit(obj, ...keys) {
498
500
  const flatKeys = keys.flat();
499
- return reactiveComputed(() => Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
501
+ const predicate = flatKeys[0];
502
+ return reactiveComputed(
503
+ () => typeof predicate === "function" ? Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter(([k, v]) => !predicate(resolveUnref(v), k))) : Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !flatKeys.includes(e[0])))
504
+ );
500
505
  }
501
506
 
502
507
  function reactivePick(obj, ...keys) {
503
508
  const flatKeys = keys.flat();
504
- return vueDemi.reactive(Object.fromEntries(flatKeys.map((k) => [k, vueDemi.toRef(obj, k)])));
509
+ const predicate = flatKeys[0];
510
+ return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter(([k, v]) => predicate(resolveUnref(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, vueDemi.toRef(obj, k)])));
505
511
  }
506
512
 
507
513
  function refAutoReset(defaultValue, afterMs = 1e4) {
@@ -531,7 +537,10 @@ function refAutoReset(defaultValue, afterMs = 1e4) {
531
537
  }
532
538
 
533
539
  function useDebounceFn(fn, ms = 200, options = {}) {
534
- return createFilterWrapper(debounceFilter(ms, options), fn);
540
+ return createFilterWrapper(
541
+ debounceFilter(ms, options),
542
+ fn
543
+ );
535
544
  }
536
545
 
537
546
  function refDebounced(value, ms = 200, options = {}) {
@@ -556,7 +565,10 @@ function refDefault(source, defaultValue) {
556
565
  }
557
566
 
558
567
  function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
559
- return createFilterWrapper(throttleFilter(ms, trailing, leading, rejectOnCancel), fn);
568
+ return createFilterWrapper(
569
+ throttleFilter(ms, trailing, leading, rejectOnCancel),
570
+ fn
571
+ );
560
572
  }
561
573
 
562
574
  function refThrottled(value, delay = 200, trailing = true, leading = true) {
@@ -607,14 +619,18 @@ function refWithControl(initial, options = {}) {
607
619
  const silentSet = (v) => set(v, false);
608
620
  const peek = () => get(false);
609
621
  const lay = (v) => set(v, false);
610
- return extendRef(ref, {
611
- get,
612
- set,
613
- untrackedGet,
614
- silentSet,
615
- peek,
616
- lay
617
- }, { enumerable: true });
622
+ return extendRef(
623
+ ref,
624
+ {
625
+ get,
626
+ set,
627
+ untrackedGet,
628
+ silentSet,
629
+ peek,
630
+ lay
631
+ },
632
+ { enumerable: true }
633
+ );
618
634
  }
619
635
  const controlledRef = refWithControl;
620
636
 
@@ -651,10 +667,18 @@ function syncRef(left, right, options = {}) {
651
667
  const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
652
668
  const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
653
669
  if (direction === "both" || direction === "ltr") {
654
- watchLeft = vueDemi.watch(left, (newValue) => right.value = transformLTR(newValue), { flush, deep, immediate });
670
+ watchLeft = vueDemi.watch(
671
+ left,
672
+ (newValue) => right.value = transformLTR(newValue),
673
+ { flush, deep, immediate }
674
+ );
655
675
  }
656
676
  if (direction === "both" || direction === "rtl") {
657
- watchRight = vueDemi.watch(right, (newValue) => left.value = transformRTL(newValue), { flush, deep, immediate });
677
+ watchRight = vueDemi.watch(
678
+ right,
679
+ (newValue) => left.value = transformRTL(newValue),
680
+ { flush, deep, immediate }
681
+ );
658
682
  }
659
683
  return () => {
660
684
  watchLeft == null ? void 0 : watchLeft();
@@ -670,7 +694,11 @@ function syncRefs(source, targets, options = {}) {
670
694
  } = options;
671
695
  if (!Array.isArray(targets))
672
696
  targets = [targets];
673
- return vueDemi.watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
697
+ return vueDemi.watch(
698
+ source,
699
+ (newValue) => targets.forEach((target) => target.value = newValue),
700
+ { flush, deep, immediate }
701
+ );
674
702
  }
675
703
 
676
704
  var __defProp$9 = Object.defineProperty;
@@ -749,20 +777,26 @@ function createUntil(r, isNot = false) {
749
777
  function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
750
778
  let stop = null;
751
779
  const watcher = new Promise((resolve) => {
752
- stop = vueDemi.watch(r, (v) => {
753
- if (condition(v) !== isNot) {
754
- stop == null ? void 0 : stop();
755
- resolve(v);
780
+ stop = vueDemi.watch(
781
+ r,
782
+ (v) => {
783
+ if (condition(v) !== isNot) {
784
+ stop == null ? void 0 : stop();
785
+ resolve(v);
786
+ }
787
+ },
788
+ {
789
+ flush,
790
+ deep,
791
+ immediate: true
756
792
  }
757
- }, {
758
- flush,
759
- deep,
760
- immediate: true
761
- });
793
+ );
762
794
  });
763
795
  const promises = [watcher];
764
796
  if (timeout != null) {
765
- promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => resolveUnref(r)).finally(() => stop == null ? void 0 : stop()));
797
+ promises.push(
798
+ promiseTimeout(timeout, throwOnTimeout).then(() => resolveUnref(r)).finally(() => stop == null ? void 0 : stop())
799
+ );
766
800
  }
767
801
  return Promise.race(promises);
768
802
  }
@@ -772,23 +806,29 @@ function createUntil(r, isNot = false) {
772
806
  const { flush = "sync", deep = false, timeout, throwOnTimeout } = options != null ? options : {};
773
807
  let stop = null;
774
808
  const watcher = new Promise((resolve) => {
775
- stop = vueDemi.watch([r, value], ([v1, v2]) => {
776
- if (isNot !== (v1 === v2)) {
777
- stop == null ? void 0 : stop();
778
- resolve(v1);
809
+ stop = vueDemi.watch(
810
+ [r, value],
811
+ ([v1, v2]) => {
812
+ if (isNot !== (v1 === v2)) {
813
+ stop == null ? void 0 : stop();
814
+ resolve(v1);
815
+ }
816
+ },
817
+ {
818
+ flush,
819
+ deep,
820
+ immediate: true
779
821
  }
780
- }, {
781
- flush,
782
- deep,
783
- immediate: true
784
- });
822
+ );
785
823
  });
786
824
  const promises = [watcher];
787
825
  if (timeout != null) {
788
- promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => resolveUnref(r)).finally(() => {
789
- stop == null ? void 0 : stop();
790
- return resolveUnref(r);
791
- }));
826
+ promises.push(
827
+ promiseTimeout(timeout, throwOnTimeout).then(() => resolveUnref(r)).finally(() => {
828
+ stop == null ? void 0 : stop();
829
+ return resolveUnref(r);
830
+ })
831
+ );
792
832
  }
793
833
  return Promise.race(promises);
794
834
  }
@@ -852,7 +892,9 @@ function until(r) {
852
892
  return createUntil(r);
853
893
  }
854
894
 
855
- const defaultComparator = (value, othVal) => value === othVal;
895
+ function defaultComparator(value, othVal) {
896
+ return value === othVal;
897
+ }
856
898
  function useArrayDifference(...args) {
857
899
  var _a;
858
900
  const list = args[0];
@@ -874,7 +916,11 @@ function useArrayFilter(list, fn) {
874
916
  }
875
917
 
876
918
  function useArrayFind(list, fn) {
877
- return vueDemi.computed(() => resolveUnref(resolveUnref(list).find((element, index, array) => fn(resolveUnref(element), index, array))));
919
+ return vueDemi.computed(
920
+ () => resolveUnref(
921
+ resolveUnref(list).find((element, index, array) => fn(resolveUnref(element), index, array))
922
+ )
923
+ );
878
924
  }
879
925
 
880
926
  function useArrayFindIndex(list, fn) {
@@ -890,7 +936,11 @@ function findLast(arr, cb) {
890
936
  return void 0;
891
937
  }
892
938
  function useArrayFindLast(list, fn) {
893
- return vueDemi.computed(() => resolveUnref(!Array.prototype.findLast ? findLast(resolveUnref(list), (element, index, array) => fn(resolveUnref(element), index, array)) : resolveUnref(list).findLast((element, index, array) => fn(resolveUnref(element), index, array))));
939
+ return vueDemi.computed(
940
+ () => resolveUnref(
941
+ !Array.prototype.findLast ? findLast(resolveUnref(list), (element, index, array) => fn(resolveUnref(element), index, array)) : resolveUnref(list).findLast((element, index, array) => fn(resolveUnref(element), index, array))
942
+ )
943
+ );
894
944
  }
895
945
 
896
946
  function isArrayIncludesOptions(obj) {
@@ -911,7 +961,11 @@ function useArrayIncludes(...args) {
911
961
  comparator = (element, value2) => element[key] === resolveUnref(value2);
912
962
  }
913
963
  comparator = comparator != null ? comparator : (element, value2) => element === resolveUnref(value2);
914
- return vueDemi.computed(() => resolveUnref(list).slice(formIndex).some((element, index, array) => comparator(resolveUnref(element), resolveUnref(value), index, resolveUnref(array))));
964
+ return vueDemi.computed(
965
+ () => resolveUnref(list).slice(formIndex).some(
966
+ (element, index, array) => comparator(resolveUnref(element), resolveUnref(value), index, resolveUnref(array))
967
+ )
968
+ );
915
969
  }
916
970
 
917
971
  function useArrayJoin(list, separator) {
@@ -934,8 +988,21 @@ function useArraySome(list, fn) {
934
988
  return vueDemi.computed(() => resolveUnref(list).some((element, index, array) => fn(resolveUnref(element), index, array)));
935
989
  }
936
990
 
937
- function useArrayUnique(list) {
938
- return vueDemi.computed(() => [...new Set(resolveUnref(list).map((element) => resolveUnref(element)))]);
991
+ function uniq(array) {
992
+ return Array.from(new Set(array));
993
+ }
994
+ function uniqueElementsBy(array, fn) {
995
+ return array.reduce((acc, v) => {
996
+ if (!acc.some((x) => fn(v, x, array)))
997
+ acc.push(v);
998
+ return acc;
999
+ }, []);
1000
+ }
1001
+ function useArrayUnique(list, compareFn) {
1002
+ return vueDemi.computed(() => {
1003
+ const resolvedList = resolveUnref(list).map((element) => resolveUnref(element));
1004
+ return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);
1005
+ });
939
1006
  }
940
1007
 
941
1008
  function useCounter(initialValue = 0, options = {}) {
@@ -957,13 +1024,13 @@ function useCounter(initialValue = 0, options = {}) {
957
1024
 
958
1025
  const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
959
1026
  const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
960
- const defaultMeridiem = (hours, minutes, isLowercase, hasPeriod) => {
1027
+ function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
961
1028
  let m = hours < 12 ? "AM" : "PM";
962
1029
  if (hasPeriod)
963
1030
  m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
964
1031
  return isLowercase ? m.toLowerCase() : m;
965
- };
966
- const formatDate = (date, formatStr, options = {}) => {
1032
+ }
1033
+ function formatDate(date, formatStr, options = {}) {
967
1034
  var _a;
968
1035
  const years = date.getFullYear();
969
1036
  const month = date.getMonth();
@@ -1002,12 +1069,12 @@ const formatDate = (date, formatStr, options = {}) => {
1002
1069
  aa: () => meridiem(hours, minutes, true, true)
1003
1070
  };
1004
1071
  return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
1005
- };
1006
- const normalizeDate = (date) => {
1072
+ }
1073
+ function normalizeDate(date) {
1007
1074
  if (date === null)
1008
- return new Date(NaN);
1075
+ return /* @__PURE__ */ new Date(NaN);
1009
1076
  if (date === void 0)
1010
- return new Date();
1077
+ return /* @__PURE__ */ new Date();
1011
1078
  if (date instanceof Date)
1012
1079
  return new Date(date);
1013
1080
  if (typeof date === "string" && !/Z$/i.test(date)) {
@@ -1019,7 +1086,7 @@ const normalizeDate = (date) => {
1019
1086
  }
1020
1087
  }
1021
1088
  return new Date(date);
1022
- };
1089
+ }
1023
1090
  function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
1024
1091
  return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options));
1025
1092
  }
@@ -1095,10 +1162,14 @@ function useInterval(interval = 1e3, options = {}) {
1095
1162
  const reset = () => {
1096
1163
  counter.value = 0;
1097
1164
  };
1098
- const controls = useIntervalFn(callback ? () => {
1099
- update();
1100
- callback(counter.value);
1101
- } : update, interval, { immediate });
1165
+ const controls = useIntervalFn(
1166
+ callback ? () => {
1167
+ update();
1168
+ callback(counter.value);
1169
+ } : update,
1170
+ interval,
1171
+ { immediate }
1172
+ );
1102
1173
  if (exposeControls) {
1103
1174
  return __spreadValues$8({
1104
1175
  counter,
@@ -1112,7 +1183,11 @@ function useInterval(interval = 1e3, options = {}) {
1112
1183
  function useLastChanged(source, options = {}) {
1113
1184
  var _a;
1114
1185
  const ms = vueDemi.ref((_a = options.initialValue) != null ? _a : null);
1115
- vueDemi.watch(source, () => ms.value = timestamp(), options);
1186
+ vueDemi.watch(
1187
+ source,
1188
+ () => ms.value = timestamp(),
1189
+ options
1190
+ );
1116
1191
  return ms;
1117
1192
  }
1118
1193
 
@@ -1175,7 +1250,11 @@ function useTimeout(interval = 1e3, options = {}) {
1175
1250
  controls: exposeControls = false,
1176
1251
  callback
1177
1252
  } = options;
1178
- const controls = useTimeoutFn(callback != null ? callback : noop, interval, options);
1253
+ const controls = useTimeoutFn(
1254
+ callback != null ? callback : noop,
1255
+ interval,
1256
+ options
1257
+ );
1179
1258
  const ready = vueDemi.computed(() => !controls.isPending.value);
1180
1259
  if (exposeControls) {
1181
1260
  return __spreadValues$7({
@@ -1275,7 +1354,14 @@ function watchWithFilter(source, cb, options = {}) {
1275
1354
  } = _a, watchOptions = __objRest$5(_a, [
1276
1355
  "eventFilter"
1277
1356
  ]);
1278
- return vueDemi.watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
1357
+ return vueDemi.watch(
1358
+ source,
1359
+ createFilterWrapper(
1360
+ eventFilter,
1361
+ cb
1362
+ ),
1363
+ watchOptions
1364
+ );
1279
1365
  }
1280
1366
 
1281
1367
  var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
@@ -1300,12 +1386,16 @@ function watchAtMost(source, cb, options) {
1300
1386
  "count"
1301
1387
  ]);
1302
1388
  const current = vueDemi.ref(0);
1303
- const stop = watchWithFilter(source, (...args) => {
1304
- current.value += 1;
1305
- if (current.value >= resolveUnref(count))
1306
- vueDemi.nextTick(() => stop());
1307
- cb(...args);
1308
- }, watchOptions);
1389
+ const stop = watchWithFilter(
1390
+ source,
1391
+ (...args) => {
1392
+ current.value += 1;
1393
+ if (current.value >= resolveUnref(count))
1394
+ vueDemi.nextTick(() => stop());
1395
+ cb(...args);
1396
+ },
1397
+ watchOptions
1398
+ );
1309
1399
  return { count: current, stop };
1310
1400
  }
1311
1401
 
@@ -1348,9 +1438,13 @@ function watchDebounced(source, cb, options = {}) {
1348
1438
  "debounce",
1349
1439
  "maxWait"
1350
1440
  ]);
1351
- return watchWithFilter(source, cb, __spreadProps$6(__spreadValues$6({}, watchOptions), {
1352
- eventFilter: debounceFilter(debounce, { maxWait })
1353
- }));
1441
+ return watchWithFilter(
1442
+ source,
1443
+ cb,
1444
+ __spreadProps$6(__spreadValues$6({}, watchOptions), {
1445
+ eventFilter: debounceFilter(debounce, { maxWait })
1446
+ })
1447
+ );
1354
1448
  }
1355
1449
 
1356
1450
  var __defProp$5 = Object.defineProperty;
@@ -1373,12 +1467,13 @@ var __spreadValues$5 = (a, b) => {
1373
1467
  };
1374
1468
  var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
1375
1469
  function watchDeep(source, cb, options) {
1376
- return vueDemi.watch(source, (v, ov, onInvalidate) => {
1377
- if (v)
1378
- cb(v, ov, onInvalidate);
1379
- }, __spreadProps$5(__spreadValues$5({}, options), {
1380
- deep: true
1381
- }));
1470
+ return vueDemi.watch(
1471
+ source,
1472
+ cb,
1473
+ __spreadProps$5(__spreadValues$5({}, options), {
1474
+ deep: true
1475
+ })
1476
+ );
1382
1477
  }
1383
1478
 
1384
1479
  var __defProp$4 = Object.defineProperty;
@@ -1418,7 +1513,10 @@ function watchIgnorable(source, cb, options = {}) {
1418
1513
  } = _a, watchOptions = __objRest$2(_a, [
1419
1514
  "eventFilter"
1420
1515
  ]);
1421
- const filteredCb = createFilterWrapper(eventFilter, cb);
1516
+ const filteredCb = createFilterWrapper(
1517
+ eventFilter,
1518
+ cb
1519
+ );
1422
1520
  let ignoreUpdates;
1423
1521
  let ignorePrevAsyncUpdates;
1424
1522
  let stop;
@@ -1431,10 +1529,14 @@ function watchIgnorable(source, cb, options = {}) {
1431
1529
  updater();
1432
1530
  ignore.value = false;
1433
1531
  };
1434
- stop = vueDemi.watch(source, (...args) => {
1435
- if (!ignore.value)
1436
- filteredCb(...args);
1437
- }, watchOptions);
1532
+ stop = vueDemi.watch(
1533
+ source,
1534
+ (...args) => {
1535
+ if (!ignore.value)
1536
+ filteredCb(...args);
1537
+ },
1538
+ watchOptions
1539
+ );
1438
1540
  } else {
1439
1541
  const disposables = [];
1440
1542
  const ignoreCounter = vueDemi.ref(0);
@@ -1442,22 +1544,34 @@ function watchIgnorable(source, cb, options = {}) {
1442
1544
  ignorePrevAsyncUpdates = () => {
1443
1545
  ignoreCounter.value = syncCounter.value;
1444
1546
  };
1445
- disposables.push(vueDemi.watch(source, () => {
1446
- syncCounter.value++;
1447
- }, __spreadProps$4(__spreadValues$4({}, watchOptions), { flush: "sync" })));
1547
+ disposables.push(
1548
+ vueDemi.watch(
1549
+ source,
1550
+ () => {
1551
+ syncCounter.value++;
1552
+ },
1553
+ __spreadProps$4(__spreadValues$4({}, watchOptions), { flush: "sync" })
1554
+ )
1555
+ );
1448
1556
  ignoreUpdates = (updater) => {
1449
1557
  const syncCounterPrev = syncCounter.value;
1450
1558
  updater();
1451
1559
  ignoreCounter.value += syncCounter.value - syncCounterPrev;
1452
1560
  };
1453
- disposables.push(vueDemi.watch(source, (...args) => {
1454
- const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;
1455
- ignoreCounter.value = 0;
1456
- syncCounter.value = 0;
1457
- if (ignore)
1458
- return;
1459
- filteredCb(...args);
1460
- }, watchOptions));
1561
+ disposables.push(
1562
+ vueDemi.watch(
1563
+ source,
1564
+ (...args) => {
1565
+ const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;
1566
+ ignoreCounter.value = 0;
1567
+ syncCounter.value = 0;
1568
+ if (ignore)
1569
+ return;
1570
+ filteredCb(...args);
1571
+ },
1572
+ watchOptions
1573
+ )
1574
+ );
1461
1575
  stop = () => {
1462
1576
  disposables.forEach((fn) => fn());
1463
1577
  };
@@ -1485,12 +1599,13 @@ var __spreadValues$3 = (a, b) => {
1485
1599
  };
1486
1600
  var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1487
1601
  function watchImmediate(source, cb, options) {
1488
- return vueDemi.watch(source, (v, ov, onInvalidate) => {
1489
- if (v)
1490
- cb(v, ov, onInvalidate);
1491
- }, __spreadProps$3(__spreadValues$3({}, options), {
1492
- immediate: true
1493
- }));
1602
+ return vueDemi.watch(
1603
+ source,
1604
+ cb,
1605
+ __spreadProps$3(__spreadValues$3({}, options), {
1606
+ immediate: true
1607
+ })
1608
+ );
1494
1609
  }
1495
1610
 
1496
1611
  function watchOnce(source, cb, options) {
@@ -1538,9 +1653,13 @@ function watchPausable(source, cb, options = {}) {
1538
1653
  "eventFilter"
1539
1654
  ]);
1540
1655
  const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
1541
- const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$2({}, watchOptions), {
1542
- eventFilter
1543
- }));
1656
+ const stop = watchWithFilter(
1657
+ source,
1658
+ cb,
1659
+ __spreadProps$2(__spreadValues$2({}, watchOptions), {
1660
+ eventFilter
1661
+ })
1662
+ );
1544
1663
  return { stop, pause, resume, isActive };
1545
1664
  }
1546
1665
 
@@ -1585,9 +1704,13 @@ function watchThrottled(source, cb, options = {}) {
1585
1704
  "trailing",
1586
1705
  "leading"
1587
1706
  ]);
1588
- return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
1589
- eventFilter: throttleFilter(throttle, trailing, leading)
1590
- }));
1707
+ return watchWithFilter(
1708
+ source,
1709
+ cb,
1710
+ __spreadProps$1(__spreadValues$1({}, watchOptions), {
1711
+ eventFilter: throttleFilter(throttle, trailing, leading)
1712
+ })
1713
+ );
1591
1714
  }
1592
1715
 
1593
1716
  var __defProp = Object.defineProperty;
@@ -1653,10 +1776,14 @@ function getOldValue(source) {
1653
1776
  }
1654
1777
 
1655
1778
  function whenever(source, cb, options) {
1656
- return vueDemi.watch(source, (v, ov, onInvalidate) => {
1657
- if (v)
1658
- cb(v, ov, onInvalidate);
1659
- }, options);
1779
+ return vueDemi.watch(
1780
+ source,
1781
+ (v, ov, onInvalidate) => {
1782
+ if (v)
1783
+ cb(v, ov, onInvalidate);
1784
+ },
1785
+ options
1786
+ );
1660
1787
  }
1661
1788
 
1662
1789
  exports.__onlyVue27Plus = __onlyVue27Plus;