@vueuse/shared 12.0.0-beta.1 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -61,6 +61,9 @@ function createEventHook() {
61
61
  const off = (fn) => {
62
62
  fns.delete(fn);
63
63
  };
64
+ const clear = () => {
65
+ fns.clear();
66
+ };
64
67
  const on = (fn) => {
65
68
  fns.add(fn);
66
69
  const offFn = () => off(fn);
@@ -75,7 +78,8 @@ function createEventHook() {
75
78
  return {
76
79
  on,
77
80
  off,
78
- trigger
81
+ trigger,
82
+ clear
79
83
  };
80
84
  }
81
85
 
@@ -98,9 +102,9 @@ const injectLocal = (...args) => {
98
102
  var _a;
99
103
  const key = args[0];
100
104
  const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
101
- if (instance == null)
105
+ if (instance == null && !vue.hasInjectionContext())
102
106
  throw new Error("injectLocal must be called in setup");
103
- if (localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
107
+ if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
104
108
  return localProvidedStateMap.get(instance)[key];
105
109
  return vue.inject(...args);
106
110
  };
@@ -487,6 +491,9 @@ function increaseWithUnit(target, delta) {
487
491
  return target;
488
492
  return result + unit;
489
493
  }
494
+ function pxValue(px) {
495
+ return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
496
+ }
490
497
  function objectPick(obj, keys, omitUndefined = false) {
491
498
  return keys.reduce((n, k) => {
492
499
  if (k in obj) {
@@ -1616,6 +1623,7 @@ exports.pausableFilter = pausableFilter;
1616
1623
  exports.pausableWatch = watchPausable;
1617
1624
  exports.promiseTimeout = promiseTimeout;
1618
1625
  exports.provideLocal = provideLocal;
1626
+ exports.pxValue = pxValue;
1619
1627
  exports.rand = rand;
1620
1628
  exports.reactify = reactify;
1621
1629
  exports.reactifyObject = reactifyObject;
package/index.d.cts CHANGED
@@ -152,6 +152,7 @@ interface EventHook<T = any> {
152
152
  on: EventHookOn<T>;
153
153
  off: EventHookOff<T>;
154
154
  trigger: EventHookTrigger<T>;
155
+ clear: () => void;
155
156
  }
156
157
  /**
157
158
  * Utility for creating event hooks
@@ -286,6 +287,10 @@ declare function containsProp(obj: object, ...props: string[]): boolean;
286
287
  declare function increaseWithUnit(target: number, delta: number): number;
287
288
  declare function increaseWithUnit(target: string, delta: number): string;
288
289
  declare function increaseWithUnit(target: string | number, delta: number): string | number;
290
+ /**
291
+ * Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
292
+ */
293
+ declare function pxValue(px: string): number;
289
294
  /**
290
295
  * Create a new subset object by giving keys
291
296
  */
@@ -1206,4 +1211,4 @@ interface WheneverOptions extends WatchOptions {
1206
1211
  */
1207
1212
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
1208
1213
 
1209
- 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 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 UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type 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, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1214
+ 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 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 UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type 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, 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
@@ -152,6 +152,7 @@ interface EventHook<T = any> {
152
152
  on: EventHookOn<T>;
153
153
  off: EventHookOff<T>;
154
154
  trigger: EventHookTrigger<T>;
155
+ clear: () => void;
155
156
  }
156
157
  /**
157
158
  * Utility for creating event hooks
@@ -286,6 +287,10 @@ declare function containsProp(obj: object, ...props: string[]): boolean;
286
287
  declare function increaseWithUnit(target: number, delta: number): number;
287
288
  declare function increaseWithUnit(target: string, delta: number): string;
288
289
  declare function increaseWithUnit(target: string | number, delta: number): string | number;
290
+ /**
291
+ * Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
292
+ */
293
+ declare function pxValue(px: string): number;
289
294
  /**
290
295
  * Create a new subset object by giving keys
291
296
  */
@@ -1206,4 +1211,4 @@ interface WheneverOptions extends WatchOptions {
1206
1211
  */
1207
1212
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
1208
1213
 
1209
- 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 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 UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type 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, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1214
+ 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 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 UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type 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, 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
@@ -152,6 +152,7 @@ interface EventHook<T = any> {
152
152
  on: EventHookOn<T>;
153
153
  off: EventHookOff<T>;
154
154
  trigger: EventHookTrigger<T>;
155
+ clear: () => void;
155
156
  }
156
157
  /**
157
158
  * Utility for creating event hooks
@@ -286,6 +287,10 @@ declare function containsProp(obj: object, ...props: string[]): boolean;
286
287
  declare function increaseWithUnit(target: number, delta: number): number;
287
288
  declare function increaseWithUnit(target: string, delta: number): string;
288
289
  declare function increaseWithUnit(target: string | number, delta: number): string | number;
290
+ /**
291
+ * Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
292
+ */
293
+ declare function pxValue(px: string): number;
289
294
  /**
290
295
  * Create a new subset object by giving keys
291
296
  */
@@ -1206,4 +1211,4 @@ interface WheneverOptions extends WatchOptions {
1206
1211
  */
1207
1212
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
1208
1213
 
1209
- 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 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 UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type 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, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1214
+ 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 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 UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type 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, 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
@@ -60,6 +60,9 @@
60
60
  const off = (fn) => {
61
61
  fns.delete(fn);
62
62
  };
63
+ const clear = () => {
64
+ fns.clear();
65
+ };
63
66
  const on = (fn) => {
64
67
  fns.add(fn);
65
68
  const offFn = () => off(fn);
@@ -74,7 +77,8 @@
74
77
  return {
75
78
  on,
76
79
  off,
77
- trigger
80
+ trigger,
81
+ clear
78
82
  };
79
83
  }
80
84
 
@@ -97,9 +101,9 @@
97
101
  var _a;
98
102
  const key = args[0];
99
103
  const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
100
- if (instance == null)
104
+ if (instance == null && !vue.hasInjectionContext())
101
105
  throw new Error("injectLocal must be called in setup");
102
- if (localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
106
+ if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
103
107
  return localProvidedStateMap.get(instance)[key];
104
108
  return vue.inject(...args);
105
109
  };
@@ -486,6 +490,9 @@
486
490
  return target;
487
491
  return result + unit;
488
492
  }
493
+ function pxValue(px) {
494
+ return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
495
+ }
489
496
  function objectPick(obj, keys, omitUndefined = false) {
490
497
  return keys.reduce((n, k) => {
491
498
  if (k in obj) {
@@ -1615,6 +1622,7 @@
1615
1622
  exports.pausableWatch = watchPausable;
1616
1623
  exports.promiseTimeout = promiseTimeout;
1617
1624
  exports.provideLocal = provideLocal;
1625
+ exports.pxValue = pxValue;
1618
1626
  exports.rand = rand;
1619
1627
  exports.reactify = reactify;
1620
1628
  exports.reactifyObject = reactifyObject;
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- (function(o,u){"use strict";function H(e,t){var n;const r=u.shallowRef();return u.watchEffect(()=>{r.value=e()},{...t,flush:(n=t?.flush)!=null?n:"sync"}),u.readonly(r)}function G(e,t){let n,r,i;const c=u.ref(!0),l=()=>{c.value=!0,i()};u.watch(e,l,{flush:"sync"});const a=typeof t=="function"?t:t.get,f=typeof t=="function"?void 0:t.set,y=u.customRef((h,m)=>(r=h,i=m,{get(){return c.value&&(n=a(n),c.value=!1),r(),n},set(d){f?.(d)}}));return Object.isExtensible(y)&&(y.trigger=l),y}function A(e){return u.getCurrentScope()?(u.onScopeDispose(e),!0):!1}function de(){const e=new Set,t=i=>{e.delete(i)};return{on:i=>{e.add(i);const c=()=>t(i);return A(c),{off:c}},off:t,trigger:(...i)=>Promise.all(Array.from(e).map(c=>c(...i)))}}function me(e){let t=!1,n;const r=u.effectScope(!0);return(...i)=>(t||(n=r.run(()=>e(...i)),t=!0),n)}const T=new WeakMap,z=(...e)=>{var t;const n=e[0],r=(t=u.getCurrentInstance())==null?void 0:t.proxy;if(r==null)throw new Error("injectLocal must be called in setup");return T.has(r)&&n in T.get(r)?T.get(r)[n]:u.inject(...e)},q=(e,t)=>{var n;const r=(n=u.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");T.has(r)||T.set(r,Object.create(null));const i=T.get(r);i[e]=t,u.provide(e,t)};function he(e,t){const n=t?.injectionKey||Symbol(e.name||"InjectionState"),r=t?.defaultValue;return[(...l)=>{const a=e(...l);return q(n,a),a},()=>z(n,r)]}function ye(e){let t=0,n,r;const i=()=>{t-=1,r&&t<=0&&(r.stop(),n=void 0,r=void 0)};return(...c)=>(t+=1,r||(r=u.effectScope(!0),n=r.run(()=>e(...c))),A(i),n)}function Z(e,t,{enumerable:n=!1,unwrap:r=!0}={}){for(const[i,c]of Object.entries(t))i!=="value"&&(u.isRef(c)&&r?Object.defineProperty(e,i,{get(){return c.value},set(l){c.value=l},enumerable:n}):Object.defineProperty(e,i,{value:c,enumerable:n}));return e}function ge(e,t){return t==null?u.unref(e):u.unref(e)[t]}function we(e){return u.unref(e)!=null}function be(e,t){if(typeof Symbol<"u"){const n={...e};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:t[r++],done:r>t.length})}}}),n}else return Object.assign([...t],e)}function s(e){return typeof e=="function"?e():u.unref(e)}const pe=s;function E(e,t){const n=t?.computedGetter===!1?u.unref:s;return function(...r){return u.computed(()=>e.apply(this,r.map(i=>n(i))))}}function ve(e,t={}){let n=[],r;if(Array.isArray(t))n=t;else{r=t;const{includeOwnProperties:i=!0}=t;n.push(...Object.keys(e)),i&&n.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(n.map(i=>{const c=e[i];return[i,typeof c=="function"?E(c.bind(e),r):c]}))}function J(e){if(!u.isRef(e))return u.reactive(e);const t=new Proxy({},{get(n,r,i){return u.unref(Reflect.get(e.value,r,i))},set(n,r,i){return u.isRef(e.value[r])&&!u.isRef(i)?e.value[r].value=i:e.value[r]=i,!0},deleteProperty(n,r){return Reflect.deleteProperty(e.value,r)},has(n,r){return Reflect.has(e.value,r)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return u.reactive(t)}function _(e){return J(u.computed(e))}function Ae(e,...t){const n=t.flat(),r=n[0];return _(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(e)).filter(([i,c])=>!r(s(c),i)):Object.entries(u.toRefs(e)).filter(i=>!n.includes(i[0]))))}const F=typeof window<"u"&&typeof document<"u",Oe=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Se=e=>typeof e<"u",Te=e=>e!=null,De=(e,...t)=>{e||console.warn(...t)},Fe=Object.prototype.toString,X=e=>Fe.call(e)==="[object Object]",Me=()=>Date.now(),K=()=>+Date.now(),Pe=(e,t,n)=>Math.min(n,Math.max(t,e)),O=()=>{},Re=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),Ie=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ce=ke();function ke(){var e,t;return F&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function M(e,t){function n(...r){return new Promise((i,c)=>{Promise.resolve(e(()=>t.apply(this,r),{fn:t,thisArg:this,args:r})).then(i).catch(c)})}return n}const I=e=>e();function j(e,t={}){let n,r,i=O;const c=a=>{clearTimeout(a),i(),i=O};return a=>{const f=s(e),y=s(t.maxWait);return n&&c(n),f<=0||y!==void 0&&y<=0?(r&&(c(r),r=null),Promise.resolve(a())):new Promise((h,m)=>{i=t.rejectOnCancel?m:h,y&&!r&&(r=setTimeout(()=>{n&&c(n),r=null,h(a())},y)),n=setTimeout(()=>{r&&c(r),r=null,h(a())},f)})}}function L(...e){let t=0,n,r=!0,i=O,c,l,a,f,y;!u.isRef(e[0])&&typeof e[0]=="object"?{delay:l,trailing:a=!0,leading:f=!0,rejectOnCancel:y=!1}=e[0]:[l,a=!0,f=!0,y=!1]=e;const h=()=>{n&&(clearTimeout(n),n=void 0,i(),i=O)};return d=>{const g=s(l),w=Date.now()-t,p=()=>c=d();return h(),g<=0?(t=Date.now(),p()):(w>g&&(f||!r)?(t=Date.now(),p()):a&&(c=new Promise((b,v)=>{i=y?v:b,n=setTimeout(()=>{t=Date.now(),r=!0,b(p()),h()},Math.max(0,g-w))})),!f&&!n&&(n=setTimeout(()=>r=!0,g)),r=!1,c)}}function Q(e=I){const t=u.ref(!0);function n(){t.value=!1}function r(){t.value=!0}const i=(...c)=>{t.value&&e(...c)};return{isActive:u.readonly(t),pause:n,resume:r,eventFilter:i}}function x(e){const t=Object.create(null);return n=>t[n]||(t[n]=e(n))}const Ee=/\B([A-Z])/g,_e=x(e=>e.replace(Ee,"-$1").toLowerCase()),je=/-(\w)/g,Le=x(e=>e.replace(je,(t,n)=>n?n.toUpperCase():""));function N(e,t=!1,n="Timeout"){return new Promise((r,i)=>{setTimeout(t?()=>i(n):r,e)})}function Ne(e){return e}function We(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const r=t;t=void 0,r&&await r},n}function Ue(e){return e()}function ee(e,...t){return t.some(n=>n in e)}function Be(e,t){var n;if(typeof e=="number")return e+t;const r=((n=e.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",i=e.slice(r.length),c=Number.parseFloat(r)+t;return Number.isNaN(c)?e:c+i}function Ve(e,t,n=!1){return t.reduce((r,i)=>(i in e&&(!n||e[i]!==void 0)&&(r[i]=e[i]),r),{})}function Ye(e,t,n=!1){return Object.fromEntries(Object.entries(e).filter(([r,i])=>(!n||i!==void 0)&&!t.includes(r)))}function $e(e){return Object.entries(e)}function P(e){return e||u.getCurrentInstance()}function W(...e){if(e.length!==1)return u.toRef(...e);const t=e[0];return typeof t=="function"?u.readonly(u.customRef(()=>({get:t,set:O}))):u.ref(t)}const He=W;function Ge(e,...t){const n=t.flat(),r=n[0];return _(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(e)).filter(([i,c])=>r(s(c),i)):n.map(i=>[i,W(e,i)])))}function te(e,t=1e4){return u.customRef((n,r)=>{let i=s(e),c;const l=()=>setTimeout(()=>{i=s(e),r()},s(t));return A(()=>{clearTimeout(c)}),{get(){return n(),i},set(a){i=a,r(),clearTimeout(c),c=l()}}})}function ne(e,t=200,n={}){return M(j(t,n),e)}function U(e,t=200,n={}){const r=u.ref(e.value),i=ne(()=>{r.value=e.value},t,n);return u.watch(e,()=>i()),r}function ze(e,t){return u.computed({get(){var n;return(n=e.value)!=null?n:t},set(n){e.value=n}})}function re(e,t=200,n=!1,r=!0,i=!1){return M(L(t,n,r,i),e)}function B(e,t=200,n=!0,r=!0){if(t<=0)return e;const i=u.ref(e.value),c=re(()=>{i.value=e.value},t,n,r);return u.watch(e,()=>c()),i}function ie(e,t={}){let n=e,r,i;const c=u.customRef((d,g)=>(r=d,i=g,{get(){return l()},set(w){a(w)}}));function l(d=!0){return d&&r(),n}function a(d,g=!0){var w,p;if(d===n)return;const b=n;((w=t.onBeforeChange)==null?void 0:w.call(t,d,b))!==!1&&(n=d,(p=t.onChanged)==null||p.call(t,d,b),g&&i())}return Z(c,{get:l,set:a,untrackedGet:()=>l(!1),silentSet:d=>a(d,!1),peek:()=>l(!1),lay:d=>a(d,!1)},{enumerable:!0})}const qe=ie;function Ze(...e){if(e.length===2){const[t,n]=e;t.value=n}if(e.length===3){const[t,n,r]=e;t[n]=r}}function R(e,t,n={}){const{eventFilter:r=I,...i}=n;return u.watch(e,M(r,t),i)}function C(e,t,n={}){const{eventFilter:r,...i}=n,{eventFilter:c,pause:l,resume:a,isActive:f}=Q(r);return{stop:R(e,t,{...i,eventFilter:c}),pause:l,resume:a,isActive:f}}function Je(e,t,...[n]){const{flush:r="sync",deep:i=!1,immediate:c=!0,direction:l="both",transform:a={}}=n||{},f=[],y="ltr"in a&&a.ltr||(d=>d),h="rtl"in a&&a.rtl||(d=>d);return(l==="both"||l==="ltr")&&f.push(C(e,d=>{f.forEach(g=>g.pause()),t.value=y(d),f.forEach(g=>g.resume())},{flush:r,deep:i,immediate:c})),(l==="both"||l==="rtl")&&f.push(C(t,d=>{f.forEach(g=>g.pause()),e.value=h(d),f.forEach(g=>g.resume())},{flush:r,deep:i,immediate:c})),()=>{f.forEach(d=>d.stop())}}function Xe(e,t,n={}){const{flush:r="sync",deep:i=!1,immediate:c=!0}=n;return Array.isArray(t)||(t=[t]),u.watch(e,l=>t.forEach(a=>a.value=l),{flush:r,deep:i,immediate:c})}function Ke(e,t={}){if(!u.isRef(e))return u.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const r in e.value)n[r]=u.customRef(()=>({get(){return e.value[r]},set(i){var c;if((c=s(t.replaceRef))!=null?c:!0)if(Array.isArray(e.value)){const a=[...e.value];a[r]=i,e.value=a}else{const a={...e.value,[r]:i};Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[r]=i}}));return n}function Qe(e,t=!0,n){P(n)?u.onBeforeMount(e,n):t?e():u.nextTick(e)}function xe(e,t){P(t)&&u.onBeforeUnmount(e,t)}function et(e,t=!0,n){P()?u.onMounted(e,n):t?e():u.nextTick(e)}function tt(e,t){P(t)&&u.onUnmounted(e,t)}function V(e,t=!1){function n(m,{flush:d="sync",deep:g=!1,timeout:w,throwOnTimeout:p}={}){let b=null;const $=[new Promise(k=>{b=u.watch(e,D=>{m(D)!==t&&(b?b():u.nextTick(()=>b?.()),k(D))},{flush:d,deep:g,immediate:!0})})];return w!=null&&$.push(N(w,p).then(()=>s(e)).finally(()=>b?.())),Promise.race($)}function r(m,d){if(!u.isRef(m))return n(D=>D===m,d);const{flush:g="sync",deep:w=!1,timeout:p,throwOnTimeout:b}=d??{};let v=null;const k=[new Promise(D=>{v=u.watch([e,m],([fe,Bt])=>{t!==(fe===Bt)&&(v?v():u.nextTick(()=>v?.()),D(fe))},{flush:g,deep:w,immediate:!0})})];return p!=null&&k.push(N(p,b).then(()=>s(e)).finally(()=>(v?.(),s(e)))),Promise.race(k)}function i(m){return n(d=>!!d,m)}function c(m){return r(null,m)}function l(m){return r(void 0,m)}function a(m){return n(Number.isNaN,m)}function f(m,d){return n(g=>{const w=Array.from(g);return w.includes(m)||w.includes(s(m))},d)}function y(m){return h(1,m)}function h(m=1,d){let g=-1;return n(()=>(g+=1,g>=m),d)}return Array.isArray(s(e))?{toMatch:n,toContains:f,changed:y,changedTimes:h,get not(){return V(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:c,toBeNaN:a,toBeUndefined:l,changed:y,changedTimes:h,get not(){return V(e,!t)}}}function nt(e){return V(e)}function rt(e,t){return e===t}function it(...e){var t;const n=e[0],r=e[1];let i=(t=e[2])!=null?t:rt;if(typeof i=="string"){const c=i;i=(l,a)=>l[c]===a[c]}return u.computed(()=>s(n).filter(c=>s(r).findIndex(l=>i(c,l))===-1))}function ct(e,t){return u.computed(()=>s(e).every((n,r,i)=>t(s(n),r,i)))}function ot(e,t){return u.computed(()=>s(e).map(n=>s(n)).filter(t))}function ut(e,t){return u.computed(()=>s(s(e).find((n,r,i)=>t(s(n),r,i))))}function at(e,t){return u.computed(()=>s(e).findIndex((n,r,i)=>t(s(n),r,i)))}function lt(e,t){let n=e.length;for(;n-- >0;)if(t(e[n],n,e))return e[n]}function st(e,t){return u.computed(()=>s(Array.prototype.findLast?s(e).findLast((n,r,i)=>t(s(n),r,i)):lt(s(e),(n,r,i)=>t(s(n),r,i))))}function ft(e){return X(e)&&ee(e,"formIndex","comparator")}function dt(...e){var t;const n=e[0],r=e[1];let i=e[2],c=0;if(ft(i)&&(c=(t=i.fromIndex)!=null?t:0,i=i.comparator),typeof i=="string"){const l=i;i=(a,f)=>a[l]===s(f)}return i=i??((l,a)=>l===s(a)),u.computed(()=>s(n).slice(c).some((l,a,f)=>i(s(l),s(r),a,s(f))))}function mt(e,t){return u.computed(()=>s(e).map(n=>s(n)).join(s(t)))}function ht(e,t){return u.computed(()=>s(e).map(n=>s(n)).map(t))}function yt(e,t,...n){const r=(i,c,l)=>t(s(i),s(c),l);return u.computed(()=>{const i=s(e);return n.length?i.reduce(r,typeof n[0]=="function"?s(n[0]()):s(n[0])):i.reduce(r)})}function gt(e,t){return u.computed(()=>s(e).some((n,r,i)=>t(s(n),r,i)))}function wt(e){return Array.from(new Set(e))}function bt(e,t){return e.reduce((n,r)=>(n.some(i=>t(r,i,e))||n.push(r),n),[])}function pt(e,t){return u.computed(()=>{const n=s(e).map(r=>s(r));return t?bt(n,t):wt(n)})}function vt(e=0,t={}){let n=u.unref(e);const r=u.ref(e),{max:i=Number.POSITIVE_INFINITY,min:c=Number.NEGATIVE_INFINITY}=t,l=(m=1)=>r.value=Math.max(Math.min(i,r.value+m),c),a=(m=1)=>r.value=Math.min(Math.max(c,r.value-m),i),f=()=>r.value,y=m=>r.value=Math.max(c,Math.min(i,m));return{count:r,inc:l,dec:a,get:f,set:y,reset:(m=n)=>(n=m,y(m))}}const At=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,Ot=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function St(e,t,n,r){let i=e<12?"AM":"PM";return r&&(i=i.split("").reduce((c,l)=>c+=`${l}.`,"")),n?i.toLowerCase():i}function S(e){const t=["th","st","nd","rd"],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function ce(e,t,n={}){var r;const i=e.getFullYear(),c=e.getMonth(),l=e.getDate(),a=e.getHours(),f=e.getMinutes(),y=e.getSeconds(),h=e.getMilliseconds(),m=e.getDay(),d=(r=n.customMeridiem)!=null?r:St,g={Yo:()=>S(i),YY:()=>String(i).slice(-2),YYYY:()=>i,M:()=>c+1,Mo:()=>S(c+1),MM:()=>`${c+1}`.padStart(2,"0"),MMM:()=>e.toLocaleDateString(s(n.locales),{month:"short"}),MMMM:()=>e.toLocaleDateString(s(n.locales),{month:"long"}),D:()=>String(l),Do:()=>S(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(a),Ho:()=>S(a),HH:()=>`${a}`.padStart(2,"0"),h:()=>`${a%12||12}`.padStart(1,"0"),ho:()=>S(a%12||12),hh:()=>`${a%12||12}`.padStart(2,"0"),m:()=>String(f),mo:()=>S(f),mm:()=>`${f}`.padStart(2,"0"),s:()=>String(y),so:()=>S(y),ss:()=>`${y}`.padStart(2,"0"),SSS:()=>`${h}`.padStart(3,"0"),d:()=>m,dd:()=>e.toLocaleDateString(s(n.locales),{weekday:"narrow"}),ddd:()=>e.toLocaleDateString(s(n.locales),{weekday:"short"}),dddd:()=>e.toLocaleDateString(s(n.locales),{weekday:"long"}),A:()=>d(a,f),AA:()=>d(a,f,!1,!0),a:()=>d(a,f,!0),aa:()=>d(a,f,!0,!0)};return t.replace(Ot,(w,p)=>{var b,v;return(v=p??((b=g[w])==null?void 0:b.call(g)))!=null?v:w})}function oe(e){if(e===null)return new Date(Number.NaN);if(e===void 0)return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){const t=e.match(At);if(t){const n=t[2]-1||0,r=(t[7]||"0").substring(0,3);return new Date(t[1],n,t[3]||1,t[4]||0,t[5]||0,t[6]||0,r)}}return new Date(e)}function Tt(e,t="HH:mm:ss",n={}){return u.computed(()=>ce(oe(s(e)),s(t),n))}function ue(e,t=1e3,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n;let c=null;const l=u.ref(!1);function a(){c&&(clearInterval(c),c=null)}function f(){l.value=!1,a()}function y(){const h=s(t);h<=0||(l.value=!0,i&&e(),a(),l.value&&(c=setInterval(e,h)))}if(r&&F&&y(),u.isRef(t)||typeof t=="function"){const h=u.watch(t,()=>{l.value&&F&&y()});A(h)}return A(f),{isActive:l,pause:f,resume:y}}function Dt(e=1e3,t={}){const{controls:n=!1,immediate:r=!0,callback:i}=t,c=u.ref(0),l=()=>c.value+=1,a=()=>{c.value=0},f=ue(i?()=>{l(),i(c.value)}:l,e,{immediate:r});return n?{counter:c,reset:a,...f}:c}function Ft(e,t={}){var n;const r=u.ref((n=t.initialValue)!=null?n:null);return u.watch(e,()=>r.value=K(),t),r}function ae(e,t,n={}){const{immediate:r=!0}=n,i=u.ref(!1);let c=null;function l(){c&&(clearTimeout(c),c=null)}function a(){i.value=!1,l()}function f(...y){l(),i.value=!0,c=setTimeout(()=>{i.value=!1,c=null,e(...y)},s(t))}return r&&(i.value=!0,F&&f()),A(a),{isPending:u.readonly(i),start:f,stop:a}}function Mt(e=1e3,t={}){const{controls:n=!1,callback:r}=t,i=ae(r??O,e,t),c=u.computed(()=>!i.isPending.value);return n?{ready:c,...i}:c}function Pt(e,t={}){const{method:n="parseFloat",radix:r,nanToZero:i}=t;return u.computed(()=>{let c=s(e);return typeof c=="string"&&(c=Number[n](c,r)),i&&Number.isNaN(c)&&(c=0),c})}function Rt(e){return u.computed(()=>`${s(e)}`)}function It(e=!1,t={}){const{truthyValue:n=!0,falsyValue:r=!1}=t,i=u.isRef(e),c=u.ref(e);function l(a){if(arguments.length)return c.value=a,c.value;{const f=s(n);return c.value=c.value===f?s(r):f,c.value}}return i?l:[c,l]}function Ct(e,t,n){let r=n?.immediate?[]:[...e instanceof Function?e():Array.isArray(e)?e:s(e)];return u.watch(e,(i,c,l)=>{const a=Array.from({length:r.length}),f=[];for(const h of i){let m=!1;for(let d=0;d<r.length;d++)if(!a[d]&&h===r[d]){a[d]=!0,m=!0;break}m||f.push(h)}const y=r.filter((h,m)=>!a[m]);t(i,r,f,y,l),r=[...i]},n)}function kt(e,t,n){const{count:r,...i}=n,c=u.ref(0),l=R(e,(...a)=>{c.value+=1,c.value>=s(r)&&u.nextTick(()=>l()),t(...a)},i);return{count:c,stop:l}}function le(e,t,n={}){const{debounce:r=0,maxWait:i=void 0,...c}=n;return R(e,t,{...c,eventFilter:j(r,{maxWait:i})})}function Et(e,t,n){return u.watch(e,t,{...n,deep:!0})}function Y(e,t,n={}){const{eventFilter:r=I,...i}=n,c=M(r,t);let l,a,f;if(i.flush==="sync"){const y=u.ref(!1);a=()=>{},l=h=>{y.value=!0,h(),y.value=!1},f=u.watch(e,(...h)=>{y.value||c(...h)},i)}else{const y=[],h=u.ref(0),m=u.ref(0);a=()=>{h.value=m.value},y.push(u.watch(e,()=>{m.value++},{...i,flush:"sync"})),l=d=>{const g=m.value;d(),h.value+=m.value-g},y.push(u.watch(e,(...d)=>{const g=h.value>0&&h.value===m.value;h.value=0,m.value=0,!g&&c(...d)},i)),f=()=>{y.forEach(d=>d())}}return{stop:f,ignoreUpdates:l,ignorePrevAsyncUpdates:a}}function _t(e,t,n){return u.watch(e,t,{...n,immediate:!0})}function jt(e,t,n){const r=u.watch(e,(...i)=>(u.nextTick(()=>r()),t(...i)),n);return r}function se(e,t,n={}){const{throttle:r=0,trailing:i=!0,leading:c=!0,...l}=n;return R(e,t,{...l,eventFilter:L(r,i,c)})}function Lt(e,t,n={}){let r;function i(){if(!r)return;const h=r;r=void 0,h()}function c(h){r=h}const l=(h,m)=>(i(),t(h,m,c)),a=Y(e,l,n),{ignoreUpdates:f}=a;return{...a,trigger:()=>{let h;return f(()=>{h=l(Nt(e),Wt(e))}),h}}}function Nt(e){return u.isReactive(e)?e:Array.isArray(e)?e.map(t=>s(t)):s(e)}function Wt(e){return Array.isArray(e)?e.map(()=>{}):void 0}function Ut(e,t,n){const r=u.watch(e,(i,c,l)=>{i&&(n?.once&&u.nextTick(()=>r()),t(i,c,l))},{...n,once:!1});return r}o.assert=De,o.autoResetRef=te,o.bypassFilter=I,o.camelize=Le,o.clamp=Pe,o.computedEager=H,o.computedWithControl=G,o.containsProp=ee,o.controlledComputed=G,o.controlledRef=qe,o.createEventHook=de,o.createFilterWrapper=M,o.createGlobalState=me,o.createInjectionState=he,o.createReactiveFn=E,o.createSharedComposable=ye,o.createSingletonPromise=We,o.debounceFilter=j,o.debouncedRef=U,o.debouncedWatch=le,o.eagerComputed=H,o.extendRef=Z,o.formatDate=ce,o.get=ge,o.getLifeCycleTarget=P,o.hasOwn=Ie,o.hyphenate=_e,o.identity=Ne,o.ignorableWatch=Y,o.increaseWithUnit=Be,o.injectLocal=z,o.invoke=Ue,o.isClient=F,o.isDef=Se,o.isDefined=we,o.isIOS=Ce,o.isObject=X,o.isWorker=Oe,o.makeDestructurable=be,o.noop=O,o.normalizeDate=oe,o.notNullish=Te,o.now=Me,o.objectEntries=$e,o.objectOmit=Ye,o.objectPick=Ve,o.pausableFilter=Q,o.pausableWatch=C,o.promiseTimeout=N,o.provideLocal=q,o.rand=Re,o.reactify=E,o.reactifyObject=ve,o.reactiveComputed=_,o.reactiveOmit=Ae,o.reactivePick=Ge,o.refAutoReset=te,o.refDebounced=U,o.refDefault=ze,o.refThrottled=B,o.refWithControl=ie,o.resolveRef=He,o.resolveUnref=pe,o.set=Ze,o.syncRef=Je,o.syncRefs=Xe,o.throttleFilter=L,o.throttledRef=B,o.throttledWatch=se,o.timestamp=K,o.toReactive=J,o.toRef=W,o.toRefs=Ke,o.toValue=s,o.tryOnBeforeMount=Qe,o.tryOnBeforeUnmount=xe,o.tryOnMounted=et,o.tryOnScopeDispose=A,o.tryOnUnmounted=tt,o.until=nt,o.useArrayDifference=it,o.useArrayEvery=ct,o.useArrayFilter=ot,o.useArrayFind=ut,o.useArrayFindIndex=at,o.useArrayFindLast=st,o.useArrayIncludes=dt,o.useArrayJoin=mt,o.useArrayMap=ht,o.useArrayReduce=yt,o.useArraySome=gt,o.useArrayUnique=pt,o.useCounter=vt,o.useDateFormat=Tt,o.useDebounce=U,o.useDebounceFn=ne,o.useInterval=Dt,o.useIntervalFn=ue,o.useLastChanged=Ft,o.useThrottle=B,o.useThrottleFn=re,o.useTimeout=Mt,o.useTimeoutFn=ae,o.useToNumber=Pt,o.useToString=Rt,o.useToggle=It,o.watchArray=Ct,o.watchAtMost=kt,o.watchDebounced=le,o.watchDeep=Et,o.watchIgnorable=Y,o.watchImmediate=_t,o.watchOnce=jt,o.watchPausable=C,o.watchThrottled=se,o.watchTriggerable=Lt,o.watchWithFilter=R,o.whenever=Ut})(this.VueUse=this.VueUse||{},Vue);
1
+ (function(o,u){"use strict";function H(e,t){var n;const r=u.shallowRef();return u.watchEffect(()=>{r.value=e()},{...t,flush:(n=t?.flush)!=null?n:"sync"}),u.readonly(r)}function G(e,t){let n,r,i;const c=u.ref(!0),a=()=>{c.value=!0,i()};u.watch(e,a,{flush:"sync"});const l=typeof t=="function"?t:t.get,f=typeof t=="function"?void 0:t.set,y=u.customRef((h,m)=>(r=h,i=m,{get(){return c.value&&(n=l(n),c.value=!1),r(),n},set(d){f?.(d)}}));return Object.isExtensible(y)&&(y.trigger=a),y}function A(e){return u.getCurrentScope()?(u.onScopeDispose(e),!0):!1}function de(){const e=new Set,t=c=>{e.delete(c)};return{on:c=>{e.add(c);const a=()=>t(c);return A(a),{off:a}},off:t,trigger:(...c)=>Promise.all(Array.from(e).map(a=>a(...c))),clear:()=>{e.clear()}}}function me(e){let t=!1,n;const r=u.effectScope(!0);return(...i)=>(t||(n=r.run(()=>e(...i)),t=!0),n)}const T=new WeakMap,z=(...e)=>{var t;const n=e[0],r=(t=u.getCurrentInstance())==null?void 0:t.proxy;if(r==null&&!u.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&T.has(r)&&n in T.get(r)?T.get(r)[n]:u.inject(...e)},q=(e,t)=>{var n;const r=(n=u.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");T.has(r)||T.set(r,Object.create(null));const i=T.get(r);i[e]=t,u.provide(e,t)};function he(e,t){const n=t?.injectionKey||Symbol(e.name||"InjectionState"),r=t?.defaultValue;return[(...a)=>{const l=e(...a);return q(n,l),l},()=>z(n,r)]}function ye(e){let t=0,n,r;const i=()=>{t-=1,r&&t<=0&&(r.stop(),n=void 0,r=void 0)};return(...c)=>(t+=1,r||(r=u.effectScope(!0),n=r.run(()=>e(...c))),A(i),n)}function Z(e,t,{enumerable:n=!1,unwrap:r=!0}={}){for(const[i,c]of Object.entries(t))i!=="value"&&(u.isRef(c)&&r?Object.defineProperty(e,i,{get(){return c.value},set(a){c.value=a},enumerable:n}):Object.defineProperty(e,i,{value:c,enumerable:n}));return e}function ge(e,t){return t==null?u.unref(e):u.unref(e)[t]}function we(e){return u.unref(e)!=null}function be(e,t){if(typeof Symbol<"u"){const n={...e};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:t[r++],done:r>t.length})}}}),n}else return Object.assign([...t],e)}function s(e){return typeof e=="function"?e():u.unref(e)}const pe=s;function E(e,t){const n=t?.computedGetter===!1?u.unref:s;return function(...r){return u.computed(()=>e.apply(this,r.map(i=>n(i))))}}function ve(e,t={}){let n=[],r;if(Array.isArray(t))n=t;else{r=t;const{includeOwnProperties:i=!0}=t;n.push(...Object.keys(e)),i&&n.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(n.map(i=>{const c=e[i];return[i,typeof c=="function"?E(c.bind(e),r):c]}))}function J(e){if(!u.isRef(e))return u.reactive(e);const t=new Proxy({},{get(n,r,i){return u.unref(Reflect.get(e.value,r,i))},set(n,r,i){return u.isRef(e.value[r])&&!u.isRef(i)?e.value[r].value=i:e.value[r]=i,!0},deleteProperty(n,r){return Reflect.deleteProperty(e.value,r)},has(n,r){return Reflect.has(e.value,r)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return u.reactive(t)}function _(e){return J(u.computed(e))}function Ae(e,...t){const n=t.flat(),r=n[0];return _(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(e)).filter(([i,c])=>!r(s(c),i)):Object.entries(u.toRefs(e)).filter(i=>!n.includes(i[0]))))}const F=typeof window<"u"&&typeof document<"u",Oe=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Se=e=>typeof e<"u",Te=e=>e!=null,De=(e,...t)=>{e||console.warn(...t)},Fe=Object.prototype.toString,X=e=>Fe.call(e)==="[object Object]",Me=()=>Date.now(),K=()=>+Date.now(),Pe=(e,t,n)=>Math.min(n,Math.max(t,e)),O=()=>{},Re=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),Ie=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ce=ke();function ke(){var e,t;return F&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function M(e,t){function n(...r){return new Promise((i,c)=>{Promise.resolve(e(()=>t.apply(this,r),{fn:t,thisArg:this,args:r})).then(i).catch(c)})}return n}const I=e=>e();function N(e,t={}){let n,r,i=O;const c=l=>{clearTimeout(l),i(),i=O};return l=>{const f=s(e),y=s(t.maxWait);return n&&c(n),f<=0||y!==void 0&&y<=0?(r&&(c(r),r=null),Promise.resolve(l())):new Promise((h,m)=>{i=t.rejectOnCancel?m:h,y&&!r&&(r=setTimeout(()=>{n&&c(n),r=null,h(l())},y)),n=setTimeout(()=>{r&&c(r),r=null,h(l())},f)})}}function j(...e){let t=0,n,r=!0,i=O,c,a,l,f,y;!u.isRef(e[0])&&typeof e[0]=="object"?{delay:a,trailing:l=!0,leading:f=!0,rejectOnCancel:y=!1}=e[0]:[a,l=!0,f=!0,y=!1]=e;const h=()=>{n&&(clearTimeout(n),n=void 0,i(),i=O)};return d=>{const g=s(a),w=Date.now()-t,p=()=>c=d();return h(),g<=0?(t=Date.now(),p()):(w>g&&(f||!r)?(t=Date.now(),p()):l&&(c=new Promise((b,v)=>{i=y?v:b,n=setTimeout(()=>{t=Date.now(),r=!0,b(p()),h()},Math.max(0,g-w))})),!f&&!n&&(n=setTimeout(()=>r=!0,g)),r=!1,c)}}function Q(e=I){const t=u.ref(!0);function n(){t.value=!1}function r(){t.value=!0}const i=(...c)=>{t.value&&e(...c)};return{isActive:u.readonly(t),pause:n,resume:r,eventFilter:i}}function x(e){const t=Object.create(null);return n=>t[n]||(t[n]=e(n))}const Ee=/\B([A-Z])/g,_e=x(e=>e.replace(Ee,"-$1").toLowerCase()),Ne=/-(\w)/g,je=x(e=>e.replace(Ne,(t,n)=>n?n.toUpperCase():""));function L(e,t=!1,n="Timeout"){return new Promise((r,i)=>{setTimeout(t?()=>i(n):r,e)})}function Le(e){return e}function We(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const r=t;t=void 0,r&&await r},n}function Ue(e){return e()}function ee(e,...t){return t.some(n=>n in e)}function Be(e,t){var n;if(typeof e=="number")return e+t;const r=((n=e.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",i=e.slice(r.length),c=Number.parseFloat(r)+t;return Number.isNaN(c)?e:c+i}function Ve(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function Ye(e,t,n=!1){return t.reduce((r,i)=>(i in e&&(!n||e[i]!==void 0)&&(r[i]=e[i]),r),{})}function $e(e,t,n=!1){return Object.fromEntries(Object.entries(e).filter(([r,i])=>(!n||i!==void 0)&&!t.includes(r)))}function He(e){return Object.entries(e)}function P(e){return e||u.getCurrentInstance()}function W(...e){if(e.length!==1)return u.toRef(...e);const t=e[0];return typeof t=="function"?u.readonly(u.customRef(()=>({get:t,set:O}))):u.ref(t)}const Ge=W;function ze(e,...t){const n=t.flat(),r=n[0];return _(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(e)).filter(([i,c])=>r(s(c),i)):n.map(i=>[i,W(e,i)])))}function te(e,t=1e4){return u.customRef((n,r)=>{let i=s(e),c;const a=()=>setTimeout(()=>{i=s(e),r()},s(t));return A(()=>{clearTimeout(c)}),{get(){return n(),i},set(l){i=l,r(),clearTimeout(c),c=a()}}})}function ne(e,t=200,n={}){return M(N(t,n),e)}function U(e,t=200,n={}){const r=u.ref(e.value),i=ne(()=>{r.value=e.value},t,n);return u.watch(e,()=>i()),r}function qe(e,t){return u.computed({get(){var n;return(n=e.value)!=null?n:t},set(n){e.value=n}})}function re(e,t=200,n=!1,r=!0,i=!1){return M(j(t,n,r,i),e)}function B(e,t=200,n=!0,r=!0){if(t<=0)return e;const i=u.ref(e.value),c=re(()=>{i.value=e.value},t,n,r);return u.watch(e,()=>c()),i}function ie(e,t={}){let n=e,r,i;const c=u.customRef((d,g)=>(r=d,i=g,{get(){return a()},set(w){l(w)}}));function a(d=!0){return d&&r(),n}function l(d,g=!0){var w,p;if(d===n)return;const b=n;((w=t.onBeforeChange)==null?void 0:w.call(t,d,b))!==!1&&(n=d,(p=t.onChanged)==null||p.call(t,d,b),g&&i())}return Z(c,{get:a,set:l,untrackedGet:()=>a(!1),silentSet:d=>l(d,!1),peek:()=>a(!1),lay:d=>l(d,!1)},{enumerable:!0})}const Ze=ie;function Je(...e){if(e.length===2){const[t,n]=e;t.value=n}if(e.length===3){const[t,n,r]=e;t[n]=r}}function R(e,t,n={}){const{eventFilter:r=I,...i}=n;return u.watch(e,M(r,t),i)}function C(e,t,n={}){const{eventFilter:r,...i}=n,{eventFilter:c,pause:a,resume:l,isActive:f}=Q(r);return{stop:R(e,t,{...i,eventFilter:c}),pause:a,resume:l,isActive:f}}function Xe(e,t,...[n]){const{flush:r="sync",deep:i=!1,immediate:c=!0,direction:a="both",transform:l={}}=n||{},f=[],y="ltr"in l&&l.ltr||(d=>d),h="rtl"in l&&l.rtl||(d=>d);return(a==="both"||a==="ltr")&&f.push(C(e,d=>{f.forEach(g=>g.pause()),t.value=y(d),f.forEach(g=>g.resume())},{flush:r,deep:i,immediate:c})),(a==="both"||a==="rtl")&&f.push(C(t,d=>{f.forEach(g=>g.pause()),e.value=h(d),f.forEach(g=>g.resume())},{flush:r,deep:i,immediate:c})),()=>{f.forEach(d=>d.stop())}}function Ke(e,t,n={}){const{flush:r="sync",deep:i=!1,immediate:c=!0}=n;return Array.isArray(t)||(t=[t]),u.watch(e,a=>t.forEach(l=>l.value=a),{flush:r,deep:i,immediate:c})}function Qe(e,t={}){if(!u.isRef(e))return u.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const r in e.value)n[r]=u.customRef(()=>({get(){return e.value[r]},set(i){var c;if((c=s(t.replaceRef))!=null?c:!0)if(Array.isArray(e.value)){const l=[...e.value];l[r]=i,e.value=l}else{const l={...e.value,[r]:i};Object.setPrototypeOf(l,Object.getPrototypeOf(e.value)),e.value=l}else e.value[r]=i}}));return n}function xe(e,t=!0,n){P(n)?u.onBeforeMount(e,n):t?e():u.nextTick(e)}function et(e,t){P(t)&&u.onBeforeUnmount(e,t)}function tt(e,t=!0,n){P()?u.onMounted(e,n):t?e():u.nextTick(e)}function nt(e,t){P(t)&&u.onUnmounted(e,t)}function V(e,t=!1){function n(m,{flush:d="sync",deep:g=!1,timeout:w,throwOnTimeout:p}={}){let b=null;const $=[new Promise(k=>{b=u.watch(e,D=>{m(D)!==t&&(b?b():u.nextTick(()=>b?.()),k(D))},{flush:d,deep:g,immediate:!0})})];return w!=null&&$.push(L(w,p).then(()=>s(e)).finally(()=>b?.())),Promise.race($)}function r(m,d){if(!u.isRef(m))return n(D=>D===m,d);const{flush:g="sync",deep:w=!1,timeout:p,throwOnTimeout:b}=d??{};let v=null;const k=[new Promise(D=>{v=u.watch([e,m],([fe,Vt])=>{t!==(fe===Vt)&&(v?v():u.nextTick(()=>v?.()),D(fe))},{flush:g,deep:w,immediate:!0})})];return p!=null&&k.push(L(p,b).then(()=>s(e)).finally(()=>(v?.(),s(e)))),Promise.race(k)}function i(m){return n(d=>!!d,m)}function c(m){return r(null,m)}function a(m){return r(void 0,m)}function l(m){return n(Number.isNaN,m)}function f(m,d){return n(g=>{const w=Array.from(g);return w.includes(m)||w.includes(s(m))},d)}function y(m){return h(1,m)}function h(m=1,d){let g=-1;return n(()=>(g+=1,g>=m),d)}return Array.isArray(s(e))?{toMatch:n,toContains:f,changed:y,changedTimes:h,get not(){return V(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:c,toBeNaN:l,toBeUndefined:a,changed:y,changedTimes:h,get not(){return V(e,!t)}}}function rt(e){return V(e)}function it(e,t){return e===t}function ct(...e){var t;const n=e[0],r=e[1];let i=(t=e[2])!=null?t:it;if(typeof i=="string"){const c=i;i=(a,l)=>a[c]===l[c]}return u.computed(()=>s(n).filter(c=>s(r).findIndex(a=>i(c,a))===-1))}function ot(e,t){return u.computed(()=>s(e).every((n,r,i)=>t(s(n),r,i)))}function ut(e,t){return u.computed(()=>s(e).map(n=>s(n)).filter(t))}function at(e,t){return u.computed(()=>s(s(e).find((n,r,i)=>t(s(n),r,i))))}function lt(e,t){return u.computed(()=>s(e).findIndex((n,r,i)=>t(s(n),r,i)))}function st(e,t){let n=e.length;for(;n-- >0;)if(t(e[n],n,e))return e[n]}function ft(e,t){return u.computed(()=>s(Array.prototype.findLast?s(e).findLast((n,r,i)=>t(s(n),r,i)):st(s(e),(n,r,i)=>t(s(n),r,i))))}function dt(e){return X(e)&&ee(e,"formIndex","comparator")}function mt(...e){var t;const n=e[0],r=e[1];let i=e[2],c=0;if(dt(i)&&(c=(t=i.fromIndex)!=null?t:0,i=i.comparator),typeof i=="string"){const a=i;i=(l,f)=>l[a]===s(f)}return i=i??((a,l)=>a===s(l)),u.computed(()=>s(n).slice(c).some((a,l,f)=>i(s(a),s(r),l,s(f))))}function ht(e,t){return u.computed(()=>s(e).map(n=>s(n)).join(s(t)))}function yt(e,t){return u.computed(()=>s(e).map(n=>s(n)).map(t))}function gt(e,t,...n){const r=(i,c,a)=>t(s(i),s(c),a);return u.computed(()=>{const i=s(e);return n.length?i.reduce(r,typeof n[0]=="function"?s(n[0]()):s(n[0])):i.reduce(r)})}function wt(e,t){return u.computed(()=>s(e).some((n,r,i)=>t(s(n),r,i)))}function bt(e){return Array.from(new Set(e))}function pt(e,t){return e.reduce((n,r)=>(n.some(i=>t(r,i,e))||n.push(r),n),[])}function vt(e,t){return u.computed(()=>{const n=s(e).map(r=>s(r));return t?pt(n,t):bt(n)})}function At(e=0,t={}){let n=u.unref(e);const r=u.ref(e),{max:i=Number.POSITIVE_INFINITY,min:c=Number.NEGATIVE_INFINITY}=t,a=(m=1)=>r.value=Math.max(Math.min(i,r.value+m),c),l=(m=1)=>r.value=Math.min(Math.max(c,r.value-m),i),f=()=>r.value,y=m=>r.value=Math.max(c,Math.min(i,m));return{count:r,inc:a,dec:l,get:f,set:y,reset:(m=n)=>(n=m,y(m))}}const Ot=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,St=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function Tt(e,t,n,r){let i=e<12?"AM":"PM";return r&&(i=i.split("").reduce((c,a)=>c+=`${a}.`,"")),n?i.toLowerCase():i}function S(e){const t=["th","st","nd","rd"],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function ce(e,t,n={}){var r;const i=e.getFullYear(),c=e.getMonth(),a=e.getDate(),l=e.getHours(),f=e.getMinutes(),y=e.getSeconds(),h=e.getMilliseconds(),m=e.getDay(),d=(r=n.customMeridiem)!=null?r:Tt,g={Yo:()=>S(i),YY:()=>String(i).slice(-2),YYYY:()=>i,M:()=>c+1,Mo:()=>S(c+1),MM:()=>`${c+1}`.padStart(2,"0"),MMM:()=>e.toLocaleDateString(s(n.locales),{month:"short"}),MMMM:()=>e.toLocaleDateString(s(n.locales),{month:"long"}),D:()=>String(a),Do:()=>S(a),DD:()=>`${a}`.padStart(2,"0"),H:()=>String(l),Ho:()=>S(l),HH:()=>`${l}`.padStart(2,"0"),h:()=>`${l%12||12}`.padStart(1,"0"),ho:()=>S(l%12||12),hh:()=>`${l%12||12}`.padStart(2,"0"),m:()=>String(f),mo:()=>S(f),mm:()=>`${f}`.padStart(2,"0"),s:()=>String(y),so:()=>S(y),ss:()=>`${y}`.padStart(2,"0"),SSS:()=>`${h}`.padStart(3,"0"),d:()=>m,dd:()=>e.toLocaleDateString(s(n.locales),{weekday:"narrow"}),ddd:()=>e.toLocaleDateString(s(n.locales),{weekday:"short"}),dddd:()=>e.toLocaleDateString(s(n.locales),{weekday:"long"}),A:()=>d(l,f),AA:()=>d(l,f,!1,!0),a:()=>d(l,f,!0),aa:()=>d(l,f,!0,!0)};return t.replace(St,(w,p)=>{var b,v;return(v=p??((b=g[w])==null?void 0:b.call(g)))!=null?v:w})}function oe(e){if(e===null)return new Date(Number.NaN);if(e===void 0)return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){const t=e.match(Ot);if(t){const n=t[2]-1||0,r=(t[7]||"0").substring(0,3);return new Date(t[1],n,t[3]||1,t[4]||0,t[5]||0,t[6]||0,r)}}return new Date(e)}function Dt(e,t="HH:mm:ss",n={}){return u.computed(()=>ce(oe(s(e)),s(t),n))}function ue(e,t=1e3,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n;let c=null;const a=u.ref(!1);function l(){c&&(clearInterval(c),c=null)}function f(){a.value=!1,l()}function y(){const h=s(t);h<=0||(a.value=!0,i&&e(),l(),a.value&&(c=setInterval(e,h)))}if(r&&F&&y(),u.isRef(t)||typeof t=="function"){const h=u.watch(t,()=>{a.value&&F&&y()});A(h)}return A(f),{isActive:a,pause:f,resume:y}}function Ft(e=1e3,t={}){const{controls:n=!1,immediate:r=!0,callback:i}=t,c=u.ref(0),a=()=>c.value+=1,l=()=>{c.value=0},f=ue(i?()=>{a(),i(c.value)}:a,e,{immediate:r});return n?{counter:c,reset:l,...f}:c}function Mt(e,t={}){var n;const r=u.ref((n=t.initialValue)!=null?n:null);return u.watch(e,()=>r.value=K(),t),r}function ae(e,t,n={}){const{immediate:r=!0}=n,i=u.ref(!1);let c=null;function a(){c&&(clearTimeout(c),c=null)}function l(){i.value=!1,a()}function f(...y){a(),i.value=!0,c=setTimeout(()=>{i.value=!1,c=null,e(...y)},s(t))}return r&&(i.value=!0,F&&f()),A(l),{isPending:u.readonly(i),start:f,stop:l}}function Pt(e=1e3,t={}){const{controls:n=!1,callback:r}=t,i=ae(r??O,e,t),c=u.computed(()=>!i.isPending.value);return n?{ready:c,...i}:c}function Rt(e,t={}){const{method:n="parseFloat",radix:r,nanToZero:i}=t;return u.computed(()=>{let c=s(e);return typeof c=="string"&&(c=Number[n](c,r)),i&&Number.isNaN(c)&&(c=0),c})}function It(e){return u.computed(()=>`${s(e)}`)}function Ct(e=!1,t={}){const{truthyValue:n=!0,falsyValue:r=!1}=t,i=u.isRef(e),c=u.ref(e);function a(l){if(arguments.length)return c.value=l,c.value;{const f=s(n);return c.value=c.value===f?s(r):f,c.value}}return i?a:[c,a]}function kt(e,t,n){let r=n?.immediate?[]:[...e instanceof Function?e():Array.isArray(e)?e:s(e)];return u.watch(e,(i,c,a)=>{const l=Array.from({length:r.length}),f=[];for(const h of i){let m=!1;for(let d=0;d<r.length;d++)if(!l[d]&&h===r[d]){l[d]=!0,m=!0;break}m||f.push(h)}const y=r.filter((h,m)=>!l[m]);t(i,r,f,y,a),r=[...i]},n)}function Et(e,t,n){const{count:r,...i}=n,c=u.ref(0),a=R(e,(...l)=>{c.value+=1,c.value>=s(r)&&u.nextTick(()=>a()),t(...l)},i);return{count:c,stop:a}}function le(e,t,n={}){const{debounce:r=0,maxWait:i=void 0,...c}=n;return R(e,t,{...c,eventFilter:N(r,{maxWait:i})})}function _t(e,t,n){return u.watch(e,t,{...n,deep:!0})}function Y(e,t,n={}){const{eventFilter:r=I,...i}=n,c=M(r,t);let a,l,f;if(i.flush==="sync"){const y=u.ref(!1);l=()=>{},a=h=>{y.value=!0,h(),y.value=!1},f=u.watch(e,(...h)=>{y.value||c(...h)},i)}else{const y=[],h=u.ref(0),m=u.ref(0);l=()=>{h.value=m.value},y.push(u.watch(e,()=>{m.value++},{...i,flush:"sync"})),a=d=>{const g=m.value;d(),h.value+=m.value-g},y.push(u.watch(e,(...d)=>{const g=h.value>0&&h.value===m.value;h.value=0,m.value=0,!g&&c(...d)},i)),f=()=>{y.forEach(d=>d())}}return{stop:f,ignoreUpdates:a,ignorePrevAsyncUpdates:l}}function Nt(e,t,n){return u.watch(e,t,{...n,immediate:!0})}function jt(e,t,n){const r=u.watch(e,(...i)=>(u.nextTick(()=>r()),t(...i)),n);return r}function se(e,t,n={}){const{throttle:r=0,trailing:i=!0,leading:c=!0,...a}=n;return R(e,t,{...a,eventFilter:j(r,i,c)})}function Lt(e,t,n={}){let r;function i(){if(!r)return;const h=r;r=void 0,h()}function c(h){r=h}const a=(h,m)=>(i(),t(h,m,c)),l=Y(e,a,n),{ignoreUpdates:f}=l;return{...l,trigger:()=>{let h;return f(()=>{h=a(Wt(e),Ut(e))}),h}}}function Wt(e){return u.isReactive(e)?e:Array.isArray(e)?e.map(t=>s(t)):s(e)}function Ut(e){return Array.isArray(e)?e.map(()=>{}):void 0}function Bt(e,t,n){const r=u.watch(e,(i,c,a)=>{i&&(n?.once&&u.nextTick(()=>r()),t(i,c,a))},{...n,once:!1});return r}o.assert=De,o.autoResetRef=te,o.bypassFilter=I,o.camelize=je,o.clamp=Pe,o.computedEager=H,o.computedWithControl=G,o.containsProp=ee,o.controlledComputed=G,o.controlledRef=Ze,o.createEventHook=de,o.createFilterWrapper=M,o.createGlobalState=me,o.createInjectionState=he,o.createReactiveFn=E,o.createSharedComposable=ye,o.createSingletonPromise=We,o.debounceFilter=N,o.debouncedRef=U,o.debouncedWatch=le,o.eagerComputed=H,o.extendRef=Z,o.formatDate=ce,o.get=ge,o.getLifeCycleTarget=P,o.hasOwn=Ie,o.hyphenate=_e,o.identity=Le,o.ignorableWatch=Y,o.increaseWithUnit=Be,o.injectLocal=z,o.invoke=Ue,o.isClient=F,o.isDef=Se,o.isDefined=we,o.isIOS=Ce,o.isObject=X,o.isWorker=Oe,o.makeDestructurable=be,o.noop=O,o.normalizeDate=oe,o.notNullish=Te,o.now=Me,o.objectEntries=He,o.objectOmit=$e,o.objectPick=Ye,o.pausableFilter=Q,o.pausableWatch=C,o.promiseTimeout=L,o.provideLocal=q,o.pxValue=Ve,o.rand=Re,o.reactify=E,o.reactifyObject=ve,o.reactiveComputed=_,o.reactiveOmit=Ae,o.reactivePick=ze,o.refAutoReset=te,o.refDebounced=U,o.refDefault=qe,o.refThrottled=B,o.refWithControl=ie,o.resolveRef=Ge,o.resolveUnref=pe,o.set=Je,o.syncRef=Xe,o.syncRefs=Ke,o.throttleFilter=j,o.throttledRef=B,o.throttledWatch=se,o.timestamp=K,o.toReactive=J,o.toRef=W,o.toRefs=Qe,o.toValue=s,o.tryOnBeforeMount=xe,o.tryOnBeforeUnmount=et,o.tryOnMounted=tt,o.tryOnScopeDispose=A,o.tryOnUnmounted=nt,o.until=rt,o.useArrayDifference=ct,o.useArrayEvery=ot,o.useArrayFilter=ut,o.useArrayFind=at,o.useArrayFindIndex=lt,o.useArrayFindLast=ft,o.useArrayIncludes=mt,o.useArrayJoin=ht,o.useArrayMap=yt,o.useArrayReduce=gt,o.useArraySome=wt,o.useArrayUnique=vt,o.useCounter=At,o.useDateFormat=Dt,o.useDebounce=U,o.useDebounceFn=ne,o.useInterval=Ft,o.useIntervalFn=ue,o.useLastChanged=Mt,o.useThrottle=B,o.useThrottleFn=re,o.useTimeout=Pt,o.useTimeoutFn=ae,o.useToNumber=Rt,o.useToString=It,o.useToggle=Ct,o.watchArray=kt,o.watchAtMost=Et,o.watchDebounced=le,o.watchDeep=_t,o.watchIgnorable=Y,o.watchImmediate=Nt,o.watchOnce=jt,o.watchPausable=C,o.watchThrottled=se,o.watchTriggerable=Lt,o.watchWithFilter=R,o.whenever=Bt})(this.VueUse=this.VueUse||{},Vue);
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, inject, provide, isRef, unref, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue';
1
+ import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, isRef, unref, 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;
@@ -59,6 +59,9 @@ function createEventHook() {
59
59
  const off = (fn) => {
60
60
  fns.delete(fn);
61
61
  };
62
+ const clear = () => {
63
+ fns.clear();
64
+ };
62
65
  const on = (fn) => {
63
66
  fns.add(fn);
64
67
  const offFn = () => off(fn);
@@ -73,7 +76,8 @@ function createEventHook() {
73
76
  return {
74
77
  on,
75
78
  off,
76
- trigger
79
+ trigger,
80
+ clear
77
81
  };
78
82
  }
79
83
 
@@ -96,9 +100,9 @@ const injectLocal = (...args) => {
96
100
  var _a;
97
101
  const key = args[0];
98
102
  const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
99
- if (instance == null)
103
+ if (instance == null && !hasInjectionContext())
100
104
  throw new Error("injectLocal must be called in setup");
101
- if (localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
105
+ if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
102
106
  return localProvidedStateMap.get(instance)[key];
103
107
  return inject(...args);
104
108
  };
@@ -485,6 +489,9 @@ function increaseWithUnit(target, delta) {
485
489
  return target;
486
490
  return result + unit;
487
491
  }
492
+ function pxValue(px) {
493
+ return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
494
+ }
488
495
  function objectPick(obj, keys, omitUndefined = false) {
489
496
  return keys.reduce((n, k) => {
490
497
  if (k in obj) {
@@ -1564,4 +1571,4 @@ function whenever(source, cb, options) {
1564
1571
  return stop;
1565
1572
  }
1566
1573
 
1567
- 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, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1574
+ 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, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/shared",
3
- "version": "12.0.0-beta.1",
3
+ "version": "12.1.0",
4
4
  "author": "Anthony Fu <https://github.com/antfu>",
5
5
  "license": "MIT",
6
6
  "funding": "https://github.com/sponsors/antfu",
@@ -34,4 +34,4 @@
34
34
  "dependencies": {
35
35
  "vue": "^3.5.13"
36
36
  }
37
- }
37
+ }