@vueuse/shared 8.7.5 → 8.9.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,60 +1,248 @@
1
- import { shallowRef, watchEffect, readonly, ref, watch, customRef, effectScope, provide, inject, getCurrentScope, onScopeDispose, isVue3, isRef, unref, computed, reactive, toRefs as toRefs$1, toRef, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted } from 'vue-demi';
1
+ import { shallowRef, watchEffect, readonly, ref, unref, isVue3, watch, customRef, effectScope, provide, inject, getCurrentScope, onScopeDispose, isRef, computed, reactive, toRefs as toRefs$1, toRef, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue-demi';
2
2
 
3
- var __defProp$8 = Object.defineProperty;
4
- var __defProps$5 = Object.defineProperties;
5
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
7
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues$8 = (a, b) => {
3
+ var __defProp$9 = Object.defineProperty;
4
+ var __defProps$6 = Object.defineProperties;
5
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues$9 = (a, b) => {
11
11
  for (var prop in b || (b = {}))
12
- if (__hasOwnProp$a.call(b, prop))
13
- __defNormalProp$8(a, prop, b[prop]);
14
- if (__getOwnPropSymbols$a)
15
- for (var prop of __getOwnPropSymbols$a(b)) {
16
- if (__propIsEnum$a.call(b, prop))
17
- __defNormalProp$8(a, prop, b[prop]);
12
+ if (__hasOwnProp$b.call(b, prop))
13
+ __defNormalProp$9(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols$b)
15
+ for (var prop of __getOwnPropSymbols$b(b)) {
16
+ if (__propIsEnum$b.call(b, prop))
17
+ __defNormalProp$9(a, prop, b[prop]);
18
18
  }
19
19
  return a;
20
20
  };
21
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
21
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
22
22
  function computedEager(fn, options) {
23
23
  var _a;
24
24
  const result = shallowRef();
25
25
  watchEffect(() => {
26
26
  result.value = fn();
27
- }, __spreadProps$5(__spreadValues$8({}, options), {
27
+ }, __spreadProps$6(__spreadValues$9({}, options), {
28
28
  flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
29
29
  }));
30
30
  return readonly(result);
31
31
  }
32
32
 
33
+ var _a;
34
+ const isClient = typeof window !== "undefined";
35
+ const isDef = (val) => typeof val !== "undefined";
36
+ const assert = (condition, ...infos) => {
37
+ if (!condition)
38
+ console.warn(...infos);
39
+ };
40
+ const toString = Object.prototype.toString;
41
+ const isBoolean = (val) => typeof val === "boolean";
42
+ const isFunction = (val) => typeof val === "function";
43
+ const isNumber = (val) => typeof val === "number";
44
+ const isString = (val) => typeof val === "string";
45
+ const isObject = (val) => toString.call(val) === "[object Object]";
46
+ const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
47
+ const now = () => Date.now();
48
+ const timestamp = () => +Date.now();
49
+ const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
50
+ const noop = () => {
51
+ };
52
+ const rand = (min, max) => {
53
+ min = Math.ceil(min);
54
+ max = Math.floor(max);
55
+ return Math.floor(Math.random() * (max - min + 1)) + min;
56
+ };
57
+ const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
58
+
59
+ function createFilterWrapper(filter, fn) {
60
+ function wrapper(...args) {
61
+ filter(() => fn.apply(this, args), { fn, thisArg: this, args });
62
+ }
63
+ return wrapper;
64
+ }
65
+ const bypassFilter = (invoke) => {
66
+ return invoke();
67
+ };
68
+ function debounceFilter(ms, options = {}) {
69
+ let timer;
70
+ let maxTimer;
71
+ const filter = (invoke) => {
72
+ const duration = unref(ms);
73
+ const maxDuration = unref(options.maxWait);
74
+ if (timer)
75
+ clearTimeout(timer);
76
+ if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
77
+ if (maxTimer) {
78
+ clearTimeout(maxTimer);
79
+ maxTimer = null;
80
+ }
81
+ return invoke();
82
+ }
83
+ if (maxDuration && !maxTimer) {
84
+ maxTimer = setTimeout(() => {
85
+ if (timer)
86
+ clearTimeout(timer);
87
+ maxTimer = null;
88
+ invoke();
89
+ }, maxDuration);
90
+ }
91
+ timer = setTimeout(() => {
92
+ if (maxTimer)
93
+ clearTimeout(maxTimer);
94
+ maxTimer = null;
95
+ invoke();
96
+ }, duration);
97
+ };
98
+ return filter;
99
+ }
100
+ function throttleFilter(ms, trailing = true, leading = true) {
101
+ let lastExec = 0;
102
+ let timer;
103
+ let isLeading = true;
104
+ const clear = () => {
105
+ if (timer) {
106
+ clearTimeout(timer);
107
+ timer = void 0;
108
+ }
109
+ };
110
+ const filter = (invoke) => {
111
+ const duration = unref(ms);
112
+ const elapsed = Date.now() - lastExec;
113
+ clear();
114
+ if (duration <= 0) {
115
+ lastExec = Date.now();
116
+ return invoke();
117
+ }
118
+ if (elapsed > duration && (leading || !isLeading)) {
119
+ lastExec = Date.now();
120
+ invoke();
121
+ } else if (trailing) {
122
+ timer = setTimeout(() => {
123
+ lastExec = Date.now();
124
+ isLeading = true;
125
+ clear();
126
+ invoke();
127
+ }, duration);
128
+ }
129
+ if (!leading && !timer)
130
+ timer = setTimeout(() => isLeading = true, duration);
131
+ isLeading = false;
132
+ };
133
+ return filter;
134
+ }
135
+ function pausableFilter(extendFilter = bypassFilter) {
136
+ const isActive = ref(true);
137
+ function pause() {
138
+ isActive.value = false;
139
+ }
140
+ function resume() {
141
+ isActive.value = true;
142
+ }
143
+ const eventFilter = (...args) => {
144
+ if (isActive.value)
145
+ extendFilter(...args);
146
+ };
147
+ return { isActive, pause, resume, eventFilter };
148
+ }
149
+
150
+ function __onlyVue3(name = "this function") {
151
+ if (isVue3)
152
+ return;
153
+ throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
154
+ }
155
+ const directiveHooks = {
156
+ mounted: isVue3 ? "mounted" : "inserted",
157
+ updated: isVue3 ? "updated" : "componentUpdated",
158
+ unmounted: isVue3 ? "unmounted" : "unbind"
159
+ };
160
+
161
+ function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
162
+ return new Promise((resolve, reject) => {
163
+ if (throwOnTimeout)
164
+ setTimeout(() => reject(reason), ms);
165
+ else
166
+ setTimeout(resolve, ms);
167
+ });
168
+ }
169
+ function identity(arg) {
170
+ return arg;
171
+ }
172
+ function createSingletonPromise(fn) {
173
+ let _promise;
174
+ function wrapper() {
175
+ if (!_promise)
176
+ _promise = fn();
177
+ return _promise;
178
+ }
179
+ wrapper.reset = async () => {
180
+ const _prev = _promise;
181
+ _promise = void 0;
182
+ if (_prev)
183
+ await _prev;
184
+ };
185
+ return wrapper;
186
+ }
187
+ function invoke(fn) {
188
+ return fn();
189
+ }
190
+ function containsProp(obj, ...props) {
191
+ return props.some((k) => k in obj);
192
+ }
193
+ function increaseWithUnit(target, delta) {
194
+ var _a;
195
+ if (typeof target === "number")
196
+ return target + delta;
197
+ const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
198
+ const unit = target.slice(value.length);
199
+ const result = parseFloat(value) + delta;
200
+ if (Number.isNaN(result))
201
+ return target;
202
+ return result + unit;
203
+ }
204
+ function objectPick(obj, keys, omitUndefined = false) {
205
+ return keys.reduce((n, k) => {
206
+ if (k in obj) {
207
+ if (!omitUndefined || obj[k] !== void 0)
208
+ n[k] = obj[k];
209
+ }
210
+ return n;
211
+ }, {});
212
+ }
213
+
33
214
  function computedWithControl(source, fn) {
34
215
  let v = void 0;
35
216
  let track;
36
217
  let trigger;
37
218
  const dirty = ref(true);
38
- watch(source, () => {
219
+ const update = () => {
39
220
  dirty.value = true;
40
221
  trigger();
41
- }, { flush: "sync" });
42
- return customRef((_track, _trigger) => {
222
+ };
223
+ watch(source, update, { flush: "sync" });
224
+ const get = isFunction(fn) ? fn : fn.get;
225
+ const set = isFunction(fn) ? void 0 : fn.set;
226
+ const result = customRef((_track, _trigger) => {
43
227
  track = _track;
44
228
  trigger = _trigger;
45
229
  return {
46
230
  get() {
47
231
  if (dirty.value) {
48
- v = fn();
232
+ v = get();
49
233
  dirty.value = false;
50
234
  }
51
235
  track();
52
236
  return v;
53
237
  },
54
- set() {
238
+ set(v2) {
239
+ set == null ? void 0 : set(v2);
55
240
  }
56
241
  };
57
242
  });
243
+ if (Object.isExtensible(result))
244
+ result.trigger = update;
245
+ return result;
58
246
  }
59
247
 
60
248
  function createEventHook() {
@@ -133,17 +321,6 @@ function createSharedComposable(composable) {
133
321
  };
134
322
  }
135
323
 
136
- function __onlyVue3(name = "this function") {
137
- if (isVue3)
138
- return;
139
- throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
140
- }
141
- const directiveHooks = {
142
- mounted: isVue3 ? "mounted" : "inserted",
143
- updated: isVue3 ? "updated" : "componentUpdated",
144
- unmounted: isVue3 ? "unmounted" : "unbind"
145
- };
146
-
147
324
  function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
148
325
  __onlyVue3();
149
326
  for (const [key, value] of Object.entries(extend)) {
@@ -188,25 +365,25 @@ function logicOr(...args) {
188
365
  return computed(() => args.some((i) => unref(i)));
189
366
  }
190
367
 
191
- var __defProp$7 = Object.defineProperty;
192
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
193
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
194
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
195
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
196
- var __spreadValues$7 = (a, b) => {
368
+ var __defProp$8 = Object.defineProperty;
369
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
370
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
371
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
372
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
373
+ var __spreadValues$8 = (a, b) => {
197
374
  for (var prop in b || (b = {}))
198
- if (__hasOwnProp$9.call(b, prop))
199
- __defNormalProp$7(a, prop, b[prop]);
200
- if (__getOwnPropSymbols$9)
201
- for (var prop of __getOwnPropSymbols$9(b)) {
202
- if (__propIsEnum$9.call(b, prop))
203
- __defNormalProp$7(a, prop, b[prop]);
375
+ if (__hasOwnProp$a.call(b, prop))
376
+ __defNormalProp$8(a, prop, b[prop]);
377
+ if (__getOwnPropSymbols$a)
378
+ for (var prop of __getOwnPropSymbols$a(b)) {
379
+ if (__propIsEnum$a.call(b, prop))
380
+ __defNormalProp$8(a, prop, b[prop]);
204
381
  }
205
382
  return a;
206
383
  };
207
384
  function makeDestructurable(obj, arr) {
208
385
  if (typeof Symbol !== "undefined") {
209
- const clone = __spreadValues$7({}, obj);
386
+ const clone = __spreadValues$8({}, obj);
210
387
  Object.defineProperty(clone, Symbol.iterator, {
211
388
  enumerable: false,
212
389
  value() {
@@ -288,11 +465,13 @@ function reactiveComputed(fn) {
288
465
  }
289
466
 
290
467
  function reactiveOmit(obj, ...keys) {
291
- return reactiveComputed(() => Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !keys.includes(e[0]))));
468
+ const flatKeys = keys.flat();
469
+ return reactiveComputed(() => Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));
292
470
  }
293
471
 
294
472
  function reactivePick(obj, ...keys) {
295
- return reactive(Object.fromEntries(keys.map((k) => [k, toRef(obj, k)])));
473
+ const flatKeys = keys.flat();
474
+ return reactive(Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
296
475
  }
297
476
 
298
477
  function refAutoReset(defaultValue, afterMs = 1e4) {
@@ -321,176 +500,6 @@ function refAutoReset(defaultValue, afterMs = 1e4) {
321
500
  });
322
501
  }
323
502
 
324
- var _a;
325
- const isClient = typeof window !== "undefined";
326
- const isDef = (val) => typeof val !== "undefined";
327
- const assert = (condition, ...infos) => {
328
- if (!condition)
329
- console.warn(...infos);
330
- };
331
- const toString = Object.prototype.toString;
332
- const isBoolean = (val) => typeof val === "boolean";
333
- const isFunction = (val) => typeof val === "function";
334
- const isNumber = (val) => typeof val === "number";
335
- const isString = (val) => typeof val === "string";
336
- const isObject = (val) => toString.call(val) === "[object Object]";
337
- const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
338
- const now = () => Date.now();
339
- const timestamp = () => +Date.now();
340
- const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
341
- const noop = () => {
342
- };
343
- const rand = (min, max) => {
344
- min = Math.ceil(min);
345
- max = Math.floor(max);
346
- return Math.floor(Math.random() * (max - min + 1)) + min;
347
- };
348
- const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
349
-
350
- function createFilterWrapper(filter, fn) {
351
- function wrapper(...args) {
352
- filter(() => fn.apply(this, args), { fn, thisArg: this, args });
353
- }
354
- return wrapper;
355
- }
356
- const bypassFilter = (invoke) => {
357
- return invoke();
358
- };
359
- function debounceFilter(ms, options = {}) {
360
- let timer;
361
- let maxTimer;
362
- const filter = (invoke) => {
363
- const duration = unref(ms);
364
- const maxDuration = unref(options.maxWait);
365
- if (timer)
366
- clearTimeout(timer);
367
- if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
368
- if (maxTimer) {
369
- clearTimeout(maxTimer);
370
- maxTimer = null;
371
- }
372
- return invoke();
373
- }
374
- if (maxDuration && !maxTimer) {
375
- maxTimer = setTimeout(() => {
376
- if (timer)
377
- clearTimeout(timer);
378
- maxTimer = null;
379
- invoke();
380
- }, maxDuration);
381
- }
382
- timer = setTimeout(() => {
383
- if (maxTimer)
384
- clearTimeout(maxTimer);
385
- maxTimer = null;
386
- invoke();
387
- }, duration);
388
- };
389
- return filter;
390
- }
391
- function throttleFilter(ms, trailing = true, leading = true) {
392
- let lastExec = 0;
393
- let timer;
394
- let isLeading = true;
395
- const clear = () => {
396
- if (timer) {
397
- clearTimeout(timer);
398
- timer = void 0;
399
- }
400
- };
401
- const filter = (invoke) => {
402
- const duration = unref(ms);
403
- const elapsed = Date.now() - lastExec;
404
- clear();
405
- if (duration <= 0) {
406
- lastExec = Date.now();
407
- return invoke();
408
- }
409
- if (elapsed > duration && (leading || !isLeading)) {
410
- lastExec = Date.now();
411
- invoke();
412
- } else if (trailing) {
413
- timer = setTimeout(() => {
414
- lastExec = Date.now();
415
- isLeading = true;
416
- clear();
417
- invoke();
418
- }, duration);
419
- }
420
- if (!leading && !timer)
421
- timer = setTimeout(() => isLeading = true, duration);
422
- isLeading = false;
423
- };
424
- return filter;
425
- }
426
- function pausableFilter(extendFilter = bypassFilter) {
427
- const isActive = ref(true);
428
- function pause() {
429
- isActive.value = false;
430
- }
431
- function resume() {
432
- isActive.value = true;
433
- }
434
- const eventFilter = (...args) => {
435
- if (isActive.value)
436
- extendFilter(...args);
437
- };
438
- return { isActive, pause, resume, eventFilter };
439
- }
440
-
441
- function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
442
- return new Promise((resolve, reject) => {
443
- if (throwOnTimeout)
444
- setTimeout(() => reject(reason), ms);
445
- else
446
- setTimeout(resolve, ms);
447
- });
448
- }
449
- function identity(arg) {
450
- return arg;
451
- }
452
- function createSingletonPromise(fn) {
453
- let _promise;
454
- function wrapper() {
455
- if (!_promise)
456
- _promise = fn();
457
- return _promise;
458
- }
459
- wrapper.reset = async () => {
460
- const _prev = _promise;
461
- _promise = void 0;
462
- if (_prev)
463
- await _prev;
464
- };
465
- return wrapper;
466
- }
467
- function invoke(fn) {
468
- return fn();
469
- }
470
- function containsProp(obj, ...props) {
471
- return props.some((k) => k in obj);
472
- }
473
- function increaseWithUnit(target, delta) {
474
- var _a;
475
- if (typeof target === "number")
476
- return target + delta;
477
- const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
478
- const unit = target.slice(value.length);
479
- const result = parseFloat(value) + delta;
480
- if (Number.isNaN(result))
481
- return target;
482
- return result + unit;
483
- }
484
- function objectPick(obj, keys, omitUndefined = false) {
485
- return keys.reduce((n, k) => {
486
- if (k in obj) {
487
- if (!omitUndefined || obj[k] !== void 0)
488
- n[k] = obj[k];
489
- }
490
- return n;
491
- }, {});
492
- }
493
-
494
503
  function useDebounceFn(fn, ms = 200, options = {}) {
495
504
  return createFilterWrapper(debounceFilter(ms, options), fn);
496
505
  }
@@ -581,6 +590,14 @@ function refWithControl(initial, options = {}) {
581
590
  }
582
591
  const controlledRef = refWithControl;
583
592
 
593
+ function resolveRef(r) {
594
+ return typeof r === "function" ? computed(r) : ref(r);
595
+ }
596
+
597
+ function resolveUnref(r) {
598
+ return typeof r === "function" ? r() : unref(r);
599
+ }
600
+
584
601
  function set(...args) {
585
602
  if (args.length === 2) {
586
603
  const [ref, value] = args;
@@ -627,25 +644,25 @@ function syncRefs(source, targets, options = {}) {
627
644
  return watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
628
645
  }
629
646
 
630
- var __defProp$6 = Object.defineProperty;
631
- var __defProps$4 = Object.defineProperties;
632
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
633
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
634
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
635
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
636
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
637
- var __spreadValues$6 = (a, b) => {
647
+ var __defProp$7 = Object.defineProperty;
648
+ var __defProps$5 = Object.defineProperties;
649
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
650
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
651
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
652
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
653
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
654
+ var __spreadValues$7 = (a, b) => {
638
655
  for (var prop in b || (b = {}))
639
- if (__hasOwnProp$8.call(b, prop))
640
- __defNormalProp$6(a, prop, b[prop]);
641
- if (__getOwnPropSymbols$8)
642
- for (var prop of __getOwnPropSymbols$8(b)) {
643
- if (__propIsEnum$8.call(b, prop))
644
- __defNormalProp$6(a, prop, b[prop]);
656
+ if (__hasOwnProp$9.call(b, prop))
657
+ __defNormalProp$7(a, prop, b[prop]);
658
+ if (__getOwnPropSymbols$9)
659
+ for (var prop of __getOwnPropSymbols$9(b)) {
660
+ if (__propIsEnum$9.call(b, prop))
661
+ __defNormalProp$7(a, prop, b[prop]);
645
662
  }
646
663
  return a;
647
664
  };
648
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
665
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
649
666
  function toRefs(objectRef) {
650
667
  if (!isRef(objectRef))
651
668
  return toRefs$1(objectRef);
@@ -661,7 +678,7 @@ function toRefs(objectRef) {
661
678
  copy[key] = v;
662
679
  objectRef.value = copy;
663
680
  } else {
664
- const newObject = __spreadProps$4(__spreadValues$6({}, objectRef.value), { [key]: v });
681
+ const newObject = __spreadProps$5(__spreadValues$7({}, objectRef.value), { [key]: v });
665
682
  Object.setPrototypeOf(newObject, objectRef.value);
666
683
  objectRef.value = newObject;
667
684
  }
@@ -918,19 +935,19 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
918
935
  };
919
936
  }
920
937
 
921
- var __defProp$5 = Object.defineProperty;
922
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
923
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
924
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
925
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
926
- var __spreadValues$5 = (a, b) => {
938
+ var __defProp$6 = Object.defineProperty;
939
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
940
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
941
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
942
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
943
+ var __spreadValues$6 = (a, b) => {
927
944
  for (var prop in b || (b = {}))
928
- if (__hasOwnProp$7.call(b, prop))
929
- __defNormalProp$5(a, prop, b[prop]);
930
- if (__getOwnPropSymbols$7)
931
- for (var prop of __getOwnPropSymbols$7(b)) {
932
- if (__propIsEnum$7.call(b, prop))
933
- __defNormalProp$5(a, prop, b[prop]);
945
+ if (__hasOwnProp$8.call(b, prop))
946
+ __defNormalProp$6(a, prop, b[prop]);
947
+ if (__getOwnPropSymbols$8)
948
+ for (var prop of __getOwnPropSymbols$8(b)) {
949
+ if (__propIsEnum$8.call(b, prop))
950
+ __defNormalProp$6(a, prop, b[prop]);
934
951
  }
935
952
  return a;
936
953
  };
@@ -942,7 +959,7 @@ function useInterval(interval = 1e3, options = {}) {
942
959
  const counter = ref(0);
943
960
  const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
944
961
  if (exposeControls) {
945
- return __spreadValues$5({
962
+ return __spreadValues$6({
946
963
  counter
947
964
  }, controls);
948
965
  } else {
@@ -995,19 +1012,19 @@ function useTimeoutFn(cb, interval, options = {}) {
995
1012
  };
996
1013
  }
997
1014
 
998
- var __defProp$4 = Object.defineProperty;
999
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1000
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1001
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1002
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1003
- var __spreadValues$4 = (a, b) => {
1015
+ var __defProp$5 = Object.defineProperty;
1016
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
1017
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
1018
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
1019
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1020
+ var __spreadValues$5 = (a, b) => {
1004
1021
  for (var prop in b || (b = {}))
1005
- if (__hasOwnProp$6.call(b, prop))
1006
- __defNormalProp$4(a, prop, b[prop]);
1007
- if (__getOwnPropSymbols$6)
1008
- for (var prop of __getOwnPropSymbols$6(b)) {
1009
- if (__propIsEnum$6.call(b, prop))
1010
- __defNormalProp$4(a, prop, b[prop]);
1022
+ if (__hasOwnProp$7.call(b, prop))
1023
+ __defNormalProp$5(a, prop, b[prop]);
1024
+ if (__getOwnPropSymbols$7)
1025
+ for (var prop of __getOwnPropSymbols$7(b)) {
1026
+ if (__propIsEnum$7.call(b, prop))
1027
+ __defNormalProp$5(a, prop, b[prop]);
1011
1028
  }
1012
1029
  return a;
1013
1030
  };
@@ -1018,7 +1035,7 @@ function useTimeout(interval = 1e3, options = {}) {
1018
1035
  const controls = useTimeoutFn(noop, interval, options);
1019
1036
  const ready = computed(() => !controls.isPending.value);
1020
1037
  if (exposeControls) {
1021
- return __spreadValues$4({
1038
+ return __spreadValues$5({
1022
1039
  ready
1023
1040
  }, controls);
1024
1041
  } else {
@@ -1048,17 +1065,42 @@ function useToggle(initialValue = false, options = {}) {
1048
1065
  return [innerValue, toggle];
1049
1066
  }
1050
1067
 
1051
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1052
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1053
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1068
+ function watchArray(source, cb, options) {
1069
+ let oldList = (options == null ? void 0 : options.immediate) ? [] : [
1070
+ ...source instanceof Function ? source() : Array.isArray(source) ? source : unref(source)
1071
+ ];
1072
+ return watch(source, (newList, _, onCleanup) => {
1073
+ const oldListRemains = new Array(oldList.length);
1074
+ const added = [];
1075
+ for (const obj of newList) {
1076
+ let found = false;
1077
+ for (let i = 0; i < oldList.length; i++) {
1078
+ if (!oldListRemains[i] && obj === oldList[i]) {
1079
+ oldListRemains[i] = true;
1080
+ found = true;
1081
+ break;
1082
+ }
1083
+ }
1084
+ if (!found)
1085
+ added.push(obj);
1086
+ }
1087
+ const removed = oldList.filter((_2, i) => !oldListRemains[i]);
1088
+ cb(newList, oldList, added, removed, onCleanup);
1089
+ oldList = [...newList];
1090
+ }, options);
1091
+ }
1092
+
1093
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1094
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1095
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1054
1096
  var __objRest$5 = (source, exclude) => {
1055
1097
  var target = {};
1056
1098
  for (var prop in source)
1057
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
1099
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
1058
1100
  target[prop] = source[prop];
1059
- if (source != null && __getOwnPropSymbols$5)
1060
- for (var prop of __getOwnPropSymbols$5(source)) {
1061
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
1101
+ if (source != null && __getOwnPropSymbols$6)
1102
+ for (var prop of __getOwnPropSymbols$6(source)) {
1103
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
1062
1104
  target[prop] = source[prop];
1063
1105
  }
1064
1106
  return target;
@@ -1072,17 +1114,17 @@ function watchWithFilter(source, cb, options = {}) {
1072
1114
  return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
1073
1115
  }
1074
1116
 
1075
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1076
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1077
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1117
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1118
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1119
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1078
1120
  var __objRest$4 = (source, exclude) => {
1079
1121
  var target = {};
1080
1122
  for (var prop in source)
1081
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1123
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
1082
1124
  target[prop] = source[prop];
1083
- if (source != null && __getOwnPropSymbols$4)
1084
- for (var prop of __getOwnPropSymbols$4(source)) {
1085
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1125
+ if (source != null && __getOwnPropSymbols$5)
1126
+ for (var prop of __getOwnPropSymbols$5(source)) {
1127
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
1086
1128
  target[prop] = source[prop];
1087
1129
  }
1088
1130
  return target;
@@ -1103,33 +1145,33 @@ function watchAtMost(source, cb, options) {
1103
1145
  return { count: current, stop };
1104
1146
  }
1105
1147
 
1106
- var __defProp$3 = Object.defineProperty;
1107
- var __defProps$3 = Object.defineProperties;
1108
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
1109
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1110
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1111
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1112
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1113
- var __spreadValues$3 = (a, b) => {
1148
+ var __defProp$4 = Object.defineProperty;
1149
+ var __defProps$4 = Object.defineProperties;
1150
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
1151
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1152
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1153
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1154
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1155
+ var __spreadValues$4 = (a, b) => {
1114
1156
  for (var prop in b || (b = {}))
1115
- if (__hasOwnProp$3.call(b, prop))
1116
- __defNormalProp$3(a, prop, b[prop]);
1117
- if (__getOwnPropSymbols$3)
1118
- for (var prop of __getOwnPropSymbols$3(b)) {
1119
- if (__propIsEnum$3.call(b, prop))
1120
- __defNormalProp$3(a, prop, b[prop]);
1157
+ if (__hasOwnProp$4.call(b, prop))
1158
+ __defNormalProp$4(a, prop, b[prop]);
1159
+ if (__getOwnPropSymbols$4)
1160
+ for (var prop of __getOwnPropSymbols$4(b)) {
1161
+ if (__propIsEnum$4.call(b, prop))
1162
+ __defNormalProp$4(a, prop, b[prop]);
1121
1163
  }
1122
1164
  return a;
1123
1165
  };
1124
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1166
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
1125
1167
  var __objRest$3 = (source, exclude) => {
1126
1168
  var target = {};
1127
1169
  for (var prop in source)
1128
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1170
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1129
1171
  target[prop] = source[prop];
1130
- if (source != null && __getOwnPropSymbols$3)
1131
- for (var prop of __getOwnPropSymbols$3(source)) {
1132
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1172
+ if (source != null && __getOwnPropSymbols$4)
1173
+ for (var prop of __getOwnPropSymbols$4(source)) {
1174
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1133
1175
  target[prop] = source[prop];
1134
1176
  }
1135
1177
  return target;
@@ -1142,38 +1184,38 @@ function watchDebounced(source, cb, options = {}) {
1142
1184
  "debounce",
1143
1185
  "maxWait"
1144
1186
  ]);
1145
- return watchWithFilter(source, cb, __spreadProps$3(__spreadValues$3({}, watchOptions), {
1187
+ return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$4({}, watchOptions), {
1146
1188
  eventFilter: debounceFilter(debounce, { maxWait })
1147
1189
  }));
1148
1190
  }
1149
1191
 
1150
- var __defProp$2 = Object.defineProperty;
1151
- var __defProps$2 = Object.defineProperties;
1152
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
1153
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1154
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1155
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1156
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1157
- var __spreadValues$2 = (a, b) => {
1192
+ var __defProp$3 = Object.defineProperty;
1193
+ var __defProps$3 = Object.defineProperties;
1194
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
1195
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1196
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1197
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1198
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1199
+ var __spreadValues$3 = (a, b) => {
1158
1200
  for (var prop in b || (b = {}))
1159
- if (__hasOwnProp$2.call(b, prop))
1160
- __defNormalProp$2(a, prop, b[prop]);
1161
- if (__getOwnPropSymbols$2)
1162
- for (var prop of __getOwnPropSymbols$2(b)) {
1163
- if (__propIsEnum$2.call(b, prop))
1164
- __defNormalProp$2(a, prop, b[prop]);
1201
+ if (__hasOwnProp$3.call(b, prop))
1202
+ __defNormalProp$3(a, prop, b[prop]);
1203
+ if (__getOwnPropSymbols$3)
1204
+ for (var prop of __getOwnPropSymbols$3(b)) {
1205
+ if (__propIsEnum$3.call(b, prop))
1206
+ __defNormalProp$3(a, prop, b[prop]);
1165
1207
  }
1166
1208
  return a;
1167
1209
  };
1168
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1210
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1169
1211
  var __objRest$2 = (source, exclude) => {
1170
1212
  var target = {};
1171
1213
  for (var prop in source)
1172
- if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
1214
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1173
1215
  target[prop] = source[prop];
1174
- if (source != null && __getOwnPropSymbols$2)
1175
- for (var prop of __getOwnPropSymbols$2(source)) {
1176
- if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
1216
+ if (source != null && __getOwnPropSymbols$3)
1217
+ for (var prop of __getOwnPropSymbols$3(source)) {
1218
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1177
1219
  target[prop] = source[prop];
1178
1220
  }
1179
1221
  return target;
@@ -1210,7 +1252,7 @@ function watchIgnorable(source, cb, options = {}) {
1210
1252
  };
1211
1253
  disposables.push(watch(source, () => {
1212
1254
  syncCounter.value++;
1213
- }, __spreadProps$2(__spreadValues$2({}, watchOptions), { flush: "sync" })));
1255
+ }, __spreadProps$3(__spreadValues$3({}, watchOptions), { flush: "sync" })));
1214
1256
  ignoreUpdates = (updater) => {
1215
1257
  const syncCounterPrev = syncCounter.value;
1216
1258
  updater();
@@ -1238,6 +1280,50 @@ function watchOnce(source, cb, options) {
1238
1280
  }, options);
1239
1281
  }
1240
1282
 
1283
+ var __defProp$2 = Object.defineProperty;
1284
+ var __defProps$2 = Object.defineProperties;
1285
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
1286
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1287
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1288
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1289
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1290
+ var __spreadValues$2 = (a, b) => {
1291
+ for (var prop in b || (b = {}))
1292
+ if (__hasOwnProp$2.call(b, prop))
1293
+ __defNormalProp$2(a, prop, b[prop]);
1294
+ if (__getOwnPropSymbols$2)
1295
+ for (var prop of __getOwnPropSymbols$2(b)) {
1296
+ if (__propIsEnum$2.call(b, prop))
1297
+ __defNormalProp$2(a, prop, b[prop]);
1298
+ }
1299
+ return a;
1300
+ };
1301
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1302
+ var __objRest$1 = (source, exclude) => {
1303
+ var target = {};
1304
+ for (var prop in source)
1305
+ if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
1306
+ target[prop] = source[prop];
1307
+ if (source != null && __getOwnPropSymbols$2)
1308
+ for (var prop of __getOwnPropSymbols$2(source)) {
1309
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
1310
+ target[prop] = source[prop];
1311
+ }
1312
+ return target;
1313
+ };
1314
+ function watchPausable(source, cb, options = {}) {
1315
+ const _a = options, {
1316
+ eventFilter: filter
1317
+ } = _a, watchOptions = __objRest$1(_a, [
1318
+ "eventFilter"
1319
+ ]);
1320
+ const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
1321
+ const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$2({}, watchOptions), {
1322
+ eventFilter
1323
+ }));
1324
+ return { stop, pause, resume, isActive };
1325
+ }
1326
+
1241
1327
  var __defProp$1 = Object.defineProperty;
1242
1328
  var __defProps$1 = Object.defineProperties;
1243
1329
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -1257,7 +1343,7 @@ var __spreadValues$1 = (a, b) => {
1257
1343
  return a;
1258
1344
  };
1259
1345
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
1260
- var __objRest$1 = (source, exclude) => {
1346
+ var __objRest = (source, exclude) => {
1261
1347
  var target = {};
1262
1348
  for (var prop in source)
1263
1349
  if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -1269,17 +1355,19 @@ var __objRest$1 = (source, exclude) => {
1269
1355
  }
1270
1356
  return target;
1271
1357
  };
1272
- function watchPausable(source, cb, options = {}) {
1358
+ function watchThrottled(source, cb, options = {}) {
1273
1359
  const _a = options, {
1274
- eventFilter: filter
1275
- } = _a, watchOptions = __objRest$1(_a, [
1276
- "eventFilter"
1360
+ throttle = 0,
1361
+ trailing = true,
1362
+ leading = true
1363
+ } = _a, watchOptions = __objRest(_a, [
1364
+ "throttle",
1365
+ "trailing",
1366
+ "leading"
1277
1367
  ]);
1278
- const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
1279
- const stop = watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
1280
- eventFilter
1368
+ return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
1369
+ eventFilter: throttleFilter(throttle, trailing, leading)
1281
1370
  }));
1282
- return { stop, pause, resume, isActive };
1283
1371
  }
1284
1372
 
1285
1373
  var __defProp = Object.defineProperty;
@@ -1301,31 +1389,47 @@ var __spreadValues = (a, b) => {
1301
1389
  return a;
1302
1390
  };
1303
1391
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1304
- var __objRest = (source, exclude) => {
1305
- var target = {};
1306
- for (var prop in source)
1307
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
1308
- target[prop] = source[prop];
1309
- if (source != null && __getOwnPropSymbols)
1310
- for (var prop of __getOwnPropSymbols(source)) {
1311
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
1312
- target[prop] = source[prop];
1313
- }
1314
- return target;
1315
- };
1316
- function watchThrottled(source, cb, options = {}) {
1317
- const _a = options, {
1318
- throttle = 0,
1319
- trailing = true,
1320
- leading = true
1321
- } = _a, watchOptions = __objRest(_a, [
1322
- "throttle",
1323
- "trailing",
1324
- "leading"
1325
- ]);
1326
- return watchWithFilter(source, cb, __spreadProps(__spreadValues({}, watchOptions), {
1327
- eventFilter: throttleFilter(throttle, trailing, leading)
1328
- }));
1392
+ function watchTriggerable(source, cb, options = {}) {
1393
+ let cleanupFn;
1394
+ function onEffect() {
1395
+ if (!cleanupFn)
1396
+ return;
1397
+ const fn = cleanupFn;
1398
+ cleanupFn = void 0;
1399
+ fn();
1400
+ }
1401
+ function onCleanup(callback) {
1402
+ cleanupFn = callback;
1403
+ }
1404
+ const _cb = (value, oldValue) => {
1405
+ onEffect();
1406
+ return cb(value, oldValue, onCleanup);
1407
+ };
1408
+ const res = watchIgnorable(source, _cb, options);
1409
+ const { ignoreUpdates } = res;
1410
+ const trigger = () => {
1411
+ let res2;
1412
+ ignoreUpdates(() => {
1413
+ res2 = _cb(getWatchSources(source), getOldValue(source));
1414
+ });
1415
+ return res2;
1416
+ };
1417
+ return __spreadProps(__spreadValues({}, res), {
1418
+ trigger
1419
+ });
1420
+ }
1421
+ function getWatchSources(sources) {
1422
+ if (isReactive(sources))
1423
+ return sources;
1424
+ if (Array.isArray(sources))
1425
+ return sources.map((item) => getOneWatchSource(item));
1426
+ return getOneWatchSource(sources);
1427
+ }
1428
+ function getOneWatchSource(source) {
1429
+ return typeof source === "function" ? source() : unref(source);
1430
+ }
1431
+ function getOldValue(source) {
1432
+ return Array.isArray(source) ? source.map(() => void 0) : void 0;
1329
1433
  }
1330
1434
 
1331
1435
  function whenever(source, cb, options) {
@@ -1335,4 +1439,4 @@ function whenever(source, cb, options) {
1335
1439
  }, options);
1336
1440
  }
1337
1441
 
1338
- export { __onlyVue3, logicAnd as and, assert, refAutoReset as autoResetRef, bypassFilter, 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, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, logicAnd, logicNot, logicOr, makeDestructurable, noop, normalizeDate, logicNot as not, now, objectPick, logicOr as or, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchWithFilter, whenever };
1442
+ export { __onlyVue3, logicAnd as and, assert, refAutoReset as autoResetRef, bypassFilter, 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, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, logicAnd, logicNot, logicOr, makeDestructurable, noop, normalizeDate, logicNot as not, now, objectPick, logicOr as or, 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, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };