@vueuse/shared 10.6.0 → 10.7.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
@@ -69,8 +69,8 @@ function createEventHook() {
69
69
  off: offFn
70
70
  };
71
71
  };
72
- const trigger = (param) => {
73
- return Promise.all(Array.from(fns).map((fn) => param ? fn(param) : fn()));
72
+ const trigger = (...args) => {
73
+ return Promise.all(Array.from(fns).map((fn) => fn(...args)));
74
74
  };
75
75
  return {
76
76
  on,
@@ -309,8 +309,8 @@ const rand = (min, max) => {
309
309
  const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
310
310
  const isIOS = /* @__PURE__ */ getIsIOS();
311
311
  function getIsIOS() {
312
- var _a;
313
- return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
312
+ var _a, _b;
313
+ return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
314
314
  }
315
315
 
316
316
  function createFilterWrapper(filter, fn) {
@@ -506,6 +506,10 @@ function objectOmit(obj, keys, omitUndefined = false) {
506
506
  function objectEntries(obj) {
507
507
  return Object.entries(obj);
508
508
  }
509
+ function getLifeCycleTarget(target) {
510
+ const instance = target || vueDemi.getCurrentInstance();
511
+ return vueDemi.isVue3 ? instance : instance == null ? void 0 : instance.proxy;
512
+ }
509
513
 
510
514
  function toRef(...args) {
511
515
  if (args.length !== 1)
@@ -777,32 +781,36 @@ function toRefs(objectRef, options = {}) {
777
781
  return result;
778
782
  }
779
783
 
780
- function tryOnBeforeMount(fn, sync = true) {
781
- if (vueDemi.getCurrentInstance())
782
- vueDemi.onBeforeMount(fn);
784
+ function tryOnBeforeMount(fn, sync = true, target) {
785
+ const instance = getLifeCycleTarget(target);
786
+ if (instance)
787
+ vueDemi.onBeforeMount(fn, instance);
783
788
  else if (sync)
784
789
  fn();
785
790
  else
786
791
  vueDemi.nextTick(fn);
787
792
  }
788
793
 
789
- function tryOnBeforeUnmount(fn) {
790
- if (vueDemi.getCurrentInstance())
791
- vueDemi.onBeforeUnmount(fn);
794
+ function tryOnBeforeUnmount(fn, target) {
795
+ const instance = getLifeCycleTarget(target);
796
+ if (instance)
797
+ vueDemi.onBeforeUnmount(fn, instance);
792
798
  }
793
799
 
794
- function tryOnMounted(fn, sync = true) {
795
- if (vueDemi.getCurrentInstance())
796
- vueDemi.onMounted(fn);
800
+ function tryOnMounted(fn, sync = true, target) {
801
+ const instance = getLifeCycleTarget(target);
802
+ if (instance)
803
+ vueDemi.onMounted(fn, instance);
797
804
  else if (sync)
798
805
  fn();
799
806
  else
800
807
  vueDemi.nextTick(fn);
801
808
  }
802
809
 
803
- function tryOnUnmounted(fn) {
804
- if (vueDemi.getCurrentInstance())
805
- vueDemi.onUnmounted(fn);
810
+ function tryOnUnmounted(fn, target) {
811
+ const instance = getLifeCycleTarget(target);
812
+ if (instance)
813
+ vueDemi.onUnmounted(fn, instance);
806
814
  }
807
815
 
808
816
  function createUntil(r, isNot = false) {
@@ -1576,6 +1584,7 @@ exports.eagerComputed = computedEager;
1576
1584
  exports.extendRef = extendRef;
1577
1585
  exports.formatDate = formatDate;
1578
1586
  exports.get = get;
1587
+ exports.getLifeCycleTarget = getLifeCycleTarget;
1579
1588
  exports.hasOwn = hasOwn;
1580
1589
  exports.hyphenate = hyphenate;
1581
1590
  exports.identity = identity;
package/index.d.cts CHANGED
@@ -16,38 +16,6 @@ interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, Comp
16
16
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
17
17
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
18
18
 
19
- type Callback<T> = T extends void ? () => void : (param: T) => void;
20
- type EventHookOn<T = any> = (fn: Callback<T>) => {
21
- off: () => void;
22
- };
23
- type EventHookOff<T = any> = (fn: Callback<T>) => void;
24
- type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
25
- interface EventHook<T = any> {
26
- on: EventHookOn<T>;
27
- off: EventHookOff<T>;
28
- trigger: EventHookTrigger<T>;
29
- }
30
- /**
31
- * Utility for creating event hooks
32
- *
33
- * @see https://vueuse.org/createEventHook
34
- */
35
- declare function createEventHook<T = any>(): EventHook<T>;
36
-
37
- declare const isClient: boolean;
38
- declare const isWorker: boolean;
39
- declare const isDef: <T = any>(val?: T | undefined) => val is T;
40
- declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
41
- declare const assert: (condition: boolean, ...infos: any[]) => void;
42
- declare const isObject: (val: any) => val is object;
43
- declare const now: () => number;
44
- declare const timestamp: () => number;
45
- declare const clamp: (n: number, min: number, max: number) => number;
46
- declare const noop: () => void;
47
- declare const rand: (min: number, max: number) => number;
48
- declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
49
- declare const isIOS: boolean | "";
50
-
51
19
  /**
52
20
  * Void function
53
21
  */
@@ -166,6 +134,50 @@ type MapOldSources<T, Immediate> = {
166
134
  type Mutable<T> = {
167
135
  -readonly [P in keyof T]: T[P];
168
136
  };
137
+ type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
138
+ /**
139
+ * will return `true` if `T` is `any`, or `false` otherwise
140
+ */
141
+ type IsAny<T> = IfAny<T, true, false>;
142
+
143
+ /**
144
+ * The source code for this function was inspired by vue-apollo's `useEventHook` util
145
+ * https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts
146
+ */
147
+
148
+ type Callback<T> = IsAny<T> extends true ? (param: any) => void : ([
149
+ T
150
+ ] extends [void] ? () => void : (param: T) => void);
151
+ type EventHookOn<T = any> = (fn: Callback<T>) => {
152
+ off: () => void;
153
+ };
154
+ type EventHookOff<T = any> = (fn: Callback<T>) => void;
155
+ type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
156
+ interface EventHook<T = any> {
157
+ on: EventHookOn<T>;
158
+ off: EventHookOff<T>;
159
+ trigger: EventHookTrigger<T>;
160
+ }
161
+ /**
162
+ * Utility for creating event hooks
163
+ *
164
+ * @see https://vueuse.org/createEventHook
165
+ */
166
+ declare function createEventHook<T = any>(): EventHook<T>;
167
+
168
+ declare const isClient: boolean;
169
+ declare const isWorker: boolean;
170
+ declare const isDef: <T = any>(val?: T | undefined) => val is T;
171
+ declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
172
+ declare const assert: (condition: boolean, ...infos: any[]) => void;
173
+ declare const isObject: (val: any) => val is object;
174
+ declare const now: () => number;
175
+ declare const timestamp: () => number;
176
+ declare const clamp: (n: number, min: number, max: number) => number;
177
+ declare const noop: () => void;
178
+ declare const rand: (min: number, max: number) => number;
179
+ declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
180
+ declare const isIOS: boolean | "";
169
181
 
170
182
  type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
171
183
  interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
@@ -275,6 +287,7 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
275
287
  */
276
288
  declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
277
289
  declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
290
+ declare function getLifeCycleTarget(target?: any): any;
278
291
 
279
292
  /**
280
293
  * Keep states in the global scope to be reusable across Vue instances.
@@ -486,7 +499,7 @@ type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T,
486
499
  /**
487
500
  * A = B
488
501
  */
489
- type Equal<A, B> = A extends B ? (B extends A ? true : false) : false;
502
+ type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
490
503
  /**
491
504
  * A ∩ B ≠ ∅
492
505
  */
@@ -626,23 +639,26 @@ declare const resolveUnref: typeof toValue;
626
639
  *
627
640
  * @param fn
628
641
  * @param sync if set to false, it will run in the nextTick() of Vue
642
+ * @param target
629
643
  */
630
- declare function tryOnBeforeMount(fn: Fn, sync?: boolean): void;
644
+ declare function tryOnBeforeMount(fn: Fn, sync?: boolean, target?: any): void;
631
645
 
632
646
  /**
633
647
  * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
634
648
  *
635
649
  * @param fn
650
+ * @param target
636
651
  */
637
- declare function tryOnBeforeUnmount(fn: Fn): void;
652
+ declare function tryOnBeforeUnmount(fn: Fn, target?: any): void;
638
653
 
639
654
  /**
640
655
  * Call onMounted() if it's inside a component lifecycle, if not, just call the function
641
656
  *
642
657
  * @param fn
643
658
  * @param sync if set to false, it will run in the nextTick() of Vue
659
+ * @param target
644
660
  */
645
- declare function tryOnMounted(fn: Fn, sync?: boolean): void;
661
+ declare function tryOnMounted(fn: Fn, sync?: boolean, target?: any): void;
646
662
 
647
663
  /**
648
664
  * Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
@@ -655,8 +671,9 @@ declare function tryOnScopeDispose(fn: Fn): boolean;
655
671
  * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
656
672
  *
657
673
  * @param fn
674
+ * @param target
658
675
  */
659
- declare function tryOnUnmounted(fn: Fn): void;
676
+ declare function tryOnUnmounted(fn: Fn, target?: any): void;
660
677
 
661
678
  interface UntilToMatchOptions {
662
679
  /**
@@ -1166,4 +1183,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
1166
1183
  */
1167
1184
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
1168
1185
 
1169
- export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1186
+ export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/index.d.mts CHANGED
@@ -16,38 +16,6 @@ interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, Comp
16
16
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
17
17
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
18
18
 
19
- type Callback<T> = T extends void ? () => void : (param: T) => void;
20
- type EventHookOn<T = any> = (fn: Callback<T>) => {
21
- off: () => void;
22
- };
23
- type EventHookOff<T = any> = (fn: Callback<T>) => void;
24
- type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
25
- interface EventHook<T = any> {
26
- on: EventHookOn<T>;
27
- off: EventHookOff<T>;
28
- trigger: EventHookTrigger<T>;
29
- }
30
- /**
31
- * Utility for creating event hooks
32
- *
33
- * @see https://vueuse.org/createEventHook
34
- */
35
- declare function createEventHook<T = any>(): EventHook<T>;
36
-
37
- declare const isClient: boolean;
38
- declare const isWorker: boolean;
39
- declare const isDef: <T = any>(val?: T | undefined) => val is T;
40
- declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
41
- declare const assert: (condition: boolean, ...infos: any[]) => void;
42
- declare const isObject: (val: any) => val is object;
43
- declare const now: () => number;
44
- declare const timestamp: () => number;
45
- declare const clamp: (n: number, min: number, max: number) => number;
46
- declare const noop: () => void;
47
- declare const rand: (min: number, max: number) => number;
48
- declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
49
- declare const isIOS: boolean | "";
50
-
51
19
  /**
52
20
  * Void function
53
21
  */
@@ -166,6 +134,50 @@ type MapOldSources<T, Immediate> = {
166
134
  type Mutable<T> = {
167
135
  -readonly [P in keyof T]: T[P];
168
136
  };
137
+ type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
138
+ /**
139
+ * will return `true` if `T` is `any`, or `false` otherwise
140
+ */
141
+ type IsAny<T> = IfAny<T, true, false>;
142
+
143
+ /**
144
+ * The source code for this function was inspired by vue-apollo's `useEventHook` util
145
+ * https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts
146
+ */
147
+
148
+ type Callback<T> = IsAny<T> extends true ? (param: any) => void : ([
149
+ T
150
+ ] extends [void] ? () => void : (param: T) => void);
151
+ type EventHookOn<T = any> = (fn: Callback<T>) => {
152
+ off: () => void;
153
+ };
154
+ type EventHookOff<T = any> = (fn: Callback<T>) => void;
155
+ type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
156
+ interface EventHook<T = any> {
157
+ on: EventHookOn<T>;
158
+ off: EventHookOff<T>;
159
+ trigger: EventHookTrigger<T>;
160
+ }
161
+ /**
162
+ * Utility for creating event hooks
163
+ *
164
+ * @see https://vueuse.org/createEventHook
165
+ */
166
+ declare function createEventHook<T = any>(): EventHook<T>;
167
+
168
+ declare const isClient: boolean;
169
+ declare const isWorker: boolean;
170
+ declare const isDef: <T = any>(val?: T | undefined) => val is T;
171
+ declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
172
+ declare const assert: (condition: boolean, ...infos: any[]) => void;
173
+ declare const isObject: (val: any) => val is object;
174
+ declare const now: () => number;
175
+ declare const timestamp: () => number;
176
+ declare const clamp: (n: number, min: number, max: number) => number;
177
+ declare const noop: () => void;
178
+ declare const rand: (min: number, max: number) => number;
179
+ declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
180
+ declare const isIOS: boolean | "";
169
181
 
170
182
  type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
171
183
  interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
@@ -275,6 +287,7 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
275
287
  */
276
288
  declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
277
289
  declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
290
+ declare function getLifeCycleTarget(target?: any): any;
278
291
 
279
292
  /**
280
293
  * Keep states in the global scope to be reusable across Vue instances.
@@ -486,7 +499,7 @@ type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T,
486
499
  /**
487
500
  * A = B
488
501
  */
489
- type Equal<A, B> = A extends B ? (B extends A ? true : false) : false;
502
+ type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
490
503
  /**
491
504
  * A ∩ B ≠ ∅
492
505
  */
@@ -626,23 +639,26 @@ declare const resolveUnref: typeof toValue;
626
639
  *
627
640
  * @param fn
628
641
  * @param sync if set to false, it will run in the nextTick() of Vue
642
+ * @param target
629
643
  */
630
- declare function tryOnBeforeMount(fn: Fn, sync?: boolean): void;
644
+ declare function tryOnBeforeMount(fn: Fn, sync?: boolean, target?: any): void;
631
645
 
632
646
  /**
633
647
  * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
634
648
  *
635
649
  * @param fn
650
+ * @param target
636
651
  */
637
- declare function tryOnBeforeUnmount(fn: Fn): void;
652
+ declare function tryOnBeforeUnmount(fn: Fn, target?: any): void;
638
653
 
639
654
  /**
640
655
  * Call onMounted() if it's inside a component lifecycle, if not, just call the function
641
656
  *
642
657
  * @param fn
643
658
  * @param sync if set to false, it will run in the nextTick() of Vue
659
+ * @param target
644
660
  */
645
- declare function tryOnMounted(fn: Fn, sync?: boolean): void;
661
+ declare function tryOnMounted(fn: Fn, sync?: boolean, target?: any): void;
646
662
 
647
663
  /**
648
664
  * Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
@@ -655,8 +671,9 @@ declare function tryOnScopeDispose(fn: Fn): boolean;
655
671
  * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
656
672
  *
657
673
  * @param fn
674
+ * @param target
658
675
  */
659
- declare function tryOnUnmounted(fn: Fn): void;
676
+ declare function tryOnUnmounted(fn: Fn, target?: any): void;
660
677
 
661
678
  interface UntilToMatchOptions {
662
679
  /**
@@ -1166,4 +1183,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
1166
1183
  */
1167
1184
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
1168
1185
 
1169
- export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1186
+ export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/index.d.ts CHANGED
@@ -16,38 +16,6 @@ interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, Comp
16
16
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
17
17
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
18
18
 
19
- type Callback<T> = T extends void ? () => void : (param: T) => void;
20
- type EventHookOn<T = any> = (fn: Callback<T>) => {
21
- off: () => void;
22
- };
23
- type EventHookOff<T = any> = (fn: Callback<T>) => void;
24
- type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
25
- interface EventHook<T = any> {
26
- on: EventHookOn<T>;
27
- off: EventHookOff<T>;
28
- trigger: EventHookTrigger<T>;
29
- }
30
- /**
31
- * Utility for creating event hooks
32
- *
33
- * @see https://vueuse.org/createEventHook
34
- */
35
- declare function createEventHook<T = any>(): EventHook<T>;
36
-
37
- declare const isClient: boolean;
38
- declare const isWorker: boolean;
39
- declare const isDef: <T = any>(val?: T | undefined) => val is T;
40
- declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
41
- declare const assert: (condition: boolean, ...infos: any[]) => void;
42
- declare const isObject: (val: any) => val is object;
43
- declare const now: () => number;
44
- declare const timestamp: () => number;
45
- declare const clamp: (n: number, min: number, max: number) => number;
46
- declare const noop: () => void;
47
- declare const rand: (min: number, max: number) => number;
48
- declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
49
- declare const isIOS: boolean | "";
50
-
51
19
  /**
52
20
  * Void function
53
21
  */
@@ -166,6 +134,50 @@ type MapOldSources<T, Immediate> = {
166
134
  type Mutable<T> = {
167
135
  -readonly [P in keyof T]: T[P];
168
136
  };
137
+ type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
138
+ /**
139
+ * will return `true` if `T` is `any`, or `false` otherwise
140
+ */
141
+ type IsAny<T> = IfAny<T, true, false>;
142
+
143
+ /**
144
+ * The source code for this function was inspired by vue-apollo's `useEventHook` util
145
+ * https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts
146
+ */
147
+
148
+ type Callback<T> = IsAny<T> extends true ? (param: any) => void : ([
149
+ T
150
+ ] extends [void] ? () => void : (param: T) => void);
151
+ type EventHookOn<T = any> = (fn: Callback<T>) => {
152
+ off: () => void;
153
+ };
154
+ type EventHookOff<T = any> = (fn: Callback<T>) => void;
155
+ type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
156
+ interface EventHook<T = any> {
157
+ on: EventHookOn<T>;
158
+ off: EventHookOff<T>;
159
+ trigger: EventHookTrigger<T>;
160
+ }
161
+ /**
162
+ * Utility for creating event hooks
163
+ *
164
+ * @see https://vueuse.org/createEventHook
165
+ */
166
+ declare function createEventHook<T = any>(): EventHook<T>;
167
+
168
+ declare const isClient: boolean;
169
+ declare const isWorker: boolean;
170
+ declare const isDef: <T = any>(val?: T | undefined) => val is T;
171
+ declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
172
+ declare const assert: (condition: boolean, ...infos: any[]) => void;
173
+ declare const isObject: (val: any) => val is object;
174
+ declare const now: () => number;
175
+ declare const timestamp: () => number;
176
+ declare const clamp: (n: number, min: number, max: number) => number;
177
+ declare const noop: () => void;
178
+ declare const rand: (min: number, max: number) => number;
179
+ declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
180
+ declare const isIOS: boolean | "";
169
181
 
170
182
  type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
171
183
  interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
@@ -275,6 +287,7 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
275
287
  */
276
288
  declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
277
289
  declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
290
+ declare function getLifeCycleTarget(target?: any): any;
278
291
 
279
292
  /**
280
293
  * Keep states in the global scope to be reusable across Vue instances.
@@ -486,7 +499,7 @@ type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T,
486
499
  /**
487
500
  * A = B
488
501
  */
489
- type Equal<A, B> = A extends B ? (B extends A ? true : false) : false;
502
+ type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
490
503
  /**
491
504
  * A ∩ B ≠ ∅
492
505
  */
@@ -626,23 +639,26 @@ declare const resolveUnref: typeof toValue;
626
639
  *
627
640
  * @param fn
628
641
  * @param sync if set to false, it will run in the nextTick() of Vue
642
+ * @param target
629
643
  */
630
- declare function tryOnBeforeMount(fn: Fn, sync?: boolean): void;
644
+ declare function tryOnBeforeMount(fn: Fn, sync?: boolean, target?: any): void;
631
645
 
632
646
  /**
633
647
  * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
634
648
  *
635
649
  * @param fn
650
+ * @param target
636
651
  */
637
- declare function tryOnBeforeUnmount(fn: Fn): void;
652
+ declare function tryOnBeforeUnmount(fn: Fn, target?: any): void;
638
653
 
639
654
  /**
640
655
  * Call onMounted() if it's inside a component lifecycle, if not, just call the function
641
656
  *
642
657
  * @param fn
643
658
  * @param sync if set to false, it will run in the nextTick() of Vue
659
+ * @param target
644
660
  */
645
- declare function tryOnMounted(fn: Fn, sync?: boolean): void;
661
+ declare function tryOnMounted(fn: Fn, sync?: boolean, target?: any): void;
646
662
 
647
663
  /**
648
664
  * Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
@@ -655,8 +671,9 @@ declare function tryOnScopeDispose(fn: Fn): boolean;
655
671
  * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
656
672
  *
657
673
  * @param fn
674
+ * @param target
658
675
  */
659
- declare function tryOnUnmounted(fn: Fn): void;
676
+ declare function tryOnUnmounted(fn: Fn, target?: any): void;
660
677
 
661
678
  interface UntilToMatchOptions {
662
679
  /**
@@ -1166,4 +1183,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
1166
1183
  */
1167
1184
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
1168
1185
 
1169
- export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1186
+ export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/index.iife.js CHANGED
@@ -184,8 +184,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
184
184
  off: offFn
185
185
  };
186
186
  };
187
- const trigger = (param) => {
188
- return Promise.all(Array.from(fns).map((fn) => param ? fn(param) : fn()));
187
+ const trigger = (...args) => {
188
+ return Promise.all(Array.from(fns).map((fn) => fn(...args)));
189
189
  };
190
190
  return {
191
191
  on,
@@ -424,8 +424,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
424
424
  const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
425
425
  const isIOS = /* @__PURE__ */ getIsIOS();
426
426
  function getIsIOS() {
427
- var _a;
428
- return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
427
+ var _a, _b;
428
+ return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
429
429
  }
430
430
 
431
431
  function createFilterWrapper(filter, fn) {
@@ -621,6 +621,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
621
621
  function objectEntries(obj) {
622
622
  return Object.entries(obj);
623
623
  }
624
+ function getLifeCycleTarget(target) {
625
+ const instance = target || vueDemi.getCurrentInstance();
626
+ return vueDemi.isVue3 ? instance : instance == null ? void 0 : instance.proxy;
627
+ }
624
628
 
625
629
  function toRef(...args) {
626
630
  if (args.length !== 1)
@@ -892,32 +896,36 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
892
896
  return result;
893
897
  }
894
898
 
895
- function tryOnBeforeMount(fn, sync = true) {
896
- if (vueDemi.getCurrentInstance())
897
- vueDemi.onBeforeMount(fn);
899
+ function tryOnBeforeMount(fn, sync = true, target) {
900
+ const instance = getLifeCycleTarget(target);
901
+ if (instance)
902
+ vueDemi.onBeforeMount(fn, instance);
898
903
  else if (sync)
899
904
  fn();
900
905
  else
901
906
  vueDemi.nextTick(fn);
902
907
  }
903
908
 
904
- function tryOnBeforeUnmount(fn) {
905
- if (vueDemi.getCurrentInstance())
906
- vueDemi.onBeforeUnmount(fn);
909
+ function tryOnBeforeUnmount(fn, target) {
910
+ const instance = getLifeCycleTarget(target);
911
+ if (instance)
912
+ vueDemi.onBeforeUnmount(fn, instance);
907
913
  }
908
914
 
909
- function tryOnMounted(fn, sync = true) {
910
- if (vueDemi.getCurrentInstance())
911
- vueDemi.onMounted(fn);
915
+ function tryOnMounted(fn, sync = true, target) {
916
+ const instance = getLifeCycleTarget(target);
917
+ if (instance)
918
+ vueDemi.onMounted(fn, instance);
912
919
  else if (sync)
913
920
  fn();
914
921
  else
915
922
  vueDemi.nextTick(fn);
916
923
  }
917
924
 
918
- function tryOnUnmounted(fn) {
919
- if (vueDemi.getCurrentInstance())
920
- vueDemi.onUnmounted(fn);
925
+ function tryOnUnmounted(fn, target) {
926
+ const instance = getLifeCycleTarget(target);
927
+ if (instance)
928
+ vueDemi.onUnmounted(fn, instance);
921
929
  }
922
930
 
923
931
  function createUntil(r, isNot = false) {
@@ -1691,6 +1699,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1691
1699
  exports.extendRef = extendRef;
1692
1700
  exports.formatDate = formatDate;
1693
1701
  exports.get = get;
1702
+ exports.getLifeCycleTarget = getLifeCycleTarget;
1694
1703
  exports.hasOwn = hasOwn;
1695
1704
  exports.hyphenate = hyphenate;
1696
1705
  exports.identity = identity;
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- var VueDemi=function(c,u,E){if(c.install)return c;if(!u)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),c;if(u.version.slice(0,4)==="2.7."){let v=function(S,b){var T,_={},W={config:u.config,use:u.use.bind(u),mixin:u.mixin.bind(u),component:u.component.bind(u),provide:function(M,I){return _[M]=I,this},directive:function(M,I){return I?(u.directive(M,I),W):u.directive(M)},mount:function(M,I){return T||(T=new u(Object.assign({propsData:b},S,{provide:Object.assign(_,S.provide)})),T.$mount(M,I),T)},unmount:function(){T&&(T.$destroy(),T=void 0)}};return W};var P=v;for(var O in u)c[O]=u[O];c.isVue2=!0,c.isVue3=!1,c.install=function(){},c.Vue=u,c.Vue2=u,c.version=u.version,c.warn=u.util.warn,c.hasInjectionContext=()=>!!c.getCurrentInstance(),c.createApp=v}else if(u.version.slice(0,2)==="2.")if(E){for(var O in E)c[O]=E[O];c.isVue2=!0,c.isVue3=!1,c.install=function(){},c.Vue=u,c.Vue2=u,c.version=u.version,c.hasInjectionContext=()=>!!c.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(u.version.slice(0,2)==="3."){for(var O in u)c[O]=u[O];c.isVue2=!1,c.isVue3=!0,c.install=function(){},c.Vue=u,c.Vue2=void 0,c.version=u.version,c.set=function(v,S,b){return Array.isArray(v)?(v.length=Math.max(v.length,S),v.splice(S,1,b),b):(v[S]=b,b)},c.del=function(v,S){if(Array.isArray(v)){v.splice(S,1);return}delete v[S]}}else console.error("[vue-demi] Vue version "+u.version+" is unsupported.");return c}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(c,u){"use strict";function E(t,e){var n;const r=u.shallowRef();return u.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),u.readonly(r)}function O(t,e){let n,r,o;const a=u.ref(!0),i=()=>{a.value=!0,o()};u.watch(t,i,{flush:"sync"});const l=typeof e=="function"?e:e.get,d=typeof e=="function"?void 0:e.set,g=u.customRef((y,h)=>(r=y,o=h,{get(){return a.value&&(n=l(),a.value=!1),r(),n},set(f){d?.(f)}}));return Object.isExtensible(g)&&(g.trigger=i),g}function P(t){return u.getCurrentScope()?(u.onScopeDispose(t),!0):!1}function v(){const t=new Set,e=o=>{t.delete(o)};return{on:o=>{t.add(o);const a=()=>e(o);return P(a),{off:a}},off:e,trigger:o=>Promise.all(Array.from(t).map(a=>o?a(o):a()))}}function S(t){let e=!1,n;const r=u.effectScope(!0);return(...o)=>(e||(n=r.run(()=>t(...o)),e=!0),n)}const b=new WeakMap,T=(t,e)=>{var n;const r=(n=u.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");b.has(r)||b.set(r,Object.create(null));const o=b.get(r);o[t]=e,u.provide(t,e)},_=(...t)=>{var e;const n=t[0],r=(e=u.getCurrentInstance())==null?void 0:e.proxy;if(r==null)throw new Error("injectLocal must be called in setup");return b.has(r)&&n in b.get(r)?b.get(r)[n]:u.inject(...t)};function W(t,e){const n=e?.injectionKey||Symbol("InjectionState");return[(...a)=>{const i=t(...a);return T(n,i),i},()=>_(n)]}function M(t){let e=0,n,r;const o=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...a)=>(e+=1,n||(r=u.effectScope(!0),n=r.run(()=>t(...a))),P(o),n)}function I(t,e,{enumerable:n=!1,unwrap:r=!0}={}){if(!u.isVue3&&!u.version.startsWith("2.7.")){if(process.env.NODE_ENV!=="production")throw new Error("[VueUse] extendRef only works in Vue 2.7 or above.");return}for(const[o,a]of Object.entries(e))o!=="value"&&(u.isRef(a)&&r?Object.defineProperty(t,o,{get(){return a.value},set(i){a.value=i},enumerable:n}):Object.defineProperty(t,o,{value:a,enumerable:n}));return t}function gt(t,e){return e==null?u.unref(t):u.unref(t)[e]}function mt(t){return u.unref(t)!=null}function wt(t,e){if(typeof Symbol<"u"){const n={...t};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function s(t){return typeof t=="function"?t():u.unref(t)}const pt=s;function H(t,e){const n=e?.computedGetter===!1?u.unref:s;return function(...r){return u.computed(()=>t.apply(this,r.map(o=>n(o))))}}function vt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:o=!0}=e;n.push(...Object.keys(t)),o&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(o=>{const a=t[o];return[o,typeof a=="function"?H(a.bind(t),r):a]}))}function x(t){if(!u.isRef(t))return u.reactive(t);const e=new Proxy({},{get(n,r,o){return u.unref(Reflect.get(t.value,r,o))},set(n,r,o){return u.isRef(t.value[r])&&!u.isRef(o)?t.value[r].value=o:t.value[r]=o,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return u.reactive(e)}function Y(t){return x(u.computed(t))}function bt(t,...e){const n=e.flat(),r=n[0];return Y(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,a])=>!r(s(a),o)):Object.entries(u.toRefs(t)).filter(o=>!n.includes(o[0]))))}const j=typeof window<"u"&&typeof document<"u",At=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Ot=t=>typeof t<"u",St=t=>t!=null,Tt=(t,...e)=>{t||console.warn(...e)},It=Object.prototype.toString,D=t=>It.call(t)==="[object Object]",Ft=()=>Date.now(),tt=()=>+Date.now(),Pt=(t,e,n)=>Math.min(n,Math.max(e,t)),C=()=>{},Mt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),Ct=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Rt=Et();function Et(){var t;return j&&((t=window?.navigator)==null?void 0:t.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function N(t,e){function n(...r){return new Promise((o,a)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(o).catch(a)})}return n}const U=t=>t();function G(t,e={}){let n,r,o=C;const a=l=>{clearTimeout(l),o(),o=C};return l=>{const d=s(t),g=s(e.maxWait);return n&&a(n),d<=0||g!==void 0&&g<=0?(r&&(a(r),r=null),Promise.resolve(l())):new Promise((y,h)=>{o=e.rejectOnCancel?h:y,g&&!r&&(r=setTimeout(()=>{n&&a(n),r=null,y(l())},g)),n=setTimeout(()=>{r&&a(r),r=null,y(l())},d)})}}function z(t,e=!0,n=!0,r=!1){let o=0,a,i=!0,l=C,d;const g=()=>{a&&(clearTimeout(a),a=void 0,l(),l=C)};return h=>{const f=s(t),m=Date.now()-o,w=()=>d=h();return g(),f<=0?(o=Date.now(),w()):(m>f&&(n||!i)?(o=Date.now(),w()):e&&(d=new Promise((A,p)=>{l=r?p:A,a=setTimeout(()=>{o=Date.now(),i=!0,A(w()),g()},Math.max(0,f-m))})),!n&&!a&&(a=setTimeout(()=>i=!0,f)),i=!1,d)}}function et(t=U){const e=u.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const o=(...a)=>{e.value&&t(...a)};return{isActive:u.readonly(e),pause:n,resume:r,eventFilter:o}}const kt={mounted:u.isVue3?"mounted":"inserted",updated:u.isVue3?"updated":"componentUpdated",unmounted:u.isVue3?"unmounted":"unbind"};function nt(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const _t=/\B([A-Z])/g,jt=nt(t=>t.replace(_t,"-$1").toLowerCase()),Nt=/-(\w)/g,Lt=nt(t=>t.replace(Nt,(e,n)=>n?n.toUpperCase():""));function q(t,e=!1,n="Timeout"){return new Promise((r,o)=>{setTimeout(e?()=>o(n):r,t)})}function Wt(t){return t}function Ut(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function Bt(t){return t()}function rt(t,...e){return e.some(n=>n in t)}function $t(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:n[0])||"",o=t.slice(r.length),a=Number.parseFloat(r)+e;return Number.isNaN(a)?t:a+o}function Ht(t,e,n=!1){return e.reduce((r,o)=>(o in t&&(!n||t[o]!==void 0)&&(r[o]=t[o]),r),{})}function Yt(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,o])=>(!n||o!==void 0)&&!e.includes(r)))}function Gt(t){return Object.entries(t)}function Z(...t){if(t.length!==1)return u.toRef(...t);const e=t[0];return typeof e=="function"?u.readonly(u.customRef(()=>({get:e,set:C}))):u.ref(e)}const zt=Z;function qt(t,...e){const n=e.flat(),r=n[0];return Y(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,a])=>r(s(a),o)):n.map(o=>[o,Z(t,o)])))}function ot(t,e=1e4){return u.customRef((n,r)=>{let o=s(t),a;const i=()=>setTimeout(()=>{o=s(t),r()},s(e));return P(()=>{clearTimeout(a)}),{get(){return n(),o},set(l){o=l,r(),clearTimeout(a),a=i()}}})}function ct(t,e=200,n={}){return N(G(e,n),t)}function J(t,e=200,n={}){const r=u.ref(t.value),o=ct(()=>{r.value=t.value},e,n);return u.watch(t,()=>o()),r}function Zt(t,e){return u.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function ut(t,e=200,n=!1,r=!0,o=!1){return N(z(e,n,r,o),t)}function X(t,e=200,n=!0,r=!0){if(e<=0)return t;const o=u.ref(t.value),a=ut(()=>{o.value=t.value},e,n,r);return u.watch(t,()=>a()),o}function at(t,e={}){let n=t,r,o;const a=u.customRef((f,m)=>(r=f,o=m,{get(){return i()},set(w){l(w)}}));function i(f=!0){return f&&r(),n}function l(f,m=!0){var w,A;if(f===n)return;const p=n;((w=e.onBeforeChange)==null?void 0:w.call(e,f,p))!==!1&&(n=f,(A=e.onChanged)==null||A.call(e,f,p),m&&o())}return I(a,{get:i,set:l,untrackedGet:()=>i(!1),silentSet:f=>l(f,!1),peek:()=>i(!1),lay:f=>l(f,!1)},{enumerable:!0})}const Jt=at;function Xt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3)if(u.isVue2)u.set(...t);else{const[e,n,r]=t;e[n]=r}}function L(t,e,n={}){const{eventFilter:r=U,...o}=n;return u.watch(t,N(r,e),o)}function B(t,e,n={}){const{eventFilter:r,...o}=n,{eventFilter:a,pause:i,resume:l,isActive:d}=et(r);return{stop:L(t,e,{...o,eventFilter:a}),pause:i,resume:l,isActive:d}}function Kt(t,e,...[n]){const{flush:r="sync",deep:o=!1,immediate:a=!0,direction:i="both",transform:l={}}=n||{},d=[],g="ltr"in l&&l.ltr||(f=>f),y="rtl"in l&&l.rtl||(f=>f);return(i==="both"||i==="ltr")&&d.push(B(t,f=>{d.forEach(m=>m.pause()),e.value=g(f),d.forEach(m=>m.resume())},{flush:r,deep:o,immediate:a})),(i==="both"||i==="rtl")&&d.push(B(e,f=>{d.forEach(m=>m.pause()),t.value=y(f),d.forEach(m=>m.resume())},{flush:r,deep:o,immediate:a})),()=>{d.forEach(f=>f.stop())}}function Qt(t,e,n={}){const{flush:r="sync",deep:o=!1,immediate:a=!0}=n;return Array.isArray(e)||(e=[e]),u.watch(t,i=>e.forEach(l=>l.value=i),{flush:r,deep:o,immediate:a})}function Vt(t,e={}){if(!u.isRef(t))return u.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=u.customRef(()=>({get(){return t.value[r]},set(o){var a;if((a=s(e.replaceRef))!=null?a:!0)if(Array.isArray(t.value)){const l=[...t.value];l[r]=o,t.value=l}else{const l={...t.value,[r]:o};Object.setPrototypeOf(l,Object.getPrototypeOf(t.value)),t.value=l}else t.value[r]=o}}));return n}function xt(t,e=!0){u.getCurrentInstance()?u.onBeforeMount(t):e?t():u.nextTick(t)}function Dt(t){u.getCurrentInstance()&&u.onBeforeUnmount(t)}function te(t,e=!0){u.getCurrentInstance()?u.onMounted(t):e?t():u.nextTick(t)}function ee(t){u.getCurrentInstance()&&u.onUnmounted(t)}function K(t,e=!1){function n(h,{flush:f="sync",deep:m=!1,timeout:w,throwOnTimeout:A}={}){let p=null;const V=[new Promise($=>{p=u.watch(t,k=>{h(k)!==e&&(p?.(),$(k))},{flush:f,deep:m,immediate:!0})})];return w!=null&&V.push(q(w,A).then(()=>s(t)).finally(()=>p?.())),Promise.race(V)}function r(h,f){if(!u.isRef(h))return n(k=>k===h,f);const{flush:m="sync",deep:w=!1,timeout:A,throwOnTimeout:p}=f??{};let F=null;const $=[new Promise(k=>{F=u.watch([t,h],([yt,$e])=>{e!==(yt===$e)&&(F?.(),k(yt))},{flush:m,deep:w,immediate:!0})})];return A!=null&&$.push(q(A,p).then(()=>s(t)).finally(()=>(F?.(),s(t)))),Promise.race($)}function o(h){return n(f=>!!f,h)}function a(h){return r(null,h)}function i(h){return r(void 0,h)}function l(h){return n(Number.isNaN,h)}function d(h,f){return n(m=>{const w=Array.from(m);return w.includes(h)||w.includes(s(h))},f)}function g(h){return y(1,h)}function y(h=1,f){let m=-1;return n(()=>(m+=1,m>=h),f)}return Array.isArray(s(t))?{toMatch:n,toContains:d,changed:g,changedTimes:y,get not(){return K(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:o,toBeNull:a,toBeNaN:l,toBeUndefined:i,changed:g,changedTimes:y,get not(){return K(t,!e)}}}function ne(t){return K(t)}function re(t,e){return t===e}function oe(...t){var e;const n=t[0],r=t[1];let o=(e=t[2])!=null?e:re;if(typeof o=="string"){const a=o;o=(i,l)=>i[a]===l[a]}return u.computed(()=>s(n).filter(a=>s(r).findIndex(i=>o(a,i))===-1))}function ce(t,e){return u.computed(()=>s(t).every((n,r,o)=>e(s(n),r,o)))}function ue(t,e){return u.computed(()=>s(t).map(n=>s(n)).filter(e))}function ae(t,e){return u.computed(()=>s(s(t).find((n,r,o)=>e(s(n),r,o))))}function ie(t,e){return u.computed(()=>s(t).findIndex((n,r,o)=>e(s(n),r,o)))}function le(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function se(t,e){return u.computed(()=>s(Array.prototype.findLast?s(t).findLast((n,r,o)=>e(s(n),r,o)):le(s(t),(n,r,o)=>e(s(n),r,o))))}function fe(t){return D(t)&&rt(t,"formIndex","comparator")}function de(...t){var e;const n=t[0],r=t[1];let o=t[2],a=0;if(fe(o)&&(a=(e=o.fromIndex)!=null?e:0,o=o.comparator),typeof o=="string"){const i=o;o=(l,d)=>l[i]===s(d)}return o=o??((i,l)=>i===s(l)),u.computed(()=>s(n).slice(a).some((i,l,d)=>o(s(i),s(r),l,s(d))))}function he(t,e){return u.computed(()=>s(t).map(n=>s(n)).join(s(e)))}function ye(t,e){return u.computed(()=>s(t).map(n=>s(n)).map(e))}function ge(t,e,...n){const r=(o,a,i)=>e(s(o),s(a),i);return u.computed(()=>{const o=s(t);return n.length?o.reduce(r,s(n[0])):o.reduce(r)})}function me(t,e){return u.computed(()=>s(t).some((n,r,o)=>e(s(n),r,o)))}function we(t){return Array.from(new Set(t))}function pe(t,e){return t.reduce((n,r)=>(n.some(o=>e(r,o,t))||n.push(r),n),[])}function ve(t,e){return u.computed(()=>{const n=s(t).map(r=>s(r));return e?pe(n,e):we(n)})}function be(t=0,e={}){let n=u.unref(t);const r=u.ref(t),{max:o=Number.POSITIVE_INFINITY,min:a=Number.NEGATIVE_INFINITY}=e,i=(h=1)=>r.value=Math.min(o,r.value+h),l=(h=1)=>r.value=Math.max(a,r.value-h),d=()=>r.value,g=h=>r.value=Math.max(a,Math.min(o,h));return{count:r,inc:i,dec:l,get:d,set:g,reset:(h=n)=>(n=h,g(h))}}const Ae=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Oe=/[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}|SSS/g;function Se(t,e,n,r){let o=t<12?"AM":"PM";return r&&(o=o.split("").reduce((a,i)=>a+=`${i}.`,"")),n?o.toLowerCase():o}function R(t){const e=["th","st","nd","rd"],n=t%100;return t+(e[(n-20)%10]||e[n]||e[0])}function it(t,e,n={}){var r;const o=t.getFullYear(),a=t.getMonth(),i=t.getDate(),l=t.getHours(),d=t.getMinutes(),g=t.getSeconds(),y=t.getMilliseconds(),h=t.getDay(),f=(r=n.customMeridiem)!=null?r:Se,m={Yo:()=>R(o),YY:()=>String(o).slice(-2),YYYY:()=>o,M:()=>a+1,Mo:()=>R(a+1),MM:()=>`${a+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(n.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(n.locales,{month:"long"}),D:()=>String(i),Do:()=>R(i),DD:()=>`${i}`.padStart(2,"0"),H:()=>String(l),Ho:()=>R(l),HH:()=>`${l}`.padStart(2,"0"),h:()=>`${l%12||12}`.padStart(1,"0"),ho:()=>R(l%12||12),hh:()=>`${l%12||12}`.padStart(2,"0"),m:()=>String(d),mo:()=>R(d),mm:()=>`${d}`.padStart(2,"0"),s:()=>String(g),so:()=>R(g),ss:()=>`${g}`.padStart(2,"0"),SSS:()=>`${y}`.padStart(3,"0"),d:()=>h,dd:()=>t.toLocaleDateString(n.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(n.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(n.locales,{weekday:"long"}),A:()=>f(l,d),AA:()=>f(l,d,!1,!0),a:()=>f(l,d,!0),aa:()=>f(l,d,!0,!0)};return e.replace(Oe,(w,A)=>{var p,F;return(F=A??((p=m[w])==null?void 0:p.call(m)))!=null?F:w})}function lt(t){if(t===null)return new Date(Number.NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(Ae);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)}function Te(t,e="HH:mm:ss",n={}){return u.computed(()=>it(lt(s(t)),s(e),n))}function st(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:o=!1}=n;let a=null;const i=u.ref(!1);function l(){a&&(clearInterval(a),a=null)}function d(){i.value=!1,l()}function g(){const y=s(e);y<=0||(i.value=!0,o&&t(),l(),a=setInterval(t,y))}if(r&&j&&g(),u.isRef(e)||typeof e=="function"){const y=u.watch(e,()=>{i.value&&j&&g()});P(y)}return P(d),{isActive:i,pause:d,resume:g}}function Ie(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:o}=e,a=u.ref(0),i=()=>a.value+=1,l=()=>{a.value=0},d=st(o?()=>{i(),o(a.value)}:i,t,{immediate:r});return n?{counter:a,reset:l,...d}:a}function Fe(t,e={}){var n;const r=u.ref((n=e.initialValue)!=null?n:null);return u.watch(t,()=>r.value=tt(),e),r}function ft(t,e,n={}){const{immediate:r=!0}=n,o=u.ref(!1);let a=null;function i(){a&&(clearTimeout(a),a=null)}function l(){o.value=!1,i()}function d(...g){i(),o.value=!0,a=setTimeout(()=>{o.value=!1,a=null,t(...g)},s(e))}return r&&(o.value=!0,j&&d()),P(l),{isPending:u.readonly(o),start:d,stop:l}}function Pe(t=1e3,e={}){const{controls:n=!1,callback:r}=e,o=ft(r??C,t,e),a=u.computed(()=>!o.isPending.value);return n?{ready:a,...o}:a}function Me(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:o}=e;return u.computed(()=>{let a=s(t);return typeof a=="string"&&(a=Number[n](a,r)),o&&Number.isNaN(a)&&(a=0),a})}function Ce(t){return u.computed(()=>`${s(t)}`)}function Re(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,o=u.isRef(t),a=u.ref(t);function i(l){if(arguments.length)return a.value=l,a.value;{const d=s(n);return a.value=a.value===d?s(r):d,a.value}}return o?i:[a,i]}function Ee(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:s(t)];return u.watch(t,(o,a,i)=>{const l=Array.from({length:r.length}),d=[];for(const y of o){let h=!1;for(let f=0;f<r.length;f++)if(!l[f]&&y===r[f]){l[f]=!0,h=!0;break}h||d.push(y)}const g=r.filter((y,h)=>!l[h]);e(o,r,d,g,i),r=[...o]},n)}function ke(t,e,n){const{count:r,...o}=n,a=u.ref(0),i=L(t,(...l)=>{a.value+=1,a.value>=s(r)&&u.nextTick(()=>i()),e(...l)},o);return{count:a,stop:i}}function dt(t,e,n={}){const{debounce:r=0,maxWait:o=void 0,...a}=n;return L(t,e,{...a,eventFilter:G(r,{maxWait:o})})}function _e(t,e,n){return u.watch(t,e,{...n,deep:!0})}function Q(t,e,n={}){const{eventFilter:r=U,...o}=n,a=N(r,e);let i,l,d;if(o.flush==="sync"){const g=u.ref(!1);l=()=>{},i=y=>{g.value=!0,y(),g.value=!1},d=u.watch(t,(...y)=>{g.value||a(...y)},o)}else{const g=[],y=u.ref(0),h=u.ref(0);l=()=>{y.value=h.value},g.push(u.watch(t,()=>{h.value++},{...o,flush:"sync"})),i=f=>{const m=h.value;f(),y.value+=h.value-m},g.push(u.watch(t,(...f)=>{const m=y.value>0&&y.value===h.value;y.value=0,h.value=0,!m&&a(...f)},o)),d=()=>{g.forEach(f=>f())}}return{stop:d,ignoreUpdates:i,ignorePrevAsyncUpdates:l}}function je(t,e,n){return u.watch(t,e,{...n,immediate:!0})}function Ne(t,e,n){const r=u.watch(t,(...o)=>(u.nextTick(()=>r()),e(...o)),n);return r}function ht(t,e,n={}){const{throttle:r=0,trailing:o=!0,leading:a=!0,...i}=n;return L(t,e,{...i,eventFilter:z(r,o,a)})}function Le(t,e,n={}){let r;function o(){if(!r)return;const y=r;r=void 0,y()}function a(y){r=y}const i=(y,h)=>(o(),e(y,h,a)),l=Q(t,i,n),{ignoreUpdates:d}=l;return{...l,trigger:()=>{let y;return d(()=>{y=i(We(t),Ue(t))}),y}}}function We(t){return u.isReactive(t)?t:Array.isArray(t)?t.map(e=>s(e)):s(t)}function Ue(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Be(t,e,n){return u.watch(t,(r,o,a)=>{r&&e(r,o,a)},n)}c.assert=Tt,c.autoResetRef=ot,c.bypassFilter=U,c.camelize=Lt,c.clamp=Pt,c.computedEager=E,c.computedWithControl=O,c.containsProp=rt,c.controlledComputed=O,c.controlledRef=Jt,c.createEventHook=v,c.createFilterWrapper=N,c.createGlobalState=S,c.createInjectionState=W,c.createReactiveFn=H,c.createSharedComposable=M,c.createSingletonPromise=Ut,c.debounceFilter=G,c.debouncedRef=J,c.debouncedWatch=dt,c.directiveHooks=kt,c.eagerComputed=E,c.extendRef=I,c.formatDate=it,c.get=gt,c.hasOwn=Ct,c.hyphenate=jt,c.identity=Wt,c.ignorableWatch=Q,c.increaseWithUnit=$t,c.injectLocal=_,c.invoke=Bt,c.isClient=j,c.isDef=Ot,c.isDefined=mt,c.isIOS=Rt,c.isObject=D,c.isWorker=At,c.makeDestructurable=wt,c.noop=C,c.normalizeDate=lt,c.notNullish=St,c.now=Ft,c.objectEntries=Gt,c.objectOmit=Yt,c.objectPick=Ht,c.pausableFilter=et,c.pausableWatch=B,c.promiseTimeout=q,c.provideLocal=T,c.rand=Mt,c.reactify=H,c.reactifyObject=vt,c.reactiveComputed=Y,c.reactiveOmit=bt,c.reactivePick=qt,c.refAutoReset=ot,c.refDebounced=J,c.refDefault=Zt,c.refThrottled=X,c.refWithControl=at,c.resolveRef=zt,c.resolveUnref=pt,c.set=Xt,c.syncRef=Kt,c.syncRefs=Qt,c.throttleFilter=z,c.throttledRef=X,c.throttledWatch=ht,c.timestamp=tt,c.toReactive=x,c.toRef=Z,c.toRefs=Vt,c.toValue=s,c.tryOnBeforeMount=xt,c.tryOnBeforeUnmount=Dt,c.tryOnMounted=te,c.tryOnScopeDispose=P,c.tryOnUnmounted=ee,c.until=ne,c.useArrayDifference=oe,c.useArrayEvery=ce,c.useArrayFilter=ue,c.useArrayFind=ae,c.useArrayFindIndex=ie,c.useArrayFindLast=se,c.useArrayIncludes=de,c.useArrayJoin=he,c.useArrayMap=ye,c.useArrayReduce=ge,c.useArraySome=me,c.useArrayUnique=ve,c.useCounter=be,c.useDateFormat=Te,c.useDebounce=J,c.useDebounceFn=ct,c.useInterval=Ie,c.useIntervalFn=st,c.useLastChanged=Fe,c.useThrottle=X,c.useThrottleFn=ut,c.useTimeout=Pe,c.useTimeoutFn=ft,c.useToNumber=Me,c.useToString=Ce,c.useToggle=Re,c.watchArray=Ee,c.watchAtMost=ke,c.watchDebounced=dt,c.watchDeep=_e,c.watchIgnorable=Q,c.watchImmediate=je,c.watchOnce=Ne,c.watchPausable=B,c.watchThrottled=ht,c.watchTriggerable=Le,c.watchWithFilter=L,c.whenever=Be})(this.VueUse=this.VueUse||{},VueDemi);
1
+ var VueDemi=function(c,u,E){if(c.install)return c;if(!u)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),c;if(u.version.slice(0,4)==="2.7."){let v=function(S,b){var T,_={},U={config:u.config,use:u.use.bind(u),mixin:u.mixin.bind(u),component:u.component.bind(u),provide:function(M,P){return _[M]=P,this},directive:function(M,P){return P?(u.directive(M,P),U):u.directive(M)},mount:function(M,P){return T||(T=new u(Object.assign({propsData:b},S,{provide:Object.assign(_,S.provide)})),T.$mount(M,P),T)},unmount:function(){T&&(T.$destroy(),T=void 0)}};return U};var I=v;for(var O in u)c[O]=u[O];c.isVue2=!0,c.isVue3=!1,c.install=function(){},c.Vue=u,c.Vue2=u,c.version=u.version,c.warn=u.util.warn,c.hasInjectionContext=()=>!!c.getCurrentInstance(),c.createApp=v}else if(u.version.slice(0,2)==="2.")if(E){for(var O in E)c[O]=E[O];c.isVue2=!0,c.isVue3=!1,c.install=function(){},c.Vue=u,c.Vue2=u,c.version=u.version,c.hasInjectionContext=()=>!!c.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(u.version.slice(0,2)==="3."){for(var O in u)c[O]=u[O];c.isVue2=!1,c.isVue3=!0,c.install=function(){},c.Vue=u,c.Vue2=void 0,c.version=u.version,c.set=function(v,S,b){return Array.isArray(v)?(v.length=Math.max(v.length,S),v.splice(S,1,b),b):(v[S]=b,b)},c.del=function(v,S){if(Array.isArray(v)){v.splice(S,1);return}delete v[S]}}else console.error("[vue-demi] Vue version "+u.version+" is unsupported.");return c}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(c,u){"use strict";function E(t,e){var n;const r=u.shallowRef();return u.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),u.readonly(r)}function O(t,e){let n,r,o;const i=u.ref(!0),a=()=>{i.value=!0,o()};u.watch(t,a,{flush:"sync"});const l=typeof e=="function"?e:e.get,d=typeof e=="function"?void 0:e.set,g=u.customRef((y,h)=>(r=y,o=h,{get(){return i.value&&(n=l(),i.value=!1),r(),n},set(f){d?.(f)}}));return Object.isExtensible(g)&&(g.trigger=a),g}function I(t){return u.getCurrentScope()?(u.onScopeDispose(t),!0):!1}function v(){const t=new Set,e=o=>{t.delete(o)};return{on:o=>{t.add(o);const i=()=>e(o);return I(i),{off:i}},off:e,trigger:(...o)=>Promise.all(Array.from(t).map(i=>i(...o)))}}function S(t){let e=!1,n;const r=u.effectScope(!0);return(...o)=>(e||(n=r.run(()=>t(...o)),e=!0),n)}const b=new WeakMap,T=(t,e)=>{var n;const r=(n=u.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");b.has(r)||b.set(r,Object.create(null));const o=b.get(r);o[t]=e,u.provide(t,e)},_=(...t)=>{var e;const n=t[0],r=(e=u.getCurrentInstance())==null?void 0:e.proxy;if(r==null)throw new Error("injectLocal must be called in setup");return b.has(r)&&n in b.get(r)?b.get(r)[n]:u.inject(...t)};function U(t,e){const n=e?.injectionKey||Symbol("InjectionState");return[(...i)=>{const a=t(...i);return T(n,a),a},()=>_(n)]}function M(t){let e=0,n,r;const o=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...i)=>(e+=1,n||(r=u.effectScope(!0),n=r.run(()=>t(...i))),I(o),n)}function P(t,e,{enumerable:n=!1,unwrap:r=!0}={}){if(!u.isVue3&&!u.version.startsWith("2.7.")){if(process.env.NODE_ENV!=="production")throw new Error("[VueUse] extendRef only works in Vue 2.7 or above.");return}for(const[o,i]of Object.entries(e))o!=="value"&&(u.isRef(i)&&r?Object.defineProperty(t,o,{get(){return i.value},set(a){i.value=a},enumerable:n}):Object.defineProperty(t,o,{value:i,enumerable:n}));return t}function wt(t,e){return e==null?u.unref(t):u.unref(t)[e]}function mt(t){return u.unref(t)!=null}function pt(t,e){if(typeof Symbol<"u"){const n={...t};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function s(t){return typeof t=="function"?t():u.unref(t)}const vt=s;function Y(t,e){const n=e?.computedGetter===!1?u.unref:s;return function(...r){return u.computed(()=>t.apply(this,r.map(o=>n(o))))}}function bt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:o=!0}=e;n.push(...Object.keys(t)),o&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(o=>{const i=t[o];return[o,typeof i=="function"?Y(i.bind(t),r):i]}))}function D(t){if(!u.isRef(t))return u.reactive(t);const e=new Proxy({},{get(n,r,o){return u.unref(Reflect.get(t.value,r,o))},set(n,r,o){return u.isRef(t.value[r])&&!u.isRef(o)?t.value[r].value=o:t.value[r]=o,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return u.reactive(e)}function G(t){return D(u.computed(t))}function At(t,...e){const n=e.flat(),r=n[0];return G(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,i])=>!r(s(i),o)):Object.entries(u.toRefs(t)).filter(o=>!n.includes(o[0]))))}const j=typeof window<"u"&&typeof document<"u",Ot=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,St=t=>typeof t<"u",Tt=t=>t!=null,Pt=(t,...e)=>{t||console.warn(...e)},Ft=Object.prototype.toString,tt=t=>Ft.call(t)==="[object Object]",It=()=>Date.now(),et=()=>+Date.now(),Mt=(t,e,n)=>Math.min(n,Math.max(e,t)),C=()=>{},Ct=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),Rt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Et=kt();function kt(){var t,e;return j&&((t=window?.navigator)==null?void 0:t.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((e=window?.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function N(t,e){function n(...r){return new Promise((o,i)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(o).catch(i)})}return n}const B=t=>t();function z(t,e={}){let n,r,o=C;const i=l=>{clearTimeout(l),o(),o=C};return l=>{const d=s(t),g=s(e.maxWait);return n&&i(n),d<=0||g!==void 0&&g<=0?(r&&(i(r),r=null),Promise.resolve(l())):new Promise((y,h)=>{o=e.rejectOnCancel?h:y,g&&!r&&(r=setTimeout(()=>{n&&i(n),r=null,y(l())},g)),n=setTimeout(()=>{r&&i(r),r=null,y(l())},d)})}}function q(t,e=!0,n=!0,r=!1){let o=0,i,a=!0,l=C,d;const g=()=>{i&&(clearTimeout(i),i=void 0,l(),l=C)};return h=>{const f=s(t),w=Date.now()-o,m=()=>d=h();return g(),f<=0?(o=Date.now(),m()):(w>f&&(n||!a)?(o=Date.now(),m()):e&&(d=new Promise((A,p)=>{l=r?p:A,i=setTimeout(()=>{o=Date.now(),a=!0,A(m()),g()},Math.max(0,f-w))})),!n&&!i&&(i=setTimeout(()=>a=!0,f)),a=!1,d)}}function nt(t=B){const e=u.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const o=(...i)=>{e.value&&t(...i)};return{isActive:u.readonly(e),pause:n,resume:r,eventFilter:o}}const _t={mounted:u.isVue3?"mounted":"inserted",updated:u.isVue3?"updated":"componentUpdated",unmounted:u.isVue3?"unmounted":"unbind"};function rt(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const jt=/\B([A-Z])/g,Nt=rt(t=>t.replace(jt,"-$1").toLowerCase()),Lt=/-(\w)/g,Wt=rt(t=>t.replace(Lt,(e,n)=>n?n.toUpperCase():""));function Z(t,e=!1,n="Timeout"){return new Promise((r,o)=>{setTimeout(e?()=>o(n):r,t)})}function Ut(t){return t}function Bt(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function $t(t){return t()}function ot(t,...e){return e.some(n=>n in t)}function Ht(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:n[0])||"",o=t.slice(r.length),i=Number.parseFloat(r)+e;return Number.isNaN(i)?t:i+o}function Yt(t,e,n=!1){return e.reduce((r,o)=>(o in t&&(!n||t[o]!==void 0)&&(r[o]=t[o]),r),{})}function Gt(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,o])=>(!n||o!==void 0)&&!e.includes(r)))}function zt(t){return Object.entries(t)}function L(t){const e=t||u.getCurrentInstance();return u.isVue3?e:e?.proxy}function J(...t){if(t.length!==1)return u.toRef(...t);const e=t[0];return typeof e=="function"?u.readonly(u.customRef(()=>({get:e,set:C}))):u.ref(e)}const qt=J;function Zt(t,...e){const n=e.flat(),r=n[0];return G(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,i])=>r(s(i),o)):n.map(o=>[o,J(t,o)])))}function ct(t,e=1e4){return u.customRef((n,r)=>{let o=s(t),i;const a=()=>setTimeout(()=>{o=s(t),r()},s(e));return I(()=>{clearTimeout(i)}),{get(){return n(),o},set(l){o=l,r(),clearTimeout(i),i=a()}}})}function ut(t,e=200,n={}){return N(z(e,n),t)}function X(t,e=200,n={}){const r=u.ref(t.value),o=ut(()=>{r.value=t.value},e,n);return u.watch(t,()=>o()),r}function Jt(t,e){return u.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function it(t,e=200,n=!1,r=!0,o=!1){return N(q(e,n,r,o),t)}function K(t,e=200,n=!0,r=!0){if(e<=0)return t;const o=u.ref(t.value),i=it(()=>{o.value=t.value},e,n,r);return u.watch(t,()=>i()),o}function at(t,e={}){let n=t,r,o;const i=u.customRef((f,w)=>(r=f,o=w,{get(){return a()},set(m){l(m)}}));function a(f=!0){return f&&r(),n}function l(f,w=!0){var m,A;if(f===n)return;const p=n;((m=e.onBeforeChange)==null?void 0:m.call(e,f,p))!==!1&&(n=f,(A=e.onChanged)==null||A.call(e,f,p),w&&o())}return P(i,{get:a,set:l,untrackedGet:()=>a(!1),silentSet:f=>l(f,!1),peek:()=>a(!1),lay:f=>l(f,!1)},{enumerable:!0})}const Xt=at;function Kt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3)if(u.isVue2)u.set(...t);else{const[e,n,r]=t;e[n]=r}}function W(t,e,n={}){const{eventFilter:r=B,...o}=n;return u.watch(t,N(r,e),o)}function $(t,e,n={}){const{eventFilter:r,...o}=n,{eventFilter:i,pause:a,resume:l,isActive:d}=nt(r);return{stop:W(t,e,{...o,eventFilter:i}),pause:a,resume:l,isActive:d}}function Qt(t,e,...[n]){const{flush:r="sync",deep:o=!1,immediate:i=!0,direction:a="both",transform:l={}}=n||{},d=[],g="ltr"in l&&l.ltr||(f=>f),y="rtl"in l&&l.rtl||(f=>f);return(a==="both"||a==="ltr")&&d.push($(t,f=>{d.forEach(w=>w.pause()),e.value=g(f),d.forEach(w=>w.resume())},{flush:r,deep:o,immediate:i})),(a==="both"||a==="rtl")&&d.push($(e,f=>{d.forEach(w=>w.pause()),t.value=y(f),d.forEach(w=>w.resume())},{flush:r,deep:o,immediate:i})),()=>{d.forEach(f=>f.stop())}}function Vt(t,e,n={}){const{flush:r="sync",deep:o=!1,immediate:i=!0}=n;return Array.isArray(e)||(e=[e]),u.watch(t,a=>e.forEach(l=>l.value=a),{flush:r,deep:o,immediate:i})}function xt(t,e={}){if(!u.isRef(t))return u.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=u.customRef(()=>({get(){return t.value[r]},set(o){var i;if((i=s(e.replaceRef))!=null?i:!0)if(Array.isArray(t.value)){const l=[...t.value];l[r]=o,t.value=l}else{const l={...t.value,[r]:o};Object.setPrototypeOf(l,Object.getPrototypeOf(t.value)),t.value=l}else t.value[r]=o}}));return n}function Dt(t,e=!0,n){const r=L(n);r?u.onBeforeMount(t,r):e?t():u.nextTick(t)}function te(t,e){const n=L(e);n&&u.onBeforeUnmount(t,n)}function ee(t,e=!0,n){const r=L(n);r?u.onMounted(t,r):e?t():u.nextTick(t)}function ne(t,e){const n=L(e);n&&u.onUnmounted(t,n)}function Q(t,e=!1){function n(h,{flush:f="sync",deep:w=!1,timeout:m,throwOnTimeout:A}={}){let p=null;const x=[new Promise(H=>{p=u.watch(t,k=>{h(k)!==e&&(p?.(),H(k))},{flush:f,deep:w,immediate:!0})})];return m!=null&&x.push(Z(m,A).then(()=>s(t)).finally(()=>p?.())),Promise.race(x)}function r(h,f){if(!u.isRef(h))return n(k=>k===h,f);const{flush:w="sync",deep:m=!1,timeout:A,throwOnTimeout:p}=f??{};let F=null;const H=[new Promise(k=>{F=u.watch([t,h],([gt,He])=>{e!==(gt===He)&&(F?.(),k(gt))},{flush:w,deep:m,immediate:!0})})];return A!=null&&H.push(Z(A,p).then(()=>s(t)).finally(()=>(F?.(),s(t)))),Promise.race(H)}function o(h){return n(f=>!!f,h)}function i(h){return r(null,h)}function a(h){return r(void 0,h)}function l(h){return n(Number.isNaN,h)}function d(h,f){return n(w=>{const m=Array.from(w);return m.includes(h)||m.includes(s(h))},f)}function g(h){return y(1,h)}function y(h=1,f){let w=-1;return n(()=>(w+=1,w>=h),f)}return Array.isArray(s(t))?{toMatch:n,toContains:d,changed:g,changedTimes:y,get not(){return Q(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:o,toBeNull:i,toBeNaN:l,toBeUndefined:a,changed:g,changedTimes:y,get not(){return Q(t,!e)}}}function re(t){return Q(t)}function oe(t,e){return t===e}function ce(...t){var e;const n=t[0],r=t[1];let o=(e=t[2])!=null?e:oe;if(typeof o=="string"){const i=o;o=(a,l)=>a[i]===l[i]}return u.computed(()=>s(n).filter(i=>s(r).findIndex(a=>o(i,a))===-1))}function ue(t,e){return u.computed(()=>s(t).every((n,r,o)=>e(s(n),r,o)))}function ie(t,e){return u.computed(()=>s(t).map(n=>s(n)).filter(e))}function ae(t,e){return u.computed(()=>s(s(t).find((n,r,o)=>e(s(n),r,o))))}function le(t,e){return u.computed(()=>s(t).findIndex((n,r,o)=>e(s(n),r,o)))}function se(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function fe(t,e){return u.computed(()=>s(Array.prototype.findLast?s(t).findLast((n,r,o)=>e(s(n),r,o)):se(s(t),(n,r,o)=>e(s(n),r,o))))}function de(t){return tt(t)&&ot(t,"formIndex","comparator")}function he(...t){var e;const n=t[0],r=t[1];let o=t[2],i=0;if(de(o)&&(i=(e=o.fromIndex)!=null?e:0,o=o.comparator),typeof o=="string"){const a=o;o=(l,d)=>l[a]===s(d)}return o=o??((a,l)=>a===s(l)),u.computed(()=>s(n).slice(i).some((a,l,d)=>o(s(a),s(r),l,s(d))))}function ye(t,e){return u.computed(()=>s(t).map(n=>s(n)).join(s(e)))}function ge(t,e){return u.computed(()=>s(t).map(n=>s(n)).map(e))}function we(t,e,...n){const r=(o,i,a)=>e(s(o),s(i),a);return u.computed(()=>{const o=s(t);return n.length?o.reduce(r,s(n[0])):o.reduce(r)})}function me(t,e){return u.computed(()=>s(t).some((n,r,o)=>e(s(n),r,o)))}function pe(t){return Array.from(new Set(t))}function ve(t,e){return t.reduce((n,r)=>(n.some(o=>e(r,o,t))||n.push(r),n),[])}function be(t,e){return u.computed(()=>{const n=s(t).map(r=>s(r));return e?ve(n,e):pe(n)})}function Ae(t=0,e={}){let n=u.unref(t);const r=u.ref(t),{max:o=Number.POSITIVE_INFINITY,min:i=Number.NEGATIVE_INFINITY}=e,a=(h=1)=>r.value=Math.min(o,r.value+h),l=(h=1)=>r.value=Math.max(i,r.value-h),d=()=>r.value,g=h=>r.value=Math.max(i,Math.min(o,h));return{count:r,inc:a,dec:l,get:d,set:g,reset:(h=n)=>(n=h,g(h))}}const Oe=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Se=/[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}|SSS/g;function Te(t,e,n,r){let o=t<12?"AM":"PM";return r&&(o=o.split("").reduce((i,a)=>i+=`${a}.`,"")),n?o.toLowerCase():o}function R(t){const e=["th","st","nd","rd"],n=t%100;return t+(e[(n-20)%10]||e[n]||e[0])}function lt(t,e,n={}){var r;const o=t.getFullYear(),i=t.getMonth(),a=t.getDate(),l=t.getHours(),d=t.getMinutes(),g=t.getSeconds(),y=t.getMilliseconds(),h=t.getDay(),f=(r=n.customMeridiem)!=null?r:Te,w={Yo:()=>R(o),YY:()=>String(o).slice(-2),YYYY:()=>o,M:()=>i+1,Mo:()=>R(i+1),MM:()=>`${i+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(n.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(n.locales,{month:"long"}),D:()=>String(a),Do:()=>R(a),DD:()=>`${a}`.padStart(2,"0"),H:()=>String(l),Ho:()=>R(l),HH:()=>`${l}`.padStart(2,"0"),h:()=>`${l%12||12}`.padStart(1,"0"),ho:()=>R(l%12||12),hh:()=>`${l%12||12}`.padStart(2,"0"),m:()=>String(d),mo:()=>R(d),mm:()=>`${d}`.padStart(2,"0"),s:()=>String(g),so:()=>R(g),ss:()=>`${g}`.padStart(2,"0"),SSS:()=>`${y}`.padStart(3,"0"),d:()=>h,dd:()=>t.toLocaleDateString(n.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(n.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(n.locales,{weekday:"long"}),A:()=>f(l,d),AA:()=>f(l,d,!1,!0),a:()=>f(l,d,!0),aa:()=>f(l,d,!0,!0)};return e.replace(Se,(m,A)=>{var p,F;return(F=A??((p=w[m])==null?void 0:p.call(w)))!=null?F:m})}function st(t){if(t===null)return new Date(Number.NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(Oe);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)}function Pe(t,e="HH:mm:ss",n={}){return u.computed(()=>lt(st(s(t)),s(e),n))}function ft(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:o=!1}=n;let i=null;const a=u.ref(!1);function l(){i&&(clearInterval(i),i=null)}function d(){a.value=!1,l()}function g(){const y=s(e);y<=0||(a.value=!0,o&&t(),l(),i=setInterval(t,y))}if(r&&j&&g(),u.isRef(e)||typeof e=="function"){const y=u.watch(e,()=>{a.value&&j&&g()});I(y)}return I(d),{isActive:a,pause:d,resume:g}}function Fe(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:o}=e,i=u.ref(0),a=()=>i.value+=1,l=()=>{i.value=0},d=ft(o?()=>{a(),o(i.value)}:a,t,{immediate:r});return n?{counter:i,reset:l,...d}:i}function Ie(t,e={}){var n;const r=u.ref((n=e.initialValue)!=null?n:null);return u.watch(t,()=>r.value=et(),e),r}function dt(t,e,n={}){const{immediate:r=!0}=n,o=u.ref(!1);let i=null;function a(){i&&(clearTimeout(i),i=null)}function l(){o.value=!1,a()}function d(...g){a(),o.value=!0,i=setTimeout(()=>{o.value=!1,i=null,t(...g)},s(e))}return r&&(o.value=!0,j&&d()),I(l),{isPending:u.readonly(o),start:d,stop:l}}function Me(t=1e3,e={}){const{controls:n=!1,callback:r}=e,o=dt(r??C,t,e),i=u.computed(()=>!o.isPending.value);return n?{ready:i,...o}:i}function Ce(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:o}=e;return u.computed(()=>{let i=s(t);return typeof i=="string"&&(i=Number[n](i,r)),o&&Number.isNaN(i)&&(i=0),i})}function Re(t){return u.computed(()=>`${s(t)}`)}function Ee(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,o=u.isRef(t),i=u.ref(t);function a(l){if(arguments.length)return i.value=l,i.value;{const d=s(n);return i.value=i.value===d?s(r):d,i.value}}return o?a:[i,a]}function ke(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:s(t)];return u.watch(t,(o,i,a)=>{const l=Array.from({length:r.length}),d=[];for(const y of o){let h=!1;for(let f=0;f<r.length;f++)if(!l[f]&&y===r[f]){l[f]=!0,h=!0;break}h||d.push(y)}const g=r.filter((y,h)=>!l[h]);e(o,r,d,g,a),r=[...o]},n)}function _e(t,e,n){const{count:r,...o}=n,i=u.ref(0),a=W(t,(...l)=>{i.value+=1,i.value>=s(r)&&u.nextTick(()=>a()),e(...l)},o);return{count:i,stop:a}}function ht(t,e,n={}){const{debounce:r=0,maxWait:o=void 0,...i}=n;return W(t,e,{...i,eventFilter:z(r,{maxWait:o})})}function je(t,e,n){return u.watch(t,e,{...n,deep:!0})}function V(t,e,n={}){const{eventFilter:r=B,...o}=n,i=N(r,e);let a,l,d;if(o.flush==="sync"){const g=u.ref(!1);l=()=>{},a=y=>{g.value=!0,y(),g.value=!1},d=u.watch(t,(...y)=>{g.value||i(...y)},o)}else{const g=[],y=u.ref(0),h=u.ref(0);l=()=>{y.value=h.value},g.push(u.watch(t,()=>{h.value++},{...o,flush:"sync"})),a=f=>{const w=h.value;f(),y.value+=h.value-w},g.push(u.watch(t,(...f)=>{const w=y.value>0&&y.value===h.value;y.value=0,h.value=0,!w&&i(...f)},o)),d=()=>{g.forEach(f=>f())}}return{stop:d,ignoreUpdates:a,ignorePrevAsyncUpdates:l}}function Ne(t,e,n){return u.watch(t,e,{...n,immediate:!0})}function Le(t,e,n){const r=u.watch(t,(...o)=>(u.nextTick(()=>r()),e(...o)),n);return r}function yt(t,e,n={}){const{throttle:r=0,trailing:o=!0,leading:i=!0,...a}=n;return W(t,e,{...a,eventFilter:q(r,o,i)})}function We(t,e,n={}){let r;function o(){if(!r)return;const y=r;r=void 0,y()}function i(y){r=y}const a=(y,h)=>(o(),e(y,h,i)),l=V(t,a,n),{ignoreUpdates:d}=l;return{...l,trigger:()=>{let y;return d(()=>{y=a(Ue(t),Be(t))}),y}}}function Ue(t){return u.isReactive(t)?t:Array.isArray(t)?t.map(e=>s(e)):s(t)}function Be(t){return Array.isArray(t)?t.map(()=>{}):void 0}function $e(t,e,n){return u.watch(t,(r,o,i)=>{r&&e(r,o,i)},n)}c.assert=Pt,c.autoResetRef=ct,c.bypassFilter=B,c.camelize=Wt,c.clamp=Mt,c.computedEager=E,c.computedWithControl=O,c.containsProp=ot,c.controlledComputed=O,c.controlledRef=Xt,c.createEventHook=v,c.createFilterWrapper=N,c.createGlobalState=S,c.createInjectionState=U,c.createReactiveFn=Y,c.createSharedComposable=M,c.createSingletonPromise=Bt,c.debounceFilter=z,c.debouncedRef=X,c.debouncedWatch=ht,c.directiveHooks=_t,c.eagerComputed=E,c.extendRef=P,c.formatDate=lt,c.get=wt,c.getLifeCycleTarget=L,c.hasOwn=Rt,c.hyphenate=Nt,c.identity=Ut,c.ignorableWatch=V,c.increaseWithUnit=Ht,c.injectLocal=_,c.invoke=$t,c.isClient=j,c.isDef=St,c.isDefined=mt,c.isIOS=Et,c.isObject=tt,c.isWorker=Ot,c.makeDestructurable=pt,c.noop=C,c.normalizeDate=st,c.notNullish=Tt,c.now=It,c.objectEntries=zt,c.objectOmit=Gt,c.objectPick=Yt,c.pausableFilter=nt,c.pausableWatch=$,c.promiseTimeout=Z,c.provideLocal=T,c.rand=Ct,c.reactify=Y,c.reactifyObject=bt,c.reactiveComputed=G,c.reactiveOmit=At,c.reactivePick=Zt,c.refAutoReset=ct,c.refDebounced=X,c.refDefault=Jt,c.refThrottled=K,c.refWithControl=at,c.resolveRef=qt,c.resolveUnref=vt,c.set=Kt,c.syncRef=Qt,c.syncRefs=Vt,c.throttleFilter=q,c.throttledRef=K,c.throttledWatch=yt,c.timestamp=et,c.toReactive=D,c.toRef=J,c.toRefs=xt,c.toValue=s,c.tryOnBeforeMount=Dt,c.tryOnBeforeUnmount=te,c.tryOnMounted=ee,c.tryOnScopeDispose=I,c.tryOnUnmounted=ne,c.until=re,c.useArrayDifference=ce,c.useArrayEvery=ue,c.useArrayFilter=ie,c.useArrayFind=ae,c.useArrayFindIndex=le,c.useArrayFindLast=fe,c.useArrayIncludes=he,c.useArrayJoin=ye,c.useArrayMap=ge,c.useArrayReduce=we,c.useArraySome=me,c.useArrayUnique=be,c.useCounter=Ae,c.useDateFormat=Pe,c.useDebounce=X,c.useDebounceFn=ut,c.useInterval=Fe,c.useIntervalFn=ft,c.useLastChanged=Ie,c.useThrottle=K,c.useThrottleFn=it,c.useTimeout=Me,c.useTimeoutFn=dt,c.useToNumber=Ce,c.useToString=Re,c.useToggle=Ee,c.watchArray=ke,c.watchAtMost=_e,c.watchDebounced=ht,c.watchDeep=je,c.watchIgnorable=V,c.watchImmediate=Ne,c.watchOnce=Le,c.watchPausable=$,c.watchThrottled=yt,c.watchTriggerable=We,c.watchWithFilter=W,c.whenever=$e})(this.VueUse=this.VueUse||{},VueDemi);
package/index.mjs CHANGED
@@ -67,8 +67,8 @@ function createEventHook() {
67
67
  off: offFn
68
68
  };
69
69
  };
70
- const trigger = (param) => {
71
- return Promise.all(Array.from(fns).map((fn) => param ? fn(param) : fn()));
70
+ const trigger = (...args) => {
71
+ return Promise.all(Array.from(fns).map((fn) => fn(...args)));
72
72
  };
73
73
  return {
74
74
  on,
@@ -307,8 +307,8 @@ const rand = (min, max) => {
307
307
  const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
308
308
  const isIOS = /* @__PURE__ */ getIsIOS();
309
309
  function getIsIOS() {
310
- var _a;
311
- return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
310
+ var _a, _b;
311
+ return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
312
312
  }
313
313
 
314
314
  function createFilterWrapper(filter, fn) {
@@ -504,6 +504,10 @@ function objectOmit(obj, keys, omitUndefined = false) {
504
504
  function objectEntries(obj) {
505
505
  return Object.entries(obj);
506
506
  }
507
+ function getLifeCycleTarget(target) {
508
+ const instance = target || getCurrentInstance();
509
+ return isVue3 ? instance : instance == null ? void 0 : instance.proxy;
510
+ }
507
511
 
508
512
  function toRef(...args) {
509
513
  if (args.length !== 1)
@@ -775,32 +779,36 @@ function toRefs(objectRef, options = {}) {
775
779
  return result;
776
780
  }
777
781
 
778
- function tryOnBeforeMount(fn, sync = true) {
779
- if (getCurrentInstance())
780
- onBeforeMount(fn);
782
+ function tryOnBeforeMount(fn, sync = true, target) {
783
+ const instance = getLifeCycleTarget(target);
784
+ if (instance)
785
+ onBeforeMount(fn, instance);
781
786
  else if (sync)
782
787
  fn();
783
788
  else
784
789
  nextTick(fn);
785
790
  }
786
791
 
787
- function tryOnBeforeUnmount(fn) {
788
- if (getCurrentInstance())
789
- onBeforeUnmount(fn);
792
+ function tryOnBeforeUnmount(fn, target) {
793
+ const instance = getLifeCycleTarget(target);
794
+ if (instance)
795
+ onBeforeUnmount(fn, instance);
790
796
  }
791
797
 
792
- function tryOnMounted(fn, sync = true) {
793
- if (getCurrentInstance())
794
- onMounted(fn);
798
+ function tryOnMounted(fn, sync = true, target) {
799
+ const instance = getLifeCycleTarget(target);
800
+ if (instance)
801
+ onMounted(fn, instance);
795
802
  else if (sync)
796
803
  fn();
797
804
  else
798
805
  nextTick(fn);
799
806
  }
800
807
 
801
- function tryOnUnmounted(fn) {
802
- if (getCurrentInstance())
803
- onUnmounted(fn);
808
+ function tryOnUnmounted(fn, target) {
809
+ const instance = getLifeCycleTarget(target);
810
+ if (instance)
811
+ onUnmounted(fn, instance);
804
812
  }
805
813
 
806
814
  function createUntil(r, isNot = false) {
@@ -1549,4 +1557,4 @@ function whenever(source, cb, options) {
1549
1557
  );
1550
1558
  }
1551
1559
 
1552
- export { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1560
+ export { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/shared",
3
- "version": "10.6.0",
3
+ "version": "10.7.0",
4
4
  "author": "Anthony Fu <https://github.com/antfu>",
5
5
  "license": "MIT",
6
6
  "funding": "https://github.com/sponsors/antfu",