@vueuse/integrations 12.2.0 → 12.4.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 (61) hide show
  1. package/index.cjs +46 -46
  2. package/index.d.cts +20 -14
  3. package/index.d.mts +20 -14
  4. package/index.d.ts +20 -14
  5. package/index.iife.js +46 -46
  6. package/index.iife.min.js +1 -1
  7. package/index.mjs +36 -36
  8. package/package.json +3 -3
  9. package/useAsyncValidator/component.cjs +1 -1
  10. package/useAsyncValidator/component.mjs +2 -2
  11. package/useAsyncValidator.cjs +3 -3
  12. package/useAsyncValidator.iife.js +3 -3
  13. package/useAsyncValidator.iife.min.js +1 -1
  14. package/useAsyncValidator.mjs +4 -4
  15. package/useAxios.cjs +6 -6
  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 +6 -6
  20. package/useAxios.iife.min.js +1 -1
  21. package/useAxios.mjs +6 -6
  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/useDrauu.cjs +9 -9
  27. package/useDrauu.iife.js +9 -9
  28. package/useDrauu.iife.min.js +1 -1
  29. package/useDrauu.mjs +9 -9
  30. package/useFocusTrap.cjs +3 -3
  31. package/useFocusTrap.d.cts +1 -1
  32. package/useFocusTrap.d.mts +1 -1
  33. package/useFocusTrap.d.ts +1 -1
  34. package/useFocusTrap.iife.js +3 -3
  35. package/useFocusTrap.iife.min.js +1 -1
  36. package/useFocusTrap.mjs +4 -4
  37. package/useFuse.cjs +9 -10
  38. package/useFuse.iife.js +11 -11
  39. package/useFuse.iife.min.js +1 -1
  40. package/useFuse.mjs +6 -7
  41. package/useIDBKeyval.cjs +1 -2
  42. package/useIDBKeyval.iife.js +3 -3
  43. package/useIDBKeyval.iife.min.js +1 -1
  44. package/useIDBKeyval.mjs +1 -2
  45. package/useJwt.cjs +3 -4
  46. package/useJwt.iife.js +5 -5
  47. package/useJwt.iife.min.js +1 -1
  48. package/useJwt.mjs +2 -3
  49. package/useNProgress.cjs +1 -1
  50. package/useNProgress.d.cts +1 -1
  51. package/useNProgress.d.mts +1 -1
  52. package/useNProgress.d.ts +1 -1
  53. package/useNProgress.iife.js +1 -1
  54. package/useNProgress.iife.min.js +1 -1
  55. package/useNProgress.mjs +3 -3
  56. package/useSortable/component.cjs +4 -4
  57. package/useSortable/component.mjs +5 -5
  58. package/useSortable.cjs +8 -8
  59. package/useSortable.iife.js +8 -8
  60. package/useSortable.iife.min.js +1 -1
  61. package/useSortable.mjs +9 -9
@@ -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 = {}) {
@@ -15,11 +15,11 @@ function useAsyncValidator(value, rules, options = {}) {
15
15
  const pass = ref(!immediate || manual);
16
16
  const errors = computed(() => {
17
17
  var _a;
18
- return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
18
+ return ((_a = errorInfo.value) == null ? undefined : _a.errors) || [];
19
19
  });
20
20
  const errorFields = computed(() => {
21
21
  var _a;
22
- return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
22
+ return ((_a = errorInfo.value) == null ? undefined : _a.fields) || {};
23
23
  });
24
24
  const validator = computed(() => new AsyncValidatorSchema(toValue(rules)));
25
25
  const execute = async () => {
package/useAxios.cjs CHANGED
@@ -5,7 +5,7 @@ var axios = require('axios');
5
5
  var vue = require('vue');
6
6
 
7
7
  function useAxios(...args) {
8
- const url = typeof args[0] === "string" ? args[0] : void 0;
8
+ const url = typeof args[0] === "string" ? args[0] : undefined;
9
9
  const argsPlaceholder = typeof url === "string" ? 1 : 0;
10
10
  const defaultOptions = {
11
11
  immediate: !!argsPlaceholder,
@@ -15,7 +15,7 @@ function useAxios(...args) {
15
15
  let defaultConfig = {};
16
16
  let instance = axios;
17
17
  let options = defaultOptions;
18
- const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
18
+ const isAxiosInstance = (val) => !!(val == null ? undefined : val.request);
19
19
  if (args.length > 0 + argsPlaceholder) {
20
20
  if (isAxiosInstance(args[0 + argsPlaceholder]))
21
21
  instance = args[0 + argsPlaceholder];
@@ -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);
@@ -70,9 +70,9 @@ function useAxios(...args) {
70
70
  };
71
71
  let executeCounter = 0;
72
72
  const execute = (executeUrl = url, config = {}) => {
73
- error.value = void 0;
73
+ error.value = undefined;
74
74
  const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
75
- if (_url === void 0) {
75
+ if (_url === undefined) {
76
76
  error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
77
77
  isFinished.value = true;
78
78
  return promise;
@@ -96,7 +96,7 @@ function useAxios(...args) {
96
96
  onError(e);
97
97
  }).finally(() => {
98
98
  var _a;
99
- (_a = options.onFinish) == null ? void 0 : _a.call(options);
99
+ (_a = options.onFinish) == null ? undefined : _a.call(options);
100
100
  if (currentExecuteCounter === executeCounter)
101
101
  loading(false);
102
102
  });
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
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  function useAxios(...args) {
5
- const url = typeof args[0] === "string" ? args[0] : void 0;
5
+ const url = typeof args[0] === "string" ? args[0] : undefined;
6
6
  const argsPlaceholder = typeof url === "string" ? 1 : 0;
7
7
  const defaultOptions = {
8
8
  immediate: !!argsPlaceholder,
@@ -12,7 +12,7 @@
12
12
  let defaultConfig = {};
13
13
  let instance = axios;
14
14
  let options = defaultOptions;
15
- const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
15
+ const isAxiosInstance = (val) => !!(val == null ? undefined : val.request);
16
16
  if (args.length > 0 + argsPlaceholder) {
17
17
  if (isAxiosInstance(args[0 + argsPlaceholder]))
18
18
  instance = args[0 + argsPlaceholder];
@@ -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);
@@ -67,9 +67,9 @@
67
67
  };
68
68
  let executeCounter = 0;
69
69
  const execute = (executeUrl = url, config = {}) => {
70
- error.value = void 0;
70
+ error.value = undefined;
71
71
  const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
72
- if (_url === void 0) {
72
+ if (_url === undefined) {
73
73
  error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
74
74
  isFinished.value = true;
75
75
  return promise;
@@ -93,7 +93,7 @@
93
93
  onError(e);
94
94
  }).finally(() => {
95
95
  var _a;
96
- (_a = options.onFinish) == null ? void 0 : _a.call(options);
96
+ (_a = options.onFinish) == null ? undefined : _a.call(options);
97
97
  if (currentExecuteCounter === executeCounter)
98
98
  loading(false);
99
99
  });
@@ -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,d,o){"use strict";function O(...t){const a=typeof t[0]=="string"?t[0]:void 0,n=typeof a=="string"?1:0,E={immediate:!!n,shallow:!0,abortPrevious:!0};let R={},v=d,s=E;const p=e=>!!e?.request;t.length>0+n&&(p(t[0+n])?v=t[0+n]:R=t[0+n]),t.length>1+n&&p(t[1+n])&&(v=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=o.shallowRef(),w=(U?o.shallowRef:o.ref)(x),i=o.ref(!1),c=o.ref(!1),r=o.ref(!1),u=o.shallowRef();let b=new AbortController;const A=e=>{i.value||!c.value||(b.abort(e),b=new AbortController,r.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(()=>u.value?f(u.value):e(_))}),C={then:(...e)=>D().then(...e),catch:(...e)=>D().catch(...e)};let m=0;const P=(e=a,f={})=>{u.value=void 0;const F=typeof e=="string"?e:a??f.url;if(F===void 0)return u.value=new d.AxiosError(d.AxiosError.ERR_INVALID_URL),i.value=!0,C;S(),s.abortPrevious!==!1&&A(),V(!0),m+=1;const k=m;return r.value=!1,v(F,{...R,...typeof e=="object"?e:f,signal:b.signal}).then(l=>{if(r.value)return;y.value=l;const I=l.data;w.value=I,j(I)}).catch(l=>{u.value=l,q(l)}).finally(()=>{var l;(l=s.onFinish)==null||l.call(s),k===m&&V(!1)}),C};B&&a&&P();const _={response:y,data:w,error:u,isFinished:i,isLoading:c,cancel:A,isAborted:r,isCanceled:r,abort:A,execute:P};return{..._,...C}}L.useAxios=O})(this.VueUse=this.VueUse||{},VueUse,axios,Vue);
package/useAxios.mjs CHANGED
@@ -3,7 +3,7 @@ import axios, { AxiosError } from 'axios';
3
3
  import { shallowRef, ref } from 'vue';
4
4
 
5
5
  function useAxios(...args) {
6
- const url = typeof args[0] === "string" ? args[0] : void 0;
6
+ const url = typeof args[0] === "string" ? args[0] : undefined;
7
7
  const argsPlaceholder = typeof url === "string" ? 1 : 0;
8
8
  const defaultOptions = {
9
9
  immediate: !!argsPlaceholder,
@@ -13,7 +13,7 @@ function useAxios(...args) {
13
13
  let defaultConfig = {};
14
14
  let instance = axios;
15
15
  let options = defaultOptions;
16
- const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
16
+ const isAxiosInstance = (val) => !!(val == null ? undefined : val.request);
17
17
  if (args.length > 0 + argsPlaceholder) {
18
18
  if (isAxiosInstance(args[0 + argsPlaceholder]))
19
19
  instance = args[0 + argsPlaceholder];
@@ -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);
@@ -68,9 +68,9 @@ function useAxios(...args) {
68
68
  };
69
69
  let executeCounter = 0;
70
70
  const execute = (executeUrl = url, config = {}) => {
71
- error.value = void 0;
71
+ error.value = undefined;
72
72
  const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
73
- if (_url === void 0) {
73
+ if (_url === undefined) {
74
74
  error.value = new AxiosError(AxiosError.ERR_INVALID_URL);
75
75
  isFinished.value = true;
76
76
  return promise;
@@ -94,7 +94,7 @@ function useAxios(...args) {
94
94
  onError(e);
95
95
  }).finally(() => {
96
96
  var _a;
97
- (_a = options.onFinish) == null ? void 0 : _a.call(options);
97
+ (_a = options.onFinish) == null ? undefined : _a.call(options);
98
98
  if (currentExecuteCounter === executeCounter)
99
99
  loading(false);
100
100
  });
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/useDrauu.cjs CHANGED
@@ -22,10 +22,10 @@ function useDrauu(target, options) {
22
22
  size: 3,
23
23
  arrowEnd: false,
24
24
  cornerRadius: 0,
25
- dasharray: void 0,
25
+ dasharray: undefined,
26
26
  fill: "transparent",
27
27
  mode: "draw",
28
- ...options == null ? void 0 : options.brush
28
+ ...options == null ? undefined : options.brush
29
29
  });
30
30
  vue.watch(brush, () => {
31
31
  const instance = drauuInstance.value;
@@ -36,32 +36,32 @@ function useDrauu(target, options) {
36
36
  }, { deep: true });
37
37
  const undo = () => {
38
38
  var _a;
39
- return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
39
+ return (_a = drauuInstance.value) == null ? undefined : _a.undo();
40
40
  };
41
41
  const redo = () => {
42
42
  var _a;
43
- return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
43
+ return (_a = drauuInstance.value) == null ? undefined : _a.redo();
44
44
  };
45
45
  const clear = () => {
46
46
  var _a;
47
- return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
47
+ return (_a = drauuInstance.value) == null ? undefined : _a.clear();
48
48
  };
49
49
  const cancel = () => {
50
50
  var _a;
51
- return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
51
+ return (_a = drauuInstance.value) == null ? undefined : _a.cancel();
52
52
  };
53
53
  const load = (svg) => {
54
54
  var _a;
55
- return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
55
+ return (_a = drauuInstance.value) == null ? undefined : _a.load(svg);
56
56
  };
57
57
  const dump = () => {
58
58
  var _a;
59
- return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
59
+ return (_a = drauuInstance.value) == null ? undefined : _a.dump();
60
60
  };
61
61
  const cleanup = () => {
62
62
  var _a;
63
63
  disposables.forEach((dispose) => dispose());
64
- (_a = drauuInstance.value) == null ? void 0 : _a.unmount();
64
+ (_a = drauuInstance.value) == null ? undefined : _a.unmount();
65
65
  };
66
66
  const syncStatus = () => {
67
67
  if (drauuInstance.value) {
package/useDrauu.iife.js CHANGED
@@ -18,10 +18,10 @@
18
18
  size: 3,
19
19
  arrowEnd: false,
20
20
  cornerRadius: 0,
21
- dasharray: void 0,
21
+ dasharray: undefined,
22
22
  fill: "transparent",
23
23
  mode: "draw",
24
- ...options == null ? void 0 : options.brush
24
+ ...options == null ? undefined : options.brush
25
25
  });
26
26
  vue.watch(brush, () => {
27
27
  const instance = drauuInstance.value;
@@ -32,32 +32,32 @@
32
32
  }, { deep: true });
33
33
  const undo = () => {
34
34
  var _a;
35
- return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
35
+ return (_a = drauuInstance.value) == null ? undefined : _a.undo();
36
36
  };
37
37
  const redo = () => {
38
38
  var _a;
39
- return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
39
+ return (_a = drauuInstance.value) == null ? undefined : _a.redo();
40
40
  };
41
41
  const clear = () => {
42
42
  var _a;
43
- return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
43
+ return (_a = drauuInstance.value) == null ? undefined : _a.clear();
44
44
  };
45
45
  const cancel = () => {
46
46
  var _a;
47
- return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
47
+ return (_a = drauuInstance.value) == null ? undefined : _a.cancel();
48
48
  };
49
49
  const load = (svg) => {
50
50
  var _a;
51
- return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
51
+ return (_a = drauuInstance.value) == null ? undefined : _a.load(svg);
52
52
  };
53
53
  const dump = () => {
54
54
  var _a;
55
- return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
55
+ return (_a = drauuInstance.value) == null ? undefined : _a.dump();
56
56
  };
57
57
  const cleanup = () => {
58
58
  var _a;
59
59
  disposables.forEach((dispose) => dispose());
60
- (_a = drauuInstance.value) == null ? void 0 : _a.unmount();
60
+ (_a = drauuInstance.value) == null ? undefined : _a.unmount();
61
61
  };
62
62
  const syncStatus = () => {
63
63
  if (drauuInstance.value) {
@@ -1 +1 @@
1
- (function(E,o,k,H,a){"use strict";function V(p,u){const n=a.ref();let l=[];const s=o.createEventHook(),c=o.createEventHook(),d=o.createEventHook(),v=o.createEventHook(),i=o.createEventHook(),f=a.ref(!1),h=a.ref(!1),S=a.ref(!1),_=a.ref(!1),r=a.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...u?.brush});a.watch(r,()=>{const e=n.value;e&&(e.brush=r.value,e.mode=r.value.mode)},{deep:!0});const C=()=>{var e;return(e=n.value)==null?void 0:e.undo()},U=()=>{var e;return(e=n.value)==null?void 0:e.redo()},b=()=>{var e;return(e=n.value)==null?void 0:e.clear()},D=()=>{var e;return(e=n.value)==null?void 0:e.cancel()},w=e=>{var t;return(t=n.value)==null?void 0:t.load(e)},y=()=>{var e;return(e=n.value)==null?void 0:e.dump()},m=()=>{var e;l.forEach(t=>t()),(e=n.value)==null||e.unmount()},g=()=>{n.value&&(f.value=n.value.canUndo(),h.value=n.value.canRedo(),S.value=n.value.altPressed,_.value=n.value.shiftPressed)};return a.watch(()=>o.unrefElement(p),e=>{!e||typeof SVGSVGElement>"u"||!(e instanceof SVGSVGElement)||(n.value&&m(),n.value=H.createDrauu({el:e,...u}),g(),l=[n.value.on("canceled",()=>c.trigger()),n.value.on("committed",t=>d.trigger(t)),n.value.on("start",()=>v.trigger()),n.value.on("end",()=>i.trigger()),n.value.on("changed",()=>{g(),s.trigger()})])},{flush:"post"}),k.tryOnScopeDispose(()=>m()),{drauuInstance:n,load:w,dump:y,clear:b,cancel:D,undo:C,redo:U,canUndo:f,canRedo:h,brush:r,onChanged:s.on,onCommitted:d.on,onStart:v.on,onEnd:i.on,onCanceled:c.on}}E.useDrauu=V})(this.VueUse=this.VueUse||{},VueUse,VueUse,Drauu,Vue);
1
+ (function(E,t,k,H,a){"use strict";function V(p,r){const n=a.ref();let l=[];const s=t.createEventHook(),d=t.createEventHook(),c=t.createEventHook(),f=t.createEventHook(),i=t.createEventHook(),v=a.ref(!1),h=a.ref(!1),S=a.ref(!1),_=a.ref(!1),u=a.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...r?.brush});a.watch(u,()=>{const e=n.value;e&&(e.brush=u.value,e.mode=u.value.mode)},{deep:!0});const C=()=>{var e;return(e=n.value)==null?void 0:e.undo()},U=()=>{var e;return(e=n.value)==null?void 0:e.redo()},b=()=>{var e;return(e=n.value)==null?void 0:e.clear()},D=()=>{var e;return(e=n.value)==null?void 0:e.cancel()},w=e=>{var o;return(o=n.value)==null?void 0:o.load(e)},y=()=>{var e;return(e=n.value)==null?void 0:e.dump()},m=()=>{var e;l.forEach(o=>o()),(e=n.value)==null||e.unmount()},g=()=>{n.value&&(v.value=n.value.canUndo(),h.value=n.value.canRedo(),S.value=n.value.altPressed,_.value=n.value.shiftPressed)};return a.watch(()=>t.unrefElement(p),e=>{!e||typeof SVGSVGElement>"u"||!(e instanceof SVGSVGElement)||(n.value&&m(),n.value=H.createDrauu({el:e,...r}),g(),l=[n.value.on("canceled",()=>d.trigger()),n.value.on("committed",o=>c.trigger(o)),n.value.on("start",()=>f.trigger()),n.value.on("end",()=>i.trigger()),n.value.on("changed",()=>{g(),s.trigger()})])},{flush:"post"}),k.tryOnScopeDispose(()=>m()),{drauuInstance:n,load:w,dump:y,clear:b,cancel:D,undo:C,redo:U,canUndo:v,canRedo:h,brush:u,onChanged:s.on,onCommitted:c.on,onStart:f.on,onEnd:i.on,onCanceled:d.on}}E.useDrauu=V})(this.VueUse=this.VueUse||{},VueUse,VueUse,Drauu,Vue);