@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.
- package/index.cjs +46 -46
- package/index.d.cts +20 -14
- package/index.d.mts +20 -14
- package/index.d.ts +20 -14
- package/index.iife.js +46 -46
- package/index.iife.min.js +1 -1
- package/index.mjs +36 -36
- package/package.json +3 -3
- package/useAsyncValidator/component.cjs +1 -1
- package/useAsyncValidator/component.mjs +2 -2
- package/useAsyncValidator.cjs +3 -3
- package/useAsyncValidator.iife.js +3 -3
- package/useAsyncValidator.iife.min.js +1 -1
- package/useAsyncValidator.mjs +4 -4
- package/useAxios.cjs +6 -6
- package/useAxios.d.cts +19 -13
- package/useAxios.d.mts +19 -13
- package/useAxios.d.ts +19 -13
- package/useAxios.iife.js +6 -6
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +6 -6
- package/useChangeCase.cjs +3 -4
- package/useChangeCase.iife.js +5 -5
- package/useChangeCase.iife.min.js +1 -1
- package/useChangeCase.mjs +1 -2
- package/useDrauu.cjs +9 -9
- package/useDrauu.iife.js +9 -9
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +9 -9
- package/useFocusTrap.cjs +3 -3
- package/useFocusTrap.d.cts +1 -1
- package/useFocusTrap.d.mts +1 -1
- package/useFocusTrap.d.ts +1 -1
- package/useFocusTrap.iife.js +3 -3
- package/useFocusTrap.iife.min.js +1 -1
- package/useFocusTrap.mjs +4 -4
- package/useFuse.cjs +9 -10
- package/useFuse.iife.js +11 -11
- package/useFuse.iife.min.js +1 -1
- package/useFuse.mjs +6 -7
- package/useIDBKeyval.cjs +1 -2
- package/useIDBKeyval.iife.js +3 -3
- package/useIDBKeyval.iife.min.js +1 -1
- package/useIDBKeyval.mjs +1 -2
- package/useJwt.cjs +3 -4
- package/useJwt.iife.js +5 -5
- package/useJwt.iife.min.js +1 -1
- package/useJwt.mjs +2 -3
- package/useNProgress.cjs +1 -1
- package/useNProgress.d.cts +1 -1
- package/useNProgress.d.mts +1 -1
- package/useNProgress.d.ts +1 -1
- package/useNProgress.iife.js +1 -1
- package/useNProgress.iife.min.js +1 -1
- package/useNProgress.mjs +3 -3
- package/useSortable/component.cjs +4 -4
- package/useSortable/component.mjs +5 -5
- package/useSortable.cjs +8 -8
- package/useSortable.iife.js +8 -8
- package/useSortable.iife.min.js +1 -1
- package/useSortable.mjs +9 -9
package/index.iife.js
CHANGED
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
const pass = vue.ref(!immediate || manual);
|
|
34
34
|
const errors = vue.computed(() => {
|
|
35
35
|
var _a;
|
|
36
|
-
return ((_a = errorInfo.value) == null ?
|
|
36
|
+
return ((_a = errorInfo.value) == null ? undefined : _a.errors) || [];
|
|
37
37
|
});
|
|
38
38
|
const errorFields = vue.computed(() => {
|
|
39
39
|
var _a;
|
|
40
|
-
return ((_a = errorInfo.value) == null ?
|
|
40
|
+
return ((_a = errorInfo.value) == null ? undefined : _a.fields) || {};
|
|
41
41
|
});
|
|
42
|
-
const validator = vue.computed(() => new AsyncValidatorSchema(
|
|
42
|
+
const validator = vue.computed(() => new AsyncValidatorSchema(vue.toValue(rules)));
|
|
43
43
|
const execute = async () => {
|
|
44
44
|
isFinished.value = false;
|
|
45
45
|
pass.value = false;
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function useAxios(...args) {
|
|
91
|
-
const url = typeof args[0] === "string" ? args[0] :
|
|
91
|
+
const url = typeof args[0] === "string" ? args[0] : undefined;
|
|
92
92
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
93
93
|
const defaultOptions = {
|
|
94
94
|
immediate: !!argsPlaceholder,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
let defaultConfig = {};
|
|
99
99
|
let instance = axios;
|
|
100
100
|
let options = defaultOptions;
|
|
101
|
-
const isAxiosInstance = (val) => !!(val == null ?
|
|
101
|
+
const isAxiosInstance = (val) => !!(val == null ? undefined : val.request);
|
|
102
102
|
if (args.length > 0 + argsPlaceholder) {
|
|
103
103
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
104
104
|
instance = args[0 + argsPlaceholder];
|
|
@@ -113,13 +113,13 @@
|
|
|
113
113
|
options = args[args.length - 1] || defaultOptions;
|
|
114
114
|
}
|
|
115
115
|
const {
|
|
116
|
-
initialData,
|
|
117
116
|
shallow,
|
|
118
117
|
onSuccess = shared.noop,
|
|
119
118
|
onError = shared.noop,
|
|
120
119
|
immediate,
|
|
121
120
|
resetOnExecute = false
|
|
122
121
|
} = options;
|
|
122
|
+
const initialData = options.initialData;
|
|
123
123
|
const response = vue.shallowRef();
|
|
124
124
|
const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
|
|
125
125
|
const isFinished = vue.ref(false);
|
|
@@ -153,9 +153,9 @@
|
|
|
153
153
|
};
|
|
154
154
|
let executeCounter = 0;
|
|
155
155
|
const execute = (executeUrl = url, config = {}) => {
|
|
156
|
-
error.value =
|
|
156
|
+
error.value = undefined;
|
|
157
157
|
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
|
158
|
-
if (_url ===
|
|
158
|
+
if (_url === undefined) {
|
|
159
159
|
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
|
160
160
|
isFinished.value = true;
|
|
161
161
|
return promise;
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
onError(e);
|
|
180
180
|
}).finally(() => {
|
|
181
181
|
var _a;
|
|
182
|
-
(_a = options.onFinish) == null ?
|
|
182
|
+
(_a = options.onFinish) == null ? undefined : _a.call(options);
|
|
183
183
|
if (currentExecuteCounter === executeCounter)
|
|
184
184
|
loading(false);
|
|
185
185
|
});
|
|
@@ -211,17 +211,17 @@
|
|
|
211
211
|
}, {});
|
|
212
212
|
function useChangeCase(input, type, options) {
|
|
213
213
|
const typeRef = vue.computed(() => {
|
|
214
|
-
const t =
|
|
214
|
+
const t = vue.toValue(type);
|
|
215
215
|
if (!changeCaseTransforms[t])
|
|
216
216
|
throw new Error(`Invalid change case type "${t}"`);
|
|
217
217
|
return t;
|
|
218
218
|
});
|
|
219
219
|
if (typeof input === "function")
|
|
220
|
-
return vue.computed(() => changeCaseTransforms[typeRef.value](
|
|
220
|
+
return vue.computed(() => changeCaseTransforms[typeRef.value](vue.toValue(input), vue.toValue(options)));
|
|
221
221
|
const text = vue.ref(input);
|
|
222
222
|
return vue.computed({
|
|
223
223
|
get() {
|
|
224
|
-
return changeCaseTransforms[typeRef.value](text.value,
|
|
224
|
+
return changeCaseTransforms[typeRef.value](text.value, vue.toValue(options));
|
|
225
225
|
},
|
|
226
226
|
set(value) {
|
|
227
227
|
text.value = value;
|
|
@@ -302,10 +302,10 @@
|
|
|
302
302
|
size: 3,
|
|
303
303
|
arrowEnd: false,
|
|
304
304
|
cornerRadius: 0,
|
|
305
|
-
dasharray:
|
|
305
|
+
dasharray: undefined,
|
|
306
306
|
fill: "transparent",
|
|
307
307
|
mode: "draw",
|
|
308
|
-
...options == null ?
|
|
308
|
+
...options == null ? undefined : options.brush
|
|
309
309
|
});
|
|
310
310
|
vue.watch(brush, () => {
|
|
311
311
|
const instance = drauuInstance.value;
|
|
@@ -316,32 +316,32 @@
|
|
|
316
316
|
}, { deep: true });
|
|
317
317
|
const undo = () => {
|
|
318
318
|
var _a;
|
|
319
|
-
return (_a = drauuInstance.value) == null ?
|
|
319
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.undo();
|
|
320
320
|
};
|
|
321
321
|
const redo = () => {
|
|
322
322
|
var _a;
|
|
323
|
-
return (_a = drauuInstance.value) == null ?
|
|
323
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.redo();
|
|
324
324
|
};
|
|
325
325
|
const clear = () => {
|
|
326
326
|
var _a;
|
|
327
|
-
return (_a = drauuInstance.value) == null ?
|
|
327
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.clear();
|
|
328
328
|
};
|
|
329
329
|
const cancel = () => {
|
|
330
330
|
var _a;
|
|
331
|
-
return (_a = drauuInstance.value) == null ?
|
|
331
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.cancel();
|
|
332
332
|
};
|
|
333
333
|
const load = (svg) => {
|
|
334
334
|
var _a;
|
|
335
|
-
return (_a = drauuInstance.value) == null ?
|
|
335
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.load(svg);
|
|
336
336
|
};
|
|
337
337
|
const dump = () => {
|
|
338
338
|
var _a;
|
|
339
|
-
return (_a = drauuInstance.value) == null ?
|
|
339
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.dump();
|
|
340
340
|
};
|
|
341
341
|
const cleanup = () => {
|
|
342
342
|
var _a;
|
|
343
343
|
disposables.forEach((dispose) => dispose());
|
|
344
|
-
(_a = drauuInstance.value) == null ?
|
|
344
|
+
(_a = drauuInstance.value) == null ? undefined : _a.unmount();
|
|
345
345
|
};
|
|
346
346
|
const syncStatus = () => {
|
|
347
347
|
if (drauuInstance.value) {
|
|
@@ -413,9 +413,9 @@
|
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
415
|
const targets = vue.computed(() => {
|
|
416
|
-
const _targets =
|
|
417
|
-
return
|
|
418
|
-
const _el =
|
|
416
|
+
const _targets = vue.toValue(target);
|
|
417
|
+
return core.toArray(_targets).map((el) => {
|
|
418
|
+
const _el = vue.toValue(el);
|
|
419
419
|
return typeof _el === "string" ? _el : core.unrefElement(_el);
|
|
420
420
|
}).filter(shared.notNullish);
|
|
421
421
|
});
|
|
@@ -457,15 +457,15 @@
|
|
|
457
457
|
const createFuse = () => {
|
|
458
458
|
var _a, _b;
|
|
459
459
|
return new Fuse(
|
|
460
|
-
(_a =
|
|
461
|
-
(_b =
|
|
460
|
+
(_a = vue.toValue(data)) != null ? _a : [],
|
|
461
|
+
(_b = vue.toValue(options)) == null ? undefined : _b.fuseOptions
|
|
462
462
|
);
|
|
463
463
|
};
|
|
464
464
|
const fuse = vue.ref(createFuse());
|
|
465
465
|
vue.watch(
|
|
466
466
|
() => {
|
|
467
467
|
var _a;
|
|
468
|
-
return (_a =
|
|
468
|
+
return (_a = vue.toValue(options)) == null ? undefined : _a.fuseOptions;
|
|
469
469
|
},
|
|
470
470
|
() => {
|
|
471
471
|
fuse.value = createFuse();
|
|
@@ -473,18 +473,18 @@
|
|
|
473
473
|
{ deep: true }
|
|
474
474
|
);
|
|
475
475
|
vue.watch(
|
|
476
|
-
() =>
|
|
476
|
+
() => vue.toValue(data),
|
|
477
477
|
(newData) => {
|
|
478
478
|
fuse.value.setCollection(newData);
|
|
479
479
|
},
|
|
480
480
|
{ deep: true }
|
|
481
481
|
);
|
|
482
482
|
const results = vue.computed(() => {
|
|
483
|
-
const resolved =
|
|
484
|
-
if ((resolved == null ?
|
|
485
|
-
return
|
|
486
|
-
const limit = resolved == null ?
|
|
487
|
-
return fuse.value.search(
|
|
483
|
+
const resolved = vue.toValue(options);
|
|
484
|
+
if ((resolved == null ? undefined : resolved.matchAllWhenSearchEmpty) && !vue.toValue(search))
|
|
485
|
+
return vue.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
486
|
+
const limit = resolved == null ? undefined : resolved.resultLimit;
|
|
487
|
+
return fuse.value.search(vue.toValue(search), limit ? { limit } : undefined);
|
|
488
488
|
});
|
|
489
489
|
return {
|
|
490
490
|
fuse,
|
|
@@ -504,7 +504,7 @@
|
|
|
504
504
|
} = options;
|
|
505
505
|
const isFinished = vue.ref(false);
|
|
506
506
|
const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
|
|
507
|
-
const rawInit =
|
|
507
|
+
const rawInit = vue.toValue(initialValue);
|
|
508
508
|
async function read() {
|
|
509
509
|
try {
|
|
510
510
|
const rawValue = await idbKeyval.get(key);
|
|
@@ -557,12 +557,12 @@
|
|
|
557
557
|
try {
|
|
558
558
|
return jwtDecode.jwtDecode(encodedJwt2, options2);
|
|
559
559
|
} catch (err) {
|
|
560
|
-
onError == null ?
|
|
560
|
+
onError == null ? undefined : onError(err);
|
|
561
561
|
return fallbackValue;
|
|
562
562
|
}
|
|
563
563
|
};
|
|
564
|
-
const header = vue.computed(() => decodeWithFallback(
|
|
565
|
-
const payload = vue.computed(() => decodeWithFallback(
|
|
564
|
+
const header = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt), { header: true }));
|
|
565
|
+
const payload = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt)));
|
|
566
566
|
return {
|
|
567
567
|
header,
|
|
568
568
|
payload
|
|
@@ -570,7 +570,7 @@
|
|
|
570
570
|
}
|
|
571
571
|
|
|
572
572
|
function useNProgress(currentProgress = null, options) {
|
|
573
|
-
const progress =
|
|
573
|
+
const progress = shared.toRef(currentProgress);
|
|
574
574
|
const isLoading = vue.computed({
|
|
575
575
|
set: (load) => load ? nprogress.start() : nprogress.done(),
|
|
576
576
|
get: () => typeof progress.value === "number" && progress.value < 1
|
|
@@ -622,20 +622,20 @@
|
|
|
622
622
|
}
|
|
623
623
|
};
|
|
624
624
|
const start = () => {
|
|
625
|
-
const target = typeof el === "string" ? document == null ?
|
|
626
|
-
if (!target || sortable !==
|
|
625
|
+
const target = typeof el === "string" ? document == null ? undefined : document.querySelector(el) : core.unrefElement(el);
|
|
626
|
+
if (!target || sortable !== undefined)
|
|
627
627
|
return;
|
|
628
628
|
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
|
629
629
|
};
|
|
630
630
|
const stop = () => {
|
|
631
|
-
sortable == null ?
|
|
632
|
-
sortable =
|
|
631
|
+
sortable == null ? undefined : sortable.destroy();
|
|
632
|
+
sortable = undefined;
|
|
633
633
|
};
|
|
634
634
|
const option = (name, value) => {
|
|
635
|
-
if (value !==
|
|
636
|
-
sortable == null ?
|
|
635
|
+
if (value !== undefined)
|
|
636
|
+
sortable == null ? undefined : sortable.option(name, value);
|
|
637
637
|
else
|
|
638
|
-
return sortable == null ?
|
|
638
|
+
return sortable == null ? undefined : sortable.option(name);
|
|
639
639
|
};
|
|
640
640
|
core.tryOnMounted(start);
|
|
641
641
|
core.tryOnScopeDispose(stop);
|
|
@@ -659,7 +659,7 @@
|
|
|
659
659
|
insertNodeAt(e.from, e.item, from);
|
|
660
660
|
}
|
|
661
661
|
const _valueIsRef = vue.isRef(list);
|
|
662
|
-
const array = _valueIsRef ? [...
|
|
662
|
+
const array = _valueIsRef ? [...vue.toValue(list)] : vue.toValue(list);
|
|
663
663
|
if (to >= 0 && to < array.length) {
|
|
664
664
|
const element = array.splice(from, 1)[0];
|
|
665
665
|
vue.nextTick(() => {
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(p,C,U,n,L,$,k,w,K,X,Y,P,Z,b,x,ee){"use strict";function te(t){var l=Object.create(null);return t&&Object.keys(t).forEach(function(e){if(e!=="default"){var a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(l,e,a.get?a:{enumerable:!0,get:function(){return t[e]}})}}),l.default=t,Object.freeze(l)}var ne=te($);const ae=U.default||U;function le(t,l,e={}){const{validateOption:a={},immediate:u=!0,manual:r=!1}=e,o=C.toRef(t),c=n.shallowRef(null),s=n.ref(!0),d=n.ref(!u||r),h=n.computed(()=>{var i;return((i=c.value)==null?void 0:i.errors)||[]}),g=n.computed(()=>{var i;return((i=c.value)==null?void 0:i.fields)||{}}),m=n.computed(()=>new ae(n.toValue(l))),y=async()=>{s.value=!1,d.value=!1;try{await m.value.validate(o.value,a),d.value=!0,c.value=null}catch(i){c.value=i}finally{s.value=!0}return{pass:d.value,errorInfo:c.value,errors:h.value,errorFields:g.value}};r||n.watch([o,m],()=>y(),{immediate:u,deep:!0});const V={isFinished:s,pass:d,errors:h,errorInfo:c,errorFields:g,execute:y};function A(){return new Promise((i,E)=>{C.until(s).toBe(!0).then(()=>i(V)).catch(D=>E(D))})}return{...V,then(i,E){return A().then(i,E)}}}function oe(...t){const l=typeof t[0]=="string"?t[0]:void 0,e=typeof l=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let u={},r=L,o=a;const c=v=>!!v?.request;t.length>0+e&&(c(t[0+e])?r=t[0+e]:u=t[0+e]),t.length>1+e&&c(t[1+e])&&(r=t[1+e]),(t.length===2+e&&!c(t[1+e])||t.length===3+e)&&(o=t[t.length-1]||a);const{shallow:s,onSuccess:d=C.noop,onError:h=C.noop,immediate:g,resetOnExecute:m=!1}=o,y=o.initialData,V=n.shallowRef(),A=(s?n.shallowRef:n.ref)(y),i=n.ref(!1),E=n.ref(!1),D=n.ref(!1),R=n.shallowRef();let S=new AbortController;const F=v=>{i.value||!E.value||(S.abort(v),S=new AbortController,D.value=!0,E.value=!1,i.value=!1)},f=v=>{E.value=v,i.value=!v},_=()=>{m&&(A.value=y)},Q=()=>new Promise((v,I)=>{C.until(i).toBe(!0).then(()=>R.value?I(R.value):v(q))}),H={then:(...v)=>Q().then(...v),catch:(...v)=>Q().catch(...v)};let j=0;const z=(v=l,I={})=>{R.value=void 0;const J=typeof v=="string"?v:l??I.url;if(J===void 0)return R.value=new L.AxiosError(L.AxiosError.ERR_INVALID_URL),i.value=!0,H;_(),o.abortPrevious!==!1&&F(),f(!0),j+=1;const we=j;return D.value=!1,r(J,{...u,...typeof v=="object"?v:I,signal:S.signal}).then(O=>{if(D.value)return;V.value=O;const M=O.data;A.value=M,d(M)}).catch(O=>{R.value=O,h(O)}).finally(()=>{var O;(O=o.onFinish)==null||O.call(o),we===j&&f(!1)}),H};g&&l&&z();const q={response:V,data:A,error:R,isFinished:i,isLoading:E,cancel:F,isAborted:D,isCanceled:D,abort:F,execute:z};return{...q,...H}}const N=Object.entries(ne).filter(([t,l])=>typeof l=="function"&&t.endsWith("Case")).reduce((t,[l,e])=>(t[l]=e,t),{});function ue(t,l,e){const a=n.computed(()=>{const r=n.toValue(l);if(!N[r])throw new Error(`Invalid change case type "${r}"`);return r});if(typeof t=="function")return n.computed(()=>N[a.value](n.toValue(t),n.toValue(e)));const u=n.ref(t);return n.computed({get(){return N[a.value](u.value,n.toValue(e))},set(r){u.value=r}})}function re(t){const l=new k(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:u=!1}={})=>T(e,{doNotParse:a,autoUpdateDependencies:u},l)}function T(t,{doNotParse:l=!1,autoUpdateDependencies:e=!1}={},a=new k){const u=e?[...t||[]]:t;let r=a.getAll({doNotParse:!0});const o=n.ref(0),c=()=>{const s=a.getAll({doNotParse:!0});se(u||null,s,r)&&o.value++,r=s};return a.addChangeListener(c),C.tryOnScopeDispose(()=>{a.removeChangeListener(c)}),{get:(...s)=>(e&&u&&!u.includes(s[0])&&u.push(s[0]),o.value,a.get(s[0],{doNotParse:l,...s[1]})),getAll:(...s)=>(o.value,a.getAll({doNotParse:l,...s[0]})),set:(...s)=>a.set(...s),remove:(...s)=>a.remove(...s),addChangeListener:(...s)=>a.addChangeListener(...s),removeChangeListener:(...s)=>a.removeChangeListener(...s)}}function se(t,l,e){if(!t)return!0;for(const a of t)if(l[a]!==e[a])return!0;return!1}function ce(t,l){const e=n.ref();let a=[];const u=w.createEventHook(),r=w.createEventHook(),o=w.createEventHook(),c=w.createEventHook(),s=w.createEventHook(),d=n.ref(!1),h=n.ref(!1),g=n.ref(!1),m=n.ref(!1),y=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...l?.brush});n.watch(y,()=>{const f=e.value;f&&(f.brush=y.value,f.mode=y.value.mode)},{deep:!0});const V=()=>{var f;return(f=e.value)==null?void 0:f.undo()},A=()=>{var f;return(f=e.value)==null?void 0:f.redo()},i=()=>{var f;return(f=e.value)==null?void 0:f.clear()},E=()=>{var f;return(f=e.value)==null?void 0:f.cancel()},D=f=>{var _;return(_=e.value)==null?void 0:_.load(f)},R=()=>{var f;return(f=e.value)==null?void 0:f.dump()},S=()=>{var f;a.forEach(_=>_()),(f=e.value)==null||f.unmount()},F=()=>{e.value&&(d.value=e.value.canUndo(),h.value=e.value.canRedo(),g.value=e.value.altPressed,m.value=e.value.shiftPressed)};return n.watch(()=>w.unrefElement(t),f=>{!f||typeof SVGSVGElement>"u"||!(f instanceof SVGSVGElement)||(e.value&&S(),e.value=K.createDrauu({el:f,...l}),F(),a=[e.value.on("canceled",()=>r.trigger()),e.value.on("committed",_=>o.trigger(_)),e.value.on("start",()=>c.trigger()),e.value.on("end",()=>s.trigger()),e.value.on("changed",()=>{F(),u.trigger()})])},{flush:"post"}),C.tryOnScopeDispose(()=>S()),{drauuInstance:e,load:D,dump:R,clear:i,cancel:E,undo:V,redo:A,canUndo:d,canRedo:h,brush:y,onChanged:u.on,onCommitted:o.on,onStart:c.on,onEnd:s.on,onCanceled:r.on}}function ie(t,l={}){let e;const{immediate:a,...u}=l,r=n.ref(!1),o=n.ref(!1),c=m=>e&&e.activate(m),s=m=>e&&e.deactivate(m),d=()=>{e&&(e.pause(),o.value=!0)},h=()=>{e&&(e.unpause(),o.value=!1)},g=n.computed(()=>{const m=n.toValue(t);return w.toArray(m).map(y=>{const V=n.toValue(y);return typeof V=="string"?V:w.unrefElement(V)}).filter(C.notNullish)});return n.watch(g,m=>{m.length&&(e=X.createFocusTrap(m,{...u,onActivate(){r.value=!0,l.onActivate&&l.onActivate()},onDeactivate(){r.value=!1,l.onDeactivate&&l.onDeactivate()}}),a&&c())},{flush:"post"}),w.tryOnScopeDispose(()=>s()),{hasFocus:r,isPaused:o,activate:c,deactivate:s,pause:d,unpause:h}}function fe(t,l,e){const a=()=>{var o,c;return new Y((o=n.toValue(l))!=null?o:[],(c=n.toValue(e))==null?void 0:c.fuseOptions)},u=n.ref(a());n.watch(()=>{var o;return(o=n.toValue(e))==null?void 0:o.fuseOptions},()=>{u.value=a()},{deep:!0}),n.watch(()=>n.toValue(l),o=>{u.value.setCollection(o)},{deep:!0});const r=n.computed(()=>{const o=n.toValue(e);if(o?.matchAllWhenSearchEmpty&&!n.toValue(t))return n.toValue(l).map((s,d)=>({item:s,refIndex:d}));const c=o?.resultLimit;return u.value.search(n.toValue(t),c?{limit:c}:void 0)});return{fuse:u,results:r}}function de(t,l,e={}){const{flush:a="pre",deep:u=!0,shallow:r=!1,onError:o=i=>{console.error(i)},writeDefaults:c=!0}=e,s=n.ref(!1),d=(r?n.shallowRef:n.ref)(l),h=n.toValue(l);async function g(){try{const i=await P.get(t);i===void 0?h!=null&&c&&await P.set(t,h):d.value=i}catch(i){o(i)}s.value=!0}g();async function m(){try{d.value==null?await P.del(t):await P.update(t,()=>n.toRaw(d.value))}catch(i){o(i)}}const{pause:y,resume:V}=w.watchPausable(d,()=>m(),{flush:a,deep:u});async function A(i){y(),d.value=i,await m(),V()}return{set:A,isFinished:s,data:d}}function he(t,l={}){const{onError:e,fallbackValue:a=null}=l,u=(c,s)=>{try{return Z.jwtDecode(c,s)}catch(d){return e?.(d),a}},r=n.computed(()=>u(n.toValue(t),{header:!0})),o=n.computed(()=>u(n.toValue(t)));return{header:r,payload:o}}function me(t=null,l){const e=C.toRef(t),a=n.computed({set:r=>r?b.start():b.done(),get:()=>typeof e.value=="number"&&e.value<1});l&&b.configure(l);const u=b.set;return b.set=r=>(e.value=r,u.call(b,r)),n.watchEffect(()=>{typeof e.value=="number"&&C.isClient&&u.call(b,e.value)}),C.tryOnScopeDispose(b.remove),{isLoading:a,progress:e,start:b.start,done:b.done,remove:()=>{e.value=null,b.remove()}}}function ve(t,l){const e=C.toRef(t),a=n.ref("");return n.watch(e,async u=>{e.value&&C.isClient&&(a.value=await x.toDataURL(u,l))},{immediate:!0}),a}function pe(t,l,e={}){let a;const{document:u=w.defaultDocument,...r}=e,o={onUpdate:h=>{G(l,h.oldIndex,h.newIndex,h)}},c=()=>{const h=typeof t=="string"?u?.querySelector(t):w.unrefElement(t);!h||a!==void 0||(a=new ee(h,{...o,...r}))},s=()=>{a?.destroy(),a=void 0},d=(h,g)=>{if(g!==void 0)a?.option(h,g);else return a?.option(h)};return w.tryOnMounted(c),w.tryOnScopeDispose(s),{stop:s,start:c,option:d}}function B(t,l,e){const a=t.children[e];t.insertBefore(l,a)}function W(t){t.parentNode&&t.parentNode.removeChild(t)}function G(t,l,e,a=null){a!=null&&(W(a.item),B(a.from,a.item,l));const u=n.isRef(t),r=u?[...n.toValue(t)]:n.toValue(t);if(e>=0&&e<r.length){const o=r.splice(l,1)[0];n.nextTick(()=>{r.splice(e,0,o),u&&(t.value=r)})}}p.createCookies=re,p.insertNodeAt=B,p.moveArrayElement=G,p.removeNode=W,p.useAsyncValidator=le,p.useAxios=oe,p.useChangeCase=ue,p.useCookies=T,p.useDrauu=ce,p.useFocusTrap=ie,p.useFuse=fe,p.useIDBKeyval=de,p.useJwt=he,p.useNProgress=me,p.useQRCode=ve,p.useSortable=pe})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue,axios,changeCase,UniversalCookie,VueUse,Drauu,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
|
package/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { toRef,
|
|
1
|
+
import { toRef, until, noop, tryOnScopeDispose, notNullish, isClient } from '@vueuse/shared';
|
|
2
2
|
import Schema from 'async-validator';
|
|
3
|
-
import { shallowRef, ref, computed, watch, toRaw, watchEffect, isRef, nextTick } from 'vue';
|
|
3
|
+
import { shallowRef, ref, computed, toValue, watch, toRaw, watchEffect, isRef, nextTick } from 'vue';
|
|
4
4
|
import axios, { AxiosError } from 'axios';
|
|
5
5
|
import * as changeCase from 'change-case';
|
|
6
6
|
import Cookie from 'universal-cookie';
|
|
7
|
-
import { createEventHook, unrefElement, tryOnScopeDispose as tryOnScopeDispose$1, watchPausable, tryOnMounted,
|
|
7
|
+
import { createEventHook, unrefElement, toArray, tryOnScopeDispose as tryOnScopeDispose$1, watchPausable, tryOnMounted, defaultDocument } from '@vueuse/core';
|
|
8
8
|
import { createDrauu } from 'drauu';
|
|
9
9
|
import { createFocusTrap } from 'focus-trap';
|
|
10
10
|
import Fuse from 'fuse.js';
|
|
@@ -27,11 +27,11 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
27
27
|
const pass = ref(!immediate || manual);
|
|
28
28
|
const errors = computed(() => {
|
|
29
29
|
var _a;
|
|
30
|
-
return ((_a = errorInfo.value) == null ?
|
|
30
|
+
return ((_a = errorInfo.value) == null ? undefined : _a.errors) || [];
|
|
31
31
|
});
|
|
32
32
|
const errorFields = computed(() => {
|
|
33
33
|
var _a;
|
|
34
|
-
return ((_a = errorInfo.value) == null ?
|
|
34
|
+
return ((_a = errorInfo.value) == null ? undefined : _a.fields) || {};
|
|
35
35
|
});
|
|
36
36
|
const validator = computed(() => new AsyncValidatorSchema(toValue(rules)));
|
|
37
37
|
const execute = async () => {
|
|
@@ -82,7 +82,7 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function useAxios(...args) {
|
|
85
|
-
const url = typeof args[0] === "string" ? args[0] :
|
|
85
|
+
const url = typeof args[0] === "string" ? args[0] : undefined;
|
|
86
86
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
87
87
|
const defaultOptions = {
|
|
88
88
|
immediate: !!argsPlaceholder,
|
|
@@ -92,7 +92,7 @@ function useAxios(...args) {
|
|
|
92
92
|
let defaultConfig = {};
|
|
93
93
|
let instance = axios;
|
|
94
94
|
let options = defaultOptions;
|
|
95
|
-
const isAxiosInstance = (val) => !!(val == null ?
|
|
95
|
+
const isAxiosInstance = (val) => !!(val == null ? undefined : val.request);
|
|
96
96
|
if (args.length > 0 + argsPlaceholder) {
|
|
97
97
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
98
98
|
instance = args[0 + argsPlaceholder];
|
|
@@ -107,13 +107,13 @@ function useAxios(...args) {
|
|
|
107
107
|
options = args[args.length - 1] || defaultOptions;
|
|
108
108
|
}
|
|
109
109
|
const {
|
|
110
|
-
initialData,
|
|
111
110
|
shallow,
|
|
112
111
|
onSuccess = noop,
|
|
113
112
|
onError = noop,
|
|
114
113
|
immediate,
|
|
115
114
|
resetOnExecute = false
|
|
116
115
|
} = options;
|
|
116
|
+
const initialData = options.initialData;
|
|
117
117
|
const response = shallowRef();
|
|
118
118
|
const data = (shallow ? shallowRef : ref)(initialData);
|
|
119
119
|
const isFinished = ref(false);
|
|
@@ -147,9 +147,9 @@ function useAxios(...args) {
|
|
|
147
147
|
};
|
|
148
148
|
let executeCounter = 0;
|
|
149
149
|
const execute = (executeUrl = url, config = {}) => {
|
|
150
|
-
error.value =
|
|
150
|
+
error.value = undefined;
|
|
151
151
|
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
|
152
|
-
if (_url ===
|
|
152
|
+
if (_url === undefined) {
|
|
153
153
|
error.value = new AxiosError(AxiosError.ERR_INVALID_URL);
|
|
154
154
|
isFinished.value = true;
|
|
155
155
|
return promise;
|
|
@@ -173,7 +173,7 @@ function useAxios(...args) {
|
|
|
173
173
|
onError(e);
|
|
174
174
|
}).finally(() => {
|
|
175
175
|
var _a;
|
|
176
|
-
(_a = options.onFinish) == null ?
|
|
176
|
+
(_a = options.onFinish) == null ? undefined : _a.call(options);
|
|
177
177
|
if (currentExecuteCounter === executeCounter)
|
|
178
178
|
loading(false);
|
|
179
179
|
});
|
|
@@ -296,10 +296,10 @@ function useDrauu(target, options) {
|
|
|
296
296
|
size: 3,
|
|
297
297
|
arrowEnd: false,
|
|
298
298
|
cornerRadius: 0,
|
|
299
|
-
dasharray:
|
|
299
|
+
dasharray: undefined,
|
|
300
300
|
fill: "transparent",
|
|
301
301
|
mode: "draw",
|
|
302
|
-
...options == null ?
|
|
302
|
+
...options == null ? undefined : options.brush
|
|
303
303
|
});
|
|
304
304
|
watch(brush, () => {
|
|
305
305
|
const instance = drauuInstance.value;
|
|
@@ -310,32 +310,32 @@ function useDrauu(target, options) {
|
|
|
310
310
|
}, { deep: true });
|
|
311
311
|
const undo = () => {
|
|
312
312
|
var _a;
|
|
313
|
-
return (_a = drauuInstance.value) == null ?
|
|
313
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.undo();
|
|
314
314
|
};
|
|
315
315
|
const redo = () => {
|
|
316
316
|
var _a;
|
|
317
|
-
return (_a = drauuInstance.value) == null ?
|
|
317
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.redo();
|
|
318
318
|
};
|
|
319
319
|
const clear = () => {
|
|
320
320
|
var _a;
|
|
321
|
-
return (_a = drauuInstance.value) == null ?
|
|
321
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.clear();
|
|
322
322
|
};
|
|
323
323
|
const cancel = () => {
|
|
324
324
|
var _a;
|
|
325
|
-
return (_a = drauuInstance.value) == null ?
|
|
325
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.cancel();
|
|
326
326
|
};
|
|
327
327
|
const load = (svg) => {
|
|
328
328
|
var _a;
|
|
329
|
-
return (_a = drauuInstance.value) == null ?
|
|
329
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.load(svg);
|
|
330
330
|
};
|
|
331
331
|
const dump = () => {
|
|
332
332
|
var _a;
|
|
333
|
-
return (_a = drauuInstance.value) == null ?
|
|
333
|
+
return (_a = drauuInstance.value) == null ? undefined : _a.dump();
|
|
334
334
|
};
|
|
335
335
|
const cleanup = () => {
|
|
336
336
|
var _a;
|
|
337
337
|
disposables.forEach((dispose) => dispose());
|
|
338
|
-
(_a = drauuInstance.value) == null ?
|
|
338
|
+
(_a = drauuInstance.value) == null ? undefined : _a.unmount();
|
|
339
339
|
};
|
|
340
340
|
const syncStatus = () => {
|
|
341
341
|
if (drauuInstance.value) {
|
|
@@ -408,7 +408,7 @@ function useFocusTrap(target, options = {}) {
|
|
|
408
408
|
};
|
|
409
409
|
const targets = computed(() => {
|
|
410
410
|
const _targets = toValue(target);
|
|
411
|
-
return (
|
|
411
|
+
return toArray(_targets).map((el) => {
|
|
412
412
|
const _el = toValue(el);
|
|
413
413
|
return typeof _el === "string" ? _el : unrefElement(_el);
|
|
414
414
|
}).filter(notNullish);
|
|
@@ -452,14 +452,14 @@ function useFuse(search, data, options) {
|
|
|
452
452
|
var _a, _b;
|
|
453
453
|
return new Fuse(
|
|
454
454
|
(_a = toValue(data)) != null ? _a : [],
|
|
455
|
-
(_b = toValue(options)) == null ?
|
|
455
|
+
(_b = toValue(options)) == null ? undefined : _b.fuseOptions
|
|
456
456
|
);
|
|
457
457
|
};
|
|
458
458
|
const fuse = ref(createFuse());
|
|
459
459
|
watch(
|
|
460
460
|
() => {
|
|
461
461
|
var _a;
|
|
462
|
-
return (_a = toValue(options)) == null ?
|
|
462
|
+
return (_a = toValue(options)) == null ? undefined : _a.fuseOptions;
|
|
463
463
|
},
|
|
464
464
|
() => {
|
|
465
465
|
fuse.value = createFuse();
|
|
@@ -475,10 +475,10 @@ function useFuse(search, data, options) {
|
|
|
475
475
|
);
|
|
476
476
|
const results = computed(() => {
|
|
477
477
|
const resolved = toValue(options);
|
|
478
|
-
if ((resolved == null ?
|
|
478
|
+
if ((resolved == null ? undefined : resolved.matchAllWhenSearchEmpty) && !toValue(search))
|
|
479
479
|
return toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
480
|
-
const limit = resolved == null ?
|
|
481
|
-
return fuse.value.search(toValue(search), limit ? { limit } :
|
|
480
|
+
const limit = resolved == null ? undefined : resolved.resultLimit;
|
|
481
|
+
return fuse.value.search(toValue(search), limit ? { limit } : undefined);
|
|
482
482
|
});
|
|
483
483
|
return {
|
|
484
484
|
fuse,
|
|
@@ -551,7 +551,7 @@ function useJwt(encodedJwt, options = {}) {
|
|
|
551
551
|
try {
|
|
552
552
|
return jwtDecode(encodedJwt2, options2);
|
|
553
553
|
} catch (err) {
|
|
554
|
-
onError == null ?
|
|
554
|
+
onError == null ? undefined : onError(err);
|
|
555
555
|
return fallbackValue;
|
|
556
556
|
}
|
|
557
557
|
};
|
|
@@ -564,7 +564,7 @@ function useJwt(encodedJwt, options = {}) {
|
|
|
564
564
|
}
|
|
565
565
|
|
|
566
566
|
function useNProgress(currentProgress = null, options) {
|
|
567
|
-
const progress =
|
|
567
|
+
const progress = toRef(currentProgress);
|
|
568
568
|
const isLoading = computed({
|
|
569
569
|
set: (load) => load ? nprogress.start() : nprogress.done(),
|
|
570
570
|
get: () => typeof progress.value === "number" && progress.value < 1
|
|
@@ -616,20 +616,20 @@ function useSortable(el, list, options = {}) {
|
|
|
616
616
|
}
|
|
617
617
|
};
|
|
618
618
|
const start = () => {
|
|
619
|
-
const target = typeof el === "string" ? document == null ?
|
|
620
|
-
if (!target || sortable !==
|
|
619
|
+
const target = typeof el === "string" ? document == null ? undefined : document.querySelector(el) : unrefElement(el);
|
|
620
|
+
if (!target || sortable !== undefined)
|
|
621
621
|
return;
|
|
622
622
|
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
|
623
623
|
};
|
|
624
624
|
const stop = () => {
|
|
625
|
-
sortable == null ?
|
|
626
|
-
sortable =
|
|
625
|
+
sortable == null ? undefined : sortable.destroy();
|
|
626
|
+
sortable = undefined;
|
|
627
627
|
};
|
|
628
628
|
const option = (name, value) => {
|
|
629
|
-
if (value !==
|
|
630
|
-
sortable == null ?
|
|
629
|
+
if (value !== undefined)
|
|
630
|
+
sortable == null ? undefined : sortable.option(name, value);
|
|
631
631
|
else
|
|
632
|
-
return sortable == null ?
|
|
632
|
+
return sortable == null ? undefined : sortable.option(name);
|
|
633
633
|
};
|
|
634
634
|
tryOnMounted(start);
|
|
635
635
|
tryOnScopeDispose$1(stop);
|
|
@@ -653,7 +653,7 @@ function moveArrayElement(list, from, to, e = null) {
|
|
|
653
653
|
insertNodeAt(e.from, e.item, from);
|
|
654
654
|
}
|
|
655
655
|
const _valueIsRef = isRef(list);
|
|
656
|
-
const array = _valueIsRef ? [...toValue
|
|
656
|
+
const array = _valueIsRef ? [...toValue(list)] : toValue(list);
|
|
657
657
|
if (to >= 0 && to < array.length) {
|
|
658
658
|
const element = array.splice(from, 1)[0];
|
|
659
659
|
nextTick(() => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/integrations",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.4.0",
|
|
5
5
|
"description": "Integration wrappers for utility libraries",
|
|
6
6
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -155,8 +155,8 @@
|
|
|
155
155
|
},
|
|
156
156
|
"dependencies": {
|
|
157
157
|
"vue": "^3.5.13",
|
|
158
|
-
"@vueuse/core": "12.
|
|
159
|
-
"@vueuse/shared": "12.
|
|
158
|
+
"@vueuse/core": "12.4.0",
|
|
159
|
+
"@vueuse/shared": "12.4.0"
|
|
160
160
|
},
|
|
161
161
|
"devDependencies": {
|
|
162
162
|
"@types/nprogress": "^0.2.3",
|
|
@@ -17,7 +17,7 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
17
17
|
const pass = vue.ref(!immediate || manual);
|
|
18
18
|
const errors = vue.computed(() => errorInfo.value?.errors || []);
|
|
19
19
|
const errorFields = vue.computed(() => errorInfo.value?.fields || {});
|
|
20
|
-
const validator = vue.computed(() => new AsyncValidatorSchema(
|
|
20
|
+
const validator = vue.computed(() => new AsyncValidatorSchema(vue.toValue(rules)));
|
|
21
21
|
const execute = async () => {
|
|
22
22
|
isFinished.value = false;
|
|
23
23
|
pass.value = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { shallowRef, ref, computed, watch, defineComponent, reactive } from 'vue';
|
|
2
|
-
import { toRef,
|
|
1
|
+
import { shallowRef, ref, computed, toValue, watch, defineComponent, reactive } from 'vue';
|
|
2
|
+
import { toRef, until } from '@vueuse/shared';
|
|
3
3
|
import Schema from 'async-validator';
|
|
4
4
|
|
|
5
5
|
const AsyncValidatorSchema = Schema.default || Schema;
|
package/useAsyncValidator.cjs
CHANGED
|
@@ -17,13 +17,13 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
17
17
|
const pass = vue.ref(!immediate || manual);
|
|
18
18
|
const errors = vue.computed(() => {
|
|
19
19
|
var _a;
|
|
20
|
-
return ((_a = errorInfo.value) == null ?
|
|
20
|
+
return ((_a = errorInfo.value) == null ? undefined : _a.errors) || [];
|
|
21
21
|
});
|
|
22
22
|
const errorFields = vue.computed(() => {
|
|
23
23
|
var _a;
|
|
24
|
-
return ((_a = errorInfo.value) == null ?
|
|
24
|
+
return ((_a = errorInfo.value) == null ? undefined : _a.fields) || {};
|
|
25
25
|
});
|
|
26
|
-
const validator = vue.computed(() => new AsyncValidatorSchema(
|
|
26
|
+
const validator = vue.computed(() => new AsyncValidatorSchema(vue.toValue(rules)));
|
|
27
27
|
const execute = async () => {
|
|
28
28
|
isFinished.value = false;
|
|
29
29
|
pass.value = false;
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
const pass = vue.ref(!immediate || manual);
|
|
15
15
|
const errors = vue.computed(() => {
|
|
16
16
|
var _a;
|
|
17
|
-
return ((_a = errorInfo.value) == null ?
|
|
17
|
+
return ((_a = errorInfo.value) == null ? undefined : _a.errors) || [];
|
|
18
18
|
});
|
|
19
19
|
const errorFields = vue.computed(() => {
|
|
20
20
|
var _a;
|
|
21
|
-
return ((_a = errorInfo.value) == null ?
|
|
21
|
+
return ((_a = errorInfo.value) == null ? undefined : _a.fields) || {};
|
|
22
22
|
});
|
|
23
|
-
const validator = vue.computed(() => new AsyncValidatorSchema(
|
|
23
|
+
const validator = vue.computed(() => new AsyncValidatorSchema(vue.toValue(rules)));
|
|
24
24
|
const execute = async () => {
|
|
25
25
|
isFinished.value = false;
|
|
26
26
|
pass.value = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(m,
|
|
1
|
+
(function(m,u,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=u.toRef(w),r=t.shallowRef(null),a=t.ref(!0),n=t.ref(!o||i),d=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.errors)||[]}),f=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.fields)||{}}),v=t.computed(()=>new p(t.toValue(A))),h=async()=>{a.value=!1,n.value=!1;try{await v.value.validate(c.value,U),n.value=!0,r.value=null}catch(e){r.value=e}finally{a.value=!0}return{pass:n.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:n,errors:d,errorInfo:r,errorFields:f,execute:h};function R(){return new Promise((e,l)=>{u.until(a).toBe(!0).then(()=>e(V)).catch(I=>l(I))})}return{...V,then(e,l){return R().then(e,l)}}}m.useAsyncValidator=y})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue);
|