@vueuse/shared 14.2.1 → 14.4.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.
@@ -1,32 +1,7 @@
1
1
  (function(exports, vue) {
2
-
3
- //#region rolldown:runtime
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
21
- value: mod,
22
- enumerable: true
23
- }) : target, mod));
24
-
25
- //#endregion
26
- vue = __toESM(vue);
27
-
28
- //#region computedEager/index.ts
29
- /**
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ //#region computedEager/index.ts
4
+ /**
30
5
  *
31
6
  * @deprecated This function will be removed in future version.
32
7
  *
@@ -52,10 +27,9 @@ vue = __toESM(vue);
52
27
  }
53
28
  /** @deprecated use `computedEager` instead */
54
29
  const eagerComputed = computedEager;
55
-
56
- //#endregion
57
- //#region computedWithControl/index.ts
58
- /**
30
+ //#endregion
31
+ //#region computedWithControl/index.ts
32
+ /**
59
33
  * Explicitly define the deps of computed.
60
34
  *
61
35
  * @param source
@@ -74,22 +48,22 @@ vue = __toESM(vue);
74
48
  flush: "sync",
75
49
  ...options
76
50
  });
77
- const get$1 = typeof fn === "function" ? fn : fn.get;
78
- const set$1 = typeof fn === "function" ? void 0 : fn.set;
51
+ const get = typeof fn === "function" ? fn : fn.get;
52
+ const set = typeof fn === "function" ? void 0 : fn.set;
79
53
  const result = (0, vue.customRef)((_track, _trigger) => {
80
54
  track = _track;
81
55
  trigger = _trigger;
82
56
  return {
83
57
  get() {
84
58
  if (dirty) {
85
- v = get$1(v);
59
+ v = get(v);
86
60
  dirty = false;
87
61
  }
88
62
  track();
89
63
  return v;
90
64
  },
91
- set(v$1) {
92
- set$1 === null || set$1 === void 0 || set$1(v$1);
65
+ set(v) {
66
+ set === null || set === void 0 || set(v);
93
67
  }
94
68
  };
95
69
  });
@@ -98,10 +72,47 @@ vue = __toESM(vue);
98
72
  }
99
73
  /** @deprecated use `computedWithControl` instead */
100
74
  const controlledComputed = computedWithControl;
101
-
102
- //#endregion
103
- //#region tryOnScopeDispose/index.ts
104
- /**
75
+ //#endregion
76
+ //#region createDisposableDirective/index.ts
77
+ /**
78
+ * Utility for authoring disposable directives. Reactive effects created within `mounted` directive hook will be tracked and automatically disposed when directive is unmounted.
79
+ *
80
+ * @see https://vueuse.org/createDisposableDirective
81
+ *
82
+ * @__NO_SIDE_EFFECTS__
83
+ */
84
+ function createDisposableDirective(origin = {}) {
85
+ function isFunc(fn) {
86
+ return typeof fn === "function";
87
+ }
88
+ const normalisedOrigin = isFunc(origin) ? {
89
+ mounted: origin,
90
+ updated: origin
91
+ } : origin;
92
+ const { mounted, unmounted } = normalisedOrigin;
93
+ if (!isFunc(mounted)) return origin;
94
+ const scopeWeakMap = /* @__PURE__ */ new WeakMap();
95
+ return {
96
+ ...normalisedOrigin,
97
+ mounted(el, binding, vNode, prevNode) {
98
+ var _scopeWeakMap$get;
99
+ const scope = (_scopeWeakMap$get = scopeWeakMap.get(el)) !== null && _scopeWeakMap$get !== void 0 ? _scopeWeakMap$get : (0, vue.effectScope)();
100
+ scopeWeakMap.set(el, scope);
101
+ scope.run(() => {
102
+ mounted === null || mounted === void 0 || mounted(el, binding, vNode, prevNode);
103
+ });
104
+ },
105
+ unmounted(el, binding, vNode, prevNode) {
106
+ var _scopeWeakMap$get2;
107
+ (_scopeWeakMap$get2 = scopeWeakMap.get(el)) === null || _scopeWeakMap$get2 === void 0 || _scopeWeakMap$get2.stop();
108
+ scopeWeakMap.delete(el);
109
+ if (isFunc(unmounted)) unmounted(el, binding, vNode, prevNode);
110
+ }
111
+ };
112
+ }
113
+ //#endregion
114
+ //#region tryOnScopeDispose/index.ts
115
+ /**
105
116
  * Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
106
117
  *
107
118
  * @param fn
@@ -113,10 +124,9 @@ vue = __toESM(vue);
113
124
  }
114
125
  return false;
115
126
  }
116
-
117
- //#endregion
118
- //#region createEventHook/index.ts
119
- /**
127
+ //#endregion
128
+ //#region createEventHook/index.ts
129
+ /**
120
130
  * Utility for creating event hooks
121
131
  *
122
132
  * @see https://vueuse.org/createEventHook
@@ -147,10 +157,9 @@ vue = __toESM(vue);
147
157
  clear
148
158
  };
149
159
  }
150
-
151
- //#endregion
152
- //#region createGlobalState/index.ts
153
- /**
160
+ //#endregion
161
+ //#region createGlobalState/index.ts
162
+ /**
154
163
  * Keep states in the global scope to be reusable across Vue instances.
155
164
  *
156
165
  * @see https://vueuse.org/createGlobalState
@@ -170,14 +179,12 @@ vue = __toESM(vue);
170
179
  return state;
171
180
  });
172
181
  }
173
-
174
- //#endregion
175
- //#region provideLocal/map.ts
182
+ //#endregion
183
+ //#region provideLocal/map.ts
176
184
  const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
177
-
178
- //#endregion
179
- //#region injectLocal/index.ts
180
- /**
185
+ //#endregion
186
+ //#region injectLocal/index.ts
187
+ /**
181
188
  * On the basis of `inject`, it is allowed to directly call inject to obtain the value after call provide in the same component.
182
189
  *
183
190
  * @example
@@ -197,10 +204,9 @@ vue = __toESM(vue);
197
204
  if (owner && localProvidedStateMap.has(owner) && key in localProvidedStateMap.get(owner)) return localProvidedStateMap.get(owner)[key];
198
205
  return (0, vue.inject)(...args);
199
206
  };
200
-
201
- //#endregion
202
- //#region provideLocal/index.ts
203
- /**
207
+ //#endregion
208
+ //#region provideLocal/index.ts
209
+ /**
204
210
  * On the basis of `provide`, it is allowed to directly call inject to obtain the value after call provide in the same component.
205
211
  *
206
212
  * @example
@@ -219,16 +225,8 @@ vue = __toESM(vue);
219
225
  localProvidedState[key] = value;
220
226
  return (0, vue.provide)(key, value);
221
227
  }
222
-
223
- //#endregion
224
- //#region createInjectionState/index.ts
225
- /**
226
- * Create global state that can be injected into components.
227
- *
228
- * @see https://vueuse.org/createInjectionState
229
- *
230
- * @__NO_SIDE_EFFECTS__
231
- */
228
+ //#endregion
229
+ //#region createInjectionState/index.ts
232
230
  function createInjectionState(composable, options) {
233
231
  const key = (options === null || options === void 0 ? void 0 : options.injectionKey) || Symbol(composable.name || "InjectionState");
234
232
  const defaultValue = options === null || options === void 0 ? void 0 : options.defaultValue;
@@ -240,10 +238,9 @@ vue = __toESM(vue);
240
238
  const useInjectedState = () => injectLocal(key, defaultValue);
241
239
  return [useProvidingState, useInjectedState];
242
240
  }
243
-
244
- //#endregion
245
- //#region createRef/index.ts
246
- /**
241
+ //#endregion
242
+ //#region createRef/index.ts
243
+ /**
247
244
  * Returns a `deepRef` or `shallowRef` depending on the `deep` param.
248
245
  *
249
246
  * @example createRef(1) // ShallowRef<number>
@@ -262,9 +259,8 @@ vue = __toESM(vue);
262
259
  if (deep === true) return (0, vue.ref)(value);
263
260
  else return (0, vue.shallowRef)(value);
264
261
  }
265
-
266
- //#endregion
267
- //#region utils/is.ts
262
+ //#endregion
263
+ //#region utils/is.ts
268
264
  const isClient = typeof window !== "undefined" && typeof document !== "undefined";
269
265
  const isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
270
266
  const isDef = (val) => typeof val !== "undefined";
@@ -283,15 +279,14 @@ vue = __toESM(vue);
283
279
  max = Math.floor(max);
284
280
  return Math.floor(Math.random() * (max - min + 1)) + min;
285
281
  };
286
- const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
287
- const isIOS = /* @__PURE__ */ getIsIOS();
282
+ const hasOwn = (val, key) => Object.hasOwn(val, key);
283
+ const isIOS = /* #__PURE__ */ getIsIOS();
288
284
  function getIsIOS() {
289
285
  var _window, _window2, _window3;
290
286
  return isClient && !!((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.navigator) === null || _window2 === void 0 ? void 0 : _window2.maxTouchPoints) > 2 && /iPad|Macintosh/.test((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.navigator.userAgent));
291
287
  }
292
-
293
- //#endregion
294
- //#region toRef/index.ts
288
+ //#endregion
289
+ //#region toRef/index.ts
295
290
  function toRef(...args) {
296
291
  if (args.length !== 1) return (0, vue.toRef)(...args);
297
292
  const r = args[0];
@@ -300,12 +295,8 @@ vue = __toESM(vue);
300
295
  set: noop
301
296
  }))) : (0, vue.ref)(r);
302
297
  }
303
-
304
- //#endregion
305
- //#region utils/filters.ts
306
- /**
307
- * @internal
308
- */
298
+ //#endregion
299
+ //#region utils/filters.ts
309
300
  function createFilterWrapper(filter, fn) {
310
301
  function wrapper(...args) {
311
302
  return new Promise((resolve, reject) => {
@@ -316,10 +307,15 @@ vue = __toESM(vue);
316
307
  })).then(resolve).catch(reject);
317
308
  });
318
309
  }
310
+ if ("cancel" in filter) Object.assign(wrapper, {
311
+ cancel: filter.cancel,
312
+ flush: filter.flush,
313
+ isPending: filter.isPending
314
+ });
319
315
  return wrapper;
320
316
  }
321
- const bypassFilter = (invoke$1) => {
322
- return invoke$1();
317
+ const bypassFilter = (invoke) => {
318
+ return invoke();
323
319
  };
324
320
  /**
325
321
  * Create an EventFilter that debounce the events
@@ -328,13 +324,15 @@ vue = __toESM(vue);
328
324
  let timer;
329
325
  let maxTimer;
330
326
  let lastRejector = noop;
331
- const _clearTimeout = (timer$1) => {
332
- clearTimeout(timer$1);
327
+ let lastResolve = noop;
328
+ const _pending = (0, vue.shallowRef)(false);
329
+ const _clearTimeout = (timer) => {
330
+ clearTimeout(timer);
333
331
  lastRejector();
334
332
  lastRejector = noop;
335
333
  };
336
334
  let lastInvoker;
337
- const filter = (invoke$1) => {
335
+ const handler = (invoke) => {
338
336
  const duration = (0, vue.toValue)(ms);
339
337
  const maxDuration = (0, vue.toValue)(options.maxWait);
340
338
  if (timer) _clearTimeout(timer);
@@ -343,24 +341,60 @@ vue = __toESM(vue);
343
341
  _clearTimeout(maxTimer);
344
342
  maxTimer = void 0;
345
343
  }
346
- return Promise.resolve(invoke$1());
344
+ _pending.value = false;
345
+ return Promise.resolve(invoke());
347
346
  }
347
+ _pending.value = true;
348
348
  return new Promise((resolve, reject) => {
349
349
  lastRejector = options.rejectOnCancel ? reject : resolve;
350
- lastInvoker = invoke$1;
350
+ lastResolve = resolve;
351
+ lastInvoker = invoke;
351
352
  if (maxDuration && !maxTimer) maxTimer = setTimeout(() => {
352
353
  if (timer) _clearTimeout(timer);
353
354
  maxTimer = void 0;
355
+ _pending.value = false;
354
356
  resolve(lastInvoker());
355
357
  }, maxDuration);
356
358
  timer = setTimeout(() => {
357
359
  if (maxTimer) _clearTimeout(maxTimer);
358
360
  maxTimer = void 0;
359
- resolve(invoke$1());
361
+ _pending.value = false;
362
+ resolve(invoke());
360
363
  }, duration);
361
364
  });
362
365
  };
363
- return filter;
366
+ return Object.assign(handler, {
367
+ cancel: () => {
368
+ if (timer) {
369
+ _clearTimeout(timer);
370
+ timer = void 0;
371
+ }
372
+ if (maxTimer) {
373
+ _clearTimeout(maxTimer);
374
+ maxTimer = void 0;
375
+ }
376
+ _pending.value = false;
377
+ lastResolve = noop;
378
+ },
379
+ flush: () => {
380
+ if (_pending.value) {
381
+ if (timer) {
382
+ clearTimeout(timer);
383
+ timer = void 0;
384
+ }
385
+ if (maxTimer) {
386
+ clearTimeout(maxTimer);
387
+ maxTimer = void 0;
388
+ }
389
+ _pending.value = false;
390
+ const resolve = lastResolve;
391
+ lastRejector = noop;
392
+ lastResolve = noop;
393
+ resolve(lastInvoker());
394
+ }
395
+ },
396
+ isPending: (0, vue.shallowReadonly)(_pending)
397
+ });
364
398
  }
365
399
  function throttleFilter(...args) {
366
400
  let lastExec = 0;
@@ -385,23 +419,23 @@ vue = __toESM(vue);
385
419
  const filter = (_invoke) => {
386
420
  const duration = (0, vue.toValue)(ms);
387
421
  const elapsed = Date.now() - lastExec;
388
- const invoke$1 = () => {
422
+ const invoke = () => {
389
423
  return lastValue = _invoke();
390
424
  };
391
425
  clear();
392
426
  if (duration <= 0) {
393
427
  lastExec = Date.now();
394
- return invoke$1();
428
+ return invoke();
395
429
  }
396
430
  if (elapsed > duration) {
397
431
  lastExec = Date.now();
398
- if (leading || !isLeading) invoke$1();
432
+ if (leading || !isLeading) invoke();
399
433
  } else if (trailing) lastValue = new Promise((resolve, reject) => {
400
434
  lastRejector = rejectOnCancel ? reject : resolve;
401
435
  timer = setTimeout(() => {
402
436
  lastExec = Date.now();
403
437
  isLeading = true;
404
- resolve(invoke$1());
438
+ resolve(invoke());
405
439
  clear();
406
440
  }, Math.max(0, duration - elapsed));
407
441
  });
@@ -430,18 +464,17 @@ vue = __toESM(vue);
430
464
  if (isActive.value) extendFilter(...args);
431
465
  };
432
466
  return {
433
- isActive: (0, vue.readonly)(isActive),
467
+ isActive: (0, vue.shallowReadonly)(isActive),
434
468
  pause,
435
469
  resume,
436
470
  eventFilter
437
471
  };
438
472
  }
439
-
440
- //#endregion
441
- //#region utils/general.ts
473
+ //#endregion
474
+ //#region utils/general.ts
442
475
  function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
443
476
  return new Promise((resolve, reject) => {
444
- if (throwOnTimeout) setTimeout(() => reject(reason), ms);
477
+ if (throwOnTimeout) setTimeout(reject, ms, reason);
445
478
  else setTimeout(resolve, ms);
446
479
  });
447
480
  }
@@ -519,9 +552,8 @@ vue = __toESM(vue);
519
552
  function toArray(value) {
520
553
  return Array.isArray(value) ? value : [value];
521
554
  }
522
-
523
- //#endregion
524
- //#region utils/port.ts
555
+ //#endregion
556
+ //#region utils/port.ts
525
557
  function cacheStringFunction(fn) {
526
558
  const cache = Object.create(null);
527
559
  return ((str) => {
@@ -534,16 +566,14 @@ vue = __toESM(vue);
534
566
  const camelize = cacheStringFunction((str) => {
535
567
  return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
536
568
  });
537
-
538
- //#endregion
539
- //#region utils/vue.ts
569
+ //#endregion
570
+ //#region utils/vue.ts
540
571
  function getLifeCycleTarget(target) {
541
572
  return target || (0, vue.getCurrentInstance)();
542
573
  }
543
-
544
- //#endregion
545
- //#region createSharedComposable/index.ts
546
- /**
574
+ //#endregion
575
+ //#region createSharedComposable/index.ts
576
+ /**
547
577
  * Make a composable function usable with multiple Vue instances.
548
578
  *
549
579
  * @see https://vueuse.org/createSharedComposable
@@ -573,9 +603,8 @@ vue = __toESM(vue);
573
603
  return state;
574
604
  });
575
605
  }
576
-
577
- //#endregion
578
- //#region extendRef/index.ts
606
+ //#endregion
607
+ //#region extendRef/index.ts
579
608
  function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
580
609
  for (const [key, value] of Object.entries(extend)) {
581
610
  if (key === "value") continue;
@@ -595,22 +624,19 @@ vue = __toESM(vue);
595
624
  }
596
625
  return ref;
597
626
  }
598
-
599
- //#endregion
600
- //#region get/index.ts
627
+ //#endregion
628
+ //#region get/index.ts
601
629
  function get(obj, key) {
602
630
  if (key == null) return (0, vue.unref)(obj);
603
631
  return (0, vue.unref)(obj)[key];
604
632
  }
605
-
606
- //#endregion
607
- //#region isDefined/index.ts
633
+ //#endregion
634
+ //#region isDefined/index.ts
608
635
  function isDefined(v) {
609
636
  return (0, vue.unref)(v) != null;
610
637
  }
611
-
612
- //#endregion
613
- //#region makeDestructurable/index.ts
638
+ //#endregion
639
+ //#region makeDestructurable/index.ts
614
640
  /* @__NO_SIDE_EFFECTS__ */
615
641
  function makeDestructurable(obj, arr) {
616
642
  if (typeof Symbol !== "undefined") {
@@ -628,10 +654,9 @@ vue = __toESM(vue);
628
654
  return clone;
629
655
  } else return Object.assign([...arr], obj);
630
656
  }
631
-
632
- //#endregion
633
- //#region reactify/index.ts
634
- /**
657
+ //#endregion
658
+ //#region reactify/index.ts
659
+ /**
635
660
  * Converts plain function into a reactive function.
636
661
  * The converted function accepts refs as it's arguments
637
662
  * and returns a ComputedRef, with proper typing.
@@ -649,10 +674,9 @@ vue = __toESM(vue);
649
674
  }
650
675
  /** @deprecated use `reactify` instead */
651
676
  const createReactiveFn = reactify;
652
-
653
- //#endregion
654
- //#region reactifyObject/index.ts
655
- /**
677
+ //#endregion
678
+ //#region reactifyObject/index.ts
679
+ /**
656
680
  * Apply `reactify` to an object
657
681
  *
658
682
  * @__NO_SIDE_EFFECTS__
@@ -672,10 +696,9 @@ vue = __toESM(vue);
672
696
  return [key, typeof value === "function" ? reactify(value.bind(obj), options) : value];
673
697
  }));
674
698
  }
675
-
676
- //#endregion
677
- //#region toReactive/index.ts
678
- /**
699
+ //#endregion
700
+ //#region toReactive/index.ts
701
+ /**
679
702
  * Converts ref to reactive.
680
703
  *
681
704
  * @see https://vueuse.org/toReactive
@@ -709,19 +732,17 @@ vue = __toESM(vue);
709
732
  }
710
733
  }));
711
734
  }
712
-
713
- //#endregion
714
- //#region reactiveComputed/index.ts
715
- /**
735
+ //#endregion
736
+ //#region reactiveComputed/index.ts
737
+ /**
716
738
  * Computed reactive object.
717
739
  */
718
740
  function reactiveComputed(fn) {
719
741
  return toReactive((0, vue.computed)(fn));
720
742
  }
721
-
722
- //#endregion
723
- //#region reactiveOmit/index.ts
724
- /**
743
+ //#endregion
744
+ //#region reactiveOmit/index.ts
745
+ /**
725
746
  * Reactively omit fields from a reactive object
726
747
  *
727
748
  * @see https://vueuse.org/reactiveOmit
@@ -731,10 +752,9 @@ vue = __toESM(vue);
731
752
  const predicate = flatKeys[0];
732
753
  return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries((0, vue.toRefs)(obj)).filter(([k, v]) => !predicate((0, vue.toValue)(v), k))) : Object.fromEntries(Object.entries((0, vue.toRefs)(obj)).filter((e) => !flatKeys.includes(e[0]))));
733
754
  }
734
-
735
- //#endregion
736
- //#region reactivePick/index.ts
737
- /**
755
+ //#endregion
756
+ //#region reactivePick/index.ts
757
+ /**
738
758
  * Reactively pick fields from a reactive object
739
759
  *
740
760
  * @see https://vueuse.org/reactivePick
@@ -744,10 +764,9 @@ vue = __toESM(vue);
744
764
  const predicate = flatKeys[0];
745
765
  return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries((0, vue.toRefs)(obj)).filter(([k, v]) => predicate((0, vue.toValue)(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
746
766
  }
747
-
748
- //#endregion
749
- //#region refAutoReset/index.ts
750
- /**
767
+ //#endregion
768
+ //#region refAutoReset/index.ts
769
+ /**
751
770
  * Create a ref which will be reset to the default value after some time.
752
771
  *
753
772
  * @see https://vueuse.org/refAutoReset
@@ -781,10 +800,9 @@ vue = __toESM(vue);
781
800
  }
782
801
  /** @deprecated use `refAutoReset` instead */
783
802
  const autoResetRef = refAutoReset;
784
-
785
- //#endregion
786
- //#region useDebounceFn/index.ts
787
- /**
803
+ //#endregion
804
+ //#region useDebounceFn/index.ts
805
+ /**
788
806
  * Debounce execution of a function.
789
807
  *
790
808
  * @see https://vueuse.org/useDebounceFn
@@ -792,17 +810,14 @@ vue = __toESM(vue);
792
810
  * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
793
811
  * @param options Options
794
812
  *
795
- * @return A new, debounce, function.
796
- *
797
- * @__NO_SIDE_EFFECTS__
813
+ * @return A new, debounced, function with isPending, cancel, and flush properties.
798
814
  */
799
815
  function useDebounceFn(fn, ms = 200, options = {}) {
800
816
  return createFilterWrapper(debounceFilter(ms, options), fn);
801
817
  }
802
-
803
- //#endregion
804
- //#region refDebounced/index.ts
805
- /**
818
+ //#endregion
819
+ //#region refDebounced/index.ts
820
+ /**
806
821
  * Debounce updates of a ref.
807
822
  *
808
823
  * @return A new debounced ref.
@@ -819,10 +834,9 @@ vue = __toESM(vue);
819
834
  const debouncedRef = refDebounced;
820
835
  /** @deprecated use `refDebounced` instead */
821
836
  const useDebounce = refDebounced;
822
-
823
- //#endregion
824
- //#region refDefault/index.ts
825
- /**
837
+ //#endregion
838
+ //#region refDefault/index.ts
839
+ /**
826
840
  * Apply default value to a ref.
827
841
  *
828
842
  * @__NO_SIDE_EFFECTS__
@@ -838,10 +852,9 @@ vue = __toESM(vue);
838
852
  }
839
853
  });
840
854
  }
841
-
842
- //#endregion
843
- //#region refManualReset/index.ts
844
- /**
855
+ //#endregion
856
+ //#region refManualReset/index.ts
857
+ /**
845
858
  * Create a ref with manual reset functionality.
846
859
  *
847
860
  * @see https://vueuse.org/refManualReset
@@ -870,10 +883,9 @@ vue = __toESM(vue);
870
883
  refValue.reset = reset;
871
884
  return refValue;
872
885
  }
873
-
874
- //#endregion
875
- //#region useThrottleFn/index.ts
876
- /**
886
+ //#endregion
887
+ //#region useThrottleFn/index.ts
888
+ /**
877
889
  * Throttle execution of a function. Especially useful for rate limiting
878
890
  * execution of handlers on events like resize and scroll.
879
891
  *
@@ -895,10 +907,9 @@ vue = __toESM(vue);
895
907
  function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
896
908
  return createFilterWrapper(throttleFilter(ms, trailing, leading, rejectOnCancel), fn);
897
909
  }
898
-
899
- //#endregion
900
- //#region refThrottled/index.ts
901
- /**
910
+ //#endregion
911
+ //#region refThrottled/index.ts
912
+ /**
902
913
  * Throttle execution of a function. Especially useful for rate limiting
903
914
  * execution of handlers on events like resize and scroll.
904
915
  *
@@ -920,10 +931,9 @@ vue = __toESM(vue);
920
931
  const throttledRef = refThrottled;
921
932
  /** @deprecated use `refThrottled` instead */
922
933
  const useThrottle = refThrottled;
923
-
924
- //#endregion
925
- //#region refWithControl/index.ts
926
- /**
934
+ //#endregion
935
+ //#region refWithControl/index.ts
936
+ /**
927
937
  * Fine-grained controls over ref and its reactivity.
928
938
  *
929
939
  * @__NO_SIDE_EFFECTS__
@@ -937,18 +947,18 @@ vue = __toESM(vue);
937
947
  trigger = _trigger;
938
948
  return {
939
949
  get() {
940
- return get$1();
950
+ return get();
941
951
  },
942
952
  set(v) {
943
- set$1(v);
953
+ set(v);
944
954
  }
945
955
  };
946
956
  });
947
- function get$1(tracking = true) {
957
+ function get(tracking = true) {
948
958
  if (tracking) track();
949
959
  return source;
950
960
  }
951
- function set$1(value, triggering = true) {
961
+ function set(value, triggering = true) {
952
962
  var _options$onBeforeChan, _options$onChanged;
953
963
  if (value === source) return;
954
964
  const old = source;
@@ -960,26 +970,26 @@ vue = __toESM(vue);
960
970
  /**
961
971
  * Get the value without tracked in the reactivity system
962
972
  */
963
- const untrackedGet = () => get$1(false);
973
+ const untrackedGet = () => get(false);
964
974
  /**
965
975
  * Set the value without triggering the reactivity system
966
976
  */
967
- const silentSet = (v) => set$1(v, false);
977
+ const silentSet = (v) => set(v, false);
968
978
  /**
969
979
  * Get the value without tracked in the reactivity system.
970
980
  *
971
981
  * Alias for `untrackedGet()`
972
982
  */
973
- const peek = () => get$1(false);
983
+ const peek = () => get(false);
974
984
  /**
975
985
  * Set the value without triggering the reactivity system
976
986
  *
977
987
  * Alias for `silentSet(v)`
978
988
  */
979
- const lay = (v) => set$1(v, false);
989
+ const lay = (v) => set(v, false);
980
990
  return extendRef(ref, {
981
- get: get$1,
982
- set: set$1,
991
+ get,
992
+ set,
983
993
  untrackedGet,
984
994
  silentSet,
985
995
  peek,
@@ -988,10 +998,9 @@ vue = __toESM(vue);
988
998
  }
989
999
  /** @deprecated use `refWithControl` instead */
990
1000
  const controlledRef = refWithControl;
991
-
992
- //#endregion
993
- //#region set/index.ts
994
- /**
1001
+ //#endregion
1002
+ //#region set/index.ts
1003
+ /**
995
1004
  * Shorthand for `ref.value = x`
996
1005
  */
997
1006
  function set(...args) {
@@ -1004,19 +1013,17 @@ vue = __toESM(vue);
1004
1013
  target[key] = value;
1005
1014
  }
1006
1015
  }
1007
-
1008
- //#endregion
1009
- //#region watchWithFilter/index.ts
1016
+ //#endregion
1017
+ //#region watchWithFilter/index.ts
1010
1018
  function watchWithFilter(source, cb, options = {}) {
1011
- const { eventFilter = bypassFilter,...watchOptions } = options;
1019
+ const { eventFilter = bypassFilter, ...watchOptions } = options;
1012
1020
  return (0, vue.watch)(source, createFilterWrapper(eventFilter, cb), watchOptions);
1013
1021
  }
1014
-
1015
- //#endregion
1016
- //#region watchPausable/index.ts
1017
- /** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
1022
+ //#endregion
1023
+ //#region watchPausable/index.ts
1024
+ /** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
1018
1025
  function watchPausable(source, cb, options = {}) {
1019
- const { eventFilter: filter, initialState = "active",...watchOptions } = options;
1026
+ const { eventFilter: filter, initialState = "active", ...watchOptions } = options;
1020
1027
  const { eventFilter, pause, resume, isActive } = pausableFilter(filter, { initialState });
1021
1028
  return {
1022
1029
  stop: watchWithFilter(source, cb, {
@@ -1030,10 +1037,9 @@ vue = __toESM(vue);
1030
1037
  }
1031
1038
  /** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
1032
1039
  const pausableWatch = watchPausable;
1033
-
1034
- //#endregion
1035
- //#region syncRef/index.ts
1036
- /**
1040
+ //#endregion
1041
+ //#region syncRef/index.ts
1042
+ /**
1037
1043
  * Two-way refs synchronization.
1038
1044
  * From the set theory perspective to restrict the option's type
1039
1045
  * Check in the following order:
@@ -1070,10 +1076,9 @@ vue = __toESM(vue);
1070
1076
  };
1071
1077
  return stop;
1072
1078
  }
1073
-
1074
- //#endregion
1075
- //#region syncRefs/index.ts
1076
- /**
1079
+ //#endregion
1080
+ //#region syncRefs/index.ts
1081
+ /**
1077
1082
  * Keep target ref(s) in sync with the source ref
1078
1083
  *
1079
1084
  * @param source source ref
@@ -1088,10 +1093,9 @@ vue = __toESM(vue);
1088
1093
  immediate
1089
1094
  });
1090
1095
  }
1091
-
1092
- //#endregion
1093
- //#region toRefs/index.ts
1094
- /**
1096
+ //#endregion
1097
+ //#region toRefs/index.ts
1098
+ /**
1095
1099
  * Extended `toRefs` that also accepts refs of an object.
1096
1100
  *
1097
1101
  * @see https://vueuse.org/toRefs
@@ -1124,10 +1128,9 @@ vue = __toESM(vue);
1124
1128
  }));
1125
1129
  return result;
1126
1130
  }
1127
-
1128
- //#endregion
1129
- //#region tryOnBeforeMount/index.ts
1130
- /**
1131
+ //#endregion
1132
+ //#region tryOnBeforeMount/index.ts
1133
+ /**
1131
1134
  * Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
1132
1135
  *
1133
1136
  * @param fn
@@ -1139,10 +1142,9 @@ vue = __toESM(vue);
1139
1142
  else if (sync) fn();
1140
1143
  else (0, vue.nextTick)(fn);
1141
1144
  }
1142
-
1143
- //#endregion
1144
- //#region tryOnBeforeUnmount/index.ts
1145
- /**
1145
+ //#endregion
1146
+ //#region tryOnBeforeUnmount/index.ts
1147
+ /**
1146
1148
  * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
1147
1149
  *
1148
1150
  * @param fn
@@ -1151,10 +1153,9 @@ vue = __toESM(vue);
1151
1153
  function tryOnBeforeUnmount(fn, target) {
1152
1154
  if (getLifeCycleTarget(target)) (0, vue.onBeforeUnmount)(fn, target);
1153
1155
  }
1154
-
1155
- //#endregion
1156
- //#region tryOnMounted/index.ts
1157
- /**
1156
+ //#endregion
1157
+ //#region tryOnMounted/index.ts
1158
+ /**
1158
1159
  * Call onMounted() if it's inside a component lifecycle, if not, just call the function
1159
1160
  *
1160
1161
  * @param fn
@@ -1166,10 +1167,9 @@ vue = __toESM(vue);
1166
1167
  else if (sync) fn();
1167
1168
  else (0, vue.nextTick)(fn);
1168
1169
  }
1169
-
1170
- //#endregion
1171
- //#region tryOnUnmounted/index.ts
1172
- /**
1170
+ //#endregion
1171
+ //#region tryOnUnmounted/index.ts
1172
+ /**
1173
1173
  * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
1174
1174
  *
1175
1175
  * @param fn
@@ -1178,9 +1178,8 @@ vue = __toESM(vue);
1178
1178
  function tryOnUnmounted(fn, target) {
1179
1179
  if (getLifeCycleTarget(target)) (0, vue.onUnmounted)(fn, target);
1180
1180
  }
1181
-
1182
- //#endregion
1183
- //#region until/index.ts
1181
+ //#endregion
1182
+ //#region until/index.ts
1184
1183
  function createUntil(r, isNot = false) {
1185
1184
  function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
1186
1185
  let stop = null;
@@ -1277,9 +1276,8 @@ vue = __toESM(vue);
1277
1276
  function until(r) {
1278
1277
  return createUntil(r);
1279
1278
  }
1280
-
1281
- //#endregion
1282
- //#region useArrayDifference/index.ts
1279
+ //#endregion
1280
+ //#region useArrayDifference/index.ts
1283
1281
  function defaultComparator(value, othVal) {
1284
1282
  return value === othVal;
1285
1283
  }
@@ -1307,10 +1305,9 @@ vue = __toESM(vue);
1307
1305
  return (0, vue.computed)(() => symmetric ? [...(0, vue.toValue)(diff1), ...(0, vue.toValue)(diff2)] : (0, vue.toValue)(diff1));
1308
1306
  } else return diff1;
1309
1307
  }
1310
-
1311
- //#endregion
1312
- //#region useArrayEvery/index.ts
1313
- /**
1308
+ //#endregion
1309
+ //#region useArrayEvery/index.ts
1310
+ /**
1314
1311
  * Reactive `Array.every`
1315
1312
  *
1316
1313
  * @see https://vueuse.org/useArrayEvery
@@ -1324,10 +1321,9 @@ vue = __toESM(vue);
1324
1321
  function useArrayEvery(list, fn) {
1325
1322
  return (0, vue.computed)(() => (0, vue.toValue)(list).every((element, index, array) => fn((0, vue.toValue)(element), index, array)));
1326
1323
  }
1327
-
1328
- //#endregion
1329
- //#region useArrayFilter/index.ts
1330
- /**
1324
+ //#endregion
1325
+ //#region useArrayFilter/index.ts
1326
+ /**
1331
1327
  * Reactive `Array.filter`
1332
1328
  *
1333
1329
  * @see https://vueuse.org/useArrayFilter
@@ -1341,10 +1337,9 @@ vue = __toESM(vue);
1341
1337
  function useArrayFilter(list, fn) {
1342
1338
  return (0, vue.computed)(() => (0, vue.toValue)(list).map((i) => (0, vue.toValue)(i)).filter(fn));
1343
1339
  }
1344
-
1345
- //#endregion
1346
- //#region useArrayFind/index.ts
1347
- /**
1340
+ //#endregion
1341
+ //#region useArrayFind/index.ts
1342
+ /**
1348
1343
  * Reactive `Array.find`
1349
1344
  *
1350
1345
  * @see https://vueuse.org/useArrayFind
@@ -1358,10 +1353,9 @@ vue = __toESM(vue);
1358
1353
  function useArrayFind(list, fn) {
1359
1354
  return (0, vue.computed)(() => (0, vue.toValue)((0, vue.toValue)(list).find((element, index, array) => fn((0, vue.toValue)(element), index, array))));
1360
1355
  }
1361
-
1362
- //#endregion
1363
- //#region useArrayFindIndex/index.ts
1364
- /**
1356
+ //#endregion
1357
+ //#region useArrayFindIndex/index.ts
1358
+ /**
1365
1359
  * Reactive `Array.findIndex`
1366
1360
  *
1367
1361
  * @see https://vueuse.org/useArrayFindIndex
@@ -1375,9 +1369,8 @@ vue = __toESM(vue);
1375
1369
  function useArrayFindIndex(list, fn) {
1376
1370
  return (0, vue.computed)(() => (0, vue.toValue)(list).findIndex((element, index, array) => fn((0, vue.toValue)(element), index, array)));
1377
1371
  }
1378
-
1379
- //#endregion
1380
- //#region useArrayFindLast/index.ts
1372
+ //#endregion
1373
+ //#region useArrayFindLast/index.ts
1381
1374
  function findLast(arr, cb) {
1382
1375
  let index = arr.length;
1383
1376
  while (index-- > 0) if (cb(arr[index], index, arr)) return arr[index];
@@ -1396,9 +1389,8 @@ vue = __toESM(vue);
1396
1389
  function useArrayFindLast(list, fn) {
1397
1390
  return (0, vue.computed)(() => (0, vue.toValue)(!Array.prototype.findLast ? findLast((0, vue.toValue)(list), (element, index, array) => fn((0, vue.toValue)(element), index, array)) : (0, vue.toValue)(list).findLast((element, index, array) => fn((0, vue.toValue)(element), index, array))));
1398
1391
  }
1399
-
1400
- //#endregion
1401
- //#region useArrayIncludes/index.ts
1392
+ //#endregion
1393
+ //#region useArrayIncludes/index.ts
1402
1394
  function isArrayIncludesOptions(obj) {
1403
1395
  return isObject(obj) && containsProp(obj, "formIndex", "comparator");
1404
1396
  }
@@ -1424,15 +1416,14 @@ vue = __toESM(vue);
1424
1416
  }
1425
1417
  if (typeof comparator === "string") {
1426
1418
  const key = comparator;
1427
- comparator = (element, value$1) => element[key] === (0, vue.toValue)(value$1);
1419
+ comparator = (element, value) => element[key] === (0, vue.toValue)(value);
1428
1420
  }
1429
- comparator = (_comparator = comparator) !== null && _comparator !== void 0 ? _comparator : ((element, value$1) => element === (0, vue.toValue)(value$1));
1421
+ comparator = (_comparator = comparator) !== null && _comparator !== void 0 ? _comparator : ((element, value) => element === (0, vue.toValue)(value));
1430
1422
  return (0, vue.computed)(() => (0, vue.toValue)(list).slice(formIndex).some((element, index, array) => comparator((0, vue.toValue)(element), (0, vue.toValue)(value), index, (0, vue.toValue)(array))));
1431
1423
  }
1432
-
1433
- //#endregion
1434
- //#region useArrayJoin/index.ts
1435
- /**
1424
+ //#endregion
1425
+ //#region useArrayJoin/index.ts
1426
+ /**
1436
1427
  * Reactive `Array.join`
1437
1428
  *
1438
1429
  * @see https://vueuse.org/useArrayJoin
@@ -1446,10 +1437,9 @@ vue = __toESM(vue);
1446
1437
  function useArrayJoin(list, separator) {
1447
1438
  return (0, vue.computed)(() => (0, vue.toValue)(list).map((i) => (0, vue.toValue)(i)).join((0, vue.toValue)(separator)));
1448
1439
  }
1449
-
1450
- //#endregion
1451
- //#region useArrayMap/index.ts
1452
- /**
1440
+ //#endregion
1441
+ //#region useArrayMap/index.ts
1442
+ /**
1453
1443
  * Reactive `Array.map`
1454
1444
  *
1455
1445
  * @see https://vueuse.org/useArrayMap
@@ -1463,10 +1453,9 @@ vue = __toESM(vue);
1463
1453
  function useArrayMap(list, fn) {
1464
1454
  return (0, vue.computed)(() => (0, vue.toValue)(list).map((i) => (0, vue.toValue)(i)).map(fn));
1465
1455
  }
1466
-
1467
- //#endregion
1468
- //#region useArrayReduce/index.ts
1469
- /**
1456
+ //#endregion
1457
+ //#region useArrayReduce/index.ts
1458
+ /**
1470
1459
  * Reactive `Array.reduce`
1471
1460
  *
1472
1461
  * @see https://vueuse.org/useArrayReduce
@@ -1485,10 +1474,9 @@ vue = __toESM(vue);
1485
1474
  return args.length ? resolved.reduce(reduceCallback, typeof args[0] === "function" ? (0, vue.toValue)(args[0]()) : (0, vue.toValue)(args[0])) : resolved.reduce(reduceCallback);
1486
1475
  });
1487
1476
  }
1488
-
1489
- //#endregion
1490
- //#region useArraySome/index.ts
1491
- /**
1477
+ //#endregion
1478
+ //#region useArraySome/index.ts
1479
+ /**
1492
1480
  * Reactive `Array.some`
1493
1481
  *
1494
1482
  * @see https://vueuse.org/useArraySome
@@ -1502,9 +1490,8 @@ vue = __toESM(vue);
1502
1490
  function useArraySome(list, fn) {
1503
1491
  return (0, vue.computed)(() => (0, vue.toValue)(list).some((element, index, array) => fn((0, vue.toValue)(element), index, array)));
1504
1492
  }
1505
-
1506
- //#endregion
1507
- //#region useArrayUnique/index.ts
1493
+ //#endregion
1494
+ //#region useArrayUnique/index.ts
1508
1495
  function uniq(array) {
1509
1496
  return Array.from(new Set(array));
1510
1497
  }
@@ -1529,10 +1516,9 @@ vue = __toESM(vue);
1529
1516
  return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);
1530
1517
  });
1531
1518
  }
1532
-
1533
- //#endregion
1534
- //#region useCounter/index.ts
1535
- /**
1519
+ //#endregion
1520
+ //#region useCounter/index.ts
1521
+ /**
1536
1522
  * Basic counter with utility functions.
1537
1523
  *
1538
1524
  * @see https://vueuse.org/useCounter
@@ -1545,24 +1531,23 @@ vue = __toESM(vue);
1545
1531
  const { max = Number.POSITIVE_INFINITY, min = Number.NEGATIVE_INFINITY } = options;
1546
1532
  const inc = (delta = 1) => count.value = Math.max(Math.min(max, count.value + delta), min);
1547
1533
  const dec = (delta = 1) => count.value = Math.min(Math.max(min, count.value - delta), max);
1548
- const get$1 = () => count.value;
1549
- const set$1 = (val) => count.value = Math.max(min, Math.min(max, val));
1534
+ const get = () => count.value;
1535
+ const set = (val) => count.value = Math.max(min, Math.min(max, val));
1550
1536
  const reset = (val = _initialValue) => {
1551
1537
  _initialValue = val;
1552
- return set$1(val);
1538
+ return set(val);
1553
1539
  };
1554
1540
  return {
1555
1541
  count: (0, vue.shallowReadonly)(count),
1556
1542
  inc,
1557
1543
  dec,
1558
- get: get$1,
1559
- set: set$1,
1544
+ get,
1545
+ set,
1560
1546
  reset
1561
1547
  };
1562
1548
  }
1563
-
1564
- //#endregion
1565
- //#region useDateFormat/index.ts
1549
+ //#endregion
1550
+ //#region useDateFormat/index.ts
1566
1551
  const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
1567
1552
  const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;
1568
1553
  function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
@@ -1665,10 +1650,9 @@ vue = __toESM(vue);
1665
1650
  function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
1666
1651
  return (0, vue.computed)(() => formatDate(normalizeDate((0, vue.toValue)(date)), (0, vue.toValue)(formatStr), options));
1667
1652
  }
1668
-
1669
- //#endregion
1670
- //#region useIntervalFn/index.ts
1671
- /**
1653
+ //#endregion
1654
+ //#region useIntervalFn/index.ts
1655
+ /**
1672
1656
  * Wrapper for `setInterval` with controls
1673
1657
  *
1674
1658
  * @see https://vueuse.org/useIntervalFn
@@ -1709,9 +1693,8 @@ vue = __toESM(vue);
1709
1693
  resume
1710
1694
  };
1711
1695
  }
1712
-
1713
- //#endregion
1714
- //#region useInterval/index.ts
1696
+ //#endregion
1697
+ //#region useInterval/index.ts
1715
1698
  function useInterval(interval = 1e3, options = {}) {
1716
1699
  const { controls: exposeControls = false, immediate = true, callback } = options;
1717
1700
  const counter = (0, vue.shallowRef)(0);
@@ -1730,19 +1713,17 @@ vue = __toESM(vue);
1730
1713
  };
1731
1714
  else return (0, vue.shallowReadonly)(counter);
1732
1715
  }
1733
-
1734
- //#endregion
1735
- //#region useLastChanged/index.ts
1716
+ //#endregion
1717
+ //#region useLastChanged/index.ts
1736
1718
  function useLastChanged(source, options = {}) {
1737
1719
  var _options$initialValue;
1738
1720
  const ms = (0, vue.shallowRef)((_options$initialValue = options.initialValue) !== null && _options$initialValue !== void 0 ? _options$initialValue : null);
1739
1721
  (0, vue.watch)(source, () => ms.value = timestamp(), options);
1740
1722
  return (0, vue.shallowReadonly)(ms);
1741
1723
  }
1742
-
1743
- //#endregion
1744
- //#region useTimeoutFn/index.ts
1745
- /**
1724
+ //#endregion
1725
+ //#region useTimeoutFn/index.ts
1726
+ /**
1746
1727
  * Wrapper for `setTimeout` with controls.
1747
1728
  *
1748
1729
  * @param cb
@@ -1784,9 +1765,8 @@ vue = __toESM(vue);
1784
1765
  stop
1785
1766
  };
1786
1767
  }
1787
-
1788
- //#endregion
1789
- //#region useTimeout/index.ts
1768
+ //#endregion
1769
+ //#region useTimeout/index.ts
1790
1770
  function useTimeout(interval = 1e3, options = {}) {
1791
1771
  const { controls: exposeControls = false, callback } = options;
1792
1772
  const controls = useTimeoutFn(callback !== null && callback !== void 0 ? callback : noop, interval, options);
@@ -1797,10 +1777,9 @@ vue = __toESM(vue);
1797
1777
  };
1798
1778
  else return ready;
1799
1779
  }
1800
-
1801
- //#endregion
1802
- //#region useToNumber/index.ts
1803
- /**
1780
+ //#endregion
1781
+ //#region useToNumber/index.ts
1782
+ /**
1804
1783
  * Reactively convert a string ref to number.
1805
1784
  *
1806
1785
  * @__NO_SIDE_EFFECTS__
@@ -1815,10 +1794,9 @@ vue = __toESM(vue);
1815
1794
  return resolved;
1816
1795
  });
1817
1796
  }
1818
-
1819
- //#endregion
1820
- //#region useToString/index.ts
1821
- /**
1797
+ //#endregion
1798
+ //#region useToString/index.ts
1799
+ /**
1822
1800
  * Reactively convert a ref to string.
1823
1801
  *
1824
1802
  * @see https://vueuse.org/useToString
@@ -1828,10 +1806,9 @@ vue = __toESM(vue);
1828
1806
  function useToString(value) {
1829
1807
  return (0, vue.computed)(() => `${(0, vue.toValue)(value)}`);
1830
1808
  }
1831
-
1832
- //#endregion
1833
- //#region useToggle/index.ts
1834
- /**
1809
+ //#endregion
1810
+ //#region useToggle/index.ts
1811
+ /**
1835
1812
  * A boolean ref with a toggler
1836
1813
  *
1837
1814
  * @see https://vueuse.org/useToggle
@@ -1857,10 +1834,9 @@ vue = __toESM(vue);
1857
1834
  if (valueIsRef) return toggle;
1858
1835
  else return [_value, toggle];
1859
1836
  }
1860
-
1861
- //#endregion
1862
- //#region watchArray/index.ts
1863
- /**
1837
+ //#endregion
1838
+ //#region watchArray/index.ts
1839
+ /**
1864
1840
  * Watch for an array with additions and removals.
1865
1841
  *
1866
1842
  * @see https://vueuse.org/watchArray
@@ -1879,16 +1855,15 @@ vue = __toESM(vue);
1879
1855
  }
1880
1856
  if (!found) added.push(obj);
1881
1857
  }
1882
- const removed = oldList.filter((_$1, i) => !oldListRemains[i]);
1858
+ const removed = oldList.filter((_, i) => !oldListRemains[i]);
1883
1859
  cb(newList, oldList, added, removed, onCleanup);
1884
1860
  oldList = [...newList];
1885
1861
  }, options);
1886
1862
  }
1887
-
1888
- //#endregion
1889
- //#region watchAtMost/index.ts
1863
+ //#endregion
1864
+ //#region watchAtMost/index.ts
1890
1865
  function watchAtMost(source, cb, options) {
1891
- const { count,...watchOptions } = options;
1866
+ const { count, ...watchOptions } = options;
1892
1867
  const current = (0, vue.shallowRef)(0);
1893
1868
  const { stop, resume, pause } = watchWithFilter(source, (...args) => {
1894
1869
  current.value += 1;
@@ -1902,11 +1877,10 @@ vue = __toESM(vue);
1902
1877
  pause
1903
1878
  };
1904
1879
  }
1905
-
1906
- //#endregion
1907
- //#region watchDebounced/index.ts
1880
+ //#endregion
1881
+ //#region watchDebounced/index.ts
1908
1882
  function watchDebounced(source, cb, options = {}) {
1909
- const { debounce = 0, maxWait = void 0,...watchOptions } = options;
1883
+ const { debounce = 0, maxWait = void 0, ...watchOptions } = options;
1910
1884
  return watchWithFilter(source, cb, {
1911
1885
  ...watchOptions,
1912
1886
  eventFilter: debounceFilter(debounce, { maxWait })
@@ -1914,10 +1888,9 @@ vue = __toESM(vue);
1914
1888
  }
1915
1889
  /** @deprecated use `watchDebounced` instead */
1916
1890
  const debouncedWatch = watchDebounced;
1917
-
1918
- //#endregion
1919
- //#region watchDeep/index.ts
1920
- /**
1891
+ //#endregion
1892
+ //#region watchDeep/index.ts
1893
+ /**
1921
1894
  * Shorthand for watching value with {deep: true}
1922
1895
  *
1923
1896
  * @see https://vueuse.org/watchDeep
@@ -1928,11 +1901,10 @@ vue = __toESM(vue);
1928
1901
  deep: true
1929
1902
  });
1930
1903
  }
1931
-
1932
- //#endregion
1933
- //#region watchIgnorable/index.ts
1904
+ //#endregion
1905
+ //#region watchIgnorable/index.ts
1934
1906
  function watchIgnorable(source, cb, options = {}) {
1935
- const { eventFilter = bypassFilter,...watchOptions } = options;
1907
+ const { eventFilter = bypassFilter, ...watchOptions } = options;
1936
1908
  const filteredCb = createFilterWrapper(eventFilter, cb);
1937
1909
  let ignoreUpdates;
1938
1910
  let ignorePrevAsyncUpdates;
@@ -1985,10 +1957,9 @@ vue = __toESM(vue);
1985
1957
  }
1986
1958
  /** @deprecated use `watchIgnorable` instead */
1987
1959
  const ignorableWatch = watchIgnorable;
1988
-
1989
- //#endregion
1990
- //#region watchImmediate/index.ts
1991
- /**
1960
+ //#endregion
1961
+ //#region watchImmediate/index.ts
1962
+ /**
1992
1963
  * Shorthand for watching value with {immediate: true}
1993
1964
  *
1994
1965
  * @see https://vueuse.org/watchImmediate
@@ -1999,10 +1970,9 @@ vue = __toESM(vue);
1999
1970
  immediate: true
2000
1971
  });
2001
1972
  }
2002
-
2003
- //#endregion
2004
- //#region watchOnce/index.ts
2005
- /**
1973
+ //#endregion
1974
+ //#region watchOnce/index.ts
1975
+ /**
2006
1976
  * Shorthand for watching value with { once: true }
2007
1977
  *
2008
1978
  * @see https://vueuse.org/watchOnce
@@ -2013,11 +1983,10 @@ vue = __toESM(vue);
2013
1983
  once: true
2014
1984
  });
2015
1985
  }
2016
-
2017
- //#endregion
2018
- //#region watchThrottled/index.ts
1986
+ //#endregion
1987
+ //#region watchThrottled/index.ts
2019
1988
  function watchThrottled(source, cb, options = {}) {
2020
- const { throttle = 0, trailing = true, leading = true,...watchOptions } = options;
1989
+ const { throttle = 0, trailing = true, leading = true, ...watchOptions } = options;
2021
1990
  return watchWithFilter(source, cb, {
2022
1991
  ...watchOptions,
2023
1992
  eventFilter: throttleFilter(throttle, trailing, leading)
@@ -2025,9 +1994,8 @@ vue = __toESM(vue);
2025
1994
  }
2026
1995
  /** @deprecated use `watchThrottled` instead */
2027
1996
  const throttledWatch = watchThrottled;
2028
-
2029
- //#endregion
2030
- //#region watchTriggerable/index.ts
1997
+ //#endregion
1998
+ //#region watchTriggerable/index.ts
2031
1999
  function watchTriggerable(source, cb, options = {}) {
2032
2000
  let cleanupFn;
2033
2001
  function onEffect() {
@@ -2047,11 +2015,11 @@ vue = __toESM(vue);
2047
2015
  const res = watchIgnorable(source, _cb, options);
2048
2016
  const { ignoreUpdates } = res;
2049
2017
  const trigger = () => {
2050
- let res$1;
2018
+ let res;
2051
2019
  ignoreUpdates(() => {
2052
- res$1 = _cb(getWatchSources(source), getOldValue(source));
2020
+ res = _cb(getWatchSources(source), getOldValue(source));
2053
2021
  });
2054
- return res$1;
2022
+ return res;
2055
2023
  };
2056
2024
  return {
2057
2025
  ...res,
@@ -2066,14 +2034,8 @@ vue = __toESM(vue);
2066
2034
  function getOldValue(source) {
2067
2035
  return Array.isArray(source) ? source.map(() => void 0) : void 0;
2068
2036
  }
2069
-
2070
- //#endregion
2071
- //#region whenever/index.ts
2072
- /**
2073
- * Shorthand for watching value to be truthy
2074
- *
2075
- * @see https://vueuse.org/whenever
2076
- */
2037
+ //#endregion
2038
+ //#region whenever/index.ts
2077
2039
  function whenever(source, cb, options) {
2078
2040
  const stop = (0, vue.watch)(source, (v, ov, onInvalidate) => {
2079
2041
  if (v) {
@@ -2086,125 +2048,125 @@ vue = __toESM(vue);
2086
2048
  });
2087
2049
  return stop;
2088
2050
  }
2089
-
2090
- //#endregion
2091
- exports.assert = assert;
2092
- exports.autoResetRef = autoResetRef;
2093
- exports.bypassFilter = bypassFilter;
2094
- exports.camelize = camelize;
2095
- exports.clamp = clamp;
2096
- exports.computedEager = computedEager;
2097
- exports.computedWithControl = computedWithControl;
2098
- exports.containsProp = containsProp;
2099
- exports.controlledComputed = controlledComputed;
2100
- exports.controlledRef = controlledRef;
2101
- exports.createEventHook = createEventHook;
2102
- exports.createFilterWrapper = createFilterWrapper;
2103
- exports.createGlobalState = createGlobalState;
2104
- exports.createInjectionState = createInjectionState;
2105
- exports.createReactiveFn = createReactiveFn;
2106
- exports.createRef = createRef;
2107
- exports.createSharedComposable = createSharedComposable;
2108
- exports.createSingletonPromise = createSingletonPromise;
2109
- exports.debounceFilter = debounceFilter;
2110
- exports.debouncedRef = debouncedRef;
2111
- exports.debouncedWatch = debouncedWatch;
2112
- exports.eagerComputed = eagerComputed;
2113
- exports.extendRef = extendRef;
2114
- exports.formatDate = formatDate;
2115
- exports.get = get;
2116
- exports.getLifeCycleTarget = getLifeCycleTarget;
2117
- exports.hasOwn = hasOwn;
2118
- exports.hyphenate = hyphenate;
2119
- exports.identity = identity;
2120
- exports.ignorableWatch = ignorableWatch;
2121
- exports.increaseWithUnit = increaseWithUnit;
2122
- exports.injectLocal = injectLocal;
2123
- exports.invoke = invoke;
2124
- exports.isClient = isClient;
2125
- exports.isDef = isDef;
2126
- exports.isDefined = isDefined;
2127
- exports.isIOS = isIOS;
2128
- exports.isObject = isObject;
2129
- exports.isWorker = isWorker;
2130
- exports.makeDestructurable = makeDestructurable;
2131
- exports.noop = noop;
2132
- exports.normalizeDate = normalizeDate;
2133
- exports.notNullish = notNullish;
2134
- exports.now = now;
2135
- exports.objectEntries = objectEntries;
2136
- exports.objectOmit = objectOmit;
2137
- exports.objectPick = objectPick;
2138
- exports.pausableFilter = pausableFilter;
2139
- exports.pausableWatch = pausableWatch;
2140
- exports.promiseTimeout = promiseTimeout;
2141
- exports.provideLocal = provideLocal;
2142
- exports.pxValue = pxValue;
2143
- exports.rand = rand;
2144
- exports.reactify = reactify;
2145
- exports.reactifyObject = reactifyObject;
2146
- exports.reactiveComputed = reactiveComputed;
2147
- exports.reactiveOmit = reactiveOmit;
2148
- exports.reactivePick = reactivePick;
2149
- exports.refAutoReset = refAutoReset;
2150
- exports.refDebounced = refDebounced;
2151
- exports.refDefault = refDefault;
2152
- exports.refManualReset = refManualReset;
2153
- exports.refThrottled = refThrottled;
2154
- exports.refWithControl = refWithControl;
2155
- exports.set = set;
2156
- exports.syncRef = syncRef;
2157
- exports.syncRefs = syncRefs;
2158
- exports.throttleFilter = throttleFilter;
2159
- exports.throttledRef = throttledRef;
2160
- exports.throttledWatch = throttledWatch;
2161
- exports.timestamp = timestamp;
2162
- exports.toArray = toArray;
2163
- exports.toReactive = toReactive;
2164
- exports.toRef = toRef;
2165
- exports.toRefs = toRefs;
2166
- exports.tryOnBeforeMount = tryOnBeforeMount;
2167
- exports.tryOnBeforeUnmount = tryOnBeforeUnmount;
2168
- exports.tryOnMounted = tryOnMounted;
2169
- exports.tryOnScopeDispose = tryOnScopeDispose;
2170
- exports.tryOnUnmounted = tryOnUnmounted;
2171
- exports.until = until;
2172
- exports.useArrayDifference = useArrayDifference;
2173
- exports.useArrayEvery = useArrayEvery;
2174
- exports.useArrayFilter = useArrayFilter;
2175
- exports.useArrayFind = useArrayFind;
2176
- exports.useArrayFindIndex = useArrayFindIndex;
2177
- exports.useArrayFindLast = useArrayFindLast;
2178
- exports.useArrayIncludes = useArrayIncludes;
2179
- exports.useArrayJoin = useArrayJoin;
2180
- exports.useArrayMap = useArrayMap;
2181
- exports.useArrayReduce = useArrayReduce;
2182
- exports.useArraySome = useArraySome;
2183
- exports.useArrayUnique = useArrayUnique;
2184
- exports.useCounter = useCounter;
2185
- exports.useDateFormat = useDateFormat;
2186
- exports.useDebounce = useDebounce;
2187
- exports.useDebounceFn = useDebounceFn;
2188
- exports.useInterval = useInterval;
2189
- exports.useIntervalFn = useIntervalFn;
2190
- exports.useLastChanged = useLastChanged;
2191
- exports.useThrottle = useThrottle;
2192
- exports.useThrottleFn = useThrottleFn;
2193
- exports.useTimeout = useTimeout;
2194
- exports.useTimeoutFn = useTimeoutFn;
2195
- exports.useToNumber = useToNumber;
2196
- exports.useToString = useToString;
2197
- exports.useToggle = useToggle;
2198
- exports.watchArray = watchArray;
2199
- exports.watchAtMost = watchAtMost;
2200
- exports.watchDebounced = watchDebounced;
2201
- exports.watchDeep = watchDeep;
2202
- exports.watchIgnorable = watchIgnorable;
2203
- exports.watchImmediate = watchImmediate;
2204
- exports.watchOnce = watchOnce;
2205
- exports.watchPausable = watchPausable;
2206
- exports.watchThrottled = watchThrottled;
2207
- exports.watchTriggerable = watchTriggerable;
2208
- exports.watchWithFilter = watchWithFilter;
2209
- exports.whenever = whenever;
2210
- })(this.VueUse = this.VueUse || {}, Vue);
2051
+ //#endregion
2052
+ exports.assert = assert;
2053
+ exports.autoResetRef = autoResetRef;
2054
+ exports.bypassFilter = bypassFilter;
2055
+ exports.camelize = camelize;
2056
+ exports.clamp = clamp;
2057
+ exports.computedEager = computedEager;
2058
+ exports.computedWithControl = computedWithControl;
2059
+ exports.containsProp = containsProp;
2060
+ exports.controlledComputed = controlledComputed;
2061
+ exports.controlledRef = controlledRef;
2062
+ exports.createDisposableDirective = createDisposableDirective;
2063
+ exports.createEventHook = createEventHook;
2064
+ exports.createFilterWrapper = createFilterWrapper;
2065
+ exports.createGlobalState = createGlobalState;
2066
+ exports.createInjectionState = createInjectionState;
2067
+ exports.createReactiveFn = createReactiveFn;
2068
+ exports.createRef = createRef;
2069
+ exports.createSharedComposable = createSharedComposable;
2070
+ exports.createSingletonPromise = createSingletonPromise;
2071
+ exports.debounceFilter = debounceFilter;
2072
+ exports.debouncedRef = debouncedRef;
2073
+ exports.debouncedWatch = debouncedWatch;
2074
+ exports.eagerComputed = eagerComputed;
2075
+ exports.extendRef = extendRef;
2076
+ exports.formatDate = formatDate;
2077
+ exports.get = get;
2078
+ exports.getLifeCycleTarget = getLifeCycleTarget;
2079
+ exports.hasOwn = hasOwn;
2080
+ exports.hyphenate = hyphenate;
2081
+ exports.identity = identity;
2082
+ exports.ignorableWatch = ignorableWatch;
2083
+ exports.increaseWithUnit = increaseWithUnit;
2084
+ exports.injectLocal = injectLocal;
2085
+ exports.invoke = invoke;
2086
+ exports.isClient = isClient;
2087
+ exports.isDef = isDef;
2088
+ exports.isDefined = isDefined;
2089
+ exports.isIOS = isIOS;
2090
+ exports.isObject = isObject;
2091
+ exports.isWorker = isWorker;
2092
+ exports.makeDestructurable = makeDestructurable;
2093
+ exports.noop = noop;
2094
+ exports.normalizeDate = normalizeDate;
2095
+ exports.notNullish = notNullish;
2096
+ exports.now = now;
2097
+ exports.objectEntries = objectEntries;
2098
+ exports.objectOmit = objectOmit;
2099
+ exports.objectPick = objectPick;
2100
+ exports.pausableFilter = pausableFilter;
2101
+ exports.pausableWatch = pausableWatch;
2102
+ exports.promiseTimeout = promiseTimeout;
2103
+ exports.provideLocal = provideLocal;
2104
+ exports.pxValue = pxValue;
2105
+ exports.rand = rand;
2106
+ exports.reactify = reactify;
2107
+ exports.reactifyObject = reactifyObject;
2108
+ exports.reactiveComputed = reactiveComputed;
2109
+ exports.reactiveOmit = reactiveOmit;
2110
+ exports.reactivePick = reactivePick;
2111
+ exports.refAutoReset = refAutoReset;
2112
+ exports.refDebounced = refDebounced;
2113
+ exports.refDefault = refDefault;
2114
+ exports.refManualReset = refManualReset;
2115
+ exports.refThrottled = refThrottled;
2116
+ exports.refWithControl = refWithControl;
2117
+ exports.set = set;
2118
+ exports.syncRef = syncRef;
2119
+ exports.syncRefs = syncRefs;
2120
+ exports.throttleFilter = throttleFilter;
2121
+ exports.throttledRef = throttledRef;
2122
+ exports.throttledWatch = throttledWatch;
2123
+ exports.timestamp = timestamp;
2124
+ exports.toArray = toArray;
2125
+ exports.toReactive = toReactive;
2126
+ exports.toRef = toRef;
2127
+ exports.toRefs = toRefs;
2128
+ exports.tryOnBeforeMount = tryOnBeforeMount;
2129
+ exports.tryOnBeforeUnmount = tryOnBeforeUnmount;
2130
+ exports.tryOnMounted = tryOnMounted;
2131
+ exports.tryOnScopeDispose = tryOnScopeDispose;
2132
+ exports.tryOnUnmounted = tryOnUnmounted;
2133
+ exports.until = until;
2134
+ exports.useArrayDifference = useArrayDifference;
2135
+ exports.useArrayEvery = useArrayEvery;
2136
+ exports.useArrayFilter = useArrayFilter;
2137
+ exports.useArrayFind = useArrayFind;
2138
+ exports.useArrayFindIndex = useArrayFindIndex;
2139
+ exports.useArrayFindLast = useArrayFindLast;
2140
+ exports.useArrayIncludes = useArrayIncludes;
2141
+ exports.useArrayJoin = useArrayJoin;
2142
+ exports.useArrayMap = useArrayMap;
2143
+ exports.useArrayReduce = useArrayReduce;
2144
+ exports.useArraySome = useArraySome;
2145
+ exports.useArrayUnique = useArrayUnique;
2146
+ exports.useCounter = useCounter;
2147
+ exports.useDateFormat = useDateFormat;
2148
+ exports.useDebounce = useDebounce;
2149
+ exports.useDebounceFn = useDebounceFn;
2150
+ exports.useInterval = useInterval;
2151
+ exports.useIntervalFn = useIntervalFn;
2152
+ exports.useLastChanged = useLastChanged;
2153
+ exports.useThrottle = useThrottle;
2154
+ exports.useThrottleFn = useThrottleFn;
2155
+ exports.useTimeout = useTimeout;
2156
+ exports.useTimeoutFn = useTimeoutFn;
2157
+ exports.useToNumber = useToNumber;
2158
+ exports.useToString = useToString;
2159
+ exports.useToggle = useToggle;
2160
+ exports.watchArray = watchArray;
2161
+ exports.watchAtMost = watchAtMost;
2162
+ exports.watchDebounced = watchDebounced;
2163
+ exports.watchDeep = watchDeep;
2164
+ exports.watchIgnorable = watchIgnorable;
2165
+ exports.watchImmediate = watchImmediate;
2166
+ exports.watchOnce = watchOnce;
2167
+ exports.watchPausable = watchPausable;
2168
+ exports.watchThrottled = watchThrottled;
2169
+ exports.watchTriggerable = watchTriggerable;
2170
+ exports.watchWithFilter = watchWithFilter;
2171
+ exports.whenever = whenever;
2172
+ })(this.VueUse = this.VueUse || {}, Vue);