@vueuse/integrations 11.2.0 → 12.0.0-beta.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/index.cjs +63 -49
- package/index.d.cts +19 -5
- package/index.d.mts +19 -5
- package/index.d.ts +19 -5
- package/index.iife.js +64 -177
- package/index.iife.min.js +1 -1
- package/index.mjs +16 -4
- package/package.json +4 -4
- package/useAsyncValidator/component.cjs +10 -10
- package/useAsyncValidator/component.d.cts +1 -1
- package/useAsyncValidator/component.d.mts +1 -1
- package/useAsyncValidator/component.d.ts +1 -1
- package/useAsyncValidator/component.mjs +1 -1
- package/useAsyncValidator.cjs +8 -8
- package/useAsyncValidator.d.cts +1 -1
- package/useAsyncValidator.d.mts +1 -1
- package/useAsyncValidator.d.ts +1 -1
- package/useAsyncValidator.iife.js +9 -136
- package/useAsyncValidator.iife.min.js +1 -1
- package/useAsyncValidator.mjs +1 -1
- package/useAxios.cjs +7 -7
- package/useAxios.d.cts +1 -1
- package/useAxios.d.mts +1 -1
- package/useAxios.d.ts +1 -1
- package/useAxios.iife.js +8 -135
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +1 -1
- package/useChangeCase.cjs +5 -5
- package/useChangeCase.d.cts +1 -1
- package/useChangeCase.d.mts +1 -1
- package/useChangeCase.d.ts +1 -1
- package/useChangeCase.iife.js +6 -133
- package/useChangeCase.iife.min.js +1 -1
- package/useChangeCase.mjs +1 -1
- package/useCookies.cjs +2 -2
- package/useCookies.iife.js +3 -130
- package/useCookies.iife.min.js +1 -1
- package/useCookies.mjs +1 -1
- package/useDrauu.cjs +9 -9
- package/useDrauu.d.cts +1 -1
- package/useDrauu.d.mts +1 -1
- package/useDrauu.d.ts +1 -1
- package/useDrauu.iife.js +10 -137
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +1 -1
- package/useFocusTrap/component.cjs +6 -6
- package/useFocusTrap/component.mjs +1 -1
- package/useFocusTrap.cjs +5 -5
- package/useFocusTrap.d.cts +1 -1
- package/useFocusTrap.d.mts +1 -1
- package/useFocusTrap.d.ts +1 -1
- package/useFocusTrap.iife.js +6 -133
- package/useFocusTrap.iife.min.js +1 -1
- package/useFocusTrap.mjs +1 -1
- package/useFuse.cjs +5 -5
- package/useFuse.d.cts +2 -2
- package/useFuse.d.mts +2 -2
- package/useFuse.d.ts +2 -2
- package/useFuse.iife.js +6 -133
- package/useFuse.iife.min.js +1 -1
- package/useFuse.mjs +1 -1
- package/useIDBKeyval.cjs +4 -4
- package/useIDBKeyval.d.cts +1 -1
- package/useIDBKeyval.d.mts +1 -1
- package/useIDBKeyval.d.ts +1 -1
- package/useIDBKeyval.iife.js +5 -132
- package/useIDBKeyval.iife.min.js +1 -1
- package/useIDBKeyval.mjs +1 -1
- package/useJwt.cjs +3 -3
- package/useJwt.d.cts +1 -1
- package/useJwt.d.mts +1 -1
- package/useJwt.d.ts +1 -1
- package/useJwt.iife.js +4 -131
- package/useJwt.iife.min.js +1 -1
- package/useJwt.mjs +1 -1
- package/useNProgress.cjs +4 -4
- package/useNProgress.d.cts +2 -2
- package/useNProgress.d.mts +2 -2
- package/useNProgress.d.ts +2 -2
- package/useNProgress.iife.js +5 -132
- package/useNProgress.iife.min.js +1 -1
- package/useNProgress.mjs +1 -1
- package/useQRCode.cjs +3 -3
- package/useQRCode.d.cts +1 -1
- package/useQRCode.d.mts +1 -1
- package/useQRCode.d.ts +1 -1
- package/useQRCode.iife.js +4 -131
- package/useQRCode.iife.min.js +1 -1
- package/useQRCode.mjs +1 -1
- package/useSortable/component.cjs +21 -14
- package/useSortable/component.d.cts +1 -1
- package/useSortable/component.d.mts +1 -1
- package/useSortable/component.d.ts +1 -1
- package/useSortable/component.mjs +15 -8
- package/useSortable.cjs +19 -5
- package/useSortable.d.cts +16 -2
- package/useSortable.d.mts +16 -2
- package/useSortable.d.ts +16 -2
- package/useSortable.iife.js +20 -133
- package/useSortable.iife.min.js +1 -1
- package/useSortable.mjs +16 -4
package/useAsyncValidator.d.cts
CHANGED
package/useAsyncValidator.d.mts
CHANGED
package/useAsyncValidator.d.ts
CHANGED
|
@@ -1,131 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
? globalThis
|
|
3
|
-
: typeof global !== 'undefined'
|
|
4
|
-
? global
|
|
5
|
-
: typeof self !== 'undefined'
|
|
6
|
-
? self
|
|
7
|
-
: this
|
|
8
|
-
var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
9
|
-
if (VueDemi.install) {
|
|
10
|
-
return VueDemi
|
|
11
|
-
}
|
|
12
|
-
if (!Vue) {
|
|
13
|
-
console.error('[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.')
|
|
14
|
-
return VueDemi
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Vue 2.7
|
|
18
|
-
if (Vue.version.slice(0, 4) === '2.7.') {
|
|
19
|
-
for (var key in Vue) {
|
|
20
|
-
VueDemi[key] = Vue[key]
|
|
21
|
-
}
|
|
22
|
-
VueDemi.isVue2 = true
|
|
23
|
-
VueDemi.isVue3 = false
|
|
24
|
-
VueDemi.install = function () {}
|
|
25
|
-
VueDemi.Vue = Vue
|
|
26
|
-
VueDemi.Vue2 = Vue
|
|
27
|
-
VueDemi.version = Vue.version
|
|
28
|
-
VueDemi.warn = Vue.util.warn
|
|
29
|
-
VueDemi.hasInjectionContext = function() {
|
|
30
|
-
return !!VueDemi.getCurrentInstance()
|
|
31
|
-
}
|
|
32
|
-
function createApp(rootComponent, rootProps) {
|
|
33
|
-
var vm
|
|
34
|
-
var provide = {}
|
|
35
|
-
var app = {
|
|
36
|
-
config: Vue.config,
|
|
37
|
-
use: Vue.use.bind(Vue),
|
|
38
|
-
mixin: Vue.mixin.bind(Vue),
|
|
39
|
-
component: Vue.component.bind(Vue),
|
|
40
|
-
provide: function (key, value) {
|
|
41
|
-
provide[key] = value
|
|
42
|
-
return this
|
|
43
|
-
},
|
|
44
|
-
directive: function (name, dir) {
|
|
45
|
-
if (dir) {
|
|
46
|
-
Vue.directive(name, dir)
|
|
47
|
-
return app
|
|
48
|
-
} else {
|
|
49
|
-
return Vue.directive(name)
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
mount: function (el, hydrating) {
|
|
53
|
-
if (!vm) {
|
|
54
|
-
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
|
|
55
|
-
vm.$mount(el, hydrating)
|
|
56
|
-
return vm
|
|
57
|
-
} else {
|
|
58
|
-
return vm
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
unmount: function () {
|
|
62
|
-
if (vm) {
|
|
63
|
-
vm.$destroy()
|
|
64
|
-
vm = undefined
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
}
|
|
68
|
-
return app
|
|
69
|
-
}
|
|
70
|
-
VueDemi.createApp = createApp
|
|
71
|
-
}
|
|
72
|
-
// Vue 2.6.x
|
|
73
|
-
else if (Vue.version.slice(0, 2) === '2.') {
|
|
74
|
-
if (VueCompositionAPI) {
|
|
75
|
-
for (var key in VueCompositionAPI) {
|
|
76
|
-
VueDemi[key] = VueCompositionAPI[key]
|
|
77
|
-
}
|
|
78
|
-
VueDemi.isVue2 = true
|
|
79
|
-
VueDemi.isVue3 = false
|
|
80
|
-
VueDemi.install = function () {}
|
|
81
|
-
VueDemi.Vue = Vue
|
|
82
|
-
VueDemi.Vue2 = Vue
|
|
83
|
-
VueDemi.version = Vue.version
|
|
84
|
-
VueDemi.hasInjectionContext = function() {
|
|
85
|
-
return !!VueDemi.getCurrentInstance()
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.')
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// Vue 3
|
|
92
|
-
else if (Vue.version.slice(0, 2) === '3.') {
|
|
93
|
-
for (var key in Vue) {
|
|
94
|
-
VueDemi[key] = Vue[key]
|
|
95
|
-
}
|
|
96
|
-
VueDemi.isVue2 = false
|
|
97
|
-
VueDemi.isVue3 = true
|
|
98
|
-
VueDemi.install = function () {}
|
|
99
|
-
VueDemi.Vue = Vue
|
|
100
|
-
VueDemi.Vue2 = undefined
|
|
101
|
-
VueDemi.version = Vue.version
|
|
102
|
-
VueDemi.set = function (target, key, val) {
|
|
103
|
-
if (Array.isArray(target)) {
|
|
104
|
-
target.length = Math.max(target.length, key)
|
|
105
|
-
target.splice(key, 1, val)
|
|
106
|
-
return val
|
|
107
|
-
}
|
|
108
|
-
target[key] = val
|
|
109
|
-
return val
|
|
110
|
-
}
|
|
111
|
-
VueDemi.del = function (target, key) {
|
|
112
|
-
if (Array.isArray(target)) {
|
|
113
|
-
target.splice(key, 1)
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
delete target[key]
|
|
117
|
-
}
|
|
118
|
-
} else {
|
|
119
|
-
console.error('[vue-demi] Vue version ' + Vue.version + ' is unsupported.')
|
|
120
|
-
}
|
|
121
|
-
return VueDemi
|
|
122
|
-
})(
|
|
123
|
-
(_VueDemiGlobal.VueDemi = _VueDemiGlobal.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
|
|
124
|
-
_VueDemiGlobal.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
|
|
125
|
-
_VueDemiGlobal.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
|
|
126
|
-
);
|
|
127
|
-
;
|
|
128
|
-
;(function (exports, shared, Schema, vueDemi) {
|
|
1
|
+
(function (exports, shared, Schema, vue) {
|
|
129
2
|
'use strict';
|
|
130
3
|
|
|
131
4
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
@@ -136,18 +9,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
136
9
|
manual = false
|
|
137
10
|
} = options;
|
|
138
11
|
const valueRef = shared.toRef(value);
|
|
139
|
-
const errorInfo =
|
|
140
|
-
const isFinished =
|
|
141
|
-
const pass =
|
|
142
|
-
const errors =
|
|
12
|
+
const errorInfo = vue.shallowRef(null);
|
|
13
|
+
const isFinished = vue.ref(true);
|
|
14
|
+
const pass = vue.ref(!immediate || manual);
|
|
15
|
+
const errors = vue.computed(() => {
|
|
143
16
|
var _a;
|
|
144
17
|
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
145
18
|
});
|
|
146
|
-
const errorFields =
|
|
19
|
+
const errorFields = vue.computed(() => {
|
|
147
20
|
var _a;
|
|
148
21
|
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
149
22
|
});
|
|
150
|
-
const validator =
|
|
23
|
+
const validator = vue.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
151
24
|
const execute = async () => {
|
|
152
25
|
isFinished.value = false;
|
|
153
26
|
pass.value = false;
|
|
@@ -168,7 +41,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
168
41
|
};
|
|
169
42
|
};
|
|
170
43
|
if (!manual) {
|
|
171
|
-
|
|
44
|
+
vue.watch(
|
|
172
45
|
[valueRef, validator],
|
|
173
46
|
() => execute(),
|
|
174
47
|
{ immediate, deep: true }
|
|
@@ -197,4 +70,4 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
197
70
|
|
|
198
71
|
exports.useAsyncValidator = useAsyncValidator;
|
|
199
72
|
|
|
200
|
-
})(this.VueUse = this.VueUse || {}, VueUse, AsyncValidator,
|
|
73
|
+
})(this.VueUse = this.VueUse || {}, VueUse, AsyncValidator, Vue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(m,n,s,t){"use strict";const p=s.default||s;function y(w,A,F={}){const{validateOption:U={},immediate:o=!0,manual:i=!1}=F,c=n.toRef(w),r=t.shallowRef(null),a=t.ref(!0),l=t.ref(!o||i),d=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.errors)||[]}),f=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.fields)||{}}),v=t.computed(()=>new p(n.toValue(A))),h=async()=>{a.value=!1,l.value=!1;try{await v.value.validate(c.value,U),l.value=!0,r.value=null}catch(e){r.value=e}finally{a.value=!0}return{pass:l.value,errorInfo:r.value,errors:d.value,errorFields:f.value}};i||t.watch([c,v],()=>h(),{immediate:o,deep:!0});const V={isFinished:a,pass:l,errors:d,errorInfo:r,errorFields:f,execute:h};function R(){return new Promise((e,u)=>{n.until(a).toBe(!0).then(()=>e(V)).catch(I=>u(I))})}return{...V,then(e,u){return R().then(e,u)}}}m.useAsyncValidator=y})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue);
|
package/useAsyncValidator.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toRef, toValue, until } from '@vueuse/shared';
|
|
2
2
|
import Schema from 'async-validator';
|
|
3
|
-
import { shallowRef, ref, computed, watch } from 'vue
|
|
3
|
+
import { shallowRef, ref, computed, watch } from 'vue';
|
|
4
4
|
|
|
5
5
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
6
6
|
function useAsyncValidator(value, rules, options = {}) {
|
package/useAxios.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var shared = require('@vueuse/shared');
|
|
4
4
|
var axios = require('axios');
|
|
5
|
-
var
|
|
5
|
+
var vue = require('vue');
|
|
6
6
|
|
|
7
7
|
function useAxios(...args) {
|
|
8
8
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
|
@@ -37,12 +37,12 @@ function useAxios(...args) {
|
|
|
37
37
|
immediate,
|
|
38
38
|
resetOnExecute = false
|
|
39
39
|
} = options;
|
|
40
|
-
const response =
|
|
41
|
-
const data = (shallow ?
|
|
42
|
-
const isFinished =
|
|
43
|
-
const isLoading =
|
|
44
|
-
const isAborted =
|
|
45
|
-
const error =
|
|
40
|
+
const response = vue.shallowRef();
|
|
41
|
+
const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
|
|
42
|
+
const isFinished = vue.ref(false);
|
|
43
|
+
const isLoading = vue.ref(false);
|
|
44
|
+
const isAborted = vue.ref(false);
|
|
45
|
+
const error = vue.shallowRef();
|
|
46
46
|
let abortController = new AbortController();
|
|
47
47
|
const abort = (message) => {
|
|
48
48
|
if (isFinished.value || !isLoading.value)
|
package/useAxios.d.cts
CHANGED
package/useAxios.d.mts
CHANGED
package/useAxios.d.ts
CHANGED
package/useAxios.iife.js
CHANGED
|
@@ -1,131 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
? globalThis
|
|
3
|
-
: typeof global !== 'undefined'
|
|
4
|
-
? global
|
|
5
|
-
: typeof self !== 'undefined'
|
|
6
|
-
? self
|
|
7
|
-
: this
|
|
8
|
-
var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
9
|
-
if (VueDemi.install) {
|
|
10
|
-
return VueDemi
|
|
11
|
-
}
|
|
12
|
-
if (!Vue) {
|
|
13
|
-
console.error('[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.')
|
|
14
|
-
return VueDemi
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Vue 2.7
|
|
18
|
-
if (Vue.version.slice(0, 4) === '2.7.') {
|
|
19
|
-
for (var key in Vue) {
|
|
20
|
-
VueDemi[key] = Vue[key]
|
|
21
|
-
}
|
|
22
|
-
VueDemi.isVue2 = true
|
|
23
|
-
VueDemi.isVue3 = false
|
|
24
|
-
VueDemi.install = function () {}
|
|
25
|
-
VueDemi.Vue = Vue
|
|
26
|
-
VueDemi.Vue2 = Vue
|
|
27
|
-
VueDemi.version = Vue.version
|
|
28
|
-
VueDemi.warn = Vue.util.warn
|
|
29
|
-
VueDemi.hasInjectionContext = function() {
|
|
30
|
-
return !!VueDemi.getCurrentInstance()
|
|
31
|
-
}
|
|
32
|
-
function createApp(rootComponent, rootProps) {
|
|
33
|
-
var vm
|
|
34
|
-
var provide = {}
|
|
35
|
-
var app = {
|
|
36
|
-
config: Vue.config,
|
|
37
|
-
use: Vue.use.bind(Vue),
|
|
38
|
-
mixin: Vue.mixin.bind(Vue),
|
|
39
|
-
component: Vue.component.bind(Vue),
|
|
40
|
-
provide: function (key, value) {
|
|
41
|
-
provide[key] = value
|
|
42
|
-
return this
|
|
43
|
-
},
|
|
44
|
-
directive: function (name, dir) {
|
|
45
|
-
if (dir) {
|
|
46
|
-
Vue.directive(name, dir)
|
|
47
|
-
return app
|
|
48
|
-
} else {
|
|
49
|
-
return Vue.directive(name)
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
mount: function (el, hydrating) {
|
|
53
|
-
if (!vm) {
|
|
54
|
-
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
|
|
55
|
-
vm.$mount(el, hydrating)
|
|
56
|
-
return vm
|
|
57
|
-
} else {
|
|
58
|
-
return vm
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
unmount: function () {
|
|
62
|
-
if (vm) {
|
|
63
|
-
vm.$destroy()
|
|
64
|
-
vm = undefined
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
}
|
|
68
|
-
return app
|
|
69
|
-
}
|
|
70
|
-
VueDemi.createApp = createApp
|
|
71
|
-
}
|
|
72
|
-
// Vue 2.6.x
|
|
73
|
-
else if (Vue.version.slice(0, 2) === '2.') {
|
|
74
|
-
if (VueCompositionAPI) {
|
|
75
|
-
for (var key in VueCompositionAPI) {
|
|
76
|
-
VueDemi[key] = VueCompositionAPI[key]
|
|
77
|
-
}
|
|
78
|
-
VueDemi.isVue2 = true
|
|
79
|
-
VueDemi.isVue3 = false
|
|
80
|
-
VueDemi.install = function () {}
|
|
81
|
-
VueDemi.Vue = Vue
|
|
82
|
-
VueDemi.Vue2 = Vue
|
|
83
|
-
VueDemi.version = Vue.version
|
|
84
|
-
VueDemi.hasInjectionContext = function() {
|
|
85
|
-
return !!VueDemi.getCurrentInstance()
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.')
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// Vue 3
|
|
92
|
-
else if (Vue.version.slice(0, 2) === '3.') {
|
|
93
|
-
for (var key in Vue) {
|
|
94
|
-
VueDemi[key] = Vue[key]
|
|
95
|
-
}
|
|
96
|
-
VueDemi.isVue2 = false
|
|
97
|
-
VueDemi.isVue3 = true
|
|
98
|
-
VueDemi.install = function () {}
|
|
99
|
-
VueDemi.Vue = Vue
|
|
100
|
-
VueDemi.Vue2 = undefined
|
|
101
|
-
VueDemi.version = Vue.version
|
|
102
|
-
VueDemi.set = function (target, key, val) {
|
|
103
|
-
if (Array.isArray(target)) {
|
|
104
|
-
target.length = Math.max(target.length, key)
|
|
105
|
-
target.splice(key, 1, val)
|
|
106
|
-
return val
|
|
107
|
-
}
|
|
108
|
-
target[key] = val
|
|
109
|
-
return val
|
|
110
|
-
}
|
|
111
|
-
VueDemi.del = function (target, key) {
|
|
112
|
-
if (Array.isArray(target)) {
|
|
113
|
-
target.splice(key, 1)
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
delete target[key]
|
|
117
|
-
}
|
|
118
|
-
} else {
|
|
119
|
-
console.error('[vue-demi] Vue version ' + Vue.version + ' is unsupported.')
|
|
120
|
-
}
|
|
121
|
-
return VueDemi
|
|
122
|
-
})(
|
|
123
|
-
(_VueDemiGlobal.VueDemi = _VueDemiGlobal.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
|
|
124
|
-
_VueDemiGlobal.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
|
|
125
|
-
_VueDemiGlobal.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
|
|
126
|
-
);
|
|
127
|
-
;
|
|
128
|
-
;(function (exports, shared, axios, vueDemi) {
|
|
1
|
+
(function (exports, shared, axios, vue) {
|
|
129
2
|
'use strict';
|
|
130
3
|
|
|
131
4
|
function useAxios(...args) {
|
|
@@ -161,12 +34,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
161
34
|
immediate,
|
|
162
35
|
resetOnExecute = false
|
|
163
36
|
} = options;
|
|
164
|
-
const response =
|
|
165
|
-
const data = (shallow ?
|
|
166
|
-
const isFinished =
|
|
167
|
-
const isLoading =
|
|
168
|
-
const isAborted =
|
|
169
|
-
const error =
|
|
37
|
+
const response = vue.shallowRef();
|
|
38
|
+
const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
|
|
39
|
+
const isFinished = vue.ref(false);
|
|
40
|
+
const isLoading = vue.ref(false);
|
|
41
|
+
const isAborted = vue.ref(false);
|
|
42
|
+
const error = vue.shallowRef();
|
|
170
43
|
let abortController = new AbortController();
|
|
171
44
|
const abort = (message) => {
|
|
172
45
|
if (isFinished.value || !isLoading.value)
|
|
@@ -248,4 +121,4 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
248
121
|
|
|
249
122
|
exports.useAxios = useAxios;
|
|
250
123
|
|
|
251
|
-
})(this.VueUse = this.VueUse || {}, VueUse, axios,
|
|
124
|
+
})(this.VueUse = this.VueUse || {}, VueUse, axios, Vue);
|
package/useAxios.iife.min.js
CHANGED
|
@@ -1 +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);
|
package/useAxios.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { noop, until } from '@vueuse/shared';
|
|
2
2
|
import axios, { AxiosError } from 'axios';
|
|
3
|
-
import { shallowRef, ref } from 'vue
|
|
3
|
+
import { shallowRef, ref } from 'vue';
|
|
4
4
|
|
|
5
5
|
function useAxios(...args) {
|
|
6
6
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
package/useChangeCase.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var shared = require('@vueuse/shared');
|
|
4
4
|
var changeCase = require('change-case');
|
|
5
|
-
var
|
|
5
|
+
var vue = require('vue');
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
var n = Object.create(null);
|
|
@@ -28,16 +28,16 @@ const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase__namespac
|
|
|
28
28
|
return acc;
|
|
29
29
|
}, {});
|
|
30
30
|
function useChangeCase(input, type, options) {
|
|
31
|
-
const typeRef =
|
|
31
|
+
const typeRef = vue.computed(() => {
|
|
32
32
|
const t = shared.toValue(type);
|
|
33
33
|
if (!changeCaseTransforms[t])
|
|
34
34
|
throw new Error(`Invalid change case type "${t}"`);
|
|
35
35
|
return t;
|
|
36
36
|
});
|
|
37
37
|
if (typeof input === "function")
|
|
38
|
-
return
|
|
39
|
-
const text =
|
|
40
|
-
return
|
|
38
|
+
return vue.computed(() => changeCaseTransforms[typeRef.value](shared.toValue(input), shared.toValue(options)));
|
|
39
|
+
const text = vue.ref(input);
|
|
40
|
+
return vue.computed({
|
|
41
41
|
get() {
|
|
42
42
|
return changeCaseTransforms[typeRef.value](text.value, shared.toValue(options));
|
|
43
43
|
},
|
package/useChangeCase.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared';
|
|
2
2
|
import * as changeCase from 'change-case';
|
|
3
3
|
import { Options } from 'change-case';
|
|
4
|
-
import { WritableComputedRef, ComputedRef } from 'vue
|
|
4
|
+
import { WritableComputedRef, ComputedRef } from 'vue';
|
|
5
5
|
|
|
6
6
|
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
|
7
7
|
type FilterKeys<T> = {
|
package/useChangeCase.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared';
|
|
2
2
|
import * as changeCase from 'change-case';
|
|
3
3
|
import { Options } from 'change-case';
|
|
4
|
-
import { WritableComputedRef, ComputedRef } from 'vue
|
|
4
|
+
import { WritableComputedRef, ComputedRef } from 'vue';
|
|
5
5
|
|
|
6
6
|
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
|
7
7
|
type FilterKeys<T> = {
|
package/useChangeCase.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared';
|
|
2
2
|
import * as changeCase from 'change-case';
|
|
3
3
|
import { Options } from 'change-case';
|
|
4
|
-
import { WritableComputedRef, ComputedRef } from 'vue
|
|
4
|
+
import { WritableComputedRef, ComputedRef } from 'vue';
|
|
5
5
|
|
|
6
6
|
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
|
7
7
|
type FilterKeys<T> = {
|