@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/index.cjs
CHANGED
|
@@ -6,6 +6,8 @@ var vueDemi = require('vue-demi');
|
|
|
6
6
|
var axios = require('axios');
|
|
7
7
|
var shared = require('@vueuse/shared');
|
|
8
8
|
var Cookie = require('universal-cookie');
|
|
9
|
+
var drauu = require('drauu');
|
|
10
|
+
var core = require('@vueuse/core');
|
|
9
11
|
var focusTrap = require('focus-trap');
|
|
10
12
|
var jwt_decode = require('jwt-decode');
|
|
11
13
|
var nprogress = require('nprogress');
|
|
@@ -19,336 +21,400 @@ var jwt_decode__default = /*#__PURE__*/_interopDefaultLegacy(jwt_decode);
|
|
|
19
21
|
var nprogress__default = /*#__PURE__*/_interopDefaultLegacy(nprogress);
|
|
20
22
|
var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode);
|
|
21
23
|
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
24
|
+
var __defProp$3 = Object.defineProperty;
|
|
25
|
+
var __defProps$1 = Object.defineProperties;
|
|
26
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
27
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
28
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
29
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
30
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
31
|
+
var __spreadValues$3 = (a, b) => {
|
|
32
|
+
for (var prop in b || (b = {}))
|
|
33
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
34
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
35
|
+
if (__getOwnPropSymbols$3)
|
|
36
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
37
|
+
if (__propIsEnum$3.call(b, prop))
|
|
38
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
39
|
+
}
|
|
40
|
+
return a;
|
|
41
|
+
};
|
|
42
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
43
|
+
function useAxios(url, ...args) {
|
|
44
|
+
let config = {};
|
|
45
|
+
let instance = axios__default["default"];
|
|
46
|
+
if (args.length > 0) {
|
|
47
|
+
if ("request" in args[0])
|
|
48
|
+
instance = args[0];
|
|
49
|
+
else
|
|
50
|
+
config = args[0];
|
|
51
|
+
}
|
|
52
|
+
if (args.length > 1) {
|
|
53
|
+
if ("request" in args[1])
|
|
54
|
+
instance = args[1];
|
|
55
|
+
}
|
|
56
|
+
const response = vueDemi.shallowRef();
|
|
57
|
+
const data = vueDemi.shallowRef();
|
|
58
|
+
const isFinished = vueDemi.ref(false);
|
|
59
|
+
const isLoading = vueDemi.ref(true);
|
|
60
|
+
const aborted = vueDemi.ref(false);
|
|
61
|
+
const error = vueDemi.shallowRef();
|
|
62
|
+
const cancelToken = axios__default["default"].CancelToken.source();
|
|
63
|
+
const abort = (message) => {
|
|
64
|
+
if (isFinished.value || !isLoading.value)
|
|
65
|
+
return;
|
|
66
|
+
cancelToken.cancel(message);
|
|
67
|
+
aborted.value = true;
|
|
68
|
+
isLoading.value = false;
|
|
69
|
+
isFinished.value = false;
|
|
70
|
+
};
|
|
71
|
+
instance(url, __spreadProps$1(__spreadValues$3({}, config), { cancelToken: cancelToken.token })).then((r) => {
|
|
72
|
+
response.value = r;
|
|
73
|
+
data.value = r.data;
|
|
74
|
+
}).catch((e) => {
|
|
75
|
+
error.value = e;
|
|
76
|
+
}).finally(() => {
|
|
77
|
+
isLoading.value = false;
|
|
78
|
+
isFinished.value = true;
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
response,
|
|
82
|
+
data,
|
|
83
|
+
error,
|
|
84
|
+
finished: isFinished,
|
|
85
|
+
loading: isLoading,
|
|
86
|
+
isFinished,
|
|
87
|
+
isLoading,
|
|
88
|
+
cancel: abort,
|
|
89
|
+
canceled: aborted,
|
|
90
|
+
aborted,
|
|
91
|
+
abort
|
|
92
|
+
};
|
|
87
93
|
}
|
|
88
94
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
|
109
|
-
let previousCookies = cookies.getAll({ doNotParse: true });
|
|
110
|
-
/**
|
|
111
|
-
* Adds reactivity to get/getAll methods
|
|
112
|
-
*/
|
|
113
|
-
const touches = vueDemi.ref(0);
|
|
114
|
-
const onChange = () => {
|
|
115
|
-
const newCookies = cookies.getAll({ doNotParse: true });
|
|
116
|
-
if (shouldUpdate(watchingDependencies || null, newCookies, previousCookies))
|
|
117
|
-
touches.value++;
|
|
118
|
-
previousCookies = newCookies;
|
|
119
|
-
};
|
|
120
|
-
cookies.addChangeListener(onChange);
|
|
121
|
-
shared.tryOnScopeDispose(() => {
|
|
122
|
-
cookies.removeChangeListener(onChange);
|
|
123
|
-
});
|
|
124
|
-
return {
|
|
125
|
-
/**
|
|
126
|
-
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
127
|
-
*/
|
|
128
|
-
get: (...args) => {
|
|
129
|
-
/**
|
|
130
|
-
* Auto update watching dependencies if needed
|
|
131
|
-
*/
|
|
132
|
-
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
133
|
-
watchingDependencies.push(args[0]);
|
|
134
|
-
// eslint-disable-next-line no-unused-expressions
|
|
135
|
-
touches.value; // adds reactivity to method
|
|
136
|
-
return cookies.get(args[0], Object.assign({ doNotParse }, args[1]));
|
|
137
|
-
},
|
|
138
|
-
/**
|
|
139
|
-
* Reactive get all cookies
|
|
140
|
-
*/
|
|
141
|
-
getAll: (...args) => {
|
|
142
|
-
// eslint-disable-next-line no-unused-expressions
|
|
143
|
-
touches.value; // adds reactivity to method
|
|
144
|
-
return cookies.getAll(Object.assign({ doNotParse }, args[0]));
|
|
145
|
-
},
|
|
146
|
-
set: (...args) => cookies.set(...args),
|
|
147
|
-
remove: (...args) => cookies.remove(...args),
|
|
148
|
-
addChangeListener: (...args) => cookies.addChangeListener(...args),
|
|
149
|
-
removeChangeListener: (...args) => cookies.removeChangeListener(...args),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
153
|
-
if (!dependencies)
|
|
154
|
-
return true;
|
|
155
|
-
for (const dependency of dependencies) {
|
|
156
|
-
if (newCookies[dependency] !== oldCookies[dependency])
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
return false;
|
|
95
|
+
var __defProp$2 = Object.defineProperty;
|
|
96
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
97
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
98
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
99
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
100
|
+
var __spreadValues$2 = (a, b) => {
|
|
101
|
+
for (var prop in b || (b = {}))
|
|
102
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
103
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
104
|
+
if (__getOwnPropSymbols$2)
|
|
105
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
106
|
+
if (__propIsEnum$2.call(b, prop))
|
|
107
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
108
|
+
}
|
|
109
|
+
return a;
|
|
110
|
+
};
|
|
111
|
+
function createCookies(req) {
|
|
112
|
+
const universalCookie = new Cookie__default["default"](req ? req.headers.cookie : null);
|
|
113
|
+
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
160
114
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
115
|
+
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie__default["default"]()) {
|
|
116
|
+
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
|
117
|
+
let previousCookies = cookies.getAll({ doNotParse: true });
|
|
118
|
+
const touches = vueDemi.ref(0);
|
|
119
|
+
const onChange = () => {
|
|
120
|
+
const newCookies = cookies.getAll({ doNotParse: true });
|
|
121
|
+
if (shouldUpdate(watchingDependencies || null, newCookies, previousCookies))
|
|
122
|
+
touches.value++;
|
|
123
|
+
previousCookies = newCookies;
|
|
124
|
+
};
|
|
125
|
+
cookies.addChangeListener(onChange);
|
|
126
|
+
shared.tryOnScopeDispose(() => {
|
|
127
|
+
cookies.removeChangeListener(onChange);
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
get: (...args) => {
|
|
131
|
+
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
132
|
+
watchingDependencies.push(args[0]);
|
|
133
|
+
touches.value;
|
|
134
|
+
return cookies.get(args[0], __spreadValues$2({ doNotParse }, args[1]));
|
|
135
|
+
},
|
|
136
|
+
getAll: (...args) => {
|
|
137
|
+
touches.value;
|
|
138
|
+
return cookies.getAll(__spreadValues$2({ doNotParse }, args[0]));
|
|
139
|
+
},
|
|
140
|
+
set: (...args) => cookies.set(...args),
|
|
141
|
+
remove: (...args) => cookies.remove(...args),
|
|
142
|
+
addChangeListener: (...args) => cookies.addChangeListener(...args),
|
|
143
|
+
removeChangeListener: (...args) => cookies.removeChangeListener(...args)
|
|
144
|
+
};
|
|
187
145
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const plain = vueDemi.unref(elRef);
|
|
197
|
-
return (_b = (_a = plain) === null || _a === void 0 ? void 0 : _a.$el) !== null && _b !== void 0 ? _b : plain;
|
|
146
|
+
function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
147
|
+
if (!dependencies)
|
|
148
|
+
return true;
|
|
149
|
+
for (const dependency of dependencies) {
|
|
150
|
+
if (newCookies[dependency] !== oldCookies[dependency])
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
198
154
|
}
|
|
199
155
|
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
156
|
+
var __defProp$1 = Object.defineProperty;
|
|
157
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
158
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
159
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
160
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
161
|
+
var __spreadValues$1 = (a, b) => {
|
|
162
|
+
for (var prop in b || (b = {}))
|
|
163
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
164
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
165
|
+
if (__getOwnPropSymbols$1)
|
|
166
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
167
|
+
if (__propIsEnum$1.call(b, prop))
|
|
168
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
169
|
+
}
|
|
170
|
+
return a;
|
|
171
|
+
};
|
|
172
|
+
function useDrauu(target, options) {
|
|
173
|
+
const drauuInstance = vueDemi.ref();
|
|
174
|
+
let disposables = [];
|
|
175
|
+
const onChangedHook = core.createEventHook();
|
|
176
|
+
const onCanceledHook = core.createEventHook();
|
|
177
|
+
const onCommittedHook = core.createEventHook();
|
|
178
|
+
const onStartHook = core.createEventHook();
|
|
179
|
+
const onEndHook = core.createEventHook();
|
|
180
|
+
const canUndo = vueDemi.ref(false);
|
|
181
|
+
const canRedo = vueDemi.ref(false);
|
|
182
|
+
const altPressed = vueDemi.ref(false);
|
|
183
|
+
const shiftPressed = vueDemi.ref(false);
|
|
184
|
+
const brush = vueDemi.ref({
|
|
185
|
+
color: "black",
|
|
186
|
+
size: 3,
|
|
187
|
+
arrowEnd: false,
|
|
188
|
+
cornerRadius: 0,
|
|
189
|
+
dasharray: void 0,
|
|
190
|
+
fill: "transparent",
|
|
191
|
+
mode: "draw"
|
|
192
|
+
});
|
|
193
|
+
vueDemi.watch(brush, () => {
|
|
194
|
+
const instance = drauuInstance.value;
|
|
195
|
+
if (instance)
|
|
196
|
+
instance.brush = brush.value;
|
|
197
|
+
}, { deep: true });
|
|
198
|
+
const undo = () => {
|
|
199
|
+
var _a;
|
|
200
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
|
|
201
|
+
};
|
|
202
|
+
const redo = () => {
|
|
203
|
+
var _a;
|
|
204
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
|
|
205
|
+
};
|
|
206
|
+
const clear = () => {
|
|
207
|
+
var _a;
|
|
208
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
|
|
209
|
+
};
|
|
210
|
+
const cancel = () => {
|
|
211
|
+
var _a;
|
|
212
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
|
|
213
|
+
};
|
|
214
|
+
const load = (svg) => {
|
|
215
|
+
var _a;
|
|
216
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
|
|
217
|
+
};
|
|
218
|
+
const dump = () => {
|
|
219
|
+
var _a;
|
|
220
|
+
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
|
|
221
|
+
};
|
|
222
|
+
const cleanup = () => {
|
|
223
|
+
var _a;
|
|
224
|
+
disposables.forEach((dispose) => dispose());
|
|
225
|
+
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
|
|
226
|
+
};
|
|
227
|
+
const syncStatus = () => {
|
|
228
|
+
if (drauuInstance.value) {
|
|
229
|
+
canUndo.value = drauuInstance.value.canUndo();
|
|
230
|
+
canRedo.value = drauuInstance.value.canRedo();
|
|
231
|
+
altPressed.value = drauuInstance.value.altPressed;
|
|
232
|
+
shiftPressed.value = drauuInstance.value.shiftPressed;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
vueDemi.watch(() => core.unrefElement(target), (el) => {
|
|
236
|
+
if (!el || !(el instanceof SVGSVGElement))
|
|
237
|
+
return;
|
|
238
|
+
if (drauuInstance.value)
|
|
239
|
+
cleanup();
|
|
240
|
+
drauuInstance.value = drauu.createDrauu(__spreadValues$1({ el }, options));
|
|
241
|
+
syncStatus();
|
|
242
|
+
disposables = [
|
|
243
|
+
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
|
|
244
|
+
drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
|
|
245
|
+
drauuInstance.value.on("start", () => onStartHook.trigger()),
|
|
246
|
+
drauuInstance.value.on("end", () => onEndHook.trigger()),
|
|
247
|
+
drauuInstance.value.on("changed", () => {
|
|
248
|
+
syncStatus();
|
|
249
|
+
onChangedHook.trigger();
|
|
250
|
+
})
|
|
251
|
+
];
|
|
252
|
+
}, { flush: "post" });
|
|
253
|
+
shared.tryOnScopeDispose(() => cleanup());
|
|
254
|
+
return {
|
|
255
|
+
drauuInstance,
|
|
256
|
+
load,
|
|
257
|
+
dump,
|
|
258
|
+
clear,
|
|
259
|
+
cancel,
|
|
260
|
+
undo,
|
|
261
|
+
redo,
|
|
262
|
+
canUndo,
|
|
263
|
+
canRedo,
|
|
264
|
+
brush,
|
|
265
|
+
onChanged: onChangedHook.on,
|
|
266
|
+
onCommitted: onCommittedHook.on,
|
|
267
|
+
onStart: onStartHook.on,
|
|
268
|
+
onEnd: onEndHook.on,
|
|
269
|
+
onCanceled: onCanceledHook.on
|
|
270
|
+
};
|
|
271
|
+
}
|
|
208
272
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
273
|
+
var __defProp = Object.defineProperty;
|
|
274
|
+
var __defProps = Object.defineProperties;
|
|
275
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
276
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
277
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
278
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
279
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
280
|
+
var __spreadValues = (a, b) => {
|
|
281
|
+
for (var prop in b || (b = {}))
|
|
282
|
+
if (__hasOwnProp.call(b, prop))
|
|
283
|
+
__defNormalProp(a, prop, b[prop]);
|
|
284
|
+
if (__getOwnPropSymbols)
|
|
285
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
286
|
+
if (__propIsEnum.call(b, prop))
|
|
287
|
+
__defNormalProp(a, prop, b[prop]);
|
|
288
|
+
}
|
|
289
|
+
return a;
|
|
290
|
+
};
|
|
291
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
292
|
+
var __objRest = (source, exclude) => {
|
|
293
|
+
var target = {};
|
|
294
|
+
for (var prop in source)
|
|
295
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
296
|
+
target[prop] = source[prop];
|
|
297
|
+
if (source != null && __getOwnPropSymbols)
|
|
298
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
299
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
300
|
+
target[prop] = source[prop];
|
|
301
|
+
}
|
|
302
|
+
return target;
|
|
303
|
+
};
|
|
304
|
+
function useFocusTrap(target, options = {}) {
|
|
305
|
+
let trap;
|
|
306
|
+
const _a = options, { immediate } = _a, focusTrapOptions = __objRest(_a, ["immediate"]);
|
|
307
|
+
const hasFocus = vueDemi.ref(false);
|
|
308
|
+
const isPaused = vueDemi.ref(false);
|
|
309
|
+
const activate = (opts) => trap && trap.activate(opts);
|
|
310
|
+
const deactivate = (opts) => trap && trap.deactivate(opts);
|
|
311
|
+
const pause = () => {
|
|
312
|
+
if (trap) {
|
|
313
|
+
trap.pause();
|
|
314
|
+
isPaused.value = true;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const unpause = () => {
|
|
318
|
+
if (trap) {
|
|
319
|
+
trap.unpause();
|
|
320
|
+
isPaused.value = false;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
vueDemi.watch(() => core.unrefElement(target), (el) => {
|
|
324
|
+
if (!el)
|
|
325
|
+
return;
|
|
326
|
+
trap = focusTrap.createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
|
|
327
|
+
onActivate() {
|
|
328
|
+
hasFocus.value = true;
|
|
329
|
+
if (options.onActivate)
|
|
330
|
+
options.onActivate();
|
|
331
|
+
},
|
|
332
|
+
onDeactivate() {
|
|
333
|
+
hasFocus.value = false;
|
|
334
|
+
if (options.onDeactivate)
|
|
335
|
+
options.onDeactivate();
|
|
336
|
+
}
|
|
337
|
+
}));
|
|
338
|
+
if (immediate)
|
|
339
|
+
activate();
|
|
340
|
+
}, { flush: "post" });
|
|
341
|
+
core.tryOnScopeDispose(() => deactivate());
|
|
342
|
+
return {
|
|
343
|
+
hasFocus,
|
|
344
|
+
isPaused,
|
|
345
|
+
activate,
|
|
346
|
+
deactivate,
|
|
347
|
+
pause,
|
|
348
|
+
unpause
|
|
349
|
+
};
|
|
265
350
|
}
|
|
266
351
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return {
|
|
288
|
-
header,
|
|
289
|
-
payload,
|
|
290
|
-
};
|
|
352
|
+
function useJwt(encodedJwt, options = {}) {
|
|
353
|
+
const encodedJwtRef = vueDemi.ref(encodedJwt);
|
|
354
|
+
const {
|
|
355
|
+
onError,
|
|
356
|
+
fallbackValue = null
|
|
357
|
+
} = options;
|
|
358
|
+
const decodeWithFallback = (encodedJwt2, options2) => {
|
|
359
|
+
try {
|
|
360
|
+
return jwt_decode__default["default"](encodedJwt2, options2);
|
|
361
|
+
} catch (err) {
|
|
362
|
+
onError == null ? void 0 : onError(err);
|
|
363
|
+
return fallbackValue;
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
const header = vueDemi.computed(() => decodeWithFallback(encodedJwtRef.value, { header: true }));
|
|
367
|
+
const payload = vueDemi.computed(() => decodeWithFallback(encodedJwtRef.value));
|
|
368
|
+
return {
|
|
369
|
+
header,
|
|
370
|
+
payload
|
|
371
|
+
};
|
|
291
372
|
}
|
|
292
373
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
isLoading,
|
|
322
|
-
progress,
|
|
323
|
-
start: nprogress__default['default'].start,
|
|
324
|
-
done: nprogress__default['default'].done,
|
|
325
|
-
remove: () => {
|
|
326
|
-
progress.value = null;
|
|
327
|
-
nprogress__default['default'].remove();
|
|
328
|
-
},
|
|
329
|
-
};
|
|
374
|
+
function useNProgress(currentProgress = null, options) {
|
|
375
|
+
const progress = vueDemi.isRef(currentProgress) ? currentProgress : vueDemi.ref(currentProgress);
|
|
376
|
+
const isLoading = vueDemi.computed({
|
|
377
|
+
set: (load) => load ? nprogress__default["default"].start() : nprogress__default["default"].done(),
|
|
378
|
+
get: () => shared.isNumber(progress.value) && progress.value < 1
|
|
379
|
+
});
|
|
380
|
+
if (options)
|
|
381
|
+
nprogress__default["default"].configure(options);
|
|
382
|
+
const setProgress = nprogress__default["default"].set;
|
|
383
|
+
nprogress__default["default"].set = (n) => {
|
|
384
|
+
progress.value = n;
|
|
385
|
+
return setProgress.call(nprogress__default["default"], n);
|
|
386
|
+
};
|
|
387
|
+
vueDemi.watchEffect(() => {
|
|
388
|
+
if (shared.isNumber(progress.value))
|
|
389
|
+
setProgress.call(nprogress__default["default"], progress.value);
|
|
390
|
+
});
|
|
391
|
+
shared.tryOnScopeDispose(nprogress__default["default"].remove);
|
|
392
|
+
return {
|
|
393
|
+
isLoading,
|
|
394
|
+
progress,
|
|
395
|
+
start: nprogress__default["default"].start,
|
|
396
|
+
done: nprogress__default["default"].done,
|
|
397
|
+
remove: () => {
|
|
398
|
+
progress.value = null;
|
|
399
|
+
nprogress__default["default"].remove();
|
|
400
|
+
}
|
|
401
|
+
};
|
|
330
402
|
}
|
|
331
403
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
const src = vueDemi.ref(text);
|
|
341
|
-
const result = vueDemi.ref('');
|
|
342
|
-
vueDemi.watch(src, async (value) => {
|
|
343
|
-
if (src.value && shared.isClient)
|
|
344
|
-
result.value = await QRCode__default['default'].toDataURL(value, options);
|
|
345
|
-
}, { immediate: true });
|
|
346
|
-
return result;
|
|
404
|
+
function useQRCode(text, options) {
|
|
405
|
+
const src = vueDemi.ref(text);
|
|
406
|
+
const result = vueDemi.ref("");
|
|
407
|
+
vueDemi.watch(src, async (value) => {
|
|
408
|
+
if (src.value && shared.isClient)
|
|
409
|
+
result.value = await QRCode__default["default"].toDataURL(value, options);
|
|
410
|
+
}, { immediate: true });
|
|
411
|
+
return result;
|
|
347
412
|
}
|
|
348
413
|
|
|
349
414
|
exports.createCookies = createCookies;
|
|
350
415
|
exports.useAxios = useAxios;
|
|
351
416
|
exports.useCookies = useCookies;
|
|
417
|
+
exports.useDrauu = useDrauu;
|
|
352
418
|
exports.useFocusTrap = useFocusTrap;
|
|
353
419
|
exports.useJwt = useJwt;
|
|
354
420
|
exports.useNProgress = useNProgress;
|