@vueuse/shared 8.7.3 → 8.8.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 CHANGED
@@ -4,31 +4,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vueDemi = require('vue-demi');
6
6
 
7
- var __defProp$8 = Object.defineProperty;
8
- var __defProps$5 = Object.defineProperties;
9
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
10
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
11
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
12
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
13
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __spreadValues$8 = (a, b) => {
7
+ var __defProp$9 = Object.defineProperty;
8
+ var __defProps$6 = Object.defineProperties;
9
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
10
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
11
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
12
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
13
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues$9 = (a, b) => {
15
15
  for (var prop in b || (b = {}))
16
- if (__hasOwnProp$a.call(b, prop))
17
- __defNormalProp$8(a, prop, b[prop]);
18
- if (__getOwnPropSymbols$a)
19
- for (var prop of __getOwnPropSymbols$a(b)) {
20
- if (__propIsEnum$a.call(b, prop))
21
- __defNormalProp$8(a, prop, b[prop]);
16
+ if (__hasOwnProp$b.call(b, prop))
17
+ __defNormalProp$9(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols$b)
19
+ for (var prop of __getOwnPropSymbols$b(b)) {
20
+ if (__propIsEnum$b.call(b, prop))
21
+ __defNormalProp$9(a, prop, b[prop]);
22
22
  }
23
23
  return a;
24
24
  };
25
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
25
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
26
26
  function computedEager(fn, options) {
27
27
  var _a;
28
28
  const result = vueDemi.shallowRef();
29
29
  vueDemi.watchEffect(() => {
30
30
  result.value = fn();
31
- }, __spreadProps$5(__spreadValues$8({}, options), {
31
+ }, __spreadProps$6(__spreadValues$9({}, options), {
32
32
  flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
33
33
  }));
34
34
  return vueDemi.readonly(result);
@@ -192,25 +192,25 @@ function logicOr(...args) {
192
192
  return vueDemi.computed(() => args.some((i) => vueDemi.unref(i)));
193
193
  }
194
194
 
195
- var __defProp$7 = Object.defineProperty;
196
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
197
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
198
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
199
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
200
- var __spreadValues$7 = (a, b) => {
195
+ var __defProp$8 = Object.defineProperty;
196
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
197
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
198
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
199
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
200
+ var __spreadValues$8 = (a, b) => {
201
201
  for (var prop in b || (b = {}))
202
- if (__hasOwnProp$9.call(b, prop))
203
- __defNormalProp$7(a, prop, b[prop]);
204
- if (__getOwnPropSymbols$9)
205
- for (var prop of __getOwnPropSymbols$9(b)) {
206
- if (__propIsEnum$9.call(b, prop))
207
- __defNormalProp$7(a, prop, b[prop]);
202
+ if (__hasOwnProp$a.call(b, prop))
203
+ __defNormalProp$8(a, prop, b[prop]);
204
+ if (__getOwnPropSymbols$a)
205
+ for (var prop of __getOwnPropSymbols$a(b)) {
206
+ if (__propIsEnum$a.call(b, prop))
207
+ __defNormalProp$8(a, prop, b[prop]);
208
208
  }
209
209
  return a;
210
210
  };
211
211
  function makeDestructurable(obj, arr) {
212
212
  if (typeof Symbol !== "undefined") {
213
- const clone = __spreadValues$7({}, obj);
213
+ const clone = __spreadValues$8({}, obj);
214
214
  Object.defineProperty(clone, Symbol.iterator, {
215
215
  enumerable: false,
216
216
  value() {
@@ -292,11 +292,13 @@ function reactiveComputed(fn) {
292
292
  }
293
293
 
294
294
  function reactiveOmit(obj, ...keys) {
295
- return reactiveComputed(() => Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !keys.includes(e[0]))));
295
+ const flatKeys = keys.flat();
296
+ return reactiveComputed(() => Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
296
297
  }
297
298
 
298
299
  function reactivePick(obj, ...keys) {
299
- return vueDemi.reactive(Object.fromEntries(keys.map((k) => [k, vueDemi.toRef(obj, k)])));
300
+ const flatKeys = keys.flat();
301
+ return vueDemi.reactive(Object.fromEntries(flatKeys.map((k) => [k, vueDemi.toRef(obj, k)])));
300
302
  }
301
303
 
302
304
  function refAutoReset(defaultValue, afterMs = 1e4) {
@@ -585,6 +587,14 @@ function refWithControl(initial, options = {}) {
585
587
  }
586
588
  const controlledRef = refWithControl;
587
589
 
590
+ function resolveRef(r) {
591
+ return typeof r === "function" ? vueDemi.computed(r) : vueDemi.ref(r);
592
+ }
593
+
594
+ function resolveUnref(r) {
595
+ return typeof r === "function" ? r() : vueDemi.unref(r);
596
+ }
597
+
588
598
  function set(...args) {
589
599
  if (args.length === 2) {
590
600
  const [ref, value] = args;
@@ -631,25 +641,25 @@ function syncRefs(source, targets, options = {}) {
631
641
  return vueDemi.watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
632
642
  }
633
643
 
634
- var __defProp$6 = Object.defineProperty;
635
- var __defProps$4 = Object.defineProperties;
636
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
637
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
638
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
639
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
640
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
641
- var __spreadValues$6 = (a, b) => {
644
+ var __defProp$7 = Object.defineProperty;
645
+ var __defProps$5 = Object.defineProperties;
646
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
647
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
648
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
649
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
650
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
651
+ var __spreadValues$7 = (a, b) => {
642
652
  for (var prop in b || (b = {}))
643
- if (__hasOwnProp$8.call(b, prop))
644
- __defNormalProp$6(a, prop, b[prop]);
645
- if (__getOwnPropSymbols$8)
646
- for (var prop of __getOwnPropSymbols$8(b)) {
647
- if (__propIsEnum$8.call(b, prop))
648
- __defNormalProp$6(a, prop, b[prop]);
653
+ if (__hasOwnProp$9.call(b, prop))
654
+ __defNormalProp$7(a, prop, b[prop]);
655
+ if (__getOwnPropSymbols$9)
656
+ for (var prop of __getOwnPropSymbols$9(b)) {
657
+ if (__propIsEnum$9.call(b, prop))
658
+ __defNormalProp$7(a, prop, b[prop]);
649
659
  }
650
660
  return a;
651
661
  };
652
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
662
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
653
663
  function toRefs(objectRef) {
654
664
  if (!vueDemi.isRef(objectRef))
655
665
  return vueDemi.toRefs(objectRef);
@@ -665,7 +675,7 @@ function toRefs(objectRef) {
665
675
  copy[key] = v;
666
676
  objectRef.value = copy;
667
677
  } else {
668
- const newObject = __spreadProps$4(__spreadValues$6({}, objectRef.value), { [key]: v });
678
+ const newObject = __spreadProps$5(__spreadValues$7({}, objectRef.value), { [key]: v });
669
679
  Object.setPrototypeOf(newObject, objectRef.value);
670
680
  objectRef.value = newObject;
671
681
  }
@@ -922,19 +932,19 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
922
932
  };
923
933
  }
924
934
 
925
- var __defProp$5 = Object.defineProperty;
926
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
927
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
928
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
929
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
930
- var __spreadValues$5 = (a, b) => {
935
+ var __defProp$6 = Object.defineProperty;
936
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
937
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
938
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
939
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
940
+ var __spreadValues$6 = (a, b) => {
931
941
  for (var prop in b || (b = {}))
932
- if (__hasOwnProp$7.call(b, prop))
933
- __defNormalProp$5(a, prop, b[prop]);
934
- if (__getOwnPropSymbols$7)
935
- for (var prop of __getOwnPropSymbols$7(b)) {
936
- if (__propIsEnum$7.call(b, prop))
937
- __defNormalProp$5(a, prop, b[prop]);
942
+ if (__hasOwnProp$8.call(b, prop))
943
+ __defNormalProp$6(a, prop, b[prop]);
944
+ if (__getOwnPropSymbols$8)
945
+ for (var prop of __getOwnPropSymbols$8(b)) {
946
+ if (__propIsEnum$8.call(b, prop))
947
+ __defNormalProp$6(a, prop, b[prop]);
938
948
  }
939
949
  return a;
940
950
  };
@@ -946,7 +956,7 @@ function useInterval(interval = 1e3, options = {}) {
946
956
  const counter = vueDemi.ref(0);
947
957
  const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
948
958
  if (exposeControls) {
949
- return __spreadValues$5({
959
+ return __spreadValues$6({
950
960
  counter
951
961
  }, controls);
952
962
  } else {
@@ -999,19 +1009,19 @@ function useTimeoutFn(cb, interval, options = {}) {
999
1009
  };
1000
1010
  }
1001
1011
 
1002
- var __defProp$4 = Object.defineProperty;
1003
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1004
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1005
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1006
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1007
- var __spreadValues$4 = (a, b) => {
1012
+ var __defProp$5 = Object.defineProperty;
1013
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
1014
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
1015
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
1016
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1017
+ var __spreadValues$5 = (a, b) => {
1008
1018
  for (var prop in b || (b = {}))
1009
- if (__hasOwnProp$6.call(b, prop))
1010
- __defNormalProp$4(a, prop, b[prop]);
1011
- if (__getOwnPropSymbols$6)
1012
- for (var prop of __getOwnPropSymbols$6(b)) {
1013
- if (__propIsEnum$6.call(b, prop))
1014
- __defNormalProp$4(a, prop, b[prop]);
1019
+ if (__hasOwnProp$7.call(b, prop))
1020
+ __defNormalProp$5(a, prop, b[prop]);
1021
+ if (__getOwnPropSymbols$7)
1022
+ for (var prop of __getOwnPropSymbols$7(b)) {
1023
+ if (__propIsEnum$7.call(b, prop))
1024
+ __defNormalProp$5(a, prop, b[prop]);
1015
1025
  }
1016
1026
  return a;
1017
1027
  };
@@ -1022,7 +1032,7 @@ function useTimeout(interval = 1e3, options = {}) {
1022
1032
  const controls = useTimeoutFn(noop, interval, options);
1023
1033
  const ready = vueDemi.computed(() => !controls.isPending.value);
1024
1034
  if (exposeControls) {
1025
- return __spreadValues$4({
1035
+ return __spreadValues$5({
1026
1036
  ready
1027
1037
  }, controls);
1028
1038
  } else {
@@ -1052,17 +1062,17 @@ function useToggle(initialValue = false, options = {}) {
1052
1062
  return [innerValue, toggle];
1053
1063
  }
1054
1064
 
1055
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1056
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1057
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1065
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1066
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1067
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1058
1068
  var __objRest$5 = (source, exclude) => {
1059
1069
  var target = {};
1060
1070
  for (var prop in source)
1061
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
1071
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
1062
1072
  target[prop] = source[prop];
1063
- if (source != null && __getOwnPropSymbols$5)
1064
- for (var prop of __getOwnPropSymbols$5(source)) {
1065
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
1073
+ if (source != null && __getOwnPropSymbols$6)
1074
+ for (var prop of __getOwnPropSymbols$6(source)) {
1075
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
1066
1076
  target[prop] = source[prop];
1067
1077
  }
1068
1078
  return target;
@@ -1076,17 +1086,17 @@ function watchWithFilter(source, cb, options = {}) {
1076
1086
  return vueDemi.watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
1077
1087
  }
1078
1088
 
1079
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1080
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1081
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1089
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1090
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1091
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1082
1092
  var __objRest$4 = (source, exclude) => {
1083
1093
  var target = {};
1084
1094
  for (var prop in source)
1085
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1095
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
1086
1096
  target[prop] = source[prop];
1087
- if (source != null && __getOwnPropSymbols$4)
1088
- for (var prop of __getOwnPropSymbols$4(source)) {
1089
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1097
+ if (source != null && __getOwnPropSymbols$5)
1098
+ for (var prop of __getOwnPropSymbols$5(source)) {
1099
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
1090
1100
  target[prop] = source[prop];
1091
1101
  }
1092
1102
  return target;
@@ -1107,33 +1117,33 @@ function watchAtMost(source, cb, options) {
1107
1117
  return { count: current, stop };
1108
1118
  }
1109
1119
 
1110
- var __defProp$3 = Object.defineProperty;
1111
- var __defProps$3 = Object.defineProperties;
1112
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
1113
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1114
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1115
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1116
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1117
- var __spreadValues$3 = (a, b) => {
1120
+ var __defProp$4 = Object.defineProperty;
1121
+ var __defProps$4 = Object.defineProperties;
1122
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
1123
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1124
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1125
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1126
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1127
+ var __spreadValues$4 = (a, b) => {
1118
1128
  for (var prop in b || (b = {}))
1119
- if (__hasOwnProp$3.call(b, prop))
1120
- __defNormalProp$3(a, prop, b[prop]);
1121
- if (__getOwnPropSymbols$3)
1122
- for (var prop of __getOwnPropSymbols$3(b)) {
1123
- if (__propIsEnum$3.call(b, prop))
1124
- __defNormalProp$3(a, prop, b[prop]);
1129
+ if (__hasOwnProp$4.call(b, prop))
1130
+ __defNormalProp$4(a, prop, b[prop]);
1131
+ if (__getOwnPropSymbols$4)
1132
+ for (var prop of __getOwnPropSymbols$4(b)) {
1133
+ if (__propIsEnum$4.call(b, prop))
1134
+ __defNormalProp$4(a, prop, b[prop]);
1125
1135
  }
1126
1136
  return a;
1127
1137
  };
1128
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1138
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
1129
1139
  var __objRest$3 = (source, exclude) => {
1130
1140
  var target = {};
1131
1141
  for (var prop in source)
1132
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1142
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1133
1143
  target[prop] = source[prop];
1134
- if (source != null && __getOwnPropSymbols$3)
1135
- for (var prop of __getOwnPropSymbols$3(source)) {
1136
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1144
+ if (source != null && __getOwnPropSymbols$4)
1145
+ for (var prop of __getOwnPropSymbols$4(source)) {
1146
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1137
1147
  target[prop] = source[prop];
1138
1148
  }
1139
1149
  return target;
@@ -1146,38 +1156,38 @@ function watchDebounced(source, cb, options = {}) {
1146
1156
  "debounce",
1147
1157
  "maxWait"
1148
1158
  ]);
1149
- return watchWithFilter(source, cb, __spreadProps$3(__spreadValues$3({}, watchOptions), {
1159
+ return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$4({}, watchOptions), {
1150
1160
  eventFilter: debounceFilter(debounce, { maxWait })
1151
1161
  }));
1152
1162
  }
1153
1163
 
1154
- var __defProp$2 = Object.defineProperty;
1155
- var __defProps$2 = Object.defineProperties;
1156
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
1157
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1158
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1159
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1160
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1161
- var __spreadValues$2 = (a, b) => {
1164
+ var __defProp$3 = Object.defineProperty;
1165
+ var __defProps$3 = Object.defineProperties;
1166
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
1167
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1168
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1169
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1170
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1171
+ var __spreadValues$3 = (a, b) => {
1162
1172
  for (var prop in b || (b = {}))
1163
- if (__hasOwnProp$2.call(b, prop))
1164
- __defNormalProp$2(a, prop, b[prop]);
1165
- if (__getOwnPropSymbols$2)
1166
- for (var prop of __getOwnPropSymbols$2(b)) {
1167
- if (__propIsEnum$2.call(b, prop))
1168
- __defNormalProp$2(a, prop, b[prop]);
1173
+ if (__hasOwnProp$3.call(b, prop))
1174
+ __defNormalProp$3(a, prop, b[prop]);
1175
+ if (__getOwnPropSymbols$3)
1176
+ for (var prop of __getOwnPropSymbols$3(b)) {
1177
+ if (__propIsEnum$3.call(b, prop))
1178
+ __defNormalProp$3(a, prop, b[prop]);
1169
1179
  }
1170
1180
  return a;
1171
1181
  };
1172
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1182
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1173
1183
  var __objRest$2 = (source, exclude) => {
1174
1184
  var target = {};
1175
1185
  for (var prop in source)
1176
- if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
1186
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1177
1187
  target[prop] = source[prop];
1178
- if (source != null && __getOwnPropSymbols$2)
1179
- for (var prop of __getOwnPropSymbols$2(source)) {
1180
- if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
1188
+ if (source != null && __getOwnPropSymbols$3)
1189
+ for (var prop of __getOwnPropSymbols$3(source)) {
1190
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1181
1191
  target[prop] = source[prop];
1182
1192
  }
1183
1193
  return target;
@@ -1214,7 +1224,7 @@ function watchIgnorable(source, cb, options = {}) {
1214
1224
  };
1215
1225
  disposables.push(vueDemi.watch(source, () => {
1216
1226
  syncCounter.value++;
1217
- }, __spreadProps$2(__spreadValues$2({}, watchOptions), { flush: "sync" })));
1227
+ }, __spreadProps$3(__spreadValues$3({}, watchOptions), { flush: "sync" })));
1218
1228
  ignoreUpdates = (updater) => {
1219
1229
  const syncCounterPrev = syncCounter.value;
1220
1230
  updater();
@@ -1242,6 +1252,50 @@ function watchOnce(source, cb, options) {
1242
1252
  }, options);
1243
1253
  }
1244
1254
 
1255
+ var __defProp$2 = Object.defineProperty;
1256
+ var __defProps$2 = Object.defineProperties;
1257
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
1258
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1259
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1260
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1261
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1262
+ var __spreadValues$2 = (a, b) => {
1263
+ for (var prop in b || (b = {}))
1264
+ if (__hasOwnProp$2.call(b, prop))
1265
+ __defNormalProp$2(a, prop, b[prop]);
1266
+ if (__getOwnPropSymbols$2)
1267
+ for (var prop of __getOwnPropSymbols$2(b)) {
1268
+ if (__propIsEnum$2.call(b, prop))
1269
+ __defNormalProp$2(a, prop, b[prop]);
1270
+ }
1271
+ return a;
1272
+ };
1273
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1274
+ var __objRest$1 = (source, exclude) => {
1275
+ var target = {};
1276
+ for (var prop in source)
1277
+ if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
1278
+ target[prop] = source[prop];
1279
+ if (source != null && __getOwnPropSymbols$2)
1280
+ for (var prop of __getOwnPropSymbols$2(source)) {
1281
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
1282
+ target[prop] = source[prop];
1283
+ }
1284
+ return target;
1285
+ };
1286
+ function watchPausable(source, cb, options = {}) {
1287
+ const _a = options, {
1288
+ eventFilter: filter
1289
+ } = _a, watchOptions = __objRest$1(_a, [
1290
+ "eventFilter"
1291
+ ]);
1292
+ const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
1293
+ const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$2({}, watchOptions), {
1294
+ eventFilter
1295
+ }));
1296
+ return { stop, pause, resume, isActive };
1297
+ }
1298
+
1245
1299
  var __defProp$1 = Object.defineProperty;
1246
1300
  var __defProps$1 = Object.defineProperties;
1247
1301
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -1261,7 +1315,7 @@ var __spreadValues$1 = (a, b) => {
1261
1315
  return a;
1262
1316
  };
1263
1317
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
1264
- var __objRest$1 = (source, exclude) => {
1318
+ var __objRest = (source, exclude) => {
1265
1319
  var target = {};
1266
1320
  for (var prop in source)
1267
1321
  if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -1273,17 +1327,19 @@ var __objRest$1 = (source, exclude) => {
1273
1327
  }
1274
1328
  return target;
1275
1329
  };
1276
- function watchPausable(source, cb, options = {}) {
1330
+ function watchThrottled(source, cb, options = {}) {
1277
1331
  const _a = options, {
1278
- eventFilter: filter
1279
- } = _a, watchOptions = __objRest$1(_a, [
1280
- "eventFilter"
1332
+ throttle = 0,
1333
+ trailing = true,
1334
+ leading = true
1335
+ } = _a, watchOptions = __objRest(_a, [
1336
+ "throttle",
1337
+ "trailing",
1338
+ "leading"
1281
1339
  ]);
1282
- const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
1283
- const stop = watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
1284
- eventFilter
1340
+ return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
1341
+ eventFilter: throttleFilter(throttle, trailing, leading)
1285
1342
  }));
1286
- return { stop, pause, resume, isActive };
1287
1343
  }
1288
1344
 
1289
1345
  var __defProp = Object.defineProperty;
@@ -1305,31 +1361,47 @@ var __spreadValues = (a, b) => {
1305
1361
  return a;
1306
1362
  };
1307
1363
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1308
- var __objRest = (source, exclude) => {
1309
- var target = {};
1310
- for (var prop in source)
1311
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
1312
- target[prop] = source[prop];
1313
- if (source != null && __getOwnPropSymbols)
1314
- for (var prop of __getOwnPropSymbols(source)) {
1315
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
1316
- target[prop] = source[prop];
1317
- }
1318
- return target;
1319
- };
1320
- function watchThrottled(source, cb, options = {}) {
1321
- const _a = options, {
1322
- throttle = 0,
1323
- trailing = true,
1324
- leading = true
1325
- } = _a, watchOptions = __objRest(_a, [
1326
- "throttle",
1327
- "trailing",
1328
- "leading"
1329
- ]);
1330
- return watchWithFilter(source, cb, __spreadProps(__spreadValues({}, watchOptions), {
1331
- eventFilter: throttleFilter(throttle, trailing, leading)
1332
- }));
1364
+ function watchTriggerable(source, cb, options = {}) {
1365
+ let cleanupFn;
1366
+ function onEffect() {
1367
+ if (!cleanupFn)
1368
+ return;
1369
+ const fn = cleanupFn;
1370
+ cleanupFn = void 0;
1371
+ fn();
1372
+ }
1373
+ function onCleanup(callback) {
1374
+ cleanupFn = callback;
1375
+ }
1376
+ const _cb = (value, oldValue) => {
1377
+ onEffect();
1378
+ return cb(value, oldValue, onCleanup);
1379
+ };
1380
+ const res = watchIgnorable(source, _cb, options);
1381
+ const { ignoreUpdates } = res;
1382
+ const trigger = () => {
1383
+ let res2;
1384
+ ignoreUpdates(() => {
1385
+ res2 = _cb(getWatchSources(source), getOldValue(source));
1386
+ });
1387
+ return res2;
1388
+ };
1389
+ return __spreadProps(__spreadValues({}, res), {
1390
+ trigger
1391
+ });
1392
+ }
1393
+ function getWatchSources(sources) {
1394
+ if (vueDemi.isReactive(sources))
1395
+ return sources;
1396
+ if (Array.isArray(sources))
1397
+ return sources.map((item) => getOneWatchSource(item));
1398
+ return getOneWatchSource(sources);
1399
+ }
1400
+ function getOneWatchSource(source) {
1401
+ return typeof source === "function" ? source() : vueDemi.unref(source);
1402
+ }
1403
+ function getOldValue(source) {
1404
+ return Array.isArray(source) ? source.map(() => void 0) : void 0;
1333
1405
  }
1334
1406
 
1335
1407
  function whenever(source, cb, options) {
@@ -1403,6 +1475,8 @@ exports.refDebounced = refDebounced;
1403
1475
  exports.refDefault = refDefault;
1404
1476
  exports.refThrottled = refThrottled;
1405
1477
  exports.refWithControl = refWithControl;
1478
+ exports.resolveRef = resolveRef;
1479
+ exports.resolveUnref = resolveUnref;
1406
1480
  exports.set = set;
1407
1481
  exports.syncRef = syncRef;
1408
1482
  exports.syncRefs = syncRefs;
@@ -1436,5 +1510,6 @@ exports.watchIgnorable = watchIgnorable;
1436
1510
  exports.watchOnce = watchOnce;
1437
1511
  exports.watchPausable = watchPausable;
1438
1512
  exports.watchThrottled = watchThrottled;
1513
+ exports.watchTriggerable = watchTriggerable;
1439
1514
  exports.watchWithFilter = watchWithFilter;
1440
1515
  exports.whenever = whenever;