@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.cjs CHANGED
@@ -4,61 +4,249 @@ 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);
35
35
  }
36
36
 
37
+ var _a;
38
+ const isClient = typeof window !== "undefined";
39
+ const isDef = (val) => typeof val !== "undefined";
40
+ const assert = (condition, ...infos) => {
41
+ if (!condition)
42
+ console.warn(...infos);
43
+ };
44
+ const toString = Object.prototype.toString;
45
+ const isBoolean = (val) => typeof val === "boolean";
46
+ const isFunction = (val) => typeof val === "function";
47
+ const isNumber = (val) => typeof val === "number";
48
+ const isString = (val) => typeof val === "string";
49
+ const isObject = (val) => toString.call(val) === "[object Object]";
50
+ const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
51
+ const now = () => Date.now();
52
+ const timestamp = () => +Date.now();
53
+ const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
54
+ const noop = () => {
55
+ };
56
+ const rand = (min, max) => {
57
+ min = Math.ceil(min);
58
+ max = Math.floor(max);
59
+ return Math.floor(Math.random() * (max - min + 1)) + min;
60
+ };
61
+ const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
62
+
63
+ function createFilterWrapper(filter, fn) {
64
+ function wrapper(...args) {
65
+ filter(() => fn.apply(this, args), { fn, thisArg: this, args });
66
+ }
67
+ return wrapper;
68
+ }
69
+ const bypassFilter = (invoke) => {
70
+ return invoke();
71
+ };
72
+ function debounceFilter(ms, options = {}) {
73
+ let timer;
74
+ let maxTimer;
75
+ const filter = (invoke) => {
76
+ const duration = vueDemi.unref(ms);
77
+ const maxDuration = vueDemi.unref(options.maxWait);
78
+ if (timer)
79
+ clearTimeout(timer);
80
+ if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
81
+ if (maxTimer) {
82
+ clearTimeout(maxTimer);
83
+ maxTimer = null;
84
+ }
85
+ return invoke();
86
+ }
87
+ if (maxDuration && !maxTimer) {
88
+ maxTimer = setTimeout(() => {
89
+ if (timer)
90
+ clearTimeout(timer);
91
+ maxTimer = null;
92
+ invoke();
93
+ }, maxDuration);
94
+ }
95
+ timer = setTimeout(() => {
96
+ if (maxTimer)
97
+ clearTimeout(maxTimer);
98
+ maxTimer = null;
99
+ invoke();
100
+ }, duration);
101
+ };
102
+ return filter;
103
+ }
104
+ function throttleFilter(ms, trailing = true, leading = true) {
105
+ let lastExec = 0;
106
+ let timer;
107
+ let isLeading = true;
108
+ const clear = () => {
109
+ if (timer) {
110
+ clearTimeout(timer);
111
+ timer = void 0;
112
+ }
113
+ };
114
+ const filter = (invoke) => {
115
+ const duration = vueDemi.unref(ms);
116
+ const elapsed = Date.now() - lastExec;
117
+ clear();
118
+ if (duration <= 0) {
119
+ lastExec = Date.now();
120
+ return invoke();
121
+ }
122
+ if (elapsed > duration && (leading || !isLeading)) {
123
+ lastExec = Date.now();
124
+ invoke();
125
+ } else if (trailing) {
126
+ timer = setTimeout(() => {
127
+ lastExec = Date.now();
128
+ isLeading = true;
129
+ clear();
130
+ invoke();
131
+ }, duration);
132
+ }
133
+ if (!leading && !timer)
134
+ timer = setTimeout(() => isLeading = true, duration);
135
+ isLeading = false;
136
+ };
137
+ return filter;
138
+ }
139
+ function pausableFilter(extendFilter = bypassFilter) {
140
+ const isActive = vueDemi.ref(true);
141
+ function pause() {
142
+ isActive.value = false;
143
+ }
144
+ function resume() {
145
+ isActive.value = true;
146
+ }
147
+ const eventFilter = (...args) => {
148
+ if (isActive.value)
149
+ extendFilter(...args);
150
+ };
151
+ return { isActive, pause, resume, eventFilter };
152
+ }
153
+
154
+ function __onlyVue3(name = "this function") {
155
+ if (vueDemi.isVue3)
156
+ return;
157
+ throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
158
+ }
159
+ const directiveHooks = {
160
+ mounted: vueDemi.isVue3 ? "mounted" : "inserted",
161
+ updated: vueDemi.isVue3 ? "updated" : "componentUpdated",
162
+ unmounted: vueDemi.isVue3 ? "unmounted" : "unbind"
163
+ };
164
+
165
+ function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
166
+ return new Promise((resolve, reject) => {
167
+ if (throwOnTimeout)
168
+ setTimeout(() => reject(reason), ms);
169
+ else
170
+ setTimeout(resolve, ms);
171
+ });
172
+ }
173
+ function identity(arg) {
174
+ return arg;
175
+ }
176
+ function createSingletonPromise(fn) {
177
+ let _promise;
178
+ function wrapper() {
179
+ if (!_promise)
180
+ _promise = fn();
181
+ return _promise;
182
+ }
183
+ wrapper.reset = async () => {
184
+ const _prev = _promise;
185
+ _promise = void 0;
186
+ if (_prev)
187
+ await _prev;
188
+ };
189
+ return wrapper;
190
+ }
191
+ function invoke(fn) {
192
+ return fn();
193
+ }
194
+ function containsProp(obj, ...props) {
195
+ return props.some((k) => k in obj);
196
+ }
197
+ function increaseWithUnit(target, delta) {
198
+ var _a;
199
+ if (typeof target === "number")
200
+ return target + delta;
201
+ const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
202
+ const unit = target.slice(value.length);
203
+ const result = parseFloat(value) + delta;
204
+ if (Number.isNaN(result))
205
+ return target;
206
+ return result + unit;
207
+ }
208
+ function objectPick(obj, keys, omitUndefined = false) {
209
+ return keys.reduce((n, k) => {
210
+ if (k in obj) {
211
+ if (!omitUndefined || obj[k] !== void 0)
212
+ n[k] = obj[k];
213
+ }
214
+ return n;
215
+ }, {});
216
+ }
217
+
37
218
  function computedWithControl(source, fn) {
38
219
  let v = void 0;
39
220
  let track;
40
221
  let trigger;
41
222
  const dirty = vueDemi.ref(true);
42
- vueDemi.watch(source, () => {
223
+ const update = () => {
43
224
  dirty.value = true;
44
225
  trigger();
45
- }, { flush: "sync" });
46
- return vueDemi.customRef((_track, _trigger) => {
226
+ };
227
+ vueDemi.watch(source, update, { flush: "sync" });
228
+ const get = isFunction(fn) ? fn : fn.get;
229
+ const set = isFunction(fn) ? void 0 : fn.set;
230
+ const result = vueDemi.customRef((_track, _trigger) => {
47
231
  track = _track;
48
232
  trigger = _trigger;
49
233
  return {
50
234
  get() {
51
235
  if (dirty.value) {
52
- v = fn();
236
+ v = get();
53
237
  dirty.value = false;
54
238
  }
55
239
  track();
56
240
  return v;
57
241
  },
58
- set() {
242
+ set(v2) {
243
+ set == null ? void 0 : set(v2);
59
244
  }
60
245
  };
61
246
  });
247
+ if (Object.isExtensible(result))
248
+ result.trigger = update;
249
+ return result;
62
250
  }
63
251
 
64
252
  function createEventHook() {
@@ -137,17 +325,6 @@ function createSharedComposable(composable) {
137
325
  };
138
326
  }
139
327
 
140
- function __onlyVue3(name = "this function") {
141
- if (vueDemi.isVue3)
142
- return;
143
- throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
144
- }
145
- const directiveHooks = {
146
- mounted: vueDemi.isVue3 ? "mounted" : "inserted",
147
- updated: vueDemi.isVue3 ? "updated" : "componentUpdated",
148
- unmounted: vueDemi.isVue3 ? "unmounted" : "unbind"
149
- };
150
-
151
328
  function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
152
329
  __onlyVue3();
153
330
  for (const [key, value] of Object.entries(extend)) {
@@ -192,25 +369,25 @@ function logicOr(...args) {
192
369
  return vueDemi.computed(() => args.some((i) => vueDemi.unref(i)));
193
370
  }
194
371
 
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) => {
372
+ var __defProp$8 = Object.defineProperty;
373
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
374
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
375
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
376
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
377
+ var __spreadValues$8 = (a, b) => {
201
378
  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]);
379
+ if (__hasOwnProp$a.call(b, prop))
380
+ __defNormalProp$8(a, prop, b[prop]);
381
+ if (__getOwnPropSymbols$a)
382
+ for (var prop of __getOwnPropSymbols$a(b)) {
383
+ if (__propIsEnum$a.call(b, prop))
384
+ __defNormalProp$8(a, prop, b[prop]);
208
385
  }
209
386
  return a;
210
387
  };
211
388
  function makeDestructurable(obj, arr) {
212
389
  if (typeof Symbol !== "undefined") {
213
- const clone = __spreadValues$7({}, obj);
390
+ const clone = __spreadValues$8({}, obj);
214
391
  Object.defineProperty(clone, Symbol.iterator, {
215
392
  enumerable: false,
216
393
  value() {
@@ -292,11 +469,13 @@ function reactiveComputed(fn) {
292
469
  }
293
470
 
294
471
  function reactiveOmit(obj, ...keys) {
295
- return reactiveComputed(() => Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !keys.includes(e[0]))));
472
+ const flatKeys = keys.flat();
473
+ return reactiveComputed(() => Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
296
474
  }
297
475
 
298
476
  function reactivePick(obj, ...keys) {
299
- return vueDemi.reactive(Object.fromEntries(keys.map((k) => [k, vueDemi.toRef(obj, k)])));
477
+ const flatKeys = keys.flat();
478
+ return vueDemi.reactive(Object.fromEntries(flatKeys.map((k) => [k, vueDemi.toRef(obj, k)])));
300
479
  }
301
480
 
302
481
  function refAutoReset(defaultValue, afterMs = 1e4) {
@@ -325,176 +504,6 @@ function refAutoReset(defaultValue, afterMs = 1e4) {
325
504
  });
326
505
  }
327
506
 
328
- var _a;
329
- const isClient = typeof window !== "undefined";
330
- const isDef = (val) => typeof val !== "undefined";
331
- const assert = (condition, ...infos) => {
332
- if (!condition)
333
- console.warn(...infos);
334
- };
335
- const toString = Object.prototype.toString;
336
- const isBoolean = (val) => typeof val === "boolean";
337
- const isFunction = (val) => typeof val === "function";
338
- const isNumber = (val) => typeof val === "number";
339
- const isString = (val) => typeof val === "string";
340
- const isObject = (val) => toString.call(val) === "[object Object]";
341
- const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
342
- const now = () => Date.now();
343
- const timestamp = () => +Date.now();
344
- const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
345
- const noop = () => {
346
- };
347
- const rand = (min, max) => {
348
- min = Math.ceil(min);
349
- max = Math.floor(max);
350
- return Math.floor(Math.random() * (max - min + 1)) + min;
351
- };
352
- const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
353
-
354
- function createFilterWrapper(filter, fn) {
355
- function wrapper(...args) {
356
- filter(() => fn.apply(this, args), { fn, thisArg: this, args });
357
- }
358
- return wrapper;
359
- }
360
- const bypassFilter = (invoke) => {
361
- return invoke();
362
- };
363
- function debounceFilter(ms, options = {}) {
364
- let timer;
365
- let maxTimer;
366
- const filter = (invoke) => {
367
- const duration = vueDemi.unref(ms);
368
- const maxDuration = vueDemi.unref(options.maxWait);
369
- if (timer)
370
- clearTimeout(timer);
371
- if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
372
- if (maxTimer) {
373
- clearTimeout(maxTimer);
374
- maxTimer = null;
375
- }
376
- return invoke();
377
- }
378
- if (maxDuration && !maxTimer) {
379
- maxTimer = setTimeout(() => {
380
- if (timer)
381
- clearTimeout(timer);
382
- maxTimer = null;
383
- invoke();
384
- }, maxDuration);
385
- }
386
- timer = setTimeout(() => {
387
- if (maxTimer)
388
- clearTimeout(maxTimer);
389
- maxTimer = null;
390
- invoke();
391
- }, duration);
392
- };
393
- return filter;
394
- }
395
- function throttleFilter(ms, trailing = true, leading = true) {
396
- let lastExec = 0;
397
- let timer;
398
- let isLeading = true;
399
- const clear = () => {
400
- if (timer) {
401
- clearTimeout(timer);
402
- timer = void 0;
403
- }
404
- };
405
- const filter = (invoke) => {
406
- const duration = vueDemi.unref(ms);
407
- const elapsed = Date.now() - lastExec;
408
- clear();
409
- if (duration <= 0) {
410
- lastExec = Date.now();
411
- return invoke();
412
- }
413
- if (elapsed > duration && (leading || !isLeading)) {
414
- lastExec = Date.now();
415
- invoke();
416
- } else if (trailing) {
417
- timer = setTimeout(() => {
418
- lastExec = Date.now();
419
- isLeading = true;
420
- clear();
421
- invoke();
422
- }, duration);
423
- }
424
- if (!leading && !timer)
425
- timer = setTimeout(() => isLeading = true, duration);
426
- isLeading = false;
427
- };
428
- return filter;
429
- }
430
- function pausableFilter(extendFilter = bypassFilter) {
431
- const isActive = vueDemi.ref(true);
432
- function pause() {
433
- isActive.value = false;
434
- }
435
- function resume() {
436
- isActive.value = true;
437
- }
438
- const eventFilter = (...args) => {
439
- if (isActive.value)
440
- extendFilter(...args);
441
- };
442
- return { isActive, pause, resume, eventFilter };
443
- }
444
-
445
- function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
446
- return new Promise((resolve, reject) => {
447
- if (throwOnTimeout)
448
- setTimeout(() => reject(reason), ms);
449
- else
450
- setTimeout(resolve, ms);
451
- });
452
- }
453
- function identity(arg) {
454
- return arg;
455
- }
456
- function createSingletonPromise(fn) {
457
- let _promise;
458
- function wrapper() {
459
- if (!_promise)
460
- _promise = fn();
461
- return _promise;
462
- }
463
- wrapper.reset = async () => {
464
- const _prev = _promise;
465
- _promise = void 0;
466
- if (_prev)
467
- await _prev;
468
- };
469
- return wrapper;
470
- }
471
- function invoke(fn) {
472
- return fn();
473
- }
474
- function containsProp(obj, ...props) {
475
- return props.some((k) => k in obj);
476
- }
477
- function increaseWithUnit(target, delta) {
478
- var _a;
479
- if (typeof target === "number")
480
- return target + delta;
481
- const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
482
- const unit = target.slice(value.length);
483
- const result = parseFloat(value) + delta;
484
- if (Number.isNaN(result))
485
- return target;
486
- return result + unit;
487
- }
488
- function objectPick(obj, keys, omitUndefined = false) {
489
- return keys.reduce((n, k) => {
490
- if (k in obj) {
491
- if (!omitUndefined || obj[k] !== void 0)
492
- n[k] = obj[k];
493
- }
494
- return n;
495
- }, {});
496
- }
497
-
498
507
  function useDebounceFn(fn, ms = 200, options = {}) {
499
508
  return createFilterWrapper(debounceFilter(ms, options), fn);
500
509
  }
@@ -585,6 +594,14 @@ function refWithControl(initial, options = {}) {
585
594
  }
586
595
  const controlledRef = refWithControl;
587
596
 
597
+ function resolveRef(r) {
598
+ return typeof r === "function" ? vueDemi.computed(r) : vueDemi.ref(r);
599
+ }
600
+
601
+ function resolveUnref(r) {
602
+ return typeof r === "function" ? r() : vueDemi.unref(r);
603
+ }
604
+
588
605
  function set(...args) {
589
606
  if (args.length === 2) {
590
607
  const [ref, value] = args;
@@ -631,25 +648,25 @@ function syncRefs(source, targets, options = {}) {
631
648
  return vueDemi.watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
632
649
  }
633
650
 
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) => {
651
+ var __defProp$7 = Object.defineProperty;
652
+ var __defProps$5 = Object.defineProperties;
653
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
654
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
655
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
656
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
657
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
658
+ var __spreadValues$7 = (a, b) => {
642
659
  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]);
660
+ if (__hasOwnProp$9.call(b, prop))
661
+ __defNormalProp$7(a, prop, b[prop]);
662
+ if (__getOwnPropSymbols$9)
663
+ for (var prop of __getOwnPropSymbols$9(b)) {
664
+ if (__propIsEnum$9.call(b, prop))
665
+ __defNormalProp$7(a, prop, b[prop]);
649
666
  }
650
667
  return a;
651
668
  };
652
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
669
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
653
670
  function toRefs(objectRef) {
654
671
  if (!vueDemi.isRef(objectRef))
655
672
  return vueDemi.toRefs(objectRef);
@@ -665,7 +682,7 @@ function toRefs(objectRef) {
665
682
  copy[key] = v;
666
683
  objectRef.value = copy;
667
684
  } else {
668
- const newObject = __spreadProps$4(__spreadValues$6({}, objectRef.value), { [key]: v });
685
+ const newObject = __spreadProps$5(__spreadValues$7({}, objectRef.value), { [key]: v });
669
686
  Object.setPrototypeOf(newObject, objectRef.value);
670
687
  objectRef.value = newObject;
671
688
  }
@@ -922,19 +939,19 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
922
939
  };
923
940
  }
924
941
 
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) => {
942
+ var __defProp$6 = Object.defineProperty;
943
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
944
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
945
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
946
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
947
+ var __spreadValues$6 = (a, b) => {
931
948
  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]);
949
+ if (__hasOwnProp$8.call(b, prop))
950
+ __defNormalProp$6(a, prop, b[prop]);
951
+ if (__getOwnPropSymbols$8)
952
+ for (var prop of __getOwnPropSymbols$8(b)) {
953
+ if (__propIsEnum$8.call(b, prop))
954
+ __defNormalProp$6(a, prop, b[prop]);
938
955
  }
939
956
  return a;
940
957
  };
@@ -946,7 +963,7 @@ function useInterval(interval = 1e3, options = {}) {
946
963
  const counter = vueDemi.ref(0);
947
964
  const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
948
965
  if (exposeControls) {
949
- return __spreadValues$5({
966
+ return __spreadValues$6({
950
967
  counter
951
968
  }, controls);
952
969
  } else {
@@ -999,19 +1016,19 @@ function useTimeoutFn(cb, interval, options = {}) {
999
1016
  };
1000
1017
  }
1001
1018
 
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) => {
1019
+ var __defProp$5 = Object.defineProperty;
1020
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
1021
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
1022
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
1023
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1024
+ var __spreadValues$5 = (a, b) => {
1008
1025
  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]);
1026
+ if (__hasOwnProp$7.call(b, prop))
1027
+ __defNormalProp$5(a, prop, b[prop]);
1028
+ if (__getOwnPropSymbols$7)
1029
+ for (var prop of __getOwnPropSymbols$7(b)) {
1030
+ if (__propIsEnum$7.call(b, prop))
1031
+ __defNormalProp$5(a, prop, b[prop]);
1015
1032
  }
1016
1033
  return a;
1017
1034
  };
@@ -1022,7 +1039,7 @@ function useTimeout(interval = 1e3, options = {}) {
1022
1039
  const controls = useTimeoutFn(noop, interval, options);
1023
1040
  const ready = vueDemi.computed(() => !controls.isPending.value);
1024
1041
  if (exposeControls) {
1025
- return __spreadValues$4({
1042
+ return __spreadValues$5({
1026
1043
  ready
1027
1044
  }, controls);
1028
1045
  } else {
@@ -1052,17 +1069,42 @@ function useToggle(initialValue = false, options = {}) {
1052
1069
  return [innerValue, toggle];
1053
1070
  }
1054
1071
 
1055
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1056
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1057
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1072
+ function watchArray(source, cb, options) {
1073
+ let oldList = (options == null ? void 0 : options.immediate) ? [] : [
1074
+ ...source instanceof Function ? source() : Array.isArray(source) ? source : vueDemi.unref(source)
1075
+ ];
1076
+ return vueDemi.watch(source, (newList, _, onCleanup) => {
1077
+ const oldListRemains = new Array(oldList.length);
1078
+ const added = [];
1079
+ for (const obj of newList) {
1080
+ let found = false;
1081
+ for (let i = 0; i < oldList.length; i++) {
1082
+ if (!oldListRemains[i] && obj === oldList[i]) {
1083
+ oldListRemains[i] = true;
1084
+ found = true;
1085
+ break;
1086
+ }
1087
+ }
1088
+ if (!found)
1089
+ added.push(obj);
1090
+ }
1091
+ const removed = oldList.filter((_2, i) => !oldListRemains[i]);
1092
+ cb(newList, oldList, added, removed, onCleanup);
1093
+ oldList = [...newList];
1094
+ }, options);
1095
+ }
1096
+
1097
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1098
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1099
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1058
1100
  var __objRest$5 = (source, exclude) => {
1059
1101
  var target = {};
1060
1102
  for (var prop in source)
1061
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
1103
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
1062
1104
  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))
1105
+ if (source != null && __getOwnPropSymbols$6)
1106
+ for (var prop of __getOwnPropSymbols$6(source)) {
1107
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
1066
1108
  target[prop] = source[prop];
1067
1109
  }
1068
1110
  return target;
@@ -1076,17 +1118,17 @@ function watchWithFilter(source, cb, options = {}) {
1076
1118
  return vueDemi.watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
1077
1119
  }
1078
1120
 
1079
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1080
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1081
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1121
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
1122
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
1123
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
1082
1124
  var __objRest$4 = (source, exclude) => {
1083
1125
  var target = {};
1084
1126
  for (var prop in source)
1085
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1127
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
1086
1128
  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))
1129
+ if (source != null && __getOwnPropSymbols$5)
1130
+ for (var prop of __getOwnPropSymbols$5(source)) {
1131
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
1090
1132
  target[prop] = source[prop];
1091
1133
  }
1092
1134
  return target;
@@ -1107,33 +1149,33 @@ function watchAtMost(source, cb, options) {
1107
1149
  return { count: current, stop };
1108
1150
  }
1109
1151
 
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) => {
1152
+ var __defProp$4 = Object.defineProperty;
1153
+ var __defProps$4 = Object.defineProperties;
1154
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
1155
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1156
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1157
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1158
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1159
+ var __spreadValues$4 = (a, b) => {
1118
1160
  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]);
1161
+ if (__hasOwnProp$4.call(b, prop))
1162
+ __defNormalProp$4(a, prop, b[prop]);
1163
+ if (__getOwnPropSymbols$4)
1164
+ for (var prop of __getOwnPropSymbols$4(b)) {
1165
+ if (__propIsEnum$4.call(b, prop))
1166
+ __defNormalProp$4(a, prop, b[prop]);
1125
1167
  }
1126
1168
  return a;
1127
1169
  };
1128
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1170
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
1129
1171
  var __objRest$3 = (source, exclude) => {
1130
1172
  var target = {};
1131
1173
  for (var prop in source)
1132
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1174
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1133
1175
  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))
1176
+ if (source != null && __getOwnPropSymbols$4)
1177
+ for (var prop of __getOwnPropSymbols$4(source)) {
1178
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1137
1179
  target[prop] = source[prop];
1138
1180
  }
1139
1181
  return target;
@@ -1146,38 +1188,38 @@ function watchDebounced(source, cb, options = {}) {
1146
1188
  "debounce",
1147
1189
  "maxWait"
1148
1190
  ]);
1149
- return watchWithFilter(source, cb, __spreadProps$3(__spreadValues$3({}, watchOptions), {
1191
+ return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$4({}, watchOptions), {
1150
1192
  eventFilter: debounceFilter(debounce, { maxWait })
1151
1193
  }));
1152
1194
  }
1153
1195
 
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) => {
1196
+ var __defProp$3 = Object.defineProperty;
1197
+ var __defProps$3 = Object.defineProperties;
1198
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
1199
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1200
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1201
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1202
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1203
+ var __spreadValues$3 = (a, b) => {
1162
1204
  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]);
1205
+ if (__hasOwnProp$3.call(b, prop))
1206
+ __defNormalProp$3(a, prop, b[prop]);
1207
+ if (__getOwnPropSymbols$3)
1208
+ for (var prop of __getOwnPropSymbols$3(b)) {
1209
+ if (__propIsEnum$3.call(b, prop))
1210
+ __defNormalProp$3(a, prop, b[prop]);
1169
1211
  }
1170
1212
  return a;
1171
1213
  };
1172
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1214
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
1173
1215
  var __objRest$2 = (source, exclude) => {
1174
1216
  var target = {};
1175
1217
  for (var prop in source)
1176
- if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
1218
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1177
1219
  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))
1220
+ if (source != null && __getOwnPropSymbols$3)
1221
+ for (var prop of __getOwnPropSymbols$3(source)) {
1222
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1181
1223
  target[prop] = source[prop];
1182
1224
  }
1183
1225
  return target;
@@ -1214,7 +1256,7 @@ function watchIgnorable(source, cb, options = {}) {
1214
1256
  };
1215
1257
  disposables.push(vueDemi.watch(source, () => {
1216
1258
  syncCounter.value++;
1217
- }, __spreadProps$2(__spreadValues$2({}, watchOptions), { flush: "sync" })));
1259
+ }, __spreadProps$3(__spreadValues$3({}, watchOptions), { flush: "sync" })));
1218
1260
  ignoreUpdates = (updater) => {
1219
1261
  const syncCounterPrev = syncCounter.value;
1220
1262
  updater();
@@ -1242,6 +1284,50 @@ function watchOnce(source, cb, options) {
1242
1284
  }, options);
1243
1285
  }
1244
1286
 
1287
+ var __defProp$2 = Object.defineProperty;
1288
+ var __defProps$2 = Object.defineProperties;
1289
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
1290
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1291
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1292
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1293
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1294
+ var __spreadValues$2 = (a, b) => {
1295
+ for (var prop in b || (b = {}))
1296
+ if (__hasOwnProp$2.call(b, prop))
1297
+ __defNormalProp$2(a, prop, b[prop]);
1298
+ if (__getOwnPropSymbols$2)
1299
+ for (var prop of __getOwnPropSymbols$2(b)) {
1300
+ if (__propIsEnum$2.call(b, prop))
1301
+ __defNormalProp$2(a, prop, b[prop]);
1302
+ }
1303
+ return a;
1304
+ };
1305
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1306
+ var __objRest$1 = (source, exclude) => {
1307
+ var target = {};
1308
+ for (var prop in source)
1309
+ if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
1310
+ target[prop] = source[prop];
1311
+ if (source != null && __getOwnPropSymbols$2)
1312
+ for (var prop of __getOwnPropSymbols$2(source)) {
1313
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
1314
+ target[prop] = source[prop];
1315
+ }
1316
+ return target;
1317
+ };
1318
+ function watchPausable(source, cb, options = {}) {
1319
+ const _a = options, {
1320
+ eventFilter: filter
1321
+ } = _a, watchOptions = __objRest$1(_a, [
1322
+ "eventFilter"
1323
+ ]);
1324
+ const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
1325
+ const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$2({}, watchOptions), {
1326
+ eventFilter
1327
+ }));
1328
+ return { stop, pause, resume, isActive };
1329
+ }
1330
+
1245
1331
  var __defProp$1 = Object.defineProperty;
1246
1332
  var __defProps$1 = Object.defineProperties;
1247
1333
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -1261,7 +1347,7 @@ var __spreadValues$1 = (a, b) => {
1261
1347
  return a;
1262
1348
  };
1263
1349
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
1264
- var __objRest$1 = (source, exclude) => {
1350
+ var __objRest = (source, exclude) => {
1265
1351
  var target = {};
1266
1352
  for (var prop in source)
1267
1353
  if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -1273,17 +1359,19 @@ var __objRest$1 = (source, exclude) => {
1273
1359
  }
1274
1360
  return target;
1275
1361
  };
1276
- function watchPausable(source, cb, options = {}) {
1362
+ function watchThrottled(source, cb, options = {}) {
1277
1363
  const _a = options, {
1278
- eventFilter: filter
1279
- } = _a, watchOptions = __objRest$1(_a, [
1280
- "eventFilter"
1364
+ throttle = 0,
1365
+ trailing = true,
1366
+ leading = true
1367
+ } = _a, watchOptions = __objRest(_a, [
1368
+ "throttle",
1369
+ "trailing",
1370
+ "leading"
1281
1371
  ]);
1282
- const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
1283
- const stop = watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
1284
- eventFilter
1372
+ return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
1373
+ eventFilter: throttleFilter(throttle, trailing, leading)
1285
1374
  }));
1286
- return { stop, pause, resume, isActive };
1287
1375
  }
1288
1376
 
1289
1377
  var __defProp = Object.defineProperty;
@@ -1305,31 +1393,47 @@ var __spreadValues = (a, b) => {
1305
1393
  return a;
1306
1394
  };
1307
1395
  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
- }));
1396
+ function watchTriggerable(source, cb, options = {}) {
1397
+ let cleanupFn;
1398
+ function onEffect() {
1399
+ if (!cleanupFn)
1400
+ return;
1401
+ const fn = cleanupFn;
1402
+ cleanupFn = void 0;
1403
+ fn();
1404
+ }
1405
+ function onCleanup(callback) {
1406
+ cleanupFn = callback;
1407
+ }
1408
+ const _cb = (value, oldValue) => {
1409
+ onEffect();
1410
+ return cb(value, oldValue, onCleanup);
1411
+ };
1412
+ const res = watchIgnorable(source, _cb, options);
1413
+ const { ignoreUpdates } = res;
1414
+ const trigger = () => {
1415
+ let res2;
1416
+ ignoreUpdates(() => {
1417
+ res2 = _cb(getWatchSources(source), getOldValue(source));
1418
+ });
1419
+ return res2;
1420
+ };
1421
+ return __spreadProps(__spreadValues({}, res), {
1422
+ trigger
1423
+ });
1424
+ }
1425
+ function getWatchSources(sources) {
1426
+ if (vueDemi.isReactive(sources))
1427
+ return sources;
1428
+ if (Array.isArray(sources))
1429
+ return sources.map((item) => getOneWatchSource(item));
1430
+ return getOneWatchSource(sources);
1431
+ }
1432
+ function getOneWatchSource(source) {
1433
+ return typeof source === "function" ? source() : vueDemi.unref(source);
1434
+ }
1435
+ function getOldValue(source) {
1436
+ return Array.isArray(source) ? source.map(() => void 0) : void 0;
1333
1437
  }
1334
1438
 
1335
1439
  function whenever(source, cb, options) {
@@ -1403,6 +1507,8 @@ exports.refDebounced = refDebounced;
1403
1507
  exports.refDefault = refDefault;
1404
1508
  exports.refThrottled = refThrottled;
1405
1509
  exports.refWithControl = refWithControl;
1510
+ exports.resolveRef = resolveRef;
1511
+ exports.resolveUnref = resolveUnref;
1406
1512
  exports.set = set;
1407
1513
  exports.syncRef = syncRef;
1408
1514
  exports.syncRefs = syncRefs;
@@ -1430,11 +1536,13 @@ exports.useThrottleFn = useThrottleFn;
1430
1536
  exports.useTimeout = useTimeout;
1431
1537
  exports.useTimeoutFn = useTimeoutFn;
1432
1538
  exports.useToggle = useToggle;
1539
+ exports.watchArray = watchArray;
1433
1540
  exports.watchAtMost = watchAtMost;
1434
1541
  exports.watchDebounced = watchDebounced;
1435
1542
  exports.watchIgnorable = watchIgnorable;
1436
1543
  exports.watchOnce = watchOnce;
1437
1544
  exports.watchPausable = watchPausable;
1438
1545
  exports.watchThrottled = watchThrottled;
1546
+ exports.watchTriggerable = watchTriggerable;
1439
1547
  exports.watchWithFilter = watchWithFilter;
1440
1548
  exports.whenever = whenever;