@vueuse/integrations 11.3.0 → 12.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +47 -47
- package/index.d.cts +3 -3
- package/index.d.mts +3 -3
- package/index.d.ts +3 -3
- package/index.iife.js +48 -175
- package/index.iife.min.js +1 -1
- package/index.mjs +1 -1
- package/package.json +4 -4
- package/useAsyncValidator/component.cjs +10 -10
- package/useAsyncValidator/component.d.cts +1 -1
- package/useAsyncValidator/component.d.mts +1 -1
- package/useAsyncValidator/component.d.ts +1 -1
- package/useAsyncValidator/component.mjs +1 -1
- package/useAsyncValidator.cjs +8 -8
- package/useAsyncValidator.d.cts +1 -1
- package/useAsyncValidator.d.mts +1 -1
- package/useAsyncValidator.d.ts +1 -1
- package/useAsyncValidator.iife.js +9 -136
- package/useAsyncValidator.iife.min.js +1 -1
- package/useAsyncValidator.mjs +1 -1
- package/useAxios.cjs +7 -7
- package/useAxios.d.cts +1 -1
- package/useAxios.d.mts +1 -1
- package/useAxios.d.ts +1 -1
- package/useAxios.iife.js +8 -135
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +1 -1
- package/useChangeCase.cjs +5 -5
- package/useChangeCase.d.cts +1 -1
- package/useChangeCase.d.mts +1 -1
- package/useChangeCase.d.ts +1 -1
- package/useChangeCase.iife.js +6 -133
- package/useChangeCase.iife.min.js +1 -1
- package/useChangeCase.mjs +1 -1
- package/useCookies.cjs +2 -2
- package/useCookies.iife.js +3 -130
- package/useCookies.iife.min.js +1 -1
- package/useCookies.mjs +1 -1
- package/useDrauu.cjs +9 -9
- package/useDrauu.d.cts +1 -1
- package/useDrauu.d.mts +1 -1
- package/useDrauu.d.ts +1 -1
- package/useDrauu.iife.js +10 -137
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +1 -1
- package/useFocusTrap/component.cjs +6 -6
- package/useFocusTrap/component.mjs +1 -1
- package/useFocusTrap.cjs +5 -5
- package/useFocusTrap.d.cts +1 -1
- package/useFocusTrap.d.mts +1 -1
- package/useFocusTrap.d.ts +1 -1
- package/useFocusTrap.iife.js +6 -133
- package/useFocusTrap.iife.min.js +1 -1
- package/useFocusTrap.mjs +1 -1
- package/useFuse.cjs +5 -5
- package/useFuse.d.cts +2 -2
- package/useFuse.d.mts +2 -2
- package/useFuse.d.ts +2 -2
- package/useFuse.iife.js +6 -133
- package/useFuse.iife.min.js +1 -1
- package/useFuse.mjs +1 -1
- package/useIDBKeyval.cjs +4 -4
- package/useIDBKeyval.d.cts +1 -1
- package/useIDBKeyval.d.mts +1 -1
- package/useIDBKeyval.d.ts +1 -1
- package/useIDBKeyval.iife.js +5 -132
- package/useIDBKeyval.iife.min.js +1 -1
- package/useIDBKeyval.mjs +1 -1
- package/useJwt.cjs +3 -3
- package/useJwt.d.cts +1 -1
- package/useJwt.d.mts +1 -1
- package/useJwt.d.ts +1 -1
- package/useJwt.iife.js +4 -131
- package/useJwt.iife.min.js +1 -1
- package/useJwt.mjs +1 -1
- package/useNProgress.cjs +4 -4
- package/useNProgress.d.cts +2 -2
- package/useNProgress.d.mts +2 -2
- package/useNProgress.d.ts +2 -2
- package/useNProgress.iife.js +5 -132
- package/useNProgress.iife.min.js +1 -1
- package/useNProgress.mjs +1 -1
- package/useQRCode.cjs +3 -3
- package/useQRCode.d.cts +1 -1
- package/useQRCode.d.mts +1 -1
- package/useQRCode.d.ts +1 -1
- package/useQRCode.iife.js +4 -131
- package/useQRCode.iife.min.js +1 -1
- package/useQRCode.mjs +1 -1
- package/useSortable/component.cjs +7 -12
- package/useSortable/component.d.cts +1 -1
- package/useSortable/component.d.mts +1 -1
- package/useSortable/component.d.ts +1 -1
- package/useSortable/component.mjs +1 -6
- package/useSortable.cjs +3 -3
- package/useSortable.iife.js +4 -131
- package/useSortable.iife.min.js +1 -1
- package/useSortable.mjs +1 -1
package/index.iife.js
CHANGED
|
@@ -1,131 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
? globalThis
|
|
3
|
-
: typeof global !== 'undefined'
|
|
4
|
-
? global
|
|
5
|
-
: typeof self !== 'undefined'
|
|
6
|
-
? self
|
|
7
|
-
: this
|
|
8
|
-
var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
9
|
-
if (VueDemi.install) {
|
|
10
|
-
return VueDemi
|
|
11
|
-
}
|
|
12
|
-
if (!Vue) {
|
|
13
|
-
console.error('[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.')
|
|
14
|
-
return VueDemi
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Vue 2.7
|
|
18
|
-
if (Vue.version.slice(0, 4) === '2.7.') {
|
|
19
|
-
for (var key in Vue) {
|
|
20
|
-
VueDemi[key] = Vue[key]
|
|
21
|
-
}
|
|
22
|
-
VueDemi.isVue2 = true
|
|
23
|
-
VueDemi.isVue3 = false
|
|
24
|
-
VueDemi.install = function () {}
|
|
25
|
-
VueDemi.Vue = Vue
|
|
26
|
-
VueDemi.Vue2 = Vue
|
|
27
|
-
VueDemi.version = Vue.version
|
|
28
|
-
VueDemi.warn = Vue.util.warn
|
|
29
|
-
VueDemi.hasInjectionContext = function() {
|
|
30
|
-
return !!VueDemi.getCurrentInstance()
|
|
31
|
-
}
|
|
32
|
-
function createApp(rootComponent, rootProps) {
|
|
33
|
-
var vm
|
|
34
|
-
var provide = {}
|
|
35
|
-
var app = {
|
|
36
|
-
config: Vue.config,
|
|
37
|
-
use: Vue.use.bind(Vue),
|
|
38
|
-
mixin: Vue.mixin.bind(Vue),
|
|
39
|
-
component: Vue.component.bind(Vue),
|
|
40
|
-
provide: function (key, value) {
|
|
41
|
-
provide[key] = value
|
|
42
|
-
return this
|
|
43
|
-
},
|
|
44
|
-
directive: function (name, dir) {
|
|
45
|
-
if (dir) {
|
|
46
|
-
Vue.directive(name, dir)
|
|
47
|
-
return app
|
|
48
|
-
} else {
|
|
49
|
-
return Vue.directive(name)
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
mount: function (el, hydrating) {
|
|
53
|
-
if (!vm) {
|
|
54
|
-
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
|
|
55
|
-
vm.$mount(el, hydrating)
|
|
56
|
-
return vm
|
|
57
|
-
} else {
|
|
58
|
-
return vm
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
unmount: function () {
|
|
62
|
-
if (vm) {
|
|
63
|
-
vm.$destroy()
|
|
64
|
-
vm = undefined
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
}
|
|
68
|
-
return app
|
|
69
|
-
}
|
|
70
|
-
VueDemi.createApp = createApp
|
|
71
|
-
}
|
|
72
|
-
// Vue 2.6.x
|
|
73
|
-
else if (Vue.version.slice(0, 2) === '2.') {
|
|
74
|
-
if (VueCompositionAPI) {
|
|
75
|
-
for (var key in VueCompositionAPI) {
|
|
76
|
-
VueDemi[key] = VueCompositionAPI[key]
|
|
77
|
-
}
|
|
78
|
-
VueDemi.isVue2 = true
|
|
79
|
-
VueDemi.isVue3 = false
|
|
80
|
-
VueDemi.install = function () {}
|
|
81
|
-
VueDemi.Vue = Vue
|
|
82
|
-
VueDemi.Vue2 = Vue
|
|
83
|
-
VueDemi.version = Vue.version
|
|
84
|
-
VueDemi.hasInjectionContext = function() {
|
|
85
|
-
return !!VueDemi.getCurrentInstance()
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.')
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// Vue 3
|
|
92
|
-
else if (Vue.version.slice(0, 2) === '3.') {
|
|
93
|
-
for (var key in Vue) {
|
|
94
|
-
VueDemi[key] = Vue[key]
|
|
95
|
-
}
|
|
96
|
-
VueDemi.isVue2 = false
|
|
97
|
-
VueDemi.isVue3 = true
|
|
98
|
-
VueDemi.install = function () {}
|
|
99
|
-
VueDemi.Vue = Vue
|
|
100
|
-
VueDemi.Vue2 = undefined
|
|
101
|
-
VueDemi.version = Vue.version
|
|
102
|
-
VueDemi.set = function (target, key, val) {
|
|
103
|
-
if (Array.isArray(target)) {
|
|
104
|
-
target.length = Math.max(target.length, key)
|
|
105
|
-
target.splice(key, 1, val)
|
|
106
|
-
return val
|
|
107
|
-
}
|
|
108
|
-
target[key] = val
|
|
109
|
-
return val
|
|
110
|
-
}
|
|
111
|
-
VueDemi.del = function (target, key) {
|
|
112
|
-
if (Array.isArray(target)) {
|
|
113
|
-
target.splice(key, 1)
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
delete target[key]
|
|
117
|
-
}
|
|
118
|
-
} else {
|
|
119
|
-
console.error('[vue-demi] Vue version ' + Vue.version + ' is unsupported.')
|
|
120
|
-
}
|
|
121
|
-
return VueDemi
|
|
122
|
-
})(
|
|
123
|
-
(_VueDemiGlobal.VueDemi = _VueDemiGlobal.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
|
|
124
|
-
_VueDemiGlobal.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
|
|
125
|
-
_VueDemiGlobal.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
|
|
126
|
-
);
|
|
127
|
-
;
|
|
128
|
-
;(function (exports, shared, Schema, vueDemi, axios, changeCase, Cookie, core, drauu, focusTrap, Fuse, idbKeyval, jwtDecode, nprogress, QRCode, Sortable) {
|
|
1
|
+
(function (exports, shared, Schema, vue, axios, changeCase, Cookie, core, drauu, focusTrap, Fuse, idbKeyval, jwtDecode, nprogress, QRCode, Sortable) {
|
|
129
2
|
'use strict';
|
|
130
3
|
|
|
131
4
|
function _interopNamespaceDefault(e) {
|
|
@@ -155,18 +28,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
155
28
|
manual = false
|
|
156
29
|
} = options;
|
|
157
30
|
const valueRef = shared.toRef(value);
|
|
158
|
-
const errorInfo =
|
|
159
|
-
const isFinished =
|
|
160
|
-
const pass =
|
|
161
|
-
const errors =
|
|
31
|
+
const errorInfo = vue.shallowRef(null);
|
|
32
|
+
const isFinished = vue.ref(true);
|
|
33
|
+
const pass = vue.ref(!immediate || manual);
|
|
34
|
+
const errors = vue.computed(() => {
|
|
162
35
|
var _a;
|
|
163
36
|
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
164
37
|
});
|
|
165
|
-
const errorFields =
|
|
38
|
+
const errorFields = vue.computed(() => {
|
|
166
39
|
var _a;
|
|
167
40
|
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
168
41
|
});
|
|
169
|
-
const validator =
|
|
42
|
+
const validator = vue.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
170
43
|
const execute = async () => {
|
|
171
44
|
isFinished.value = false;
|
|
172
45
|
pass.value = false;
|
|
@@ -187,7 +60,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
187
60
|
};
|
|
188
61
|
};
|
|
189
62
|
if (!manual) {
|
|
190
|
-
|
|
63
|
+
vue.watch(
|
|
191
64
|
[valueRef, validator],
|
|
192
65
|
() => execute(),
|
|
193
66
|
{ immediate, deep: true }
|
|
@@ -247,12 +120,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
247
120
|
immediate,
|
|
248
121
|
resetOnExecute = false
|
|
249
122
|
} = options;
|
|
250
|
-
const response =
|
|
251
|
-
const data = (shallow ?
|
|
252
|
-
const isFinished =
|
|
253
|
-
const isLoading =
|
|
254
|
-
const isAborted =
|
|
255
|
-
const error =
|
|
123
|
+
const response = vue.shallowRef();
|
|
124
|
+
const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
|
|
125
|
+
const isFinished = vue.ref(false);
|
|
126
|
+
const isLoading = vue.ref(false);
|
|
127
|
+
const isAborted = vue.ref(false);
|
|
128
|
+
const error = vue.shallowRef();
|
|
256
129
|
let abortController = new AbortController();
|
|
257
130
|
const abort = (message) => {
|
|
258
131
|
if (isFinished.value || !isLoading.value)
|
|
@@ -337,16 +210,16 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
337
210
|
return acc;
|
|
338
211
|
}, {});
|
|
339
212
|
function useChangeCase(input, type, options) {
|
|
340
|
-
const typeRef =
|
|
213
|
+
const typeRef = vue.computed(() => {
|
|
341
214
|
const t = shared.toValue(type);
|
|
342
215
|
if (!changeCaseTransforms[t])
|
|
343
216
|
throw new Error(`Invalid change case type "${t}"`);
|
|
344
217
|
return t;
|
|
345
218
|
});
|
|
346
219
|
if (typeof input === "function")
|
|
347
|
-
return
|
|
348
|
-
const text =
|
|
349
|
-
return
|
|
220
|
+
return vue.computed(() => changeCaseTransforms[typeRef.value](shared.toValue(input), shared.toValue(options)));
|
|
221
|
+
const text = vue.ref(input);
|
|
222
|
+
return vue.computed({
|
|
350
223
|
get() {
|
|
351
224
|
return changeCaseTransforms[typeRef.value](text.value, shared.toValue(options));
|
|
352
225
|
},
|
|
@@ -363,7 +236,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
363
236
|
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
|
|
364
237
|
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
|
365
238
|
let previousCookies = cookies.getAll({ doNotParse: true });
|
|
366
|
-
const touches =
|
|
239
|
+
const touches = vue.ref(0);
|
|
367
240
|
const onChange = () => {
|
|
368
241
|
const newCookies = cookies.getAll({ doNotParse: true });
|
|
369
242
|
if (shouldUpdate(
|
|
@@ -413,18 +286,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
413
286
|
}
|
|
414
287
|
|
|
415
288
|
function useDrauu(target, options) {
|
|
416
|
-
const drauuInstance =
|
|
289
|
+
const drauuInstance = vue.ref();
|
|
417
290
|
let disposables = [];
|
|
418
291
|
const onChangedHook = core.createEventHook();
|
|
419
292
|
const onCanceledHook = core.createEventHook();
|
|
420
293
|
const onCommittedHook = core.createEventHook();
|
|
421
294
|
const onStartHook = core.createEventHook();
|
|
422
295
|
const onEndHook = core.createEventHook();
|
|
423
|
-
const canUndo =
|
|
424
|
-
const canRedo =
|
|
425
|
-
const altPressed =
|
|
426
|
-
const shiftPressed =
|
|
427
|
-
const brush =
|
|
296
|
+
const canUndo = vue.ref(false);
|
|
297
|
+
const canRedo = vue.ref(false);
|
|
298
|
+
const altPressed = vue.ref(false);
|
|
299
|
+
const shiftPressed = vue.ref(false);
|
|
300
|
+
const brush = vue.ref({
|
|
428
301
|
color: "black",
|
|
429
302
|
size: 3,
|
|
430
303
|
arrowEnd: false,
|
|
@@ -434,7 +307,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
434
307
|
mode: "draw",
|
|
435
308
|
...options == null ? void 0 : options.brush
|
|
436
309
|
});
|
|
437
|
-
|
|
310
|
+
vue.watch(brush, () => {
|
|
438
311
|
const instance = drauuInstance.value;
|
|
439
312
|
if (instance) {
|
|
440
313
|
instance.brush = brush.value;
|
|
@@ -478,7 +351,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
478
351
|
shiftPressed.value = drauuInstance.value.shiftPressed;
|
|
479
352
|
}
|
|
480
353
|
};
|
|
481
|
-
|
|
354
|
+
vue.watch(
|
|
482
355
|
() => core.unrefElement(target),
|
|
483
356
|
(el) => {
|
|
484
357
|
if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
|
|
@@ -523,8 +396,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
523
396
|
function useFocusTrap(target, options = {}) {
|
|
524
397
|
let trap;
|
|
525
398
|
const { immediate, ...focusTrapOptions } = options;
|
|
526
|
-
const hasFocus =
|
|
527
|
-
const isPaused =
|
|
399
|
+
const hasFocus = vue.ref(false);
|
|
400
|
+
const isPaused = vue.ref(false);
|
|
528
401
|
const activate = (opts) => trap && trap.activate(opts);
|
|
529
402
|
const deactivate = (opts) => trap && trap.deactivate(opts);
|
|
530
403
|
const pause = () => {
|
|
@@ -539,14 +412,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
539
412
|
isPaused.value = false;
|
|
540
413
|
}
|
|
541
414
|
};
|
|
542
|
-
const targets =
|
|
415
|
+
const targets = vue.computed(() => {
|
|
543
416
|
const _targets = shared.toValue(target);
|
|
544
417
|
return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
|
|
545
418
|
const _el = shared.toValue(el);
|
|
546
419
|
return typeof _el === "string" ? _el : core.unrefElement(_el);
|
|
547
420
|
}).filter(shared.notNullish);
|
|
548
421
|
});
|
|
549
|
-
|
|
422
|
+
vue.watch(
|
|
550
423
|
targets,
|
|
551
424
|
(els) => {
|
|
552
425
|
if (!els.length)
|
|
@@ -588,8 +461,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
588
461
|
(_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
|
|
589
462
|
);
|
|
590
463
|
};
|
|
591
|
-
const fuse =
|
|
592
|
-
|
|
464
|
+
const fuse = vue.ref(createFuse());
|
|
465
|
+
vue.watch(
|
|
593
466
|
() => {
|
|
594
467
|
var _a;
|
|
595
468
|
return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
|
@@ -599,14 +472,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
599
472
|
},
|
|
600
473
|
{ deep: true }
|
|
601
474
|
);
|
|
602
|
-
|
|
475
|
+
vue.watch(
|
|
603
476
|
() => shared.toValue(data),
|
|
604
477
|
(newData) => {
|
|
605
478
|
fuse.value.setCollection(newData);
|
|
606
479
|
},
|
|
607
480
|
{ deep: true }
|
|
608
481
|
);
|
|
609
|
-
const results =
|
|
482
|
+
const results = vue.computed(() => {
|
|
610
483
|
const resolved = shared.toValue(options);
|
|
611
484
|
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
|
|
612
485
|
return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
|
@@ -629,8 +502,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
629
502
|
},
|
|
630
503
|
writeDefaults = true
|
|
631
504
|
} = options;
|
|
632
|
-
const isFinished =
|
|
633
|
-
const data = (shallow ?
|
|
505
|
+
const isFinished = vue.ref(false);
|
|
506
|
+
const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
|
|
634
507
|
const rawInit = shared.toValue(initialValue);
|
|
635
508
|
async function read() {
|
|
636
509
|
try {
|
|
@@ -652,7 +525,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
652
525
|
if (data.value == null) {
|
|
653
526
|
await idbKeyval.del(key);
|
|
654
527
|
} else {
|
|
655
|
-
await idbKeyval.update(key, () =>
|
|
528
|
+
await idbKeyval.update(key, () => vue.toRaw(data.value));
|
|
656
529
|
}
|
|
657
530
|
} catch (e) {
|
|
658
531
|
onError(e);
|
|
@@ -688,8 +561,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
688
561
|
return fallbackValue;
|
|
689
562
|
}
|
|
690
563
|
};
|
|
691
|
-
const header =
|
|
692
|
-
const payload =
|
|
564
|
+
const header = vue.computed(() => decodeWithFallback(shared.toValue(encodedJwt), { header: true }));
|
|
565
|
+
const payload = vue.computed(() => decodeWithFallback(shared.toValue(encodedJwt)));
|
|
693
566
|
return {
|
|
694
567
|
header,
|
|
695
568
|
payload
|
|
@@ -697,8 +570,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
697
570
|
}
|
|
698
571
|
|
|
699
572
|
function useNProgress(currentProgress = null, options) {
|
|
700
|
-
const progress =
|
|
701
|
-
const isLoading =
|
|
573
|
+
const progress = vue.ref(currentProgress);
|
|
574
|
+
const isLoading = vue.computed({
|
|
702
575
|
set: (load) => load ? nprogress.start() : nprogress.done(),
|
|
703
576
|
get: () => typeof progress.value === "number" && progress.value < 1
|
|
704
577
|
});
|
|
@@ -709,7 +582,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
709
582
|
progress.value = n;
|
|
710
583
|
return setProgress.call(nprogress, n);
|
|
711
584
|
};
|
|
712
|
-
|
|
585
|
+
vue.watchEffect(() => {
|
|
713
586
|
if (typeof progress.value === "number" && shared.isClient)
|
|
714
587
|
setProgress.call(nprogress, progress.value);
|
|
715
588
|
});
|
|
@@ -728,8 +601,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
728
601
|
|
|
729
602
|
function useQRCode(text, options) {
|
|
730
603
|
const src = shared.toRef(text);
|
|
731
|
-
const result =
|
|
732
|
-
|
|
604
|
+
const result = vue.ref("");
|
|
605
|
+
vue.watch(
|
|
733
606
|
src,
|
|
734
607
|
async (value) => {
|
|
735
608
|
if (src.value && shared.isClient)
|
|
@@ -785,11 +658,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
785
658
|
removeNode(e.item);
|
|
786
659
|
insertNodeAt(e.from, e.item, from);
|
|
787
660
|
}
|
|
788
|
-
const _valueIsRef =
|
|
661
|
+
const _valueIsRef = vue.isRef(list);
|
|
789
662
|
const array = _valueIsRef ? [...core.toValue(list)] : core.toValue(list);
|
|
790
663
|
if (to >= 0 && to < array.length) {
|
|
791
664
|
const element = array.splice(from, 1)[0];
|
|
792
|
-
|
|
665
|
+
vue.nextTick(() => {
|
|
793
666
|
array.splice(to, 0, element);
|
|
794
667
|
if (_valueIsRef)
|
|
795
668
|
list.value = array;
|
|
@@ -814,4 +687,4 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
814
687
|
exports.useQRCode = useQRCode;
|
|
815
688
|
exports.useSortable = useSortable;
|
|
816
689
|
|
|
817
|
-
})(this.VueUse = this.VueUse || {}, VueUse, AsyncValidator,
|
|
690
|
+
})(this.VueUse = this.VueUse || {}, VueUse, AsyncValidator, Vue, axios, changeCase, UniversalCookie, VueUse, Drauu, focusTrap, Fuse, idbKeyval, jwt_decode, nprogress, QRCode, Sortable);
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _VueDemiGlobal=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this,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 g=function(_,w){var I,B={},G={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(O,F){return B[O]=F,this},directive:function(O,F){return F?(o.directive(O,F),G):o.directive(O)},mount:function(O,F){return I||(I=new o(Object.assign({propsData:w},_,{provide:Object.assign(B,_.provide)})),I.$mount(O,F),I)},unmount:function(){I&&(I.$destroy(),I=void 0)}};return G};var k=g;for(var r in o)l[r]=o[r];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=function(){return!!l.getCurrentInstance()},l.createApp=g}else if(o.version.slice(0,2)==="2.")if(H){for(var r in H)l[r]=H[r];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.hasInjectionContext=function(){return!!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 r in o)l[r]=o[r];l.isVue2=!1,l.isVue3=!0,l.install=function(){},l.Vue=o,l.Vue2=void 0,l.version=o.version,l.set=function(g,_,w){return Array.isArray(g)?(g.length=Math.max(g.length,_),g.splice(_,1,w),w):(g[_]=w,w)},l.del=function(g,_){if(Array.isArray(g)){g.splice(_,1);return}delete g[_]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return l}(_VueDemiGlobal.VueDemi=_VueDemiGlobal.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),_VueDemiGlobal.Vue||(typeof Vue<"u"?Vue:void 0),_VueDemiGlobal.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(l,o,H,r,k,g,_,w,I,B,G,O,F,R,D,ee){"use strict";function te(t){var a=Object.create(null);return t&&Object.keys(t).forEach(function(e){if(e!=="default"){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}}),a.default=t,Object.freeze(a)}var ne=te(g);const oe=H.default||H;function re(t,a,e={}){const{validateOption:n={},immediate:u=!0,manual:i=!1}=e,s=o.toRef(t),f=r.shallowRef(null),c=r.ref(!0),p=r.ref(!u||i),h=r.computed(()=>{var d;return((d=f.value)==null?void 0:d.errors)||[]}),b=r.computed(()=>{var d;return((d=f.value)==null?void 0:d.fields)||{}}),y=r.computed(()=>new oe(o.toValue(a))),A=async()=>{c.value=!1,p.value=!1;try{await y.value.validate(s.value,n),p.value=!0,f.value=null}catch(d){f.value=d}finally{c.value=!0}return{pass:p.value,errorInfo:f.value,errors:h.value,errorFields:b.value}};i||r.watch([s,y],()=>A(),{immediate:u,deep:!0});const E={isFinished:c,pass:p,errors:h,errorInfo:f,errorFields:b,execute:A};function S(){return new Promise((d,P)=>{o.until(c).toBe(!0).then(()=>d(E)).catch(m=>P(m))})}return{...E,then(d,P){return S().then(d,P)}}}function ae(...t){const a=typeof t[0]=="string"?t[0]:void 0,e=typeof a=="string"?1:0,n={immediate:!!e,shallow:!0,abortPrevious:!0};let u={},i=k,s=n;const f=C=>!!C?.request;t.length>0+e&&(f(t[0+e])?i=t[0+e]:u=t[0+e]),t.length>1+e&&f(t[1+e])&&(i=t[1+e]),(t.length===2+e&&!f(t[1+e])||t.length===3+e)&&(s=t[t.length-1]||n);const{initialData:c,shallow:p,onSuccess:h=o.noop,onError:b=o.noop,immediate:y,resetOnExecute:A=!1}=s,E=r.shallowRef(),S=(p?r.shallowRef:r.ref)(c),d=r.ref(!1),P=r.ref(!1),m=r.ref(!1),j=r.shallowRef();let T=new AbortController;const U=C=>{d.value||!P.value||(T.abort(C),T=new AbortController,m.value=!0,P.value=!1,d.value=!1)},v=C=>{P.value=C,d.value=!C},L=()=>{A&&(S.value=c)},K=()=>new Promise((C,W)=>{o.until(d).toBe(!0).then(()=>j.value?W(j.value):C(Y))}),$={then:(...C)=>K().then(...C),catch:(...C)=>K().catch(...C)};let z=0;const X=(C=a,W={})=>{j.value=void 0;const Z=typeof C=="string"?C:a??W.url;if(Z===void 0)return j.value=new k.AxiosError(k.AxiosError.ERR_INVALID_URL),d.value=!0,$;L(),s.abortPrevious!==!1&&U(),v(!0),z+=1;const ye=z;return m.value=!1,i(Z,{...u,...typeof C=="object"?C:W,signal:T.signal}).then(N=>{if(m.value)return;E.value=N;const V=N.data;S.value=V,h(V)}).catch(N=>{j.value=N,b(N)}).finally(()=>{var N;(N=s.onFinish)==null||N.call(s),ye===z&&v(!1)}),$};y&&a&&X();const Y={response:E,data:S,error:j,isFinished:d,isLoading:P,cancel:U,isAborted:m,isCanceled:m,abort:U,execute:X};return{...Y,...$}}const Q=Object.entries(ne).filter(([t,a])=>typeof a=="function"&&t.endsWith("Case")).reduce((t,[a,e])=>(t[a]=e,t),{});function le(t,a,e){const n=r.computed(()=>{const i=o.toValue(a);if(!Q[i])throw new Error(`Invalid change case type "${i}"`);return i});if(typeof t=="function")return r.computed(()=>Q[n.value](o.toValue(t),o.toValue(e)));const u=r.ref(t);return r.computed({get(){return Q[n.value](u.value,o.toValue(e))},set(i){u.value=i}})}function ue(t){const a=new _(t?t.headers.cookie:null);return(e,{doNotParse:n=!1,autoUpdateDependencies:u=!1}={})=>M(e,{doNotParse:n,autoUpdateDependencies:u},a)}function M(t,{doNotParse:a=!1,autoUpdateDependencies:e=!1}={},n=new _){const u=e?[...t||[]]:t;let i=n.getAll({doNotParse:!0});const s=r.ref(0),f=()=>{const c=n.getAll({doNotParse:!0});se(u||null,c,i)&&s.value++,i=c};return n.addChangeListener(f),o.tryOnScopeDispose(()=>{n.removeChangeListener(f)}),{get:(...c)=>(e&&u&&!u.includes(c[0])&&u.push(c[0]),s.value,n.get(c[0],{doNotParse:a,...c[1]})),getAll:(...c)=>(s.value,n.getAll({doNotParse:a,...c[0]})),set:(...c)=>n.set(...c),remove:(...c)=>n.remove(...c),addChangeListener:(...c)=>n.addChangeListener(...c),removeChangeListener:(...c)=>n.removeChangeListener(...c)}}function se(t,a,e){if(!t)return!0;for(const n of t)if(a[n]!==e[n])return!0;return!1}function ce(t,a){const e=r.ref();let n=[];const u=w.createEventHook(),i=w.createEventHook(),s=w.createEventHook(),f=w.createEventHook(),c=w.createEventHook(),p=r.ref(!1),h=r.ref(!1),b=r.ref(!1),y=r.ref(!1),A=r.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...a?.brush});r.watch(A,()=>{const v=e.value;v&&(v.brush=A.value,v.mode=A.value.mode)},{deep:!0});const E=()=>{var v;return(v=e.value)==null?void 0:v.undo()},S=()=>{var v;return(v=e.value)==null?void 0:v.redo()},d=()=>{var v;return(v=e.value)==null?void 0:v.clear()},P=()=>{var v;return(v=e.value)==null?void 0:v.cancel()},m=v=>{var L;return(L=e.value)==null?void 0:L.load(v)},j=()=>{var v;return(v=e.value)==null?void 0:v.dump()},T=()=>{var v;n.forEach(L=>L()),(v=e.value)==null||v.unmount()},U=()=>{e.value&&(p.value=e.value.canUndo(),h.value=e.value.canRedo(),b.value=e.value.altPressed,y.value=e.value.shiftPressed)};return r.watch(()=>w.unrefElement(t),v=>{!v||typeof SVGSVGElement>"u"||!(v instanceof SVGSVGElement)||(e.value&&T(),e.value=I.createDrauu({el:v,...a}),U(),n=[e.value.on("canceled",()=>i.trigger()),e.value.on("committed",L=>s.trigger(L)),e.value.on("start",()=>f.trigger()),e.value.on("end",()=>c.trigger()),e.value.on("changed",()=>{U(),u.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>T()),{drauuInstance:e,load:m,dump:j,clear:d,cancel:P,undo:E,redo:S,canUndo:p,canRedo:h,brush:A,onChanged:u.on,onCommitted:s.on,onStart:f.on,onEnd:c.on,onCanceled:i.on}}function ie(t,a={}){let e;const{immediate:n,...u}=a,i=r.ref(!1),s=r.ref(!1),f=y=>e&&e.activate(y),c=y=>e&&e.deactivate(y),p=()=>{e&&(e.pause(),s.value=!0)},h=()=>{e&&(e.unpause(),s.value=!1)},b=r.computed(()=>{const y=o.toValue(t);return(Array.isArray(y)?y:[y]).map(A=>{const E=o.toValue(A);return typeof E=="string"?E:w.unrefElement(E)}).filter(o.notNullish)});return r.watch(b,y=>{y.length&&(e=B.createFocusTrap(y,{...u,onActivate(){i.value=!0,a.onActivate&&a.onActivate()},onDeactivate(){i.value=!1,a.onDeactivate&&a.onDeactivate()}}),n&&f())},{flush:"post"}),w.tryOnScopeDispose(()=>c()),{hasFocus:i,isPaused:s,activate:f,deactivate:c,pause:p,unpause:h}}function fe(t,a,e){const n=()=>{var s,f;return new G((s=o.toValue(a))!=null?s:[],(f=o.toValue(e))==null?void 0:f.fuseOptions)},u=r.ref(n());r.watch(()=>{var s;return(s=o.toValue(e))==null?void 0:s.fuseOptions},()=>{u.value=n()},{deep:!0}),r.watch(()=>o.toValue(a),s=>{u.value.setCollection(s)},{deep:!0});const i=r.computed(()=>{const s=o.toValue(e);if(s?.matchAllWhenSearchEmpty&&!o.toValue(t))return o.toValue(a).map((c,p)=>({item:c,refIndex:p}));const f=s?.resultLimit;return u.value.search(o.toValue(t),f?{limit:f}:void 0)});return{fuse:u,results:i}}function de(t,a,e={}){const{flush:n="pre",deep:u=!0,shallow:i=!1,onError:s=d=>{console.error(d)},writeDefaults:f=!0}=e,c=r.ref(!1),p=(i?r.shallowRef:r.ref)(a),h=o.toValue(a);async function b(){try{const d=await O.get(t);d===void 0?h!=null&&f&&await O.set(t,h):p.value=d}catch(d){s(d)}c.value=!0}b();async function y(){try{p.value==null?await O.del(t):await O.update(t,()=>r.toRaw(p.value))}catch(d){s(d)}}const{pause:A,resume:E}=w.watchPausable(p,()=>y(),{flush:n,deep:u});async function S(d){A(),p.value=d,await y(),E()}return{set:S,isFinished:c,data:p}}function ve(t,a={}){const{onError:e,fallbackValue:n=null}=a,u=(f,c)=>{try{return F.jwtDecode(f,c)}catch(p){return e?.(p),n}},i=r.computed(()=>u(o.toValue(t),{header:!0})),s=r.computed(()=>u(o.toValue(t)));return{header:i,payload:s}}function pe(t=null,a){const e=r.ref(t),n=r.computed({set:i=>i?R.start():R.done(),get:()=>typeof e.value=="number"&&e.value<1});a&&R.configure(a);const u=R.set;return R.set=i=>(e.value=i,u.call(R,i)),r.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&u.call(R,e.value)}),o.tryOnScopeDispose(R.remove),{isLoading:n,progress:e,start:R.start,done:R.done,remove:()=>{e.value=null,R.remove()}}}function he(t,a){const e=o.toRef(t),n=r.ref("");return r.watch(e,async u=>{e.value&&o.isClient&&(n.value=await D.toDataURL(u,a))},{immediate:!0}),n}function we(t,a,e={}){let n;const{document:u=w.defaultDocument,...i}=e,s={onUpdate:h=>{J(a,h.oldIndex,h.newIndex,h)}},f=()=>{const h=typeof t=="string"?u?.querySelector(t):w.unrefElement(t);!h||n!==void 0||(n=new ee(h,{...s,...i}))},c=()=>{n?.destroy(),n=void 0},p=(h,b)=>{if(b!==void 0)n?.option(h,b);else return n?.option(h)};return w.tryOnMounted(f),w.tryOnScopeDispose(c),{stop:c,start:f,option:p}}function q(t,a,e){const n=t.children[e];t.insertBefore(a,n)}function x(t){t.parentNode&&t.parentNode.removeChild(t)}function J(t,a,e,n=null){n!=null&&(x(n.item),q(n.from,n.item,a));const u=r.isRef(t),i=u?[...w.toValue(t)]:w.toValue(t);if(e>=0&&e<i.length){const s=i.splice(a,1)[0];r.nextTick(()=>{i.splice(e,0,s),u&&(t.value=i)})}}l.createCookies=ue,l.insertNodeAt=q,l.moveArrayElement=J,l.removeNode=x,l.useAsyncValidator=re,l.useAxios=ae,l.useChangeCase=le,l.useCookies=M,l.useDrauu=ce,l.useFocusTrap=ie,l.useFuse=fe,l.useIDBKeyval=de,l.useJwt=ve,l.useNProgress=pe,l.useQRCode=he,l.useSortable=we})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,VueUse,Drauu,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
|
|
1
|
+
(function(w,f,U,a,L,$,k,y,K,X,Y,P,Z,b,x,ee){"use strict";function te(t){var o=Object.create(null);return t&&Object.keys(t).forEach(function(e){if(e!=="default"){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(o,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}}),o.default=t,Object.freeze(o)}var ne=te($);const oe=U.default||U;function ae(t,o,e={}){const{validateOption:n={},immediate:l=!0,manual:s=!1}=e,u=f.toRef(t),c=a.shallowRef(null),r=a.ref(!0),v=a.ref(!l||s),m=a.computed(()=>{var i;return((i=c.value)==null?void 0:i.errors)||[]}),C=a.computed(()=>{var i;return((i=c.value)==null?void 0:i.fields)||{}}),h=a.computed(()=>new oe(f.toValue(o))),g=async()=>{r.value=!1,v.value=!1;try{await h.value.validate(u.value,n),v.value=!0,c.value=null}catch(i){c.value=i}finally{r.value=!0}return{pass:v.value,errorInfo:c.value,errors:m.value,errorFields:C.value}};s||a.watch([u,h],()=>g(),{immediate:l,deep:!0});const V={isFinished:r,pass:v,errors:m,errorInfo:c,errorFields:C,execute:g};function A(){return new Promise((i,E)=>{f.until(r).toBe(!0).then(()=>i(V)).catch(D=>E(D))})}return{...V,then(i,E){return A().then(i,E)}}}function le(...t){const o=typeof t[0]=="string"?t[0]:void 0,e=typeof o=="string"?1:0,n={immediate:!!e,shallow:!0,abortPrevious:!0};let l={},s=L,u=n;const c=p=>!!p?.request;t.length>0+e&&(c(t[0+e])?s=t[0+e]:l=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)&&(u=t[t.length-1]||n);const{initialData:r,shallow:v,onSuccess:m=f.noop,onError:C=f.noop,immediate:h,resetOnExecute:g=!1}=u,V=a.shallowRef(),A=(v?a.shallowRef:a.ref)(r),i=a.ref(!1),E=a.ref(!1),D=a.ref(!1),_=a.shallowRef();let S=new AbortController;const F=p=>{i.value||!E.value||(S.abort(p),S=new AbortController,D.value=!0,E.value=!1,i.value=!1)},d=p=>{E.value=p,i.value=!p},R=()=>{g&&(A.value=r)},Q=()=>new Promise((p,I)=>{f.until(i).toBe(!0).then(()=>_.value?I(_.value):p(q))}),H={then:(...p)=>Q().then(...p),catch:(...p)=>Q().catch(...p)};let j=0;const z=(p=o,I={})=>{_.value=void 0;const J=typeof p=="string"?p:o??I.url;if(J===void 0)return _.value=new L.AxiosError(L.AxiosError.ERR_INVALID_URL),i.value=!0,H;R(),u.abortPrevious!==!1&&F(),d(!0),j+=1;const we=j;return D.value=!1,s(J,{...l,...typeof p=="object"?p:I,signal:S.signal}).then(O=>{if(D.value)return;V.value=O;const M=O.data;A.value=M,m(M)}).catch(O=>{_.value=O,C(O)}).finally(()=>{var O;(O=u.onFinish)==null||O.call(u),we===j&&d(!1)}),H};h&&o&&z();const q={response:V,data:A,error:_,isFinished:i,isLoading:E,cancel:F,isAborted:D,isCanceled:D,abort:F,execute:z};return{...q,...H}}const N=Object.entries(ne).filter(([t,o])=>typeof o=="function"&&t.endsWith("Case")).reduce((t,[o,e])=>(t[o]=e,t),{});function ue(t,o,e){const n=a.computed(()=>{const s=f.toValue(o);if(!N[s])throw new Error(`Invalid change case type "${s}"`);return s});if(typeof t=="function")return a.computed(()=>N[n.value](f.toValue(t),f.toValue(e)));const l=a.ref(t);return a.computed({get(){return N[n.value](l.value,f.toValue(e))},set(s){l.value=s}})}function re(t){const o=new k(t?t.headers.cookie:null);return(e,{doNotParse:n=!1,autoUpdateDependencies:l=!1}={})=>T(e,{doNotParse:n,autoUpdateDependencies:l},o)}function T(t,{doNotParse:o=!1,autoUpdateDependencies:e=!1}={},n=new k){const l=e?[...t||[]]:t;let s=n.getAll({doNotParse:!0});const u=a.ref(0),c=()=>{const r=n.getAll({doNotParse:!0});se(l||null,r,s)&&u.value++,s=r};return n.addChangeListener(c),f.tryOnScopeDispose(()=>{n.removeChangeListener(c)}),{get:(...r)=>(e&&l&&!l.includes(r[0])&&l.push(r[0]),u.value,n.get(r[0],{doNotParse:o,...r[1]})),getAll:(...r)=>(u.value,n.getAll({doNotParse:o,...r[0]})),set:(...r)=>n.set(...r),remove:(...r)=>n.remove(...r),addChangeListener:(...r)=>n.addChangeListener(...r),removeChangeListener:(...r)=>n.removeChangeListener(...r)}}function se(t,o,e){if(!t)return!0;for(const n of t)if(o[n]!==e[n])return!0;return!1}function ce(t,o){const e=a.ref();let n=[];const l=y.createEventHook(),s=y.createEventHook(),u=y.createEventHook(),c=y.createEventHook(),r=y.createEventHook(),v=a.ref(!1),m=a.ref(!1),C=a.ref(!1),h=a.ref(!1),g=a.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...o?.brush});a.watch(g,()=>{const d=e.value;d&&(d.brush=g.value,d.mode=g.value.mode)},{deep:!0});const V=()=>{var d;return(d=e.value)==null?void 0:d.undo()},A=()=>{var d;return(d=e.value)==null?void 0:d.redo()},i=()=>{var d;return(d=e.value)==null?void 0:d.clear()},E=()=>{var d;return(d=e.value)==null?void 0:d.cancel()},D=d=>{var R;return(R=e.value)==null?void 0:R.load(d)},_=()=>{var d;return(d=e.value)==null?void 0:d.dump()},S=()=>{var d;n.forEach(R=>R()),(d=e.value)==null||d.unmount()},F=()=>{e.value&&(v.value=e.value.canUndo(),m.value=e.value.canRedo(),C.value=e.value.altPressed,h.value=e.value.shiftPressed)};return a.watch(()=>y.unrefElement(t),d=>{!d||typeof SVGSVGElement>"u"||!(d instanceof SVGSVGElement)||(e.value&&S(),e.value=K.createDrauu({el:d,...o}),F(),n=[e.value.on("canceled",()=>s.trigger()),e.value.on("committed",R=>u.trigger(R)),e.value.on("start",()=>c.trigger()),e.value.on("end",()=>r.trigger()),e.value.on("changed",()=>{F(),l.trigger()})])},{flush:"post"}),f.tryOnScopeDispose(()=>S()),{drauuInstance:e,load:D,dump:_,clear:i,cancel:E,undo:V,redo:A,canUndo:v,canRedo:m,brush:g,onChanged:l.on,onCommitted:u.on,onStart:c.on,onEnd:r.on,onCanceled:s.on}}function ie(t,o={}){let e;const{immediate:n,...l}=o,s=a.ref(!1),u=a.ref(!1),c=h=>e&&e.activate(h),r=h=>e&&e.deactivate(h),v=()=>{e&&(e.pause(),u.value=!0)},m=()=>{e&&(e.unpause(),u.value=!1)},C=a.computed(()=>{const h=f.toValue(t);return(Array.isArray(h)?h:[h]).map(g=>{const V=f.toValue(g);return typeof V=="string"?V:y.unrefElement(V)}).filter(f.notNullish)});return a.watch(C,h=>{h.length&&(e=X.createFocusTrap(h,{...l,onActivate(){s.value=!0,o.onActivate&&o.onActivate()},onDeactivate(){s.value=!1,o.onDeactivate&&o.onDeactivate()}}),n&&c())},{flush:"post"}),y.tryOnScopeDispose(()=>r()),{hasFocus:s,isPaused:u,activate:c,deactivate:r,pause:v,unpause:m}}function fe(t,o,e){const n=()=>{var u,c;return new Y((u=f.toValue(o))!=null?u:[],(c=f.toValue(e))==null?void 0:c.fuseOptions)},l=a.ref(n());a.watch(()=>{var u;return(u=f.toValue(e))==null?void 0:u.fuseOptions},()=>{l.value=n()},{deep:!0}),a.watch(()=>f.toValue(o),u=>{l.value.setCollection(u)},{deep:!0});const s=a.computed(()=>{const u=f.toValue(e);if(u?.matchAllWhenSearchEmpty&&!f.toValue(t))return f.toValue(o).map((r,v)=>({item:r,refIndex:v}));const c=u?.resultLimit;return l.value.search(f.toValue(t),c?{limit:c}:void 0)});return{fuse:l,results:s}}function de(t,o,e={}){const{flush:n="pre",deep:l=!0,shallow:s=!1,onError:u=i=>{console.error(i)},writeDefaults:c=!0}=e,r=a.ref(!1),v=(s?a.shallowRef:a.ref)(o),m=f.toValue(o);async function C(){try{const i=await P.get(t);i===void 0?m!=null&&c&&await P.set(t,m):v.value=i}catch(i){u(i)}r.value=!0}C();async function h(){try{v.value==null?await P.del(t):await P.update(t,()=>a.toRaw(v.value))}catch(i){u(i)}}const{pause:g,resume:V}=y.watchPausable(v,()=>h(),{flush:n,deep:l});async function A(i){g(),v.value=i,await h(),V()}return{set:A,isFinished:r,data:v}}function ve(t,o={}){const{onError:e,fallbackValue:n=null}=o,l=(c,r)=>{try{return Z.jwtDecode(c,r)}catch(v){return e?.(v),n}},s=a.computed(()=>l(f.toValue(t),{header:!0})),u=a.computed(()=>l(f.toValue(t)));return{header:s,payload:u}}function me(t=null,o){const e=a.ref(t),n=a.computed({set:s=>s?b.start():b.done(),get:()=>typeof e.value=="number"&&e.value<1});o&&b.configure(o);const l=b.set;return b.set=s=>(e.value=s,l.call(b,s)),a.watchEffect(()=>{typeof e.value=="number"&&f.isClient&&l.call(b,e.value)}),f.tryOnScopeDispose(b.remove),{isLoading:n,progress:e,start:b.start,done:b.done,remove:()=>{e.value=null,b.remove()}}}function he(t,o){const e=f.toRef(t),n=a.ref("");return a.watch(e,async l=>{e.value&&f.isClient&&(n.value=await x.toDataURL(l,o))},{immediate:!0}),n}function pe(t,o,e={}){let n;const{document:l=y.defaultDocument,...s}=e,u={onUpdate:m=>{G(o,m.oldIndex,m.newIndex,m)}},c=()=>{const m=typeof t=="string"?l?.querySelector(t):y.unrefElement(t);!m||n!==void 0||(n=new ee(m,{...u,...s}))},r=()=>{n?.destroy(),n=void 0},v=(m,C)=>{if(C!==void 0)n?.option(m,C);else return n?.option(m)};return y.tryOnMounted(c),y.tryOnScopeDispose(r),{stop:r,start:c,option:v}}function B(t,o,e){const n=t.children[e];t.insertBefore(o,n)}function W(t){t.parentNode&&t.parentNode.removeChild(t)}function G(t,o,e,n=null){n!=null&&(W(n.item),B(n.from,n.item,o));const l=a.isRef(t),s=l?[...y.toValue(t)]:y.toValue(t);if(e>=0&&e<s.length){const u=s.splice(o,1)[0];a.nextTick(()=>{s.splice(e,0,u),l&&(t.value=s)})}}w.createCookies=re,w.insertNodeAt=B,w.moveArrayElement=G,w.removeNode=W,w.useAsyncValidator=ae,w.useAxios=le,w.useChangeCase=ue,w.useCookies=T,w.useDrauu=ce,w.useFocusTrap=ie,w.useFuse=fe,w.useIDBKeyval=de,w.useJwt=ve,w.useNProgress=me,w.useQRCode=he,w.useSortable=pe})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue,axios,changeCase,UniversalCookie,VueUse,Drauu,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toRef, toValue, until, noop, tryOnScopeDispose, notNullish, isClient } from '@vueuse/shared';
|
|
2
2
|
import Schema from 'async-validator';
|
|
3
|
-
import { shallowRef, ref, computed, watch, toRaw, watchEffect, isRef, nextTick } from 'vue
|
|
3
|
+
import { shallowRef, ref, computed, watch, toRaw, watchEffect, isRef, nextTick } from 'vue';
|
|
4
4
|
import axios, { AxiosError } from 'axios';
|
|
5
5
|
import * as changeCase from 'change-case';
|
|
6
6
|
import Cookie from 'universal-cookie';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/integrations",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0-beta.1",
|
|
4
4
|
"description": "Integration wrappers for utility libraries",
|
|
5
5
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
"dependencies": {
|
|
148
|
-
"@vueuse/core": "
|
|
149
|
-
"@vueuse/shared": "
|
|
150
|
-
"vue
|
|
148
|
+
"@vueuse/core": "12.0.0-beta.1",
|
|
149
|
+
"@vueuse/shared": "12.0.0-beta.1",
|
|
150
|
+
"vue": "^3.5.13"
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var vue = require('vue');
|
|
4
4
|
var shared = require('@vueuse/shared');
|
|
5
5
|
var Schema = require('async-validator');
|
|
6
6
|
|
|
@@ -12,12 +12,12 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
12
12
|
manual = false
|
|
13
13
|
} = options;
|
|
14
14
|
const valueRef = shared.toRef(value);
|
|
15
|
-
const errorInfo =
|
|
16
|
-
const isFinished =
|
|
17
|
-
const pass =
|
|
18
|
-
const errors =
|
|
19
|
-
const errorFields =
|
|
20
|
-
const validator =
|
|
15
|
+
const errorInfo = vue.shallowRef(null);
|
|
16
|
+
const isFinished = vue.ref(true);
|
|
17
|
+
const pass = vue.ref(!immediate || manual);
|
|
18
|
+
const errors = vue.computed(() => errorInfo.value?.errors || []);
|
|
19
|
+
const errorFields = vue.computed(() => errorInfo.value?.fields || {});
|
|
20
|
+
const validator = vue.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
21
21
|
const execute = async () => {
|
|
22
22
|
isFinished.value = false;
|
|
23
23
|
pass.value = false;
|
|
@@ -38,7 +38,7 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
if (!manual) {
|
|
41
|
-
|
|
41
|
+
vue.watch(
|
|
42
42
|
[valueRef, validator],
|
|
43
43
|
() => execute(),
|
|
44
44
|
{ immediate, deep: true }
|
|
@@ -65,7 +65,7 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const UseAsyncValidator = /* @__PURE__ */ /* #__PURE__ */
|
|
68
|
+
const UseAsyncValidator = /* @__PURE__ */ /* #__PURE__ */ vue.defineComponent({
|
|
69
69
|
name: "UseAsyncValidator",
|
|
70
70
|
props: {
|
|
71
71
|
form: {
|
|
@@ -78,7 +78,7 @@ const UseAsyncValidator = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponen
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
setup(props, { slots }) {
|
|
81
|
-
const data =
|
|
81
|
+
const data = vue.reactive(useAsyncValidator(props.form, props.rules));
|
|
82
82
|
return () => {
|
|
83
83
|
if (slots.default)
|
|
84
84
|
return slots.default(data);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowRef, ref, computed, watch, defineComponent, reactive } from 'vue
|
|
1
|
+
import { shallowRef, ref, computed, watch, defineComponent, reactive } from 'vue';
|
|
2
2
|
import { toRef, toValue, until } from '@vueuse/shared';
|
|
3
3
|
import Schema from 'async-validator';
|
|
4
4
|
|
package/useAsyncValidator.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var shared = require('@vueuse/shared');
|
|
4
4
|
var Schema = require('async-validator');
|
|
5
|
-
var
|
|
5
|
+
var vue = require('vue');
|
|
6
6
|
|
|
7
7
|
const AsyncValidatorSchema = Schema.default || Schema;
|
|
8
8
|
function useAsyncValidator(value, rules, options = {}) {
|
|
@@ -12,18 +12,18 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
12
12
|
manual = false
|
|
13
13
|
} = options;
|
|
14
14
|
const valueRef = shared.toRef(value);
|
|
15
|
-
const errorInfo =
|
|
16
|
-
const isFinished =
|
|
17
|
-
const pass =
|
|
18
|
-
const errors =
|
|
15
|
+
const errorInfo = vue.shallowRef(null);
|
|
16
|
+
const isFinished = vue.ref(true);
|
|
17
|
+
const pass = vue.ref(!immediate || manual);
|
|
18
|
+
const errors = vue.computed(() => {
|
|
19
19
|
var _a;
|
|
20
20
|
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
|
21
21
|
});
|
|
22
|
-
const errorFields =
|
|
22
|
+
const errorFields = vue.computed(() => {
|
|
23
23
|
var _a;
|
|
24
24
|
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
|
25
25
|
});
|
|
26
|
-
const validator =
|
|
26
|
+
const validator = vue.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
|
|
27
27
|
const execute = async () => {
|
|
28
28
|
isFinished.value = false;
|
|
29
29
|
pass.value = false;
|
|
@@ -44,7 +44,7 @@ function useAsyncValidator(value, rules, options = {}) {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
if (!manual) {
|
|
47
|
-
|
|
47
|
+
vue.watch(
|
|
48
48
|
[valueRef, validator],
|
|
49
49
|
() => execute(),
|
|
50
50
|
{ immediate, deep: true }
|
package/useAsyncValidator.d.cts
CHANGED
package/useAsyncValidator.d.mts
CHANGED
package/useAsyncValidator.d.ts
CHANGED