@vueuse/integrations 6.3.3 → 6.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/integrations",
3
- "version": "6.3.3",
3
+ "version": "6.6.1",
4
4
  "description": "Integration wrappers for utility libraries",
5
5
  "keywords": [
6
6
  "vue",
@@ -13,7 +13,7 @@
13
13
  "url": "git+https://github.com/vueuse/vueuse.git"
14
14
  },
15
15
  "funding": "https://github.com/sponsors/antfu",
16
- "author": "Anthony Fu<https://github.com/antfu>",
16
+ "author": "Anthony Fu <https://github.com/antfu>",
17
17
  "exports": {
18
18
  ".": {
19
19
  "import": "./index.mjs",
@@ -28,10 +28,22 @@
28
28
  "import": "./useCookies.mjs",
29
29
  "require": "./useCookies.cjs"
30
30
  },
31
+ "./useDrauu": {
32
+ "import": "./useDrauu.mjs",
33
+ "require": "./useDrauu.cjs"
34
+ },
31
35
  "./useFocusTrap": {
32
36
  "import": "./useFocusTrap.mjs",
33
37
  "require": "./useFocusTrap.cjs"
34
38
  },
39
+ "./useFocusTrap/component": {
40
+ "import": "./useFocusTrap/component.mjs",
41
+ "require": "./useFocusTrap/component.cjs"
42
+ },
43
+ "./useFuse": {
44
+ "import": "./useFuse.mjs",
45
+ "require": "./useFuse.cjs"
46
+ },
35
47
  "./useJwt": {
36
48
  "import": "./useJwt.mjs",
37
49
  "require": "./useJwt.cjs"
@@ -56,12 +68,14 @@
56
68
  },
57
69
  "homepage": "https://github.com/vueuse/vueuse/tree/main/packages/integrations#readme",
58
70
  "dependencies": {
59
- "@vueuse/shared": "6.3.3",
71
+ "@vueuse/core": "6.6.1",
60
72
  "vue-demi": "*"
61
73
  },
62
74
  "optionalDependencies": {
63
- "axios": "^0.21.4",
64
- "focus-trap": "^6.6.1",
75
+ "axios": "^0.23.0",
76
+ "drauu": "^0.2.1",
77
+ "focus-trap": "^6.7.1",
78
+ "fuse.js": "^6.4.6",
65
79
  "jwt-decode": "^3.1.2",
66
80
  "nprogress": "^0.2.0",
67
81
  "qrcode": "^1.4.4",
package/useAxios.cjs CHANGED
@@ -9,71 +9,75 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
9
9
 
10
10
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
11
11
 
12
- /**
13
- * Wrapper for axios.
14
- *
15
- * @see https://vueuse.org/useAxios
16
- * @param url
17
- * @param config
18
- */
19
- function useAxios(url, ...args) {
20
- let config = {};
21
- let instance = axios__default['default'];
22
- if (args.length > 0) {
23
- /**
24
- * Unable to use `instanceof` here becuase of (https://github.com/axios/axios/issues/737)
25
- * so instead we are checking if there is a `requset` on the object to see if it is an
26
- * axios instance
27
- */
28
- if ('request' in args[0])
29
- instance = args[0];
30
- else
31
- config = args[0];
32
- }
33
- if (args.length > 1) {
34
- if ('request' in args[1])
35
- instance = args[1];
36
- }
37
- const response = vueDemi.shallowRef();
38
- const data = vueDemi.shallowRef();
39
- const isFinished = vueDemi.ref(false);
40
- const isLoading = vueDemi.ref(true);
41
- const aborted = vueDemi.ref(false);
42
- const error = vueDemi.shallowRef();
43
- const cancelToken = axios__default['default'].CancelToken.source();
44
- const abort = (message) => {
45
- if (isFinished.value || !isLoading.value)
46
- return;
47
- cancelToken.cancel(message);
48
- aborted.value = true;
49
- isLoading.value = false;
50
- isFinished.value = false;
51
- };
52
- instance(url, Object.assign(Object.assign({}, config), { cancelToken: cancelToken.token }))
53
- .then((r) => {
54
- response.value = r;
55
- data.value = r.data;
56
- })
57
- .catch((e) => {
58
- error.value = e;
59
- })
60
- .finally(() => {
61
- isLoading.value = false;
62
- isFinished.value = true;
63
- });
64
- return {
65
- response,
66
- data,
67
- error,
68
- finished: isFinished,
69
- loading: isLoading,
70
- isFinished,
71
- isLoading,
72
- cancel: abort,
73
- canceled: aborted,
74
- aborted,
75
- abort,
76
- };
12
+ var __defProp = Object.defineProperty;
13
+ var __defProps = Object.defineProperties;
14
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
15
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
16
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
17
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
18
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19
+ var __spreadValues = (a, b) => {
20
+ for (var prop in b || (b = {}))
21
+ if (__hasOwnProp.call(b, prop))
22
+ __defNormalProp(a, prop, b[prop]);
23
+ if (__getOwnPropSymbols)
24
+ for (var prop of __getOwnPropSymbols(b)) {
25
+ if (__propIsEnum.call(b, prop))
26
+ __defNormalProp(a, prop, b[prop]);
27
+ }
28
+ return a;
29
+ };
30
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
31
+ function useAxios(url, ...args) {
32
+ let config = {};
33
+ let instance = axios__default["default"];
34
+ if (args.length > 0) {
35
+ if ("request" in args[0])
36
+ instance = args[0];
37
+ else
38
+ config = args[0];
39
+ }
40
+ if (args.length > 1) {
41
+ if ("request" in args[1])
42
+ instance = args[1];
43
+ }
44
+ const response = vueDemi.shallowRef();
45
+ const data = vueDemi.shallowRef();
46
+ const isFinished = vueDemi.ref(false);
47
+ const isLoading = vueDemi.ref(true);
48
+ const aborted = vueDemi.ref(false);
49
+ const error = vueDemi.shallowRef();
50
+ const cancelToken = axios__default["default"].CancelToken.source();
51
+ const abort = (message) => {
52
+ if (isFinished.value || !isLoading.value)
53
+ return;
54
+ cancelToken.cancel(message);
55
+ aborted.value = true;
56
+ isLoading.value = false;
57
+ isFinished.value = false;
58
+ };
59
+ instance(url, __spreadProps(__spreadValues({}, config), { cancelToken: cancelToken.token })).then((r) => {
60
+ response.value = r;
61
+ data.value = r.data;
62
+ }).catch((e) => {
63
+ error.value = e;
64
+ }).finally(() => {
65
+ isLoading.value = false;
66
+ isFinished.value = true;
67
+ });
68
+ return {
69
+ response,
70
+ data,
71
+ error,
72
+ finished: isFinished,
73
+ loading: isLoading,
74
+ isFinished,
75
+ isLoading,
76
+ cancel: abort,
77
+ canceled: aborted,
78
+ aborted,
79
+ abort
80
+ };
77
81
  }
78
82
 
79
83
  exports.useAxios = useAxios;
package/useAxios.d.ts CHANGED
@@ -23,7 +23,7 @@ interface UseAxiosReturn<T> {
23
23
  */
24
24
  aborted: Ref<boolean>;
25
25
  /**
26
- * Any erros that may have occurred
26
+ * Any errors that may have occurred
27
27
  */
28
28
  error: Ref<AxiosError<T> | undefined>;
29
29
  /**
package/useAxios.iife.js CHANGED
@@ -66,75 +66,79 @@
66
66
 
67
67
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
68
68
 
69
- /**
70
- * Wrapper for axios.
71
- *
72
- * @see https://vueuse.org/useAxios
73
- * @param url
74
- * @param config
75
- */
76
- function useAxios(url, ...args) {
77
- let config = {};
78
- let instance = axios__default['default'];
79
- if (args.length > 0) {
80
- /**
81
- * Unable to use `instanceof` here becuase of (https://github.com/axios/axios/issues/737)
82
- * so instead we are checking if there is a `requset` on the object to see if it is an
83
- * axios instance
84
- */
85
- if ('request' in args[0])
86
- instance = args[0];
87
- else
88
- config = args[0];
89
- }
90
- if (args.length > 1) {
91
- if ('request' in args[1])
92
- instance = args[1];
93
- }
94
- const response = vueDemi.shallowRef();
95
- const data = vueDemi.shallowRef();
96
- const isFinished = vueDemi.ref(false);
97
- const isLoading = vueDemi.ref(true);
98
- const aborted = vueDemi.ref(false);
99
- const error = vueDemi.shallowRef();
100
- const cancelToken = axios__default['default'].CancelToken.source();
101
- const abort = (message) => {
102
- if (isFinished.value || !isLoading.value)
103
- return;
104
- cancelToken.cancel(message);
105
- aborted.value = true;
106
- isLoading.value = false;
107
- isFinished.value = false;
108
- };
109
- instance(url, Object.assign(Object.assign({}, config), { cancelToken: cancelToken.token }))
110
- .then((r) => {
111
- response.value = r;
112
- data.value = r.data;
113
- })
114
- .catch((e) => {
115
- error.value = e;
116
- })
117
- .finally(() => {
118
- isLoading.value = false;
119
- isFinished.value = true;
120
- });
121
- return {
122
- response,
123
- data,
124
- error,
125
- finished: isFinished,
126
- loading: isLoading,
127
- isFinished,
128
- isLoading,
129
- cancel: abort,
130
- canceled: aborted,
131
- aborted,
132
- abort,
133
- };
69
+ var __defProp = Object.defineProperty;
70
+ var __defProps = Object.defineProperties;
71
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
72
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
73
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
74
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
75
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
76
+ var __spreadValues = (a, b) => {
77
+ for (var prop in b || (b = {}))
78
+ if (__hasOwnProp.call(b, prop))
79
+ __defNormalProp(a, prop, b[prop]);
80
+ if (__getOwnPropSymbols)
81
+ for (var prop of __getOwnPropSymbols(b)) {
82
+ if (__propIsEnum.call(b, prop))
83
+ __defNormalProp(a, prop, b[prop]);
84
+ }
85
+ return a;
86
+ };
87
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
88
+ function useAxios(url, ...args) {
89
+ let config = {};
90
+ let instance = axios__default["default"];
91
+ if (args.length > 0) {
92
+ if ("request" in args[0])
93
+ instance = args[0];
94
+ else
95
+ config = args[0];
96
+ }
97
+ if (args.length > 1) {
98
+ if ("request" in args[1])
99
+ instance = args[1];
100
+ }
101
+ const response = vueDemi.shallowRef();
102
+ const data = vueDemi.shallowRef();
103
+ const isFinished = vueDemi.ref(false);
104
+ const isLoading = vueDemi.ref(true);
105
+ const aborted = vueDemi.ref(false);
106
+ const error = vueDemi.shallowRef();
107
+ const cancelToken = axios__default["default"].CancelToken.source();
108
+ const abort = (message) => {
109
+ if (isFinished.value || !isLoading.value)
110
+ return;
111
+ cancelToken.cancel(message);
112
+ aborted.value = true;
113
+ isLoading.value = false;
114
+ isFinished.value = false;
115
+ };
116
+ instance(url, __spreadProps(__spreadValues({}, config), { cancelToken: cancelToken.token })).then((r) => {
117
+ response.value = r;
118
+ data.value = r.data;
119
+ }).catch((e) => {
120
+ error.value = e;
121
+ }).finally(() => {
122
+ isLoading.value = false;
123
+ isFinished.value = true;
124
+ });
125
+ return {
126
+ response,
127
+ data,
128
+ error,
129
+ finished: isFinished,
130
+ loading: isLoading,
131
+ isFinished,
132
+ isLoading,
133
+ cancel: abort,
134
+ canceled: aborted,
135
+ aborted,
136
+ abort
137
+ };
134
138
  }
135
139
 
136
140
  exports.useAxios = useAxios;
137
141
 
138
142
  Object.defineProperty(exports, '__esModule', { value: true });
139
143
 
140
- }(this.VueUse = this.VueUse || {}, VueDemi, axios));
144
+ })(this.VueUse = this.VueUse || {}, VueDemi, axios);
@@ -1 +1 @@
1
- !function(e){if(!e.VueDemi){var i={},n=e.Vue;if(n)if("2."===n.version.slice(0,2)){var o=e.VueCompositionAPI;if(o){for(var s in o)i[s]=o[s];i.isVue2=!0,i.isVue3=!1,i.install=function(){},i.Vue=n,i.Vue2=n,i.version=n.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if("3."===n.version.slice(0,2)){for(var s in n)i[s]=n[s];i.isVue2=!1,i.isVue3=!0,i.install=function(){},i.Vue=n,i.Vue2=void 0,i.version=n.version,i.set=function(e,i,n){return Array.isArray(e)?(e.length=Math.max(e.length,i),e.splice(i,1,n),n):(e[i]=n,n)},i.del=function(e,i){Array.isArray(e)?e.splice(i,1):delete e[i]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");e.VueDemi=i}}(window),function(e,i,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(n);e.useAxios=function(e,...n){let o={},u=s.default;n.length>0&&("request"in n[0]?u=n[0]:o=n[0]),n.length>1&&"request"in n[1]&&(u=n[1]);const r=i.shallowRef(),t=i.shallowRef(),a=i.ref(!1),l=i.ref(!0),c=i.ref(!1),f=i.shallowRef(),v=s.default.CancelToken.source(),d=e=>{!a.value&&l.value&&(v.cancel(e),c.value=!0,l.value=!1,a.value=!1)};return u(e,Object.assign(Object.assign({},o),{cancelToken:v.token})).then((e=>{r.value=e,t.value=e.data})).catch((e=>{f.value=e})).finally((()=>{l.value=!1,a.value=!0})),{response:r,data:t,error:f,finished:a,loading:l,isFinished:a,isLoading:l,cancel:d,canceled:c,aborted:c,abort:d}},Object.defineProperty(e,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi,axios);
1
+ (function(l){if(!l.VueDemi){var e={},o=l.Vue;if(o)if(o.version.slice(0,2)==="2."){var c=l.VueCompositionAPI;if(c){for(var t in c)e[t]=c[t];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=o,e.Vue2=o,e.version=o.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if(o.version.slice(0,2)==="3."){for(var t in o)e[t]=o[t];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=o,e.Vue2=void 0,e.version=o.version,e.set=function(i,u,a){return Array.isArray(i)?(i.length=Math.max(i.length,u),i.splice(u,1,a),a):(i[u]=a,a)},e.del=function(i,u){if(Array.isArray(i)){i.splice(u,1);return}delete i[u]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");l.VueDemi=e}})(window),function(l,e,o){"use strict";function c(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var t=c(o),i=Object.defineProperty,u=Object.defineProperties,a=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,h=(n,r,s)=>r in n?i(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s,A=(n,r)=>{for(var s in r||(r={}))j.call(r,s)&&h(n,s,r[s]);if(V)for(var s of V(r))w.call(r,s)&&h(n,s,r[s]);return n},x=(n,r)=>u(n,a(r));function R(n,...r){let s={},d=t.default;r.length>0&&("request"in r[0]?d=r[0]:s=r[0]),r.length>1&&"request"in r[1]&&(d=r[1]);const m=e.shallowRef(),O=e.shallowRef(),p=e.ref(!1),v=e.ref(!0),_=e.ref(!1),P=e.shallowRef(),b=t.default.CancelToken.source(),y=f=>{p.value||!v.value||(b.cancel(f),_.value=!0,v.value=!1,p.value=!1)};return d(n,x(A({},s),{cancelToken:b.token})).then(f=>{m.value=f,O.value=f.data}).catch(f=>{P.value=f}).finally(()=>{v.value=!1,p.value=!0}),{response:m,data:O,error:P,finished:p,loading:v,isFinished:p,isLoading:v,cancel:y,canceled:_,aborted:_,abort:y}}l.useAxios=R,Object.defineProperty(l,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi,axios);
package/useAxios.mjs CHANGED
@@ -1,71 +1,75 @@
1
1
  import { shallowRef, ref } from 'vue-demi';
2
2
  import axios from 'axios';
3
3
 
4
- /**
5
- * Wrapper for axios.
6
- *
7
- * @see https://vueuse.org/useAxios
8
- * @param url
9
- * @param config
10
- */
11
- function useAxios(url, ...args) {
12
- let config = {};
13
- let instance = axios;
14
- if (args.length > 0) {
15
- /**
16
- * Unable to use `instanceof` here becuase of (https://github.com/axios/axios/issues/737)
17
- * so instead we are checking if there is a `requset` on the object to see if it is an
18
- * axios instance
19
- */
20
- if ('request' in args[0])
21
- instance = args[0];
22
- else
23
- config = args[0];
24
- }
25
- if (args.length > 1) {
26
- if ('request' in args[1])
27
- instance = args[1];
28
- }
29
- const response = shallowRef();
30
- const data = shallowRef();
31
- const isFinished = ref(false);
32
- const isLoading = ref(true);
33
- const aborted = ref(false);
34
- const error = shallowRef();
35
- const cancelToken = axios.CancelToken.source();
36
- const abort = (message) => {
37
- if (isFinished.value || !isLoading.value)
38
- return;
39
- cancelToken.cancel(message);
40
- aborted.value = true;
41
- isLoading.value = false;
42
- isFinished.value = false;
43
- };
44
- instance(url, Object.assign(Object.assign({}, config), { cancelToken: cancelToken.token }))
45
- .then((r) => {
46
- response.value = r;
47
- data.value = r.data;
48
- })
49
- .catch((e) => {
50
- error.value = e;
51
- })
52
- .finally(() => {
53
- isLoading.value = false;
54
- isFinished.value = true;
55
- });
56
- return {
57
- response,
58
- data,
59
- error,
60
- finished: isFinished,
61
- loading: isLoading,
62
- isFinished,
63
- isLoading,
64
- cancel: abort,
65
- canceled: aborted,
66
- aborted,
67
- abort,
68
- };
4
+ var __defProp = Object.defineProperty;
5
+ var __defProps = Object.defineProperties;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ function useAxios(url, ...args) {
24
+ let config = {};
25
+ let instance = axios;
26
+ if (args.length > 0) {
27
+ if ("request" in args[0])
28
+ instance = args[0];
29
+ else
30
+ config = args[0];
31
+ }
32
+ if (args.length > 1) {
33
+ if ("request" in args[1])
34
+ instance = args[1];
35
+ }
36
+ const response = shallowRef();
37
+ const data = shallowRef();
38
+ const isFinished = ref(false);
39
+ const isLoading = ref(true);
40
+ const aborted = ref(false);
41
+ const error = shallowRef();
42
+ const cancelToken = axios.CancelToken.source();
43
+ const abort = (message) => {
44
+ if (isFinished.value || !isLoading.value)
45
+ return;
46
+ cancelToken.cancel(message);
47
+ aborted.value = true;
48
+ isLoading.value = false;
49
+ isFinished.value = false;
50
+ };
51
+ instance(url, __spreadProps(__spreadValues({}, config), { cancelToken: cancelToken.token })).then((r) => {
52
+ response.value = r;
53
+ data.value = r.data;
54
+ }).catch((e) => {
55
+ error.value = e;
56
+ }).finally(() => {
57
+ isLoading.value = false;
58
+ isFinished.value = true;
59
+ });
60
+ return {
61
+ response,
62
+ data,
63
+ error,
64
+ finished: isFinished,
65
+ loading: isLoading,
66
+ isFinished,
67
+ isLoading,
68
+ cancel: abort,
69
+ canceled: aborted,
70
+ aborted,
71
+ abort
72
+ };
69
73
  }
70
74
 
71
75
  export { useAxios };