@vueuse/integrations 10.4.0 → 10.5.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 +54 -23
- package/index.d.cts +6 -10
- package/index.d.mts +6 -10
- package/index.d.ts +6 -10
- package/index.iife.js +54 -23
- package/index.iife.min.js +1 -1
- package/index.mjs +54 -23
- package/package.json +41 -41
- package/useAsyncValidator.cjs +8 -2
- package/useAsyncValidator.iife.js +8 -2
- package/useAsyncValidator.iife.min.js +1 -1
- package/useAsyncValidator.mjs +8 -2
- package/useAxios.cjs +4 -3
- package/useAxios.iife.js +4 -3
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +4 -3
- package/useCookies.d.cts +6 -6
- package/useCookies.d.mts +6 -6
- package/useCookies.d.ts +6 -6
- package/useDrauu.cjs +28 -8
- package/useDrauu.iife.js +28 -8
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +28 -8
- package/useFocusTrap.d.cts +0 -3
- package/useFocusTrap.d.mts +0 -3
- package/useFocusTrap.d.ts +0 -3
- package/useFuse.cjs +9 -5
- package/useFuse.iife.js +9 -5
- package/useFuse.iife.min.js +1 -1
- package/useFuse.mjs +9 -5
- package/useJwt.cjs +1 -1
- package/useJwt.d.cts +0 -1
- package/useJwt.d.mts +0 -1
- package/useJwt.d.ts +0 -1
- package/useJwt.iife.js +1 -1
- package/useJwt.iife.min.js +1 -1
- package/useJwt.mjs +1 -1
- package/useSortable.cjs +4 -4
- package/useSortable.iife.js +4 -4
- package/useSortable.iife.min.js +1 -1
- package/useSortable.mjs +4 -4
package/index.cjs
CHANGED
|
@@ -27,8 +27,14 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
27
27
|
const errorInfo = vueDemi.shallowRef(null);
|
|
28
28
|
const isFinished = vueDemi.ref(true);
|
|
29
29
|
const pass = vueDemi.ref(!immediate || manual);
|
|
30
|
-
const errors = vueDemi.computed(() =>
|
|
31
|
-
|
|
30
|
+
const errors = vueDemi.computed(() => {
|
|
31
|
+
var _a;
|
|
32
|
+
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
33
|
+
});
|
|
34
|
+
const errorFields = vueDemi.computed(() => {
|
|
35
|
+
var _a;
|
|
36
|
+
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
37
|
+
});
|
|
32
38
|
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
33
39
|
const execute = async () => {
|
|
34
40
|
isFinished.value = false;
|
|
@@ -86,7 +92,7 @@ function useAxios(...args) {
|
|
|
86
92
|
immediate: !!argsPlaceholder,
|
|
87
93
|
shallow: true
|
|
88
94
|
};
|
|
89
|
-
const isAxiosInstance = (val) => !!val
|
|
95
|
+
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
|
90
96
|
if (args.length > 0 + argsPlaceholder) {
|
|
91
97
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
92
98
|
instance = args[0 + argsPlaceholder];
|
|
@@ -142,7 +148,7 @@ function useAxios(...args) {
|
|
|
142
148
|
let executeCounter = 0;
|
|
143
149
|
const execute = (executeUrl = url, config = {}) => {
|
|
144
150
|
error.value = void 0;
|
|
145
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
151
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
|
146
152
|
if (_url === void 0) {
|
|
147
153
|
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
|
148
154
|
isFinished.value = true;
|
|
@@ -162,7 +168,8 @@ function useAxios(...args) {
|
|
|
162
168
|
error.value = e;
|
|
163
169
|
onError(e);
|
|
164
170
|
}).finally(() => {
|
|
165
|
-
|
|
171
|
+
var _a;
|
|
172
|
+
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
166
173
|
if (currentExecuteCounter === executeCounter)
|
|
167
174
|
loading(false);
|
|
168
175
|
});
|
|
@@ -291,7 +298,8 @@ function useDrauu(target, options) {
|
|
|
291
298
|
cornerRadius: 0,
|
|
292
299
|
dasharray: void 0,
|
|
293
300
|
fill: "transparent",
|
|
294
|
-
mode: "draw"
|
|
301
|
+
mode: "draw",
|
|
302
|
+
...options == null ? void 0 : options.brush
|
|
295
303
|
});
|
|
296
304
|
vueDemi.watch(brush, () => {
|
|
297
305
|
const instance = drauuInstance.value;
|
|
@@ -300,15 +308,34 @@ function useDrauu(target, options) {
|
|
|
300
308
|
instance.mode = brush.value.mode;
|
|
301
309
|
}
|
|
302
310
|
}, { deep: true });
|
|
303
|
-
const undo = () =>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
|
|
311
|
+
const undo = () => {
|
|
312
|
+
var _a;
|
|
313
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
|
|
314
|
+
};
|
|
315
|
+
const redo = () => {
|
|
316
|
+
var _a;
|
|
317
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
|
|
318
|
+
};
|
|
319
|
+
const clear = () => {
|
|
320
|
+
var _a;
|
|
321
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
|
|
322
|
+
};
|
|
323
|
+
const cancel = () => {
|
|
324
|
+
var _a;
|
|
325
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
|
|
326
|
+
};
|
|
327
|
+
const load = (svg) => {
|
|
328
|
+
var _a;
|
|
329
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
|
|
330
|
+
};
|
|
331
|
+
const dump = () => {
|
|
332
|
+
var _a;
|
|
333
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
|
|
334
|
+
};
|
|
309
335
|
const cleanup = () => {
|
|
336
|
+
var _a;
|
|
310
337
|
disposables.forEach((dispose) => dispose());
|
|
311
|
-
drauuInstance.value
|
|
338
|
+
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
|
|
312
339
|
};
|
|
313
340
|
const syncStatus = () => {
|
|
314
341
|
if (drauuInstance.value) {
|
|
@@ -415,14 +442,18 @@ function useFocusTrap(target, options = {}) {
|
|
|
415
442
|
|
|
416
443
|
function useFuse(search, data, options) {
|
|
417
444
|
const createFuse = () => {
|
|
445
|
+
var _a, _b;
|
|
418
446
|
return new Fuse(
|
|
419
|
-
shared.toValue(data)
|
|
420
|
-
shared.toValue(options)
|
|
447
|
+
(_a = shared.toValue(data)) != null ? _a : [],
|
|
448
|
+
(_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
|
|
421
449
|
);
|
|
422
450
|
};
|
|
423
451
|
const fuse = vueDemi.ref(createFuse());
|
|
424
452
|
vueDemi.watch(
|
|
425
|
-
() =>
|
|
453
|
+
() => {
|
|
454
|
+
var _a;
|
|
455
|
+
return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
|
456
|
+
},
|
|
426
457
|
() => {
|
|
427
458
|
fuse.value = createFuse();
|
|
428
459
|
},
|
|
@@ -437,9 +468,9 @@ function useFuse(search, data, options) {
|
|
|
437
468
|
);
|
|
438
469
|
const results = vueDemi.computed(() => {
|
|
439
470
|
const resolved = shared.toValue(options);
|
|
440
|
-
if (resolved
|
|
471
|
+
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
|
|
441
472
|
return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
442
|
-
const limit = resolved
|
|
473
|
+
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
|
443
474
|
return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
|
|
444
475
|
});
|
|
445
476
|
return {
|
|
@@ -518,7 +549,7 @@ function useJwt(encodedJwt, options = {}) {
|
|
|
518
549
|
try {
|
|
519
550
|
return jwt_decode(encodedJwt2, options2);
|
|
520
551
|
} catch (err) {
|
|
521
|
-
onError
|
|
552
|
+
onError == null ? void 0 : onError(err);
|
|
522
553
|
return fallbackValue;
|
|
523
554
|
}
|
|
524
555
|
};
|
|
@@ -583,17 +614,17 @@ function useSortable(el, list, options = {}) {
|
|
|
583
614
|
}
|
|
584
615
|
};
|
|
585
616
|
const start = () => {
|
|
586
|
-
const target = typeof el === "string" ? document
|
|
617
|
+
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
|
|
587
618
|
if (!target)
|
|
588
619
|
return;
|
|
589
620
|
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
|
590
621
|
};
|
|
591
|
-
const stop = () => sortable
|
|
622
|
+
const stop = () => sortable == null ? void 0 : sortable.destroy();
|
|
592
623
|
const option = (name, value) => {
|
|
593
624
|
if (value !== void 0)
|
|
594
|
-
sortable
|
|
625
|
+
sortable == null ? void 0 : sortable.option(name, value);
|
|
595
626
|
else
|
|
596
|
-
return sortable
|
|
627
|
+
return sortable == null ? void 0 : sortable.option(name);
|
|
597
628
|
};
|
|
598
629
|
core.tryOnMounted(start);
|
|
599
630
|
core.tryOnScopeDispose(stop);
|
package/index.d.cts
CHANGED
|
@@ -170,7 +170,7 @@ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCase
|
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* Creates a new {@link useCookies} function
|
|
173
|
-
* @param
|
|
173
|
+
* @param req - incoming http request (for SSR)
|
|
174
174
|
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
|
175
175
|
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
|
176
176
|
*/
|
|
@@ -193,11 +193,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
|
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
195
|
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
|
196
|
-
* @param
|
|
197
|
-
* @param
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
196
|
+
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
|
197
|
+
* @param options
|
|
198
|
+
* @param options.doNotParse - don't try parse value as JSON
|
|
199
|
+
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
|
200
|
+
* @param cookies - universal-cookie instance
|
|
201
201
|
*/
|
|
202
202
|
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
203
203
|
doNotParse?: boolean | undefined;
|
|
@@ -290,9 +290,6 @@ interface UseFocusTrapReturn {
|
|
|
290
290
|
* Reactive focus-trap
|
|
291
291
|
*
|
|
292
292
|
* @see https://vueuse.org/useFocusTrap
|
|
293
|
-
* @param target The target element to trap focus within
|
|
294
|
-
* @param options Focus trap options
|
|
295
|
-
* @param autoFocus Focus trap automatically when mounted
|
|
296
293
|
*/
|
|
297
294
|
declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
|
298
295
|
|
|
@@ -374,7 +371,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
|
|
|
374
371
|
* Reactive decoded jwt token.
|
|
375
372
|
*
|
|
376
373
|
* @see https://vueuse.org/useJwt
|
|
377
|
-
* @param jwt
|
|
378
374
|
*/
|
|
379
375
|
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
|
|
380
376
|
|
package/index.d.mts
CHANGED
|
@@ -170,7 +170,7 @@ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCase
|
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* Creates a new {@link useCookies} function
|
|
173
|
-
* @param
|
|
173
|
+
* @param req - incoming http request (for SSR)
|
|
174
174
|
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
|
175
175
|
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
|
176
176
|
*/
|
|
@@ -193,11 +193,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
|
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
195
|
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
|
196
|
-
* @param
|
|
197
|
-
* @param
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
196
|
+
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
|
197
|
+
* @param options
|
|
198
|
+
* @param options.doNotParse - don't try parse value as JSON
|
|
199
|
+
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
|
200
|
+
* @param cookies - universal-cookie instance
|
|
201
201
|
*/
|
|
202
202
|
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
203
203
|
doNotParse?: boolean | undefined;
|
|
@@ -290,9 +290,6 @@ interface UseFocusTrapReturn {
|
|
|
290
290
|
* Reactive focus-trap
|
|
291
291
|
*
|
|
292
292
|
* @see https://vueuse.org/useFocusTrap
|
|
293
|
-
* @param target The target element to trap focus within
|
|
294
|
-
* @param options Focus trap options
|
|
295
|
-
* @param autoFocus Focus trap automatically when mounted
|
|
296
293
|
*/
|
|
297
294
|
declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
|
298
295
|
|
|
@@ -374,7 +371,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
|
|
|
374
371
|
* Reactive decoded jwt token.
|
|
375
372
|
*
|
|
376
373
|
* @see https://vueuse.org/useJwt
|
|
377
|
-
* @param jwt
|
|
378
374
|
*/
|
|
379
375
|
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
|
|
380
376
|
|
package/index.d.ts
CHANGED
|
@@ -170,7 +170,7 @@ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCase
|
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* Creates a new {@link useCookies} function
|
|
173
|
-
* @param
|
|
173
|
+
* @param req - incoming http request (for SSR)
|
|
174
174
|
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
|
175
175
|
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
|
176
176
|
*/
|
|
@@ -193,11 +193,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
|
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
195
|
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
|
196
|
-
* @param
|
|
197
|
-
* @param
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
196
|
+
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
|
197
|
+
* @param options
|
|
198
|
+
* @param options.doNotParse - don't try parse value as JSON
|
|
199
|
+
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
|
200
|
+
* @param cookies - universal-cookie instance
|
|
201
201
|
*/
|
|
202
202
|
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
203
203
|
doNotParse?: boolean | undefined;
|
|
@@ -290,9 +290,6 @@ interface UseFocusTrapReturn {
|
|
|
290
290
|
* Reactive focus-trap
|
|
291
291
|
*
|
|
292
292
|
* @see https://vueuse.org/useFocusTrap
|
|
293
|
-
* @param target The target element to trap focus within
|
|
294
|
-
* @param options Focus trap options
|
|
295
|
-
* @param autoFocus Focus trap automatically when mounted
|
|
296
293
|
*/
|
|
297
294
|
declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
|
298
295
|
|
|
@@ -374,7 +371,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
|
|
|
374
371
|
* Reactive decoded jwt token.
|
|
375
372
|
*
|
|
376
373
|
* @see https://vueuse.org/useJwt
|
|
377
|
-
* @param jwt
|
|
378
374
|
*/
|
|
379
375
|
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
|
|
380
376
|
|
package/index.iife.js
CHANGED
|
@@ -128,8 +128,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
128
128
|
const errorInfo = vueDemi.shallowRef(null);
|
|
129
129
|
const isFinished = vueDemi.ref(true);
|
|
130
130
|
const pass = vueDemi.ref(!immediate || manual);
|
|
131
|
-
const errors = vueDemi.computed(() =>
|
|
132
|
-
|
|
131
|
+
const errors = vueDemi.computed(() => {
|
|
132
|
+
var _a;
|
|
133
|
+
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
134
|
+
});
|
|
135
|
+
const errorFields = vueDemi.computed(() => {
|
|
136
|
+
var _a;
|
|
137
|
+
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
138
|
+
});
|
|
133
139
|
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
134
140
|
const execute = async () => {
|
|
135
141
|
isFinished.value = false;
|
|
@@ -187,7 +193,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
187
193
|
immediate: !!argsPlaceholder,
|
|
188
194
|
shallow: true
|
|
189
195
|
};
|
|
190
|
-
const isAxiosInstance = (val) => !!val
|
|
196
|
+
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
|
191
197
|
if (args.length > 0 + argsPlaceholder) {
|
|
192
198
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
193
199
|
instance = args[0 + argsPlaceholder];
|
|
@@ -243,7 +249,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
243
249
|
let executeCounter = 0;
|
|
244
250
|
const execute = (executeUrl = url, config = {}) => {
|
|
245
251
|
error.value = void 0;
|
|
246
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
252
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
|
247
253
|
if (_url === void 0) {
|
|
248
254
|
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
|
249
255
|
isFinished.value = true;
|
|
@@ -263,7 +269,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
263
269
|
error.value = e;
|
|
264
270
|
onError(e);
|
|
265
271
|
}).finally(() => {
|
|
266
|
-
|
|
272
|
+
var _a;
|
|
273
|
+
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
267
274
|
if (currentExecuteCounter === executeCounter)
|
|
268
275
|
loading(false);
|
|
269
276
|
});
|
|
@@ -392,7 +399,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
392
399
|
cornerRadius: 0,
|
|
393
400
|
dasharray: void 0,
|
|
394
401
|
fill: "transparent",
|
|
395
|
-
mode: "draw"
|
|
402
|
+
mode: "draw",
|
|
403
|
+
...options == null ? void 0 : options.brush
|
|
396
404
|
});
|
|
397
405
|
vueDemi.watch(brush, () => {
|
|
398
406
|
const instance = drauuInstance.value;
|
|
@@ -401,15 +409,34 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
401
409
|
instance.mode = brush.value.mode;
|
|
402
410
|
}
|
|
403
411
|
}, { deep: true });
|
|
404
|
-
const undo = () =>
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
|
|
412
|
+
const undo = () => {
|
|
413
|
+
var _a;
|
|
414
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
|
|
415
|
+
};
|
|
416
|
+
const redo = () => {
|
|
417
|
+
var _a;
|
|
418
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
|
|
419
|
+
};
|
|
420
|
+
const clear = () => {
|
|
421
|
+
var _a;
|
|
422
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
|
|
423
|
+
};
|
|
424
|
+
const cancel = () => {
|
|
425
|
+
var _a;
|
|
426
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
|
|
427
|
+
};
|
|
428
|
+
const load = (svg) => {
|
|
429
|
+
var _a;
|
|
430
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
|
|
431
|
+
};
|
|
432
|
+
const dump = () => {
|
|
433
|
+
var _a;
|
|
434
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
|
|
435
|
+
};
|
|
410
436
|
const cleanup = () => {
|
|
437
|
+
var _a;
|
|
411
438
|
disposables.forEach((dispose) => dispose());
|
|
412
|
-
drauuInstance.value
|
|
439
|
+
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
|
|
413
440
|
};
|
|
414
441
|
const syncStatus = () => {
|
|
415
442
|
if (drauuInstance.value) {
|
|
@@ -516,14 +543,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
516
543
|
|
|
517
544
|
function useFuse(search, data, options) {
|
|
518
545
|
const createFuse = () => {
|
|
546
|
+
var _a, _b;
|
|
519
547
|
return new Fuse(
|
|
520
|
-
shared.toValue(data)
|
|
521
|
-
shared.toValue(options)
|
|
548
|
+
(_a = shared.toValue(data)) != null ? _a : [],
|
|
549
|
+
(_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
|
|
522
550
|
);
|
|
523
551
|
};
|
|
524
552
|
const fuse = vueDemi.ref(createFuse());
|
|
525
553
|
vueDemi.watch(
|
|
526
|
-
() =>
|
|
554
|
+
() => {
|
|
555
|
+
var _a;
|
|
556
|
+
return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
|
557
|
+
},
|
|
527
558
|
() => {
|
|
528
559
|
fuse.value = createFuse();
|
|
529
560
|
},
|
|
@@ -538,9 +569,9 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
538
569
|
);
|
|
539
570
|
const results = vueDemi.computed(() => {
|
|
540
571
|
const resolved = shared.toValue(options);
|
|
541
|
-
if (resolved
|
|
572
|
+
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
|
|
542
573
|
return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
543
|
-
const limit = resolved
|
|
574
|
+
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
|
544
575
|
return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
|
|
545
576
|
});
|
|
546
577
|
return {
|
|
@@ -619,7 +650,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
619
650
|
try {
|
|
620
651
|
return jwt_decode(encodedJwt2, options2);
|
|
621
652
|
} catch (err) {
|
|
622
|
-
onError
|
|
653
|
+
onError == null ? void 0 : onError(err);
|
|
623
654
|
return fallbackValue;
|
|
624
655
|
}
|
|
625
656
|
};
|
|
@@ -684,17 +715,17 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
684
715
|
}
|
|
685
716
|
};
|
|
686
717
|
const start = () => {
|
|
687
|
-
const target = typeof el === "string" ? document
|
|
718
|
+
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
|
|
688
719
|
if (!target)
|
|
689
720
|
return;
|
|
690
721
|
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
|
691
722
|
};
|
|
692
|
-
const stop = () => sortable
|
|
723
|
+
const stop = () => sortable == null ? void 0 : sortable.destroy();
|
|
693
724
|
const option = (name, value) => {
|
|
694
725
|
if (value !== void 0)
|
|
695
|
-
sortable
|
|
726
|
+
sortable == null ? void 0 : sortable.option(name, value);
|
|
696
727
|
else
|
|
697
|
-
return sortable
|
|
728
|
+
return sortable == null ? void 0 : sortable.option(name);
|
|
698
729
|
};
|
|
699
730
|
core.tryOnMounted(start);
|
|
700
731
|
core.tryOnScopeDispose(stop);
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(a,o,m){if(a.install)return a;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),a;if(o.version.slice(0,4)==="2.7."){let v=function(b,k){var p,j={},N={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(E,L){return j[E]=L,this},directive:function(E,L){return L?(o.directive(E,L),N):o.directive(E)},mount:function(E,L){return p||(p=new o(Object.assign({propsData:k},b,{provide:Object.assign(j,b.provide)})),p.$mount(E,L),p)},unmount:function(){p&&(p.$destroy(),p=void 0)}};return N};var U=v;for(var n in o)a[n]=o[n];a.isVue2=!0,a.isVue3=!1,a.install=function(){},a.Vue=o,a.Vue2=o,a.version=o.version,a.warn=o.util.warn,a.hasInjectionContext=()=>!!a.getCurrentInstance(),a.createApp=v}else if(o.version.slice(0,2)==="2.")if(m){for(var n in m)a[n]=m[n];a.isVue2=!0,a.isVue3=!1,a.install=function(){},a.Vue=o,a.Vue2=o,a.version=o.version,a.hasInjectionContext=()=>!!a.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var n in o)a[n]=o[n];a.isVue2=!1,a.isVue3=!0,a.install=function(){},a.Vue=o,a.Vue2=void 0,a.version=o.version,a.set=function(v,b,k){return Array.isArray(v)?(v.length=Math.max(v.length,b),v.splice(b,1,k),k):(v[b]=k,k)},a.del=function(v,b){if(Array.isArray(v)){v.splice(b,1);return}delete v[b]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return a}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(a,o,m,n,U,v,b,k,p,j,N,E,L,R,V,$){"use strict";const D=m.default||m;function ee(t,r,e={}){const{validateOption:s={},immediate:l=!0,manual:c=!1}=e,i=o.toRef(t),f=n.shallowRef(null),u=n.ref(!0),d=n.ref(!l||c),C=n.computed(()=>f.value?.errors||[]),w=n.computed(()=>f.value?.fields||{}),F=n.computed(()=>new D(o.toValue(r))),g=async()=>{u.value=!1,d.value=!1;try{await F.value.validate(i.value,s),d.value=!0,f.value=null}catch(h){f.value=h}finally{u.value=!0}return{pass:d.value,errorInfo:f.value,errors:C.value,errorFields:w.value}};c||n.watch([i,F],()=>g(),{immediate:l,deep:!0});const I={isFinished:u,pass:d,errors:C,errorInfo:f,errorFields:w,execute:g};function S(){return new Promise((h,P)=>{o.until(u).toBe(!0).then(()=>h(I)).catch(O=>P(O))})}return{...I,then(h,P){return S().then(h,P)}}}function te(...t){const r=typeof t[0]=="string"?t[0]:void 0,e=typeof r=="string"?1:0;let s={},l=U,c={immediate:!!e,shallow:!0};const i=y=>!!y?.request;t.length>0+e&&(i(t[0+e])?l=t[0+e]:s=t[0+e]),t.length>1+e&&i(t[1+e])&&(l=t[1+e]),(t.length===2+e&&!i(t[1+e])||t.length===3+e)&&(c=t[t.length-1]);const{initialData:f,shallow:u,onSuccess:d=o.noop,onError:C=o.noop,immediate:w,resetOnExecute:F=!1}=c,g=n.shallowRef(),I=(u?n.shallowRef:n.ref)(f),S=n.ref(!1),h=n.ref(!1),P=n.ref(!1),O=n.shallowRef(),B=U.CancelToken.source;let H=B();const T=y=>{S.value||!h.value||(H.cancel(y),H=B(),P.value=!0,h.value=!1,S.value=!1)},A=y=>{h.value=y,S.value=!y},W=()=>{F&&(I.value=f)},q=()=>new Promise((y,G)=>{o.until(S).toBe(!0).then(()=>O.value?G(O.value):y(Y))}),J={then:(...y)=>q().then(...y),catch:(...y)=>q().catch(...y)};let Q=0;const X=(y=r,G={})=>{O.value=void 0;const Z=typeof y=="string"?y:r??G.url;if(Z===void 0)return O.value=new U.AxiosError(U.AxiosError.ERR_INVALID_URL),S.value=!0,J;W(),T(),A(!0),Q+=1;const ve=Q;return l(Z,{...s,...typeof y=="object"?y:G,cancelToken:H.token}).then(_=>{g.value=_;const K=_.data;I.value=K,d(K)}).catch(_=>{O.value=_,C(_)}).finally(()=>{c.onFinish?.(),ve===Q&&A(!1)}),J};w&&r&&X();const Y={response:g,data:I,error:O,isFinished:S,isLoading:h,cancel:T,isAborted:P,isCanceled:P,abort:T,execute:X};return{...Y,...J}}var x=Object.freeze({__proto__:null,camelCase:v.camelCase,capitalCase:v.capitalCase,constantCase:v.constantCase,dotCase:v.dotCase,headerCase:v.headerCase,noCase:v.noCase,paramCase:v.paramCase,pascalCase:v.pascalCase,pathCase:v.pathCase,sentenceCase:v.sentenceCase,snakeCase:v.snakeCase});function ne(t,r,e){if(typeof t=="function")return n.computed(()=>x[r](o.toValue(t),e));const s=n.ref(t);return n.computed({get(){return x[r](s.value,e)},set(l){s.value=l}})}function oe(t){const r=new b(t?t.headers.cookie:null);return(e,{doNotParse:s=!1,autoUpdateDependencies:l=!1}={})=>z(e,{doNotParse:s,autoUpdateDependencies:l},r)}function z(t,{doNotParse:r=!1,autoUpdateDependencies:e=!1}={},s=new b){const l=e?[...t||[]]:t;let c=s.getAll({doNotParse:!0});const i=n.ref(0),f=()=>{const u=s.getAll({doNotParse:!0});ae(l||null,u,c)&&i.value++,c=u};return s.addChangeListener(f),o.tryOnScopeDispose(()=>{s.removeChangeListener(f)}),{get:(...u)=>(e&&l&&!l.includes(u[0])&&l.push(u[0]),i.value,s.get(u[0],{doNotParse:r,...u[1]})),getAll:(...u)=>(i.value,s.getAll({doNotParse:r,...u[0]})),set:(...u)=>s.set(...u),remove:(...u)=>s.remove(...u),addChangeListener:(...u)=>s.addChangeListener(...u),removeChangeListener:(...u)=>s.removeChangeListener(...u)}}function ae(t,r,e){if(!t)return!0;for(const s of t)if(r[s]!==e[s])return!0;return!1}function se(t,r){const e=n.ref();let s=[];const l=p.createEventHook(),c=p.createEventHook(),i=p.createEventHook(),f=p.createEventHook(),u=p.createEventHook(),d=n.ref(!1),C=n.ref(!1),w=n.ref(!1),F=n.ref(!1),g=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});n.watch(g,()=>{const A=e.value;A&&(A.brush=g.value,A.mode=g.value.mode)},{deep:!0});const I=()=>e.value?.undo(),S=()=>e.value?.redo(),h=()=>e.value?.clear(),P=()=>e.value?.cancel(),O=A=>e.value?.load(A),B=()=>e.value?.dump(),H=()=>{s.forEach(A=>A()),e.value?.unmount()},T=()=>{e.value&&(d.value=e.value.canUndo(),C.value=e.value.canRedo(),w.value=e.value.altPressed,F.value=e.value.shiftPressed)};return n.watch(()=>p.unrefElement(t),A=>{!A||typeof SVGSVGElement>"u"||!(A instanceof SVGSVGElement)||(e.value&&H(),e.value=k.createDrauu({el:A,...r}),T(),s=[e.value.on("canceled",()=>c.trigger()),e.value.on("committed",W=>i.trigger(W)),e.value.on("start",()=>f.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{T(),l.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>H()),{drauuInstance:e,load:O,dump:B,clear:h,cancel:P,undo:I,redo:S,canUndo:d,canRedo:C,brush:g,onChanged:l.on,onCommitted:i.on,onStart:f.on,onEnd:u.on,onCanceled:c.on}}function re(t,r={}){let e;const{immediate:s,...l}=r,c=n.ref(!1),i=n.ref(!1),f=w=>e&&e.activate(w),u=w=>e&&e.deactivate(w),d=()=>{e&&(e.pause(),i.value=!0)},C=()=>{e&&(e.unpause(),i.value=!1)};return n.watch(()=>p.unrefElement(t),w=>{w&&(e=j.createFocusTrap(w,{...l,onActivate(){c.value=!0,r.onActivate&&r.onActivate()},onDeactivate(){c.value=!1,r.onDeactivate&&r.onDeactivate()}}),s&&f())},{flush:"post"}),p.tryOnScopeDispose(()=>u()),{hasFocus:c,isPaused:i,activate:f,deactivate:u,pause:d,unpause:C}}function le(t,r,e){const s=()=>new N(o.toValue(r)??[],o.toValue(e)?.fuseOptions),l=n.ref(s());n.watch(()=>o.toValue(e)?.fuseOptions,()=>{l.value=s()},{deep:!0}),n.watch(()=>o.toValue(r),i=>{l.value.setCollection(i)},{deep:!0});const c=n.computed(()=>{const i=o.toValue(e);if(i?.matchAllWhenSearchEmpty&&!o.toValue(t))return o.toValue(r).map((u,d)=>({item:u,refIndex:d}));const f=i?.resultLimit;return l.value.search(o.toValue(t),f?{limit:f}:void 0)});return{fuse:l,results:c}}function ue(t,r,e={}){const{flush:s="pre",deep:l=!0,shallow:c=!1,onError:i=h=>{console.error(h)},writeDefaults:f=!0}=e,u=n.ref(!1),d=(c?n.shallowRef:n.ref)(r),C=o.toValue(r);async function w(){try{const h=await E.get(t);h===void 0?C!=null&&f&&await E.set(t,C):d.value=h}catch(h){i(h)}u.value=!0}w();async function F(){try{d.value==null?await E.del(t):Array.isArray(d.value)?await E.update(t,()=>JSON.parse(JSON.stringify(d.value))):typeof d.value=="object"?await E.update(t,()=>({...d.value})):await E.update(t,()=>d.value)}catch(h){i(h)}}const{pause:g,resume:I}=p.watchPausable(d,()=>F(),{flush:s,deep:l});async function S(h){g(),d.value=h,await F(),I()}return{set:S,isFinished:u,data:d}}function ce(t,r={}){const{onError:e,fallbackValue:s=null}=r,l=(f,u)=>{try{return L(f,u)}catch(d){return e?.(d),s}},c=n.computed(()=>l(o.toValue(t),{header:!0})),i=n.computed(()=>l(o.toValue(t)));return{header:c,payload:i}}function ie(t=null,r){const e=n.ref(t),s=n.computed({set:c=>c?R.start():R.done(),get:()=>typeof e.value=="number"&&e.value<1});r&&R.configure(r);const l=R.set;return R.set=c=>(e.value=c,l.call(R,c)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&l.call(R,e.value)}),o.tryOnScopeDispose(R.remove),{isLoading:s,progress:e,start:R.start,done:R.done,remove:()=>{e.value=null,R.remove()}}}function fe(t,r){const e=o.toRef(t),s=n.ref("");return n.watch(e,async l=>{e.value&&o.isClient&&(s.value=await V.toDataURL(l,r))},{immediate:!0}),s}function de(t,r,e={}){let s;const{document:l=p.defaultDocument,...c}=e,i={onUpdate:C=>{M(r,C.oldIndex,C.newIndex)}},f=()=>{const C=typeof t=="string"?l?.querySelector(t):p.unrefElement(t);C&&(s=new $(C,{...i,...c}))},u=()=>s?.destroy(),d=(C,w)=>{if(w!==void 0)s?.option(C,w);else return s?.option(C)};return p.tryOnMounted(f),p.tryOnScopeDispose(u),{stop:u,start:f,option:d}}function M(t,r,e){const s=n.isRef(t),l=s?[...p.toValue(t)]:p.toValue(t);if(e>=0&&e<l.length){const c=l.splice(r,1)[0];n.nextTick(()=>{l.splice(e,0,c),s&&(t.value=l)})}}a.createCookies=oe,a.moveArrayElement=M,a.useAsyncValidator=ee,a.useAxios=te,a.useChangeCase=ne,a.useCookies=z,a.useDrauu=se,a.useFocusTrap=re,a.useFuse=le,a.useIDBKeyval=ue,a.useJwt=ce,a.useNProgress=ie,a.useQRCode=fe,a.useSortable=de})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
|
|
1
|
+
var VueDemi=function(l,o,H){if(l.install)return l;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),l;if(o.version.slice(0,4)==="2.7."){let h=function(b,P){var C,N={},B={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(E,k){return N[E]=k,this},directive:function(E,k){return k?(o.directive(E,k),B):o.directive(E)},mount:function(E,k){return C||(C=new o(Object.assign({propsData:P},b,{provide:Object.assign(N,b.provide)})),C.$mount(E,k),C)},unmount:function(){C&&(C.$destroy(),C=void 0)}};return B};var j=h;for(var n in o)l[n]=o[n];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.warn=o.util.warn,l.hasInjectionContext=()=>!!l.getCurrentInstance(),l.createApp=h}else if(o.version.slice(0,2)==="2.")if(H){for(var n in H)l[n]=H[n];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.hasInjectionContext=()=>!!l.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var n in o)l[n]=o[n];l.isVue2=!1,l.isVue3=!0,l.install=function(){},l.Vue=o,l.Vue2=void 0,l.version=o.version,l.set=function(h,b,P){return Array.isArray(h)?(h.length=Math.max(h.length,b),h.splice(b,1,P),P):(h[b]=P,P)},l.del=function(h,b){if(Array.isArray(h)){h.splice(b,1);return}delete h[b]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return l}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(l,o,H,n,j,h,b,P,C,N,B,E,k,S,V,$){"use strict";const D=H.default||H;function ee(t,r,e={}){const{validateOption:a={},immediate:s=!0,manual:i=!1}=e,c=o.toRef(t),f=n.shallowRef(null),u=n.ref(!0),p=n.ref(!s||i),w=n.computed(()=>{var v;return((v=f.value)==null?void 0:v.errors)||[]}),y=n.computed(()=>{var v;return((v=f.value)==null?void 0:v.fields)||{}}),O=n.computed(()=>new D(o.toValue(r))),_=async()=>{u.value=!1,p.value=!1;try{await O.value.validate(c.value,a),p.value=!0,f.value=null}catch(v){f.value=v}finally{u.value=!0}return{pass:p.value,errorInfo:f.value,errors:w.value,errorFields:y.value}};i||n.watch([c,O],()=>_(),{immediate:s,deep:!0});const R={isFinished:u,pass:p,errors:w,errorInfo:f,errorFields:y,execute:_};function g(){return new Promise((v,F)=>{o.until(u).toBe(!0).then(()=>v(R)).catch(I=>F(I))})}return{...R,then(v,F){return g().then(v,F)}}}function te(...t){const r=typeof t[0]=="string"?t[0]:void 0,e=typeof r=="string"?1:0;let a={},s=j,i={immediate:!!e,shallow:!0};const c=A=>!!A?.request;t.length>0+e&&(c(t[0+e])?s=t[0+e]:a=t[0+e]),t.length>1+e&&c(t[1+e])&&(s=t[1+e]),(t.length===2+e&&!c(t[1+e])||t.length===3+e)&&(i=t[t.length-1]);const{initialData:f,shallow:u,onSuccess:p=o.noop,onError:w=o.noop,immediate:y,resetOnExecute:O=!1}=i,_=n.shallowRef(),R=(u?n.shallowRef:n.ref)(f),g=n.ref(!1),v=n.ref(!1),F=n.ref(!1),I=n.shallowRef(),G=j.CancelToken.source;let T=G();const U=A=>{g.value||!v.value||(T.cancel(A),T=G(),F.value=!0,v.value=!1,g.value=!1)},d=A=>{v.value=A,g.value=!A},L=()=>{O&&(R.value=f)},q=()=>new Promise((A,W)=>{o.until(g).toBe(!0).then(()=>I.value?W(I.value):A(Y))}),J={then:(...A)=>q().then(...A),catch:(...A)=>q().catch(...A)};let Q=0;const X=(A=r,W={})=>{I.value=void 0;const Z=typeof A=="string"?A:r??W.url;if(Z===void 0)return I.value=new j.AxiosError(j.AxiosError.ERR_INVALID_URL),g.value=!0,J;L(),U(),d(!0),Q+=1;const ve=Q;return s(Z,{...a,...typeof A=="object"?A:W,cancelToken:T.token}).then(m=>{_.value=m;const K=m.data;R.value=K,p(K)}).catch(m=>{I.value=m,w(m)}).finally(()=>{var m;(m=i.onFinish)==null||m.call(i),ve===Q&&d(!1)}),J};y&&r&&X();const Y={response:_,data:R,error:I,isFinished:g,isLoading:v,cancel:U,isAborted:F,isCanceled:F,abort:U,execute:X};return{...Y,...J}}var x=Object.freeze({__proto__:null,camelCase:h.camelCase,capitalCase:h.capitalCase,constantCase:h.constantCase,dotCase:h.dotCase,headerCase:h.headerCase,noCase:h.noCase,paramCase:h.paramCase,pascalCase:h.pascalCase,pathCase:h.pathCase,sentenceCase:h.sentenceCase,snakeCase:h.snakeCase});function ne(t,r,e){if(typeof t=="function")return n.computed(()=>x[r](o.toValue(t),e));const a=n.ref(t);return n.computed({get(){return x[r](a.value,e)},set(s){a.value=s}})}function oe(t){const r=new b(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:s=!1}={})=>z(e,{doNotParse:a,autoUpdateDependencies:s},r)}function z(t,{doNotParse:r=!1,autoUpdateDependencies:e=!1}={},a=new b){const s=e?[...t||[]]:t;let i=a.getAll({doNotParse:!0});const c=n.ref(0),f=()=>{const u=a.getAll({doNotParse:!0});ae(s||null,u,i)&&c.value++,i=u};return a.addChangeListener(f),o.tryOnScopeDispose(()=>{a.removeChangeListener(f)}),{get:(...u)=>(e&&s&&!s.includes(u[0])&&s.push(u[0]),c.value,a.get(u[0],{doNotParse:r,...u[1]})),getAll:(...u)=>(c.value,a.getAll({doNotParse:r,...u[0]})),set:(...u)=>a.set(...u),remove:(...u)=>a.remove(...u),addChangeListener:(...u)=>a.addChangeListener(...u),removeChangeListener:(...u)=>a.removeChangeListener(...u)}}function ae(t,r,e){if(!t)return!0;for(const a of t)if(r[a]!==e[a])return!0;return!1}function le(t,r){const e=n.ref();let a=[];const s=C.createEventHook(),i=C.createEventHook(),c=C.createEventHook(),f=C.createEventHook(),u=C.createEventHook(),p=n.ref(!1),w=n.ref(!1),y=n.ref(!1),O=n.ref(!1),_=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...r?.brush});n.watch(_,()=>{const d=e.value;d&&(d.brush=_.value,d.mode=_.value.mode)},{deep:!0});const R=()=>{var d;return(d=e.value)==null?void 0:d.undo()},g=()=>{var d;return(d=e.value)==null?void 0:d.redo()},v=()=>{var d;return(d=e.value)==null?void 0:d.clear()},F=()=>{var d;return(d=e.value)==null?void 0:d.cancel()},I=d=>{var L;return(L=e.value)==null?void 0:L.load(d)},G=()=>{var d;return(d=e.value)==null?void 0:d.dump()},T=()=>{var d;a.forEach(L=>L()),(d=e.value)==null||d.unmount()},U=()=>{e.value&&(p.value=e.value.canUndo(),w.value=e.value.canRedo(),y.value=e.value.altPressed,O.value=e.value.shiftPressed)};return n.watch(()=>C.unrefElement(t),d=>{!d||typeof SVGSVGElement>"u"||!(d instanceof SVGSVGElement)||(e.value&&T(),e.value=P.createDrauu({el:d,...r}),U(),a=[e.value.on("canceled",()=>i.trigger()),e.value.on("committed",L=>c.trigger(L)),e.value.on("start",()=>f.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{U(),s.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>T()),{drauuInstance:e,load:I,dump:G,clear:v,cancel:F,undo:R,redo:g,canUndo:p,canRedo:w,brush:_,onChanged:s.on,onCommitted:c.on,onStart:f.on,onEnd:u.on,onCanceled:i.on}}function re(t,r={}){let e;const{immediate:a,...s}=r,i=n.ref(!1),c=n.ref(!1),f=y=>e&&e.activate(y),u=y=>e&&e.deactivate(y),p=()=>{e&&(e.pause(),c.value=!0)},w=()=>{e&&(e.unpause(),c.value=!1)};return n.watch(()=>C.unrefElement(t),y=>{y&&(e=N.createFocusTrap(y,{...s,onActivate(){i.value=!0,r.onActivate&&r.onActivate()},onDeactivate(){i.value=!1,r.onDeactivate&&r.onDeactivate()}}),a&&f())},{flush:"post"}),C.tryOnScopeDispose(()=>u()),{hasFocus:i,isPaused:c,activate:f,deactivate:u,pause:p,unpause:w}}function se(t,r,e){const a=()=>{var c,f;return new B((c=o.toValue(r))!=null?c:[],(f=o.toValue(e))==null?void 0:f.fuseOptions)},s=n.ref(a());n.watch(()=>{var c;return(c=o.toValue(e))==null?void 0:c.fuseOptions},()=>{s.value=a()},{deep:!0}),n.watch(()=>o.toValue(r),c=>{s.value.setCollection(c)},{deep:!0});const i=n.computed(()=>{const c=o.toValue(e);if(c?.matchAllWhenSearchEmpty&&!o.toValue(t))return o.toValue(r).map((u,p)=>({item:u,refIndex:p}));const f=c?.resultLimit;return s.value.search(o.toValue(t),f?{limit:f}:void 0)});return{fuse:s,results:i}}function ue(t,r,e={}){const{flush:a="pre",deep:s=!0,shallow:i=!1,onError:c=v=>{console.error(v)},writeDefaults:f=!0}=e,u=n.ref(!1),p=(i?n.shallowRef:n.ref)(r),w=o.toValue(r);async function y(){try{const v=await E.get(t);v===void 0?w!=null&&f&&await E.set(t,w):p.value=v}catch(v){c(v)}u.value=!0}y();async function O(){try{p.value==null?await E.del(t):Array.isArray(p.value)?await E.update(t,()=>JSON.parse(JSON.stringify(p.value))):typeof p.value=="object"?await E.update(t,()=>({...p.value})):await E.update(t,()=>p.value)}catch(v){c(v)}}const{pause:_,resume:R}=C.watchPausable(p,()=>O(),{flush:a,deep:s});async function g(v){_(),p.value=v,await O(),R()}return{set:g,isFinished:u,data:p}}function ce(t,r={}){const{onError:e,fallbackValue:a=null}=r,s=(f,u)=>{try{return k(f,u)}catch(p){return e?.(p),a}},i=n.computed(()=>s(o.toValue(t),{header:!0})),c=n.computed(()=>s(o.toValue(t)));return{header:i,payload:c}}function ie(t=null,r){const e=n.ref(t),a=n.computed({set:i=>i?S.start():S.done(),get:()=>typeof e.value=="number"&&e.value<1});r&&S.configure(r);const s=S.set;return S.set=i=>(e.value=i,s.call(S,i)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&s.call(S,e.value)}),o.tryOnScopeDispose(S.remove),{isLoading:a,progress:e,start:S.start,done:S.done,remove:()=>{e.value=null,S.remove()}}}function fe(t,r){const e=o.toRef(t),a=n.ref("");return n.watch(e,async s=>{e.value&&o.isClient&&(a.value=await V.toDataURL(s,r))},{immediate:!0}),a}function de(t,r,e={}){let a;const{document:s=C.defaultDocument,...i}=e,c={onUpdate:w=>{M(r,w.oldIndex,w.newIndex)}},f=()=>{const w=typeof t=="string"?s?.querySelector(t):C.unrefElement(t);w&&(a=new $(w,{...c,...i}))},u=()=>a?.destroy(),p=(w,y)=>{if(y!==void 0)a?.option(w,y);else return a?.option(w)};return C.tryOnMounted(f),C.tryOnScopeDispose(u),{stop:u,start:f,option:p}}function M(t,r,e){const a=n.isRef(t),s=a?[...C.toValue(t)]:C.toValue(t);if(e>=0&&e<s.length){const i=s.splice(r,1)[0];n.nextTick(()=>{s.splice(e,0,i),a&&(t.value=s)})}}l.createCookies=oe,l.moveArrayElement=M,l.useAsyncValidator=ee,l.useAxios=te,l.useChangeCase=ne,l.useCookies=z,l.useDrauu=le,l.useFocusTrap=re,l.useFuse=se,l.useIDBKeyval=ue,l.useJwt=ce,l.useNProgress=ie,l.useQRCode=fe,l.useSortable=de})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
|
package/index.mjs
CHANGED
|
@@ -25,8 +25,14 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
25
25
|
const errorInfo = shallowRef(null);
|
|
26
26
|
const isFinished = ref(true);
|
|
27
27
|
const pass = ref(!immediate || manual);
|
|
28
|
-
const errors = computed(() =>
|
|
29
|
-
|
|
28
|
+
const errors = computed(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
31
|
+
});
|
|
32
|
+
const errorFields = computed(() => {
|
|
33
|
+
var _a;
|
|
34
|
+
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
35
|
+
});
|
|
30
36
|
const validator = computed(() => new AsyncValidatorSchema(toValue(rules)));
|
|
31
37
|
const execute = async () => {
|
|
32
38
|
isFinished.value = false;
|
|
@@ -84,7 +90,7 @@ function useAxios(...args) {
|
|
|
84
90
|
immediate: !!argsPlaceholder,
|
|
85
91
|
shallow: true
|
|
86
92
|
};
|
|
87
|
-
const isAxiosInstance = (val) => !!val
|
|
93
|
+
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
|
88
94
|
if (args.length > 0 + argsPlaceholder) {
|
|
89
95
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
90
96
|
instance = args[0 + argsPlaceholder];
|
|
@@ -140,7 +146,7 @@ function useAxios(...args) {
|
|
|
140
146
|
let executeCounter = 0;
|
|
141
147
|
const execute = (executeUrl = url, config = {}) => {
|
|
142
148
|
error.value = void 0;
|
|
143
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
149
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
|
144
150
|
if (_url === void 0) {
|
|
145
151
|
error.value = new AxiosError(AxiosError.ERR_INVALID_URL);
|
|
146
152
|
isFinished.value = true;
|
|
@@ -160,7 +166,8 @@ function useAxios(...args) {
|
|
|
160
166
|
error.value = e;
|
|
161
167
|
onError(e);
|
|
162
168
|
}).finally(() => {
|
|
163
|
-
|
|
169
|
+
var _a;
|
|
170
|
+
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
164
171
|
if (currentExecuteCounter === executeCounter)
|
|
165
172
|
loading(false);
|
|
166
173
|
});
|
|
@@ -289,7 +296,8 @@ function useDrauu(target, options) {
|
|
|
289
296
|
cornerRadius: 0,
|
|
290
297
|
dasharray: void 0,
|
|
291
298
|
fill: "transparent",
|
|
292
|
-
mode: "draw"
|
|
299
|
+
mode: "draw",
|
|
300
|
+
...options == null ? void 0 : options.brush
|
|
293
301
|
});
|
|
294
302
|
watch(brush, () => {
|
|
295
303
|
const instance = drauuInstance.value;
|
|
@@ -298,15 +306,34 @@ function useDrauu(target, options) {
|
|
|
298
306
|
instance.mode = brush.value.mode;
|
|
299
307
|
}
|
|
300
308
|
}, { deep: true });
|
|
301
|
-
const undo = () =>
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
309
|
+
const undo = () => {
|
|
310
|
+
var _a;
|
|
311
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
|
|
312
|
+
};
|
|
313
|
+
const redo = () => {
|
|
314
|
+
var _a;
|
|
315
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
|
|
316
|
+
};
|
|
317
|
+
const clear = () => {
|
|
318
|
+
var _a;
|
|
319
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
|
|
320
|
+
};
|
|
321
|
+
const cancel = () => {
|
|
322
|
+
var _a;
|
|
323
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
|
|
324
|
+
};
|
|
325
|
+
const load = (svg) => {
|
|
326
|
+
var _a;
|
|
327
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
|
|
328
|
+
};
|
|
329
|
+
const dump = () => {
|
|
330
|
+
var _a;
|
|
331
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
|
|
332
|
+
};
|
|
307
333
|
const cleanup = () => {
|
|
334
|
+
var _a;
|
|
308
335
|
disposables.forEach((dispose) => dispose());
|
|
309
|
-
drauuInstance.value
|
|
336
|
+
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
|
|
310
337
|
};
|
|
311
338
|
const syncStatus = () => {
|
|
312
339
|
if (drauuInstance.value) {
|
|
@@ -413,14 +440,18 @@ function useFocusTrap(target, options = {}) {
|
|
|
413
440
|
|
|
414
441
|
function useFuse(search, data, options) {
|
|
415
442
|
const createFuse = () => {
|
|
443
|
+
var _a, _b;
|
|
416
444
|
return new Fuse(
|
|
417
|
-
toValue(data)
|
|
418
|
-
toValue(options)
|
|
445
|
+
(_a = toValue(data)) != null ? _a : [],
|
|
446
|
+
(_b = toValue(options)) == null ? void 0 : _b.fuseOptions
|
|
419
447
|
);
|
|
420
448
|
};
|
|
421
449
|
const fuse = ref(createFuse());
|
|
422
450
|
watch(
|
|
423
|
-
() =>
|
|
451
|
+
() => {
|
|
452
|
+
var _a;
|
|
453
|
+
return (_a = toValue(options)) == null ? void 0 : _a.fuseOptions;
|
|
454
|
+
},
|
|
424
455
|
() => {
|
|
425
456
|
fuse.value = createFuse();
|
|
426
457
|
},
|
|
@@ -435,9 +466,9 @@ function useFuse(search, data, options) {
|
|
|
435
466
|
);
|
|
436
467
|
const results = computed(() => {
|
|
437
468
|
const resolved = toValue(options);
|
|
438
|
-
if (resolved
|
|
469
|
+
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !toValue(search))
|
|
439
470
|
return toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
440
|
-
const limit = resolved
|
|
471
|
+
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
|
441
472
|
return fuse.value.search(toValue(search), limit ? { limit } : void 0);
|
|
442
473
|
});
|
|
443
474
|
return {
|
|
@@ -516,7 +547,7 @@ function useJwt(encodedJwt, options = {}) {
|
|
|
516
547
|
try {
|
|
517
548
|
return jwt_decode(encodedJwt2, options2);
|
|
518
549
|
} catch (err) {
|
|
519
|
-
onError
|
|
550
|
+
onError == null ? void 0 : onError(err);
|
|
520
551
|
return fallbackValue;
|
|
521
552
|
}
|
|
522
553
|
};
|
|
@@ -581,17 +612,17 @@ function useSortable(el, list, options = {}) {
|
|
|
581
612
|
}
|
|
582
613
|
};
|
|
583
614
|
const start = () => {
|
|
584
|
-
const target = typeof el === "string" ? document
|
|
615
|
+
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
|
|
585
616
|
if (!target)
|
|
586
617
|
return;
|
|
587
618
|
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
|
588
619
|
};
|
|
589
|
-
const stop = () => sortable
|
|
620
|
+
const stop = () => sortable == null ? void 0 : sortable.destroy();
|
|
590
621
|
const option = (name, value) => {
|
|
591
622
|
if (value !== void 0)
|
|
592
|
-
sortable
|
|
623
|
+
sortable == null ? void 0 : sortable.option(name, value);
|
|
593
624
|
else
|
|
594
|
-
return sortable
|
|
625
|
+
return sortable == null ? void 0 : sortable.option(name);
|
|
595
626
|
};
|
|
596
627
|
tryOnMounted(start);
|
|
597
628
|
tryOnScopeDispose$1(stop);
|