@vueuse/integrations 6.3.2 → 6.5.3
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/README.md +1 -0
- package/index.cjs +378 -312
- package/index.d.ts +32 -4
- package/index.iife.js +378 -314
- package/index.iife.min.js +1 -1
- package/index.mjs +379 -314
- package/package.json +9 -4
- package/useAxios.cjs +69 -65
- package/useAxios.iife.js +70 -66
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +69 -65
- package/useCookies.cjs +59 -71
- package/useCookies.iife.js +60 -72
- package/useCookies.iife.min.js +1 -1
- package/useCookies.mjs +59 -71
- package/useDrauu.cjs +127 -0
- package/useDrauu.d.ts +32 -0
- package/useDrauu.iife.js +186 -0
- package/useDrauu.iife.min.js +1 -0
- package/useDrauu.mjs +123 -0
- package/useFocusTrap.cjs +78 -104
- package/useFocusTrap.iife.js +83 -109
- package/useFocusTrap.iife.min.js +1 -1
- package/useFocusTrap.mjs +79 -105
- package/useJwt.cjs +20 -24
- package/useJwt.iife.js +21 -25
- package/useJwt.iife.min.js +1 -1
- package/useJwt.mjs +20 -24
- package/useNProgress.cjs +28 -37
- package/useNProgress.iife.js +29 -38
- package/useNProgress.iife.min.js +1 -1
- package/useNProgress.mjs +28 -37
- package/useQRCode.cjs +8 -15
- package/useQRCode.iife.js +9 -16
- package/useQRCode.iife.min.js +1 -1
- package/useQRCode.mjs +8 -15
package/useFocusTrap.mjs
CHANGED
|
@@ -1,110 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { unrefElement, tryOnScopeDispose } from '@vueuse/core';
|
|
2
|
+
import { ref, watch } from 'vue-demi';
|
|
3
3
|
import { createFocusTrap } from 'focus-trap';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
trap = createFocusTrap(el, Object.assign(Object.assign({}, focusTrapOptions), { onActivate() {
|
|
83
|
-
hasFocus.value = true;
|
|
84
|
-
// Apply if user provided onActivate option
|
|
85
|
-
if (options.onActivate)
|
|
86
|
-
options.onActivate();
|
|
87
|
-
},
|
|
88
|
-
onDeactivate() {
|
|
89
|
-
hasFocus.value = false;
|
|
90
|
-
// Apply if user provided onDeactivate option
|
|
91
|
-
if (options.onDeactivate)
|
|
92
|
-
options.onDeactivate();
|
|
93
|
-
} }));
|
|
94
|
-
// Focus if immediate is set to true
|
|
95
|
-
if (immediate)
|
|
96
|
-
activate();
|
|
97
|
-
}, { flush: 'post' });
|
|
98
|
-
// Cleanup on unmount
|
|
99
|
-
tryOnScopeDispose(() => deactivate());
|
|
100
|
-
return {
|
|
101
|
-
hasFocus,
|
|
102
|
-
isPaused,
|
|
103
|
-
activate,
|
|
104
|
-
deactivate,
|
|
105
|
-
pause,
|
|
106
|
-
unpause,
|
|
107
|
-
};
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
function useFocusTrap(target, options = {}) {
|
|
37
|
+
let trap;
|
|
38
|
+
const _a = options, { immediate } = _a, focusTrapOptions = __objRest(_a, ["immediate"]);
|
|
39
|
+
const hasFocus = ref(false);
|
|
40
|
+
const isPaused = ref(false);
|
|
41
|
+
const activate = (opts) => trap && trap.activate(opts);
|
|
42
|
+
const deactivate = (opts) => trap && trap.deactivate(opts);
|
|
43
|
+
const pause = () => {
|
|
44
|
+
if (trap) {
|
|
45
|
+
trap.pause();
|
|
46
|
+
isPaused.value = true;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const unpause = () => {
|
|
50
|
+
if (trap) {
|
|
51
|
+
trap.unpause();
|
|
52
|
+
isPaused.value = false;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
watch(() => unrefElement(target), (el) => {
|
|
56
|
+
if (!el)
|
|
57
|
+
return;
|
|
58
|
+
trap = createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
|
|
59
|
+
onActivate() {
|
|
60
|
+
hasFocus.value = true;
|
|
61
|
+
if (options.onActivate)
|
|
62
|
+
options.onActivate();
|
|
63
|
+
},
|
|
64
|
+
onDeactivate() {
|
|
65
|
+
hasFocus.value = false;
|
|
66
|
+
if (options.onDeactivate)
|
|
67
|
+
options.onDeactivate();
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
if (immediate)
|
|
71
|
+
activate();
|
|
72
|
+
}, { flush: "post" });
|
|
73
|
+
tryOnScopeDispose(() => deactivate());
|
|
74
|
+
return {
|
|
75
|
+
hasFocus,
|
|
76
|
+
isPaused,
|
|
77
|
+
activate,
|
|
78
|
+
deactivate,
|
|
79
|
+
pause,
|
|
80
|
+
unpause
|
|
81
|
+
};
|
|
108
82
|
}
|
|
109
83
|
|
|
110
84
|
export { useFocusTrap };
|
package/useJwt.cjs
CHANGED
|
@@ -9,30 +9,26 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var jwt_decode__default = /*#__PURE__*/_interopDefaultLegacy(jwt_decode);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
header,
|
|
34
|
-
payload,
|
|
35
|
-
};
|
|
12
|
+
function useJwt(encodedJwt, options = {}) {
|
|
13
|
+
const encodedJwtRef = vueDemi.ref(encodedJwt);
|
|
14
|
+
const {
|
|
15
|
+
onError,
|
|
16
|
+
fallbackValue = null
|
|
17
|
+
} = options;
|
|
18
|
+
const decodeWithFallback = (encodedJwt2, options2) => {
|
|
19
|
+
try {
|
|
20
|
+
return jwt_decode__default["default"](encodedJwt2, options2);
|
|
21
|
+
} catch (err) {
|
|
22
|
+
onError == null ? void 0 : onError(err);
|
|
23
|
+
return fallbackValue;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const header = vueDemi.computed(() => decodeWithFallback(encodedJwtRef.value, { header: true }));
|
|
27
|
+
const payload = vueDemi.computed(() => decodeWithFallback(encodedJwtRef.value));
|
|
28
|
+
return {
|
|
29
|
+
header,
|
|
30
|
+
payload
|
|
31
|
+
};
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
exports.useJwt = useJwt;
|
package/useJwt.iife.js
CHANGED
|
@@ -66,34 +66,30 @@
|
|
|
66
66
|
|
|
67
67
|
var jwt_decode__default = /*#__PURE__*/_interopDefaultLegacy(jwt_decode);
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
header,
|
|
91
|
-
payload,
|
|
92
|
-
};
|
|
69
|
+
function useJwt(encodedJwt, options = {}) {
|
|
70
|
+
const encodedJwtRef = vueDemi.ref(encodedJwt);
|
|
71
|
+
const {
|
|
72
|
+
onError,
|
|
73
|
+
fallbackValue = null
|
|
74
|
+
} = options;
|
|
75
|
+
const decodeWithFallback = (encodedJwt2, options2) => {
|
|
76
|
+
try {
|
|
77
|
+
return jwt_decode__default["default"](encodedJwt2, options2);
|
|
78
|
+
} catch (err) {
|
|
79
|
+
onError == null ? void 0 : onError(err);
|
|
80
|
+
return fallbackValue;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const header = vueDemi.computed(() => decodeWithFallback(encodedJwtRef.value, { header: true }));
|
|
84
|
+
const payload = vueDemi.computed(() => decodeWithFallback(encodedJwtRef.value));
|
|
85
|
+
return {
|
|
86
|
+
header,
|
|
87
|
+
payload
|
|
88
|
+
};
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
exports.useJwt = useJwt;
|
|
96
92
|
|
|
97
93
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
98
94
|
|
|
99
|
-
}(this.VueUse = this.VueUse || {}, VueDemi, jwt_decode)
|
|
95
|
+
})(this.VueUse = this.VueUse || {}, VueDemi, jwt_decode);
|
package/useJwt.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(i){if(!i.VueDemi){var e={},r=i.Vue;if(r)if(r.version.slice(0,2)==="2."){var t=i.VueCompositionAPI;if(t){for(var o in t)e[o]=t[o];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=r,e.Vue2=r,e.version=r.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if(r.version.slice(0,2)==="3."){for(var o in r)e[o]=r[o];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=r,e.Vue2=void 0,e.version=r.version,e.set=function(n,u,s){return Array.isArray(n)?(n.length=Math.max(n.length,u),n.splice(u,1,s),s):(n[u]=s,s)},e.del=function(n,u){if(Array.isArray(n)){n.splice(u,1);return}delete n[u]}}else console.error("[vue-demi] Vue version "+r.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");i.VueDemi=e}})(window),function(i,e,r){"use strict";function t(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var o=t(r);function n(u,s={}){const l=e.ref(u),{onError:c,fallbackValue:a=null}=s,f=(V,p)=>{try{return o.default(V,p)}catch(m){return c==null||c(m),a}},d=e.computed(()=>f(l.value,{header:!0})),v=e.computed(()=>f(l.value));return{header:d,payload:v}}i.useJwt=n,Object.defineProperty(i,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi,jwt_decode);
|
package/useJwt.mjs
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
import { ref, computed } from 'vue-demi';
|
|
2
2
|
import jwt_decode from 'jwt-decode';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
header,
|
|
26
|
-
payload,
|
|
27
|
-
};
|
|
4
|
+
function useJwt(encodedJwt, options = {}) {
|
|
5
|
+
const encodedJwtRef = ref(encodedJwt);
|
|
6
|
+
const {
|
|
7
|
+
onError,
|
|
8
|
+
fallbackValue = null
|
|
9
|
+
} = options;
|
|
10
|
+
const decodeWithFallback = (encodedJwt2, options2) => {
|
|
11
|
+
try {
|
|
12
|
+
return jwt_decode(encodedJwt2, options2);
|
|
13
|
+
} catch (err) {
|
|
14
|
+
onError == null ? void 0 : onError(err);
|
|
15
|
+
return fallbackValue;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const header = computed(() => decodeWithFallback(encodedJwtRef.value, { header: true }));
|
|
19
|
+
const payload = computed(() => decodeWithFallback(encodedJwtRef.value));
|
|
20
|
+
return {
|
|
21
|
+
header,
|
|
22
|
+
payload
|
|
23
|
+
};
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
export { useJwt };
|
package/useNProgress.cjs
CHANGED
|
@@ -10,43 +10,34 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var nprogress__default = /*#__PURE__*/_interopDefaultLegacy(nprogress);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
isLoading,
|
|
42
|
-
progress,
|
|
43
|
-
start: nprogress__default['default'].start,
|
|
44
|
-
done: nprogress__default['default'].done,
|
|
45
|
-
remove: () => {
|
|
46
|
-
progress.value = null;
|
|
47
|
-
nprogress__default['default'].remove();
|
|
48
|
-
},
|
|
49
|
-
};
|
|
13
|
+
function useNProgress(currentProgress = null, options) {
|
|
14
|
+
const progress = vueDemi.isRef(currentProgress) ? currentProgress : vueDemi.ref(currentProgress);
|
|
15
|
+
const isLoading = vueDemi.computed({
|
|
16
|
+
set: (load) => load ? nprogress__default["default"].start() : nprogress__default["default"].done(),
|
|
17
|
+
get: () => shared.isNumber(progress.value) && progress.value < 1
|
|
18
|
+
});
|
|
19
|
+
if (options)
|
|
20
|
+
nprogress__default["default"].configure(options);
|
|
21
|
+
const setProgress = nprogress__default["default"].set;
|
|
22
|
+
nprogress__default["default"].set = (n) => {
|
|
23
|
+
progress.value = n;
|
|
24
|
+
return setProgress.call(nprogress__default["default"], n);
|
|
25
|
+
};
|
|
26
|
+
vueDemi.watchEffect(() => {
|
|
27
|
+
if (shared.isNumber(progress.value))
|
|
28
|
+
setProgress.call(nprogress__default["default"], progress.value);
|
|
29
|
+
});
|
|
30
|
+
shared.tryOnScopeDispose(nprogress__default["default"].remove);
|
|
31
|
+
return {
|
|
32
|
+
isLoading,
|
|
33
|
+
progress,
|
|
34
|
+
start: nprogress__default["default"].start,
|
|
35
|
+
done: nprogress__default["default"].done,
|
|
36
|
+
remove: () => {
|
|
37
|
+
progress.value = null;
|
|
38
|
+
nprogress__default["default"].remove();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
50
41
|
}
|
|
51
42
|
|
|
52
43
|
exports.useNProgress = useNProgress;
|
package/useNProgress.iife.js
CHANGED
|
@@ -66,47 +66,38 @@
|
|
|
66
66
|
|
|
67
67
|
var nprogress__default = /*#__PURE__*/_interopDefaultLegacy(nprogress);
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
isLoading,
|
|
98
|
-
progress,
|
|
99
|
-
start: nprogress__default['default'].start,
|
|
100
|
-
done: nprogress__default['default'].done,
|
|
101
|
-
remove: () => {
|
|
102
|
-
progress.value = null;
|
|
103
|
-
nprogress__default['default'].remove();
|
|
104
|
-
},
|
|
105
|
-
};
|
|
69
|
+
function useNProgress(currentProgress = null, options) {
|
|
70
|
+
const progress = vueDemi.isRef(currentProgress) ? currentProgress : vueDemi.ref(currentProgress);
|
|
71
|
+
const isLoading = vueDemi.computed({
|
|
72
|
+
set: (load) => load ? nprogress__default["default"].start() : nprogress__default["default"].done(),
|
|
73
|
+
get: () => shared.isNumber(progress.value) && progress.value < 1
|
|
74
|
+
});
|
|
75
|
+
if (options)
|
|
76
|
+
nprogress__default["default"].configure(options);
|
|
77
|
+
const setProgress = nprogress__default["default"].set;
|
|
78
|
+
nprogress__default["default"].set = (n) => {
|
|
79
|
+
progress.value = n;
|
|
80
|
+
return setProgress.call(nprogress__default["default"], n);
|
|
81
|
+
};
|
|
82
|
+
vueDemi.watchEffect(() => {
|
|
83
|
+
if (shared.isNumber(progress.value))
|
|
84
|
+
setProgress.call(nprogress__default["default"], progress.value);
|
|
85
|
+
});
|
|
86
|
+
shared.tryOnScopeDispose(nprogress__default["default"].remove);
|
|
87
|
+
return {
|
|
88
|
+
isLoading,
|
|
89
|
+
progress,
|
|
90
|
+
start: nprogress__default["default"].start,
|
|
91
|
+
done: nprogress__default["default"].done,
|
|
92
|
+
remove: () => {
|
|
93
|
+
progress.value = null;
|
|
94
|
+
nprogress__default["default"].remove();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
106
97
|
}
|
|
107
98
|
|
|
108
99
|
exports.useNProgress = useNProgress;
|
|
109
100
|
|
|
110
101
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
111
102
|
|
|
112
|
-
}(this.VueUse = this.VueUse || {}, nprogress, VueUse, VueDemi)
|
|
103
|
+
})(this.VueUse = this.VueUse || {}, nprogress, VueUse, VueDemi);
|
package/useNProgress.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(o){if(!o.VueDemi){var u={},s=o.Vue;if(s)if(s.version.slice(0,2)==="2."){var i=o.VueCompositionAPI;if(i){for(var t in i)u[t]=i[t];u.isVue2=!0,u.isVue3=!1,u.install=function(){},u.Vue=s,u.Vue2=s,u.version=s.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if(s.version.slice(0,2)==="3."){for(var t in s)u[t]=s[t];u.isVue2=!1,u.isVue3=!0,u.install=function(){},u.Vue=s,u.Vue2=void 0,u.version=s.version,u.set=function(e,n,r){return Array.isArray(e)?(e.length=Math.max(e.length,n),e.splice(n,1,r),r):(e[n]=r,r)},u.del=function(e,n){if(Array.isArray(e)){e.splice(n,1);return}delete e[n]}}else console.error("[vue-demi] Vue version "+s.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");o.VueDemi=u}})(window),function(o,u,s,i){"use strict";function t(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var e=t(u);function n(r=null,a){const l=i.isRef(r)?r:i.ref(r),d=i.computed({set:f=>f?e.default.start():e.default.done(),get:()=>s.isNumber(l.value)&&l.value<1});a&&e.default.configure(a);const c=e.default.set;return e.default.set=f=>(l.value=f,c.call(e.default,f)),i.watchEffect(()=>{s.isNumber(l.value)&&c.call(e.default,l.value)}),s.tryOnScopeDispose(e.default.remove),{isLoading:d,progress:l,start:e.default.start,done:e.default.done,remove:()=>{l.value=null,e.default.remove()}}}o.useNProgress=n,Object.defineProperty(o,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},nprogress,VueUse,VueDemi);
|
package/useNProgress.mjs
CHANGED
|
@@ -2,43 +2,34 @@ import nprogress from 'nprogress';
|
|
|
2
2
|
import { isNumber, tryOnScopeDispose } from '@vueuse/shared';
|
|
3
3
|
import { isRef, ref, computed, watchEffect } from 'vue-demi';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
isLoading,
|
|
34
|
-
progress,
|
|
35
|
-
start: nprogress.start,
|
|
36
|
-
done: nprogress.done,
|
|
37
|
-
remove: () => {
|
|
38
|
-
progress.value = null;
|
|
39
|
-
nprogress.remove();
|
|
40
|
-
},
|
|
41
|
-
};
|
|
5
|
+
function useNProgress(currentProgress = null, options) {
|
|
6
|
+
const progress = isRef(currentProgress) ? currentProgress : ref(currentProgress);
|
|
7
|
+
const isLoading = computed({
|
|
8
|
+
set: (load) => load ? nprogress.start() : nprogress.done(),
|
|
9
|
+
get: () => isNumber(progress.value) && progress.value < 1
|
|
10
|
+
});
|
|
11
|
+
if (options)
|
|
12
|
+
nprogress.configure(options);
|
|
13
|
+
const setProgress = nprogress.set;
|
|
14
|
+
nprogress.set = (n) => {
|
|
15
|
+
progress.value = n;
|
|
16
|
+
return setProgress.call(nprogress, n);
|
|
17
|
+
};
|
|
18
|
+
watchEffect(() => {
|
|
19
|
+
if (isNumber(progress.value))
|
|
20
|
+
setProgress.call(nprogress, progress.value);
|
|
21
|
+
});
|
|
22
|
+
tryOnScopeDispose(nprogress.remove);
|
|
23
|
+
return {
|
|
24
|
+
isLoading,
|
|
25
|
+
progress,
|
|
26
|
+
start: nprogress.start,
|
|
27
|
+
done: nprogress.done,
|
|
28
|
+
remove: () => {
|
|
29
|
+
progress.value = null;
|
|
30
|
+
nprogress.remove();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
42
33
|
}
|
|
43
34
|
|
|
44
35
|
export { useNProgress };
|
package/useQRCode.cjs
CHANGED
|
@@ -10,21 +10,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const src = vueDemi.ref(text);
|
|
22
|
-
const result = vueDemi.ref('');
|
|
23
|
-
vueDemi.watch(src, async (value) => {
|
|
24
|
-
if (src.value && shared.isClient)
|
|
25
|
-
result.value = await QRCode__default['default'].toDataURL(value, options);
|
|
26
|
-
}, { immediate: true });
|
|
27
|
-
return result;
|
|
13
|
+
function useQRCode(text, options) {
|
|
14
|
+
const src = vueDemi.ref(text);
|
|
15
|
+
const result = vueDemi.ref("");
|
|
16
|
+
vueDemi.watch(src, async (value) => {
|
|
17
|
+
if (src.value && shared.isClient)
|
|
18
|
+
result.value = await QRCode__default["default"].toDataURL(value, options);
|
|
19
|
+
}, { immediate: true });
|
|
20
|
+
return result;
|
|
28
21
|
}
|
|
29
22
|
|
|
30
23
|
exports.useQRCode = useQRCode;
|