@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/index.cjs
CHANGED
|
@@ -16,25 +16,6 @@ var nprogress = require('nprogress');
|
|
|
16
16
|
var QRCode = require('qrcode');
|
|
17
17
|
var Sortable = require('sortablejs');
|
|
18
18
|
|
|
19
|
-
var __defProp$6 = Object.defineProperty;
|
|
20
|
-
var __defProps$2 = Object.defineProperties;
|
|
21
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
22
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
23
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
24
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
25
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
26
|
-
var __spreadValues$6 = (a, b) => {
|
|
27
|
-
for (var prop in b || (b = {}))
|
|
28
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
29
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
30
|
-
if (__getOwnPropSymbols$6)
|
|
31
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
32
|
-
if (__propIsEnum$6.call(b, prop))
|
|
33
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
34
|
-
}
|
|
35
|
-
return a;
|
|
36
|
-
};
|
|
37
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
38
19
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
39
20
|
function useAsyncValidator(value, rules, options = {}) {
|
|
40
21
|
const {
|
|
@@ -46,14 +27,8 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
46
27
|
const errorInfo = vueDemi.shallowRef(null);
|
|
47
28
|
const isFinished = vueDemi.ref(true);
|
|
48
29
|
const pass = vueDemi.ref(!immediate || manual);
|
|
49
|
-
const errors = vueDemi.computed(() =>
|
|
50
|
-
|
|
51
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
52
|
-
});
|
|
53
|
-
const errorFields = vueDemi.computed(() => {
|
|
54
|
-
var _a;
|
|
55
|
-
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
56
|
-
});
|
|
30
|
+
const errors = vueDemi.computed(() => errorInfo.value?.errors || []);
|
|
31
|
+
const errorFields = vueDemi.computed(() => errorInfo.value?.fields || {});
|
|
57
32
|
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
58
33
|
const execute = async () => {
|
|
59
34
|
isFinished.value = false;
|
|
@@ -94,32 +69,14 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
94
69
|
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
|
95
70
|
});
|
|
96
71
|
}
|
|
97
|
-
return
|
|
72
|
+
return {
|
|
73
|
+
...shell,
|
|
98
74
|
then(onFulfilled, onRejected) {
|
|
99
75
|
return waitUntilFinished().then(onFulfilled, onRejected);
|
|
100
76
|
}
|
|
101
|
-
}
|
|
77
|
+
};
|
|
102
78
|
}
|
|
103
79
|
|
|
104
|
-
var __defProp$5 = Object.defineProperty;
|
|
105
|
-
var __defProps$1 = Object.defineProperties;
|
|
106
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
107
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
108
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
109
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
110
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
111
|
-
var __spreadValues$5 = (a, b) => {
|
|
112
|
-
for (var prop in b || (b = {}))
|
|
113
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
114
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
115
|
-
if (__getOwnPropSymbols$5)
|
|
116
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
117
|
-
if (__propIsEnum$5.call(b, prop))
|
|
118
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
119
|
-
}
|
|
120
|
-
return a;
|
|
121
|
-
};
|
|
122
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
123
80
|
function useAxios(...args) {
|
|
124
81
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
|
125
82
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
@@ -129,7 +86,7 @@ function useAxios(...args) {
|
|
|
129
86
|
immediate: !!argsPlaceholder,
|
|
130
87
|
shallow: true
|
|
131
88
|
};
|
|
132
|
-
const isAxiosInstance = (val) => !!
|
|
89
|
+
const isAxiosInstance = (val) => !!val?.request;
|
|
133
90
|
if (args.length > 0 + argsPlaceholder) {
|
|
134
91
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
135
92
|
instance = args[0 + argsPlaceholder];
|
|
@@ -185,7 +142,7 @@ function useAxios(...args) {
|
|
|
185
142
|
let executeCounter = 0;
|
|
186
143
|
const execute = (executeUrl = url, config = {}) => {
|
|
187
144
|
error.value = void 0;
|
|
188
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
145
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url ?? config.url;
|
|
189
146
|
if (_url === void 0) {
|
|
190
147
|
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
|
191
148
|
isFinished.value = true;
|
|
@@ -196,7 +153,7 @@ function useAxios(...args) {
|
|
|
196
153
|
loading(true);
|
|
197
154
|
executeCounter += 1;
|
|
198
155
|
const currentExecuteCounter = executeCounter;
|
|
199
|
-
instance(_url,
|
|
156
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
200
157
|
response.value = r;
|
|
201
158
|
const result2 = r.data;
|
|
202
159
|
data.value = result2;
|
|
@@ -205,8 +162,7 @@ function useAxios(...args) {
|
|
|
205
162
|
error.value = e;
|
|
206
163
|
onError(e);
|
|
207
164
|
}).finally(() => {
|
|
208
|
-
|
|
209
|
-
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
165
|
+
options.onFinish?.();
|
|
210
166
|
if (currentExecuteCounter === executeCounter)
|
|
211
167
|
loading(false);
|
|
212
168
|
});
|
|
@@ -226,7 +182,10 @@ function useAxios(...args) {
|
|
|
226
182
|
abort,
|
|
227
183
|
execute
|
|
228
184
|
};
|
|
229
|
-
return
|
|
185
|
+
return {
|
|
186
|
+
...result,
|
|
187
|
+
...promise
|
|
188
|
+
};
|
|
230
189
|
}
|
|
231
190
|
|
|
232
191
|
var changeCase = /*#__PURE__*/Object.freeze({
|
|
@@ -258,22 +217,6 @@ function useChangeCase(input, type, options) {
|
|
|
258
217
|
});
|
|
259
218
|
}
|
|
260
219
|
|
|
261
|
-
var __defProp$4 = Object.defineProperty;
|
|
262
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
263
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
264
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
265
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
266
|
-
var __spreadValues$4 = (a, b) => {
|
|
267
|
-
for (var prop in b || (b = {}))
|
|
268
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
269
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
270
|
-
if (__getOwnPropSymbols$4)
|
|
271
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
272
|
-
if (__propIsEnum$4.call(b, prop))
|
|
273
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
274
|
-
}
|
|
275
|
-
return a;
|
|
276
|
-
};
|
|
277
220
|
function createCookies(req) {
|
|
278
221
|
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
|
279
222
|
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
@@ -304,14 +247,14 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
|
|
|
304
247
|
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
305
248
|
watchingDependencies.push(args[0]);
|
|
306
249
|
touches.value;
|
|
307
|
-
return cookies.get(args[0],
|
|
250
|
+
return cookies.get(args[0], { doNotParse, ...args[1] });
|
|
308
251
|
},
|
|
309
252
|
/**
|
|
310
253
|
* Reactive get all cookies
|
|
311
254
|
*/
|
|
312
255
|
getAll: (...args) => {
|
|
313
256
|
touches.value;
|
|
314
|
-
return cookies.getAll(
|
|
257
|
+
return cookies.getAll({ doNotParse, ...args[0] });
|
|
315
258
|
},
|
|
316
259
|
set: (...args) => cookies.set(...args),
|
|
317
260
|
remove: (...args) => cookies.remove(...args),
|
|
@@ -329,22 +272,6 @@ function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
|
329
272
|
return false;
|
|
330
273
|
}
|
|
331
274
|
|
|
332
|
-
var __defProp$3 = Object.defineProperty;
|
|
333
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
334
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
335
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
336
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
337
|
-
var __spreadValues$3 = (a, b) => {
|
|
338
|
-
for (var prop in b || (b = {}))
|
|
339
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
340
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
341
|
-
if (__getOwnPropSymbols$3)
|
|
342
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
343
|
-
if (__propIsEnum$3.call(b, prop))
|
|
344
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
345
|
-
}
|
|
346
|
-
return a;
|
|
347
|
-
};
|
|
348
275
|
function useDrauu(target, options) {
|
|
349
276
|
const drauuInstance = vueDemi.ref();
|
|
350
277
|
let disposables = [];
|
|
@@ -373,34 +300,15 @@ function useDrauu(target, options) {
|
|
|
373
300
|
instance.mode = brush.value.mode;
|
|
374
301
|
}
|
|
375
302
|
}, { deep: true });
|
|
376
|
-
const undo = () =>
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
|
|
383
|
-
};
|
|
384
|
-
const clear = () => {
|
|
385
|
-
var _a;
|
|
386
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
|
|
387
|
-
};
|
|
388
|
-
const cancel = () => {
|
|
389
|
-
var _a;
|
|
390
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
|
|
391
|
-
};
|
|
392
|
-
const load = (svg) => {
|
|
393
|
-
var _a;
|
|
394
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
|
|
395
|
-
};
|
|
396
|
-
const dump = () => {
|
|
397
|
-
var _a;
|
|
398
|
-
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
|
|
399
|
-
};
|
|
303
|
+
const undo = () => drauuInstance.value?.undo();
|
|
304
|
+
const redo = () => drauuInstance.value?.redo();
|
|
305
|
+
const clear = () => drauuInstance.value?.clear();
|
|
306
|
+
const cancel = () => drauuInstance.value?.cancel();
|
|
307
|
+
const load = (svg) => drauuInstance.value?.load(svg);
|
|
308
|
+
const dump = () => drauuInstance.value?.dump();
|
|
400
309
|
const cleanup = () => {
|
|
401
|
-
var _a;
|
|
402
310
|
disposables.forEach((dispose) => dispose());
|
|
403
|
-
|
|
311
|
+
drauuInstance.value?.unmount();
|
|
404
312
|
};
|
|
405
313
|
const syncStatus = () => {
|
|
406
314
|
if (drauuInstance.value) {
|
|
@@ -417,7 +325,7 @@ function useDrauu(target, options) {
|
|
|
417
325
|
return;
|
|
418
326
|
if (drauuInstance.value)
|
|
419
327
|
cleanup();
|
|
420
|
-
drauuInstance.value = drauu.createDrauu(
|
|
328
|
+
drauuInstance.value = drauu.createDrauu({ el, ...options });
|
|
421
329
|
syncStatus();
|
|
422
330
|
disposables = [
|
|
423
331
|
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
|
|
@@ -452,40 +360,9 @@ function useDrauu(target, options) {
|
|
|
452
360
|
};
|
|
453
361
|
}
|
|
454
362
|
|
|
455
|
-
var __defProp$2 = Object.defineProperty;
|
|
456
|
-
var __defProps = Object.defineProperties;
|
|
457
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
458
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
459
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
460
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
461
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
462
|
-
var __spreadValues$2 = (a, b) => {
|
|
463
|
-
for (var prop in b || (b = {}))
|
|
464
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
465
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
466
|
-
if (__getOwnPropSymbols$2)
|
|
467
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
468
|
-
if (__propIsEnum$2.call(b, prop))
|
|
469
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
470
|
-
}
|
|
471
|
-
return a;
|
|
472
|
-
};
|
|
473
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
474
|
-
var __objRest$1 = (source, exclude) => {
|
|
475
|
-
var target = {};
|
|
476
|
-
for (var prop in source)
|
|
477
|
-
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
478
|
-
target[prop] = source[prop];
|
|
479
|
-
if (source != null && __getOwnPropSymbols$2)
|
|
480
|
-
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
481
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
482
|
-
target[prop] = source[prop];
|
|
483
|
-
}
|
|
484
|
-
return target;
|
|
485
|
-
};
|
|
486
363
|
function useFocusTrap(target, options = {}) {
|
|
487
364
|
let trap;
|
|
488
|
-
const
|
|
365
|
+
const { immediate, ...focusTrapOptions } = options;
|
|
489
366
|
const hasFocus = vueDemi.ref(false);
|
|
490
367
|
const isPaused = vueDemi.ref(false);
|
|
491
368
|
const activate = (opts) => trap && trap.activate(opts);
|
|
@@ -507,7 +384,8 @@ function useFocusTrap(target, options = {}) {
|
|
|
507
384
|
(el) => {
|
|
508
385
|
if (!el)
|
|
509
386
|
return;
|
|
510
|
-
trap = focusTrap.createFocusTrap(el,
|
|
387
|
+
trap = focusTrap.createFocusTrap(el, {
|
|
388
|
+
...focusTrapOptions,
|
|
511
389
|
onActivate() {
|
|
512
390
|
hasFocus.value = true;
|
|
513
391
|
if (options.onActivate)
|
|
@@ -518,7 +396,7 @@ function useFocusTrap(target, options = {}) {
|
|
|
518
396
|
if (options.onDeactivate)
|
|
519
397
|
options.onDeactivate();
|
|
520
398
|
}
|
|
521
|
-
})
|
|
399
|
+
});
|
|
522
400
|
if (immediate)
|
|
523
401
|
activate();
|
|
524
402
|
},
|
|
@@ -537,18 +415,14 @@ function useFocusTrap(target, options = {}) {
|
|
|
537
415
|
|
|
538
416
|
function useFuse(search, data, options) {
|
|
539
417
|
const createFuse = () => {
|
|
540
|
-
var _a, _b;
|
|
541
418
|
return new Fuse(
|
|
542
|
-
|
|
543
|
-
|
|
419
|
+
shared.toValue(data) ?? [],
|
|
420
|
+
shared.toValue(options)?.fuseOptions
|
|
544
421
|
);
|
|
545
422
|
};
|
|
546
423
|
const fuse = vueDemi.ref(createFuse());
|
|
547
424
|
vueDemi.watch(
|
|
548
|
-
() =>
|
|
549
|
-
var _a;
|
|
550
|
-
return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
|
551
|
-
},
|
|
425
|
+
() => shared.toValue(options)?.fuseOptions,
|
|
552
426
|
() => {
|
|
553
427
|
fuse.value = createFuse();
|
|
554
428
|
},
|
|
@@ -563,9 +437,9 @@ function useFuse(search, data, options) {
|
|
|
563
437
|
);
|
|
564
438
|
const results = vueDemi.computed(() => {
|
|
565
439
|
const resolved = shared.toValue(options);
|
|
566
|
-
if (
|
|
440
|
+
if (resolved?.matchAllWhenSearchEmpty && !shared.toValue(search))
|
|
567
441
|
return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
568
|
-
const limit = resolved
|
|
442
|
+
const limit = resolved?.resultLimit;
|
|
569
443
|
return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
|
|
570
444
|
});
|
|
571
445
|
return {
|
|
@@ -574,22 +448,6 @@ function useFuse(search, data, options) {
|
|
|
574
448
|
};
|
|
575
449
|
}
|
|
576
450
|
|
|
577
|
-
var __defProp$1 = Object.defineProperty;
|
|
578
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
579
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
580
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
581
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
582
|
-
var __spreadValues$1 = (a, b) => {
|
|
583
|
-
for (var prop in b || (b = {}))
|
|
584
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
585
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
586
|
-
if (__getOwnPropSymbols$1)
|
|
587
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
588
|
-
if (__propIsEnum$1.call(b, prop))
|
|
589
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
590
|
-
}
|
|
591
|
-
return a;
|
|
592
|
-
};
|
|
593
451
|
function useIDBKeyval(key, initialValue, options = {}) {
|
|
594
452
|
const {
|
|
595
453
|
flush = "pre",
|
|
@@ -626,7 +484,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
626
484
|
if (Array.isArray(data.value))
|
|
627
485
|
await idbKeyval.update(key, () => JSON.parse(JSON.stringify(data.value)));
|
|
628
486
|
else if (typeof data.value === "object")
|
|
629
|
-
await idbKeyval.update(key, () =>
|
|
487
|
+
await idbKeyval.update(key, () => ({ ...data.value }));
|
|
630
488
|
else
|
|
631
489
|
await idbKeyval.update(key, () => data.value);
|
|
632
490
|
}
|
|
@@ -634,8 +492,21 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
634
492
|
onError(e);
|
|
635
493
|
}
|
|
636
494
|
}
|
|
637
|
-
|
|
638
|
-
|
|
495
|
+
const {
|
|
496
|
+
pause: pauseWatch,
|
|
497
|
+
resume: resumeWatch
|
|
498
|
+
} = core.watchPausable(data, () => write(), { flush, deep });
|
|
499
|
+
async function setData(value) {
|
|
500
|
+
pauseWatch();
|
|
501
|
+
data.value = value;
|
|
502
|
+
await write();
|
|
503
|
+
resumeWatch();
|
|
504
|
+
}
|
|
505
|
+
return {
|
|
506
|
+
set: setData,
|
|
507
|
+
isFinished,
|
|
508
|
+
data
|
|
509
|
+
};
|
|
639
510
|
}
|
|
640
511
|
|
|
641
512
|
function useJwt(encodedJwt, options = {}) {
|
|
@@ -647,7 +518,7 @@ function useJwt(encodedJwt, options = {}) {
|
|
|
647
518
|
try {
|
|
648
519
|
return jwt_decode(encodedJwt2, options2);
|
|
649
520
|
} catch (err) {
|
|
650
|
-
onError
|
|
521
|
+
onError?.(err);
|
|
651
522
|
return fallbackValue;
|
|
652
523
|
}
|
|
653
524
|
};
|
|
@@ -703,64 +574,41 @@ function useQRCode(text, options) {
|
|
|
703
574
|
return result;
|
|
704
575
|
}
|
|
705
576
|
|
|
706
|
-
var __defProp = Object.defineProperty;
|
|
707
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
708
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
709
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
710
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
711
|
-
var __spreadValues = (a, b) => {
|
|
712
|
-
for (var prop in b || (b = {}))
|
|
713
|
-
if (__hasOwnProp.call(b, prop))
|
|
714
|
-
__defNormalProp(a, prop, b[prop]);
|
|
715
|
-
if (__getOwnPropSymbols)
|
|
716
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
717
|
-
if (__propIsEnum.call(b, prop))
|
|
718
|
-
__defNormalProp(a, prop, b[prop]);
|
|
719
|
-
}
|
|
720
|
-
return a;
|
|
721
|
-
};
|
|
722
|
-
var __objRest = (source, exclude) => {
|
|
723
|
-
var target = {};
|
|
724
|
-
for (var prop in source)
|
|
725
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
726
|
-
target[prop] = source[prop];
|
|
727
|
-
if (source != null && __getOwnPropSymbols)
|
|
728
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
729
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
730
|
-
target[prop] = source[prop];
|
|
731
|
-
}
|
|
732
|
-
return target;
|
|
733
|
-
};
|
|
734
577
|
function useSortable(el, list, options = {}) {
|
|
735
578
|
let sortable;
|
|
736
|
-
const
|
|
579
|
+
const { document = core.defaultDocument, ...resetOptions } = options;
|
|
737
580
|
const defaultOptions = {
|
|
738
581
|
onUpdate: (e) => {
|
|
739
582
|
moveArrayElement(list, e.oldIndex, e.newIndex);
|
|
740
583
|
}
|
|
741
584
|
};
|
|
742
585
|
const start = () => {
|
|
743
|
-
const target = typeof el === "string" ? document
|
|
586
|
+
const target = typeof el === "string" ? document?.querySelector(el) : core.unrefElement(el);
|
|
744
587
|
if (!target)
|
|
745
588
|
return;
|
|
746
|
-
sortable = new Sortable(target,
|
|
589
|
+
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
|
747
590
|
};
|
|
748
|
-
const stop = () => sortable
|
|
591
|
+
const stop = () => sortable?.destroy();
|
|
749
592
|
const option = (name, value) => {
|
|
750
593
|
if (value !== void 0)
|
|
751
|
-
sortable
|
|
594
|
+
sortable?.option(name, value);
|
|
752
595
|
else
|
|
753
|
-
return sortable
|
|
596
|
+
return sortable?.option(name);
|
|
754
597
|
};
|
|
755
598
|
core.tryOnMounted(start);
|
|
756
599
|
core.tryOnScopeDispose(stop);
|
|
757
600
|
return { stop, start, option };
|
|
758
601
|
}
|
|
759
602
|
function moveArrayElement(list, from, to) {
|
|
760
|
-
const
|
|
603
|
+
const _valueIsRef = vueDemi.isRef(list);
|
|
604
|
+
const array = _valueIsRef ? [...core.toValue(list)] : core.toValue(list);
|
|
761
605
|
if (to >= 0 && to < array.length) {
|
|
762
606
|
const element = array.splice(from, 1)[0];
|
|
763
|
-
vueDemi.nextTick(() =>
|
|
607
|
+
vueDemi.nextTick(() => {
|
|
608
|
+
array.splice(to, 0, element);
|
|
609
|
+
if (_valueIsRef)
|
|
610
|
+
list.value = array;
|
|
611
|
+
});
|
|
764
612
|
}
|
|
765
613
|
}
|
|
766
614
|
|
package/index.d.cts
CHANGED
|
@@ -161,19 +161,7 @@ declare const changeCase_pathCase: typeof pathCase;
|
|
|
161
161
|
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
162
162
|
declare const changeCase_snakeCase: typeof snakeCase;
|
|
163
163
|
declare namespace changeCase {
|
|
164
|
-
export {
|
|
165
|
-
changeCase_camelCase as camelCase,
|
|
166
|
-
changeCase_capitalCase as capitalCase,
|
|
167
|
-
changeCase_constantCase as constantCase,
|
|
168
|
-
changeCase_dotCase as dotCase,
|
|
169
|
-
changeCase_headerCase as headerCase,
|
|
170
|
-
changeCase_noCase as noCase,
|
|
171
|
-
changeCase_paramCase as paramCase,
|
|
172
|
-
changeCase_pascalCase as pascalCase,
|
|
173
|
-
changeCase_pathCase as pathCase,
|
|
174
|
-
changeCase_sentenceCase as sentenceCase,
|
|
175
|
-
changeCase_snakeCase as snakeCase,
|
|
176
|
-
};
|
|
164
|
+
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 };
|
|
177
165
|
}
|
|
178
166
|
|
|
179
167
|
type ChangeCaseType = keyof typeof changeCase;
|
|
@@ -353,16 +341,18 @@ interface UseIDBOptions extends ConfigurableFlush {
|
|
|
353
341
|
*/
|
|
354
342
|
writeDefaults?: boolean;
|
|
355
343
|
}
|
|
344
|
+
interface UseIDBKeyvalReturn<T> {
|
|
345
|
+
data: RemovableRef<T>;
|
|
346
|
+
isFinished: Ref<boolean>;
|
|
347
|
+
set(value: T): Promise<void>;
|
|
348
|
+
}
|
|
356
349
|
/**
|
|
357
350
|
*
|
|
358
351
|
* @param key
|
|
359
352
|
* @param initialValue
|
|
360
353
|
* @param options
|
|
361
354
|
*/
|
|
362
|
-
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions):
|
|
363
|
-
data: RemovableRef<T>;
|
|
364
|
-
isFinished: Ref<boolean>;
|
|
365
|
-
};
|
|
355
|
+
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
|
|
366
356
|
|
|
367
357
|
interface UseJwtOptions<Fallback> {
|
|
368
358
|
/**
|
|
@@ -434,4 +424,4 @@ declare function useSortable<T>(selector: string, list: MaybeRefOrGetter$1<T[]>,
|
|
|
434
424
|
declare function useSortable<T>(el: MaybeRefOrGetter$1<HTMLElement | null | undefined>, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
|
435
425
|
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number): void;
|
|
436
426
|
|
|
437
|
-
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 };
|
|
427
|
+
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
|
package/index.d.mts
CHANGED
|
@@ -161,19 +161,7 @@ declare const changeCase_pathCase: typeof pathCase;
|
|
|
161
161
|
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
162
162
|
declare const changeCase_snakeCase: typeof snakeCase;
|
|
163
163
|
declare namespace changeCase {
|
|
164
|
-
export {
|
|
165
|
-
changeCase_camelCase as camelCase,
|
|
166
|
-
changeCase_capitalCase as capitalCase,
|
|
167
|
-
changeCase_constantCase as constantCase,
|
|
168
|
-
changeCase_dotCase as dotCase,
|
|
169
|
-
changeCase_headerCase as headerCase,
|
|
170
|
-
changeCase_noCase as noCase,
|
|
171
|
-
changeCase_paramCase as paramCase,
|
|
172
|
-
changeCase_pascalCase as pascalCase,
|
|
173
|
-
changeCase_pathCase as pathCase,
|
|
174
|
-
changeCase_sentenceCase as sentenceCase,
|
|
175
|
-
changeCase_snakeCase as snakeCase,
|
|
176
|
-
};
|
|
164
|
+
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 };
|
|
177
165
|
}
|
|
178
166
|
|
|
179
167
|
type ChangeCaseType = keyof typeof changeCase;
|
|
@@ -353,16 +341,18 @@ interface UseIDBOptions extends ConfigurableFlush {
|
|
|
353
341
|
*/
|
|
354
342
|
writeDefaults?: boolean;
|
|
355
343
|
}
|
|
344
|
+
interface UseIDBKeyvalReturn<T> {
|
|
345
|
+
data: RemovableRef<T>;
|
|
346
|
+
isFinished: Ref<boolean>;
|
|
347
|
+
set(value: T): Promise<void>;
|
|
348
|
+
}
|
|
356
349
|
/**
|
|
357
350
|
*
|
|
358
351
|
* @param key
|
|
359
352
|
* @param initialValue
|
|
360
353
|
* @param options
|
|
361
354
|
*/
|
|
362
|
-
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions):
|
|
363
|
-
data: RemovableRef<T>;
|
|
364
|
-
isFinished: Ref<boolean>;
|
|
365
|
-
};
|
|
355
|
+
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
|
|
366
356
|
|
|
367
357
|
interface UseJwtOptions<Fallback> {
|
|
368
358
|
/**
|
|
@@ -434,4 +424,4 @@ declare function useSortable<T>(selector: string, list: MaybeRefOrGetter$1<T[]>,
|
|
|
434
424
|
declare function useSortable<T>(el: MaybeRefOrGetter$1<HTMLElement | null | undefined>, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
|
435
425
|
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number): void;
|
|
436
426
|
|
|
437
|
-
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 };
|
|
427
|
+
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
|
package/index.d.ts
CHANGED
|
@@ -161,19 +161,7 @@ declare const changeCase_pathCase: typeof pathCase;
|
|
|
161
161
|
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
162
162
|
declare const changeCase_snakeCase: typeof snakeCase;
|
|
163
163
|
declare namespace changeCase {
|
|
164
|
-
export {
|
|
165
|
-
changeCase_camelCase as camelCase,
|
|
166
|
-
changeCase_capitalCase as capitalCase,
|
|
167
|
-
changeCase_constantCase as constantCase,
|
|
168
|
-
changeCase_dotCase as dotCase,
|
|
169
|
-
changeCase_headerCase as headerCase,
|
|
170
|
-
changeCase_noCase as noCase,
|
|
171
|
-
changeCase_paramCase as paramCase,
|
|
172
|
-
changeCase_pascalCase as pascalCase,
|
|
173
|
-
changeCase_pathCase as pathCase,
|
|
174
|
-
changeCase_sentenceCase as sentenceCase,
|
|
175
|
-
changeCase_snakeCase as snakeCase,
|
|
176
|
-
};
|
|
164
|
+
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 };
|
|
177
165
|
}
|
|
178
166
|
|
|
179
167
|
type ChangeCaseType = keyof typeof changeCase;
|
|
@@ -353,16 +341,18 @@ interface UseIDBOptions extends ConfigurableFlush {
|
|
|
353
341
|
*/
|
|
354
342
|
writeDefaults?: boolean;
|
|
355
343
|
}
|
|
344
|
+
interface UseIDBKeyvalReturn<T> {
|
|
345
|
+
data: RemovableRef<T>;
|
|
346
|
+
isFinished: Ref<boolean>;
|
|
347
|
+
set(value: T): Promise<void>;
|
|
348
|
+
}
|
|
356
349
|
/**
|
|
357
350
|
*
|
|
358
351
|
* @param key
|
|
359
352
|
* @param initialValue
|
|
360
353
|
* @param options
|
|
361
354
|
*/
|
|
362
|
-
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions):
|
|
363
|
-
data: RemovableRef<T>;
|
|
364
|
-
isFinished: Ref<boolean>;
|
|
365
|
-
};
|
|
355
|
+
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
|
|
366
356
|
|
|
367
357
|
interface UseJwtOptions<Fallback> {
|
|
368
358
|
/**
|
|
@@ -434,4 +424,4 @@ declare function useSortable<T>(selector: string, list: MaybeRefOrGetter$1<T[]>,
|
|
|
434
424
|
declare function useSortable<T>(el: MaybeRefOrGetter$1<HTMLElement | null | undefined>, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
|
435
425
|
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number): void;
|
|
436
426
|
|
|
437
|
-
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 };
|
|
427
|
+
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
|