@vueuse/shared 13.0.0-beta.2 → 13.1.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.d.mts +144 -69
- package/index.iife.js +67 -66
- package/index.iife.min.js +1 -1
- package/index.mjs +68 -67
- package/package.json +5 -4
package/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { WatchOptionsBase, ShallowRef, WatchSource, ComputedGetter, ComputedRef, WritableComputedOptions, WritableComputedRef, WatchOptions, Ref, MaybeRef, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject,
|
|
2
|
+
import { WatchOptionsBase, ShallowRef, WatchSource, ComputedGetter, ComputedRef, WritableComputedOptions, WritableComputedRef, WatchOptions, Ref, MaybeRef, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
3
|
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
|
|
5
|
+
type ComputedEagerOptions = WatchOptionsBase;
|
|
6
|
+
type ComputedEagerReturn<T = any> = Readonly<ShallowRef<T>>;
|
|
5
7
|
/**
|
|
6
8
|
* Note: If you are using Vue 3.4+, you can straight use computed instead.
|
|
7
9
|
* Because in Vue 3.4+, if computed new value does not change,
|
|
@@ -12,7 +14,7 @@ export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
|
12
14
|
* @param options WatchOptionsBase
|
|
13
15
|
* @returns readonly shallowRef
|
|
14
16
|
*/
|
|
15
|
-
declare function computedEager<T>(fn: () => T, options?:
|
|
17
|
+
declare function computedEager<T>(fn: () => T, options?: ComputedEagerOptions): ComputedEagerReturn<T>;
|
|
16
18
|
|
|
17
19
|
interface ComputedWithControlRefExtra {
|
|
18
20
|
/**
|
|
@@ -24,6 +26,7 @@ interface ComputedRefWithControl<T> extends ComputedRef<T>, ComputedWithControlR
|
|
|
24
26
|
}
|
|
25
27
|
interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, ComputedWithControlRefExtra {
|
|
26
28
|
}
|
|
29
|
+
type ComputedWithControlRef<T = any> = ComputedRefWithControl<T> | WritableComputedRefWithControl<T>;
|
|
27
30
|
declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
|
|
28
31
|
declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
|
|
29
32
|
|
|
@@ -78,7 +81,7 @@ interface Pausable {
|
|
|
78
81
|
/**
|
|
79
82
|
* A ref indicate whether a pausable instance is active
|
|
80
83
|
*/
|
|
81
|
-
isActive: Readonly<ShallowRef<boolean>>;
|
|
84
|
+
readonly isActive: Readonly<ShallowRef<boolean>>;
|
|
82
85
|
/**
|
|
83
86
|
* Temporary pause the effect from executing
|
|
84
87
|
*/
|
|
@@ -92,7 +95,7 @@ interface Stoppable<StartFnArgs extends any[] = any[]> {
|
|
|
92
95
|
/**
|
|
93
96
|
* A ref indicate whether a stoppable instance is executing
|
|
94
97
|
*/
|
|
95
|
-
isPending: Readonly<Ref<boolean>>;
|
|
98
|
+
readonly isPending: Readonly<Ref<boolean>>;
|
|
96
99
|
/**
|
|
97
100
|
* Stop the effect from executing
|
|
98
101
|
*/
|
|
@@ -154,12 +157,13 @@ interface EventHook<T = any> {
|
|
|
154
157
|
trigger: EventHookTrigger<T>;
|
|
155
158
|
clear: () => void;
|
|
156
159
|
}
|
|
160
|
+
type EventHookReturn<T> = EventHook<T>;
|
|
157
161
|
/**
|
|
158
162
|
* Utility for creating event hooks
|
|
159
163
|
*
|
|
160
164
|
* @see https://vueuse.org/createEventHook
|
|
161
165
|
*/
|
|
162
|
-
declare function createEventHook<T = any>():
|
|
166
|
+
declare function createEventHook<T = any>(): EventHookReturn<T>;
|
|
163
167
|
|
|
164
168
|
type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
165
169
|
interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
@@ -244,23 +248,6 @@ declare function pausableFilter(extendFilter?: EventFilter, options?: PausableFi
|
|
|
244
248
|
eventFilter: EventFilter;
|
|
245
249
|
};
|
|
246
250
|
|
|
247
|
-
declare const isClient: boolean;
|
|
248
|
-
declare const isWorker: boolean;
|
|
249
|
-
declare const isDef: <T = any>(val?: T) => val is T;
|
|
250
|
-
declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
|
|
251
|
-
declare const assert: (condition: boolean, ...infos: any[]) => void;
|
|
252
|
-
declare const isObject: (val: any) => val is object;
|
|
253
|
-
declare const now: () => number;
|
|
254
|
-
declare const timestamp: () => number;
|
|
255
|
-
declare const clamp: (n: number, min: number, max: number) => number;
|
|
256
|
-
declare const noop: () => void;
|
|
257
|
-
declare const rand: (min: number, max: number) => number;
|
|
258
|
-
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
259
|
-
declare const isIOS: boolean | "";
|
|
260
|
-
|
|
261
|
-
declare const hyphenate: (str: string) => string;
|
|
262
|
-
declare const camelize: (str: string) => string;
|
|
263
|
-
|
|
264
251
|
declare function promiseTimeout(ms: number, throwOnTimeout?: boolean, reason?: string): Promise<void>;
|
|
265
252
|
declare function identity<T>(arg: T): T;
|
|
266
253
|
interface SingletonPromiseReturn<T> {
|
|
@@ -308,17 +295,36 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
308
295
|
*/
|
|
309
296
|
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
310
297
|
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
311
|
-
declare function getLifeCycleTarget(target?: any): any;
|
|
312
298
|
declare function toArray<T>(value: T | readonly T[]): readonly T[];
|
|
313
299
|
declare function toArray<T>(value: T | T[]): T[];
|
|
314
300
|
|
|
301
|
+
declare const isClient: boolean;
|
|
302
|
+
declare const isWorker: boolean;
|
|
303
|
+
declare const isDef: <T = any>(val?: T) => val is T;
|
|
304
|
+
declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
|
|
305
|
+
declare const assert: (condition: boolean, ...infos: any[]) => void;
|
|
306
|
+
declare const isObject: (val: any) => val is object;
|
|
307
|
+
declare const now: () => number;
|
|
308
|
+
declare const timestamp: () => number;
|
|
309
|
+
declare const clamp: (n: number, min: number, max: number) => number;
|
|
310
|
+
declare const noop: () => void;
|
|
311
|
+
declare const rand: (min: number, max: number) => number;
|
|
312
|
+
declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
|
|
313
|
+
declare const isIOS: boolean | "";
|
|
314
|
+
|
|
315
|
+
declare const hyphenate: (str: string) => string;
|
|
316
|
+
declare const camelize: (str: string) => string;
|
|
317
|
+
|
|
318
|
+
declare function getLifeCycleTarget(target?: any): any;
|
|
319
|
+
|
|
320
|
+
type CreateGlobalStateReturn<Fn extends AnyFn = AnyFn> = Fn;
|
|
315
321
|
/**
|
|
316
322
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
317
323
|
*
|
|
318
324
|
* @see https://vueuse.org/createGlobalState
|
|
319
325
|
* @param stateFactory A factory function to create the state
|
|
320
326
|
*/
|
|
321
|
-
declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): Fn
|
|
327
|
+
declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): CreateGlobalStateReturn<Fn>;
|
|
322
328
|
|
|
323
329
|
interface CreateInjectionStateOptions<Return> {
|
|
324
330
|
/**
|
|
@@ -338,6 +344,7 @@ interface CreateInjectionStateOptions<Return> {
|
|
|
338
344
|
*/
|
|
339
345
|
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
340
346
|
|
|
347
|
+
type CreateRefReturn<T = any, D extends boolean = false> = ShallowOrDeepRef<T, D>;
|
|
341
348
|
type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref<T> : ShallowRef<T>;
|
|
342
349
|
/**
|
|
343
350
|
* Returns a `deepRef` or `shallowRef` depending on the `deep` param.
|
|
@@ -352,15 +359,17 @@ type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref
|
|
|
352
359
|
* @param deep
|
|
353
360
|
* @returns the `deepRef` or `shallowRef`
|
|
354
361
|
*/
|
|
355
|
-
declare function createRef<T = any, D extends boolean = false>(value: T, deep?: D):
|
|
362
|
+
declare function createRef<T = any, D extends boolean = false>(value: T, deep?: D): CreateRefReturn<T, D>;
|
|
356
363
|
|
|
364
|
+
type SharedComposableReturn<T extends AnyFn = AnyFn> = T;
|
|
357
365
|
/**
|
|
358
366
|
* Make a composable function usable with multiple Vue instances.
|
|
359
367
|
*
|
|
360
368
|
* @see https://vueuse.org/createSharedComposable
|
|
361
369
|
*/
|
|
362
|
-
declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): Fn
|
|
370
|
+
declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): SharedComposableReturn<Fn>;
|
|
363
371
|
|
|
372
|
+
type ExtendRefReturn<T = any> = Ref<T>;
|
|
364
373
|
interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
365
374
|
/**
|
|
366
375
|
* Is the extends properties enumerable
|
|
@@ -401,12 +410,14 @@ declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
|
|
|
401
410
|
*/
|
|
402
411
|
declare const injectLocal: typeof inject;
|
|
403
412
|
|
|
413
|
+
type IsDefinedReturn = boolean;
|
|
404
414
|
declare function isDefined<T>(v: ComputedRef<T>): v is ComputedRef<Exclude<T, null | undefined>>;
|
|
405
415
|
declare function isDefined<T>(v: Ref<T>): v is Ref<Exclude<T, null | undefined>>;
|
|
406
416
|
declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>;
|
|
407
417
|
|
|
408
418
|
declare function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: A): T & A;
|
|
409
419
|
|
|
420
|
+
type ProvideLocalReturn = void;
|
|
410
421
|
/**
|
|
411
422
|
* On the basis of `provide`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
412
423
|
*
|
|
@@ -416,11 +427,12 @@ declare function makeDestructurable<T extends Record<string, unknown>, A extends
|
|
|
416
427
|
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
417
428
|
* ```
|
|
418
429
|
*/
|
|
419
|
-
declare
|
|
430
|
+
declare function provideLocal<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): ProvideLocalReturn;
|
|
420
431
|
|
|
421
432
|
type Reactified<T, Computed extends boolean> = T extends (...args: infer A) => infer R ? (...args: {
|
|
422
433
|
[K in keyof A]: Computed extends true ? MaybeRefOrGetter<A[K]> : MaybeRef<A[K]>;
|
|
423
434
|
}) => ComputedRef<R> : never;
|
|
435
|
+
type ReactifyReturn<T extends AnyFn = AnyFn, K extends boolean = true> = Reactified<T, K>;
|
|
424
436
|
interface ReactifyOptions<T extends boolean> {
|
|
425
437
|
/**
|
|
426
438
|
* Accept passing a function as a reactive getter
|
|
@@ -435,12 +447,14 @@ interface ReactifyOptions<T extends boolean> {
|
|
|
435
447
|
* and returns a ComputedRef, with proper typing.
|
|
436
448
|
*
|
|
437
449
|
* @param fn - Source function
|
|
450
|
+
* @param options - Options
|
|
438
451
|
*/
|
|
439
|
-
declare function reactify<T extends
|
|
452
|
+
declare function reactify<T extends AnyFn, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): ReactifyReturn<T, K>;
|
|
440
453
|
|
|
441
454
|
type ReactifyNested<T, Keys extends keyof T = keyof T, S extends boolean = true> = {
|
|
442
455
|
[K in Keys]: T[K] extends AnyFn ? Reactified<T[K], S> : T[K];
|
|
443
456
|
};
|
|
457
|
+
type ReactifyObjectReturn<T, Keys extends keyof T, S extends boolean = true> = ReactifyNested<T, Keys, S>;
|
|
444
458
|
interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
445
459
|
/**
|
|
446
460
|
* Includes names from Object.getOwnPropertyNames
|
|
@@ -452,26 +466,30 @@ interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
|
|
|
452
466
|
/**
|
|
453
467
|
* Apply `reactify` to an object
|
|
454
468
|
*/
|
|
455
|
-
declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]):
|
|
456
|
-
declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>):
|
|
469
|
+
declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyObjectReturn<T, Keys, true>;
|
|
470
|
+
declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyObjectReturn<T, keyof T, S>;
|
|
457
471
|
|
|
472
|
+
type ReactiveComputedReturn<T extends object> = UnwrapNestedRefs<T>;
|
|
458
473
|
/**
|
|
459
474
|
* Computed reactive object.
|
|
460
475
|
*/
|
|
461
|
-
declare function reactiveComputed<T extends object>(fn: ComputedGetter<T>):
|
|
476
|
+
declare function reactiveComputed<T extends object>(fn: ComputedGetter<T>): ReactiveComputedReturn<T>;
|
|
462
477
|
|
|
478
|
+
type ReactiveOmitReturn<T extends object, K extends keyof T | undefined = undefined> = [
|
|
479
|
+
K
|
|
480
|
+
] extends [undefined] ? Partial<T> : Omit<T, Extract<K, keyof T>>;
|
|
463
481
|
type ReactiveOmitPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
464
|
-
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]):
|
|
465
|
-
declare function reactiveOmit<T extends object>(obj: T, predicate: ReactiveOmitPredicate<T>):
|
|
482
|
+
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactiveOmitReturn<T, K>;
|
|
483
|
+
declare function reactiveOmit<T extends object>(obj: T, predicate: ReactiveOmitPredicate<T>): ReactiveOmitReturn<T>;
|
|
466
484
|
|
|
467
|
-
type
|
|
468
|
-
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): {
|
|
485
|
+
type ReactivePickReturn<T extends object, K extends keyof T> = {
|
|
469
486
|
[S in K]: UnwrapRef<T[S]>;
|
|
470
487
|
};
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
488
|
+
type ReactivePickPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
489
|
+
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): ReactivePickReturn<T, K>;
|
|
490
|
+
declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickPredicate<T>): ReactivePickReturn<T, keyof T>;
|
|
474
491
|
|
|
492
|
+
type RefAutoResetReturn<T = any> = Ref<T>;
|
|
475
493
|
/**
|
|
476
494
|
* Create a ref which will be reset to the default value after some time.
|
|
477
495
|
*
|
|
@@ -479,30 +497,32 @@ declare function reactivePick<T extends object>(obj: T, predicate: ReactivePickP
|
|
|
479
497
|
* @param defaultValue The value which will be set.
|
|
480
498
|
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
481
499
|
*/
|
|
482
|
-
declare function refAutoReset<T>(defaultValue: MaybeRefOrGetter<T>, afterMs?: MaybeRefOrGetter<number>):
|
|
500
|
+
declare function refAutoReset<T>(defaultValue: MaybeRefOrGetter<T>, afterMs?: MaybeRefOrGetter<number>): RefAutoResetReturn<T>;
|
|
483
501
|
|
|
502
|
+
type RefDebouncedReturn<T = any> = Readonly<Ref<T>>;
|
|
484
503
|
/**
|
|
485
504
|
* Debounce updates of a ref.
|
|
486
505
|
*
|
|
487
506
|
* @return A new debounced ref.
|
|
488
507
|
*/
|
|
489
|
-
declare function refDebounced<T>(value: Ref<T>, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions):
|
|
508
|
+
declare function refDebounced<T>(value: Ref<T>, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): RefDebouncedReturn<T>;
|
|
490
509
|
|
|
491
510
|
/**
|
|
492
511
|
* Apply default value to a ref.
|
|
493
512
|
*/
|
|
494
513
|
declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue: T): Ref<T>;
|
|
495
514
|
|
|
515
|
+
type RefThrottledReturn<T = any> = Ref<T>;
|
|
496
516
|
/**
|
|
497
517
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
498
518
|
* execution of handlers on events like resize and scroll.
|
|
499
519
|
*
|
|
500
520
|
* @param value Ref value to be watched with throttle effect
|
|
501
521
|
* @param delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
502
|
-
* @param
|
|
503
|
-
* @param
|
|
522
|
+
* @param trailing if true, update the value again after the delay time is up
|
|
523
|
+
* @param leading if true, update the value on the leading edge of the ms timeout
|
|
504
524
|
*/
|
|
505
|
-
declare function refThrottled<T>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean):
|
|
525
|
+
declare function refThrottled<T = any>(value: Ref<T>, delay?: number, trailing?: boolean, leading?: boolean): RefThrottledReturn<T>;
|
|
506
526
|
|
|
507
527
|
interface ControlledRefOptions<T> {
|
|
508
528
|
/**
|
|
@@ -665,6 +685,7 @@ interface ToRefsOptions {
|
|
|
665
685
|
*
|
|
666
686
|
* @see https://vueuse.org/toRefs
|
|
667
687
|
* @param objectRef A ref or normal object or array.
|
|
688
|
+
* @param options Options
|
|
668
689
|
*/
|
|
669
690
|
declare function toRefs<T extends object>(objectRef: MaybeRef<T>, options?: ToRefsOptions): ToRefs<T>;
|
|
670
691
|
|
|
@@ -790,9 +811,11 @@ interface UseArrayDifferenceOptions {
|
|
|
790
811
|
*/
|
|
791
812
|
symmetric?: boolean;
|
|
792
813
|
}
|
|
793
|
-
|
|
794
|
-
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>,
|
|
814
|
+
type UseArrayDifferenceReturn<T = any> = ComputedRef<T[]>;
|
|
815
|
+
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, key?: keyof T, options?: UseArrayDifferenceOptions): UseArrayDifferenceReturn<T>;
|
|
816
|
+
declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: MaybeRefOrGetter<T[]>, compareFn?: (value: T, othVal: T) => boolean, options?: UseArrayDifferenceOptions): UseArrayDifferenceReturn<T>;
|
|
795
817
|
|
|
818
|
+
type UseArrayEveryReturn = ComputedRef<boolean>;
|
|
796
819
|
/**
|
|
797
820
|
* Reactive `Array.every`
|
|
798
821
|
*
|
|
@@ -802,8 +825,9 @@ declare function useArrayDifference<T>(list: MaybeRefOrGetter<T[]>, values: Mayb
|
|
|
802
825
|
*
|
|
803
826
|
* @returns **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
|
|
804
827
|
*/
|
|
805
|
-
declare function useArrayEvery<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown):
|
|
828
|
+
declare function useArrayEvery<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArrayEveryReturn;
|
|
806
829
|
|
|
830
|
+
type UseArrayFilterReturn<T = any> = ComputedRef<T[]>;
|
|
807
831
|
/**
|
|
808
832
|
* Reactive `Array.filter`
|
|
809
833
|
*
|
|
@@ -813,9 +837,10 @@ declare function useArrayEvery<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
|
|
|
813
837
|
*
|
|
814
838
|
* @returns a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
|
|
815
839
|
*/
|
|
816
|
-
declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S):
|
|
817
|
-
declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown):
|
|
840
|
+
declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): UseArrayFilterReturn<S>;
|
|
841
|
+
declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown): UseArrayFilterReturn<T>;
|
|
818
842
|
|
|
843
|
+
type UseArrayFindReturn<T = any> = ComputedRef<T | undefined>;
|
|
819
844
|
/**
|
|
820
845
|
* Reactive `Array.find`
|
|
821
846
|
*
|
|
@@ -825,8 +850,9 @@ declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>
|
|
|
825
850
|
*
|
|
826
851
|
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
827
852
|
*/
|
|
828
|
-
declare function useArrayFind<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean):
|
|
853
|
+
declare function useArrayFind<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindReturn;
|
|
829
854
|
|
|
855
|
+
type UseArrayFindIndexReturn = ComputedRef<number>;
|
|
830
856
|
/**
|
|
831
857
|
* Reactive `Array.findIndex`
|
|
832
858
|
*
|
|
@@ -836,8 +862,9 @@ declare function useArrayFind<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
|
|
|
836
862
|
*
|
|
837
863
|
* @returns the index of the first element in the array that passes the test. Otherwise, "-1".
|
|
838
864
|
*/
|
|
839
|
-
declare function useArrayFindIndex<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown):
|
|
865
|
+
declare function useArrayFindIndex<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArrayFindIndexReturn;
|
|
840
866
|
|
|
867
|
+
type UseArrayFindLastReturn<T = any> = ComputedRef<T | undefined>;
|
|
841
868
|
/**
|
|
842
869
|
* Reactive `Array.findLast`
|
|
843
870
|
*
|
|
@@ -847,13 +874,14 @@ declare function useArrayFindIndex<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>
|
|
|
847
874
|
*
|
|
848
875
|
* @returns the last element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
849
876
|
*/
|
|
850
|
-
declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean):
|
|
877
|
+
declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindLastReturn<T>;
|
|
851
878
|
|
|
852
879
|
type UseArrayIncludesComparatorFn<T, V> = ((element: T, value: V, index: number, array: MaybeRefOrGetter<T>[]) => boolean);
|
|
853
880
|
interface UseArrayIncludesOptions<T, V> {
|
|
854
881
|
fromIndex?: number;
|
|
855
882
|
comparator?: UseArrayIncludesComparatorFn<T, V> | keyof T;
|
|
856
883
|
}
|
|
884
|
+
type UseArrayIncludesReturn = ComputedRef<boolean>;
|
|
857
885
|
/**
|
|
858
886
|
* Reactive `Array.includes`
|
|
859
887
|
*
|
|
@@ -861,10 +889,11 @@ interface UseArrayIncludesOptions<T, V> {
|
|
|
861
889
|
*
|
|
862
890
|
* @returns true if the `value` is found in the array. Otherwise, false.
|
|
863
891
|
*/
|
|
864
|
-
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>):
|
|
865
|
-
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T):
|
|
866
|
-
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, options?: UseArrayIncludesOptions<T, V>):
|
|
892
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>): UseArrayIncludesReturn;
|
|
893
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T): UseArrayIncludesReturn;
|
|
894
|
+
declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, options?: UseArrayIncludesOptions<T, V>): UseArrayIncludesReturn;
|
|
867
895
|
|
|
896
|
+
type UseArrayJoinReturn = ComputedRef<string>;
|
|
868
897
|
/**
|
|
869
898
|
* Reactive `Array.join`
|
|
870
899
|
*
|
|
@@ -874,8 +903,9 @@ declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrG
|
|
|
874
903
|
*
|
|
875
904
|
* @returns a string with all array elements joined. If arr.length is 0, the empty string is returned.
|
|
876
905
|
*/
|
|
877
|
-
declare function useArrayJoin(list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>, separator?: MaybeRefOrGetter<string>):
|
|
906
|
+
declare function useArrayJoin(list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>, separator?: MaybeRefOrGetter<string>): UseArrayJoinReturn;
|
|
878
907
|
|
|
908
|
+
type UseArrayMapReturn<T = any> = ComputedRef<T[]>;
|
|
879
909
|
/**
|
|
880
910
|
* Reactive `Array.map`
|
|
881
911
|
*
|
|
@@ -885,7 +915,7 @@ declare function useArrayJoin(list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>, s
|
|
|
885
915
|
*
|
|
886
916
|
* @returns a new array with each element being the result of the callback function.
|
|
887
917
|
*/
|
|
888
|
-
declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U):
|
|
918
|
+
declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U): UseArrayMapReturn<U>;
|
|
889
919
|
|
|
890
920
|
type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
891
921
|
/**
|
|
@@ -910,6 +940,7 @@ declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>
|
|
|
910
940
|
*/
|
|
911
941
|
declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeRefOrGetter<U>): ComputedRef<U>;
|
|
912
942
|
|
|
943
|
+
type UseArraySomeReturn = ComputedRef<boolean>;
|
|
913
944
|
/**
|
|
914
945
|
* Reactive `Array.some`
|
|
915
946
|
*
|
|
@@ -919,8 +950,9 @@ declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>
|
|
|
919
950
|
*
|
|
920
951
|
* @returns **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
|
|
921
952
|
*/
|
|
922
|
-
declare function useArraySome<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown):
|
|
953
|
+
declare function useArraySome<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArraySomeReturn;
|
|
923
954
|
|
|
955
|
+
type UseArrayUniqueReturn<T = any> = ComputedRef<T[]>;
|
|
924
956
|
/**
|
|
925
957
|
* reactive unique array
|
|
926
958
|
* @see https://vueuse.org/useArrayUnique
|
|
@@ -928,12 +960,44 @@ declare function useArraySome<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
|
|
|
928
960
|
* @param compareFn
|
|
929
961
|
* @returns A computed ref that returns a unique array of items.
|
|
930
962
|
*/
|
|
931
|
-
declare function useArrayUnique<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, compareFn?: (a: T, b: T, array: T[]) => boolean):
|
|
963
|
+
declare function useArrayUnique<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, compareFn?: (a: T, b: T, array: T[]) => boolean): UseArrayUniqueReturn<T>;
|
|
932
964
|
|
|
933
965
|
interface UseCounterOptions {
|
|
934
966
|
min?: number;
|
|
935
967
|
max?: number;
|
|
936
968
|
}
|
|
969
|
+
interface UseCounterReturn {
|
|
970
|
+
/**
|
|
971
|
+
* The current value of the counter.
|
|
972
|
+
*/
|
|
973
|
+
readonly count: Readonly<Ref<number>>;
|
|
974
|
+
/**
|
|
975
|
+
* Increment the counter.
|
|
976
|
+
*
|
|
977
|
+
* @param {number} [delta=1] The number to increment.
|
|
978
|
+
*/
|
|
979
|
+
inc: (delta?: number) => void;
|
|
980
|
+
/**
|
|
981
|
+
* Decrement the counter.
|
|
982
|
+
*
|
|
983
|
+
* @param {number} [delta=1] The number to decrement.
|
|
984
|
+
*/
|
|
985
|
+
dec: (delta?: number) => void;
|
|
986
|
+
/**
|
|
987
|
+
* Get the current value of the counter.
|
|
988
|
+
*/
|
|
989
|
+
get: () => number;
|
|
990
|
+
/**
|
|
991
|
+
* Set the counter to a new value.
|
|
992
|
+
*
|
|
993
|
+
* @param val The new value of the counter.
|
|
994
|
+
*/
|
|
995
|
+
set: (val: number) => void;
|
|
996
|
+
/**
|
|
997
|
+
* Reset the counter to an initial value.
|
|
998
|
+
*/
|
|
999
|
+
reset: (val?: number) => number;
|
|
1000
|
+
}
|
|
937
1001
|
/**
|
|
938
1002
|
* Basic counter with utility functions.
|
|
939
1003
|
*
|
|
@@ -942,7 +1006,7 @@ interface UseCounterOptions {
|
|
|
942
1006
|
* @param options
|
|
943
1007
|
*/
|
|
944
1008
|
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
945
|
-
count:
|
|
1009
|
+
count: Readonly<Ref<number, number> | vue.ShallowRef<number, number> | vue.WritableComputedRef<number, number>>;
|
|
946
1010
|
inc: (delta?: number) => number;
|
|
947
1011
|
dec: (delta?: number) => number;
|
|
948
1012
|
get: () => number;
|
|
@@ -966,6 +1030,7 @@ interface UseDateFormatOptions {
|
|
|
966
1030
|
}
|
|
967
1031
|
declare function formatDate(date: Date, formatStr: string, options?: UseDateFormatOptions): string;
|
|
968
1032
|
declare function normalizeDate(date: DateLike): Date;
|
|
1033
|
+
type UseDateFormatReturn = ComputedRef<string>;
|
|
969
1034
|
/**
|
|
970
1035
|
* Get the formatted date according to the string of tokens passed in.
|
|
971
1036
|
*
|
|
@@ -974,9 +1039,9 @@ declare function normalizeDate(date: DateLike): Date;
|
|
|
974
1039
|
* @param formatStr - The combination of tokens to format the date
|
|
975
1040
|
* @param options - UseDateFormatOptions
|
|
976
1041
|
*/
|
|
977
|
-
declare function useDateFormat(date: MaybeRefOrGetter<DateLike>, formatStr?: MaybeRefOrGetter<string>, options?: UseDateFormatOptions):
|
|
978
|
-
type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
1042
|
+
declare function useDateFormat(date: MaybeRefOrGetter<DateLike>, formatStr?: MaybeRefOrGetter<string>, options?: UseDateFormatOptions): UseDateFormatReturn;
|
|
979
1043
|
|
|
1044
|
+
type UseDebounceFnReturn<T extends FunctionArgs> = PromisifyFn<T>;
|
|
980
1045
|
/**
|
|
981
1046
|
* Debounce execution of a function.
|
|
982
1047
|
*
|
|
@@ -987,7 +1052,7 @@ type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
|
987
1052
|
*
|
|
988
1053
|
* @return A new, debounce, function.
|
|
989
1054
|
*/
|
|
990
|
-
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions):
|
|
1055
|
+
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): UseDebounceFnReturn<T>;
|
|
991
1056
|
|
|
992
1057
|
interface UseIntervalOptions<Controls extends boolean> {
|
|
993
1058
|
/**
|
|
@@ -1011,6 +1076,7 @@ interface UseIntervalControls {
|
|
|
1011
1076
|
counter: ShallowRef<number>;
|
|
1012
1077
|
reset: () => void;
|
|
1013
1078
|
}
|
|
1079
|
+
type UseIntervalReturn = Readonly<ShallowRef<number>> | Readonly<UseIntervalControls & Pausable>;
|
|
1014
1080
|
/**
|
|
1015
1081
|
* Reactive counter increases on every interval
|
|
1016
1082
|
*
|
|
@@ -1018,8 +1084,8 @@ interface UseIntervalControls {
|
|
|
1018
1084
|
* @param interval
|
|
1019
1085
|
* @param options
|
|
1020
1086
|
*/
|
|
1021
|
-
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): ShallowRef<number
|
|
1022
|
-
declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): UseIntervalControls & Pausable
|
|
1087
|
+
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Readonly<ShallowRef<number>>;
|
|
1088
|
+
declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): Readonly<UseIntervalControls & Pausable>;
|
|
1023
1089
|
|
|
1024
1090
|
interface UseIntervalFnOptions {
|
|
1025
1091
|
/**
|
|
@@ -1035,6 +1101,7 @@ interface UseIntervalFnOptions {
|
|
|
1035
1101
|
*/
|
|
1036
1102
|
immediateCallback?: boolean;
|
|
1037
1103
|
}
|
|
1104
|
+
type UseIntervalFnReturn = Pausable;
|
|
1038
1105
|
/**
|
|
1039
1106
|
* Wrapper for `setInterval` with controls
|
|
1040
1107
|
*
|
|
@@ -1042,18 +1109,19 @@ interface UseIntervalFnOptions {
|
|
|
1042
1109
|
* @param interval
|
|
1043
1110
|
* @param options
|
|
1044
1111
|
*/
|
|
1045
|
-
declare function useIntervalFn(cb: Fn, interval?: MaybeRefOrGetter<number>, options?: UseIntervalFnOptions):
|
|
1112
|
+
declare function useIntervalFn(cb: Fn, interval?: MaybeRefOrGetter<number>, options?: UseIntervalFnOptions): UseIntervalFnReturn;
|
|
1046
1113
|
|
|
1047
1114
|
interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends number | null | undefined = undefined> extends WatchOptions<Immediate> {
|
|
1048
1115
|
initialValue?: InitialValue;
|
|
1049
1116
|
}
|
|
1117
|
+
type UseLastChangedReturn = Readonly<ShallowRef<number | null>> | Readonly<ShallowRef<number>>;
|
|
1050
1118
|
/**
|
|
1051
1119
|
* Records the timestamp of the last change
|
|
1052
1120
|
*
|
|
1053
1121
|
* @see https://vueuse.org/useLastChanged
|
|
1054
1122
|
*/
|
|
1055
|
-
declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>): ShallowRef<number | null
|
|
1056
|
-
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>): ShallowRef<number
|
|
1123
|
+
declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>): Readonly<ShallowRef<number | null>>;
|
|
1124
|
+
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>): Readonly<ShallowRef<number>>;
|
|
1057
1125
|
|
|
1058
1126
|
/**
|
|
1059
1127
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
@@ -1088,6 +1156,7 @@ interface UseTimeoutFnOptions {
|
|
|
1088
1156
|
*/
|
|
1089
1157
|
immediateCallback?: boolean;
|
|
1090
1158
|
}
|
|
1159
|
+
type UseTimeoutFnReturn<CallbackFn extends AnyFn> = Stoppable<Parameters<CallbackFn> | []>;
|
|
1091
1160
|
/**
|
|
1092
1161
|
* Wrapper for `setTimeout` with controls.
|
|
1093
1162
|
*
|
|
@@ -1095,7 +1164,7 @@ interface UseTimeoutFnOptions {
|
|
|
1095
1164
|
* @param interval
|
|
1096
1165
|
* @param options
|
|
1097
1166
|
*/
|
|
1098
|
-
declare function useTimeoutFn<CallbackFn extends AnyFn>(cb: CallbackFn, interval: MaybeRefOrGetter<number>, options?: UseTimeoutFnOptions):
|
|
1167
|
+
declare function useTimeoutFn<CallbackFn extends AnyFn>(cb: CallbackFn, interval: MaybeRefOrGetter<number>, options?: UseTimeoutFnOptions): UseTimeoutFnReturn<CallbackFn>;
|
|
1099
1168
|
|
|
1100
1169
|
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
1101
1170
|
/**
|
|
@@ -1109,6 +1178,9 @@ interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOption
|
|
|
1109
1178
|
*/
|
|
1110
1179
|
callback?: Fn;
|
|
1111
1180
|
}
|
|
1181
|
+
type UseTimoutReturn = ComputedRef<boolean> | {
|
|
1182
|
+
readonly ready: ComputedRef<boolean>;
|
|
1183
|
+
} & Stoppable;
|
|
1112
1184
|
/**
|
|
1113
1185
|
* Update value after a given time with controls.
|
|
1114
1186
|
*
|
|
@@ -1154,6 +1226,8 @@ declare function useToNumber(value: MaybeRefOrGetter<number | string>, options?:
|
|
|
1154
1226
|
*/
|
|
1155
1227
|
declare function useToString(value: MaybeRefOrGetter<unknown>): ComputedRef<string>;
|
|
1156
1228
|
|
|
1229
|
+
type ToggleFn = (value?: boolean) => void;
|
|
1230
|
+
type UseToggleReturn = [ShallowRef<boolean>, ToggleFn] | ToggleFn;
|
|
1157
1231
|
interface UseToggleOptions<Truthy, Falsy> {
|
|
1158
1232
|
truthyValue?: MaybeRefOrGetter<Truthy>;
|
|
1159
1233
|
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
@@ -1257,4 +1331,5 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1257
1331
|
*/
|
|
1258
1332
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1259
1333
|
|
|
1260
|
-
export {
|
|
1334
|
+
export { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createRef, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, 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, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toArray, 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 };
|
|
1335
|
+
export type { AnyFn, ArgumentsType, Arrayable, Awaitable, Awaited, ComputedEagerOptions, ComputedEagerReturn, ComputedRefWithControl, ComputedWithControlRef, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, CreateInjectionStateOptions, CreateRefReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookReturn, EventHookTrigger, ExtendRefOptions, ExtendRefReturn, Fn, FunctionArgs, FunctionWrapperOptions, IfAny, IgnoredUpdater, IsAny, IsDefinedReturn, MapOldSources, MapSources, MultiWatchSources, Mutable, Pausable, PausableFilterOptions, Promisify, PromisifyFn, ProvideLocalReturn, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyObjectReturn, ReactifyOptions, ReactifyReturn, ReactiveComputedReturn, ReactiveOmitPredicate, ReactiveOmitReturn, ReactivePickPredicate, ReactivePickReturn, ReadonlyRefOrGetter, RefAutoResetReturn, RefDebouncedReturn, RefThrottledReturn, RemovableRef, ShallowOrDeepRef, ShallowUnwrapRef, SharedComposableReturn, SingletonPromiseReturn, Stoppable, SyncRefOptions, SyncRefsOptions, ThrottleFilterOptions, ToRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayDifferenceOptions, UseArrayDifferenceReturn, UseArrayEveryReturn, UseArrayFilterReturn, UseArrayFindIndexReturn, UseArrayFindLastReturn, UseArrayFindReturn, UseArrayIncludesComparatorFn, UseArrayIncludesOptions, UseArrayIncludesReturn, UseArrayJoinReturn, UseArrayMapReturn, UseArrayReducer, UseArraySomeReturn, UseArrayUniqueReturn, UseCounterOptions, UseCounterReturn, UseDateFormatOptions, UseDateFormatReturn, UseDebounceFnReturn, UseIntervalControls, UseIntervalFnOptions, UseIntervalFnReturn, UseIntervalOptions, UseIntervalReturn, UseLastChangedOptions, UseLastChangedReturn, UseTimeoutFnOptions, UseTimeoutFnReturn, UseTimeoutOptions, UseTimoutReturn, UseToNumberOptions, UseToggleOptions, UseToggleReturn, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableOptions, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WheneverOptions, WritableComputedRefWithControl };
|
package/index.iife.js
CHANGED
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
return vue.inject(...args);
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
function provideLocal(key, value) {
|
|
112
112
|
var _a;
|
|
113
113
|
const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
114
114
|
if (instance == null)
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
localProvidedStateMap.set(instance, /* @__PURE__ */ Object.create(null));
|
|
118
118
|
const localProvidedState = localProvidedStateMap.get(instance);
|
|
119
119
|
localProvidedState[key] = value;
|
|
120
|
-
vue.provide(key, value);
|
|
121
|
-
}
|
|
120
|
+
return vue.provide(key, value);
|
|
121
|
+
}
|
|
122
122
|
|
|
123
123
|
function createInjectionState(composable, options) {
|
|
124
124
|
const key = (options == null ? void 0 : options.injectionKey) || Symbol(composable.name || "InjectionState");
|
|
@@ -315,6 +315,46 @@
|
|
|
315
315
|
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));
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
function toRef(...args) {
|
|
319
|
+
if (args.length !== 1)
|
|
320
|
+
return vue.toRef(...args);
|
|
321
|
+
const r = args[0];
|
|
322
|
+
return typeof r === "function" ? vue.readonly(vue.customRef(() => ({ get: r, set: noop }))) : vue.ref(r);
|
|
323
|
+
}
|
|
324
|
+
const resolveRef = toRef;
|
|
325
|
+
|
|
326
|
+
function reactivePick(obj, ...keys) {
|
|
327
|
+
const flatKeys = keys.flat();
|
|
328
|
+
const predicate = flatKeys[0];
|
|
329
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => predicate(vue.toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
333
|
+
return vue.customRef((track, trigger) => {
|
|
334
|
+
let value = vue.toValue(defaultValue);
|
|
335
|
+
let timer;
|
|
336
|
+
const resetAfter = () => setTimeout(() => {
|
|
337
|
+
value = vue.toValue(defaultValue);
|
|
338
|
+
trigger();
|
|
339
|
+
}, vue.toValue(afterMs));
|
|
340
|
+
tryOnScopeDispose(() => {
|
|
341
|
+
clearTimeout(timer);
|
|
342
|
+
});
|
|
343
|
+
return {
|
|
344
|
+
get() {
|
|
345
|
+
track();
|
|
346
|
+
return value;
|
|
347
|
+
},
|
|
348
|
+
set(newValue) {
|
|
349
|
+
value = newValue;
|
|
350
|
+
trigger();
|
|
351
|
+
clearTimeout(timer);
|
|
352
|
+
timer = resetAfter();
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
318
358
|
function createFilterWrapper(filter, fn) {
|
|
319
359
|
function wrapper(...args) {
|
|
320
360
|
return new Promise((resolve, reject) => {
|
|
@@ -441,20 +481,6 @@
|
|
|
441
481
|
return { isActive: vue.readonly(isActive), pause, resume, eventFilter };
|
|
442
482
|
}
|
|
443
483
|
|
|
444
|
-
function cacheStringFunction(fn) {
|
|
445
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
446
|
-
return (str) => {
|
|
447
|
-
const hit = cache[str];
|
|
448
|
-
return hit || (cache[str] = fn(str));
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
452
|
-
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
453
|
-
const camelizeRE = /-(\w)/g;
|
|
454
|
-
const camelize = cacheStringFunction((str) => {
|
|
455
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
456
|
-
});
|
|
457
|
-
|
|
458
484
|
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
459
485
|
return new Promise((resolve, reject) => {
|
|
460
486
|
if (throwOnTimeout)
|
|
@@ -518,51 +544,26 @@
|
|
|
518
544
|
function objectEntries(obj) {
|
|
519
545
|
return Object.entries(obj);
|
|
520
546
|
}
|
|
521
|
-
function getLifeCycleTarget(target) {
|
|
522
|
-
return target || vue.getCurrentInstance();
|
|
523
|
-
}
|
|
524
547
|
function toArray(value) {
|
|
525
548
|
return Array.isArray(value) ? value : [value];
|
|
526
549
|
}
|
|
527
550
|
|
|
528
|
-
function
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
const resolveRef = toRef;
|
|
535
|
-
|
|
536
|
-
function reactivePick(obj, ...keys) {
|
|
537
|
-
const flatKeys = keys.flat();
|
|
538
|
-
const predicate = flatKeys[0];
|
|
539
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => predicate(vue.toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
551
|
+
function cacheStringFunction(fn) {
|
|
552
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
553
|
+
return (str) => {
|
|
554
|
+
const hit = cache[str];
|
|
555
|
+
return hit || (cache[str] = fn(str));
|
|
556
|
+
};
|
|
540
557
|
}
|
|
558
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
559
|
+
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
560
|
+
const camelizeRE = /-(\w)/g;
|
|
561
|
+
const camelize = cacheStringFunction((str) => {
|
|
562
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
563
|
+
});
|
|
541
564
|
|
|
542
|
-
function
|
|
543
|
-
return vue.
|
|
544
|
-
let value = vue.toValue(defaultValue);
|
|
545
|
-
let timer;
|
|
546
|
-
const resetAfter = () => setTimeout(() => {
|
|
547
|
-
value = vue.toValue(defaultValue);
|
|
548
|
-
trigger();
|
|
549
|
-
}, vue.toValue(afterMs));
|
|
550
|
-
tryOnScopeDispose(() => {
|
|
551
|
-
clearTimeout(timer);
|
|
552
|
-
});
|
|
553
|
-
return {
|
|
554
|
-
get() {
|
|
555
|
-
track();
|
|
556
|
-
return value;
|
|
557
|
-
},
|
|
558
|
-
set(newValue) {
|
|
559
|
-
value = newValue;
|
|
560
|
-
trigger();
|
|
561
|
-
clearTimeout(timer);
|
|
562
|
-
timer = resetAfter();
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
});
|
|
565
|
+
function getLifeCycleTarget(target) {
|
|
566
|
+
return target || vue.getCurrentInstance();
|
|
566
567
|
}
|
|
567
568
|
|
|
568
569
|
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
@@ -573,12 +574,12 @@
|
|
|
573
574
|
}
|
|
574
575
|
|
|
575
576
|
function refDebounced(value, ms = 200, options = {}) {
|
|
576
|
-
const debounced = vue.ref(
|
|
577
|
+
const debounced = vue.ref(vue.toValue(value));
|
|
577
578
|
const updater = useDebounceFn(() => {
|
|
578
579
|
debounced.value = value.value;
|
|
579
580
|
}, ms, options);
|
|
580
581
|
vue.watch(value, () => updater());
|
|
581
|
-
return debounced;
|
|
582
|
+
return vue.shallowReadonly(debounced);
|
|
582
583
|
}
|
|
583
584
|
|
|
584
585
|
function refDefault(source, defaultValue) {
|
|
@@ -603,7 +604,7 @@
|
|
|
603
604
|
function refThrottled(value, delay = 200, trailing = true, leading = true) {
|
|
604
605
|
if (delay <= 0)
|
|
605
606
|
return value;
|
|
606
|
-
const throttled = vue.ref(
|
|
607
|
+
const throttled = vue.ref(vue.toValue(value));
|
|
607
608
|
const updater = useThrottleFn(() => {
|
|
608
609
|
throttled.value = value.value;
|
|
609
610
|
}, delay, trailing, leading);
|
|
@@ -811,7 +812,7 @@
|
|
|
811
812
|
}
|
|
812
813
|
|
|
813
814
|
function tryOnMounted(fn, sync = true, target) {
|
|
814
|
-
const instance = getLifeCycleTarget();
|
|
815
|
+
const instance = getLifeCycleTarget(target);
|
|
815
816
|
if (instance)
|
|
816
817
|
vue.onMounted(fn, target);
|
|
817
818
|
else if (sync)
|
|
@@ -1085,7 +1086,7 @@
|
|
|
1085
1086
|
_initialValue = val;
|
|
1086
1087
|
return set(val);
|
|
1087
1088
|
};
|
|
1088
|
-
return { count, inc, dec, get, set, reset };
|
|
1089
|
+
return { count: vue.shallowReadonly(count), inc, dec, get, set, reset };
|
|
1089
1090
|
}
|
|
1090
1091
|
|
|
1091
1092
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
|
|
@@ -1219,7 +1220,7 @@
|
|
|
1219
1220
|
}
|
|
1220
1221
|
tryOnScopeDispose(pause);
|
|
1221
1222
|
return {
|
|
1222
|
-
isActive,
|
|
1223
|
+
isActive: vue.shallowReadonly(isActive),
|
|
1223
1224
|
pause,
|
|
1224
1225
|
resume
|
|
1225
1226
|
};
|
|
@@ -1246,12 +1247,12 @@
|
|
|
1246
1247
|
);
|
|
1247
1248
|
if (exposeControls) {
|
|
1248
1249
|
return {
|
|
1249
|
-
counter,
|
|
1250
|
+
counter: vue.shallowReadonly(counter),
|
|
1250
1251
|
reset,
|
|
1251
1252
|
...controls
|
|
1252
1253
|
};
|
|
1253
1254
|
} else {
|
|
1254
|
-
return counter;
|
|
1255
|
+
return vue.shallowReadonly(counter);
|
|
1255
1256
|
}
|
|
1256
1257
|
}
|
|
1257
1258
|
|
|
@@ -1263,7 +1264,7 @@
|
|
|
1263
1264
|
() => ms.value = timestamp(),
|
|
1264
1265
|
options
|
|
1265
1266
|
);
|
|
1266
|
-
return ms;
|
|
1267
|
+
return vue.shallowReadonly(ms);
|
|
1267
1268
|
}
|
|
1268
1269
|
|
|
1269
1270
|
function useTimeoutFn(cb, interval, options = {}) {
|
|
@@ -1301,7 +1302,7 @@
|
|
|
1301
1302
|
}
|
|
1302
1303
|
tryOnScopeDispose(stop);
|
|
1303
1304
|
return {
|
|
1304
|
-
isPending: vue.
|
|
1305
|
+
isPending: vue.shallowReadonly(isPending),
|
|
1305
1306
|
start,
|
|
1306
1307
|
stop
|
|
1307
1308
|
};
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,o){"use strict";function $(t,e){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),o.readonly(r)}function H(t,e){let n,r,a;const l=o.shallowRef(!0),c=()=>{l.value=!0,a()};o.watch(t,c,{flush:"sync"});const u=typeof e=="function"?e:e.get,s=typeof e=="function"?void 0:e.set,h=o.customRef((m,d)=>(r=m,a=d,{get(){return l.value&&(n=u(n),l.value=!1),r(),n},set(f){s?.(f)}}));return Object.isExtensible(h)&&(h.trigger=c),h}function p(t){return o.getCurrentScope()?(o.onScopeDispose(t),!0):!1}function dt(){const t=new Set,e=l=>{t.delete(l)};return{on:l=>{t.add(l);const c=()=>e(l);return p(c),{off:c}},off:e,trigger:(...l)=>Promise.all(Array.from(t).map(c=>c(...l))),clear:()=>{t.clear()}}}function mt(t){let e=!1,n;const r=o.effectScope(!0);return(...a)=>(e||(n=r.run(()=>t(...a)),e=!0),n)}const S=new WeakMap,G=(...t)=>{var e;const n=t[0],r=(e=o.getCurrentInstance())==null?void 0:e.proxy;if(r==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&S.has(r)&&n in S.get(r)?S.get(r)[n]:o.inject(...t)},Z=(t,e)=>{var n;const r=(n=o.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");S.has(r)||S.set(r,Object.create(null));const a=S.get(r);a[t]=e,o.provide(t,e)};function ht(t,e){const n=e?.injectionKey||Symbol(t.name||"InjectionState"),r=e?.defaultValue;return[(...c)=>{const u=t(...c);return Z(n,u),u},()=>G(n,r)]}function yt(t,e){return e===!0?o.ref(t):o.shallowRef(t)}function wt(t){let e=0,n,r;const a=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...l)=>(e+=1,r||(r=o.effectScope(!0),n=r.run(()=>t(...l))),p(a),n)}function q(t,e,{enumerable:n=!1,unwrap:r=!0}={}){for(const[a,l]of Object.entries(e))a!=="value"&&(o.isRef(l)&&r?Object.defineProperty(t,a,{get(){return l.value},set(c){l.value=c},enumerable:n}):Object.defineProperty(t,a,{value:l,enumerable:n}));return t}function gt(t,e){return e==null?o.unref(t):o.unref(t)[e]}function Vt(t){return o.unref(t)!=null}function bt(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 _(t,e){const n=e?.computedGetter===!1?o.unref:o.toValue;return function(...r){return o.computed(()=>t.apply(this,r.map(a=>n(a))))}}function pt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:a=!0}=e;n.push(...Object.keys(t)),a&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(a=>{const l=t[a];return[a,typeof l=="function"?_(l.bind(t),r):l]}))}function J(t){if(!o.isRef(t))return o.reactive(t);const e=new Proxy({},{get(n,r,a){return o.unref(Reflect.get(t.value,r,a))},set(n,r,a){return o.isRef(t.value[r])&&!o.isRef(a)?t.value[r].value=a:t.value[r]=a,!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 o.reactive(e)}function N(t){return J(o.computed(t))}function At(t,...e){const n=e.flat(),r=n[0];return N(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,l])=>!r(o.toValue(l),a)):Object.entries(o.toRefs(t)).filter(a=>!n.includes(a[0]))))}const R=typeof window<"u"&&typeof document<"u",Ot=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,St=t=>typeof t<"u",Tt=t=>t!=null,Dt=(t,...e)=>{t||console.warn(...e)},Rt=Object.prototype.toString,X=t=>Rt.call(t)==="[object Object]",Ft=()=>Date.now(),K=()=>+Date.now(),Mt=(t,e,n)=>Math.min(n,Math.max(e,t)),A=()=>{},Pt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),It=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ct=kt();function kt(){var t,e;return R&&((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 F(t,e){function n(...r){return new Promise((a,l)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(a).catch(l)})}return n}const I=t=>t();function L(t,e={}){let n,r,a=A;const l=s=>{clearTimeout(s),a(),a=A};let c;return s=>{const h=o.toValue(t),m=o.toValue(e.maxWait);return n&&l(n),h<=0||m!==void 0&&m<=0?(r&&(l(r),r=null),Promise.resolve(s())):new Promise((d,f)=>{a=e.rejectOnCancel?f:d,c=s,m&&!r&&(r=setTimeout(()=>{n&&l(n),r=null,d(c())},m)),n=setTimeout(()=>{r&&l(r),r=null,d(s())},h)})}}function j(...t){let e=0,n,r=!0,a=A,l,c,u,s,h;!o.isRef(t[0])&&typeof t[0]=="object"?{delay:c,trailing:u=!0,leading:s=!0,rejectOnCancel:h=!1}=t[0]:[c,u=!0,s=!0,h=!1]=t;const m=()=>{n&&(clearTimeout(n),n=void 0,a(),a=A)};return f=>{const y=o.toValue(c),g=Date.now()-e,V=()=>l=f();return m(),y<=0?(e=Date.now(),V()):(g>y&&(s||!r)?(e=Date.now(),V()):u&&(l=new Promise((w,b)=>{a=h?b:w,n=setTimeout(()=>{e=Date.now(),r=!0,w(V()),m()},Math.max(0,y-g))})),!s&&!n&&(n=setTimeout(()=>r=!0,y)),r=!1,l)}}function Q(t=I,e={}){const{initialState:n="active"}=e,r=C(n==="active");function a(){r.value=!1}function l(){r.value=!0}const c=(...u)=>{r.value&&t(...u)};return{isActive:o.readonly(r),pause:a,resume:l,eventFilter:c}}function v(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const Et=/\B([A-Z])/g,_t=v(t=>t.replace(Et,"-$1").toLowerCase()),Nt=/-(\w)/g,Lt=v(t=>t.replace(Nt,(e,n)=>n?n.toUpperCase():""));function W(t,e=!1,n="Timeout"){return new Promise((r,a)=>{setTimeout(e?()=>a(n):r,t)})}function jt(t){return t}function Wt(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 Ut(t){return t()}function x(t,...e){return e.some(n=>n in t)}function zt(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",a=t.slice(r.length),l=Number.parseFloat(r)+e;return Number.isNaN(l)?t:l+a}function Bt(t){return t.endsWith("rem")?Number.parseFloat(t)*16:Number.parseFloat(t)}function Yt(t,e,n=!1){return e.reduce((r,a)=>(a in t&&(!n||t[a]!==void 0)&&(r[a]=t[a]),r),{})}function $t(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,a])=>(!n||a!==void 0)&&!e.includes(r)))}function Ht(t){return Object.entries(t)}function M(t){return t||o.getCurrentInstance()}function tt(t){return Array.isArray(t)?t:[t]}function C(...t){if(t.length!==1)return o.toRef(...t);const e=t[0];return typeof e=="function"?o.readonly(o.customRef(()=>({get:e,set:A}))):o.ref(e)}const Gt=C;function Zt(t,...e){const n=e.flat(),r=n[0];return N(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,l])=>r(o.toValue(l),a)):n.map(a=>[a,C(t,a)])))}function et(t,e=1e4){return o.customRef((n,r)=>{let a=o.toValue(t),l;const c=()=>setTimeout(()=>{a=o.toValue(t),r()},o.toValue(e));return p(()=>{clearTimeout(l)}),{get(){return n(),a},set(u){a=u,r(),clearTimeout(l),l=c()}}})}function nt(t,e=200,n={}){return F(L(e,n),t)}function U(t,e=200,n={}){const r=o.ref(t.value),a=nt(()=>{r.value=t.value},e,n);return o.watch(t,()=>a()),r}function qt(t,e){return o.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function rt(t,e=200,n=!1,r=!0,a=!1){return F(j(e,n,r,a),t)}function z(t,e=200,n=!0,r=!0){if(e<=0)return t;const a=o.ref(t.value),l=rt(()=>{a.value=t.value},e,n,r);return o.watch(t,()=>l()),a}function ot(t,e={}){let n=t,r,a;const l=o.customRef((f,y)=>(r=f,a=y,{get(){return c()},set(g){u(g)}}));function c(f=!0){return f&&r(),n}function u(f,y=!0){var g,V;if(f===n)return;const w=n;((g=e.onBeforeChange)==null?void 0:g.call(e,f,w))!==!1&&(n=f,(V=e.onChanged)==null||V.call(e,f,w),y&&a())}return q(l,{get:c,set:u,untrackedGet:()=>c(!1),silentSet:f=>u(f,!1),peek:()=>c(!1),lay:f=>u(f,!1)},{enumerable:!0})}const Jt=ot;function Xt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3){const[e,n,r]=t;e[n]=r}}function P(t,e,n={}){const{eventFilter:r=I,...a}=n;return o.watch(t,F(r,e),a)}function k(t,e,n={}){const{eventFilter:r,initialState:a="active",...l}=n,{eventFilter:c,pause:u,resume:s,isActive:h}=Q(r,{initialState:a});return{stop:P(t,e,{...l,eventFilter:c}),pause:u,resume:s,isActive:h}}function Kt(t,e,...[n]){const{flush:r="sync",deep:a=!1,immediate:l=!0,direction:c="both",transform:u={}}=n||{},s=[],h="ltr"in u&&u.ltr||(f=>f),m="rtl"in u&&u.rtl||(f=>f);return(c==="both"||c==="ltr")&&s.push(k(t,f=>{s.forEach(y=>y.pause()),e.value=h(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:l})),(c==="both"||c==="rtl")&&s.push(k(e,f=>{s.forEach(y=>y.pause()),t.value=m(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:l})),()=>{s.forEach(f=>f.stop())}}function Qt(t,e,n={}){const{flush:r="sync",deep:a=!1,immediate:l=!0}=n,c=tt(e);return o.watch(t,u=>c.forEach(s=>s.value=u),{flush:r,deep:a,immediate:l})}function vt(t,e={}){if(!o.isRef(t))return o.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=o.customRef(()=>({get(){return t.value[r]},set(a){var l;if((l=o.toValue(e.replaceRef))!=null?l:!0)if(Array.isArray(t.value)){const u=[...t.value];u[r]=a,t.value=u}else{const u={...t.value,[r]:a};Object.setPrototypeOf(u,Object.getPrototypeOf(t.value)),t.value=u}else t.value[r]=a}}));return n}const xt=o.toValue,te=o.toValue;function ee(t,e=!0,n){M(n)?o.onBeforeMount(t,n):e?t():o.nextTick(t)}function ne(t,e){M(e)&&o.onBeforeUnmount(t,e)}function re(t,e=!0,n){M()?o.onMounted(t,n):e?t():o.nextTick(t)}function oe(t,e){M(e)&&o.onUnmounted(t,e)}function B(t,e=!1){function n(d,{flush:f="sync",deep:y=!1,timeout:g,throwOnTimeout:V}={}){let w=null;const T=[new Promise(E=>{w=o.watch(t,D=>{d(D)!==e&&(w?w():o.nextTick(()=>w?.()),E(D))},{flush:f,deep:y,immediate:!0})})];return g!=null&&T.push(W(g,V).then(()=>o.toValue(t)).finally(()=>w?.())),Promise.race(T)}function r(d,f){if(!o.isRef(d))return n(D=>D===d,f);const{flush:y="sync",deep:g=!1,timeout:V,throwOnTimeout:w}=f??{};let b=null;const E=[new Promise(D=>{b=o.watch([t,d],([ft,$e])=>{e!==(ft===$e)&&(b?b():o.nextTick(()=>b?.()),D(ft))},{flush:y,deep:g,immediate:!0})})];return V!=null&&E.push(W(V,w).then(()=>o.toValue(t)).finally(()=>(b?.(),o.toValue(t)))),Promise.race(E)}function a(d){return n(f=>!!f,d)}function l(d){return r(null,d)}function c(d){return r(void 0,d)}function u(d){return n(Number.isNaN,d)}function s(d,f){return n(y=>{const g=Array.from(y);return g.includes(d)||g.includes(o.toValue(d))},f)}function h(d){return m(1,d)}function m(d=1,f){let y=-1;return n(()=>(y+=1,y>=d),f)}return Array.isArray(o.toValue(t))?{toMatch:n,toContains:s,changed:h,changedTimes:m,get not(){return B(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:a,toBeNull:l,toBeNaN:u,toBeUndefined:c,changed:h,changedTimes:m,get not(){return B(t,!e)}}}function ae(t){return B(t)}function le(t,e){return t===e}function ie(...t){var e,n;const r=t[0],a=t[1];let l=(e=t[2])!=null?e:le;const{symmetric:c=!1}=(n=t[3])!=null?n:{};if(typeof l=="string"){const s=l;l=(h,m)=>h[s]===m[s]}const u=o.computed(()=>o.toValue(r).filter(s=>o.toValue(a).findIndex(h=>l(s,h))===-1));if(c){const s=o.computed(()=>o.toValue(a).filter(h=>o.toValue(r).findIndex(m=>l(h,m))===-1));return o.computed(()=>c?[...o.toValue(u),...o.toValue(s)]:o.toValue(u))}else return u}function ce(t,e){return o.computed(()=>o.toValue(t).every((n,r,a)=>e(o.toValue(n),r,a)))}function ue(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).filter(e))}function se(t,e){return o.computed(()=>o.toValue(o.toValue(t).find((n,r,a)=>e(o.toValue(n),r,a))))}function fe(t,e){return o.computed(()=>o.toValue(t).findIndex((n,r,a)=>e(o.toValue(n),r,a)))}function de(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function me(t,e){return o.computed(()=>o.toValue(Array.prototype.findLast?o.toValue(t).findLast((n,r,a)=>e(o.toValue(n),r,a)):de(o.toValue(t),(n,r,a)=>e(o.toValue(n),r,a))))}function he(t){return X(t)&&x(t,"formIndex","comparator")}function ye(...t){var e;const n=t[0],r=t[1];let a=t[2],l=0;if(he(a)&&(l=(e=a.fromIndex)!=null?e:0,a=a.comparator),typeof a=="string"){const c=a;a=(u,s)=>u[c]===o.toValue(s)}return a=a??((c,u)=>c===o.toValue(u)),o.computed(()=>o.toValue(n).slice(l).some((c,u,s)=>a(o.toValue(c),o.toValue(r),u,o.toValue(s))))}function we(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).join(o.toValue(e)))}function ge(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).map(e))}function Ve(t,e,...n){const r=(a,l,c)=>e(o.toValue(a),o.toValue(l),c);return o.computed(()=>{const a=o.toValue(t);return n.length?a.reduce(r,typeof n[0]=="function"?o.toValue(n[0]()):o.toValue(n[0])):a.reduce(r)})}function be(t,e){return o.computed(()=>o.toValue(t).some((n,r,a)=>e(o.toValue(n),r,a)))}function pe(t){return Array.from(new Set(t))}function Ae(t,e){return t.reduce((n,r)=>(n.some(a=>e(r,a,t))||n.push(r),n),[])}function Oe(t,e){return o.computed(()=>{const n=o.toValue(t).map(r=>o.toValue(r));return e?Ae(n,e):pe(n)})}function Se(t=0,e={}){let n=o.unref(t);const r=o.shallowRef(t),{max:a=Number.POSITIVE_INFINITY,min:l=Number.NEGATIVE_INFINITY}=e,c=(d=1)=>r.value=Math.max(Math.min(a,r.value+d),l),u=(d=1)=>r.value=Math.min(Math.max(l,r.value-d),a),s=()=>r.value,h=d=>r.value=Math.max(l,Math.min(a,d));return{count:r,inc:c,dec:u,get:s,set:h,reset:(d=n)=>(n=d,h(d))}}const Te=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,De=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;function Re(t,e,n,r){let a=t<12?"AM":"PM";return r&&(a=a.split("").reduce((l,c)=>l+=`${c}.`,"")),n?a.toLowerCase():a}function O(t){const e=["th","st","nd","rd"],n=t%100;return t+(e[(n-20)%10]||e[n]||e[0])}function at(t,e,n={}){var r;const a=t.getFullYear(),l=t.getMonth(),c=t.getDate(),u=t.getHours(),s=t.getMinutes(),h=t.getSeconds(),m=t.getMilliseconds(),d=t.getDay(),f=(r=n.customMeridiem)!=null?r:Re,y=V=>{var w;return(w=V.split(" ")[1])!=null?w:""},g={Yo:()=>O(a),YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>l+1,Mo:()=>O(l+1),MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"short"}),MMMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"long"}),D:()=>String(c),Do:()=>O(c),DD:()=>`${c}`.padStart(2,"0"),H:()=>String(u),Ho:()=>O(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),ho:()=>O(u%12||12),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(s),mo:()=>O(s),mm:()=>`${s}`.padStart(2,"0"),s:()=>String(h),so:()=>O(h),ss:()=>`${h}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"short"}),dddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"long"}),A:()=>f(u,s),AA:()=>f(u,s,!1,!0),a:()=>f(u,s,!0),aa:()=>f(u,s,!0,!0),z:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zzz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zzzz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"longOffset"}))};return e.replace(De,(V,w)=>{var b,T;return(T=w??((b=g[V])==null?void 0:b.call(g)))!=null?T:V})}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(Te);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 Fe(t,e="HH:mm:ss",n={}){return o.computed(()=>at(lt(o.toValue(t)),o.toValue(e),n))}function it(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n;let l=null;const c=o.shallowRef(!1);function u(){l&&(clearInterval(l),l=null)}function s(){c.value=!1,u()}function h(){const m=o.toValue(e);m<=0||(c.value=!0,a&&t(),u(),c.value&&(l=setInterval(t,m)))}if(r&&R&&h(),o.isRef(e)||typeof e=="function"){const m=o.watch(e,()=>{c.value&&R&&h()});p(m)}return p(s),{isActive:c,pause:s,resume:h}}function Me(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:a}=e,l=o.shallowRef(0),c=()=>l.value+=1,u=()=>{l.value=0},s=it(a?()=>{c(),a(l.value)}:c,t,{immediate:r});return n?{counter:l,reset:u,...s}:l}function Pe(t,e={}){var n;const r=o.shallowRef((n=e.initialValue)!=null?n:null);return o.watch(t,()=>r.value=K(),e),r}function ct(t,e,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n,l=o.shallowRef(!1);let c=null;function u(){c&&(clearTimeout(c),c=null)}function s(){l.value=!1,u()}function h(...m){a&&t(),u(),l.value=!0,c=setTimeout(()=>{l.value=!1,c=null,t(...m)},o.toValue(e))}return r&&(l.value=!0,R&&h()),p(s),{isPending:o.readonly(l),start:h,stop:s}}function Ie(t=1e3,e={}){const{controls:n=!1,callback:r}=e,a=ct(r??A,t,e),l=o.computed(()=>!a.isPending.value);return n?{ready:l,...a}:l}function Ce(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:a}=e;return o.computed(()=>{let l=o.toValue(t);return typeof n=="function"?l=n(l):typeof l=="string"&&(l=Number[n](l,r)),a&&Number.isNaN(l)&&(l=0),l})}function ke(t){return o.computed(()=>`${o.toValue(t)}`)}function Ee(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,a=o.isRef(t),l=o.shallowRef(t);function c(u){if(arguments.length)return l.value=u,l.value;{const s=o.toValue(n);return l.value=l.value===s?o.toValue(r):s,l.value}}return a?c:[l,c]}function _e(t,e,n){let r=n?.immediate?[]:[...typeof t=="function"?t():Array.isArray(t)?t:o.toValue(t)];return o.watch(t,(a,l,c)=>{const u=Array.from({length:r.length}),s=[];for(const m of a){let d=!1;for(let f=0;f<r.length;f++)if(!u[f]&&m===r[f]){u[f]=!0,d=!0;break}d||s.push(m)}const h=r.filter((m,d)=>!u[d]);e(a,r,s,h,c),r=[...a]},n)}function Ne(t,e,n){const{count:r,...a}=n,l=o.shallowRef(0),c=P(t,(...u)=>{l.value+=1,l.value>=o.toValue(r)&&o.nextTick(()=>c()),e(...u)},a);return{count:l,stop:c}}function ut(t,e,n={}){const{debounce:r=0,maxWait:a=void 0,...l}=n;return P(t,e,{...l,eventFilter:L(r,{maxWait:a})})}function Le(t,e,n){return o.watch(t,e,{...n,deep:!0})}function Y(t,e,n={}){const{eventFilter:r=I,...a}=n,l=F(r,e);let c,u,s;if(a.flush==="sync"){const h=o.shallowRef(!1);u=()=>{},c=m=>{h.value=!0,m(),h.value=!1},s=o.watch(t,(...m)=>{h.value||l(...m)},a)}else{const h=[],m=o.shallowRef(0),d=o.shallowRef(0);u=()=>{m.value=d.value},h.push(o.watch(t,()=>{d.value++},{...a,flush:"sync"})),c=f=>{const y=d.value;f(),m.value+=d.value-y},h.push(o.watch(t,(...f)=>{const y=m.value>0&&m.value===d.value;m.value=0,d.value=0,!y&&l(...f)},a)),s=()=>{h.forEach(f=>f())}}return{stop:s,ignoreUpdates:c,ignorePrevAsyncUpdates:u}}function je(t,e,n){return o.watch(t,e,{...n,immediate:!0})}function We(t,e,n){const r=o.watch(t,(...a)=>(o.nextTick(()=>r()),e(...a)),n);return r}function st(t,e,n={}){const{throttle:r=0,trailing:a=!0,leading:l=!0,...c}=n;return P(t,e,{...c,eventFilter:j(r,a,l)})}function Ue(t,e,n={}){let r;function a(){if(!r)return;const m=r;r=void 0,m()}function l(m){r=m}const c=(m,d)=>(a(),e(m,d,l)),u=Y(t,c,n),{ignoreUpdates:s}=u;return{...u,trigger:()=>{let m;return s(()=>{m=c(ze(t),Be(t))}),m}}}function ze(t){return o.isReactive(t)?t:Array.isArray(t)?t.map(e=>o.toValue(e)):o.toValue(t)}function Be(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Ye(t,e,n){const r=o.watch(t,(a,l,c)=>{a&&(n?.once&&o.nextTick(()=>r()),e(a,l,c))},{...n,once:!1});return r}i.assert=Dt,i.autoResetRef=et,i.bypassFilter=I,i.camelize=Lt,i.clamp=Mt,i.computedEager=$,i.computedWithControl=H,i.containsProp=x,i.controlledComputed=H,i.controlledRef=Jt,i.createEventHook=dt,i.createFilterWrapper=F,i.createGlobalState=mt,i.createInjectionState=ht,i.createReactiveFn=_,i.createRef=yt,i.createSharedComposable=wt,i.createSingletonPromise=Wt,i.debounceFilter=L,i.debouncedRef=U,i.debouncedWatch=ut,i.eagerComputed=$,i.extendRef=q,i.formatDate=at,i.get=gt,i.getLifeCycleTarget=M,i.hasOwn=It,i.hyphenate=_t,i.identity=jt,i.ignorableWatch=Y,i.increaseWithUnit=zt,i.injectLocal=G,i.invoke=Ut,i.isClient=R,i.isDef=St,i.isDefined=Vt,i.isIOS=Ct,i.isObject=X,i.isWorker=Ot,i.makeDestructurable=bt,i.noop=A,i.normalizeDate=lt,i.notNullish=Tt,i.now=Ft,i.objectEntries=Ht,i.objectOmit=$t,i.objectPick=Yt,i.pausableFilter=Q,i.pausableWatch=k,i.promiseTimeout=W,i.provideLocal=Z,i.pxValue=Bt,i.rand=Pt,i.reactify=_,i.reactifyObject=pt,i.reactiveComputed=N,i.reactiveOmit=At,i.reactivePick=Zt,i.refAutoReset=et,i.refDebounced=U,i.refDefault=qt,i.refThrottled=z,i.refWithControl=ot,i.resolveRef=Gt,i.resolveUnref=te,i.set=Xt,i.syncRef=Kt,i.syncRefs=Qt,i.throttleFilter=j,i.throttledRef=z,i.throttledWatch=st,i.timestamp=K,i.toArray=tt,i.toReactive=J,i.toRef=C,i.toRefs=vt,i.toValue=xt,i.tryOnBeforeMount=ee,i.tryOnBeforeUnmount=ne,i.tryOnMounted=re,i.tryOnScopeDispose=p,i.tryOnUnmounted=oe,i.until=ae,i.useArrayDifference=ie,i.useArrayEvery=ce,i.useArrayFilter=ue,i.useArrayFind=se,i.useArrayFindIndex=fe,i.useArrayFindLast=me,i.useArrayIncludes=ye,i.useArrayJoin=we,i.useArrayMap=ge,i.useArrayReduce=Ve,i.useArraySome=be,i.useArrayUnique=Oe,i.useCounter=Se,i.useDateFormat=Fe,i.useDebounce=U,i.useDebounceFn=nt,i.useInterval=Me,i.useIntervalFn=it,i.useLastChanged=Pe,i.useThrottle=z,i.useThrottleFn=rt,i.useTimeout=Ie,i.useTimeoutFn=ct,i.useToNumber=Ce,i.useToString=ke,i.useToggle=Ee,i.watchArray=_e,i.watchAtMost=Ne,i.watchDebounced=ut,i.watchDeep=Le,i.watchIgnorable=Y,i.watchImmediate=je,i.watchOnce=We,i.watchPausable=k,i.watchThrottled=st,i.watchTriggerable=Ue,i.watchWithFilter=P,i.whenever=Ye})(this.VueUse=this.VueUse||{},Vue);
|
|
1
|
+
(function(i,o){"use strict";function $(t,e){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),o.readonly(r)}function H(t,e){let n,r,a;const l=o.shallowRef(!0),c=()=>{l.value=!0,a()};o.watch(t,c,{flush:"sync"});const u=typeof e=="function"?e:e.get,s=typeof e=="function"?void 0:e.set,h=o.customRef((m,d)=>(r=m,a=d,{get(){return l.value&&(n=u(n),l.value=!1),r(),n},set(f){s?.(f)}}));return Object.isExtensible(h)&&(h.trigger=c),h}function p(t){return o.getCurrentScope()?(o.onScopeDispose(t),!0):!1}function dt(){const t=new Set,e=l=>{t.delete(l)};return{on:l=>{t.add(l);const c=()=>e(l);return p(c),{off:c}},off:e,trigger:(...l)=>Promise.all(Array.from(t).map(c=>c(...l))),clear:()=>{t.clear()}}}function mt(t){let e=!1,n;const r=o.effectScope(!0);return(...a)=>(e||(n=r.run(()=>t(...a)),e=!0),n)}const S=new WeakMap,G=(...t)=>{var e;const n=t[0],r=(e=o.getCurrentInstance())==null?void 0:e.proxy;if(r==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&S.has(r)&&n in S.get(r)?S.get(r)[n]:o.inject(...t)};function Z(t,e){var n;const r=(n=o.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");S.has(r)||S.set(r,Object.create(null));const a=S.get(r);return a[t]=e,o.provide(t,e)}function ht(t,e){const n=e?.injectionKey||Symbol(t.name||"InjectionState"),r=e?.defaultValue;return[(...c)=>{const u=t(...c);return Z(n,u),u},()=>G(n,r)]}function yt(t,e){return e===!0?o.ref(t):o.shallowRef(t)}function wt(t){let e=0,n,r;const a=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...l)=>(e+=1,r||(r=o.effectScope(!0),n=r.run(()=>t(...l))),p(a),n)}function q(t,e,{enumerable:n=!1,unwrap:r=!0}={}){for(const[a,l]of Object.entries(e))a!=="value"&&(o.isRef(l)&&r?Object.defineProperty(t,a,{get(){return l.value},set(c){l.value=c},enumerable:n}):Object.defineProperty(t,a,{value:l,enumerable:n}));return t}function gt(t,e){return e==null?o.unref(t):o.unref(t)[e]}function Vt(t){return o.unref(t)!=null}function bt(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 _(t,e){const n=e?.computedGetter===!1?o.unref:o.toValue;return function(...r){return o.computed(()=>t.apply(this,r.map(a=>n(a))))}}function pt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:a=!0}=e;n.push(...Object.keys(t)),a&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(a=>{const l=t[a];return[a,typeof l=="function"?_(l.bind(t),r):l]}))}function J(t){if(!o.isRef(t))return o.reactive(t);const e=new Proxy({},{get(n,r,a){return o.unref(Reflect.get(t.value,r,a))},set(n,r,a){return o.isRef(t.value[r])&&!o.isRef(a)?t.value[r].value=a:t.value[r]=a,!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 o.reactive(e)}function N(t){return J(o.computed(t))}function At(t,...e){const n=e.flat(),r=n[0];return N(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,l])=>!r(o.toValue(l),a)):Object.entries(o.toRefs(t)).filter(a=>!n.includes(a[0]))))}const D=typeof window<"u"&&typeof document<"u",Ot=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,St=t=>typeof t<"u",Rt=t=>t!=null,Tt=(t,...e)=>{t||console.warn(...e)},Dt=Object.prototype.toString,X=t=>Dt.call(t)==="[object Object]",Ft=()=>Date.now(),K=()=>+Date.now(),Mt=(t,e,n)=>Math.min(n,Math.max(e,t)),A=()=>{},Pt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),It=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ct=kt();function kt(){var t,e;return D&&((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 I(...t){if(t.length!==1)return o.toRef(...t);const e=t[0];return typeof e=="function"?o.readonly(o.customRef(()=>({get:e,set:A}))):o.ref(e)}const Et=I;function _t(t,...e){const n=e.flat(),r=n[0];return N(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,l])=>r(o.toValue(l),a)):n.map(a=>[a,I(t,a)])))}function Q(t,e=1e4){return o.customRef((n,r)=>{let a=o.toValue(t),l;const c=()=>setTimeout(()=>{a=o.toValue(t),r()},o.toValue(e));return p(()=>{clearTimeout(l)}),{get(){return n(),a},set(u){a=u,r(),clearTimeout(l),l=c()}}})}function F(t,e){function n(...r){return new Promise((a,l)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(a).catch(l)})}return n}const C=t=>t();function L(t,e={}){let n,r,a=A;const l=s=>{clearTimeout(s),a(),a=A};let c;return s=>{const h=o.toValue(t),m=o.toValue(e.maxWait);return n&&l(n),h<=0||m!==void 0&&m<=0?(r&&(l(r),r=null),Promise.resolve(s())):new Promise((d,f)=>{a=e.rejectOnCancel?f:d,c=s,m&&!r&&(r=setTimeout(()=>{n&&l(n),r=null,d(c())},m)),n=setTimeout(()=>{r&&l(r),r=null,d(s())},h)})}}function j(...t){let e=0,n,r=!0,a=A,l,c,u,s,h;!o.isRef(t[0])&&typeof t[0]=="object"?{delay:c,trailing:u=!0,leading:s=!0,rejectOnCancel:h=!1}=t[0]:[c,u=!0,s=!0,h=!1]=t;const m=()=>{n&&(clearTimeout(n),n=void 0,a(),a=A)};return f=>{const y=o.toValue(c),g=Date.now()-e,V=()=>l=f();return m(),y<=0?(e=Date.now(),V()):(g>y&&(s||!r)?(e=Date.now(),V()):u&&(l=new Promise((w,b)=>{a=h?b:w,n=setTimeout(()=>{e=Date.now(),r=!0,w(V()),m()},Math.max(0,y-g))})),!s&&!n&&(n=setTimeout(()=>r=!0,y)),r=!1,l)}}function v(t=C,e={}){const{initialState:n="active"}=e,r=I(n==="active");function a(){r.value=!1}function l(){r.value=!0}const c=(...u)=>{r.value&&t(...u)};return{isActive:o.readonly(r),pause:a,resume:l,eventFilter:c}}function W(t,e=!1,n="Timeout"){return new Promise((r,a)=>{setTimeout(e?()=>a(n):r,t)})}function Nt(t){return t}function Lt(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 jt(t){return t()}function x(t,...e){return e.some(n=>n in t)}function Wt(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",a=t.slice(r.length),l=Number.parseFloat(r)+e;return Number.isNaN(l)?t:l+a}function Ut(t){return t.endsWith("rem")?Number.parseFloat(t)*16:Number.parseFloat(t)}function zt(t,e,n=!1){return e.reduce((r,a)=>(a in t&&(!n||t[a]!==void 0)&&(r[a]=t[a]),r),{})}function Bt(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,a])=>(!n||a!==void 0)&&!e.includes(r)))}function Yt(t){return Object.entries(t)}function tt(t){return Array.isArray(t)?t:[t]}function et(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const $t=/\B([A-Z])/g,Ht=et(t=>t.replace($t,"-$1").toLowerCase()),Gt=/-(\w)/g,Zt=et(t=>t.replace(Gt,(e,n)=>n?n.toUpperCase():""));function M(t){return t||o.getCurrentInstance()}function nt(t,e=200,n={}){return F(L(e,n),t)}function U(t,e=200,n={}){const r=o.ref(o.toValue(t)),a=nt(()=>{r.value=t.value},e,n);return o.watch(t,()=>a()),o.shallowReadonly(r)}function qt(t,e){return o.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function rt(t,e=200,n=!1,r=!0,a=!1){return F(j(e,n,r,a),t)}function z(t,e=200,n=!0,r=!0){if(e<=0)return t;const a=o.ref(o.toValue(t)),l=rt(()=>{a.value=t.value},e,n,r);return o.watch(t,()=>l()),a}function ot(t,e={}){let n=t,r,a;const l=o.customRef((f,y)=>(r=f,a=y,{get(){return c()},set(g){u(g)}}));function c(f=!0){return f&&r(),n}function u(f,y=!0){var g,V;if(f===n)return;const w=n;((g=e.onBeforeChange)==null?void 0:g.call(e,f,w))!==!1&&(n=f,(V=e.onChanged)==null||V.call(e,f,w),y&&a())}return q(l,{get:c,set:u,untrackedGet:()=>c(!1),silentSet:f=>u(f,!1),peek:()=>c(!1),lay:f=>u(f,!1)},{enumerable:!0})}const Jt=ot;function Xt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3){const[e,n,r]=t;e[n]=r}}function P(t,e,n={}){const{eventFilter:r=C,...a}=n;return o.watch(t,F(r,e),a)}function k(t,e,n={}){const{eventFilter:r,initialState:a="active",...l}=n,{eventFilter:c,pause:u,resume:s,isActive:h}=v(r,{initialState:a});return{stop:P(t,e,{...l,eventFilter:c}),pause:u,resume:s,isActive:h}}function Kt(t,e,...[n]){const{flush:r="sync",deep:a=!1,immediate:l=!0,direction:c="both",transform:u={}}=n||{},s=[],h="ltr"in u&&u.ltr||(f=>f),m="rtl"in u&&u.rtl||(f=>f);return(c==="both"||c==="ltr")&&s.push(k(t,f=>{s.forEach(y=>y.pause()),e.value=h(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:l})),(c==="both"||c==="rtl")&&s.push(k(e,f=>{s.forEach(y=>y.pause()),t.value=m(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:l})),()=>{s.forEach(f=>f.stop())}}function Qt(t,e,n={}){const{flush:r="sync",deep:a=!1,immediate:l=!0}=n,c=tt(e);return o.watch(t,u=>c.forEach(s=>s.value=u),{flush:r,deep:a,immediate:l})}function vt(t,e={}){if(!o.isRef(t))return o.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=o.customRef(()=>({get(){return t.value[r]},set(a){var l;if((l=o.toValue(e.replaceRef))!=null?l:!0)if(Array.isArray(t.value)){const u=[...t.value];u[r]=a,t.value=u}else{const u={...t.value,[r]:a};Object.setPrototypeOf(u,Object.getPrototypeOf(t.value)),t.value=u}else t.value[r]=a}}));return n}const xt=o.toValue,te=o.toValue;function ee(t,e=!0,n){M(n)?o.onBeforeMount(t,n):e?t():o.nextTick(t)}function ne(t,e){M(e)&&o.onBeforeUnmount(t,e)}function re(t,e=!0,n){M(n)?o.onMounted(t,n):e?t():o.nextTick(t)}function oe(t,e){M(e)&&o.onUnmounted(t,e)}function B(t,e=!1){function n(d,{flush:f="sync",deep:y=!1,timeout:g,throwOnTimeout:V}={}){let w=null;const R=[new Promise(E=>{w=o.watch(t,T=>{d(T)!==e&&(w?w():o.nextTick(()=>w?.()),E(T))},{flush:f,deep:y,immediate:!0})})];return g!=null&&R.push(W(g,V).then(()=>o.toValue(t)).finally(()=>w?.())),Promise.race(R)}function r(d,f){if(!o.isRef(d))return n(T=>T===d,f);const{flush:y="sync",deep:g=!1,timeout:V,throwOnTimeout:w}=f??{};let b=null;const E=[new Promise(T=>{b=o.watch([t,d],([ft,$e])=>{e!==(ft===$e)&&(b?b():o.nextTick(()=>b?.()),T(ft))},{flush:y,deep:g,immediate:!0})})];return V!=null&&E.push(W(V,w).then(()=>o.toValue(t)).finally(()=>(b?.(),o.toValue(t)))),Promise.race(E)}function a(d){return n(f=>!!f,d)}function l(d){return r(null,d)}function c(d){return r(void 0,d)}function u(d){return n(Number.isNaN,d)}function s(d,f){return n(y=>{const g=Array.from(y);return g.includes(d)||g.includes(o.toValue(d))},f)}function h(d){return m(1,d)}function m(d=1,f){let y=-1;return n(()=>(y+=1,y>=d),f)}return Array.isArray(o.toValue(t))?{toMatch:n,toContains:s,changed:h,changedTimes:m,get not(){return B(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:a,toBeNull:l,toBeNaN:u,toBeUndefined:c,changed:h,changedTimes:m,get not(){return B(t,!e)}}}function ae(t){return B(t)}function le(t,e){return t===e}function ie(...t){var e,n;const r=t[0],a=t[1];let l=(e=t[2])!=null?e:le;const{symmetric:c=!1}=(n=t[3])!=null?n:{};if(typeof l=="string"){const s=l;l=(h,m)=>h[s]===m[s]}const u=o.computed(()=>o.toValue(r).filter(s=>o.toValue(a).findIndex(h=>l(s,h))===-1));if(c){const s=o.computed(()=>o.toValue(a).filter(h=>o.toValue(r).findIndex(m=>l(h,m))===-1));return o.computed(()=>c?[...o.toValue(u),...o.toValue(s)]:o.toValue(u))}else return u}function ce(t,e){return o.computed(()=>o.toValue(t).every((n,r,a)=>e(o.toValue(n),r,a)))}function ue(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).filter(e))}function se(t,e){return o.computed(()=>o.toValue(o.toValue(t).find((n,r,a)=>e(o.toValue(n),r,a))))}function fe(t,e){return o.computed(()=>o.toValue(t).findIndex((n,r,a)=>e(o.toValue(n),r,a)))}function de(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function me(t,e){return o.computed(()=>o.toValue(Array.prototype.findLast?o.toValue(t).findLast((n,r,a)=>e(o.toValue(n),r,a)):de(o.toValue(t),(n,r,a)=>e(o.toValue(n),r,a))))}function he(t){return X(t)&&x(t,"formIndex","comparator")}function ye(...t){var e;const n=t[0],r=t[1];let a=t[2],l=0;if(he(a)&&(l=(e=a.fromIndex)!=null?e:0,a=a.comparator),typeof a=="string"){const c=a;a=(u,s)=>u[c]===o.toValue(s)}return a=a??((c,u)=>c===o.toValue(u)),o.computed(()=>o.toValue(n).slice(l).some((c,u,s)=>a(o.toValue(c),o.toValue(r),u,o.toValue(s))))}function we(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).join(o.toValue(e)))}function ge(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).map(e))}function Ve(t,e,...n){const r=(a,l,c)=>e(o.toValue(a),o.toValue(l),c);return o.computed(()=>{const a=o.toValue(t);return n.length?a.reduce(r,typeof n[0]=="function"?o.toValue(n[0]()):o.toValue(n[0])):a.reduce(r)})}function be(t,e){return o.computed(()=>o.toValue(t).some((n,r,a)=>e(o.toValue(n),r,a)))}function pe(t){return Array.from(new Set(t))}function Ae(t,e){return t.reduce((n,r)=>(n.some(a=>e(r,a,t))||n.push(r),n),[])}function Oe(t,e){return o.computed(()=>{const n=o.toValue(t).map(r=>o.toValue(r));return e?Ae(n,e):pe(n)})}function Se(t=0,e={}){let n=o.unref(t);const r=o.shallowRef(t),{max:a=Number.POSITIVE_INFINITY,min:l=Number.NEGATIVE_INFINITY}=e,c=(d=1)=>r.value=Math.max(Math.min(a,r.value+d),l),u=(d=1)=>r.value=Math.min(Math.max(l,r.value-d),a),s=()=>r.value,h=d=>r.value=Math.max(l,Math.min(a,d)),m=(d=n)=>(n=d,h(d));return{count:o.shallowReadonly(r),inc:c,dec:u,get:s,set:h,reset:m}}const Re=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,Te=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;function De(t,e,n,r){let a=t<12?"AM":"PM";return r&&(a=a.split("").reduce((l,c)=>l+=`${c}.`,"")),n?a.toLowerCase():a}function O(t){const e=["th","st","nd","rd"],n=t%100;return t+(e[(n-20)%10]||e[n]||e[0])}function at(t,e,n={}){var r;const a=t.getFullYear(),l=t.getMonth(),c=t.getDate(),u=t.getHours(),s=t.getMinutes(),h=t.getSeconds(),m=t.getMilliseconds(),d=t.getDay(),f=(r=n.customMeridiem)!=null?r:De,y=V=>{var w;return(w=V.split(" ")[1])!=null?w:""},g={Yo:()=>O(a),YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>l+1,Mo:()=>O(l+1),MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"short"}),MMMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"long"}),D:()=>String(c),Do:()=>O(c),DD:()=>`${c}`.padStart(2,"0"),H:()=>String(u),Ho:()=>O(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),ho:()=>O(u%12||12),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(s),mo:()=>O(s),mm:()=>`${s}`.padStart(2,"0"),s:()=>String(h),so:()=>O(h),ss:()=>`${h}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"short"}),dddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"long"}),A:()=>f(u,s),AA:()=>f(u,s,!1,!0),a:()=>f(u,s,!0),aa:()=>f(u,s,!0,!0),z:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zzz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zzzz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"longOffset"}))};return e.replace(Te,(V,w)=>{var b,R;return(R=w??((b=g[V])==null?void 0:b.call(g)))!=null?R:V})}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(Re);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 Fe(t,e="HH:mm:ss",n={}){return o.computed(()=>at(lt(o.toValue(t)),o.toValue(e),n))}function it(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n;let l=null;const c=o.shallowRef(!1);function u(){l&&(clearInterval(l),l=null)}function s(){c.value=!1,u()}function h(){const m=o.toValue(e);m<=0||(c.value=!0,a&&t(),u(),c.value&&(l=setInterval(t,m)))}if(r&&D&&h(),o.isRef(e)||typeof e=="function"){const m=o.watch(e,()=>{c.value&&D&&h()});p(m)}return p(s),{isActive:o.shallowReadonly(c),pause:s,resume:h}}function Me(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:a}=e,l=o.shallowRef(0),c=()=>l.value+=1,u=()=>{l.value=0},s=it(a?()=>{c(),a(l.value)}:c,t,{immediate:r});return n?{counter:o.shallowReadonly(l),reset:u,...s}:o.shallowReadonly(l)}function Pe(t,e={}){var n;const r=o.shallowRef((n=e.initialValue)!=null?n:null);return o.watch(t,()=>r.value=K(),e),o.shallowReadonly(r)}function ct(t,e,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n,l=o.shallowRef(!1);let c=null;function u(){c&&(clearTimeout(c),c=null)}function s(){l.value=!1,u()}function h(...m){a&&t(),u(),l.value=!0,c=setTimeout(()=>{l.value=!1,c=null,t(...m)},o.toValue(e))}return r&&(l.value=!0,D&&h()),p(s),{isPending:o.shallowReadonly(l),start:h,stop:s}}function Ie(t=1e3,e={}){const{controls:n=!1,callback:r}=e,a=ct(r??A,t,e),l=o.computed(()=>!a.isPending.value);return n?{ready:l,...a}:l}function Ce(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:a}=e;return o.computed(()=>{let l=o.toValue(t);return typeof n=="function"?l=n(l):typeof l=="string"&&(l=Number[n](l,r)),a&&Number.isNaN(l)&&(l=0),l})}function ke(t){return o.computed(()=>`${o.toValue(t)}`)}function Ee(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,a=o.isRef(t),l=o.shallowRef(t);function c(u){if(arguments.length)return l.value=u,l.value;{const s=o.toValue(n);return l.value=l.value===s?o.toValue(r):s,l.value}}return a?c:[l,c]}function _e(t,e,n){let r=n?.immediate?[]:[...typeof t=="function"?t():Array.isArray(t)?t:o.toValue(t)];return o.watch(t,(a,l,c)=>{const u=Array.from({length:r.length}),s=[];for(const m of a){let d=!1;for(let f=0;f<r.length;f++)if(!u[f]&&m===r[f]){u[f]=!0,d=!0;break}d||s.push(m)}const h=r.filter((m,d)=>!u[d]);e(a,r,s,h,c),r=[...a]},n)}function Ne(t,e,n){const{count:r,...a}=n,l=o.shallowRef(0),c=P(t,(...u)=>{l.value+=1,l.value>=o.toValue(r)&&o.nextTick(()=>c()),e(...u)},a);return{count:l,stop:c}}function ut(t,e,n={}){const{debounce:r=0,maxWait:a=void 0,...l}=n;return P(t,e,{...l,eventFilter:L(r,{maxWait:a})})}function Le(t,e,n){return o.watch(t,e,{...n,deep:!0})}function Y(t,e,n={}){const{eventFilter:r=C,...a}=n,l=F(r,e);let c,u,s;if(a.flush==="sync"){const h=o.shallowRef(!1);u=()=>{},c=m=>{h.value=!0,m(),h.value=!1},s=o.watch(t,(...m)=>{h.value||l(...m)},a)}else{const h=[],m=o.shallowRef(0),d=o.shallowRef(0);u=()=>{m.value=d.value},h.push(o.watch(t,()=>{d.value++},{...a,flush:"sync"})),c=f=>{const y=d.value;f(),m.value+=d.value-y},h.push(o.watch(t,(...f)=>{const y=m.value>0&&m.value===d.value;m.value=0,d.value=0,!y&&l(...f)},a)),s=()=>{h.forEach(f=>f())}}return{stop:s,ignoreUpdates:c,ignorePrevAsyncUpdates:u}}function je(t,e,n){return o.watch(t,e,{...n,immediate:!0})}function We(t,e,n){const r=o.watch(t,(...a)=>(o.nextTick(()=>r()),e(...a)),n);return r}function st(t,e,n={}){const{throttle:r=0,trailing:a=!0,leading:l=!0,...c}=n;return P(t,e,{...c,eventFilter:j(r,a,l)})}function Ue(t,e,n={}){let r;function a(){if(!r)return;const m=r;r=void 0,m()}function l(m){r=m}const c=(m,d)=>(a(),e(m,d,l)),u=Y(t,c,n),{ignoreUpdates:s}=u;return{...u,trigger:()=>{let m;return s(()=>{m=c(ze(t),Be(t))}),m}}}function ze(t){return o.isReactive(t)?t:Array.isArray(t)?t.map(e=>o.toValue(e)):o.toValue(t)}function Be(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Ye(t,e,n){const r=o.watch(t,(a,l,c)=>{a&&(n?.once&&o.nextTick(()=>r()),e(a,l,c))},{...n,once:!1});return r}i.assert=Tt,i.autoResetRef=Q,i.bypassFilter=C,i.camelize=Zt,i.clamp=Mt,i.computedEager=$,i.computedWithControl=H,i.containsProp=x,i.controlledComputed=H,i.controlledRef=Jt,i.createEventHook=dt,i.createFilterWrapper=F,i.createGlobalState=mt,i.createInjectionState=ht,i.createReactiveFn=_,i.createRef=yt,i.createSharedComposable=wt,i.createSingletonPromise=Lt,i.debounceFilter=L,i.debouncedRef=U,i.debouncedWatch=ut,i.eagerComputed=$,i.extendRef=q,i.formatDate=at,i.get=gt,i.getLifeCycleTarget=M,i.hasOwn=It,i.hyphenate=Ht,i.identity=Nt,i.ignorableWatch=Y,i.increaseWithUnit=Wt,i.injectLocal=G,i.invoke=jt,i.isClient=D,i.isDef=St,i.isDefined=Vt,i.isIOS=Ct,i.isObject=X,i.isWorker=Ot,i.makeDestructurable=bt,i.noop=A,i.normalizeDate=lt,i.notNullish=Rt,i.now=Ft,i.objectEntries=Yt,i.objectOmit=Bt,i.objectPick=zt,i.pausableFilter=v,i.pausableWatch=k,i.promiseTimeout=W,i.provideLocal=Z,i.pxValue=Ut,i.rand=Pt,i.reactify=_,i.reactifyObject=pt,i.reactiveComputed=N,i.reactiveOmit=At,i.reactivePick=_t,i.refAutoReset=Q,i.refDebounced=U,i.refDefault=qt,i.refThrottled=z,i.refWithControl=ot,i.resolveRef=Et,i.resolveUnref=te,i.set=Xt,i.syncRef=Kt,i.syncRefs=Qt,i.throttleFilter=j,i.throttledRef=z,i.throttledWatch=st,i.timestamp=K,i.toArray=tt,i.toReactive=J,i.toRef=I,i.toRefs=vt,i.toValue=xt,i.tryOnBeforeMount=ee,i.tryOnBeforeUnmount=ne,i.tryOnMounted=re,i.tryOnScopeDispose=p,i.tryOnUnmounted=oe,i.until=ae,i.useArrayDifference=ie,i.useArrayEvery=ce,i.useArrayFilter=ue,i.useArrayFind=se,i.useArrayFindIndex=fe,i.useArrayFindLast=me,i.useArrayIncludes=ye,i.useArrayJoin=we,i.useArrayMap=ge,i.useArrayReduce=Ve,i.useArraySome=be,i.useArrayUnique=Oe,i.useCounter=Se,i.useDateFormat=Fe,i.useDebounce=U,i.useDebounceFn=nt,i.useInterval=Me,i.useIntervalFn=it,i.useLastChanged=Pe,i.useThrottle=z,i.useThrottleFn=rt,i.useTimeout=Ie,i.useTimeoutFn=ct,i.useToNumber=Ce,i.useToString=ke,i.useToggle=Ee,i.watchArray=_e,i.watchAtMost=Ne,i.watchDebounced=ut,i.watchDeep=Le,i.watchIgnorable=Y,i.watchImmediate=je,i.watchOnce=We,i.watchPausable=k,i.watchThrottled=st,i.watchTriggerable=Ue,i.watchWithFilter=P,i.whenever=Ye})(this.VueUse=this.VueUse||{},Vue);
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowRef, watchEffect, readonly, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, ref, isRef, unref, toValue as toValue$1, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue';
|
|
1
|
+
import { shallowRef, watchEffect, readonly, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, ref, isRef, unref, toValue as toValue$1, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, shallowReadonly, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue';
|
|
2
2
|
|
|
3
3
|
function computedEager(fn, options) {
|
|
4
4
|
var _a;
|
|
@@ -107,7 +107,7 @@ const injectLocal = (...args) => {
|
|
|
107
107
|
return inject(...args);
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
function provideLocal(key, value) {
|
|
111
111
|
var _a;
|
|
112
112
|
const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
113
113
|
if (instance == null)
|
|
@@ -116,8 +116,8 @@ const provideLocal = (key, value) => {
|
|
|
116
116
|
localProvidedStateMap.set(instance, /* @__PURE__ */ Object.create(null));
|
|
117
117
|
const localProvidedState = localProvidedStateMap.get(instance);
|
|
118
118
|
localProvidedState[key] = value;
|
|
119
|
-
provide(key, value);
|
|
120
|
-
}
|
|
119
|
+
return provide(key, value);
|
|
120
|
+
}
|
|
121
121
|
|
|
122
122
|
function createInjectionState(composable, options) {
|
|
123
123
|
const key = (options == null ? void 0 : options.injectionKey) || Symbol(composable.name || "InjectionState");
|
|
@@ -314,6 +314,46 @@ function getIsIOS() {
|
|
|
314
314
|
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));
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
function toRef(...args) {
|
|
318
|
+
if (args.length !== 1)
|
|
319
|
+
return toRef$1(...args);
|
|
320
|
+
const r = args[0];
|
|
321
|
+
return typeof r === "function" ? readonly(customRef(() => ({ get: r, set: noop }))) : ref(r);
|
|
322
|
+
}
|
|
323
|
+
const resolveRef = toRef;
|
|
324
|
+
|
|
325
|
+
function reactivePick(obj, ...keys) {
|
|
326
|
+
const flatKeys = keys.flat();
|
|
327
|
+
const predicate = flatKeys[0];
|
|
328
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue$1(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
332
|
+
return customRef((track, trigger) => {
|
|
333
|
+
let value = toValue$1(defaultValue);
|
|
334
|
+
let timer;
|
|
335
|
+
const resetAfter = () => setTimeout(() => {
|
|
336
|
+
value = toValue$1(defaultValue);
|
|
337
|
+
trigger();
|
|
338
|
+
}, toValue$1(afterMs));
|
|
339
|
+
tryOnScopeDispose(() => {
|
|
340
|
+
clearTimeout(timer);
|
|
341
|
+
});
|
|
342
|
+
return {
|
|
343
|
+
get() {
|
|
344
|
+
track();
|
|
345
|
+
return value;
|
|
346
|
+
},
|
|
347
|
+
set(newValue) {
|
|
348
|
+
value = newValue;
|
|
349
|
+
trigger();
|
|
350
|
+
clearTimeout(timer);
|
|
351
|
+
timer = resetAfter();
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
317
357
|
function createFilterWrapper(filter, fn) {
|
|
318
358
|
function wrapper(...args) {
|
|
319
359
|
return new Promise((resolve, reject) => {
|
|
@@ -440,20 +480,6 @@ function pausableFilter(extendFilter = bypassFilter, options = {}) {
|
|
|
440
480
|
return { isActive: readonly(isActive), pause, resume, eventFilter };
|
|
441
481
|
}
|
|
442
482
|
|
|
443
|
-
function cacheStringFunction(fn) {
|
|
444
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
445
|
-
return (str) => {
|
|
446
|
-
const hit = cache[str];
|
|
447
|
-
return hit || (cache[str] = fn(str));
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
451
|
-
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
452
|
-
const camelizeRE = /-(\w)/g;
|
|
453
|
-
const camelize = cacheStringFunction((str) => {
|
|
454
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
455
|
-
});
|
|
456
|
-
|
|
457
483
|
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
458
484
|
return new Promise((resolve, reject) => {
|
|
459
485
|
if (throwOnTimeout)
|
|
@@ -517,51 +543,26 @@ function objectOmit(obj, keys, omitUndefined = false) {
|
|
|
517
543
|
function objectEntries(obj) {
|
|
518
544
|
return Object.entries(obj);
|
|
519
545
|
}
|
|
520
|
-
function getLifeCycleTarget(target) {
|
|
521
|
-
return target || getCurrentInstance();
|
|
522
|
-
}
|
|
523
546
|
function toArray(value) {
|
|
524
547
|
return Array.isArray(value) ? value : [value];
|
|
525
548
|
}
|
|
526
549
|
|
|
527
|
-
function
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
const resolveRef = toRef;
|
|
534
|
-
|
|
535
|
-
function reactivePick(obj, ...keys) {
|
|
536
|
-
const flatKeys = keys.flat();
|
|
537
|
-
const predicate = flatKeys[0];
|
|
538
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue$1(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
550
|
+
function cacheStringFunction(fn) {
|
|
551
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
552
|
+
return (str) => {
|
|
553
|
+
const hit = cache[str];
|
|
554
|
+
return hit || (cache[str] = fn(str));
|
|
555
|
+
};
|
|
539
556
|
}
|
|
557
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
558
|
+
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
559
|
+
const camelizeRE = /-(\w)/g;
|
|
560
|
+
const camelize = cacheStringFunction((str) => {
|
|
561
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
562
|
+
});
|
|
540
563
|
|
|
541
|
-
function
|
|
542
|
-
return
|
|
543
|
-
let value = toValue$1(defaultValue);
|
|
544
|
-
let timer;
|
|
545
|
-
const resetAfter = () => setTimeout(() => {
|
|
546
|
-
value = toValue$1(defaultValue);
|
|
547
|
-
trigger();
|
|
548
|
-
}, toValue$1(afterMs));
|
|
549
|
-
tryOnScopeDispose(() => {
|
|
550
|
-
clearTimeout(timer);
|
|
551
|
-
});
|
|
552
|
-
return {
|
|
553
|
-
get() {
|
|
554
|
-
track();
|
|
555
|
-
return value;
|
|
556
|
-
},
|
|
557
|
-
set(newValue) {
|
|
558
|
-
value = newValue;
|
|
559
|
-
trigger();
|
|
560
|
-
clearTimeout(timer);
|
|
561
|
-
timer = resetAfter();
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
});
|
|
564
|
+
function getLifeCycleTarget(target) {
|
|
565
|
+
return target || getCurrentInstance();
|
|
565
566
|
}
|
|
566
567
|
|
|
567
568
|
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
@@ -572,12 +573,12 @@ function useDebounceFn(fn, ms = 200, options = {}) {
|
|
|
572
573
|
}
|
|
573
574
|
|
|
574
575
|
function refDebounced(value, ms = 200, options = {}) {
|
|
575
|
-
const debounced = ref(value
|
|
576
|
+
const debounced = ref(toValue$1(value));
|
|
576
577
|
const updater = useDebounceFn(() => {
|
|
577
578
|
debounced.value = value.value;
|
|
578
579
|
}, ms, options);
|
|
579
580
|
watch(value, () => updater());
|
|
580
|
-
return debounced;
|
|
581
|
+
return shallowReadonly(debounced);
|
|
581
582
|
}
|
|
582
583
|
|
|
583
584
|
function refDefault(source, defaultValue) {
|
|
@@ -602,7 +603,7 @@ function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnC
|
|
|
602
603
|
function refThrottled(value, delay = 200, trailing = true, leading = true) {
|
|
603
604
|
if (delay <= 0)
|
|
604
605
|
return value;
|
|
605
|
-
const throttled = ref(value
|
|
606
|
+
const throttled = ref(toValue$1(value));
|
|
606
607
|
const updater = useThrottleFn(() => {
|
|
607
608
|
throttled.value = value.value;
|
|
608
609
|
}, delay, trailing, leading);
|
|
@@ -810,7 +811,7 @@ function tryOnBeforeUnmount(fn, target) {
|
|
|
810
811
|
}
|
|
811
812
|
|
|
812
813
|
function tryOnMounted(fn, sync = true, target) {
|
|
813
|
-
const instance = getLifeCycleTarget();
|
|
814
|
+
const instance = getLifeCycleTarget(target);
|
|
814
815
|
if (instance)
|
|
815
816
|
onMounted(fn, target);
|
|
816
817
|
else if (sync)
|
|
@@ -1084,7 +1085,7 @@ function useCounter(initialValue = 0, options = {}) {
|
|
|
1084
1085
|
_initialValue = val;
|
|
1085
1086
|
return set(val);
|
|
1086
1087
|
};
|
|
1087
|
-
return { count, inc, dec, get, set, reset };
|
|
1088
|
+
return { count: shallowReadonly(count), inc, dec, get, set, reset };
|
|
1088
1089
|
}
|
|
1089
1090
|
|
|
1090
1091
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
|
|
@@ -1218,7 +1219,7 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
1218
1219
|
}
|
|
1219
1220
|
tryOnScopeDispose(pause);
|
|
1220
1221
|
return {
|
|
1221
|
-
isActive,
|
|
1222
|
+
isActive: shallowReadonly(isActive),
|
|
1222
1223
|
pause,
|
|
1223
1224
|
resume
|
|
1224
1225
|
};
|
|
@@ -1245,12 +1246,12 @@ function useInterval(interval = 1e3, options = {}) {
|
|
|
1245
1246
|
);
|
|
1246
1247
|
if (exposeControls) {
|
|
1247
1248
|
return {
|
|
1248
|
-
counter,
|
|
1249
|
+
counter: shallowReadonly(counter),
|
|
1249
1250
|
reset,
|
|
1250
1251
|
...controls
|
|
1251
1252
|
};
|
|
1252
1253
|
} else {
|
|
1253
|
-
return counter;
|
|
1254
|
+
return shallowReadonly(counter);
|
|
1254
1255
|
}
|
|
1255
1256
|
}
|
|
1256
1257
|
|
|
@@ -1262,7 +1263,7 @@ function useLastChanged(source, options = {}) {
|
|
|
1262
1263
|
() => ms.value = timestamp(),
|
|
1263
1264
|
options
|
|
1264
1265
|
);
|
|
1265
|
-
return ms;
|
|
1266
|
+
return shallowReadonly(ms);
|
|
1266
1267
|
}
|
|
1267
1268
|
|
|
1268
1269
|
function useTimeoutFn(cb, interval, options = {}) {
|
|
@@ -1300,7 +1301,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1300
1301
|
}
|
|
1301
1302
|
tryOnScopeDispose(stop);
|
|
1302
1303
|
return {
|
|
1303
|
-
isPending:
|
|
1304
|
+
isPending: shallowReadonly(isPending),
|
|
1304
1305
|
start,
|
|
1305
1306
|
stop
|
|
1306
1307
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.1.0",
|
|
5
5
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/antfu",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
"*.js",
|
|
35
35
|
"*.mjs"
|
|
36
36
|
],
|
|
37
|
-
"
|
|
38
|
-
"vue": "^3.5.
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"vue": "^3.5.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build": "rollup --config=rollup.config.ts --configPlugin=rollup-plugin-esbuild"
|
|
41
|
+
"build": "rollup --config=rollup.config.ts --configPlugin=rollup-plugin-esbuild",
|
|
42
|
+
"test:attw": "attw --pack --config-path ../../.attw.json ."
|
|
42
43
|
}
|
|
43
44
|
}
|