@vueuse/shared 12.7.0 → 12.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +14 -5
- package/index.d.cts +30 -13
- package/index.d.mts +30 -13
- package/index.d.ts +30 -13
- package/index.iife.js +14 -5
- package/index.iife.min.js +1 -1
- package/index.mjs +15 -7
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -133,6 +133,14 @@ function createInjectionState(composable, options) {
|
|
|
133
133
|
return [useProvidingState, useInjectedState];
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
function createRef(value, deep) {
|
|
137
|
+
if (deep === true) {
|
|
138
|
+
return vue.ref(value);
|
|
139
|
+
} else {
|
|
140
|
+
return vue.shallowRef(value);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
136
144
|
function createSharedComposable(composable) {
|
|
137
145
|
let subscribers = 0;
|
|
138
146
|
let state;
|
|
@@ -745,10 +753,10 @@ function syncRefs(source, targets, options = {}) {
|
|
|
745
753
|
deep = false,
|
|
746
754
|
immediate = true
|
|
747
755
|
} = options;
|
|
748
|
-
|
|
756
|
+
const targetsArray = toArray(targets);
|
|
749
757
|
return vue.watch(
|
|
750
758
|
source,
|
|
751
|
-
(newValue) =>
|
|
759
|
+
(newValue) => targetsArray.forEach((target) => target.value = newValue),
|
|
752
760
|
{ flush, deep, immediate }
|
|
753
761
|
);
|
|
754
762
|
}
|
|
@@ -1065,7 +1073,7 @@ function useArrayUnique(list, compareFn) {
|
|
|
1065
1073
|
|
|
1066
1074
|
function useCounter(initialValue = 0, options = {}) {
|
|
1067
1075
|
let _initialValue = vue.unref(initialValue);
|
|
1068
|
-
const count = vue.
|
|
1076
|
+
const count = vue.shallowRef(initialValue);
|
|
1069
1077
|
const {
|
|
1070
1078
|
max = Number.POSITIVE_INFINITY,
|
|
1071
1079
|
min = Number.NEGATIVE_INFINITY
|
|
@@ -1250,7 +1258,7 @@ function useInterval(interval = 1e3, options = {}) {
|
|
|
1250
1258
|
|
|
1251
1259
|
function useLastChanged(source, options = {}) {
|
|
1252
1260
|
var _a;
|
|
1253
|
-
const ms = vue.
|
|
1261
|
+
const ms = vue.shallowRef((_a = options.initialValue) != null ? _a : null);
|
|
1254
1262
|
vue.watch(
|
|
1255
1263
|
source,
|
|
1256
1264
|
() => ms.value = timestamp(),
|
|
@@ -1349,7 +1357,7 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1349
1357
|
falsyValue = false
|
|
1350
1358
|
} = options;
|
|
1351
1359
|
const valueIsRef = vue.isRef(initialValue);
|
|
1352
|
-
const _value = vue.
|
|
1360
|
+
const _value = vue.shallowRef(initialValue);
|
|
1353
1361
|
function toggle(value) {
|
|
1354
1362
|
if (arguments.length) {
|
|
1355
1363
|
_value.value = value;
|
|
@@ -1616,6 +1624,7 @@ exports.createFilterWrapper = createFilterWrapper;
|
|
|
1616
1624
|
exports.createGlobalState = createGlobalState;
|
|
1617
1625
|
exports.createInjectionState = createInjectionState;
|
|
1618
1626
|
exports.createReactiveFn = reactify;
|
|
1627
|
+
exports.createRef = createRef;
|
|
1619
1628
|
exports.createSharedComposable = createSharedComposable;
|
|
1620
1629
|
exports.createSingletonPromise = createSingletonPromise;
|
|
1621
1630
|
exports.debounceFilter = debounceFilter;
|
package/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { WatchOptionsBase,
|
|
2
|
+
import { WatchOptionsBase, ShallowRef, WatchSource, ComputedGetter, ComputedRef, WritableComputedOptions, WritableComputedRef, WatchOptions, Ref, MaybeRef, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
3
|
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -10,9 +10,9 @@ export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
|
10
10
|
*
|
|
11
11
|
* @param fn effect function
|
|
12
12
|
* @param options WatchOptionsBase
|
|
13
|
-
* @returns readonly
|
|
13
|
+
* @returns readonly shallowRef
|
|
14
14
|
*/
|
|
15
|
-
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<
|
|
15
|
+
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<ShallowRef<T>>;
|
|
16
16
|
|
|
17
17
|
interface ComputedWithControlRefExtra {
|
|
18
18
|
/**
|
|
@@ -78,7 +78,7 @@ interface Pausable {
|
|
|
78
78
|
/**
|
|
79
79
|
* A ref indicate whether a pausable instance is active
|
|
80
80
|
*/
|
|
81
|
-
isActive: Readonly<
|
|
81
|
+
isActive: Readonly<ShallowRef<boolean>>;
|
|
82
82
|
/**
|
|
83
83
|
* Temporary pause the effect from executing
|
|
84
84
|
*/
|
|
@@ -309,7 +309,8 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
309
309
|
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
310
310
|
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
311
311
|
declare function getLifeCycleTarget(target?: any): any;
|
|
312
|
-
declare function toArray<T>(value: T
|
|
312
|
+
declare function toArray<T>(value: T | readonly T[]): readonly T[];
|
|
313
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
313
314
|
|
|
314
315
|
/**
|
|
315
316
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
@@ -337,6 +338,22 @@ interface CreateInjectionStateOptions<Return> {
|
|
|
337
338
|
*/
|
|
338
339
|
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
339
340
|
|
|
341
|
+
type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref<T> : ShallowRef<T>;
|
|
342
|
+
/**
|
|
343
|
+
* Returns a `deepRef` or `shallowRef` depending on the `deep` param.
|
|
344
|
+
*
|
|
345
|
+
* @example createRef(1) // ShallowRef<number>
|
|
346
|
+
* @example createRef(1, false) // ShallowRef<number>
|
|
347
|
+
* @example createRef(1, true) // Ref<number>
|
|
348
|
+
* @example createRef("string") // ShallowRef<string>
|
|
349
|
+
* @example createRef<"A"|"B">("A", true) // Ref<"A"|"B">
|
|
350
|
+
*
|
|
351
|
+
* @param value
|
|
352
|
+
* @param deep
|
|
353
|
+
* @returns the `deepRef` or `shallowRef`
|
|
354
|
+
*/
|
|
355
|
+
declare function createRef<T = any, D extends boolean = false>(value: T, deep?: D): ShallowOrDeepRef<T, D>;
|
|
356
|
+
|
|
340
357
|
/**
|
|
341
358
|
* Make a composable function usable with multiple Vue instances.
|
|
342
359
|
*
|
|
@@ -925,7 +942,7 @@ interface UseCounterOptions {
|
|
|
925
942
|
* @param options
|
|
926
943
|
*/
|
|
927
944
|
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
928
|
-
count: vue.Ref<number,
|
|
945
|
+
count: vue.Ref<number, number> | vue.ShallowRef<number, number> | vue.WritableComputedRef<number, number>;
|
|
929
946
|
inc: (delta?: number) => number;
|
|
930
947
|
dec: (delta?: number) => number;
|
|
931
948
|
get: () => number;
|
|
@@ -991,7 +1008,7 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
991
1008
|
callback?: (count: number) => void;
|
|
992
1009
|
}
|
|
993
1010
|
interface UseIntervalControls {
|
|
994
|
-
counter:
|
|
1011
|
+
counter: ShallowRef<number>;
|
|
995
1012
|
reset: () => void;
|
|
996
1013
|
}
|
|
997
1014
|
/**
|
|
@@ -1001,7 +1018,7 @@ interface UseIntervalControls {
|
|
|
1001
1018
|
* @param interval
|
|
1002
1019
|
* @param options
|
|
1003
1020
|
*/
|
|
1004
|
-
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>):
|
|
1021
|
+
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): ShallowRef<number>;
|
|
1005
1022
|
declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): UseIntervalControls & Pausable;
|
|
1006
1023
|
|
|
1007
1024
|
interface UseIntervalFnOptions {
|
|
@@ -1035,8 +1052,8 @@ interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends
|
|
|
1035
1052
|
*
|
|
1036
1053
|
* @see https://vueuse.org/useLastChanged
|
|
1037
1054
|
*/
|
|
1038
|
-
declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>):
|
|
1039
|
-
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>):
|
|
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>;
|
|
1040
1057
|
|
|
1041
1058
|
/**
|
|
1042
1059
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
@@ -1142,7 +1159,7 @@ interface UseToggleOptions<Truthy, Falsy> {
|
|
|
1142
1159
|
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
1143
1160
|
}
|
|
1144
1161
|
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
1145
|
-
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [
|
|
1162
|
+
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [ShallowRef<T>, (value?: T) => T];
|
|
1146
1163
|
|
|
1147
1164
|
declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, added: V, removed: OV, onCleanup: (cleanupFn: () => void) => void) => any;
|
|
1148
1165
|
/**
|
|
@@ -1163,7 +1180,7 @@ interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate
|
|
|
1163
1180
|
}
|
|
1164
1181
|
interface WatchAtMostReturn {
|
|
1165
1182
|
stop: WatchStopHandle;
|
|
1166
|
-
count:
|
|
1183
|
+
count: ShallowRef<number>;
|
|
1167
1184
|
}
|
|
1168
1185
|
declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
1169
1186
|
declare function watchAtMost<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
@@ -1240,4 +1257,4 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1240
1257
|
*/
|
|
1241
1258
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1242
1259
|
|
|
1243
|
-
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type PausableFilterOptions, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableOptions, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, 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 };
|
|
1260
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type PausableFilterOptions, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowOrDeepRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableOptions, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { WatchOptionsBase,
|
|
2
|
+
import { WatchOptionsBase, ShallowRef, WatchSource, ComputedGetter, ComputedRef, WritableComputedOptions, WritableComputedRef, WatchOptions, Ref, MaybeRef, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
3
|
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -10,9 +10,9 @@ export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
|
10
10
|
*
|
|
11
11
|
* @param fn effect function
|
|
12
12
|
* @param options WatchOptionsBase
|
|
13
|
-
* @returns readonly
|
|
13
|
+
* @returns readonly shallowRef
|
|
14
14
|
*/
|
|
15
|
-
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<
|
|
15
|
+
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<ShallowRef<T>>;
|
|
16
16
|
|
|
17
17
|
interface ComputedWithControlRefExtra {
|
|
18
18
|
/**
|
|
@@ -78,7 +78,7 @@ interface Pausable {
|
|
|
78
78
|
/**
|
|
79
79
|
* A ref indicate whether a pausable instance is active
|
|
80
80
|
*/
|
|
81
|
-
isActive: Readonly<
|
|
81
|
+
isActive: Readonly<ShallowRef<boolean>>;
|
|
82
82
|
/**
|
|
83
83
|
* Temporary pause the effect from executing
|
|
84
84
|
*/
|
|
@@ -309,7 +309,8 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
309
309
|
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
310
310
|
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
311
311
|
declare function getLifeCycleTarget(target?: any): any;
|
|
312
|
-
declare function toArray<T>(value: T
|
|
312
|
+
declare function toArray<T>(value: T | readonly T[]): readonly T[];
|
|
313
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
313
314
|
|
|
314
315
|
/**
|
|
315
316
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
@@ -337,6 +338,22 @@ interface CreateInjectionStateOptions<Return> {
|
|
|
337
338
|
*/
|
|
338
339
|
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
339
340
|
|
|
341
|
+
type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref<T> : ShallowRef<T>;
|
|
342
|
+
/**
|
|
343
|
+
* Returns a `deepRef` or `shallowRef` depending on the `deep` param.
|
|
344
|
+
*
|
|
345
|
+
* @example createRef(1) // ShallowRef<number>
|
|
346
|
+
* @example createRef(1, false) // ShallowRef<number>
|
|
347
|
+
* @example createRef(1, true) // Ref<number>
|
|
348
|
+
* @example createRef("string") // ShallowRef<string>
|
|
349
|
+
* @example createRef<"A"|"B">("A", true) // Ref<"A"|"B">
|
|
350
|
+
*
|
|
351
|
+
* @param value
|
|
352
|
+
* @param deep
|
|
353
|
+
* @returns the `deepRef` or `shallowRef`
|
|
354
|
+
*/
|
|
355
|
+
declare function createRef<T = any, D extends boolean = false>(value: T, deep?: D): ShallowOrDeepRef<T, D>;
|
|
356
|
+
|
|
340
357
|
/**
|
|
341
358
|
* Make a composable function usable with multiple Vue instances.
|
|
342
359
|
*
|
|
@@ -925,7 +942,7 @@ interface UseCounterOptions {
|
|
|
925
942
|
* @param options
|
|
926
943
|
*/
|
|
927
944
|
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
928
|
-
count: vue.Ref<number,
|
|
945
|
+
count: vue.Ref<number, number> | vue.ShallowRef<number, number> | vue.WritableComputedRef<number, number>;
|
|
929
946
|
inc: (delta?: number) => number;
|
|
930
947
|
dec: (delta?: number) => number;
|
|
931
948
|
get: () => number;
|
|
@@ -991,7 +1008,7 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
991
1008
|
callback?: (count: number) => void;
|
|
992
1009
|
}
|
|
993
1010
|
interface UseIntervalControls {
|
|
994
|
-
counter:
|
|
1011
|
+
counter: ShallowRef<number>;
|
|
995
1012
|
reset: () => void;
|
|
996
1013
|
}
|
|
997
1014
|
/**
|
|
@@ -1001,7 +1018,7 @@ interface UseIntervalControls {
|
|
|
1001
1018
|
* @param interval
|
|
1002
1019
|
* @param options
|
|
1003
1020
|
*/
|
|
1004
|
-
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>):
|
|
1021
|
+
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): ShallowRef<number>;
|
|
1005
1022
|
declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): UseIntervalControls & Pausable;
|
|
1006
1023
|
|
|
1007
1024
|
interface UseIntervalFnOptions {
|
|
@@ -1035,8 +1052,8 @@ interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends
|
|
|
1035
1052
|
*
|
|
1036
1053
|
* @see https://vueuse.org/useLastChanged
|
|
1037
1054
|
*/
|
|
1038
|
-
declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>):
|
|
1039
|
-
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>):
|
|
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>;
|
|
1040
1057
|
|
|
1041
1058
|
/**
|
|
1042
1059
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
@@ -1142,7 +1159,7 @@ interface UseToggleOptions<Truthy, Falsy> {
|
|
|
1142
1159
|
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
1143
1160
|
}
|
|
1144
1161
|
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
1145
|
-
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [
|
|
1162
|
+
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [ShallowRef<T>, (value?: T) => T];
|
|
1146
1163
|
|
|
1147
1164
|
declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, added: V, removed: OV, onCleanup: (cleanupFn: () => void) => void) => any;
|
|
1148
1165
|
/**
|
|
@@ -1163,7 +1180,7 @@ interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate
|
|
|
1163
1180
|
}
|
|
1164
1181
|
interface WatchAtMostReturn {
|
|
1165
1182
|
stop: WatchStopHandle;
|
|
1166
|
-
count:
|
|
1183
|
+
count: ShallowRef<number>;
|
|
1167
1184
|
}
|
|
1168
1185
|
declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
1169
1186
|
declare function watchAtMost<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
@@ -1240,4 +1257,4 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1240
1257
|
*/
|
|
1241
1258
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1242
1259
|
|
|
1243
|
-
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type PausableFilterOptions, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableOptions, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, 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 };
|
|
1260
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type PausableFilterOptions, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowOrDeepRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableOptions, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { WatchOptionsBase,
|
|
2
|
+
import { WatchOptionsBase, ShallowRef, WatchSource, ComputedGetter, ComputedRef, WritableComputedOptions, WritableComputedRef, WatchOptions, Ref, MaybeRef, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
3
|
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -10,9 +10,9 @@ export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
|
10
10
|
*
|
|
11
11
|
* @param fn effect function
|
|
12
12
|
* @param options WatchOptionsBase
|
|
13
|
-
* @returns readonly
|
|
13
|
+
* @returns readonly shallowRef
|
|
14
14
|
*/
|
|
15
|
-
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<
|
|
15
|
+
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<ShallowRef<T>>;
|
|
16
16
|
|
|
17
17
|
interface ComputedWithControlRefExtra {
|
|
18
18
|
/**
|
|
@@ -78,7 +78,7 @@ interface Pausable {
|
|
|
78
78
|
/**
|
|
79
79
|
* A ref indicate whether a pausable instance is active
|
|
80
80
|
*/
|
|
81
|
-
isActive: Readonly<
|
|
81
|
+
isActive: Readonly<ShallowRef<boolean>>;
|
|
82
82
|
/**
|
|
83
83
|
* Temporary pause the effect from executing
|
|
84
84
|
*/
|
|
@@ -309,7 +309,8 @@ declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T
|
|
|
309
309
|
declare function objectOmit<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Omit<O, T>;
|
|
310
310
|
declare function objectEntries<T extends object>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
311
311
|
declare function getLifeCycleTarget(target?: any): any;
|
|
312
|
-
declare function toArray<T>(value: T
|
|
312
|
+
declare function toArray<T>(value: T | readonly T[]): readonly T[];
|
|
313
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
313
314
|
|
|
314
315
|
/**
|
|
315
316
|
* Keep states in the global scope to be reusable across Vue instances.
|
|
@@ -337,6 +338,22 @@ interface CreateInjectionStateOptions<Return> {
|
|
|
337
338
|
*/
|
|
338
339
|
declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
|
|
339
340
|
|
|
341
|
+
type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref<T> : ShallowRef<T>;
|
|
342
|
+
/**
|
|
343
|
+
* Returns a `deepRef` or `shallowRef` depending on the `deep` param.
|
|
344
|
+
*
|
|
345
|
+
* @example createRef(1) // ShallowRef<number>
|
|
346
|
+
* @example createRef(1, false) // ShallowRef<number>
|
|
347
|
+
* @example createRef(1, true) // Ref<number>
|
|
348
|
+
* @example createRef("string") // ShallowRef<string>
|
|
349
|
+
* @example createRef<"A"|"B">("A", true) // Ref<"A"|"B">
|
|
350
|
+
*
|
|
351
|
+
* @param value
|
|
352
|
+
* @param deep
|
|
353
|
+
* @returns the `deepRef` or `shallowRef`
|
|
354
|
+
*/
|
|
355
|
+
declare function createRef<T = any, D extends boolean = false>(value: T, deep?: D): ShallowOrDeepRef<T, D>;
|
|
356
|
+
|
|
340
357
|
/**
|
|
341
358
|
* Make a composable function usable with multiple Vue instances.
|
|
342
359
|
*
|
|
@@ -925,7 +942,7 @@ interface UseCounterOptions {
|
|
|
925
942
|
* @param options
|
|
926
943
|
*/
|
|
927
944
|
declare function useCounter(initialValue?: MaybeRef<number>, options?: UseCounterOptions): {
|
|
928
|
-
count: vue.Ref<number,
|
|
945
|
+
count: vue.Ref<number, number> | vue.ShallowRef<number, number> | vue.WritableComputedRef<number, number>;
|
|
929
946
|
inc: (delta?: number) => number;
|
|
930
947
|
dec: (delta?: number) => number;
|
|
931
948
|
get: () => number;
|
|
@@ -991,7 +1008,7 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
991
1008
|
callback?: (count: number) => void;
|
|
992
1009
|
}
|
|
993
1010
|
interface UseIntervalControls {
|
|
994
|
-
counter:
|
|
1011
|
+
counter: ShallowRef<number>;
|
|
995
1012
|
reset: () => void;
|
|
996
1013
|
}
|
|
997
1014
|
/**
|
|
@@ -1001,7 +1018,7 @@ interface UseIntervalControls {
|
|
|
1001
1018
|
* @param interval
|
|
1002
1019
|
* @param options
|
|
1003
1020
|
*/
|
|
1004
|
-
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>):
|
|
1021
|
+
declare function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): ShallowRef<number>;
|
|
1005
1022
|
declare function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): UseIntervalControls & Pausable;
|
|
1006
1023
|
|
|
1007
1024
|
interface UseIntervalFnOptions {
|
|
@@ -1035,8 +1052,8 @@ interface UseLastChangedOptions<Immediate extends boolean, InitialValue extends
|
|
|
1035
1052
|
*
|
|
1036
1053
|
* @see https://vueuse.org/useLastChanged
|
|
1037
1054
|
*/
|
|
1038
|
-
declare function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>):
|
|
1039
|
-
declare function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>):
|
|
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>;
|
|
1040
1057
|
|
|
1041
1058
|
/**
|
|
1042
1059
|
* Throttle execution of a function. Especially useful for rate limiting
|
|
@@ -1142,7 +1159,7 @@ interface UseToggleOptions<Truthy, Falsy> {
|
|
|
1142
1159
|
falsyValue?: MaybeRefOrGetter<Falsy>;
|
|
1143
1160
|
}
|
|
1144
1161
|
declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(initialValue: Ref<T>, options?: UseToggleOptions<Truthy, Falsy>): (value?: T) => T;
|
|
1145
|
-
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [
|
|
1162
|
+
declare function useToggle<Truthy = true, Falsy = false, T = Truthy | Falsy>(initialValue?: T, options?: UseToggleOptions<Truthy, Falsy>): [ShallowRef<T>, (value?: T) => T];
|
|
1146
1163
|
|
|
1147
1164
|
declare type WatchArrayCallback<V = any, OV = any> = (value: V, oldValue: OV, added: V, removed: OV, onCleanup: (cleanupFn: () => void) => void) => any;
|
|
1148
1165
|
/**
|
|
@@ -1163,7 +1180,7 @@ interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Immediate
|
|
|
1163
1180
|
}
|
|
1164
1181
|
interface WatchAtMostReturn {
|
|
1165
1182
|
stop: WatchStopHandle;
|
|
1166
|
-
count:
|
|
1183
|
+
count: ShallowRef<number>;
|
|
1167
1184
|
}
|
|
1168
1185
|
declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
1169
1186
|
declare function watchAtMost<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn;
|
|
@@ -1240,4 +1257,4 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1240
1257
|
*/
|
|
1241
1258
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1242
1259
|
|
|
1243
|
-
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type PausableFilterOptions, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableOptions, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, 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 };
|
|
1260
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type PausableFilterOptions, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowOrDeepRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableOptions, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, 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 };
|
package/index.iife.js
CHANGED
|
@@ -132,6 +132,14 @@
|
|
|
132
132
|
return [useProvidingState, useInjectedState];
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
function createRef(value, deep) {
|
|
136
|
+
if (deep === true) {
|
|
137
|
+
return vue.ref(value);
|
|
138
|
+
} else {
|
|
139
|
+
return vue.shallowRef(value);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
135
143
|
function createSharedComposable(composable) {
|
|
136
144
|
let subscribers = 0;
|
|
137
145
|
let state;
|
|
@@ -744,10 +752,10 @@
|
|
|
744
752
|
deep = false,
|
|
745
753
|
immediate = true
|
|
746
754
|
} = options;
|
|
747
|
-
|
|
755
|
+
const targetsArray = toArray(targets);
|
|
748
756
|
return vue.watch(
|
|
749
757
|
source,
|
|
750
|
-
(newValue) =>
|
|
758
|
+
(newValue) => targetsArray.forEach((target) => target.value = newValue),
|
|
751
759
|
{ flush, deep, immediate }
|
|
752
760
|
);
|
|
753
761
|
}
|
|
@@ -1064,7 +1072,7 @@
|
|
|
1064
1072
|
|
|
1065
1073
|
function useCounter(initialValue = 0, options = {}) {
|
|
1066
1074
|
let _initialValue = vue.unref(initialValue);
|
|
1067
|
-
const count = vue.
|
|
1075
|
+
const count = vue.shallowRef(initialValue);
|
|
1068
1076
|
const {
|
|
1069
1077
|
max = Number.POSITIVE_INFINITY,
|
|
1070
1078
|
min = Number.NEGATIVE_INFINITY
|
|
@@ -1249,7 +1257,7 @@
|
|
|
1249
1257
|
|
|
1250
1258
|
function useLastChanged(source, options = {}) {
|
|
1251
1259
|
var _a;
|
|
1252
|
-
const ms = vue.
|
|
1260
|
+
const ms = vue.shallowRef((_a = options.initialValue) != null ? _a : null);
|
|
1253
1261
|
vue.watch(
|
|
1254
1262
|
source,
|
|
1255
1263
|
() => ms.value = timestamp(),
|
|
@@ -1348,7 +1356,7 @@
|
|
|
1348
1356
|
falsyValue = false
|
|
1349
1357
|
} = options;
|
|
1350
1358
|
const valueIsRef = vue.isRef(initialValue);
|
|
1351
|
-
const _value = vue.
|
|
1359
|
+
const _value = vue.shallowRef(initialValue);
|
|
1352
1360
|
function toggle(value) {
|
|
1353
1361
|
if (arguments.length) {
|
|
1354
1362
|
_value.value = value;
|
|
@@ -1615,6 +1623,7 @@
|
|
|
1615
1623
|
exports.createGlobalState = createGlobalState;
|
|
1616
1624
|
exports.createInjectionState = createInjectionState;
|
|
1617
1625
|
exports.createReactiveFn = reactify;
|
|
1626
|
+
exports.createRef = createRef;
|
|
1618
1627
|
exports.createSharedComposable = createSharedComposable;
|
|
1619
1628
|
exports.createSingletonPromise = createSingletonPromise;
|
|
1620
1629
|
exports.debounceFilter = debounceFilter;
|
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){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 wt(t,e){return e==null?o.unref(t):o.unref(t)[e]}function gt(t){return o.unref(t)!=null}function Vt(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 bt(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 pt(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",At=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Ot=t=>typeof t<"u",St=t=>t!=null,Tt=(t,...e)=>{t||console.warn(...e)},Dt=Object.prototype.toString,X=t=>Dt.call(t)==="[object Object]",Rt=()=>Date.now(),K=()=>+Date.now(),Ft=(t,e,n)=>Math.min(n,Math.max(e,t)),A=()=>{},Mt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),Pt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),It=Ct();function Ct(){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 v(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 Q(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const kt=/\B([A-Z])/g,Et=Q(t=>t.replace(kt,"-$1").toLowerCase()),_t=/-(\w)/g,Nt=Q(t=>t.replace(_t,(e,n)=>n?n.toUpperCase():""));function W(t,e=!1,n="Timeout"){return new Promise((r,a)=>{setTimeout(e?()=>a(n):r,t)})}function Lt(t){return t}function jt(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 Wt(t){return t()}function x(t,...e){return e.some(n=>n in t)}function Ut(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 zt(t){return t.endsWith("rem")?Number.parseFloat(t)*16:Number.parseFloat(t)}function Bt(t,e,n=!1){return e.reduce((r,a)=>(a in t&&(!n||t[a]!==void 0)&&(r[a]=t[a]),r),{})}function Yt(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,a])=>(!n||a!==void 0)&&!e.includes(r)))}function $t(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 Ht=C;function Gt(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 Zt(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 qt=ot;function Jt(...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}=v(r,{initialState:a});return{stop:P(t,e,{...l,eventFilter:c}),pause:u,resume:s,isActive:h}}function Xt(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 Kt(t,e,n={}){const{flush:r="sync",deep:a=!1,immediate:l=!0}=n;return e=tt(e),o.watch(t,c=>e.forEach(u=>u.value=c),{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 Qt=o.toValue,xt=o.toValue;function te(t,e=!0,n){M(n)?o.onBeforeMount(t,n):e?t():o.nextTick(t)}function ee(t,e){M(e)&&o.onBeforeUnmount(t,e)}function ne(t,e=!0,n){M()?o.onMounted(t,n):e?t():o.nextTick(t)}function re(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,Ye])=>{e!==(ft===Ye)&&(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 oe(t){return B(t)}function ae(t,e){return t===e}function le(...t){var e,n;const r=t[0],a=t[1];let l=(e=t[2])!=null?e:ae;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 ie(t,e){return o.computed(()=>o.toValue(t).every((n,r,a)=>e(o.toValue(n),r,a)))}function ce(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).filter(e))}function ue(t,e){return o.computed(()=>o.toValue(o.toValue(t).find((n,r,a)=>e(o.toValue(n),r,a))))}function se(t,e){return o.computed(()=>o.toValue(t).findIndex((n,r,a)=>e(o.toValue(n),r,a)))}function fe(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function de(t,e){return o.computed(()=>o.toValue(Array.prototype.findLast?o.toValue(t).findLast((n,r,a)=>e(o.toValue(n),r,a)):fe(o.toValue(t),(n,r,a)=>e(o.toValue(n),r,a))))}function me(t){return X(t)&&x(t,"formIndex","comparator")}function he(...t){var e;const n=t[0],r=t[1];let a=t[2],l=0;if(me(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 ye(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).join(o.toValue(e)))}function we(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).map(e))}function ge(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 Ve(t,e){return o.computed(()=>o.toValue(t).some((n,r,a)=>e(o.toValue(n),r,a)))}function be(t){return Array.from(new Set(t))}function pe(t,e){return t.reduce((n,r)=>(n.some(a=>e(r,a,t))||n.push(r),n),[])}function Ae(t,e){return o.computed(()=>{const n=o.toValue(t).map(r=>o.toValue(r));return e?pe(n,e):be(n)})}function Oe(t=0,e={}){let n=o.unref(t);const r=o.ref(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 Se=/^(\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,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(Se);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 Re(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 Fe(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 Me(t,e={}){var n;const r=o.ref((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 Pe(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 Ie(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 Ce(t){return o.computed(()=>`${o.toValue(t)}`)}function ke(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,a=o.isRef(t),l=o.ref(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 Ee(t,e,n){let r=n?.immediate?[]:[...t instanceof 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 _e(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 Ne(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 Le(t,e,n){return o.watch(t,e,{...n,immediate:!0})}function je(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 We(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(Ue(t),ze(t))}),m}}}function Ue(t){return o.isReactive(t)?t:Array.isArray(t)?t.map(e=>o.toValue(e)):o.toValue(t)}function ze(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Be(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=et,i.bypassFilter=I,i.camelize=Nt,i.clamp=Ft,i.computedEager=$,i.computedWithControl=H,i.containsProp=x,i.controlledComputed=H,i.controlledRef=qt,i.createEventHook=dt,i.createFilterWrapper=F,i.createGlobalState=mt,i.createInjectionState=ht,i.createReactiveFn=_,i.createSharedComposable=yt,i.createSingletonPromise=jt,i.debounceFilter=L,i.debouncedRef=U,i.debouncedWatch=ut,i.eagerComputed=$,i.extendRef=q,i.formatDate=at,i.get=wt,i.getLifeCycleTarget=M,i.hasOwn=Pt,i.hyphenate=Et,i.identity=Lt,i.ignorableWatch=Y,i.increaseWithUnit=Ut,i.injectLocal=G,i.invoke=Wt,i.isClient=R,i.isDef=Ot,i.isDefined=gt,i.isIOS=It,i.isObject=X,i.isWorker=At,i.makeDestructurable=Vt,i.noop=A,i.normalizeDate=lt,i.notNullish=St,i.now=Rt,i.objectEntries=$t,i.objectOmit=Yt,i.objectPick=Bt,i.pausableFilter=v,i.pausableWatch=k,i.promiseTimeout=W,i.provideLocal=Z,i.pxValue=zt,i.rand=Mt,i.reactify=_,i.reactifyObject=bt,i.reactiveComputed=N,i.reactiveOmit=pt,i.reactivePick=Gt,i.refAutoReset=et,i.refDebounced=U,i.refDefault=Zt,i.refThrottled=z,i.refWithControl=ot,i.resolveRef=Ht,i.resolveUnref=xt,i.set=Jt,i.syncRef=Xt,i.syncRefs=Kt,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=Qt,i.tryOnBeforeMount=te,i.tryOnBeforeUnmount=ee,i.tryOnMounted=ne,i.tryOnScopeDispose=p,i.tryOnUnmounted=re,i.until=oe,i.useArrayDifference=le,i.useArrayEvery=ie,i.useArrayFilter=ce,i.useArrayFind=ue,i.useArrayFindIndex=se,i.useArrayFindLast=de,i.useArrayIncludes=he,i.useArrayJoin=ye,i.useArrayMap=we,i.useArrayReduce=ge,i.useArraySome=Ve,i.useArrayUnique=Ae,i.useCounter=Oe,i.useDateFormat=Re,i.useDebounce=U,i.useDebounceFn=nt,i.useInterval=Fe,i.useIntervalFn=it,i.useLastChanged=Me,i.useThrottle=z,i.useThrottleFn=rt,i.useTimeout=Pe,i.useTimeoutFn=ct,i.useToNumber=Ie,i.useToString=Ce,i.useToggle=ke,i.watchArray=Ee,i.watchAtMost=_e,i.watchDebounced=ut,i.watchDeep=Ne,i.watchIgnorable=Y,i.watchImmediate=Le,i.watchOnce=je,i.watchPausable=k,i.watchThrottled=st,i.watchTriggerable=We,i.watchWithFilter=P,i.whenever=Be})(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)},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?[]:[...t instanceof 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);
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowRef, watchEffect, readonly, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, isRef, unref, toValue as toValue$1, computed, reactive, toRefs as toRefs$1, toRef as toRef$1,
|
|
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';
|
|
2
2
|
|
|
3
3
|
function computedEager(fn, options) {
|
|
4
4
|
var _a;
|
|
@@ -131,6 +131,14 @@ function createInjectionState(composable, options) {
|
|
|
131
131
|
return [useProvidingState, useInjectedState];
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
function createRef(value, deep) {
|
|
135
|
+
if (deep === true) {
|
|
136
|
+
return ref(value);
|
|
137
|
+
} else {
|
|
138
|
+
return shallowRef(value);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
134
142
|
function createSharedComposable(composable) {
|
|
135
143
|
let subscribers = 0;
|
|
136
144
|
let state;
|
|
@@ -743,10 +751,10 @@ function syncRefs(source, targets, options = {}) {
|
|
|
743
751
|
deep = false,
|
|
744
752
|
immediate = true
|
|
745
753
|
} = options;
|
|
746
|
-
|
|
754
|
+
const targetsArray = toArray(targets);
|
|
747
755
|
return watch(
|
|
748
756
|
source,
|
|
749
|
-
(newValue) =>
|
|
757
|
+
(newValue) => targetsArray.forEach((target) => target.value = newValue),
|
|
750
758
|
{ flush, deep, immediate }
|
|
751
759
|
);
|
|
752
760
|
}
|
|
@@ -1063,7 +1071,7 @@ function useArrayUnique(list, compareFn) {
|
|
|
1063
1071
|
|
|
1064
1072
|
function useCounter(initialValue = 0, options = {}) {
|
|
1065
1073
|
let _initialValue = unref(initialValue);
|
|
1066
|
-
const count =
|
|
1074
|
+
const count = shallowRef(initialValue);
|
|
1067
1075
|
const {
|
|
1068
1076
|
max = Number.POSITIVE_INFINITY,
|
|
1069
1077
|
min = Number.NEGATIVE_INFINITY
|
|
@@ -1248,7 +1256,7 @@ function useInterval(interval = 1e3, options = {}) {
|
|
|
1248
1256
|
|
|
1249
1257
|
function useLastChanged(source, options = {}) {
|
|
1250
1258
|
var _a;
|
|
1251
|
-
const ms =
|
|
1259
|
+
const ms = shallowRef((_a = options.initialValue) != null ? _a : null);
|
|
1252
1260
|
watch(
|
|
1253
1261
|
source,
|
|
1254
1262
|
() => ms.value = timestamp(),
|
|
@@ -1347,7 +1355,7 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1347
1355
|
falsyValue = false
|
|
1348
1356
|
} = options;
|
|
1349
1357
|
const valueIsRef = isRef(initialValue);
|
|
1350
|
-
const _value =
|
|
1358
|
+
const _value = shallowRef(initialValue);
|
|
1351
1359
|
function toggle(value) {
|
|
1352
1360
|
if (arguments.length) {
|
|
1353
1361
|
_value.value = value;
|
|
@@ -1599,4 +1607,4 @@ function whenever(source, cb, options) {
|
|
|
1599
1607
|
return stop;
|
|
1600
1608
|
}
|
|
1601
1609
|
|
|
1602
|
-
export { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, 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 };
|
|
1610
|
+
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 };
|