@vueuse/integrations 12.2.0 → 12.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.
Files changed (50) hide show
  1. package/index.cjs +20 -20
  2. package/index.d.cts +19 -13
  3. package/index.d.mts +19 -13
  4. package/index.d.ts +19 -13
  5. package/index.iife.js +20 -20
  6. package/index.iife.min.js +1 -1
  7. package/index.mjs +6 -6
  8. package/package.json +3 -3
  9. package/useAsyncValidator/component.cjs +1 -1
  10. package/useAsyncValidator/component.mjs +2 -2
  11. package/useAsyncValidator.cjs +1 -1
  12. package/useAsyncValidator.iife.js +1 -1
  13. package/useAsyncValidator.iife.min.js +1 -1
  14. package/useAsyncValidator.mjs +2 -2
  15. package/useAxios.cjs +1 -1
  16. package/useAxios.d.cts +19 -13
  17. package/useAxios.d.mts +19 -13
  18. package/useAxios.d.ts +19 -13
  19. package/useAxios.iife.js +1 -1
  20. package/useAxios.iife.min.js +1 -1
  21. package/useAxios.mjs +1 -1
  22. package/useChangeCase.cjs +3 -4
  23. package/useChangeCase.iife.js +5 -5
  24. package/useChangeCase.iife.min.js +1 -1
  25. package/useChangeCase.mjs +1 -2
  26. package/useFocusTrap.cjs +3 -3
  27. package/useFocusTrap.d.cts +1 -1
  28. package/useFocusTrap.d.mts +1 -1
  29. package/useFocusTrap.d.ts +1 -1
  30. package/useFocusTrap.iife.js +3 -3
  31. package/useFocusTrap.iife.min.js +1 -1
  32. package/useFocusTrap.mjs +4 -4
  33. package/useFuse.cjs +8 -9
  34. package/useFuse.iife.js +10 -10
  35. package/useFuse.iife.min.js +1 -1
  36. package/useFuse.mjs +1 -2
  37. package/useIDBKeyval.cjs +1 -2
  38. package/useIDBKeyval.iife.js +3 -3
  39. package/useIDBKeyval.iife.min.js +1 -1
  40. package/useIDBKeyval.mjs +1 -2
  41. package/useJwt.cjs +2 -3
  42. package/useJwt.iife.js +4 -4
  43. package/useJwt.iife.min.js +1 -1
  44. package/useJwt.mjs +1 -2
  45. package/useSortable/component.cjs +1 -1
  46. package/useSortable/component.mjs +2 -2
  47. package/useSortable.cjs +1 -1
  48. package/useSortable.iife.js +1 -1
  49. package/useSortable.iife.min.js +1 -1
  50. package/useSortable.mjs +2 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vueuse/integrations",
3
3
  "type": "module",
4
- "version": "12.2.0",
4
+ "version": "12.3.0",
5
5
  "description": "Integration wrappers for utility libraries",
6
6
  "author": "Anthony Fu <https://github.com/antfu>",
7
7
  "license": "MIT",
@@ -155,8 +155,8 @@
155
155
  },
156
156
  "dependencies": {
157
157
  "vue": "^3.5.13",
158
- "@vueuse/core": "12.2.0",
159
- "@vueuse/shared": "12.2.0"
158
+ "@vueuse/core": "12.3.0",
159
+ "@vueuse/shared": "12.3.0"
160
160
  },
161
161
  "devDependencies": {
162
162
  "@types/nprogress": "^0.2.3",
@@ -17,7 +17,7 @@ function useAsyncValidator(value, rules, options = {}) {
17
17
  const pass = vue.ref(!immediate || manual);
18
18
  const errors = vue.computed(() => errorInfo.value?.errors || []);
19
19
  const errorFields = vue.computed(() => errorInfo.value?.fields || {});
20
- const validator = vue.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
20
+ const validator = vue.computed(() => new AsyncValidatorSchema(vue.toValue(rules)));
21
21
  const execute = async () => {
22
22
  isFinished.value = false;
23
23
  pass.value = false;
@@ -1,5 +1,5 @@
1
- import { shallowRef, ref, computed, watch, defineComponent, reactive } from 'vue';
2
- import { toRef, toValue, until } from '@vueuse/shared';
1
+ import { shallowRef, ref, computed, toValue, watch, defineComponent, reactive } from 'vue';
2
+ import { toRef, until } from '@vueuse/shared';
3
3
  import Schema from 'async-validator';
4
4
 
5
5
  const AsyncValidatorSchema = Schema.default || Schema;
@@ -23,7 +23,7 @@ function useAsyncValidator(value, rules, options = {}) {
23
23
  var _a;
24
24
  return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
25
25
  });
26
- const validator = vue.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
26
+ const validator = vue.computed(() => new AsyncValidatorSchema(vue.toValue(rules)));
27
27
  const execute = async () => {
28
28
  isFinished.value = false;
29
29
  pass.value = false;
@@ -20,7 +20,7 @@
20
20
  var _a;
21
21
  return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
22
22
  });
23
- const validator = vue.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
23
+ const validator = vue.computed(() => new AsyncValidatorSchema(vue.toValue(rules)));
24
24
  const execute = async () => {
25
25
  isFinished.value = false;
26
26
  pass.value = false;
@@ -1 +1 @@
1
- (function(m,n,s,t){"use strict";const p=s.default||s;function y(w,A,F={}){const{validateOption:U={},immediate:o=!0,manual:i=!1}=F,c=n.toRef(w),r=t.shallowRef(null),a=t.ref(!0),l=t.ref(!o||i),d=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.errors)||[]}),f=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.fields)||{}}),v=t.computed(()=>new p(n.toValue(A))),h=async()=>{a.value=!1,l.value=!1;try{await v.value.validate(c.value,U),l.value=!0,r.value=null}catch(e){r.value=e}finally{a.value=!0}return{pass:l.value,errorInfo:r.value,errors:d.value,errorFields:f.value}};i||t.watch([c,v],()=>h(),{immediate:o,deep:!0});const V={isFinished:a,pass:l,errors:d,errorInfo:r,errorFields:f,execute:h};function R(){return new Promise((e,u)=>{n.until(a).toBe(!0).then(()=>e(V)).catch(I=>u(I))})}return{...V,then(e,u){return R().then(e,u)}}}m.useAsyncValidator=y})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue);
1
+ (function(m,s,u,t){"use strict";const p=u.default||u;function y(w,A,F={}){const{validateOption:U={},immediate:o=!0,manual:i=!1}=F,c=s.toRef(w),r=t.shallowRef(null),a=t.ref(!0),l=t.ref(!o||i),d=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.errors)||[]}),f=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.fields)||{}}),v=t.computed(()=>new p(t.toValue(A))),h=async()=>{a.value=!1,l.value=!1;try{await v.value.validate(c.value,U),l.value=!0,r.value=null}catch(e){r.value=e}finally{a.value=!0}return{pass:l.value,errorInfo:r.value,errors:d.value,errorFields:f.value}};i||t.watch([c,v],()=>h(),{immediate:o,deep:!0});const V={isFinished:a,pass:l,errors:d,errorInfo:r,errorFields:f,execute:h};function R(){return new Promise((e,n)=>{s.until(a).toBe(!0).then(()=>e(V)).catch(I=>n(I))})}return{...V,then(e,n){return R().then(e,n)}}}m.useAsyncValidator=y})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue);
@@ -1,6 +1,6 @@
1
- import { toRef, toValue, until } from '@vueuse/shared';
1
+ import { toRef, until } from '@vueuse/shared';
2
2
  import Schema from 'async-validator';
3
- import { shallowRef, ref, computed, watch } from 'vue';
3
+ import { shallowRef, ref, computed, toValue, watch } from 'vue';
4
4
 
5
5
  const AsyncValidatorSchema = Schema.default || Schema;
6
6
  function useAsyncValidator(value, rules, options = {}) {
package/useAxios.cjs CHANGED
@@ -30,13 +30,13 @@ function useAxios(...args) {
30
30
  options = args[args.length - 1] || defaultOptions;
31
31
  }
32
32
  const {
33
- initialData,
34
33
  shallow,
35
34
  onSuccess = shared.noop,
36
35
  onError = shared.noop,
37
36
  immediate,
38
37
  resetOnExecute = false
39
38
  } = options;
39
+ const initialData = options.initialData;
40
40
  const response = vue.shallowRef();
41
41
  const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
42
42
  const isFinished = vue.ref(false);
package/useAxios.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
2
2
  import { ShallowRef, Ref } from 'vue';
3
3
 
4
- interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
4
+ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any, O extends UseAxiosOptions = UseAxiosOptions<T>> {
5
5
  /**
6
6
  * Axios Response
7
7
  */
@@ -9,7 +9,7 @@ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
9
9
  /**
10
10
  * Axios response data
11
11
  */
12
- data: Ref<T | undefined>;
12
+ data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : Ref<T | undefined>;
13
13
  /**
14
14
  * Indicates if the request has finished
15
15
  */
@@ -39,11 +39,11 @@ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
39
39
  */
40
40
  isCanceled: Ref<boolean>;
41
41
  }
42
- interface StrictUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
42
+ interface StrictUseAxiosReturn<T, R, D, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
43
43
  /**
44
44
  * Manually call the axios request
45
45
  */
46
- execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D>>;
46
+ execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
47
47
  }
48
48
  interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
49
49
  /**
@@ -51,7 +51,7 @@ interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
51
51
  */
52
52
  execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
53
53
  }
54
- interface UseAxiosOptions<T = any> {
54
+ interface UseAxiosOptionsBase<T = any> {
55
55
  /**
56
56
  * Will automatically run axios request when `useAxios` is used
57
57
  *
@@ -77,10 +77,6 @@ interface UseAxiosOptions<T = any> {
77
77
  * Callback when success is caught.
78
78
  */
79
79
  onSuccess?: (data: T) => void;
80
- /**
81
- * Initial data to use
82
- */
83
- initialData?: T;
84
80
  /**
85
81
  * Sets the state to initialState before executing the promise.
86
82
  */
@@ -90,11 +86,21 @@ interface UseAxiosOptions<T = any> {
90
86
  */
91
87
  onFinish?: () => void;
92
88
  }
93
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
94
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
95
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
89
+ interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
90
+ /**
91
+ * Initial data
92
+ */
93
+ initialData: T;
94
+ }
95
+ type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
96
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
97
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
98
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
99
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
100
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
101
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
96
102
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
97
103
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
98
104
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
99
105
 
100
- export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };
106
+ export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, useAxios };
package/useAxios.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
2
2
  import { ShallowRef, Ref } from 'vue';
3
3
 
4
- interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
4
+ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any, O extends UseAxiosOptions = UseAxiosOptions<T>> {
5
5
  /**
6
6
  * Axios Response
7
7
  */
@@ -9,7 +9,7 @@ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
9
9
  /**
10
10
  * Axios response data
11
11
  */
12
- data: Ref<T | undefined>;
12
+ data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : Ref<T | undefined>;
13
13
  /**
14
14
  * Indicates if the request has finished
15
15
  */
@@ -39,11 +39,11 @@ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
39
39
  */
40
40
  isCanceled: Ref<boolean>;
41
41
  }
42
- interface StrictUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
42
+ interface StrictUseAxiosReturn<T, R, D, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
43
43
  /**
44
44
  * Manually call the axios request
45
45
  */
46
- execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D>>;
46
+ execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
47
47
  }
48
48
  interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
49
49
  /**
@@ -51,7 +51,7 @@ interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
51
51
  */
52
52
  execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
53
53
  }
54
- interface UseAxiosOptions<T = any> {
54
+ interface UseAxiosOptionsBase<T = any> {
55
55
  /**
56
56
  * Will automatically run axios request when `useAxios` is used
57
57
  *
@@ -77,10 +77,6 @@ interface UseAxiosOptions<T = any> {
77
77
  * Callback when success is caught.
78
78
  */
79
79
  onSuccess?: (data: T) => void;
80
- /**
81
- * Initial data to use
82
- */
83
- initialData?: T;
84
80
  /**
85
81
  * Sets the state to initialState before executing the promise.
86
82
  */
@@ -90,11 +86,21 @@ interface UseAxiosOptions<T = any> {
90
86
  */
91
87
  onFinish?: () => void;
92
88
  }
93
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
94
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
95
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
89
+ interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
90
+ /**
91
+ * Initial data
92
+ */
93
+ initialData: T;
94
+ }
95
+ type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
96
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
97
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
98
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
99
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
100
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
101
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
96
102
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
97
103
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
98
104
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
99
105
 
100
- export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };
106
+ export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, useAxios };
package/useAxios.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
2
2
  import { ShallowRef, Ref } from 'vue';
3
3
 
4
- interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
4
+ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any, O extends UseAxiosOptions = UseAxiosOptions<T>> {
5
5
  /**
6
6
  * Axios Response
7
7
  */
@@ -9,7 +9,7 @@ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
9
9
  /**
10
10
  * Axios response data
11
11
  */
12
- data: Ref<T | undefined>;
12
+ data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : Ref<T | undefined>;
13
13
  /**
14
14
  * Indicates if the request has finished
15
15
  */
@@ -39,11 +39,11 @@ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
39
39
  */
40
40
  isCanceled: Ref<boolean>;
41
41
  }
42
- interface StrictUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
42
+ interface StrictUseAxiosReturn<T, R, D, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
43
43
  /**
44
44
  * Manually call the axios request
45
45
  */
46
- execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D>>;
46
+ execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
47
47
  }
48
48
  interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
49
49
  /**
@@ -51,7 +51,7 @@ interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
51
51
  */
52
52
  execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
53
53
  }
54
- interface UseAxiosOptions<T = any> {
54
+ interface UseAxiosOptionsBase<T = any> {
55
55
  /**
56
56
  * Will automatically run axios request when `useAxios` is used
57
57
  *
@@ -77,10 +77,6 @@ interface UseAxiosOptions<T = any> {
77
77
  * Callback when success is caught.
78
78
  */
79
79
  onSuccess?: (data: T) => void;
80
- /**
81
- * Initial data to use
82
- */
83
- initialData?: T;
84
80
  /**
85
81
  * Sets the state to initialState before executing the promise.
86
82
  */
@@ -90,11 +86,21 @@ interface UseAxiosOptions<T = any> {
90
86
  */
91
87
  onFinish?: () => void;
92
88
  }
93
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
94
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
95
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
89
+ interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
90
+ /**
91
+ * Initial data
92
+ */
93
+ initialData: T;
94
+ }
95
+ type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
96
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
97
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
98
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
99
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
100
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
101
+ declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
96
102
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
97
103
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
98
104
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
99
105
 
100
- export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };
106
+ export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, useAxios };
package/useAxios.iife.js CHANGED
@@ -27,13 +27,13 @@
27
27
  options = args[args.length - 1] || defaultOptions;
28
28
  }
29
29
  const {
30
- initialData,
31
30
  shallow,
32
31
  onSuccess = shared.noop,
33
32
  onError = shared.noop,
34
33
  immediate,
35
34
  resetOnExecute = false
36
35
  } = options;
36
+ const initialData = options.initialData;
37
37
  const response = vue.shallowRef();
38
38
  const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
39
39
  const isFinished = vue.ref(false);
@@ -1 +1 @@
1
- (function(L,h,v,l){"use strict";function O(...t){const r=typeof t[0]=="string"?t[0]:void 0,n=typeof r=="string"?1:0,E={immediate:!!n,shallow:!0,abortPrevious:!0};let R={},d=v,u=E;const p=e=>!!e?.request;t.length>0+n&&(p(t[0+n])?d=t[0+n]:R=t[0+n]),t.length>1+n&&p(t[1+n])&&(d=t[1+n]),(t.length===2+n&&!p(t[1+n])||t.length===3+n)&&(u=t[t.length-1]||E);const{initialData:x,shallow:U,onSuccess:j=h.noop,onError:q=h.noop,immediate:B,resetOnExecute:N=!1}=u,y=l.shallowRef(),w=(U?l.shallowRef:l.ref)(x),s=l.ref(!1),c=l.ref(!1),a=l.ref(!1),i=l.shallowRef();let b=new AbortController;const A=e=>{s.value||!c.value||(b.abort(e),b=new AbortController,a.value=!0,c.value=!1,s.value=!1)},V=e=>{c.value=e,s.value=!e},S=()=>{N&&(w.value=x)},P=()=>new Promise((e,f)=>{h.until(s).toBe(!0).then(()=>i.value?f(i.value):e(D))}),C={then:(...e)=>P().then(...e),catch:(...e)=>P().catch(...e)};let m=0;const _=(e=r,f={})=>{i.value=void 0;const F=typeof e=="string"?e:r??f.url;if(F===void 0)return i.value=new v.AxiosError(v.AxiosError.ERR_INVALID_URL),s.value=!0,C;S(),u.abortPrevious!==!1&&A(),V(!0),m+=1;const k=m;return a.value=!1,d(F,{...R,...typeof e=="object"?e:f,signal:b.signal}).then(o=>{if(a.value)return;y.value=o;const I=o.data;w.value=I,j(I)}).catch(o=>{i.value=o,q(o)}).finally(()=>{var o;(o=u.onFinish)==null||o.call(u),k===m&&V(!1)}),C};B&&r&&_();const D={response:y,data:w,error:i,isFinished:s,isLoading:c,cancel:A,isAborted:a,isCanceled:a,abort:A,execute:_};return{...D,...C}}L.useAxios=O})(this.VueUse=this.VueUse||{},VueUse,axios,Vue);
1
+ (function(L,h,v,l){"use strict";function O(...t){const r=typeof t[0]=="string"?t[0]:void 0,n=typeof r=="string"?1:0,E={immediate:!!n,shallow:!0,abortPrevious:!0};let R={},d=v,s=E;const p=e=>!!e?.request;t.length>0+n&&(p(t[0+n])?d=t[0+n]:R=t[0+n]),t.length>1+n&&p(t[1+n])&&(d=t[1+n]),(t.length===2+n&&!p(t[1+n])||t.length===3+n)&&(s=t[t.length-1]||E);const{shallow:U,onSuccess:j=h.noop,onError:q=h.noop,immediate:B,resetOnExecute:N=!1}=s,x=s.initialData,y=l.shallowRef(),w=(U?l.shallowRef:l.ref)(x),i=l.ref(!1),c=l.ref(!1),u=l.ref(!1),a=l.shallowRef();let b=new AbortController;const A=e=>{i.value||!c.value||(b.abort(e),b=new AbortController,u.value=!0,c.value=!1,i.value=!1)},V=e=>{c.value=e,i.value=!e},S=()=>{N&&(w.value=x)},D=()=>new Promise((e,f)=>{h.until(i).toBe(!0).then(()=>a.value?f(a.value):e(_))}),C={then:(...e)=>D().then(...e),catch:(...e)=>D().catch(...e)};let m=0;const P=(e=r,f={})=>{a.value=void 0;const F=typeof e=="string"?e:r??f.url;if(F===void 0)return a.value=new v.AxiosError(v.AxiosError.ERR_INVALID_URL),i.value=!0,C;S(),s.abortPrevious!==!1&&A(),V(!0),m+=1;const k=m;return u.value=!1,d(F,{...R,...typeof e=="object"?e:f,signal:b.signal}).then(o=>{if(u.value)return;y.value=o;const I=o.data;w.value=I,j(I)}).catch(o=>{a.value=o,q(o)}).finally(()=>{var o;(o=s.onFinish)==null||o.call(s),k===m&&V(!1)}),C};B&&r&&P();const _={response:y,data:w,error:a,isFinished:i,isLoading:c,cancel:A,isAborted:u,isCanceled:u,abort:A,execute:P};return{..._,...C}}L.useAxios=O})(this.VueUse=this.VueUse||{},VueUse,axios,Vue);
package/useAxios.mjs CHANGED
@@ -28,13 +28,13 @@ function useAxios(...args) {
28
28
  options = args[args.length - 1] || defaultOptions;
29
29
  }
30
30
  const {
31
- initialData,
32
31
  shallow,
33
32
  onSuccess = noop,
34
33
  onError = noop,
35
34
  immediate,
36
35
  resetOnExecute = false
37
36
  } = options;
37
+ const initialData = options.initialData;
38
38
  const response = shallowRef();
39
39
  const data = (shallow ? shallowRef : ref)(initialData);
40
40
  const isFinished = ref(false);
package/useChangeCase.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var shared = require('@vueuse/shared');
4
3
  var changeCase = require('change-case');
5
4
  var vue = require('vue');
6
5
 
@@ -29,17 +28,17 @@ const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase__namespac
29
28
  }, {});
30
29
  function useChangeCase(input, type, options) {
31
30
  const typeRef = vue.computed(() => {
32
- const t = shared.toValue(type);
31
+ const t = vue.toValue(type);
33
32
  if (!changeCaseTransforms[t])
34
33
  throw new Error(`Invalid change case type "${t}"`);
35
34
  return t;
36
35
  });
37
36
  if (typeof input === "function")
38
- return vue.computed(() => changeCaseTransforms[typeRef.value](shared.toValue(input), shared.toValue(options)));
37
+ return vue.computed(() => changeCaseTransforms[typeRef.value](vue.toValue(input), vue.toValue(options)));
39
38
  const text = vue.ref(input);
40
39
  return vue.computed({
41
40
  get() {
42
- return changeCaseTransforms[typeRef.value](text.value, shared.toValue(options));
41
+ return changeCaseTransforms[typeRef.value](text.value, vue.toValue(options));
43
42
  },
44
43
  set(value) {
45
44
  text.value = value;
@@ -1,4 +1,4 @@
1
- (function (exports, shared, changeCase, vue) {
1
+ (function (exports, changeCase, vue) {
2
2
  'use strict';
3
3
 
4
4
  function _interopNamespaceDefault(e) {
@@ -26,17 +26,17 @@
26
26
  }, {});
27
27
  function useChangeCase(input, type, options) {
28
28
  const typeRef = vue.computed(() => {
29
- const t = shared.toValue(type);
29
+ const t = vue.toValue(type);
30
30
  if (!changeCaseTransforms[t])
31
31
  throw new Error(`Invalid change case type "${t}"`);
32
32
  return t;
33
33
  });
34
34
  if (typeof input === "function")
35
- return vue.computed(() => changeCaseTransforms[typeRef.value](shared.toValue(input), shared.toValue(options)));
35
+ return vue.computed(() => changeCaseTransforms[typeRef.value](vue.toValue(input), vue.toValue(options)));
36
36
  const text = vue.ref(input);
37
37
  return vue.computed({
38
38
  get() {
39
- return changeCaseTransforms[typeRef.value](text.value, shared.toValue(options));
39
+ return changeCaseTransforms[typeRef.value](text.value, vue.toValue(options));
40
40
  },
41
41
  set(value) {
42
42
  text.value = value;
@@ -46,4 +46,4 @@
46
46
 
47
47
  exports.useChangeCase = useChangeCase;
48
48
 
49
- })(this.VueUse = this.VueUse || {}, VueUse, changeCase, Vue);
49
+ })(this.VueUse = this.VueUse || {}, changeCase, Vue);
@@ -1 +1 @@
1
- (function(f,a,i,c){"use strict";function l(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var g=l(i);const o=Object.entries(g).filter(([e,t])=>typeof t=="function"&&e.endsWith("Case")).reduce((e,[t,n])=>(e[t]=n,e),{});function p(e,t,n){const r=c.computed(()=>{const u=a.toValue(t);if(!o[u])throw new Error(`Invalid change case type "${u}"`);return u});if(typeof e=="function")return c.computed(()=>o[r.value](a.toValue(e),a.toValue(n)));const s=c.ref(e);return c.computed({get(){return o[r.value](s.value,a.toValue(n))},set(u){s.value=u}})}f.useChangeCase=p})(this.VueUse=this.VueUse||{},VueUse,changeCase,Vue);
1
+ (function(o,f,r){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var l=i(f);const u=Object.entries(l).filter(([e,t])=>typeof t=="function"&&e.endsWith("Case")).reduce((e,[t,n])=>(e[t]=n,e),{});function h(e,t,n){const a=r.computed(()=>{const c=r.toValue(t);if(!u[c])throw new Error(`Invalid change case type "${c}"`);return c});if(typeof e=="function")return r.computed(()=>u[a.value](r.toValue(e),r.toValue(n)));const s=r.ref(e);return r.computed({get(){return u[a.value](s.value,r.toValue(n))},set(c){s.value=c}})}o.useChangeCase=h})(this.VueUse=this.VueUse||{},changeCase,Vue);
package/useChangeCase.mjs CHANGED
@@ -1,6 +1,5 @@
1
- import { toValue } from '@vueuse/shared';
2
1
  import * as changeCase from 'change-case';
3
- import { computed, ref } from 'vue';
2
+ import { computed, toValue, ref } from 'vue';
4
3
 
5
4
  const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
6
5
  acc[name] = fn;
package/useFocusTrap.cjs CHANGED
@@ -25,9 +25,9 @@ function useFocusTrap(target, options = {}) {
25
25
  }
26
26
  };
27
27
  const targets = vue.computed(() => {
28
- const _targets = shared.toValue(target);
29
- return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
30
- const _el = shared.toValue(el);
28
+ const _targets = vue.toValue(target);
29
+ return core.toArray(_targets).map((el) => {
30
+ const _el = vue.toValue(el);
31
31
  return typeof _el === "string" ? _el : core.unrefElement(_el);
32
32
  }).filter(shared.notNullish);
33
33
  });
@@ -1,7 +1,7 @@
1
1
  import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core';
2
+ import { MaybeRefOrGetter } from '@vueuse/shared';
2
3
  import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
3
4
  import { Ref } from 'vue';
4
- import { MaybeRefOrGetter } from '@vueuse/shared';
5
5
 
6
6
  interface UseFocusTrapOptions extends Options {
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core';
2
+ import { MaybeRefOrGetter } from '@vueuse/shared';
2
3
  import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
3
4
  import { Ref } from 'vue';
4
- import { MaybeRefOrGetter } from '@vueuse/shared';
5
5
 
6
6
  interface UseFocusTrapOptions extends Options {
7
7
  /**
package/useFocusTrap.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core';
2
+ import { MaybeRefOrGetter } from '@vueuse/shared';
2
3
  import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
3
4
  import { Ref } from 'vue';
4
- import { MaybeRefOrGetter } from '@vueuse/shared';
5
5
 
6
6
  interface UseFocusTrapOptions extends Options {
7
7
  /**
@@ -21,9 +21,9 @@
21
21
  }
22
22
  };
23
23
  const targets = vue.computed(() => {
24
- const _targets = shared.toValue(target);
25
- return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
26
- const _el = shared.toValue(el);
24
+ const _targets = vue.toValue(target);
25
+ return core.toArray(_targets).map((el) => {
26
+ const _el = vue.toValue(el);
27
27
  return typeof _el === "string" ? _el : core.unrefElement(_el);
28
28
  }).filter(shared.notNullish);
29
29
  });
@@ -1 +1 @@
1
- (function(l,i,u,p,s){"use strict";function v(V,a={}){let t;const{immediate:h,...m}=a,c=s.ref(!1),n=s.ref(!1),o=e=>t&&t.activate(e),f=e=>t&&t.deactivate(e),A=()=>{t&&(t.pause(),n.value=!0)},T=()=>{t&&(t.unpause(),n.value=!1)},g=s.computed(()=>{const e=u.toValue(V);return(Array.isArray(e)?e:[e]).map(y=>{const r=u.toValue(y);return typeof r=="string"?r:i.unrefElement(r)}).filter(u.notNullish)});return s.watch(g,e=>{e.length&&(t=p.createFocusTrap(e,{...m,onActivate(){c.value=!0,a.onActivate&&a.onActivate()},onDeactivate(){c.value=!1,a.onDeactivate&&a.onDeactivate()}}),h&&o())},{flush:"post"}),i.tryOnScopeDispose(()=>f()),{hasFocus:c,isPaused:n,activate:o,deactivate:f,pause:A,unpause:T}}l.useFocusTrap=v})(this.VueUse=this.VueUse||{},VueUse,VueUse,focusTrap,Vue);
1
+ (function(f,u,l,p,a){"use strict";function v(h,s={}){let t;const{immediate:V,...d}=s,c=a.ref(!1),n=a.ref(!1),i=e=>t&&t.activate(e),o=e=>t&&t.deactivate(e),m=()=>{t&&(t.pause(),n.value=!0)},T=()=>{t&&(t.unpause(),n.value=!1)},g=a.computed(()=>{const e=a.toValue(h);return u.toArray(e).map(A=>{const r=a.toValue(A);return typeof r=="string"?r:u.unrefElement(r)}).filter(l.notNullish)});return a.watch(g,e=>{e.length&&(t=p.createFocusTrap(e,{...d,onActivate(){c.value=!0,s.onActivate&&s.onActivate()},onDeactivate(){c.value=!1,s.onDeactivate&&s.onDeactivate()}}),V&&i())},{flush:"post"}),u.tryOnScopeDispose(()=>o()),{hasFocus:c,isPaused:n,activate:i,deactivate:o,pause:m,unpause:T}}f.useFocusTrap=v})(this.VueUse=this.VueUse||{},VueUse,VueUse,focusTrap,Vue);
package/useFocusTrap.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { unrefElement, tryOnScopeDispose } from '@vueuse/core';
2
- import { toValue, notNullish } from '@vueuse/shared';
1
+ import { toArray, unrefElement, tryOnScopeDispose } from '@vueuse/core';
2
+ import { notNullish } from '@vueuse/shared';
3
3
  import { createFocusTrap } from 'focus-trap';
4
- import { ref, computed, watch } from 'vue';
4
+ import { ref, computed, toValue, watch } from 'vue';
5
5
 
6
6
  function useFocusTrap(target, options = {}) {
7
7
  let trap;
@@ -24,7 +24,7 @@ function useFocusTrap(target, options = {}) {
24
24
  };
25
25
  const targets = computed(() => {
26
26
  const _targets = toValue(target);
27
- return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
27
+ return toArray(_targets).map((el) => {
28
28
  const _el = toValue(el);
29
29
  return typeof _el === "string" ? _el : unrefElement(_el);
30
30
  }).filter(notNullish);
package/useFuse.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var shared = require('@vueuse/shared');
4
3
  var Fuse = require('fuse.js');
5
4
  var vue = require('vue');
6
5
 
@@ -8,15 +7,15 @@ function useFuse(search, data, options) {
8
7
  const createFuse = () => {
9
8
  var _a, _b;
10
9
  return new Fuse(
11
- (_a = shared.toValue(data)) != null ? _a : [],
12
- (_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
10
+ (_a = vue.toValue(data)) != null ? _a : [],
11
+ (_b = vue.toValue(options)) == null ? void 0 : _b.fuseOptions
13
12
  );
14
13
  };
15
14
  const fuse = vue.ref(createFuse());
16
15
  vue.watch(
17
16
  () => {
18
17
  var _a;
19
- return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
18
+ return (_a = vue.toValue(options)) == null ? void 0 : _a.fuseOptions;
20
19
  },
21
20
  () => {
22
21
  fuse.value = createFuse();
@@ -24,18 +23,18 @@ function useFuse(search, data, options) {
24
23
  { deep: true }
25
24
  );
26
25
  vue.watch(
27
- () => shared.toValue(data),
26
+ () => vue.toValue(data),
28
27
  (newData) => {
29
28
  fuse.value.setCollection(newData);
30
29
  },
31
30
  { deep: true }
32
31
  );
33
32
  const results = vue.computed(() => {
34
- const resolved = shared.toValue(options);
35
- if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
36
- return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
33
+ const resolved = vue.toValue(options);
34
+ if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !vue.toValue(search))
35
+ return vue.toValue(data).map((item, index) => ({ item, refIndex: index }));
37
36
  const limit = resolved == null ? void 0 : resolved.resultLimit;
38
- return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
37
+ return fuse.value.search(vue.toValue(search), limit ? { limit } : void 0);
39
38
  });
40
39
  return {
41
40
  fuse,