@vueuse/integrations 10.3.0 → 10.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.
- package/index.cjs +62 -214
- package/index.d.cts +8 -18
- package/index.d.mts +8 -18
- package/index.d.ts +8 -18
- package/index.iife.js +62 -214
- package/index.iife.min.js +1 -1
- package/index.mjs +64 -216
- package/package.json +6 -6
- package/useAsyncValidator/component.cjs +5 -29
- package/useAsyncValidator/component.mjs +5 -29
- package/useAsyncValidator.cjs +5 -29
- package/useAsyncValidator.d.cts +1 -1
- package/useAsyncValidator.d.mts +1 -1
- package/useAsyncValidator.d.ts +1 -1
- package/useAsyncValidator.iife.js +5 -29
- package/useAsyncValidator.iife.min.js +1 -1
- package/useAsyncValidator.mjs +5 -29
- package/useAxios.cjs +8 -25
- package/useAxios.d.cts +1 -1
- package/useAxios.d.mts +1 -1
- package/useAxios.d.ts +1 -1
- package/useAxios.iife.js +8 -25
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +8 -25
- package/useChangeCase.d.cts +2 -14
- package/useChangeCase.d.mts +2 -14
- package/useChangeCase.d.ts +2 -14
- package/useCookies.cjs +2 -18
- package/useCookies.iife.js +2 -18
- package/useCookies.iife.min.js +1 -1
- package/useCookies.mjs +2 -18
- package/useDrauu.cjs +8 -43
- package/useDrauu.d.cts +1 -1
- package/useDrauu.d.mts +1 -1
- package/useDrauu.d.ts +1 -1
- package/useDrauu.iife.js +8 -43
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +8 -43
- package/useFocusTrap/component.d.cts +1 -1
- package/useFocusTrap/component.d.mts +1 -1
- package/useFocusTrap/component.d.ts +1 -1
- package/useFocusTrap.cjs +4 -34
- package/useFocusTrap.d.cts +1 -1
- package/useFocusTrap.d.mts +1 -1
- package/useFocusTrap.d.ts +1 -1
- package/useFocusTrap.iife.js +4 -34
- package/useFocusTrap.iife.min.js +1 -1
- package/useFocusTrap.mjs +4 -34
- package/useFuse.cjs +5 -9
- package/useFuse.d.cts +1 -1
- package/useFuse.d.mts +1 -1
- package/useFuse.d.ts +1 -1
- package/useFuse.iife.js +5 -9
- package/useFuse.iife.min.js +1 -1
- package/useFuse.mjs +5 -9
- package/useIDBKeyval.cjs +17 -19
- package/useIDBKeyval.d.cts +8 -6
- package/useIDBKeyval.d.mts +8 -6
- package/useIDBKeyval.d.ts +8 -6
- package/useIDBKeyval.iife.js +18 -21
- package/useIDBKeyval.iife.min.js +1 -1
- package/useIDBKeyval.mjs +18 -20
- package/useJwt.cjs +1 -1
- package/useJwt.d.cts +1 -1
- package/useJwt.d.mts +1 -1
- package/useJwt.d.ts +1 -1
- package/useJwt.iife.js +1 -1
- package/useJwt.iife.min.js +1 -1
- package/useJwt.mjs +1 -1
- package/useNProgress.d.cts +1 -1
- package/useNProgress.d.mts +1 -1
- package/useNProgress.d.ts +1 -1
- package/useSortable/component.cjs +13 -36
- package/useSortable/component.mjs +14 -37
- package/useSortable.cjs +13 -36
- package/useSortable.d.cts +1 -1
- package/useSortable.d.mts +1 -1
- package/useSortable.d.ts +1 -1
- package/useSortable.iife.js +13 -36
- package/useSortable.iife.min.js +1 -1
- package/useSortable.mjs +14 -37
package/useAsyncValidator.cjs
CHANGED
|
@@ -4,25 +4,6 @@ var shared = require('@vueuse/shared');
|
|
|
4
4
|
var Schema = require('async-validator');
|
|
5
5
|
var vueDemi = require('vue-demi');
|
|
6
6
|
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __defProps = Object.defineProperties;
|
|
9
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
10
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
-
var __spreadValues = (a, b) => {
|
|
15
|
-
for (var prop in b || (b = {}))
|
|
16
|
-
if (__hasOwnProp.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
if (__getOwnPropSymbols)
|
|
19
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
-
if (__propIsEnum.call(b, prop))
|
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
|
22
|
-
}
|
|
23
|
-
return a;
|
|
24
|
-
};
|
|
25
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
7
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
27
8
|
function useAsyncValidator(value, rules, options = {}) {
|
|
28
9
|
const {
|
|
@@ -34,14 +15,8 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
34
15
|
const errorInfo = vueDemi.shallowRef(null);
|
|
35
16
|
const isFinished = vueDemi.ref(true);
|
|
36
17
|
const pass = vueDemi.ref(!immediate || manual);
|
|
37
|
-
const errors = vueDemi.computed(() =>
|
|
38
|
-
|
|
39
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
40
|
-
});
|
|
41
|
-
const errorFields = vueDemi.computed(() => {
|
|
42
|
-
var _a;
|
|
43
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
44
|
-
});
|
|
18
|
+
const errors = vueDemi.computed(() => errorInfo.value?.errors || []);
|
|
19
|
+
const errorFields = vueDemi.computed(() => errorInfo.value?.fields || {});
|
|
45
20
|
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
46
21
|
const execute = async () => {
|
|
47
22
|
isFinished.value = false;
|
|
@@ -82,11 +57,12 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
82
57
|
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
|
83
58
|
});
|
|
84
59
|
}
|
|
85
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
...shell,
|
|
86
62
|
then(onFulfilled, onRejected) {
|
|
87
63
|
return waitUntilFinished().then(onFulfilled, onRejected);
|
|
88
64
|
}
|
|
89
|
-
}
|
|
65
|
+
};
|
|
90
66
|
}
|
|
91
67
|
|
|
92
68
|
exports.useAsyncValidator = useAsyncValidator;
|
package/useAsyncValidator.d.cts
CHANGED
|
@@ -45,4 +45,4 @@ interface UseAsyncValidatorOptions {
|
|
|
45
45
|
*/
|
|
46
46
|
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
|
|
47
47
|
|
|
48
|
-
export { AsyncValidatorError, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, useAsyncValidator };
|
|
48
|
+
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };
|
package/useAsyncValidator.d.mts
CHANGED
|
@@ -45,4 +45,4 @@ interface UseAsyncValidatorOptions {
|
|
|
45
45
|
*/
|
|
46
46
|
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
|
|
47
47
|
|
|
48
|
-
export { AsyncValidatorError, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, useAsyncValidator };
|
|
48
|
+
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };
|
package/useAsyncValidator.d.ts
CHANGED
|
@@ -45,4 +45,4 @@ interface UseAsyncValidatorOptions {
|
|
|
45
45
|
*/
|
|
46
46
|
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
|
|
47
47
|
|
|
48
|
-
export { AsyncValidatorError, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, useAsyncValidator };
|
|
48
|
+
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };
|
|
@@ -117,25 +117,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
117
117
|
;(function (exports, shared, Schema, vueDemi) {
|
|
118
118
|
'use strict';
|
|
119
119
|
|
|
120
|
-
var __defProp = Object.defineProperty;
|
|
121
|
-
var __defProps = Object.defineProperties;
|
|
122
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
123
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
124
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
125
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
126
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
127
|
-
var __spreadValues = (a, b) => {
|
|
128
|
-
for (var prop in b || (b = {}))
|
|
129
|
-
if (__hasOwnProp.call(b, prop))
|
|
130
|
-
__defNormalProp(a, prop, b[prop]);
|
|
131
|
-
if (__getOwnPropSymbols)
|
|
132
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
133
|
-
if (__propIsEnum.call(b, prop))
|
|
134
|
-
__defNormalProp(a, prop, b[prop]);
|
|
135
|
-
}
|
|
136
|
-
return a;
|
|
137
|
-
};
|
|
138
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
139
120
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
140
121
|
function useAsyncValidator(value, rules, options = {}) {
|
|
141
122
|
const {
|
|
@@ -147,14 +128,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
147
128
|
const errorInfo = vueDemi.shallowRef(null);
|
|
148
129
|
const isFinished = vueDemi.ref(true);
|
|
149
130
|
const pass = vueDemi.ref(!immediate || manual);
|
|
150
|
-
const errors = vueDemi.computed(() =>
|
|
151
|
-
|
|
152
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
153
|
-
});
|
|
154
|
-
const errorFields = vueDemi.computed(() => {
|
|
155
|
-
var _a;
|
|
156
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
157
|
-
});
|
|
131
|
+
const errors = vueDemi.computed(() => errorInfo.value?.errors || []);
|
|
132
|
+
const errorFields = vueDemi.computed(() => errorInfo.value?.fields || {});
|
|
158
133
|
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
159
134
|
const execute = async () => {
|
|
160
135
|
isFinished.value = false;
|
|
@@ -195,11 +170,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
195
170
|
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
|
196
171
|
});
|
|
197
172
|
}
|
|
198
|
-
return
|
|
173
|
+
return {
|
|
174
|
+
...shell,
|
|
199
175
|
then(onFulfilled, onRejected) {
|
|
200
176
|
return waitUntilFinished().then(onFulfilled, onRejected);
|
|
201
177
|
}
|
|
202
|
-
}
|
|
178
|
+
};
|
|
203
179
|
}
|
|
204
180
|
|
|
205
181
|
exports.useAsyncValidator = useAsyncValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(r,
|
|
1
|
+
var VueDemi=function(n,r,c){if(n.install)return n;if(!r)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(r.version.slice(0,4)==="2.7."){let e=function(s,l){var o,v={},u={config:r.config,use:r.use.bind(r),mixin:r.mixin.bind(r),component:r.component.bind(r),provide:function(i,a){return v[i]=a,this},directive:function(i,a){return a?(r.directive(i,a),u):r.directive(i)},mount:function(i,a){return o||(o=new r(Object.assign({propsData:l},s,{provide:Object.assign(v,s.provide)})),o.$mount(i,a),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return u};var A=e;for(var t in r)n[t]=r[t];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=r,n.Vue2=r,n.version=r.version,n.warn=r.util.warn,n.hasInjectionContext=()=>!!n.getCurrentInstance(),n.createApp=e}else if(r.version.slice(0,2)==="2.")if(c){for(var t in c)n[t]=c[t];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=r,n.Vue2=r,n.version=r.version,n.hasInjectionContext=()=>!!n.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(r.version.slice(0,2)==="3."){for(var t in r)n[t]=r[t];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=r,n.Vue2=void 0,n.version=r.version,n.set=function(e,s,l){return Array.isArray(e)?(e.length=Math.max(e.length,s),e.splice(s,1,l),l):(e[s]=l,l)},n.del=function(e,s){if(Array.isArray(e)){e.splice(s,1);return}delete e[s]}}else console.error("[vue-demi] Vue version "+r.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,r,c,t){"use strict";const A=c.default||c;function e(s,l,o={}){const{validateOption:v={},immediate:u=!0,manual:i=!1}=o,a=r.toRef(s),f=t.shallowRef(null),p=t.ref(!0),h=t.ref(!u||i),b=t.computed(()=>f.value?.errors||[]),w=t.computed(()=>f.value?.fields||{}),I=t.computed(()=>new A(r.toValue(l))),x=async()=>{p.value=!1,h.value=!1;try{await I.value.validate(a.value,v),h.value=!0,f.value=null}catch(d){f.value=d}finally{p.value=!0}return{pass:h.value,errorInfo:f.value,errors:b.value,errorFields:w.value}};i||t.watch([a,I],()=>x(),{immediate:u,deep:!0});const C={isFinished:p,pass:h,errors:b,errorInfo:f,errorFields:w,execute:x};function j(){return new Promise((d,y)=>{r.until(p).toBe(!0).then(()=>d(C)).catch(F=>y(F))})}return{...C,then(d,y){return j().then(d,y)}}}n.useAsyncValidator=e})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi);
|
package/useAsyncValidator.mjs
CHANGED
|
@@ -2,25 +2,6 @@ import { toRef, toValue, until } from '@vueuse/shared';
|
|
|
2
2
|
import Schema from 'async-validator';
|
|
3
3
|
import { shallowRef, ref, computed, watch } from 'vue-demi';
|
|
4
4
|
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __defProps = Object.defineProperties;
|
|
7
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
5
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
25
6
|
function useAsyncValidator(value, rules, options = {}) {
|
|
26
7
|
const {
|
|
@@ -32,14 +13,8 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
32
13
|
const errorInfo = shallowRef(null);
|
|
33
14
|
const isFinished = ref(true);
|
|
34
15
|
const pass = ref(!immediate || manual);
|
|
35
|
-
const errors = computed(() =>
|
|
36
|
-
|
|
37
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
38
|
-
});
|
|
39
|
-
const errorFields = computed(() => {
|
|
40
|
-
var _a;
|
|
41
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
42
|
-
});
|
|
16
|
+
const errors = computed(() => errorInfo.value?.errors || []);
|
|
17
|
+
const errorFields = computed(() => errorInfo.value?.fields || {});
|
|
43
18
|
const validator = computed(() => new AsyncValidatorSchema(toValue(rules)));
|
|
44
19
|
const execute = async () => {
|
|
45
20
|
isFinished.value = false;
|
|
@@ -80,11 +55,12 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
80
55
|
until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
|
81
56
|
});
|
|
82
57
|
}
|
|
83
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
...shell,
|
|
84
60
|
then(onFulfilled, onRejected) {
|
|
85
61
|
return waitUntilFinished().then(onFulfilled, onRejected);
|
|
86
62
|
}
|
|
87
|
-
}
|
|
63
|
+
};
|
|
88
64
|
}
|
|
89
65
|
|
|
90
66
|
export { useAsyncValidator };
|
package/useAxios.cjs
CHANGED
|
@@ -4,25 +4,6 @@ var vueDemi = require('vue-demi');
|
|
|
4
4
|
var shared = require('@vueuse/shared');
|
|
5
5
|
var axios = require('axios');
|
|
6
6
|
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __defProps = Object.defineProperties;
|
|
9
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
10
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
-
var __spreadValues = (a, b) => {
|
|
15
|
-
for (var prop in b || (b = {}))
|
|
16
|
-
if (__hasOwnProp.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
if (__getOwnPropSymbols)
|
|
19
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
-
if (__propIsEnum.call(b, prop))
|
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
|
22
|
-
}
|
|
23
|
-
return a;
|
|
24
|
-
};
|
|
25
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
7
|
function useAxios(...args) {
|
|
27
8
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
|
28
9
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
@@ -32,7 +13,7 @@ function useAxios(...args) {
|
|
|
32
13
|
immediate: !!argsPlaceholder,
|
|
33
14
|
shallow: true
|
|
34
15
|
};
|
|
35
|
-
const isAxiosInstance = (val) => !!
|
|
16
|
+
const isAxiosInstance = (val) => !!val?.request;
|
|
36
17
|
if (args.length > 0 + argsPlaceholder) {
|
|
37
18
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
38
19
|
instance = args[0 + argsPlaceholder];
|
|
@@ -88,7 +69,7 @@ function useAxios(...args) {
|
|
|
88
69
|
let executeCounter = 0;
|
|
89
70
|
const execute = (executeUrl = url, config = {}) => {
|
|
90
71
|
error.value = void 0;
|
|
91
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
72
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url ?? config.url;
|
|
92
73
|
if (_url === void 0) {
|
|
93
74
|
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
|
94
75
|
isFinished.value = true;
|
|
@@ -99,7 +80,7 @@ function useAxios(...args) {
|
|
|
99
80
|
loading(true);
|
|
100
81
|
executeCounter += 1;
|
|
101
82
|
const currentExecuteCounter = executeCounter;
|
|
102
|
-
instance(_url,
|
|
83
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
103
84
|
response.value = r;
|
|
104
85
|
const result2 = r.data;
|
|
105
86
|
data.value = result2;
|
|
@@ -108,8 +89,7 @@ function useAxios(...args) {
|
|
|
108
89
|
error.value = e;
|
|
109
90
|
onError(e);
|
|
110
91
|
}).finally(() => {
|
|
111
|
-
|
|
112
|
-
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
92
|
+
options.onFinish?.();
|
|
113
93
|
if (currentExecuteCounter === executeCounter)
|
|
114
94
|
loading(false);
|
|
115
95
|
});
|
|
@@ -129,7 +109,10 @@ function useAxios(...args) {
|
|
|
129
109
|
abort,
|
|
130
110
|
execute
|
|
131
111
|
};
|
|
132
|
-
return
|
|
112
|
+
return {
|
|
113
|
+
...result,
|
|
114
|
+
...promise
|
|
115
|
+
};
|
|
133
116
|
}
|
|
134
117
|
|
|
135
118
|
exports.useAxios = useAxios;
|
package/useAxios.d.cts
CHANGED
|
@@ -91,4 +91,4 @@ declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: Axios
|
|
|
91
91
|
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
92
92
|
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
93
93
|
|
|
94
|
-
export { EasyUseAxiosReturn, StrictUseAxiosReturn, UseAxiosOptions, UseAxiosReturn, useAxios };
|
|
94
|
+
export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };
|
package/useAxios.d.mts
CHANGED
|
@@ -91,4 +91,4 @@ declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: Axios
|
|
|
91
91
|
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
92
92
|
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
93
93
|
|
|
94
|
-
export { EasyUseAxiosReturn, StrictUseAxiosReturn, UseAxiosOptions, UseAxiosReturn, useAxios };
|
|
94
|
+
export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };
|
package/useAxios.d.ts
CHANGED
|
@@ -91,4 +91,4 @@ declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: Axios
|
|
|
91
91
|
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
92
92
|
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
93
93
|
|
|
94
|
-
export { EasyUseAxiosReturn, StrictUseAxiosReturn, UseAxiosOptions, UseAxiosReturn, useAxios };
|
|
94
|
+
export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };
|
package/useAxios.iife.js
CHANGED
|
@@ -117,25 +117,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
117
117
|
;(function (exports, vueDemi, shared, axios) {
|
|
118
118
|
'use strict';
|
|
119
119
|
|
|
120
|
-
var __defProp = Object.defineProperty;
|
|
121
|
-
var __defProps = Object.defineProperties;
|
|
122
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
123
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
124
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
125
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
126
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
127
|
-
var __spreadValues = (a, b) => {
|
|
128
|
-
for (var prop in b || (b = {}))
|
|
129
|
-
if (__hasOwnProp.call(b, prop))
|
|
130
|
-
__defNormalProp(a, prop, b[prop]);
|
|
131
|
-
if (__getOwnPropSymbols)
|
|
132
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
133
|
-
if (__propIsEnum.call(b, prop))
|
|
134
|
-
__defNormalProp(a, prop, b[prop]);
|
|
135
|
-
}
|
|
136
|
-
return a;
|
|
137
|
-
};
|
|
138
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
139
120
|
function useAxios(...args) {
|
|
140
121
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
|
141
122
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
@@ -145,7 +126,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
145
126
|
immediate: !!argsPlaceholder,
|
|
146
127
|
shallow: true
|
|
147
128
|
};
|
|
148
|
-
const isAxiosInstance = (val) => !!
|
|
129
|
+
const isAxiosInstance = (val) => !!val?.request;
|
|
149
130
|
if (args.length > 0 + argsPlaceholder) {
|
|
150
131
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
151
132
|
instance = args[0 + argsPlaceholder];
|
|
@@ -201,7 +182,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
201
182
|
let executeCounter = 0;
|
|
202
183
|
const execute = (executeUrl = url, config = {}) => {
|
|
203
184
|
error.value = void 0;
|
|
204
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
185
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url ?? config.url;
|
|
205
186
|
if (_url === void 0) {
|
|
206
187
|
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
|
207
188
|
isFinished.value = true;
|
|
@@ -212,7 +193,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
212
193
|
loading(true);
|
|
213
194
|
executeCounter += 1;
|
|
214
195
|
const currentExecuteCounter = executeCounter;
|
|
215
|
-
instance(_url,
|
|
196
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
216
197
|
response.value = r;
|
|
217
198
|
const result2 = r.data;
|
|
218
199
|
data.value = result2;
|
|
@@ -221,8 +202,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
221
202
|
error.value = e;
|
|
222
203
|
onError(e);
|
|
223
204
|
}).finally(() => {
|
|
224
|
-
|
|
225
|
-
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
205
|
+
options.onFinish?.();
|
|
226
206
|
if (currentExecuteCounter === executeCounter)
|
|
227
207
|
loading(false);
|
|
228
208
|
});
|
|
@@ -242,7 +222,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
242
222
|
abort,
|
|
243
223
|
execute
|
|
244
224
|
};
|
|
245
|
-
return
|
|
225
|
+
return {
|
|
226
|
+
...result,
|
|
227
|
+
...promise
|
|
228
|
+
};
|
|
246
229
|
}
|
|
247
230
|
|
|
248
231
|
exports.useAxios = useAxios;
|
package/useAxios.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(e,n,
|
|
1
|
+
var VueDemi=function(e,n,a){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let t=function(i,o){var l,u={},d={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(c,f){return u[c]=f,this},directive:function(c,f){return f?(n.directive(c,f),d):n.directive(c)},mount:function(c,f){return l||(l=new n(Object.assign({propsData:o},i,{provide:Object.assign(u,i.provide)})),l.$mount(c,f),l)},unmount:function(){l&&(l.$destroy(),l=void 0)}};return d};var R=t;for(var r in n)e[r]=n[r];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.warn=n.util.warn,e.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=t}else if(n.version.slice(0,2)==="2.")if(a){for(var r in a)e[r]=a[r];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var r in n)e[r]=n[r];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(t,i,o){return Array.isArray(t)?(t.length=Math.max(t.length,i),t.splice(i,1,o),o):(t[i]=o,o)},e.del=function(t,i){if(Array.isArray(t)){t.splice(i,1);return}delete t[i]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,n,a,r){"use strict";function R(...t){const i=typeof t[0]=="string"?t[0]:void 0,o=typeof i=="string"?1:0;let l={},u=r,d={immediate:!!o,shallow:!0};const c=s=>!!s?.request;t.length>0+o&&(c(t[0+o])?u=t[0+o]:l=t[0+o]),t.length>1+o&&c(t[1+o])&&(u=t[1+o]),(t.length===2+o&&!c(t[1+o])||t.length===3+o)&&(d=t[t.length-1]);const{initialData:f,shallow:S,onSuccess:U=a.noop,onError:$=a.noop,immediate:q,resetOnExecute:B=!1}=d,j=n.shallowRef(),w=(S?n.shallowRef:n.ref)(f),v=n.ref(!1),A=n.ref(!1),y=n.ref(!1),p=n.shallowRef(),P=r.CancelToken.source;let C=P();const x=s=>{v.value||!A.value||(C.cancel(s),C=P(),y.value=!0,A.value=!1,v.value=!1)},T=s=>{A.value=s,v.value=!s},M=()=>{B&&(w.value=f)},k=()=>new Promise((s,b)=>{a.until(v).toBe(!0).then(()=>p.value?b(p.value):s(L))}),I={then:(...s)=>k().then(...s),catch:(...s)=>k().catch(...s)};let E=0;const F=(s=i,b={})=>{p.value=void 0;const O=typeof s=="string"?s:i??b.url;if(O===void 0)return p.value=new r.AxiosError(r.AxiosError.ERR_INVALID_URL),v.value=!0,I;M(),x(),T(!0),E+=1;const N=E;return u(O,{...l,...typeof s=="object"?s:b,cancelToken:C.token}).then(h=>{j.value=h;const _=h.data;w.value=_,U(_)}).catch(h=>{p.value=h,$(h)}).finally(()=>{d.onFinish?.(),N===E&&T(!1)}),I};q&&i&&F();const L={response:j,data:w,error:p,isFinished:v,isLoading:A,cancel:x,isAborted:y,isCanceled:y,abort:x,execute:F};return{...L,...I}}e.useAxios=R})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
|
package/useAxios.mjs
CHANGED
|
@@ -2,25 +2,6 @@ import { shallowRef, ref } from 'vue-demi';
|
|
|
2
2
|
import { noop, until } from '@vueuse/shared';
|
|
3
3
|
import axios, { AxiosError } from 'axios';
|
|
4
4
|
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __defProps = Object.defineProperties;
|
|
7
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
5
|
function useAxios(...args) {
|
|
25
6
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
|
26
7
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
@@ -30,7 +11,7 @@ function useAxios(...args) {
|
|
|
30
11
|
immediate: !!argsPlaceholder,
|
|
31
12
|
shallow: true
|
|
32
13
|
};
|
|
33
|
-
const isAxiosInstance = (val) => !!
|
|
14
|
+
const isAxiosInstance = (val) => !!val?.request;
|
|
34
15
|
if (args.length > 0 + argsPlaceholder) {
|
|
35
16
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
36
17
|
instance = args[0 + argsPlaceholder];
|
|
@@ -86,7 +67,7 @@ function useAxios(...args) {
|
|
|
86
67
|
let executeCounter = 0;
|
|
87
68
|
const execute = (executeUrl = url, config = {}) => {
|
|
88
69
|
error.value = void 0;
|
|
89
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
70
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url ?? config.url;
|
|
90
71
|
if (_url === void 0) {
|
|
91
72
|
error.value = new AxiosError(AxiosError.ERR_INVALID_URL);
|
|
92
73
|
isFinished.value = true;
|
|
@@ -97,7 +78,7 @@ function useAxios(...args) {
|
|
|
97
78
|
loading(true);
|
|
98
79
|
executeCounter += 1;
|
|
99
80
|
const currentExecuteCounter = executeCounter;
|
|
100
|
-
instance(_url,
|
|
81
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
101
82
|
response.value = r;
|
|
102
83
|
const result2 = r.data;
|
|
103
84
|
data.value = result2;
|
|
@@ -106,8 +87,7 @@ function useAxios(...args) {
|
|
|
106
87
|
error.value = e;
|
|
107
88
|
onError(e);
|
|
108
89
|
}).finally(() => {
|
|
109
|
-
|
|
110
|
-
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
90
|
+
options.onFinish?.();
|
|
111
91
|
if (currentExecuteCounter === executeCounter)
|
|
112
92
|
loading(false);
|
|
113
93
|
});
|
|
@@ -127,7 +107,10 @@ function useAxios(...args) {
|
|
|
127
107
|
abort,
|
|
128
108
|
execute
|
|
129
109
|
};
|
|
130
|
-
return
|
|
110
|
+
return {
|
|
111
|
+
...result,
|
|
112
|
+
...promise
|
|
113
|
+
};
|
|
131
114
|
}
|
|
132
115
|
|
|
133
116
|
export { useAxios };
|
package/useChangeCase.d.cts
CHANGED
|
@@ -14,23 +14,11 @@ declare const changeCase_pathCase: typeof pathCase;
|
|
|
14
14
|
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
15
15
|
declare const changeCase_snakeCase: typeof snakeCase;
|
|
16
16
|
declare namespace changeCase {
|
|
17
|
-
export {
|
|
18
|
-
changeCase_camelCase as camelCase,
|
|
19
|
-
changeCase_capitalCase as capitalCase,
|
|
20
|
-
changeCase_constantCase as constantCase,
|
|
21
|
-
changeCase_dotCase as dotCase,
|
|
22
|
-
changeCase_headerCase as headerCase,
|
|
23
|
-
changeCase_noCase as noCase,
|
|
24
|
-
changeCase_paramCase as paramCase,
|
|
25
|
-
changeCase_pascalCase as pascalCase,
|
|
26
|
-
changeCase_pathCase as pathCase,
|
|
27
|
-
changeCase_sentenceCase as sentenceCase,
|
|
28
|
-
changeCase_snakeCase as snakeCase,
|
|
29
|
-
};
|
|
17
|
+
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
|
|
30
18
|
}
|
|
31
19
|
|
|
32
20
|
type ChangeCaseType = keyof typeof changeCase;
|
|
33
21
|
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
|
|
34
22
|
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
|
|
35
23
|
|
|
36
|
-
export { ChangeCaseType, useChangeCase };
|
|
24
|
+
export { type ChangeCaseType, useChangeCase };
|
package/useChangeCase.d.mts
CHANGED
|
@@ -14,23 +14,11 @@ declare const changeCase_pathCase: typeof pathCase;
|
|
|
14
14
|
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
15
15
|
declare const changeCase_snakeCase: typeof snakeCase;
|
|
16
16
|
declare namespace changeCase {
|
|
17
|
-
export {
|
|
18
|
-
changeCase_camelCase as camelCase,
|
|
19
|
-
changeCase_capitalCase as capitalCase,
|
|
20
|
-
changeCase_constantCase as constantCase,
|
|
21
|
-
changeCase_dotCase as dotCase,
|
|
22
|
-
changeCase_headerCase as headerCase,
|
|
23
|
-
changeCase_noCase as noCase,
|
|
24
|
-
changeCase_paramCase as paramCase,
|
|
25
|
-
changeCase_pascalCase as pascalCase,
|
|
26
|
-
changeCase_pathCase as pathCase,
|
|
27
|
-
changeCase_sentenceCase as sentenceCase,
|
|
28
|
-
changeCase_snakeCase as snakeCase,
|
|
29
|
-
};
|
|
17
|
+
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
|
|
30
18
|
}
|
|
31
19
|
|
|
32
20
|
type ChangeCaseType = keyof typeof changeCase;
|
|
33
21
|
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
|
|
34
22
|
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
|
|
35
23
|
|
|
36
|
-
export { ChangeCaseType, useChangeCase };
|
|
24
|
+
export { type ChangeCaseType, useChangeCase };
|
package/useChangeCase.d.ts
CHANGED
|
@@ -14,23 +14,11 @@ declare const changeCase_pathCase: typeof pathCase;
|
|
|
14
14
|
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
15
15
|
declare const changeCase_snakeCase: typeof snakeCase;
|
|
16
16
|
declare namespace changeCase {
|
|
17
|
-
export {
|
|
18
|
-
changeCase_camelCase as camelCase,
|
|
19
|
-
changeCase_capitalCase as capitalCase,
|
|
20
|
-
changeCase_constantCase as constantCase,
|
|
21
|
-
changeCase_dotCase as dotCase,
|
|
22
|
-
changeCase_headerCase as headerCase,
|
|
23
|
-
changeCase_noCase as noCase,
|
|
24
|
-
changeCase_paramCase as paramCase,
|
|
25
|
-
changeCase_pascalCase as pascalCase,
|
|
26
|
-
changeCase_pathCase as pathCase,
|
|
27
|
-
changeCase_sentenceCase as sentenceCase,
|
|
28
|
-
changeCase_snakeCase as snakeCase,
|
|
29
|
-
};
|
|
17
|
+
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
|
|
30
18
|
}
|
|
31
19
|
|
|
32
20
|
type ChangeCaseType = keyof typeof changeCase;
|
|
33
21
|
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
|
|
34
22
|
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
|
|
35
23
|
|
|
36
|
-
export { ChangeCaseType, useChangeCase };
|
|
24
|
+
export { type ChangeCaseType, useChangeCase };
|
package/useCookies.cjs
CHANGED
|
@@ -4,22 +4,6 @@ var shared = require('@vueuse/shared');
|
|
|
4
4
|
var vueDemi = require('vue-demi');
|
|
5
5
|
var Cookie = require('universal-cookie');
|
|
6
6
|
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
7
|
function createCookies(req) {
|
|
24
8
|
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
|
25
9
|
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
@@ -50,14 +34,14 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
|
|
|
50
34
|
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
51
35
|
watchingDependencies.push(args[0]);
|
|
52
36
|
touches.value;
|
|
53
|
-
return cookies.get(args[0],
|
|
37
|
+
return cookies.get(args[0], { doNotParse, ...args[1] });
|
|
54
38
|
},
|
|
55
39
|
/**
|
|
56
40
|
* Reactive get all cookies
|
|
57
41
|
*/
|
|
58
42
|
getAll: (...args) => {
|
|
59
43
|
touches.value;
|
|
60
|
-
return cookies.getAll(
|
|
44
|
+
return cookies.getAll({ doNotParse, ...args[0] });
|
|
61
45
|
},
|
|
62
46
|
set: (...args) => cookies.set(...args),
|
|
63
47
|
remove: (...args) => cookies.remove(...args),
|