@vueuse/integrations 10.0.0-beta.2 → 10.0.0-beta.4
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 +130 -83
- package/index.d.ts +30 -42
- package/index.iife.js +130 -83
- package/index.iife.min.js +1 -1
- package/index.mjs +133 -86
- package/package.json +5 -5
- package/useAsyncValidator/component.cjs +7 -3
- package/useAsyncValidator/component.mjs +8 -4
- package/useAsyncValidator.cjs +7 -3
- package/useAsyncValidator.d.ts +2 -2
- package/useAsyncValidator.iife.js +7 -3
- package/useAsyncValidator.iife.min.js +1 -1
- package/useAsyncValidator.mjs +8 -4
- package/useAxios.cjs +25 -17
- package/useAxios.d.ts +18 -30
- package/useAxios.iife.js +25 -17
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +26 -18
- package/useChangeCase.cjs +1 -1
- package/useChangeCase.d.ts +2 -2
- package/useChangeCase.iife.js +1 -1
- package/useChangeCase.iife.min.js +1 -1
- package/useChangeCase.mjs +2 -2
- package/useCookies.cjs +11 -1
- package/useCookies.iife.js +11 -1
- package/useCookies.iife.min.js +1 -1
- package/useCookies.mjs +11 -1
- package/useDrauu.cjs +22 -18
- package/useDrauu.iife.js +22 -18
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +22 -18
- package/useFocusTrap/component.cjs +10 -6
- package/useFocusTrap/component.mjs +10 -6
- package/useFocusTrap.cjs +22 -18
- package/useFocusTrap.iife.js +22 -18
- package/useFocusTrap.iife.min.js +1 -1
- package/useFocusTrap.mjs +22 -18
- package/useFuse.cjs +25 -14
- package/useFuse.d.ts +2 -2
- package/useFuse.iife.js +25 -14
- package/useFuse.iife.min.js +1 -1
- package/useFuse.mjs +27 -16
- package/useIDBKeyval.cjs +1 -1
- package/useIDBKeyval.d.ts +2 -2
- package/useIDBKeyval.iife.js +1 -1
- package/useIDBKeyval.iife.min.js +1 -1
- package/useIDBKeyval.mjs +2 -2
- package/useJwt.cjs +2 -2
- package/useJwt.d.ts +2 -2
- package/useJwt.iife.js +2 -2
- package/useJwt.iife.min.js +1 -1
- package/useJwt.mjs +3 -3
- package/useNProgress.d.ts +2 -2
- package/useNProgress.iife.min.js +1 -1
- package/useQRCode.cjs +9 -5
- package/useQRCode.d.ts +2 -2
- package/useQRCode.iife.js +9 -5
- package/useQRCode.iife.min.js +1 -1
- package/useQRCode.mjs +10 -6
- package/useSortable/component.cjs +6 -3
- package/useSortable/component.mjs +8 -5
- package/useSortable.cjs +6 -3
- package/useSortable.d.ts +4 -4
- package/useSortable.iife.js +7 -5
- package/useSortable.iife.min.js +1 -1
- package/useSortable.mjs +7 -4
package/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
42
42
|
immediate = true,
|
|
43
43
|
manual = false
|
|
44
44
|
} = options;
|
|
45
|
-
const valueRef = shared.
|
|
45
|
+
const valueRef = shared.toRef(value);
|
|
46
46
|
const errorInfo = vueDemi.shallowRef(null);
|
|
47
47
|
const isFinished = vueDemi.ref(true);
|
|
48
48
|
const pass = vueDemi.ref(!immediate || manual);
|
|
@@ -54,7 +54,7 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
54
54
|
var _a;
|
|
55
55
|
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
56
56
|
});
|
|
57
|
-
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.
|
|
57
|
+
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
58
58
|
const execute = async () => {
|
|
59
59
|
isFinished.value = false;
|
|
60
60
|
pass.value = false;
|
|
@@ -75,7 +75,11 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
77
|
if (!manual) {
|
|
78
|
-
vueDemi.watch(
|
|
78
|
+
vueDemi.watch(
|
|
79
|
+
[valueRef, validator],
|
|
80
|
+
() => execute(),
|
|
81
|
+
{ immediate, deep: true }
|
|
82
|
+
);
|
|
79
83
|
}
|
|
80
84
|
const shell = {
|
|
81
85
|
isFinished,
|
|
@@ -138,8 +142,16 @@ function useAxios(...args) {
|
|
|
138
142
|
}
|
|
139
143
|
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder)
|
|
140
144
|
options = args[args.length - 1];
|
|
145
|
+
const {
|
|
146
|
+
initialData,
|
|
147
|
+
shallow,
|
|
148
|
+
onSuccess = shared.noop,
|
|
149
|
+
onError = shared.noop,
|
|
150
|
+
immediate,
|
|
151
|
+
resetOnExecute = false
|
|
152
|
+
} = options;
|
|
141
153
|
const response = vueDemi.shallowRef();
|
|
142
|
-
const data =
|
|
154
|
+
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(initialData);
|
|
143
155
|
const isFinished = vueDemi.ref(false);
|
|
144
156
|
const isLoading = vueDemi.ref(false);
|
|
145
157
|
const isAborted = vueDemi.ref(false);
|
|
@@ -159,58 +171,58 @@ function useAxios(...args) {
|
|
|
159
171
|
isLoading.value = loading2;
|
|
160
172
|
isFinished.value = !loading2;
|
|
161
173
|
};
|
|
174
|
+
const resetData = () => {
|
|
175
|
+
if (resetOnExecute)
|
|
176
|
+
data.value = initialData;
|
|
177
|
+
};
|
|
162
178
|
const waitUntilFinished = () => new Promise((resolve, reject) => {
|
|
163
|
-
shared.until(isFinished).toBe(true).then(() => resolve(result))
|
|
179
|
+
shared.until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
|
|
164
180
|
});
|
|
165
|
-
const
|
|
181
|
+
const promise = {
|
|
182
|
+
then: (...args2) => waitUntilFinished().then(...args2),
|
|
183
|
+
catch: (...args2) => waitUntilFinished().catch(...args2)
|
|
184
|
+
};
|
|
166
185
|
const execute = (executeUrl = url, config = {}) => {
|
|
167
186
|
error.value = void 0;
|
|
168
187
|
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
|
169
188
|
if (_url === void 0) {
|
|
170
189
|
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
|
171
190
|
isFinished.value = true;
|
|
172
|
-
return
|
|
191
|
+
return promise;
|
|
173
192
|
}
|
|
193
|
+
resetData();
|
|
174
194
|
abort();
|
|
175
195
|
loading(true);
|
|
176
196
|
instance(_url, __spreadProps$1(__spreadValues$5(__spreadValues$5({}, defaultConfig), typeof executeUrl === "object" ? executeUrl : config), { cancelToken: cancelToken.token })).then((r) => {
|
|
177
|
-
var _a;
|
|
178
197
|
response.value = r;
|
|
179
198
|
const result2 = r.data;
|
|
180
199
|
data.value = result2;
|
|
181
|
-
|
|
200
|
+
onSuccess(result2);
|
|
182
201
|
}).catch((e) => {
|
|
183
|
-
var _a;
|
|
184
202
|
error.value = e;
|
|
185
|
-
|
|
203
|
+
onError(e);
|
|
186
204
|
}).finally(() => {
|
|
187
205
|
var _a;
|
|
188
206
|
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
189
207
|
loading(false);
|
|
190
208
|
});
|
|
191
|
-
return
|
|
209
|
+
return promise;
|
|
192
210
|
};
|
|
193
|
-
if (
|
|
211
|
+
if (immediate && url)
|
|
194
212
|
execute();
|
|
195
213
|
const result = {
|
|
196
214
|
response,
|
|
197
215
|
data,
|
|
198
216
|
error,
|
|
199
|
-
finished: isFinished,
|
|
200
|
-
loading: isLoading,
|
|
201
217
|
isFinished,
|
|
202
218
|
isLoading,
|
|
203
219
|
cancel: abort,
|
|
204
220
|
isAborted,
|
|
205
|
-
canceled: isAborted,
|
|
206
|
-
aborted: isAborted,
|
|
207
221
|
isCanceled: isAborted,
|
|
208
222
|
abort,
|
|
209
223
|
execute
|
|
210
224
|
};
|
|
211
|
-
return
|
|
212
|
-
then
|
|
213
|
-
});
|
|
225
|
+
return __spreadValues$5(__spreadValues$5({}, result), promise);
|
|
214
226
|
}
|
|
215
227
|
|
|
216
228
|
var changeCase = /*#__PURE__*/Object.freeze({
|
|
@@ -230,7 +242,7 @@ var changeCase = /*#__PURE__*/Object.freeze({
|
|
|
230
242
|
|
|
231
243
|
function useChangeCase(input, type, options) {
|
|
232
244
|
if (shared.isFunction(input))
|
|
233
|
-
return vueDemi.computed(() => changeCase[type](shared.
|
|
245
|
+
return vueDemi.computed(() => changeCase[type](shared.toValue(input), options));
|
|
234
246
|
const text = vueDemi.ref(input);
|
|
235
247
|
return vueDemi.computed({
|
|
236
248
|
get() {
|
|
@@ -268,7 +280,11 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
|
|
|
268
280
|
const touches = vueDemi.ref(0);
|
|
269
281
|
const onChange = () => {
|
|
270
282
|
const newCookies = cookies.getAll({ doNotParse: true });
|
|
271
|
-
if (shouldUpdate(
|
|
283
|
+
if (shouldUpdate(
|
|
284
|
+
watchingDependencies || null,
|
|
285
|
+
newCookies,
|
|
286
|
+
previousCookies
|
|
287
|
+
))
|
|
272
288
|
touches.value++;
|
|
273
289
|
previousCookies = newCookies;
|
|
274
290
|
};
|
|
@@ -277,12 +293,18 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
|
|
|
277
293
|
cookies.removeChangeListener(onChange);
|
|
278
294
|
});
|
|
279
295
|
return {
|
|
296
|
+
/**
|
|
297
|
+
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
298
|
+
*/
|
|
280
299
|
get: (...args) => {
|
|
281
300
|
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
282
301
|
watchingDependencies.push(args[0]);
|
|
283
302
|
touches.value;
|
|
284
303
|
return cookies.get(args[0], __spreadValues$4({ doNotParse }, args[1]));
|
|
285
304
|
},
|
|
305
|
+
/**
|
|
306
|
+
* Reactive get all cookies
|
|
307
|
+
*/
|
|
286
308
|
getAll: (...args) => {
|
|
287
309
|
touches.value;
|
|
288
310
|
return cookies.getAll(__spreadValues$4({ doNotParse }, args[0]));
|
|
@@ -384,24 +406,28 @@ function useDrauu(target, options) {
|
|
|
384
406
|
shiftPressed.value = drauuInstance.value.shiftPressed;
|
|
385
407
|
}
|
|
386
408
|
};
|
|
387
|
-
vueDemi.watch(
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
409
|
+
vueDemi.watch(
|
|
410
|
+
() => core.unrefElement(target),
|
|
411
|
+
(el) => {
|
|
412
|
+
if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
|
|
413
|
+
return;
|
|
414
|
+
if (drauuInstance.value)
|
|
415
|
+
cleanup();
|
|
416
|
+
drauuInstance.value = drauu.createDrauu(__spreadValues$3({ el }, options));
|
|
417
|
+
syncStatus();
|
|
418
|
+
disposables = [
|
|
419
|
+
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
|
|
420
|
+
drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
|
|
421
|
+
drauuInstance.value.on("start", () => onStartHook.trigger()),
|
|
422
|
+
drauuInstance.value.on("end", () => onEndHook.trigger()),
|
|
423
|
+
drauuInstance.value.on("changed", () => {
|
|
424
|
+
syncStatus();
|
|
425
|
+
onChangedHook.trigger();
|
|
426
|
+
})
|
|
427
|
+
];
|
|
428
|
+
},
|
|
429
|
+
{ flush: "post" }
|
|
430
|
+
);
|
|
405
431
|
shared.tryOnScopeDispose(() => cleanup());
|
|
406
432
|
return {
|
|
407
433
|
drauuInstance,
|
|
@@ -472,24 +498,28 @@ function useFocusTrap(target, options = {}) {
|
|
|
472
498
|
isPaused.value = false;
|
|
473
499
|
}
|
|
474
500
|
};
|
|
475
|
-
vueDemi.watch(
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
501
|
+
vueDemi.watch(
|
|
502
|
+
() => core.unrefElement(target),
|
|
503
|
+
(el) => {
|
|
504
|
+
if (!el)
|
|
505
|
+
return;
|
|
506
|
+
trap = focusTrap.createFocusTrap(el, __spreadProps(__spreadValues$2({}, focusTrapOptions), {
|
|
507
|
+
onActivate() {
|
|
508
|
+
hasFocus.value = true;
|
|
509
|
+
if (options.onActivate)
|
|
510
|
+
options.onActivate();
|
|
511
|
+
},
|
|
512
|
+
onDeactivate() {
|
|
513
|
+
hasFocus.value = false;
|
|
514
|
+
if (options.onDeactivate)
|
|
515
|
+
options.onDeactivate();
|
|
516
|
+
}
|
|
517
|
+
}));
|
|
518
|
+
if (immediate)
|
|
519
|
+
activate();
|
|
520
|
+
},
|
|
521
|
+
{ flush: "post" }
|
|
522
|
+
);
|
|
493
523
|
core.tryOnScopeDispose(() => deactivate());
|
|
494
524
|
return {
|
|
495
525
|
hasFocus,
|
|
@@ -504,24 +534,35 @@ function useFocusTrap(target, options = {}) {
|
|
|
504
534
|
function useFuse(search, data, options) {
|
|
505
535
|
const createFuse = () => {
|
|
506
536
|
var _a, _b;
|
|
507
|
-
return new Fuse(
|
|
537
|
+
return new Fuse(
|
|
538
|
+
(_a = shared.toValue(data)) != null ? _a : [],
|
|
539
|
+
(_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
|
|
540
|
+
);
|
|
508
541
|
};
|
|
509
542
|
const fuse = vueDemi.ref(createFuse());
|
|
510
|
-
vueDemi.watch(
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
543
|
+
vueDemi.watch(
|
|
544
|
+
() => {
|
|
545
|
+
var _a;
|
|
546
|
+
return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
|
547
|
+
},
|
|
548
|
+
() => {
|
|
549
|
+
fuse.value = createFuse();
|
|
550
|
+
},
|
|
551
|
+
{ deep: true }
|
|
552
|
+
);
|
|
553
|
+
vueDemi.watch(
|
|
554
|
+
() => shared.toValue(data),
|
|
555
|
+
(newData) => {
|
|
556
|
+
fuse.value.setCollection(newData);
|
|
557
|
+
},
|
|
558
|
+
{ deep: true }
|
|
559
|
+
);
|
|
519
560
|
const results = vueDemi.computed(() => {
|
|
520
|
-
const resolved = shared.
|
|
521
|
-
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !
|
|
522
|
-
return shared.
|
|
561
|
+
const resolved = shared.toValue(options);
|
|
562
|
+
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
|
|
563
|
+
return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
523
564
|
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
|
524
|
-
return fuse.value.search(shared.
|
|
565
|
+
return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
|
|
525
566
|
});
|
|
526
567
|
return {
|
|
527
568
|
fuse,
|
|
@@ -557,7 +598,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
557
598
|
} = options;
|
|
558
599
|
const isFinished = vueDemi.ref(false);
|
|
559
600
|
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(initialValue);
|
|
560
|
-
const rawInit = shared.
|
|
601
|
+
const rawInit = shared.toValue(initialValue);
|
|
561
602
|
async function read() {
|
|
562
603
|
try {
|
|
563
604
|
const rawValue = await idbKeyval.get(key);
|
|
@@ -606,8 +647,8 @@ function useJwt(encodedJwt, options = {}) {
|
|
|
606
647
|
return fallbackValue;
|
|
607
648
|
}
|
|
608
649
|
};
|
|
609
|
-
const header = vueDemi.computed(() => decodeWithFallback(shared.
|
|
610
|
-
const payload = vueDemi.computed(() => decodeWithFallback(shared.
|
|
650
|
+
const header = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt), { header: true }));
|
|
651
|
+
const payload = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt)));
|
|
611
652
|
return {
|
|
612
653
|
header,
|
|
613
654
|
payload
|
|
@@ -645,12 +686,16 @@ function useNProgress(currentProgress = null, options) {
|
|
|
645
686
|
}
|
|
646
687
|
|
|
647
688
|
function useQRCode(text, options) {
|
|
648
|
-
const src = shared.
|
|
689
|
+
const src = shared.toRef(text);
|
|
649
690
|
const result = vueDemi.ref("");
|
|
650
|
-
vueDemi.watch(
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
691
|
+
vueDemi.watch(
|
|
692
|
+
src,
|
|
693
|
+
async (value) => {
|
|
694
|
+
if (src.value && shared.isClient)
|
|
695
|
+
result.value = await QRCode.toDataURL(value, options);
|
|
696
|
+
},
|
|
697
|
+
{ immediate: true }
|
|
698
|
+
);
|
|
654
699
|
return result;
|
|
655
700
|
}
|
|
656
701
|
|
|
@@ -702,9 +747,11 @@ function useSortable(el, list, options = {}) {
|
|
|
702
747
|
return { stop, start };
|
|
703
748
|
}
|
|
704
749
|
function moveArrayElement(list, from, to) {
|
|
705
|
-
const array = core.
|
|
706
|
-
if (to >= 0 && to < array.length)
|
|
707
|
-
|
|
750
|
+
const array = core.toValue(list);
|
|
751
|
+
if (to >= 0 && to < array.length) {
|
|
752
|
+
const element = array.splice(from, 1)[0];
|
|
753
|
+
vueDemi.nextTick(() => array.splice(to, 0, element));
|
|
754
|
+
}
|
|
708
755
|
}
|
|
709
756
|
|
|
710
757
|
exports.createCookies = createCookies;
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeRefOrGetter, MaybeRef, ConfigurableFlush, RemovableRef } from '@vueuse/shared';
|
|
2
2
|
import { ValidateError, ValidateOption, Rules } from 'async-validator';
|
|
3
3
|
import * as vue_demi from 'vue-demi';
|
|
4
4
|
import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
|
|
@@ -8,7 +8,7 @@ import * as universal_cookie from 'universal-cookie';
|
|
|
8
8
|
import universal_cookie__default from 'universal-cookie';
|
|
9
9
|
import { IncomingMessage } from 'node:http';
|
|
10
10
|
import { Options as Options$1, Drauu, Brush } from 'drauu';
|
|
11
|
-
import { EventHookOn, MaybeComputedElementRef, Fn, MaybeElementRef, ConfigurableDocument,
|
|
11
|
+
import { EventHookOn, MaybeComputedElementRef, Fn, MaybeElementRef, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
|
|
12
12
|
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
|
13
13
|
import Fuse from 'fuse.js';
|
|
14
14
|
import { JwtPayload, JwtHeader } from 'jwt-decode';
|
|
@@ -57,7 +57,7 @@ interface UseAsyncValidatorOptions {
|
|
|
57
57
|
* @see https://vueuse.org/useAsyncValidator
|
|
58
58
|
* @see https://github.com/yiminghe/async-validator
|
|
59
59
|
*/
|
|
60
|
-
declare function useAsyncValidator(value:
|
|
60
|
+
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
|
|
61
61
|
|
|
62
62
|
interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
|
|
63
63
|
/**
|
|
@@ -89,31 +89,11 @@ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
|
|
|
89
89
|
*/
|
|
90
90
|
abort: (message?: string | undefined) => void;
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
93
|
-
* @deprecated use `isFinished` instead
|
|
94
|
-
*/
|
|
95
|
-
finished: Ref<boolean>;
|
|
96
|
-
/**
|
|
97
|
-
* isLoading alias
|
|
98
|
-
* @deprecated use `isLoading` instead
|
|
99
|
-
*/
|
|
100
|
-
loading: Ref<boolean>;
|
|
101
|
-
/**
|
|
102
|
-
* isAborted alias
|
|
103
|
-
* @deprecated use `isAborted` instead
|
|
104
|
-
*/
|
|
105
|
-
aborted: Ref<boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* abort alias
|
|
92
|
+
* Alias to `abort`
|
|
108
93
|
*/
|
|
109
94
|
cancel: (message?: string | undefined) => void;
|
|
110
95
|
/**
|
|
111
|
-
* isAborted
|
|
112
|
-
* @deprecated use `isCanceled` instead
|
|
113
|
-
*/
|
|
114
|
-
canceled: Ref<boolean>;
|
|
115
|
-
/**
|
|
116
|
-
* isAborted alias
|
|
96
|
+
* Alice to `isAborted`
|
|
117
97
|
*/
|
|
118
98
|
isCanceled: Ref<boolean>;
|
|
119
99
|
}
|
|
@@ -121,13 +101,13 @@ interface StrictUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
|
|
|
121
101
|
/**
|
|
122
102
|
* Manually call the axios request
|
|
123
103
|
*/
|
|
124
|
-
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) =>
|
|
104
|
+
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D>>;
|
|
125
105
|
}
|
|
126
106
|
interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
|
|
127
107
|
/**
|
|
128
108
|
* Manually call the axios request
|
|
129
109
|
*/
|
|
130
|
-
execute: (url: string, config?: AxiosRequestConfig<D>) =>
|
|
110
|
+
execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
131
111
|
}
|
|
132
112
|
interface UseAxiosOptions<T = any> {
|
|
133
113
|
/**
|
|
@@ -149,17 +129,25 @@ interface UseAxiosOptions<T = any> {
|
|
|
149
129
|
* Callback when success is caught.
|
|
150
130
|
*/
|
|
151
131
|
onSuccess?: (data: T) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Initial data to use
|
|
134
|
+
*/
|
|
135
|
+
initialData?: T;
|
|
136
|
+
/**
|
|
137
|
+
* Sets the state to initialState before executing the promise.
|
|
138
|
+
*/
|
|
139
|
+
resetOnExecute?: boolean;
|
|
152
140
|
/**
|
|
153
141
|
* Callback when request is finished.
|
|
154
142
|
*/
|
|
155
143
|
onFinish?: () => void;
|
|
156
144
|
}
|
|
157
|
-
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> &
|
|
158
|
-
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> &
|
|
159
|
-
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> &
|
|
160
|
-
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> &
|
|
161
|
-
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> &
|
|
162
|
-
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> &
|
|
145
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
|
|
146
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
|
|
147
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
|
|
148
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
149
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
150
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
163
151
|
|
|
164
152
|
declare const changeCase_camelCase: typeof camelCase;
|
|
165
153
|
declare const changeCase_capitalCase: typeof capitalCase;
|
|
@@ -190,7 +178,7 @@ declare namespace changeCase {
|
|
|
190
178
|
|
|
191
179
|
type ChangeCaseType = keyof typeof changeCase;
|
|
192
180
|
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
|
|
193
|
-
declare function useChangeCase(input:
|
|
181
|
+
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
|
|
194
182
|
|
|
195
183
|
/**
|
|
196
184
|
* Creates a new {@link useCookies} function
|
|
@@ -326,7 +314,7 @@ interface UseFuseOptions<T> {
|
|
|
326
314
|
resultLimit?: number;
|
|
327
315
|
matchAllWhenSearchEmpty?: boolean;
|
|
328
316
|
}
|
|
329
|
-
declare function useFuse<DataItem>(search:
|
|
317
|
+
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
|
330
318
|
fuse: vue_demi.Ref<{
|
|
331
319
|
search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
|
|
332
320
|
setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
|
|
@@ -371,7 +359,7 @@ interface UseIDBOptions extends ConfigurableFlush {
|
|
|
371
359
|
* @param initialValue
|
|
372
360
|
* @param options
|
|
373
361
|
*/
|
|
374
|
-
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue:
|
|
362
|
+
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): {
|
|
375
363
|
data: RemovableRef<T>;
|
|
376
364
|
isFinished: Ref<boolean>;
|
|
377
365
|
};
|
|
@@ -398,7 +386,7 @@ interface UseJwtReturn<Payload, Header, Fallback> {
|
|
|
398
386
|
* @see https://vueuse.org/useJwt
|
|
399
387
|
* @param jwt
|
|
400
388
|
*/
|
|
401
|
-
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt:
|
|
389
|
+
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
|
|
402
390
|
|
|
403
391
|
type UseNProgressOptions = Partial<NProgressOptions>;
|
|
404
392
|
/**
|
|
@@ -406,7 +394,7 @@ type UseNProgressOptions = Partial<NProgressOptions>;
|
|
|
406
394
|
*
|
|
407
395
|
* @see https://vueuse.org/useNProgress
|
|
408
396
|
*/
|
|
409
|
-
declare function useNProgress(currentProgress?:
|
|
397
|
+
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
|
|
410
398
|
isLoading: vue_demi.WritableComputedRef<boolean>;
|
|
411
399
|
progress: vue_demi.Ref<number | (() => number | null | undefined) | null | undefined>;
|
|
412
400
|
start: () => nprogress.NProgress;
|
|
@@ -422,7 +410,7 @@ type UseNProgressReturn = ReturnType<typeof useNProgress>;
|
|
|
422
410
|
* @param text
|
|
423
411
|
* @param options
|
|
424
412
|
*/
|
|
425
|
-
declare function useQRCode(text:
|
|
413
|
+
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue_demi.Ref<string>;
|
|
426
414
|
|
|
427
415
|
interface UseSortableReturn {
|
|
428
416
|
/**
|
|
@@ -435,8 +423,8 @@ interface UseSortableReturn {
|
|
|
435
423
|
stop: () => void;
|
|
436
424
|
}
|
|
437
425
|
type UseSortableOptions = Options$3 & ConfigurableDocument;
|
|
438
|
-
declare function useSortable<T>(selector: string, list:
|
|
439
|
-
declare function useSortable<T>(el:
|
|
440
|
-
declare function moveArrayElement<T>(list:
|
|
426
|
+
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
|
427
|
+
declare function useSortable<T>(el: MaybeRefOrGetter$1<HTMLElement | null | undefined>, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
|
428
|
+
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number): void;
|
|
441
429
|
|
|
442
430
|
export { AsyncValidatorError, ChangeCaseType, EasyUseAxiosReturn, FuseOptions, StrictUseAxiosReturn, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, UseAxiosOptions, UseAxiosReturn, UseDrauuOptions, UseDrauuReturn, UseFocusTrapOptions, UseFocusTrapReturn, UseFuseOptions, UseFuseReturn, UseIDBOptions, UseJwtOptions, UseJwtReturn, UseNProgressOptions, UseNProgressReturn, UseSortableOptions, UseSortableReturn, createCookies, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
|