@vueuse/shared 10.3.0 → 10.4.1

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
@@ -2,33 +2,15 @@
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
6
  var _a;
26
7
  const result = vueDemi.shallowRef();
27
8
  vueDemi.watchEffect(() => {
28
9
  result.value = fn();
29
- }, __spreadProps$8(__spreadValues$b({}, options), {
10
+ }, {
11
+ ...options,
30
12
  flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
31
- }));
13
+ });
32
14
  return vueDemi.readonly(result);
33
15
  }
34
16
 
@@ -180,25 +162,9 @@ function isDefined(v) {
180
162
  return vueDemi.unref(v) != null;
181
163
  }
182
164
 
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
165
  function makeDestructurable(obj, arr) {
200
166
  if (typeof Symbol !== "undefined") {
201
- const clone = __spreadValues$a({}, obj);
167
+ const clone = { ...obj };
202
168
  Object.defineProperty(clone, Symbol.iterator, {
203
169
  enumerable: false,
204
170
  value() {
@@ -297,7 +263,7 @@ function reactiveOmit(obj, ...keys) {
297
263
  );
298
264
  }
299
265
 
300
- const isClient = typeof window !== "undefined";
266
+ const isClient = typeof window !== "undefined" && typeof document !== "undefined";
301
267
  const isDef = (val) => typeof val !== "undefined";
302
268
  const notNullish = (val) => val != null;
303
269
  const assert = (condition, ...infos) => {
@@ -535,10 +501,10 @@ function reactivePick(obj, ...keys) {
535
501
 
536
502
  function refAutoReset(defaultValue, afterMs = 1e4) {
537
503
  return vueDemi.customRef((track, trigger) => {
538
- let value = defaultValue;
504
+ let value = toValue(defaultValue);
539
505
  let timer;
540
506
  const resetAfter = () => setTimeout(() => {
541
- value = defaultValue;
507
+ value = toValue(defaultValue);
542
508
  trigger();
543
509
  }, toValue(afterMs));
544
510
  tryOnScopeDispose(() => {
@@ -672,6 +638,38 @@ function set(...args) {
672
638
  }
673
639
  }
674
640
 
641
+ function watchWithFilter(source, cb, options = {}) {
642
+ const {
643
+ eventFilter = bypassFilter,
644
+ ...watchOptions
645
+ } = options;
646
+ return vueDemi.watch(
647
+ source,
648
+ createFilterWrapper(
649
+ eventFilter,
650
+ cb
651
+ ),
652
+ watchOptions
653
+ );
654
+ }
655
+
656
+ function watchPausable(source, cb, options = {}) {
657
+ const {
658
+ eventFilter: filter,
659
+ ...watchOptions
660
+ } = options;
661
+ const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
662
+ const stop = watchWithFilter(
663
+ source,
664
+ cb,
665
+ {
666
+ ...watchOptions,
667
+ eventFilter
668
+ }
669
+ );
670
+ return { stop, pause, resume, isActive };
671
+ }
672
+
675
673
  function syncRef(left, right, options = {}) {
676
674
  var _a, _b;
677
675
  const {
@@ -681,28 +679,35 @@ function syncRef(left, right, options = {}) {
681
679
  direction = "both",
682
680
  transform = {}
683
681
  } = options;
684
- let watchLeft;
685
- let watchRight;
682
+ const watchers = [];
686
683
  const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
687
684
  const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
688
685
  if (direction === "both" || direction === "ltr") {
689
- watchLeft = vueDemi.watch(
686
+ watchers.push(watchPausable(
690
687
  left,
691
- (newValue) => right.value = transformLTR(newValue),
688
+ (newValue) => {
689
+ watchers.forEach((w) => w.pause());
690
+ right.value = transformLTR(newValue);
691
+ watchers.forEach((w) => w.resume());
692
+ },
692
693
  { flush, deep, immediate }
693
- );
694
+ ));
694
695
  }
695
696
  if (direction === "both" || direction === "rtl") {
696
- watchRight = vueDemi.watch(
697
+ watchers.push(watchPausable(
697
698
  right,
698
- (newValue) => left.value = transformRTL(newValue),
699
+ (newValue) => {
700
+ watchers.forEach((w) => w.pause());
701
+ left.value = transformRTL(newValue);
702
+ watchers.forEach((w) => w.resume());
703
+ },
699
704
  { flush, deep, immediate }
700
- );
705
+ ));
701
706
  }
702
- return () => {
703
- watchLeft == null ? void 0 : watchLeft();
704
- watchRight == null ? void 0 : watchRight();
707
+ const stop = () => {
708
+ watchers.forEach((w) => w.stop());
705
709
  };
710
+ return stop;
706
711
  }
707
712
 
708
713
  function syncRefs(source, targets, options = {}) {
@@ -720,25 +725,6 @@ function syncRefs(source, targets, options = {}) {
720
725
  );
721
726
  }
722
727
 
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
728
  function toRefs(objectRef, options = {}) {
743
729
  if (!vueDemi.isRef(objectRef))
744
730
  return vueDemi.toRefs(objectRef);
@@ -757,7 +743,7 @@ function toRefs(objectRef, options = {}) {
757
743
  copy[key] = v;
758
744
  objectRef.value = copy;
759
745
  } else {
760
- const newObject = __spreadProps$7(__spreadValues$9({}, objectRef.value), { [key]: v });
746
+ const newObject = { ...objectRef.value, [key]: v };
761
747
  Object.setPrototypeOf(newObject, Object.getPrototypeOf(objectRef.value));
762
748
  objectRef.value = newObject;
763
749
  }
@@ -1164,22 +1150,6 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
1164
1150
  };
1165
1151
  }
1166
1152
 
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
1153
  function useInterval(interval = 1e3, options = {}) {
1184
1154
  const {
1185
1155
  controls: exposeControls = false,
@@ -1200,10 +1170,11 @@ function useInterval(interval = 1e3, options = {}) {
1200
1170
  { immediate }
1201
1171
  );
1202
1172
  if (exposeControls) {
1203
- return __spreadValues$8({
1173
+ return {
1204
1174
  counter,
1205
- reset
1206
- }, controls);
1175
+ reset,
1176
+ ...controls
1177
+ };
1207
1178
  } else {
1208
1179
  return counter;
1209
1180
  }
@@ -1258,22 +1229,6 @@ function useTimeoutFn(cb, interval, options = {}) {
1258
1229
  };
1259
1230
  }
1260
1231
 
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
1232
  function useTimeout(interval = 1e3, options = {}) {
1278
1233
  const {
1279
1234
  controls: exposeControls = false,
@@ -1286,9 +1241,10 @@ function useTimeout(interval = 1e3, options = {}) {
1286
1241
  );
1287
1242
  const ready = vueDemi.computed(() => !controls.isPending.value);
1288
1243
  if (exposeControls) {
1289
- return __spreadValues$7({
1290
- ready
1291
- }, controls);
1244
+ return {
1245
+ ready,
1246
+ ...controls
1247
+ };
1292
1248
  } else {
1293
1249
  return ready;
1294
1250
  }
@@ -1362,58 +1318,11 @@ function watchArray(source, cb, options) {
1362
1318
  }, options);
1363
1319
  }
1364
1320
 
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
1321
  function watchAtMost(source, cb, options) {
1412
- const _a = options, {
1413
- count
1414
- } = _a, watchOptions = __objRest$4(_a, [
1415
- "count"
1416
- ]);
1322
+ const {
1323
+ count,
1324
+ ...watchOptions
1325
+ } = options;
1417
1326
  const current = vueDemi.ref(0);
1418
1327
  const stop = watchWithFilter(
1419
1328
  source,
@@ -1428,120 +1337,38 @@ function watchAtMost(source, cb, options) {
1428
1337
  return { count: current, stop };
1429
1338
  }
1430
1339
 
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
1340
  function watchDebounced(source, cb, options = {}) {
1463
- const _a = options, {
1341
+ const {
1464
1342
  debounce = 0,
1465
- maxWait = void 0
1466
- } = _a, watchOptions = __objRest$3(_a, [
1467
- "debounce",
1468
- "maxWait"
1469
- ]);
1343
+ maxWait = void 0,
1344
+ ...watchOptions
1345
+ } = options;
1470
1346
  return watchWithFilter(
1471
1347
  source,
1472
1348
  cb,
1473
- __spreadProps$6(__spreadValues$6({}, watchOptions), {
1349
+ {
1350
+ ...watchOptions,
1474
1351
  eventFilter: debounceFilter(debounce, { maxWait })
1475
- })
1352
+ }
1476
1353
  );
1477
1354
  }
1478
1355
 
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
1356
  function watchDeep(source, cb, options) {
1499
1357
  return vueDemi.watch(
1500
1358
  source,
1501
1359
  cb,
1502
- __spreadProps$5(__spreadValues$5({}, options), {
1360
+ {
1361
+ ...options,
1503
1362
  deep: true
1504
- })
1363
+ }
1505
1364
  );
1506
1365
  }
1507
1366
 
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
1367
  function watchIgnorable(source, cb, options = {}) {
1540
- const _a = options, {
1541
- eventFilter = bypassFilter
1542
- } = _a, watchOptions = __objRest$2(_a, [
1543
- "eventFilter"
1544
- ]);
1368
+ const {
1369
+ eventFilter = bypassFilter,
1370
+ ...watchOptions
1371
+ } = options;
1545
1372
  const filteredCb = createFilterWrapper(
1546
1373
  eventFilter,
1547
1374
  cb
@@ -1579,7 +1406,7 @@ function watchIgnorable(source, cb, options = {}) {
1579
1406
  () => {
1580
1407
  syncCounter.value++;
1581
1408
  },
1582
- __spreadProps$4(__spreadValues$4({}, watchOptions), { flush: "sync" })
1409
+ { ...watchOptions, flush: "sync" }
1583
1410
  )
1584
1411
  );
1585
1412
  ignoreUpdates = (updater) => {
@@ -1608,32 +1435,14 @@ function watchIgnorable(source, cb, options = {}) {
1608
1435
  return { stop, ignoreUpdates, ignorePrevAsyncUpdates };
1609
1436
  }
1610
1437
 
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
1438
  function watchImmediate(source, cb, options) {
1631
1439
  return vueDemi.watch(
1632
1440
  source,
1633
1441
  cb,
1634
- __spreadProps$3(__spreadValues$3({}, options), {
1442
+ {
1443
+ ...options,
1635
1444
  immediate: true
1636
- })
1445
+ }
1637
1446
  );
1638
1447
  }
1639
1448
 
@@ -1644,123 +1453,23 @@ function watchOnce(source, cb, options) {
1644
1453
  }, options);
1645
1454
  }
1646
1455
 
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
1456
  function watchThrottled(source, cb, options = {}) {
1727
- const _a = options, {
1457
+ const {
1728
1458
  throttle = 0,
1729
1459
  trailing = true,
1730
- leading = true
1731
- } = _a, watchOptions = __objRest(_a, [
1732
- "throttle",
1733
- "trailing",
1734
- "leading"
1735
- ]);
1460
+ leading = true,
1461
+ ...watchOptions
1462
+ } = options;
1736
1463
  return watchWithFilter(
1737
1464
  source,
1738
1465
  cb,
1739
- __spreadProps$1(__spreadValues$1({}, watchOptions), {
1466
+ {
1467
+ ...watchOptions,
1740
1468
  eventFilter: throttleFilter(throttle, trailing, leading)
1741
- })
1469
+ }
1742
1470
  );
1743
1471
  }
1744
1472
 
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
1473
  function watchTriggerable(source, cb, options = {}) {
1765
1474
  let cleanupFn;
1766
1475
  function onEffect() {
@@ -1786,9 +1495,10 @@ function watchTriggerable(source, cb, options = {}) {
1786
1495
  });
1787
1496
  return res2;
1788
1497
  };
1789
- return __spreadProps(__spreadValues({}, res), {
1498
+ return {
1499
+ ...res,
1790
1500
  trigger
1791
- });
1501
+ };
1792
1502
  }
1793
1503
  function getWatchSources(sources) {
1794
1504
  if (vueDemi.isReactive(sources))
package/index.d.cts CHANGED
@@ -386,7 +386,7 @@ declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickP
386
386
  * @param defaultValue The value which will be set.
387
387
  * @param afterMs A zero-or-greater delay in milliseconds.
388
388
  */
389
- declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeRefOrGetter<number>): Ref<T>;
389
+ declare function refAutoReset<T>(defaultValue: MaybeRefOrGetter<T>, afterMs?: MaybeRefOrGetter<number>): Ref<T>;
390
390
 
391
391
  /**
392
392
  * Debounce updates of a ref.
@@ -1093,4 +1093,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
1093
1093
  */
1094
1094
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
1095
1095
 
1096
- export { AnyFn, ArgumentsType, Arrayable, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeRef, MaybeRefOrGetter, MultiWatchSources, Mutable, Pausable, PromisifyFn, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, ReactiveOmitPredicate, ReactivePickPredicate, ReadonlyRefOrGetter, RemovableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stoppable, SyncRefOptions, SyncRefsOptions, ToRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayIncludesComparatorFn, UseArrayIncludesOptions, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalControls, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToNumberOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isClient, isDef, isDefined, isIOS, isObject, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1096
+ export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isClient, isDef, isDefined, isIOS, isObject, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };