@vueuse/shared 13.4.0 → 13.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.mts CHANGED
@@ -166,6 +166,8 @@ type EventHookReturn<T> = EventHook<T>;
166
166
  * Utility for creating event hooks
167
167
  *
168
168
  * @see https://vueuse.org/createEventHook
169
+ *
170
+ * @__NO_SIDE_EFFECTS__
169
171
  */
170
172
  declare function createEventHook<T = any>(): EventHookReturn<T>;
171
173
 
@@ -327,6 +329,8 @@ type CreateGlobalStateReturn<Fn extends AnyFn = AnyFn> = Fn;
327
329
  *
328
330
  * @see https://vueuse.org/createGlobalState
329
331
  * @param stateFactory A factory function to create the state
332
+ *
333
+ * @__NO_SIDE_EFFECTS__
330
334
  */
331
335
  declare function createGlobalState<Fn extends AnyFn>(stateFactory: Fn): CreateGlobalStateReturn<Fn>;
332
336
 
@@ -345,6 +349,7 @@ interface CreateInjectionStateOptions<Return> {
345
349
  *
346
350
  * @see https://vueuse.org/createInjectionState
347
351
  *
352
+ * @__NO_SIDE_EFFECTS__
348
353
  */
349
354
  declare function createInjectionState<Arguments extends Array<any>, Return>(composable: (...args: Arguments) => Return, options?: CreateInjectionStateOptions<Return>): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined];
350
355
 
@@ -362,6 +367,8 @@ type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref
362
367
  * @param value
363
368
  * @param deep
364
369
  * @returns the `deepRef` or `shallowRef`
370
+ *
371
+ * @__NO_SIDE_EFFECTS__
365
372
  */
366
373
  declare function createRef<T = any, D extends boolean = false>(value: T, deep?: D): CreateRefReturn<T, D>;
367
374
 
@@ -370,6 +377,8 @@ type SharedComposableReturn<T extends AnyFn = AnyFn> = T;
370
377
  * Make a composable function usable with multiple Vue instances.
371
378
  *
372
379
  * @see https://vueuse.org/createSharedComposable
380
+ *
381
+ * @__NO_SIDE_EFFECTS__
373
382
  */
374
383
  declare function createSharedComposable<Fn extends AnyFn>(composable: Fn): SharedComposableReturn<Fn>;
375
384
 
@@ -411,6 +420,8 @@ declare function get<T, K extends keyof T>(ref: MaybeRef<T>, key: K): T[K];
411
420
  * injectLocal('MyInjectionKey', 1)
412
421
  * const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
413
422
  * ```
423
+ *
424
+ * @__NO_SIDE_EFFECTS__
414
425
  */
415
426
  declare const injectLocal: typeof inject;
416
427
 
@@ -452,6 +463,8 @@ interface ReactifyOptions<T extends boolean> {
452
463
  *
453
464
  * @param fn - Source function
454
465
  * @param options - Options
466
+ *
467
+ * @__NO_SIDE_EFFECTS__
455
468
  */
456
469
  declare function reactify<T extends AnyFn, K extends boolean = true>(fn: T, options?: ReactifyOptions<K>): ReactifyReturn<T, K>;
457
470
 
@@ -469,6 +482,8 @@ interface ReactifyObjectOptions<T extends boolean> extends ReactifyOptions<T> {
469
482
  }
470
483
  /**
471
484
  * Apply `reactify` to an object
485
+ *
486
+ * @__NO_SIDE_EFFECTS__
472
487
  */
473
488
  declare function reactifyObject<T extends object, Keys extends keyof T>(obj: T, keys?: (keyof T)[]): ReactifyObjectReturn<T, Keys, true>;
474
489
  declare function reactifyObject<T extends object, S extends boolean = true>(obj: T, options?: ReactifyObjectOptions<S>): ReactifyObjectReturn<T, keyof T, S>;
@@ -511,6 +526,8 @@ declare function refDebounced<T>(value: Ref<T>, ms?: MaybeRefOrGetter<number>, o
511
526
 
512
527
  /**
513
528
  * Apply default value to a ref.
529
+ *
530
+ * @__NO_SIDE_EFFECTS__
514
531
  */
515
532
  declare function refDefault<T>(source: Ref<T | undefined | null>, defaultValue: T): Ref<T>;
516
533
 
@@ -542,6 +559,8 @@ interface ControlledRefOptions<T> {
542
559
  }
543
560
  /**
544
561
  * Fine-grained controls over ref and its reactivity.
562
+ *
563
+ * @__NO_SIDE_EFFECTS__
545
564
  */
546
565
  declare function refWithControl<T>(initial: T, options?: ControlledRefOptions<T>): vue.ShallowUnwrapRef<{
547
566
  get: (tracking?: boolean) => T;
@@ -826,6 +845,8 @@ type UseArrayEveryReturn = ComputedRef<boolean>;
826
845
  * @param fn - a function to test each element.
827
846
  *
828
847
  * @returns **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
848
+ *
849
+ * @__NO_SIDE_EFFECTS__
829
850
  */
830
851
  declare function useArrayEvery<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArrayEveryReturn;
831
852
 
@@ -838,6 +859,8 @@ type UseArrayFilterReturn<T = any> = ComputedRef<T[]>;
838
859
  * @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
839
860
  *
840
861
  * @returns a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
862
+ *
863
+ * @__NO_SIDE_EFFECTS__
841
864
  */
842
865
  declare function useArrayFilter<T, S extends T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): UseArrayFilterReturn<S>;
843
866
  declare function useArrayFilter<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => unknown): UseArrayFilterReturn<T>;
@@ -851,6 +874,8 @@ type UseArrayFindReturn<T = any> = ComputedRef<T | undefined>;
851
874
  * @param fn - a function to test each element.
852
875
  *
853
876
  * @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
877
+ *
878
+ * @__NO_SIDE_EFFECTS__
854
879
  */
855
880
  declare function useArrayFind<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindReturn<T>;
856
881
 
@@ -863,6 +888,8 @@ type UseArrayFindIndexReturn = ComputedRef<number>;
863
888
  * @param fn - a function to test each element.
864
889
  *
865
890
  * @returns the index of the first element in the array that passes the test. Otherwise, "-1".
891
+ *
892
+ * @__NO_SIDE_EFFECTS__
866
893
  */
867
894
  declare function useArrayFindIndex<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArrayFindIndexReturn;
868
895
 
@@ -875,6 +902,8 @@ type UseArrayFindLastReturn<T = any> = ComputedRef<T | undefined>;
875
902
  * @param fn - a function to test each element.
876
903
  *
877
904
  * @returns the last element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
905
+ *
906
+ * @__NO_SIDE_EFFECTS__
878
907
  */
879
908
  declare function useArrayFindLast<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => boolean): UseArrayFindLastReturn<T>;
880
909
 
@@ -890,6 +919,8 @@ type UseArrayIncludesReturn = ComputedRef<boolean>;
890
919
  * @see https://vueuse.org/useArrayIncludes
891
920
  *
892
921
  * @returns true if the `value` is found in the array. Otherwise, false.
922
+ *
923
+ * @__NO_SIDE_EFFECTS__
893
924
  */
894
925
  declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: UseArrayIncludesComparatorFn<T, V>): UseArrayIncludesReturn;
895
926
  declare function useArrayIncludes<T, V = any>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, value: MaybeRefOrGetter<V>, comparator?: keyof T): UseArrayIncludesReturn;
@@ -904,6 +935,8 @@ type UseArrayJoinReturn = ComputedRef<string>;
904
935
  * @param separator - a string to separate each pair of adjacent elements of the array. If omitted, the array elements are separated with a comma (",").
905
936
  *
906
937
  * @returns a string with all array elements joined. If arr.length is 0, the empty string is returned.
938
+ *
939
+ * @__NO_SIDE_EFFECTS__
907
940
  */
908
941
  declare function useArrayJoin(list: MaybeRefOrGetter<MaybeRefOrGetter<any>[]>, separator?: MaybeRefOrGetter<string>): UseArrayJoinReturn;
909
942
 
@@ -916,6 +949,8 @@ type UseArrayMapReturn<T = any> = ComputedRef<T[]>;
916
949
  * @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
917
950
  *
918
951
  * @returns a new array with each element being the result of the callback function.
952
+ *
953
+ * @__NO_SIDE_EFFECTS__
919
954
  */
920
955
  declare function useArrayMap<T, U = T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => U): UseArrayMapReturn<U>;
921
956
 
@@ -928,6 +963,8 @@ type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentI
928
963
  * @param reducer - a "reducer" function.
929
964
  *
930
965
  * @returns the value that results from running the "reducer" callback function to completion over the entire array.
966
+ *
967
+ * @__NO_SIDE_EFFECTS__
931
968
  */
932
969
  declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
933
970
  /**
@@ -939,6 +976,8 @@ declare function useArrayReduce<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>
939
976
  * @param initialValue - a value to be initialized the first time when the callback is called.
940
977
  *
941
978
  * @returns the value that results from running the "reducer" callback function to completion over the entire array.
979
+ *
980
+ * @__NO_SIDE_EFFECTS__
942
981
  */
943
982
  declare function useArrayReduce<T, U>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeRefOrGetter<U>): ComputedRef<U>;
944
983
 
@@ -951,6 +990,8 @@ type UseArraySomeReturn = ComputedRef<boolean>;
951
990
  * @param fn - a function to test each element.
952
991
  *
953
992
  * @returns **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
993
+ *
994
+ * @__NO_SIDE_EFFECTS__
954
995
  */
955
996
  declare function useArraySome<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: MaybeRefOrGetter<T>[]) => unknown): UseArraySomeReturn;
956
997
 
@@ -961,6 +1002,8 @@ type UseArrayUniqueReturn<T = any> = ComputedRef<T[]>;
961
1002
  * @param list - the array was called upon.
962
1003
  * @param compareFn
963
1004
  * @returns A computed ref that returns a unique array of items.
1005
+ *
1006
+ * @__NO_SIDE_EFFECTS__
964
1007
  */
965
1008
  declare function useArrayUnique<T>(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, compareFn?: (a: T, b: T, array: T[]) => boolean): UseArrayUniqueReturn<T>;
966
1009
 
@@ -1040,6 +1083,8 @@ type UseDateFormatReturn = ComputedRef<string>;
1040
1083
  * @param date - The date to format, can either be a `Date` object, a timestamp, or a string
1041
1084
  * @param formatStr - The combination of tokens to format the date
1042
1085
  * @param options - UseDateFormatOptions
1086
+ *
1087
+ * @__NO_SIDE_EFFECTS__
1043
1088
  */
1044
1089
  declare function useDateFormat(date: MaybeRefOrGetter<DateLike>, formatStr?: MaybeRefOrGetter<string>, options?: UseDateFormatOptions): UseDateFormatReturn;
1045
1090
 
@@ -1053,6 +1098,8 @@ type UseDebounceFnReturn<T extends FunctionArgs> = PromisifyFn<T>;
1053
1098
  * @param options Options
1054
1099
  *
1055
1100
  * @return A new, debounce, function.
1101
+ *
1102
+ * @__NO_SIDE_EFFECTS__
1056
1103
  */
1057
1104
  declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): UseDebounceFnReturn<T>;
1058
1105
 
@@ -1142,6 +1189,8 @@ declare function useLastChanged(source: WatchSource, options: UseLastChangedOpti
1142
1189
  * @param [rejectOnCancel] if true, reject the last call if it's been cancel (default value: false)
1143
1190
  *
1144
1191
  * @return A new, throttled, function.
1192
+ *
1193
+ * @__NO_SIDE_EFFECTS__
1145
1194
  */
1146
1195
  declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): PromisifyFn<T>;
1147
1196
 
@@ -1219,6 +1268,8 @@ interface UseToNumberOptions {
1219
1268
  }
1220
1269
  /**
1221
1270
  * Reactively convert a string ref to number.
1271
+ *
1272
+ * @__NO_SIDE_EFFECTS__
1222
1273
  */
1223
1274
  declare function useToNumber(value: MaybeRefOrGetter<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
1224
1275
 
@@ -1226,6 +1277,8 @@ declare function useToNumber(value: MaybeRefOrGetter<number | string>, options?:
1226
1277
  * Reactively convert a ref to string.
1227
1278
  *
1228
1279
  * @see https://vueuse.org/useToString
1280
+ *
1281
+ * @__NO_SIDE_EFFECTS__
1229
1282
  */
1230
1283
  declare function useToString(value: MaybeRefOrGetter<unknown>): ComputedRef<string>;
1231
1284
 
package/index.iife.js CHANGED
@@ -54,6 +54,7 @@
54
54
  return false;
55
55
  }
56
56
 
57
+ // @__NO_SIDE_EFFECTS__
57
58
  function createEventHook() {
58
59
  const fns = /* @__PURE__ */ new Set();
59
60
  const off = (fn) => {
@@ -81,6 +82,7 @@
81
82
  };
82
83
  }
83
84
 
85
+ // @__NO_SIDE_EFFECTS__
84
86
  function createGlobalState(stateFactory) {
85
87
  let initialized = false;
86
88
  let state;
@@ -96,7 +98,7 @@
96
98
 
97
99
  const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
98
100
 
99
- const injectLocal = (...args) => {
101
+ const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
100
102
  var _a;
101
103
  const key = args[0];
102
104
  const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
@@ -119,6 +121,7 @@
119
121
  return vue.provide(key, value);
120
122
  }
121
123
 
124
+ // @__NO_SIDE_EFFECTS__
122
125
  function createInjectionState(composable, options) {
123
126
  const key = (options == null ? void 0 : options.injectionKey) || Symbol(composable.name || "InjectionState");
124
127
  const defaultValue = options == null ? void 0 : options.defaultValue;
@@ -131,6 +134,7 @@
131
134
  return [useProvidingState, useInjectedState];
132
135
  }
133
136
 
137
+ // @__NO_SIDE_EFFECTS__
134
138
  function createRef(value, deep) {
135
139
  if (deep === true) {
136
140
  return vue.ref(value);
@@ -139,6 +143,7 @@
139
143
  }
140
144
  }
141
145
 
146
+ // @__NO_SIDE_EFFECTS__
142
147
  function createSharedComposable(composable) {
143
148
  let subscribers = 0;
144
149
  let state;
@@ -193,6 +198,7 @@
193
198
  return vue.unref(v) != null;
194
199
  }
195
200
 
201
+ // @__NO_SIDE_EFFECTS__
196
202
  function makeDestructurable(obj, arr) {
197
203
  if (typeof Symbol !== "undefined") {
198
204
  const clone = { ...obj };
@@ -214,6 +220,7 @@
214
220
  }
215
221
  }
216
222
 
223
+ // @__NO_SIDE_EFFECTS__
217
224
  function reactify(fn, options) {
218
225
  const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? vue.unref : vue.toValue;
219
226
  return function(...args) {
@@ -221,6 +228,7 @@
221
228
  };
222
229
  }
223
230
 
231
+ // @__NO_SIDE_EFFECTS__
224
232
  function reactifyObject(obj, optionsOrKeys = {}) {
225
233
  let keys = [];
226
234
  let options;
@@ -565,6 +573,7 @@
565
573
  return target || vue.getCurrentInstance();
566
574
  }
567
575
 
576
+ // @__NO_SIDE_EFFECTS__
568
577
  function useDebounceFn(fn, ms = 200, options = {}) {
569
578
  return createFilterWrapper(
570
579
  debounceFilter(ms, options),
@@ -581,6 +590,7 @@
581
590
  return vue.shallowReadonly(debounced);
582
591
  }
583
592
 
593
+ // @__NO_SIDE_EFFECTS__
584
594
  function refDefault(source, defaultValue) {
585
595
  return vue.computed({
586
596
  get() {
@@ -593,6 +603,7 @@
593
603
  });
594
604
  }
595
605
 
606
+ // @__NO_SIDE_EFFECTS__
596
607
  function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
597
608
  return createFilterWrapper(
598
609
  throttleFilter(ms, trailing, leading, rejectOnCancel),
@@ -611,6 +622,7 @@
611
622
  return throttled;
612
623
  }
613
624
 
625
+ // @__NO_SIDE_EFFECTS__
614
626
  function refWithControl(initial, options = {}) {
615
627
  let source = initial;
616
628
  let track;
@@ -954,6 +966,7 @@
954
966
  function defaultComparator(value, othVal) {
955
967
  return value === othVal;
956
968
  }
969
+ // @__NO_SIDE_EFFECTS__
957
970
  function useArrayDifference(...args) {
958
971
  var _a, _b;
959
972
  const list = args[0];
@@ -975,20 +988,24 @@
975
988
  }
976
989
  }
977
990
 
991
+ // @__NO_SIDE_EFFECTS__
978
992
  function useArrayEvery(list, fn) {
979
993
  return vue.computed(() => vue.toValue(list).every((element, index, array) => fn(vue.toValue(element), index, array)));
980
994
  }
981
995
 
996
+ // @__NO_SIDE_EFFECTS__
982
997
  function useArrayFilter(list, fn) {
983
998
  return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).filter(fn));
984
999
  }
985
1000
 
1001
+ // @__NO_SIDE_EFFECTS__
986
1002
  function useArrayFind(list, fn) {
987
1003
  return vue.computed(() => vue.toValue(
988
1004
  vue.toValue(list).find((element, index, array) => fn(vue.toValue(element), index, array))
989
1005
  ));
990
1006
  }
991
1007
 
1008
+ // @__NO_SIDE_EFFECTS__
992
1009
  function useArrayFindIndex(list, fn) {
993
1010
  return vue.computed(() => vue.toValue(list).findIndex((element, index, array) => fn(vue.toValue(element), index, array)));
994
1011
  }
@@ -1001,6 +1018,7 @@
1001
1018
  }
1002
1019
  return void 0;
1003
1020
  }
1021
+ // @__NO_SIDE_EFFECTS__
1004
1022
  function useArrayFindLast(list, fn) {
1005
1023
  return vue.computed(() => vue.toValue(
1006
1024
  !Array.prototype.findLast ? findLast(vue.toValue(list), (element, index, array) => fn(vue.toValue(element), index, array)) : vue.toValue(list).findLast((element, index, array) => fn(vue.toValue(element), index, array))
@@ -1010,6 +1028,7 @@
1010
1028
  function isArrayIncludesOptions(obj) {
1011
1029
  return isObject(obj) && containsProp(obj, "formIndex", "comparator");
1012
1030
  }
1031
+ // @__NO_SIDE_EFFECTS__
1013
1032
  function useArrayIncludes(...args) {
1014
1033
  var _a;
1015
1034
  const list = args[0];
@@ -1033,14 +1052,17 @@
1033
1052
  )));
1034
1053
  }
1035
1054
 
1055
+ // @__NO_SIDE_EFFECTS__
1036
1056
  function useArrayJoin(list, separator) {
1037
1057
  return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).join(vue.toValue(separator)));
1038
1058
  }
1039
1059
 
1060
+ // @__NO_SIDE_EFFECTS__
1040
1061
  function useArrayMap(list, fn) {
1041
1062
  return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).map(fn));
1042
1063
  }
1043
1064
 
1065
+ // @__NO_SIDE_EFFECTS__
1044
1066
  function useArrayReduce(list, reducer, ...args) {
1045
1067
  const reduceCallback = (sum, value, index) => reducer(vue.toValue(sum), vue.toValue(value), index);
1046
1068
  return vue.computed(() => {
@@ -1049,6 +1071,7 @@
1049
1071
  });
1050
1072
  }
1051
1073
 
1074
+ // @__NO_SIDE_EFFECTS__
1052
1075
  function useArraySome(list, fn) {
1053
1076
  return vue.computed(() => vue.toValue(list).some((element, index, array) => fn(vue.toValue(element), index, array)));
1054
1077
  }
@@ -1063,6 +1086,7 @@
1063
1086
  return acc;
1064
1087
  }, []);
1065
1088
  }
1089
+ // @__NO_SIDE_EFFECTS__
1066
1090
  function useArrayUnique(list, compareFn) {
1067
1091
  return vue.computed(() => {
1068
1092
  const resolvedList = vue.toValue(list).map((element) => vue.toValue(element));
@@ -1176,6 +1200,7 @@
1176
1200
  }
1177
1201
  return new Date(date);
1178
1202
  }
1203
+ // @__NO_SIDE_EFFECTS__
1179
1204
  function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
1180
1205
  return vue.computed(() => formatDate(normalizeDate(vue.toValue(date)), vue.toValue(formatStr), options));
1181
1206
  }
@@ -1328,6 +1353,7 @@
1328
1353
  }
1329
1354
  }
1330
1355
 
1356
+ // @__NO_SIDE_EFFECTS__
1331
1357
  function useToNumber(value, options = {}) {
1332
1358
  const {
1333
1359
  method = "parseFloat",
@@ -1346,10 +1372,12 @@
1346
1372
  });
1347
1373
  }
1348
1374
 
1375
+ // @__NO_SIDE_EFFECTS__
1349
1376
  function useToString(value) {
1350
1377
  return vue.computed(() => `${vue.toValue(value)}`);
1351
1378
  }
1352
1379
 
1380
+ // @__NO_SIDE_EFFECTS__
1353
1381
  function useToggle(initialValue = false, options = {}) {
1354
1382
  const {
1355
1383
  truthyValue = true,
package/index.mjs CHANGED
@@ -53,6 +53,7 @@ function tryOnScopeDispose(fn) {
53
53
  return false;
54
54
  }
55
55
 
56
+ // @__NO_SIDE_EFFECTS__
56
57
  function createEventHook() {
57
58
  const fns = /* @__PURE__ */ new Set();
58
59
  const off = (fn) => {
@@ -80,6 +81,7 @@ function createEventHook() {
80
81
  };
81
82
  }
82
83
 
84
+ // @__NO_SIDE_EFFECTS__
83
85
  function createGlobalState(stateFactory) {
84
86
  let initialized = false;
85
87
  let state;
@@ -95,7 +97,7 @@ function createGlobalState(stateFactory) {
95
97
 
96
98
  const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
97
99
 
98
- const injectLocal = (...args) => {
100
+ const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
99
101
  var _a;
100
102
  const key = args[0];
101
103
  const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
@@ -118,6 +120,7 @@ function provideLocal(key, value) {
118
120
  return provide(key, value);
119
121
  }
120
122
 
123
+ // @__NO_SIDE_EFFECTS__
121
124
  function createInjectionState(composable, options) {
122
125
  const key = (options == null ? void 0 : options.injectionKey) || Symbol(composable.name || "InjectionState");
123
126
  const defaultValue = options == null ? void 0 : options.defaultValue;
@@ -130,6 +133,7 @@ function createInjectionState(composable, options) {
130
133
  return [useProvidingState, useInjectedState];
131
134
  }
132
135
 
136
+ // @__NO_SIDE_EFFECTS__
133
137
  function createRef(value, deep) {
134
138
  if (deep === true) {
135
139
  return ref(value);
@@ -138,6 +142,7 @@ function createRef(value, deep) {
138
142
  }
139
143
  }
140
144
 
145
+ // @__NO_SIDE_EFFECTS__
141
146
  function createSharedComposable(composable) {
142
147
  let subscribers = 0;
143
148
  let state;
@@ -192,6 +197,7 @@ function isDefined(v) {
192
197
  return unref(v) != null;
193
198
  }
194
199
 
200
+ // @__NO_SIDE_EFFECTS__
195
201
  function makeDestructurable(obj, arr) {
196
202
  if (typeof Symbol !== "undefined") {
197
203
  const clone = { ...obj };
@@ -213,6 +219,7 @@ function makeDestructurable(obj, arr) {
213
219
  }
214
220
  }
215
221
 
222
+ // @__NO_SIDE_EFFECTS__
216
223
  function reactify(fn, options) {
217
224
  const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : toValue$1;
218
225
  return function(...args) {
@@ -220,6 +227,7 @@ function reactify(fn, options) {
220
227
  };
221
228
  }
222
229
 
230
+ // @__NO_SIDE_EFFECTS__
223
231
  function reactifyObject(obj, optionsOrKeys = {}) {
224
232
  let keys = [];
225
233
  let options;
@@ -564,6 +572,7 @@ function getLifeCycleTarget(target) {
564
572
  return target || getCurrentInstance();
565
573
  }
566
574
 
575
+ // @__NO_SIDE_EFFECTS__
567
576
  function useDebounceFn(fn, ms = 200, options = {}) {
568
577
  return createFilterWrapper(
569
578
  debounceFilter(ms, options),
@@ -580,6 +589,7 @@ function refDebounced(value, ms = 200, options = {}) {
580
589
  return shallowReadonly(debounced);
581
590
  }
582
591
 
592
+ // @__NO_SIDE_EFFECTS__
583
593
  function refDefault(source, defaultValue) {
584
594
  return computed({
585
595
  get() {
@@ -592,6 +602,7 @@ function refDefault(source, defaultValue) {
592
602
  });
593
603
  }
594
604
 
605
+ // @__NO_SIDE_EFFECTS__
595
606
  function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
596
607
  return createFilterWrapper(
597
608
  throttleFilter(ms, trailing, leading, rejectOnCancel),
@@ -610,6 +621,7 @@ function refThrottled(value, delay = 200, trailing = true, leading = true) {
610
621
  return throttled;
611
622
  }
612
623
 
624
+ // @__NO_SIDE_EFFECTS__
613
625
  function refWithControl(initial, options = {}) {
614
626
  let source = initial;
615
627
  let track;
@@ -953,6 +965,7 @@ function until(r) {
953
965
  function defaultComparator(value, othVal) {
954
966
  return value === othVal;
955
967
  }
968
+ // @__NO_SIDE_EFFECTS__
956
969
  function useArrayDifference(...args) {
957
970
  var _a, _b;
958
971
  const list = args[0];
@@ -974,20 +987,24 @@ function useArrayDifference(...args) {
974
987
  }
975
988
  }
976
989
 
990
+ // @__NO_SIDE_EFFECTS__
977
991
  function useArrayEvery(list, fn) {
978
992
  return computed(() => toValue$1(list).every((element, index, array) => fn(toValue$1(element), index, array)));
979
993
  }
980
994
 
995
+ // @__NO_SIDE_EFFECTS__
981
996
  function useArrayFilter(list, fn) {
982
997
  return computed(() => toValue$1(list).map((i) => toValue$1(i)).filter(fn));
983
998
  }
984
999
 
1000
+ // @__NO_SIDE_EFFECTS__
985
1001
  function useArrayFind(list, fn) {
986
1002
  return computed(() => toValue$1(
987
1003
  toValue$1(list).find((element, index, array) => fn(toValue$1(element), index, array))
988
1004
  ));
989
1005
  }
990
1006
 
1007
+ // @__NO_SIDE_EFFECTS__
991
1008
  function useArrayFindIndex(list, fn) {
992
1009
  return computed(() => toValue$1(list).findIndex((element, index, array) => fn(toValue$1(element), index, array)));
993
1010
  }
@@ -1000,6 +1017,7 @@ function findLast(arr, cb) {
1000
1017
  }
1001
1018
  return void 0;
1002
1019
  }
1020
+ // @__NO_SIDE_EFFECTS__
1003
1021
  function useArrayFindLast(list, fn) {
1004
1022
  return computed(() => toValue$1(
1005
1023
  !Array.prototype.findLast ? findLast(toValue$1(list), (element, index, array) => fn(toValue$1(element), index, array)) : toValue$1(list).findLast((element, index, array) => fn(toValue$1(element), index, array))
@@ -1009,6 +1027,7 @@ function useArrayFindLast(list, fn) {
1009
1027
  function isArrayIncludesOptions(obj) {
1010
1028
  return isObject(obj) && containsProp(obj, "formIndex", "comparator");
1011
1029
  }
1030
+ // @__NO_SIDE_EFFECTS__
1012
1031
  function useArrayIncludes(...args) {
1013
1032
  var _a;
1014
1033
  const list = args[0];
@@ -1032,14 +1051,17 @@ function useArrayIncludes(...args) {
1032
1051
  )));
1033
1052
  }
1034
1053
 
1054
+ // @__NO_SIDE_EFFECTS__
1035
1055
  function useArrayJoin(list, separator) {
1036
1056
  return computed(() => toValue$1(list).map((i) => toValue$1(i)).join(toValue$1(separator)));
1037
1057
  }
1038
1058
 
1059
+ // @__NO_SIDE_EFFECTS__
1039
1060
  function useArrayMap(list, fn) {
1040
1061
  return computed(() => toValue$1(list).map((i) => toValue$1(i)).map(fn));
1041
1062
  }
1042
1063
 
1064
+ // @__NO_SIDE_EFFECTS__
1043
1065
  function useArrayReduce(list, reducer, ...args) {
1044
1066
  const reduceCallback = (sum, value, index) => reducer(toValue$1(sum), toValue$1(value), index);
1045
1067
  return computed(() => {
@@ -1048,6 +1070,7 @@ function useArrayReduce(list, reducer, ...args) {
1048
1070
  });
1049
1071
  }
1050
1072
 
1073
+ // @__NO_SIDE_EFFECTS__
1051
1074
  function useArraySome(list, fn) {
1052
1075
  return computed(() => toValue$1(list).some((element, index, array) => fn(toValue$1(element), index, array)));
1053
1076
  }
@@ -1062,6 +1085,7 @@ function uniqueElementsBy(array, fn) {
1062
1085
  return acc;
1063
1086
  }, []);
1064
1087
  }
1088
+ // @__NO_SIDE_EFFECTS__
1065
1089
  function useArrayUnique(list, compareFn) {
1066
1090
  return computed(() => {
1067
1091
  const resolvedList = toValue$1(list).map((element) => toValue$1(element));
@@ -1175,6 +1199,7 @@ function normalizeDate(date) {
1175
1199
  }
1176
1200
  return new Date(date);
1177
1201
  }
1202
+ // @__NO_SIDE_EFFECTS__
1178
1203
  function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
1179
1204
  return computed(() => formatDate(normalizeDate(toValue$1(date)), toValue$1(formatStr), options));
1180
1205
  }
@@ -1327,6 +1352,7 @@ function useTimeout(interval = 1e3, options = {}) {
1327
1352
  }
1328
1353
  }
1329
1354
 
1355
+ // @__NO_SIDE_EFFECTS__
1330
1356
  function useToNumber(value, options = {}) {
1331
1357
  const {
1332
1358
  method = "parseFloat",
@@ -1345,10 +1371,12 @@ function useToNumber(value, options = {}) {
1345
1371
  });
1346
1372
  }
1347
1373
 
1374
+ // @__NO_SIDE_EFFECTS__
1348
1375
  function useToString(value) {
1349
1376
  return computed(() => `${toValue$1(value)}`);
1350
1377
  }
1351
1378
 
1379
+ // @__NO_SIDE_EFFECTS__
1352
1380
  function useToggle(initialValue = false, options = {}) {
1353
1381
  const {
1354
1382
  truthyValue = true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vueuse/shared",
3
3
  "type": "module",
4
- "version": "13.4.0",
4
+ "version": "13.6.0",
5
5
  "author": "Anthony Fu <https://github.com/antfu>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/antfu",