@vueuse/shared 9.1.1 → 9.3.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
@@ -59,6 +59,7 @@ const rand = (min, max) => {
59
59
  return Math.floor(Math.random() * (max - min + 1)) + min;
60
60
  };
61
61
  const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
62
+ const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
62
63
 
63
64
  function resolveUnref(r) {
64
65
  return typeof r === "function" ? r() : vueDemi.unref(r);
@@ -716,8 +717,7 @@ function tryOnUnmounted(fn) {
716
717
  vueDemi.onUnmounted(fn);
717
718
  }
718
719
 
719
- function until(r) {
720
- let isNot = false;
720
+ function createUntil(r, isNot = false) {
721
721
  function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
722
722
  let stop = null;
723
723
  const watcher = new Promise((resolve) => {
@@ -799,8 +799,7 @@ function until(r) {
799
799
  changed,
800
800
  changedTimes,
801
801
  get not() {
802
- isNot = !isNot;
803
- return this;
802
+ return createUntil(r, !isNot);
804
803
  }
805
804
  };
806
805
  return instance;
@@ -815,13 +814,15 @@ function until(r) {
815
814
  changed,
816
815
  changedTimes,
817
816
  get not() {
818
- isNot = !isNot;
819
- return this;
817
+ return createUntil(r, !isNot);
820
818
  }
821
819
  };
822
820
  return instance;
823
821
  }
824
822
  }
823
+ function until(r) {
824
+ return createUntil(r);
825
+ }
825
826
 
826
827
  function useArrayEvery(list, fn) {
827
828
  return vueDemi.computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
@@ -877,8 +878,15 @@ function useCounter(initialValue = 0, options = {}) {
877
878
  }
878
879
 
879
880
  const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
880
- const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
881
- const formatDate = (date, formatStr, locales) => {
881
+ const REGEX_FORMAT = /\[([^\]]+)]|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;
882
+ const defaultMeridiem = (hours, minutes, isLowercase, hasPeriod) => {
883
+ let m = hours < 12 ? "AM" : "PM";
884
+ if (hasPeriod)
885
+ m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
886
+ return isLowercase ? m.toLowerCase() : m;
887
+ };
888
+ const formatDate = (date, formatStr, options) => {
889
+ var _a;
882
890
  const years = date.getFullYear();
883
891
  const month = date.getMonth();
884
892
  const days = date.getDate();
@@ -887,11 +895,14 @@ const formatDate = (date, formatStr, locales) => {
887
895
  const seconds = date.getSeconds();
888
896
  const milliseconds = date.getMilliseconds();
889
897
  const day = date.getDay();
898
+ const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
890
899
  const matches = {
891
900
  YY: () => String(years).slice(-2),
892
901
  YYYY: () => years,
893
902
  M: () => month + 1,
894
903
  MM: () => `${month + 1}`.padStart(2, "0"),
904
+ MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
905
+ MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
895
906
  D: () => String(days),
896
907
  DD: () => `${days}`.padStart(2, "0"),
897
908
  H: () => String(hours),
@@ -904,9 +915,13 @@ const formatDate = (date, formatStr, locales) => {
904
915
  ss: () => `${seconds}`.padStart(2, "0"),
905
916
  SSS: () => `${milliseconds}`.padStart(3, "0"),
906
917
  d: () => day,
907
- dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
908
- ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
909
- dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
918
+ dd: () => date.toLocaleDateString(options.locales, { weekday: "narrow" }),
919
+ ddd: () => date.toLocaleDateString(options.locales, { weekday: "short" }),
920
+ dddd: () => date.toLocaleDateString(options.locales, { weekday: "long" }),
921
+ A: () => meridiem(hours, minutes),
922
+ AA: () => meridiem(hours, minutes, false, true),
923
+ a: () => meridiem(hours, minutes, true),
924
+ aa: () => meridiem(hours, minutes, true, true)
910
925
  };
911
926
  return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
912
927
  };
@@ -928,7 +943,7 @@ const normalizeDate = (date) => {
928
943
  return new Date(date);
929
944
  };
930
945
  function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
931
- return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
946
+ return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options));
932
947
  }
933
948
 
934
949
  function useIntervalFn(cb, interval = 1e3, options = {}) {
@@ -993,10 +1008,15 @@ var __spreadValues$6 = (a, b) => {
993
1008
  function useInterval(interval = 1e3, options = {}) {
994
1009
  const {
995
1010
  controls: exposeControls = false,
996
- immediate = true
1011
+ immediate = true,
1012
+ callback
997
1013
  } = options;
998
1014
  const counter = vueDemi.ref(0);
999
- const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
1015
+ const update = () => counter.value += 1;
1016
+ const controls = useIntervalFn(callback ? () => {
1017
+ update();
1018
+ callback(counter.value);
1019
+ } : update, interval, { immediate });
1000
1020
  if (exposeControls) {
1001
1021
  return __spreadValues$6({
1002
1022
  counter
@@ -1069,9 +1089,10 @@ var __spreadValues$5 = (a, b) => {
1069
1089
  };
1070
1090
  function useTimeout(interval = 1e3, options = {}) {
1071
1091
  const {
1072
- controls: exposeControls = false
1092
+ controls: exposeControls = false,
1093
+ callback
1073
1094
  } = options;
1074
- const controls = useTimeoutFn(noop, interval, options);
1095
+ const controls = useTimeoutFn(callback != null ? callback : noop, interval, options);
1075
1096
  const ready = vueDemi.computed(() => !controls.isPending.value);
1076
1097
  if (exposeControls) {
1077
1098
  return __spreadValues$5({
@@ -1524,6 +1545,7 @@ exports.eagerComputed = computedEager;
1524
1545
  exports.extendRef = extendRef;
1525
1546
  exports.formatDate = formatDate;
1526
1547
  exports.get = get;
1548
+ exports.hasOwn = hasOwn;
1527
1549
  exports.identity = identity;
1528
1550
  exports.ignorableWatch = watchIgnorable;
1529
1551
  exports.increaseWithUnit = increaseWithUnit;
package/index.d.ts CHANGED
@@ -76,11 +76,11 @@ interface ExtendRefOptions<Unwrap extends boolean = boolean> {
76
76
  unwrap?: Unwrap;
77
77
  }
78
78
  /**
79
- * Overlad 1: Unwrap set to false
79
+ * Overload 1: Unwrap set to false
80
80
  */
81
81
  declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
82
82
  /**
83
- * Overlad 2: Unwrap unset or set to true
83
+ * Overload 2: Unwrap unset or set to true
84
84
  */
85
85
  declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
86
86
 
@@ -99,6 +99,7 @@ declare const clamp: (n: number, min: number, max: number) => number;
99
99
  declare const noop: () => void;
100
100
  declare const rand: (min: number, max: number) => number;
101
101
  declare const isIOS: boolean | "";
102
+ declare const hasOwn: <T extends object, K extends keyof T>(val: T, key: K) => key is K;
102
103
 
103
104
  /**
104
105
  * Any function
@@ -160,7 +161,7 @@ declare type Awaitable<T> = Promise<T> | T;
160
161
  declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
161
162
  interface Pausable {
162
163
  /**
163
- * A ref indicate whether a pusable instance is active
164
+ * A ref indicate whether a pausable instance is active
164
165
  */
165
166
  isActive: Ref<boolean>;
166
167
  /**
@@ -429,7 +430,7 @@ interface ControlledRefOptions<T> {
429
430
  /**
430
431
  * Callback function after the ref changed
431
432
  *
432
- * This happends synchronously, with less overhead compare to `watch`
433
+ * This happens synchronously, with less overhead compare to `watch`
433
434
  */
434
435
  onChanged?: (value: T, oldValue: T) => void;
435
436
  }
@@ -703,7 +704,7 @@ declare function useArrayJoin(list: MaybeComputedRef<MaybeComputedRef<any>[]>, s
703
704
  *
704
705
  * @returns {Array} a new array with each element being the result of the callback function.
705
706
  */
706
- declare function useArrayMap<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => T): ComputedRef<T[]>;
707
+ declare function useArrayMap<T, U = T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => U): ComputedRef<U[]>;
707
708
 
708
709
  declare type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
709
710
  /**
@@ -762,21 +763,26 @@ declare function useCounter(initialValue?: number, options?: UseCounterOptions):
762
763
  declare type DateLike = Date | number | string | undefined;
763
764
  interface UseDateFormatOptions {
764
765
  /**
765
- * The locale(s) to used for dd/ddd/dddd format
766
+ * The locale(s) to used for dd/ddd/dddd/MMM/MMMM format
766
767
  *
767
768
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
768
769
  */
769
770
  locales?: Intl.LocalesArgument;
771
+ /**
772
+ * A custom function to re-modify the way to display meridiem
773
+ *
774
+ */
775
+ customMeridiem?: (hours: number, minutes: number, isLowercase?: boolean, hasPeriod?: boolean) => string;
770
776
  }
771
- declare const formatDate: (date: Date, formatStr: string, locales?: Intl.LocalesArgument) => string;
777
+ declare const formatDate: (date: Date, formatStr: string, options: UseDateFormatOptions) => string;
772
778
  declare const normalizeDate: (date: DateLike) => Date;
773
779
  /**
774
780
  * Get the formatted date according to the string of tokens passed in.
775
781
  *
776
782
  * @see https://vueuse.org/useDateFormat
777
- * @param date
778
- * @param formatStr
779
- * @param options
783
+ * @param date - The date to format, can either be a `Date` object, a timestamp, or a string
784
+ * @param formatStr - The combination of tokens to format the date
785
+ * @param options - UseDateFormatOptions
780
786
  */
781
787
  declare function useDateFormat(date: MaybeComputedRef<DateLike>, formatStr?: MaybeComputedRef<string>, options?: UseDateFormatOptions): vue_demi.ComputedRef<string>;
782
788
  declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
@@ -806,6 +812,10 @@ interface UseIntervalOptions<Controls extends boolean> {
806
812
  * @default true
807
813
  */
808
814
  immediate?: boolean;
815
+ /**
816
+ * Callback on every interval
817
+ */
818
+ callback?: (count: number) => void;
809
819
  }
810
820
  /**
811
821
  * Reactive counter increases on every interval
@@ -894,6 +904,10 @@ interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOption
894
904
  * @default false
895
905
  */
896
906
  controls?: Controls;
907
+ /**
908
+ * Callback on timeout
909
+ */
910
+ callback?: Fn;
897
911
  }
898
912
  /**
899
913
  * Update value after a given time with controls.
@@ -1022,4 +1036,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
1022
1036
  */
1023
1037
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
1024
1038
 
1025
- export { ArgumentsType, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeReadonlyRef, MaybeRef, Pausable, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToNumberOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, 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, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1039
+ export { ArgumentsType, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeReadonlyRef, MaybeRef, Pausable, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToNumberOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, 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, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/index.iife.js CHANGED
@@ -129,6 +129,7 @@
129
129
  return Math.floor(Math.random() * (max - min + 1)) + min;
130
130
  };
131
131
  const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
132
+ const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
132
133
 
133
134
  function resolveUnref(r) {
134
135
  return typeof r === "function" ? r() : vueDemi.unref(r);
@@ -786,8 +787,7 @@
786
787
  vueDemi.onUnmounted(fn);
787
788
  }
788
789
 
789
- function until(r) {
790
- let isNot = false;
790
+ function createUntil(r, isNot = false) {
791
791
  function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
792
792
  let stop = null;
793
793
  const watcher = new Promise((resolve) => {
@@ -869,8 +869,7 @@
869
869
  changed,
870
870
  changedTimes,
871
871
  get not() {
872
- isNot = !isNot;
873
- return this;
872
+ return createUntil(r, !isNot);
874
873
  }
875
874
  };
876
875
  return instance;
@@ -885,13 +884,15 @@
885
884
  changed,
886
885
  changedTimes,
887
886
  get not() {
888
- isNot = !isNot;
889
- return this;
887
+ return createUntil(r, !isNot);
890
888
  }
891
889
  };
892
890
  return instance;
893
891
  }
894
892
  }
893
+ function until(r) {
894
+ return createUntil(r);
895
+ }
895
896
 
896
897
  function useArrayEvery(list, fn) {
897
898
  return vueDemi.computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
@@ -947,8 +948,15 @@
947
948
  }
948
949
 
949
950
  const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
950
- const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
951
- const formatDate = (date, formatStr, locales) => {
951
+ const REGEX_FORMAT = /\[([^\]]+)]|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;
952
+ const defaultMeridiem = (hours, minutes, isLowercase, hasPeriod) => {
953
+ let m = hours < 12 ? "AM" : "PM";
954
+ if (hasPeriod)
955
+ m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
956
+ return isLowercase ? m.toLowerCase() : m;
957
+ };
958
+ const formatDate = (date, formatStr, options) => {
959
+ var _a;
952
960
  const years = date.getFullYear();
953
961
  const month = date.getMonth();
954
962
  const days = date.getDate();
@@ -957,11 +965,14 @@
957
965
  const seconds = date.getSeconds();
958
966
  const milliseconds = date.getMilliseconds();
959
967
  const day = date.getDay();
968
+ const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
960
969
  const matches = {
961
970
  YY: () => String(years).slice(-2),
962
971
  YYYY: () => years,
963
972
  M: () => month + 1,
964
973
  MM: () => `${month + 1}`.padStart(2, "0"),
974
+ MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
975
+ MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
965
976
  D: () => String(days),
966
977
  DD: () => `${days}`.padStart(2, "0"),
967
978
  H: () => String(hours),
@@ -974,9 +985,13 @@
974
985
  ss: () => `${seconds}`.padStart(2, "0"),
975
986
  SSS: () => `${milliseconds}`.padStart(3, "0"),
976
987
  d: () => day,
977
- dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
978
- ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
979
- dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
988
+ dd: () => date.toLocaleDateString(options.locales, { weekday: "narrow" }),
989
+ ddd: () => date.toLocaleDateString(options.locales, { weekday: "short" }),
990
+ dddd: () => date.toLocaleDateString(options.locales, { weekday: "long" }),
991
+ A: () => meridiem(hours, minutes),
992
+ AA: () => meridiem(hours, minutes, false, true),
993
+ a: () => meridiem(hours, minutes, true),
994
+ aa: () => meridiem(hours, minutes, true, true)
980
995
  };
981
996
  return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
982
997
  };
@@ -998,7 +1013,7 @@
998
1013
  return new Date(date);
999
1014
  };
1000
1015
  function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
1001
- return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
1016
+ return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options));
1002
1017
  }
1003
1018
 
1004
1019
  function useIntervalFn(cb, interval = 1e3, options = {}) {
@@ -1063,10 +1078,15 @@
1063
1078
  function useInterval(interval = 1e3, options = {}) {
1064
1079
  const {
1065
1080
  controls: exposeControls = false,
1066
- immediate = true
1081
+ immediate = true,
1082
+ callback
1067
1083
  } = options;
1068
1084
  const counter = vueDemi.ref(0);
1069
- const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
1085
+ const update = () => counter.value += 1;
1086
+ const controls = useIntervalFn(callback ? () => {
1087
+ update();
1088
+ callback(counter.value);
1089
+ } : update, interval, { immediate });
1070
1090
  if (exposeControls) {
1071
1091
  return __spreadValues$6({
1072
1092
  counter
@@ -1139,9 +1159,10 @@
1139
1159
  };
1140
1160
  function useTimeout(interval = 1e3, options = {}) {
1141
1161
  const {
1142
- controls: exposeControls = false
1162
+ controls: exposeControls = false,
1163
+ callback
1143
1164
  } = options;
1144
- const controls = useTimeoutFn(noop, interval, options);
1165
+ const controls = useTimeoutFn(callback != null ? callback : noop, interval, options);
1145
1166
  const ready = vueDemi.computed(() => !controls.isPending.value);
1146
1167
  if (exposeControls) {
1147
1168
  return __spreadValues$5({
@@ -1594,6 +1615,7 @@
1594
1615
  exports.extendRef = extendRef;
1595
1616
  exports.formatDate = formatDate;
1596
1617
  exports.get = get;
1618
+ exports.hasOwn = hasOwn;
1597
1619
  exports.identity = identity;
1598
1620
  exports.ignorableWatch = watchIgnorable;
1599
1621
  exports.increaseWithUnit = increaseWithUnit;
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- var VueDemi=function(o,i,j){if(o.install)return o;if(i)if(i.version.slice(0,4)==="2.7."){for(var w in i)o[w]=i[w];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else if(i.version.slice(0,2)==="2.")if(j){for(var w in j)o[w]=j[w];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(i.version.slice(0,2)==="3."){for(var w in i)o[w]=i[w];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=i,o.Vue2=void 0,o.version=i.version,o.set=function(O,P,b){return Array.isArray(O)?(O.length=Math.max(O.length,P),O.splice(P,1,b),b):(O[P]=b,b)},o.del=function(O,P){if(Array.isArray(O)){O.splice(P,1);return}delete O[P]}}else console.error("[vue-demi] Vue version "+i.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return o}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(o,i){"use strict";var j=Object.defineProperty,w=Object.defineProperties,O=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,Yt=Object.prototype.propertyIsEnumerable,J=(t,e,r)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Gt=(t,e)=>{for(var r in e||(e={}))b.call(e,r)&&J(t,r,e[r]);if(P)for(var r of P(e))Yt.call(e,r)&&J(t,r,e[r]);return t},kt=(t,e)=>w(t,O(e));function V(t,e){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=t()},kt(Gt({},e),{flush:(r=e==null?void 0:e.flush)!=null?r:"sync"})),i.readonly(n)}var X;const I=typeof window!="undefined",zt=t=>typeof t!="undefined",Zt=(t,...e)=>{t||console.warn(...e)},q=Object.prototype.toString,Jt=t=>typeof t=="boolean",U=t=>typeof t=="function",Vt=t=>typeof t=="number",Xt=t=>typeof t=="string",qt=t=>q.call(t)==="[object Object]",Kt=t=>typeof window!="undefined"&&q.call(t)==="[object Window]",Qt=()=>Date.now(),K=()=>+Date.now(),Dt=(t,e,r)=>Math.min(r,Math.max(e,t)),Q=()=>{},xt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),te=I&&((X=window==null?void 0:window.navigator)==null?void 0:X.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function y(t){return typeof t=="function"?t():i.unref(t)}function T(t,e){function r(...n){t(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})}return r}const E=t=>t();function B(t,e={}){let r,n;return l=>{const u=y(t),c=y(e.maxWait);if(r&&clearTimeout(r),u<=0||c!==void 0&&c<=0)return n&&(clearTimeout(n),n=null),l();c&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,l()},c)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,l()},u)}}function H(t,e=!0,r=!0){let n=0,a,l=!0;const u=()=>{a&&(clearTimeout(a),a=void 0)};return p=>{const _=y(t),f=Date.now()-n;if(u(),_<=0)return n=Date.now(),p();f>_&&(r||!l)?(n=Date.now(),p()):e&&(a=setTimeout(()=>{n=Date.now(),l=!0,u(),p()},_)),!r&&!a&&(a=setTimeout(()=>l=!0,_)),l=!1}}function D(t=E){const e=i.ref(!0);function r(){e.value=!1}function n(){e.value=!0}return{isActive:e,pause:r,resume:n,eventFilter:(...l)=>{e.value&&t(...l)}}}function x(t="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}const ee={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function L(t,e=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(e?()=>a(r):n,t)})}function re(t){return t}function ne(t){let e;function r(){return e||(e=t()),e}return r.reset=async()=>{const n=e;e=void 0,n&&await n},r}function oe(t){return t()}function ae(t,...e){return e.some(r=>r in t)}function ie(t,e){var r;if(typeof t=="number")return t+e;const n=((r=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:r[0])||"",a=t.slice(n.length),l=parseFloat(n)+e;return Number.isNaN(l)?t:l+a}function le(t,e,r=!1){return e.reduce((n,a)=>(a in t&&(!r||t[a]!==void 0)&&(n[a]=t[a]),n),{})}function tt(t,e){let r,n,a;const l=i.ref(!0),u=()=>{l.value=!0,a()};i.watch(t,u,{flush:"sync"});const c=U(e)?e:e.get,p=U(e)?void 0:e.set,_=i.customRef((f,s)=>(n=f,a=s,{get(){return l.value&&(r=c(),l.value=!1),n(),r},set(d){p==null||p(d)}}));return Object.isExtensible(_)&&(_.trigger=u),_}function ue(){const t=[],e=a=>{const l=t.indexOf(a);l!==-1&&t.splice(l,1)};return{on:a=>(t.push(a),{off:()=>e(a)}),off:e,trigger:a=>{t.forEach(l=>l(a))}}}function ce(t){let e=!1,r;const n=i.effectScope(!0);return()=>(e||(r=n.run(t),e=!0),r)}function se(t){const e=Symbol("InjectionState");return[(...a)=>{i.provide(e,t(...a))},()=>i.inject(e)]}function $(t){return i.getCurrentScope()?(i.onScopeDispose(t),!0):!1}function fe(t){let e=0,r,n;const a=()=>{e-=1,n&&e<=0&&(n.stop(),r=void 0,n=void 0)};return(...l)=>(e+=1,r||(n=i.effectScope(!0),r=n.run(()=>t(...l))),$(a),r)}function et(t,e,{enumerable:r=!1,unwrap:n=!0}={}){x();for(const[a,l]of Object.entries(e))a!=="value"&&(i.isRef(l)&&n?Object.defineProperty(t,a,{get(){return l.value},set(u){l.value=u},enumerable:r}):Object.defineProperty(t,a,{value:l,enumerable:r}));return t}function de(t,e){return e==null?i.unref(t):i.unref(t)[e]}function pe(t){return i.unref(t)!=null}var ye=Object.defineProperty,rt=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,nt=(t,e,r)=>e in t?ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,he=(t,e)=>{for(var r in e||(e={}))_e.call(e,r)&&nt(t,r,e[r]);if(rt)for(var r of rt(e))ve.call(e,r)&&nt(t,r,e[r]);return t};function Oe(t,e){if(typeof Symbol!="undefined"){const r=he({},t);return Object.defineProperty(r,Symbol.iterator,{enumerable:!1,value(){let n=0;return{next:()=>({value:e[n++],done:n>e.length})}}}),r}else return Object.assign([...e],t)}function Y(t,e){const r=(e==null?void 0:e.computedGetter)===!1?i.unref:y;return function(...n){return i.computed(()=>t.apply(this,n.map(a=>r(a))))}}function we(t,e={}){let r=[],n;if(Array.isArray(e))r=e;else{n=e;const{includeOwnProperties:a=!0}=e;r.push(...Object.keys(t)),a&&r.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(r.map(a=>{const l=t[a];return[a,typeof l=="function"?Y(l.bind(t),n):l]}))}function ot(t){if(!i.isRef(t))return i.reactive(t);const e=new Proxy({},{get(r,n,a){return i.unref(Reflect.get(t.value,n,a))},set(r,n,a){return i.isRef(t.value[n])&&!i.isRef(a)?t.value[n].value=a:t.value[n]=a,!0},deleteProperty(r,n){return Reflect.deleteProperty(t.value,n)},has(r,n){return Reflect.has(t.value,n)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return i.reactive(e)}function at(t){return ot(i.computed(t))}function ge(t,...e){const r=e.flat();return at(()=>Object.fromEntries(Object.entries(i.toRefs(t)).filter(n=>!r.includes(n[0]))))}function Pe(t,...e){const r=e.flat();return i.reactive(Object.fromEntries(r.map(n=>[n,i.toRef(t,n)])))}function it(t,e=1e4){return i.customRef((r,n)=>{let a=t,l;const u=()=>setTimeout(()=>{a=t,n()},y(e));return $(()=>{clearTimeout(l)}),{get(){return r(),a},set(c){a=c,n(),clearTimeout(l),l=u()}}})}function lt(t,e=200,r={}){return T(B(e,r),t)}function G(t,e=200,r={}){if(e<=0)return t;const n=i.ref(t.value),a=lt(()=>{n.value=t.value},e,r);return i.watch(t,()=>a()),n}function me(t,e){return i.computed({get(){var r;return(r=t.value)!=null?r:e},set(r){t.value=r}})}function ut(t,e=200,r=!1,n=!0){return T(H(e,r,n),t)}function k(t,e=200,r=!0,n=!0){if(e<=0)return t;const a=i.ref(t.value),l=ut(()=>{a.value=t.value},e,r,n);return i.watch(t,()=>l()),a}function ct(t,e={}){let r=t,n,a;const l=i.customRef((d,h)=>(n=d,a=h,{get(){return u()},set(v){c(v)}}));function u(d=!0){return d&&n(),r}function c(d,h=!0){var v,m;if(d===r)return;const g=r;((v=e.onBeforeChange)==null?void 0:v.call(e,d,g))!==!1&&(r=d,(m=e.onChanged)==null||m.call(e,d,g),h&&a())}return et(l,{get:u,set:c,untrackedGet:()=>u(!1),silentSet:d=>c(d,!1),peek:()=>u(!1),lay:d=>c(d,!1)},{enumerable:!0})}const be=ct;function $e(t){return typeof t=="function"?i.computed(t):i.ref(t)}function Se(...t){if(t.length===2){const[e,r]=t;e.value=r}if(t.length===3)if(i.isVue2)i.set(...t);else{const[e,r,n]=t;e[r]=n}}function Ae(t,e,r={}){var n,a;const{flush:l="sync",deep:u=!1,immediate:c=!0,direction:p="both",transform:_={}}=r;let f,s;const d=(n=_.ltr)!=null?n:v=>v,h=(a=_.rtl)!=null?a:v=>v;return(p==="both"||p==="ltr")&&(f=i.watch(t,v=>e.value=d(v),{flush:l,deep:u,immediate:c})),(p==="both"||p==="rtl")&&(s=i.watch(e,v=>t.value=h(v),{flush:l,deep:u,immediate:c})),()=>{f==null||f(),s==null||s()}}function je(t,e,r={}){const{flush:n="sync",deep:a=!1,immediate:l=!0}=r;return Array.isArray(e)||(e=[e]),i.watch(t,u=>e.forEach(c=>c.value=u),{flush:n,deep:a,immediate:l})}var Ie=Object.defineProperty,Te=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,st=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,ft=(t,e,r)=>e in t?Ie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ce=(t,e)=>{for(var r in e||(e={}))Ee.call(e,r)&&ft(t,r,e[r]);if(st)for(var r of st(e))Re.call(e,r)&&ft(t,r,e[r]);return t},Ne=(t,e)=>Te(t,Fe(e));function Me(t){if(!i.isRef(t))return i.toRefs(t);const e=Array.isArray(t.value)?new Array(t.value.length):{};for(const r in t.value)e[r]=i.customRef(()=>({get(){return t.value[r]},set(n){if(Array.isArray(t.value)){const a=[...t.value];a[r]=n,t.value=a}else{const a=Ne(Ce({},t.value),{[r]:n});Object.setPrototypeOf(a,t.value),t.value=a}}}));return e}function We(t,e=!0){i.getCurrentInstance()?i.onBeforeMount(t):e?t():i.nextTick(t)}function Ue(t){i.getCurrentInstance()&&i.onBeforeUnmount(t)}function Be(t,e=!0){i.getCurrentInstance()?i.onMounted(t):e?t():i.nextTick(t)}function He(t){i.getCurrentInstance()&&i.onUnmounted(t)}function Le(t){let e=!1;function r(s,{flush:d="sync",deep:h=!1,timeout:v,throwOnTimeout:m}={}){let g=null;const Z=[new Promise(W=>{g=i.watch(t,A=>{s(A)!==e&&(g==null||g(),W(A))},{flush:d,deep:h,immediate:!0})})];return v!=null&&Z.push(L(v,m).then(()=>y(t)).finally(()=>g==null?void 0:g())),Promise.race(Z)}function n(s,d){if(!i.isRef(s))return r(A=>A===s,d);const{flush:h="sync",deep:v=!1,timeout:m,throwOnTimeout:g}=d??{};let S=null;const W=[new Promise(A=>{S=i.watch([t,s],([Lt,nn])=>{e!==(Lt===nn)&&(S==null||S(),A(Lt))},{flush:h,deep:v,immediate:!0})})];return m!=null&&W.push(L(m,g).then(()=>y(t)).finally(()=>(S==null||S(),y(t)))),Promise.race(W)}function a(s){return r(d=>Boolean(d),s)}function l(s){return n(null,s)}function u(s){return n(void 0,s)}function c(s){return r(Number.isNaN,s)}function p(s,d){return r(h=>{const v=Array.from(h);return v.includes(s)||v.includes(y(s))},d)}function _(s){return f(1,s)}function f(s=1,d){let h=-1;return r(()=>(h+=1,h>=s),d)}return Array.isArray(y(t))?{toMatch:r,toContains:p,changed:_,changedTimes:f,get not(){return e=!e,this}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:l,toBeNaN:c,toBeUndefined:u,changed:_,changedTimes:f,get not(){return e=!e,this}}}function Ye(t,e){return i.computed(()=>y(t).every((r,n,a)=>e(y(r),n,a)))}function Ge(t,e){return i.computed(()=>y(t).map(r=>y(r)).filter(e))}function ke(t,e){return i.computed(()=>y(y(t).find((r,n,a)=>e(y(r),n,a))))}function ze(t,e){return i.computed(()=>y(t).findIndex((r,n,a)=>e(y(r),n,a)))}function Ze(t,e){return i.computed(()=>y(t).map(r=>y(r)).join(y(e)))}function Je(t,e){return i.computed(()=>y(t).map(r=>y(r)).map(e))}function Ve(t,e,...r){const n=(a,l,u)=>e(y(a),y(l),u);return i.computed(()=>{const a=y(t);return r.length?a.reduce(n,y(r[0])):a.reduce(n)})}function Xe(t,e){return i.computed(()=>y(t).some((r,n,a)=>e(y(r),n,a)))}function qe(t=0,e={}){const r=i.ref(t),{max:n=1/0,min:a=-1/0}=e,l=(f=1)=>r.value=Math.min(n,r.value+f),u=(f=1)=>r.value=Math.max(a,r.value-f),c=()=>r.value,p=f=>r.value=f;return{count:r,inc:l,dec:u,get:c,set:p,reset:(f=t)=>(t=f,p(f))}}const Ke=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Qe=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,dt=(t,e,r)=>{const n=t.getFullYear(),a=t.getMonth(),l=t.getDate(),u=t.getHours(),c=t.getMinutes(),p=t.getSeconds(),_=t.getMilliseconds(),f=t.getDay(),s={YY:()=>String(n).slice(-2),YYYY:()=>n,M:()=>a+1,MM:()=>`${a+1}`.padStart(2,"0"),D:()=>String(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(c),mm:()=>`${c}`.padStart(2,"0"),s:()=>String(p),ss:()=>`${p}`.padStart(2,"0"),SSS:()=>`${_}`.padStart(3,"0"),d:()=>f,dd:()=>t.toLocaleDateString(r,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(r,{weekday:"short"}),dddd:()=>t.toLocaleDateString(r,{weekday:"long"})};return e.replace(Qe,(d,h)=>h||s[d]())},pt=t=>{if(t===null)return new Date(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(Ke);if(e){const r=e[2]-1||0,n=(e[7]||"0").substring(0,3);return new Date(e[1],r,e[3]||1,e[4]||0,e[5]||0,e[6]||0,n)}}return new Date(t)};function De(t,e="HH:mm:ss",r={}){return i.computed(()=>dt(pt(y(t)),y(e),r==null?void 0:r.locales))}function yt(t,e=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let l=null;const u=i.ref(!1);function c(){l&&(clearInterval(l),l=null)}function p(){u.value=!1,c()}function _(){i.unref(e)<=0||(u.value=!0,a&&t(),c(),l=setInterval(t,y(e)))}if(n&&I&&_(),i.isRef(e)){const f=i.watch(e,()=>{u.value&&I&&_()});$(f)}return $(p),{isActive:u,pause:p,resume:_}}var xe=Object.defineProperty,_t=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable,vt=(t,e,r)=>e in t?xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rr=(t,e)=>{for(var r in e||(e={}))tr.call(e,r)&&vt(t,r,e[r]);if(_t)for(var r of _t(e))er.call(e,r)&&vt(t,r,e[r]);return t};function nr(t=1e3,e={}){const{controls:r=!1,immediate:n=!0}=e,a=i.ref(0),l=yt(()=>a.value+=1,t,{immediate:n});return r?rr({counter:a},l):a}function or(t,e={}){var r;const n=i.ref((r=e.initialValue)!=null?r:null);return i.watch(t,()=>n.value=K(),e),n}function ht(t,e,r={}){const{immediate:n=!0}=r,a=i.ref(!1);let l=null;function u(){l&&(clearTimeout(l),l=null)}function c(){a.value=!1,u()}function p(..._){u(),a.value=!0,l=setTimeout(()=>{a.value=!1,l=null,t(..._)},y(e))}return n&&(a.value=!0,I&&p()),$(c),{isPending:a,start:p,stop:c}}var ar=Object.defineProperty,Ot=Object.getOwnPropertySymbols,ir=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,wt=(t,e,r)=>e in t?ar(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ur=(t,e)=>{for(var r in e||(e={}))ir.call(e,r)&&wt(t,r,e[r]);if(Ot)for(var r of Ot(e))lr.call(e,r)&&wt(t,r,e[r]);return t};function cr(t=1e3,e={}){const{controls:r=!1}=e,n=ht(Q,t,e),a=i.computed(()=>!n.isPending.value);return r?ur({ready:a},n):a}function sr(t,e={}){const{method:r="parseFloat",radix:n,nanToZero:a}=e;return i.computed(()=>{let l=y(t);return typeof l=="string"&&(l=Number[r](l,n)),a&&isNaN(l)&&(l=0),l})}function fr(t){return i.computed(()=>`${y(t)}`)}function dr(t=!1,e={}){const{truthyValue:r=!0,falsyValue:n=!1}=e,a=i.isRef(t),l=i.ref(t);function u(c){if(arguments.length)return l.value=c,l.value;{const p=y(r);return l.value=l.value===p?y(n):p,l.value}}return a?u:[l,u]}function pr(t,e,r){let n=(r==null?void 0:r.immediate)?[]:[...t instanceof Function?t():Array.isArray(t)?t:i.unref(t)];return i.watch(t,(a,l,u)=>{const c=new Array(n.length),p=[];for(const f of a){let s=!1;for(let d=0;d<n.length;d++)if(!c[d]&&f===n[d]){c[d]=!0,s=!0;break}s||p.push(f)}const _=n.filter((f,s)=>!c[s]);e(a,n,p,_,u),n=[...a]},r)}var gt=Object.getOwnPropertySymbols,yr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,vr=(t,e)=>{var r={};for(var n in t)yr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&gt)for(var n of gt(t))e.indexOf(n)<0&&_r.call(t,n)&&(r[n]=t[n]);return r};function F(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=vr(n,["eventFilter"]);return i.watch(t,T(a,e),l)}var Pt=Object.getOwnPropertySymbols,hr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,wr=(t,e)=>{var r={};for(var n in t)hr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Pt)for(var n of Pt(t))e.indexOf(n)<0&&Or.call(t,n)&&(r[n]=t[n]);return r};function gr(t,e,r){const n=r,{count:a}=n,l=wr(n,["count"]),u=i.ref(0),c=F(t,(...p)=>{u.value+=1,u.value>=y(a)&&i.nextTick(()=>c()),e(...p)},l);return{count:u,stop:c}}var Pr=Object.defineProperty,mr=Object.defineProperties,br=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable,$t=(t,e,r)=>e in t?Pr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$r=(t,e)=>{for(var r in e||(e={}))mt.call(e,r)&&$t(t,r,e[r]);if(R)for(var r of R(e))bt.call(e,r)&&$t(t,r,e[r]);return t},Sr=(t,e)=>mr(t,br(e)),Ar=(t,e)=>{var r={};for(var n in t)mt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&R)for(var n of R(t))e.indexOf(n)<0&&bt.call(t,n)&&(r[n]=t[n]);return r};function St(t,e,r={}){const n=r,{debounce:a=0,maxWait:l=void 0}=n,u=Ar(n,["debounce","maxWait"]);return F(t,e,Sr($r({},u),{eventFilter:B(a,{maxWait:l})}))}var jr=Object.defineProperty,Ir=Object.defineProperties,Tr=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,It=(t,e,r)=>e in t?jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fr=(t,e)=>{for(var r in e||(e={}))At.call(e,r)&&It(t,r,e[r]);if(C)for(var r of C(e))jt.call(e,r)&&It(t,r,e[r]);return t},Er=(t,e)=>Ir(t,Tr(e)),Rr=(t,e)=>{var r={};for(var n in t)At.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&C)for(var n of C(t))e.indexOf(n)<0&&jt.call(t,n)&&(r[n]=t[n]);return r};function z(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=Rr(n,["eventFilter"]),u=T(a,e);let c,p,_;if(l.flush==="sync"){const f=i.ref(!1);p=()=>{},c=s=>{f.value=!0,s(),f.value=!1},_=i.watch(t,(...s)=>{f.value||u(...s)},l)}else{const f=[],s=i.ref(0),d=i.ref(0);p=()=>{s.value=d.value},f.push(i.watch(t,()=>{d.value++},Er(Fr({},l),{flush:"sync"}))),c=h=>{const v=d.value;h(),s.value+=d.value-v},f.push(i.watch(t,(...h)=>{const v=s.value>0&&s.value===d.value;s.value=0,d.value=0,!v&&u(...h)},l)),_=()=>{f.forEach(h=>h())}}return{stop:_,ignoreUpdates:c,ignorePrevAsyncUpdates:p}}function Cr(t,e,r){const n=i.watch(t,(...a)=>(i.nextTick(()=>n()),e(...a)),r)}var Nr=Object.defineProperty,Mr=Object.defineProperties,Wr=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Tt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Et=(t,e,r)=>e in t?Nr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ur=(t,e)=>{for(var r in e||(e={}))Tt.call(e,r)&&Et(t,r,e[r]);if(N)for(var r of N(e))Ft.call(e,r)&&Et(t,r,e[r]);return t},Br=(t,e)=>Mr(t,Wr(e)),Hr=(t,e)=>{var r={};for(var n in t)Tt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&N)for(var n of N(t))e.indexOf(n)<0&&Ft.call(t,n)&&(r[n]=t[n]);return r};function Rt(t,e,r={}){const n=r,{eventFilter:a}=n,l=Hr(n,["eventFilter"]),{eventFilter:u,pause:c,resume:p,isActive:_}=D(a);return{stop:F(t,e,Br(Ur({},l),{eventFilter:u})),pause:c,resume:p,isActive:_}}var Lr=Object.defineProperty,Yr=Object.defineProperties,Gr=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,Mt=(t,e,r)=>e in t?Lr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kr=(t,e)=>{for(var r in e||(e={}))Ct.call(e,r)&&Mt(t,r,e[r]);if(M)for(var r of M(e))Nt.call(e,r)&&Mt(t,r,e[r]);return t},zr=(t,e)=>Yr(t,Gr(e)),Zr=(t,e)=>{var r={};for(var n in t)Ct.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&M)for(var n of M(t))e.indexOf(n)<0&&Nt.call(t,n)&&(r[n]=t[n]);return r};function Wt(t,e,r={}){const n=r,{throttle:a=0,trailing:l=!0,leading:u=!0}=n,c=Zr(n,["throttle","trailing","leading"]);return F(t,e,zr(kr({},c),{eventFilter:H(a,l,u)}))}var Jr=Object.defineProperty,Vr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,Ut=Object.getOwnPropertySymbols,qr=Object.prototype.hasOwnProperty,Kr=Object.prototype.propertyIsEnumerable,Bt=(t,e,r)=>e in t?Jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qr=(t,e)=>{for(var r in e||(e={}))qr.call(e,r)&&Bt(t,r,e[r]);if(Ut)for(var r of Ut(e))Kr.call(e,r)&&Bt(t,r,e[r]);return t},Dr=(t,e)=>Vr(t,Xr(e));function xr(t,e,r={}){let n;function a(){if(!n)return;const f=n;n=void 0,f()}function l(f){n=f}const u=(f,s)=>(a(),e(f,s,l)),c=z(t,u,r),{ignoreUpdates:p}=c,_=()=>{let f;return p(()=>{f=u(tn(t),en(t))}),f};return Dr(Qr({},c),{trigger:_})}function tn(t){return i.isReactive(t)?t:Array.isArray(t)?t.map(e=>Ht(e)):Ht(t)}function Ht(t){return typeof t=="function"?t():i.unref(t)}function en(t){return Array.isArray(t)?t.map(()=>{}):void 0}function rn(t,e,r){return i.watch(t,(n,a,l)=>{n&&e(n,a,l)},r)}o.__onlyVue3=x,o.assert=Zt,o.autoResetRef=it,o.bypassFilter=E,o.clamp=Dt,o.computedEager=V,o.computedWithControl=tt,o.containsProp=ae,o.controlledComputed=tt,o.controlledRef=be,o.createEventHook=ue,o.createFilterWrapper=T,o.createGlobalState=ce,o.createInjectionState=se,o.createReactiveFn=Y,o.createSharedComposable=fe,o.createSingletonPromise=ne,o.debounceFilter=B,o.debouncedRef=G,o.debouncedWatch=St,o.directiveHooks=ee,o.eagerComputed=V,o.extendRef=et,o.formatDate=dt,o.get=de,o.identity=re,o.ignorableWatch=z,o.increaseWithUnit=ie,o.invoke=oe,o.isBoolean=Jt,o.isClient=I,o.isDef=zt,o.isDefined=pe,o.isFunction=U,o.isIOS=te,o.isNumber=Vt,o.isObject=qt,o.isString=Xt,o.isWindow=Kt,o.makeDestructurable=Oe,o.noop=Q,o.normalizeDate=pt,o.now=Qt,o.objectPick=le,o.pausableFilter=D,o.pausableWatch=Rt,o.promiseTimeout=L,o.rand=xt,o.reactify=Y,o.reactifyObject=we,o.reactiveComputed=at,o.reactiveOmit=ge,o.reactivePick=Pe,o.refAutoReset=it,o.refDebounced=G,o.refDefault=me,o.refThrottled=k,o.refWithControl=ct,o.resolveRef=$e,o.resolveUnref=y,o.set=Se,o.syncRef=Ae,o.syncRefs=je,o.throttleFilter=H,o.throttledRef=k,o.throttledWatch=Wt,o.timestamp=K,o.toReactive=ot,o.toRefs=Me,o.tryOnBeforeMount=We,o.tryOnBeforeUnmount=Ue,o.tryOnMounted=Be,o.tryOnScopeDispose=$,o.tryOnUnmounted=He,o.until=Le,o.useArrayEvery=Ye,o.useArrayFilter=Ge,o.useArrayFind=ke,o.useArrayFindIndex=ze,o.useArrayJoin=Ze,o.useArrayMap=Je,o.useArrayReduce=Ve,o.useArraySome=Xe,o.useCounter=qe,o.useDateFormat=De,o.useDebounce=G,o.useDebounceFn=lt,o.useInterval=nr,o.useIntervalFn=yt,o.useLastChanged=or,o.useThrottle=k,o.useThrottleFn=ut,o.useTimeout=cr,o.useTimeoutFn=ht,o.useToNumber=sr,o.useToString=fr,o.useToggle=dr,o.watchArray=pr,o.watchAtMost=gr,o.watchDebounced=St,o.watchIgnorable=z,o.watchOnce=Cr,o.watchPausable=Rt,o.watchThrottled=Wt,o.watchTriggerable=xr,o.watchWithFilter=F,o.whenever=rn,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi);
1
+ var VueDemi=function(o,i,j){if(o.install)return o;if(i)if(i.version.slice(0,4)==="2.7."){for(var w in i)o[w]=i[w];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else if(i.version.slice(0,2)==="2.")if(j){for(var w in j)o[w]=j[w];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(i.version.slice(0,2)==="3."){for(var w in i)o[w]=i[w];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=i,o.Vue2=void 0,o.version=i.version,o.set=function(O,P,b){return Array.isArray(O)?(O.length=Math.max(O.length,P),O.splice(P,1,b),b):(O[P]=b,b)},o.del=function(O,P){if(Array.isArray(O)){O.splice(P,1);return}delete O[P]}}else console.error("[vue-demi] Vue version "+i.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return o}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(o,i){"use strict";var j=Object.defineProperty,w=Object.defineProperties,O=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,V=(t,e,r)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kt=(t,e)=>{for(var r in e||(e={}))b.call(e,r)&&V(t,r,e[r]);if(P)for(var r of P(e))Gt.call(e,r)&&V(t,r,e[r]);return t},zt=(t,e)=>w(t,O(e));function X(t,e){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=t()},zt(kt({},e),{flush:(r=e==null?void 0:e.flush)!=null?r:"sync"})),i.readonly(n)}var q;const I=typeof window!="undefined",Zt=t=>typeof t!="undefined",Jt=(t,...e)=>{t||console.warn(...e)},K=Object.prototype.toString,Vt=t=>typeof t=="boolean",U=t=>typeof t=="function",Xt=t=>typeof t=="number",qt=t=>typeof t=="string",Kt=t=>K.call(t)==="[object Object]",Qt=t=>typeof window!="undefined"&&K.call(t)==="[object Window]",Dt=()=>Date.now(),Q=()=>+Date.now(),xt=(t,e,r)=>Math.min(r,Math.max(e,t)),D=()=>{},te=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),ee=I&&((q=window==null?void 0:window.navigator)==null?void 0:q.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent),re=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function y(t){return typeof t=="function"?t():i.unref(t)}function T(t,e){function r(...n){t(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})}return r}const E=t=>t();function B(t,e={}){let r,n;return l=>{const u=y(t),c=y(e.maxWait);if(r&&clearTimeout(r),u<=0||c!==void 0&&c<=0)return n&&(clearTimeout(n),n=null),l();c&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,l()},c)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,l()},u)}}function L(t,e=!0,r=!0){let n=0,a,l=!0;const u=()=>{a&&(clearTimeout(a),a=void 0)};return d=>{const _=y(t),f=Date.now()-n;if(u(),_<=0)return n=Date.now(),d();f>_&&(r||!l)?(n=Date.now(),d()):e&&(a=setTimeout(()=>{n=Date.now(),l=!0,u(),d()},_)),!r&&!a&&(a=setTimeout(()=>l=!0,_)),l=!1}}function x(t=E){const e=i.ref(!0);function r(){e.value=!1}function n(){e.value=!0}return{isActive:e,pause:r,resume:n,eventFilter:(...l)=>{e.value&&t(...l)}}}function tt(t="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}const ne={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function H(t,e=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(e?()=>a(r):n,t)})}function oe(t){return t}function ae(t){let e;function r(){return e||(e=t()),e}return r.reset=async()=>{const n=e;e=void 0,n&&await n},r}function ie(t){return t()}function le(t,...e){return e.some(r=>r in t)}function ue(t,e){var r;if(typeof t=="number")return t+e;const n=((r=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:r[0])||"",a=t.slice(n.length),l=parseFloat(n)+e;return Number.isNaN(l)?t:l+a}function ce(t,e,r=!1){return e.reduce((n,a)=>(a in t&&(!r||t[a]!==void 0)&&(n[a]=t[a]),n),{})}function et(t,e){let r,n,a;const l=i.ref(!0),u=()=>{l.value=!0,a()};i.watch(t,u,{flush:"sync"});const c=U(e)?e:e.get,d=U(e)?void 0:e.set,_=i.customRef((f,s)=>(n=f,a=s,{get(){return l.value&&(r=c(),l.value=!1),n(),r},set(p){d==null||d(p)}}));return Object.isExtensible(_)&&(_.trigger=u),_}function se(){const t=[],e=a=>{const l=t.indexOf(a);l!==-1&&t.splice(l,1)};return{on:a=>(t.push(a),{off:()=>e(a)}),off:e,trigger:a=>{t.forEach(l=>l(a))}}}function fe(t){let e=!1,r;const n=i.effectScope(!0);return()=>(e||(r=n.run(t),e=!0),r)}function de(t){const e=Symbol("InjectionState");return[(...a)=>{i.provide(e,t(...a))},()=>i.inject(e)]}function $(t){return i.getCurrentScope()?(i.onScopeDispose(t),!0):!1}function pe(t){let e=0,r,n;const a=()=>{e-=1,n&&e<=0&&(n.stop(),r=void 0,n=void 0)};return(...l)=>(e+=1,r||(n=i.effectScope(!0),r=n.run(()=>t(...l))),$(a),r)}function rt(t,e,{enumerable:r=!1,unwrap:n=!0}={}){tt();for(const[a,l]of Object.entries(e))a!=="value"&&(i.isRef(l)&&n?Object.defineProperty(t,a,{get(){return l.value},set(u){l.value=u},enumerable:r}):Object.defineProperty(t,a,{value:l,enumerable:r}));return t}function ye(t,e){return e==null?i.unref(t):i.unref(t)[e]}function _e(t){return i.unref(t)!=null}var ve=Object.defineProperty,nt=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ot=(t,e,r)=>e in t?ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,we=(t,e)=>{for(var r in e||(e={}))he.call(e,r)&&ot(t,r,e[r]);if(nt)for(var r of nt(e))Oe.call(e,r)&&ot(t,r,e[r]);return t};function ge(t,e){if(typeof Symbol!="undefined"){const r=we({},t);return Object.defineProperty(r,Symbol.iterator,{enumerable:!1,value(){let n=0;return{next:()=>({value:e[n++],done:n>e.length})}}}),r}else return Object.assign([...e],t)}function Y(t,e){const r=(e==null?void 0:e.computedGetter)===!1?i.unref:y;return function(...n){return i.computed(()=>t.apply(this,n.map(a=>r(a))))}}function Pe(t,e={}){let r=[],n;if(Array.isArray(e))r=e;else{n=e;const{includeOwnProperties:a=!0}=e;r.push(...Object.keys(t)),a&&r.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(r.map(a=>{const l=t[a];return[a,typeof l=="function"?Y(l.bind(t),n):l]}))}function at(t){if(!i.isRef(t))return i.reactive(t);const e=new Proxy({},{get(r,n,a){return i.unref(Reflect.get(t.value,n,a))},set(r,n,a){return i.isRef(t.value[n])&&!i.isRef(a)?t.value[n].value=a:t.value[n]=a,!0},deleteProperty(r,n){return Reflect.deleteProperty(t.value,n)},has(r,n){return Reflect.has(t.value,n)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return i.reactive(e)}function it(t){return at(i.computed(t))}function me(t,...e){const r=e.flat();return it(()=>Object.fromEntries(Object.entries(i.toRefs(t)).filter(n=>!r.includes(n[0]))))}function be(t,...e){const r=e.flat();return i.reactive(Object.fromEntries(r.map(n=>[n,i.toRef(t,n)])))}function lt(t,e=1e4){return i.customRef((r,n)=>{let a=t,l;const u=()=>setTimeout(()=>{a=t,n()},y(e));return $(()=>{clearTimeout(l)}),{get(){return r(),a},set(c){a=c,n(),clearTimeout(l),l=u()}}})}function ut(t,e=200,r={}){return T(B(e,r),t)}function G(t,e=200,r={}){if(e<=0)return t;const n=i.ref(t.value),a=ut(()=>{n.value=t.value},e,r);return i.watch(t,()=>a()),n}function $e(t,e){return i.computed({get(){var r;return(r=t.value)!=null?r:e},set(r){t.value=r}})}function ct(t,e=200,r=!1,n=!0){return T(L(e,r,n),t)}function k(t,e=200,r=!0,n=!0){if(e<=0)return t;const a=i.ref(t.value),l=ct(()=>{a.value=t.value},e,r,n);return i.watch(t,()=>l()),a}function st(t,e={}){let r=t,n,a;const l=i.customRef((p,h)=>(n=p,a=h,{get(){return u()},set(v){c(v)}}));function u(p=!0){return p&&n(),r}function c(p,h=!0){var v,m;if(p===r)return;const g=r;((v=e.onBeforeChange)==null?void 0:v.call(e,p,g))!==!1&&(r=p,(m=e.onChanged)==null||m.call(e,p,g),h&&a())}return rt(l,{get:u,set:c,untrackedGet:()=>u(!1),silentSet:p=>c(p,!1),peek:()=>u(!1),lay:p=>c(p,!1)},{enumerable:!0})}const Se=st;function Ae(t){return typeof t=="function"?i.computed(t):i.ref(t)}function je(...t){if(t.length===2){const[e,r]=t;e.value=r}if(t.length===3)if(i.isVue2)i.set(...t);else{const[e,r,n]=t;e[r]=n}}function Ie(t,e,r={}){var n,a;const{flush:l="sync",deep:u=!1,immediate:c=!0,direction:d="both",transform:_={}}=r;let f,s;const p=(n=_.ltr)!=null?n:v=>v,h=(a=_.rtl)!=null?a:v=>v;return(d==="both"||d==="ltr")&&(f=i.watch(t,v=>e.value=p(v),{flush:l,deep:u,immediate:c})),(d==="both"||d==="rtl")&&(s=i.watch(e,v=>t.value=h(v),{flush:l,deep:u,immediate:c})),()=>{f==null||f(),s==null||s()}}function Te(t,e,r={}){const{flush:n="sync",deep:a=!1,immediate:l=!0}=r;return Array.isArray(e)||(e=[e]),i.watch(t,u=>e.forEach(c=>c.value=u),{flush:n,deep:a,immediate:l})}var Fe=Object.defineProperty,Ee=Object.defineProperties,Me=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,dt=(t,e,r)=>e in t?Fe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ne=(t,e)=>{for(var r in e||(e={}))Re.call(e,r)&&dt(t,r,e[r]);if(ft)for(var r of ft(e))Ce.call(e,r)&&dt(t,r,e[r]);return t},We=(t,e)=>Ee(t,Me(e));function Ue(t){if(!i.isRef(t))return i.toRefs(t);const e=Array.isArray(t.value)?new Array(t.value.length):{};for(const r in t.value)e[r]=i.customRef(()=>({get(){return t.value[r]},set(n){if(Array.isArray(t.value)){const a=[...t.value];a[r]=n,t.value=a}else{const a=We(Ne({},t.value),{[r]:n});Object.setPrototypeOf(a,t.value),t.value=a}}}));return e}function Be(t,e=!0){i.getCurrentInstance()?i.onBeforeMount(t):e?t():i.nextTick(t)}function Le(t){i.getCurrentInstance()&&i.onBeforeUnmount(t)}function He(t,e=!0){i.getCurrentInstance()?i.onMounted(t):e?t():i.nextTick(t)}function Ye(t){i.getCurrentInstance()&&i.onUnmounted(t)}function z(t,e=!1){function r(s,{flush:p="sync",deep:h=!1,timeout:v,throwOnTimeout:m}={}){let g=null;const J=[new Promise(W=>{g=i.watch(t,A=>{s(A)!==e&&(g==null||g(),W(A))},{flush:p,deep:h,immediate:!0})})];return v!=null&&J.push(H(v,m).then(()=>y(t)).finally(()=>g==null?void 0:g())),Promise.race(J)}function n(s,p){if(!i.isRef(s))return r(A=>A===s,p);const{flush:h="sync",deep:v=!1,timeout:m,throwOnTimeout:g}=p??{};let S=null;const W=[new Promise(A=>{S=i.watch([t,s],([Yt,ln])=>{e!==(Yt===ln)&&(S==null||S(),A(Yt))},{flush:h,deep:v,immediate:!0})})];return m!=null&&W.push(H(m,g).then(()=>y(t)).finally(()=>(S==null||S(),y(t)))),Promise.race(W)}function a(s){return r(p=>Boolean(p),s)}function l(s){return n(null,s)}function u(s){return n(void 0,s)}function c(s){return r(Number.isNaN,s)}function d(s,p){return r(h=>{const v=Array.from(h);return v.includes(s)||v.includes(y(s))},p)}function _(s){return f(1,s)}function f(s=1,p){let h=-1;return r(()=>(h+=1,h>=s),p)}return Array.isArray(y(t))?{toMatch:r,toContains:d,changed:_,changedTimes:f,get not(){return z(t,!e)}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:l,toBeNaN:c,toBeUndefined:u,changed:_,changedTimes:f,get not(){return z(t,!e)}}}function Ge(t){return z(t)}function ke(t,e){return i.computed(()=>y(t).every((r,n,a)=>e(y(r),n,a)))}function ze(t,e){return i.computed(()=>y(t).map(r=>y(r)).filter(e))}function Ze(t,e){return i.computed(()=>y(y(t).find((r,n,a)=>e(y(r),n,a))))}function Je(t,e){return i.computed(()=>y(t).findIndex((r,n,a)=>e(y(r),n,a)))}function Ve(t,e){return i.computed(()=>y(t).map(r=>y(r)).join(y(e)))}function Xe(t,e){return i.computed(()=>y(t).map(r=>y(r)).map(e))}function qe(t,e,...r){const n=(a,l,u)=>e(y(a),y(l),u);return i.computed(()=>{const a=y(t);return r.length?a.reduce(n,y(r[0])):a.reduce(n)})}function Ke(t,e){return i.computed(()=>y(t).some((r,n,a)=>e(y(r),n,a)))}function Qe(t=0,e={}){const r=i.ref(t),{max:n=1/0,min:a=-1/0}=e,l=(f=1)=>r.value=Math.min(n,r.value+f),u=(f=1)=>r.value=Math.max(a,r.value-f),c=()=>r.value,d=f=>r.value=f;return{count:r,inc:l,dec:u,get:c,set:d,reset:(f=t)=>(t=f,d(f))}}const De=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,xe=/\[([^\]]+)]|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,tr=(t,e,r,n)=>{let a=t<12?"AM":"PM";return n&&(a=a.split("").reduce((l,u)=>l+=`${u}.`,"")),r?a.toLowerCase():a},pt=(t,e,r)=>{var n;const a=t.getFullYear(),l=t.getMonth(),u=t.getDate(),c=t.getHours(),d=t.getMinutes(),_=t.getSeconds(),f=t.getMilliseconds(),s=t.getDay(),p=(n=r.customMeridiem)!=null?n:tr,h={YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>l+1,MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(r.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(r.locales,{month:"long"}),D:()=>String(u),DD:()=>`${u}`.padStart(2,"0"),H:()=>String(c),HH:()=>`${c}`.padStart(2,"0"),h:()=>`${c%12||12}`.padStart(1,"0"),hh:()=>`${c%12||12}`.padStart(2,"0"),m:()=>String(d),mm:()=>`${d}`.padStart(2,"0"),s:()=>String(_),ss:()=>`${_}`.padStart(2,"0"),SSS:()=>`${f}`.padStart(3,"0"),d:()=>s,dd:()=>t.toLocaleDateString(r.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(r.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(r.locales,{weekday:"long"}),A:()=>p(c,d),AA:()=>p(c,d,!1,!0),a:()=>p(c,d,!0),aa:()=>p(c,d,!0,!0)};return e.replace(xe,(v,m)=>m||h[v]())},yt=t=>{if(t===null)return new Date(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(De);if(e){const r=e[2]-1||0,n=(e[7]||"0").substring(0,3);return new Date(e[1],r,e[3]||1,e[4]||0,e[5]||0,e[6]||0,n)}}return new Date(t)};function er(t,e="HH:mm:ss",r={}){return i.computed(()=>pt(yt(y(t)),y(e),r))}function _t(t,e=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let l=null;const u=i.ref(!1);function c(){l&&(clearInterval(l),l=null)}function d(){u.value=!1,c()}function _(){i.unref(e)<=0||(u.value=!0,a&&t(),c(),l=setInterval(t,y(e)))}if(n&&I&&_(),i.isRef(e)){const f=i.watch(e,()=>{u.value&&I&&_()});$(f)}return $(d),{isActive:u,pause:d,resume:_}}var rr=Object.defineProperty,vt=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,or=Object.prototype.propertyIsEnumerable,ht=(t,e,r)=>e in t?rr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ar=(t,e)=>{for(var r in e||(e={}))nr.call(e,r)&&ht(t,r,e[r]);if(vt)for(var r of vt(e))or.call(e,r)&&ht(t,r,e[r]);return t};function ir(t=1e3,e={}){const{controls:r=!1,immediate:n=!0,callback:a}=e,l=i.ref(0),u=()=>l.value+=1,c=_t(a?()=>{u(),a(l.value)}:u,t,{immediate:n});return r?ar({counter:l},c):l}function lr(t,e={}){var r;const n=i.ref((r=e.initialValue)!=null?r:null);return i.watch(t,()=>n.value=Q(),e),n}function Ot(t,e,r={}){const{immediate:n=!0}=r,a=i.ref(!1);let l=null;function u(){l&&(clearTimeout(l),l=null)}function c(){a.value=!1,u()}function d(..._){u(),a.value=!0,l=setTimeout(()=>{a.value=!1,l=null,t(..._)},y(e))}return n&&(a.value=!0,I&&d()),$(c),{isPending:a,start:d,stop:c}}var ur=Object.defineProperty,wt=Object.getOwnPropertySymbols,cr=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,gt=(t,e,r)=>e in t?ur(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fr=(t,e)=>{for(var r in e||(e={}))cr.call(e,r)&&gt(t,r,e[r]);if(wt)for(var r of wt(e))sr.call(e,r)&&gt(t,r,e[r]);return t};function dr(t=1e3,e={}){const{controls:r=!1,callback:n}=e,a=Ot(n??D,t,e),l=i.computed(()=>!a.isPending.value);return r?fr({ready:l},a):l}function pr(t,e={}){const{method:r="parseFloat",radix:n,nanToZero:a}=e;return i.computed(()=>{let l=y(t);return typeof l=="string"&&(l=Number[r](l,n)),a&&isNaN(l)&&(l=0),l})}function yr(t){return i.computed(()=>`${y(t)}`)}function _r(t=!1,e={}){const{truthyValue:r=!0,falsyValue:n=!1}=e,a=i.isRef(t),l=i.ref(t);function u(c){if(arguments.length)return l.value=c,l.value;{const d=y(r);return l.value=l.value===d?y(n):d,l.value}}return a?u:[l,u]}function vr(t,e,r){let n=(r==null?void 0:r.immediate)?[]:[...t instanceof Function?t():Array.isArray(t)?t:i.unref(t)];return i.watch(t,(a,l,u)=>{const c=new Array(n.length),d=[];for(const f of a){let s=!1;for(let p=0;p<n.length;p++)if(!c[p]&&f===n[p]){c[p]=!0,s=!0;break}s||d.push(f)}const _=n.filter((f,s)=>!c[s]);e(a,n,d,_,u),n=[...a]},r)}var Pt=Object.getOwnPropertySymbols,hr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,wr=(t,e)=>{var r={};for(var n in t)hr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Pt)for(var n of Pt(t))e.indexOf(n)<0&&Or.call(t,n)&&(r[n]=t[n]);return r};function F(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=wr(n,["eventFilter"]);return i.watch(t,T(a,e),l)}var mt=Object.getOwnPropertySymbols,gr=Object.prototype.hasOwnProperty,Pr=Object.prototype.propertyIsEnumerable,mr=(t,e)=>{var r={};for(var n in t)gr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&mt)for(var n of mt(t))e.indexOf(n)<0&&Pr.call(t,n)&&(r[n]=t[n]);return r};function br(t,e,r){const n=r,{count:a}=n,l=mr(n,["count"]),u=i.ref(0),c=F(t,(...d)=>{u.value+=1,u.value>=y(a)&&i.nextTick(()=>c()),e(...d)},l);return{count:u,stop:c}}var $r=Object.defineProperty,Sr=Object.defineProperties,Ar=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable,St=(t,e,r)=>e in t?$r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jr=(t,e)=>{for(var r in e||(e={}))bt.call(e,r)&&St(t,r,e[r]);if(M)for(var r of M(e))$t.call(e,r)&&St(t,r,e[r]);return t},Ir=(t,e)=>Sr(t,Ar(e)),Tr=(t,e)=>{var r={};for(var n in t)bt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&M)for(var n of M(t))e.indexOf(n)<0&&$t.call(t,n)&&(r[n]=t[n]);return r};function At(t,e,r={}){const n=r,{debounce:a=0,maxWait:l=void 0}=n,u=Tr(n,["debounce","maxWait"]);return F(t,e,Ir(jr({},u),{eventFilter:B(a,{maxWait:l})}))}var Fr=Object.defineProperty,Er=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,jt=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable,Tt=(t,e,r)=>e in t?Fr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rr=(t,e)=>{for(var r in e||(e={}))jt.call(e,r)&&Tt(t,r,e[r]);if(R)for(var r of R(e))It.call(e,r)&&Tt(t,r,e[r]);return t},Cr=(t,e)=>Er(t,Mr(e)),Nr=(t,e)=>{var r={};for(var n in t)jt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&R)for(var n of R(t))e.indexOf(n)<0&&It.call(t,n)&&(r[n]=t[n]);return r};function Z(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=Nr(n,["eventFilter"]),u=T(a,e);let c,d,_;if(l.flush==="sync"){const f=i.ref(!1);d=()=>{},c=s=>{f.value=!0,s(),f.value=!1},_=i.watch(t,(...s)=>{f.value||u(...s)},l)}else{const f=[],s=i.ref(0),p=i.ref(0);d=()=>{s.value=p.value},f.push(i.watch(t,()=>{p.value++},Cr(Rr({},l),{flush:"sync"}))),c=h=>{const v=p.value;h(),s.value+=p.value-v},f.push(i.watch(t,(...h)=>{const v=s.value>0&&s.value===p.value;s.value=0,p.value=0,!v&&u(...h)},l)),_=()=>{f.forEach(h=>h())}}return{stop:_,ignoreUpdates:c,ignorePrevAsyncUpdates:d}}function Wr(t,e,r){const n=i.watch(t,(...a)=>(i.nextTick(()=>n()),e(...a)),r)}var Ur=Object.defineProperty,Br=Object.defineProperties,Lr=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable,Mt=(t,e,r)=>e in t?Ur(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hr=(t,e)=>{for(var r in e||(e={}))Ft.call(e,r)&&Mt(t,r,e[r]);if(C)for(var r of C(e))Et.call(e,r)&&Mt(t,r,e[r]);return t},Yr=(t,e)=>Br(t,Lr(e)),Gr=(t,e)=>{var r={};for(var n in t)Ft.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&C)for(var n of C(t))e.indexOf(n)<0&&Et.call(t,n)&&(r[n]=t[n]);return r};function Rt(t,e,r={}){const n=r,{eventFilter:a}=n,l=Gr(n,["eventFilter"]),{eventFilter:u,pause:c,resume:d,isActive:_}=x(a);return{stop:F(t,e,Yr(Hr({},l),{eventFilter:u})),pause:c,resume:d,isActive:_}}var kr=Object.defineProperty,zr=Object.defineProperties,Zr=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,Wt=(t,e,r)=>e in t?kr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jr=(t,e)=>{for(var r in e||(e={}))Ct.call(e,r)&&Wt(t,r,e[r]);if(N)for(var r of N(e))Nt.call(e,r)&&Wt(t,r,e[r]);return t},Vr=(t,e)=>zr(t,Zr(e)),Xr=(t,e)=>{var r={};for(var n in t)Ct.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&N)for(var n of N(t))e.indexOf(n)<0&&Nt.call(t,n)&&(r[n]=t[n]);return r};function Ut(t,e,r={}){const n=r,{throttle:a=0,trailing:l=!0,leading:u=!0}=n,c=Xr(n,["throttle","trailing","leading"]);return F(t,e,Vr(Jr({},c),{eventFilter:L(a,l,u)}))}var qr=Object.defineProperty,Kr=Object.defineProperties,Qr=Object.getOwnPropertyDescriptors,Bt=Object.getOwnPropertySymbols,Dr=Object.prototype.hasOwnProperty,xr=Object.prototype.propertyIsEnumerable,Lt=(t,e,r)=>e in t?qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))Dr.call(e,r)&&Lt(t,r,e[r]);if(Bt)for(var r of Bt(e))xr.call(e,r)&&Lt(t,r,e[r]);return t},en=(t,e)=>Kr(t,Qr(e));function rn(t,e,r={}){let n;function a(){if(!n)return;const f=n;n=void 0,f()}function l(f){n=f}const u=(f,s)=>(a(),e(f,s,l)),c=Z(t,u,r),{ignoreUpdates:d}=c,_=()=>{let f;return d(()=>{f=u(nn(t),on(t))}),f};return en(tn({},c),{trigger:_})}function nn(t){return i.isReactive(t)?t:Array.isArray(t)?t.map(e=>Ht(e)):Ht(t)}function Ht(t){return typeof t=="function"?t():i.unref(t)}function on(t){return Array.isArray(t)?t.map(()=>{}):void 0}function an(t,e,r){return i.watch(t,(n,a,l)=>{n&&e(n,a,l)},r)}o.__onlyVue3=tt,o.assert=Jt,o.autoResetRef=lt,o.bypassFilter=E,o.clamp=xt,o.computedEager=X,o.computedWithControl=et,o.containsProp=le,o.controlledComputed=et,o.controlledRef=Se,o.createEventHook=se,o.createFilterWrapper=T,o.createGlobalState=fe,o.createInjectionState=de,o.createReactiveFn=Y,o.createSharedComposable=pe,o.createSingletonPromise=ae,o.debounceFilter=B,o.debouncedRef=G,o.debouncedWatch=At,o.directiveHooks=ne,o.eagerComputed=X,o.extendRef=rt,o.formatDate=pt,o.get=ye,o.hasOwn=re,o.identity=oe,o.ignorableWatch=Z,o.increaseWithUnit=ue,o.invoke=ie,o.isBoolean=Vt,o.isClient=I,o.isDef=Zt,o.isDefined=_e,o.isFunction=U,o.isIOS=ee,o.isNumber=Xt,o.isObject=Kt,o.isString=qt,o.isWindow=Qt,o.makeDestructurable=ge,o.noop=D,o.normalizeDate=yt,o.now=Dt,o.objectPick=ce,o.pausableFilter=x,o.pausableWatch=Rt,o.promiseTimeout=H,o.rand=te,o.reactify=Y,o.reactifyObject=Pe,o.reactiveComputed=it,o.reactiveOmit=me,o.reactivePick=be,o.refAutoReset=lt,o.refDebounced=G,o.refDefault=$e,o.refThrottled=k,o.refWithControl=st,o.resolveRef=Ae,o.resolveUnref=y,o.set=je,o.syncRef=Ie,o.syncRefs=Te,o.throttleFilter=L,o.throttledRef=k,o.throttledWatch=Ut,o.timestamp=Q,o.toReactive=at,o.toRefs=Ue,o.tryOnBeforeMount=Be,o.tryOnBeforeUnmount=Le,o.tryOnMounted=He,o.tryOnScopeDispose=$,o.tryOnUnmounted=Ye,o.until=Ge,o.useArrayEvery=ke,o.useArrayFilter=ze,o.useArrayFind=Ze,o.useArrayFindIndex=Je,o.useArrayJoin=Ve,o.useArrayMap=Xe,o.useArrayReduce=qe,o.useArraySome=Ke,o.useCounter=Qe,o.useDateFormat=er,o.useDebounce=G,o.useDebounceFn=ut,o.useInterval=ir,o.useIntervalFn=_t,o.useLastChanged=lr,o.useThrottle=k,o.useThrottleFn=ct,o.useTimeout=dr,o.useTimeoutFn=Ot,o.useToNumber=pr,o.useToString=yr,o.useToggle=_r,o.watchArray=vr,o.watchAtMost=br,o.watchDebounced=At,o.watchIgnorable=Z,o.watchOnce=Wr,o.watchPausable=Rt,o.watchThrottled=Ut,o.watchTriggerable=rn,o.watchWithFilter=F,o.whenever=an,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi);
package/index.mjs CHANGED
@@ -55,6 +55,7 @@ const rand = (min, max) => {
55
55
  return Math.floor(Math.random() * (max - min + 1)) + min;
56
56
  };
57
57
  const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
58
+ const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
58
59
 
59
60
  function resolveUnref(r) {
60
61
  return typeof r === "function" ? r() : unref(r);
@@ -712,8 +713,7 @@ function tryOnUnmounted(fn) {
712
713
  onUnmounted(fn);
713
714
  }
714
715
 
715
- function until(r) {
716
- let isNot = false;
716
+ function createUntil(r, isNot = false) {
717
717
  function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
718
718
  let stop = null;
719
719
  const watcher = new Promise((resolve) => {
@@ -795,8 +795,7 @@ function until(r) {
795
795
  changed,
796
796
  changedTimes,
797
797
  get not() {
798
- isNot = !isNot;
799
- return this;
798
+ return createUntil(r, !isNot);
800
799
  }
801
800
  };
802
801
  return instance;
@@ -811,13 +810,15 @@ function until(r) {
811
810
  changed,
812
811
  changedTimes,
813
812
  get not() {
814
- isNot = !isNot;
815
- return this;
813
+ return createUntil(r, !isNot);
816
814
  }
817
815
  };
818
816
  return instance;
819
817
  }
820
818
  }
819
+ function until(r) {
820
+ return createUntil(r);
821
+ }
821
822
 
822
823
  function useArrayEvery(list, fn) {
823
824
  return computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
@@ -873,8 +874,15 @@ function useCounter(initialValue = 0, options = {}) {
873
874
  }
874
875
 
875
876
  const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
876
- const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
877
- const formatDate = (date, formatStr, locales) => {
877
+ const REGEX_FORMAT = /\[([^\]]+)]|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;
878
+ const defaultMeridiem = (hours, minutes, isLowercase, hasPeriod) => {
879
+ let m = hours < 12 ? "AM" : "PM";
880
+ if (hasPeriod)
881
+ m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
882
+ return isLowercase ? m.toLowerCase() : m;
883
+ };
884
+ const formatDate = (date, formatStr, options) => {
885
+ var _a;
878
886
  const years = date.getFullYear();
879
887
  const month = date.getMonth();
880
888
  const days = date.getDate();
@@ -883,11 +891,14 @@ const formatDate = (date, formatStr, locales) => {
883
891
  const seconds = date.getSeconds();
884
892
  const milliseconds = date.getMilliseconds();
885
893
  const day = date.getDay();
894
+ const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
886
895
  const matches = {
887
896
  YY: () => String(years).slice(-2),
888
897
  YYYY: () => years,
889
898
  M: () => month + 1,
890
899
  MM: () => `${month + 1}`.padStart(2, "0"),
900
+ MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
901
+ MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
891
902
  D: () => String(days),
892
903
  DD: () => `${days}`.padStart(2, "0"),
893
904
  H: () => String(hours),
@@ -900,9 +911,13 @@ const formatDate = (date, formatStr, locales) => {
900
911
  ss: () => `${seconds}`.padStart(2, "0"),
901
912
  SSS: () => `${milliseconds}`.padStart(3, "0"),
902
913
  d: () => day,
903
- dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
904
- ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
905
- dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
914
+ dd: () => date.toLocaleDateString(options.locales, { weekday: "narrow" }),
915
+ ddd: () => date.toLocaleDateString(options.locales, { weekday: "short" }),
916
+ dddd: () => date.toLocaleDateString(options.locales, { weekday: "long" }),
917
+ A: () => meridiem(hours, minutes),
918
+ AA: () => meridiem(hours, minutes, false, true),
919
+ a: () => meridiem(hours, minutes, true),
920
+ aa: () => meridiem(hours, minutes, true, true)
906
921
  };
907
922
  return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
908
923
  };
@@ -924,7 +939,7 @@ const normalizeDate = (date) => {
924
939
  return new Date(date);
925
940
  };
926
941
  function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
927
- return computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
942
+ return computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options));
928
943
  }
929
944
 
930
945
  function useIntervalFn(cb, interval = 1e3, options = {}) {
@@ -989,10 +1004,15 @@ var __spreadValues$6 = (a, b) => {
989
1004
  function useInterval(interval = 1e3, options = {}) {
990
1005
  const {
991
1006
  controls: exposeControls = false,
992
- immediate = true
1007
+ immediate = true,
1008
+ callback
993
1009
  } = options;
994
1010
  const counter = ref(0);
995
- const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
1011
+ const update = () => counter.value += 1;
1012
+ const controls = useIntervalFn(callback ? () => {
1013
+ update();
1014
+ callback(counter.value);
1015
+ } : update, interval, { immediate });
996
1016
  if (exposeControls) {
997
1017
  return __spreadValues$6({
998
1018
  counter
@@ -1065,9 +1085,10 @@ var __spreadValues$5 = (a, b) => {
1065
1085
  };
1066
1086
  function useTimeout(interval = 1e3, options = {}) {
1067
1087
  const {
1068
- controls: exposeControls = false
1088
+ controls: exposeControls = false,
1089
+ callback
1069
1090
  } = options;
1070
- const controls = useTimeoutFn(noop, interval, options);
1091
+ const controls = useTimeoutFn(callback != null ? callback : noop, interval, options);
1071
1092
  const ready = computed(() => !controls.isPending.value);
1072
1093
  if (exposeControls) {
1073
1094
  return __spreadValues$5({
@@ -1495,4 +1516,4 @@ function whenever(source, cb, options) {
1495
1516
  }, options);
1496
1517
  }
1497
1518
 
1498
- export { __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, 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, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1519
+ export { __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, 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, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/shared",
3
- "version": "9.1.1",
3
+ "version": "9.3.0",
4
4
  "author": "Anthony Fu <https://github.com/antfu>",
5
5
  "license": "MIT",
6
6
  "funding": "https://github.com/sponsors/antfu",