@vueuse/integrations 6.4.1 → 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/index.cjs +375 -401
- package/index.d.ts +20 -49
- package/index.iife.js +376 -403
- package/index.iife.min.js +1 -1
- package/index.mjs +377 -403
- package/package.json +5 -5
- 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 +116 -108
- package/useDrauu.d.ts +21 -50
- package/useDrauu.iife.js +117 -110
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +118 -110
- 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
|
@@ -7,6 +7,7 @@ var axios = require('axios');
|
|
|
7
7
|
var shared = require('@vueuse/shared');
|
|
8
8
|
var Cookie = require('universal-cookie');
|
|
9
9
|
var drauu = require('drauu');
|
|
10
|
+
var core = require('@vueuse/core');
|
|
10
11
|
var focusTrap = require('focus-trap');
|
|
11
12
|
var jwt_decode = require('jwt-decode');
|
|
12
13
|
var nprogress = require('nprogress');
|
|
@@ -20,421 +21,394 @@ var jwt_decode__default = /*#__PURE__*/_interopDefaultLegacy(jwt_decode);
|
|
|
20
21
|
var nprogress__default = /*#__PURE__*/_interopDefaultLegacy(nprogress);
|
|
21
22
|
var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode);
|
|
22
23
|
|
|
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
|
-
|
|
87
|
-
|
|
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
|
+
};
|
|
88
93
|
}
|
|
89
94
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
|
110
|
-
let previousCookies = cookies.getAll({ doNotParse: true });
|
|
111
|
-
/**
|
|
112
|
-
* Adds reactivity to get/getAll methods
|
|
113
|
-
*/
|
|
114
|
-
const touches = vueDemi.ref(0);
|
|
115
|
-
const onChange = () => {
|
|
116
|
-
const newCookies = cookies.getAll({ doNotParse: true });
|
|
117
|
-
if (shouldUpdate(watchingDependencies || null, newCookies, previousCookies))
|
|
118
|
-
touches.value++;
|
|
119
|
-
previousCookies = newCookies;
|
|
120
|
-
};
|
|
121
|
-
cookies.addChangeListener(onChange);
|
|
122
|
-
shared.tryOnScopeDispose(() => {
|
|
123
|
-
cookies.removeChangeListener(onChange);
|
|
124
|
-
});
|
|
125
|
-
return {
|
|
126
|
-
/**
|
|
127
|
-
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
128
|
-
*/
|
|
129
|
-
get: (...args) => {
|
|
130
|
-
/**
|
|
131
|
-
* Auto update watching dependencies if needed
|
|
132
|
-
*/
|
|
133
|
-
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
134
|
-
watchingDependencies.push(args[0]);
|
|
135
|
-
// eslint-disable-next-line no-unused-expressions
|
|
136
|
-
touches.value; // adds reactivity to method
|
|
137
|
-
return cookies.get(args[0], Object.assign({ doNotParse }, args[1]));
|
|
138
|
-
},
|
|
139
|
-
/**
|
|
140
|
-
* Reactive get all cookies
|
|
141
|
-
*/
|
|
142
|
-
getAll: (...args) => {
|
|
143
|
-
// eslint-disable-next-line no-unused-expressions
|
|
144
|
-
touches.value; // adds reactivity to method
|
|
145
|
-
return cookies.getAll(Object.assign({ doNotParse }, args[0]));
|
|
146
|
-
},
|
|
147
|
-
set: (...args) => cookies.set(...args),
|
|
148
|
-
remove: (...args) => cookies.remove(...args),
|
|
149
|
-
addChangeListener: (...args) => cookies.addChangeListener(...args),
|
|
150
|
-
removeChangeListener: (...args) => cookies.removeChangeListener(...args),
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
154
|
-
if (!dependencies)
|
|
155
|
-
return true;
|
|
156
|
-
for (const dependency of dependencies) {
|
|
157
|
-
if (newCookies[dependency] !== oldCookies[dependency])
|
|
158
|
-
return true;
|
|
159
|
-
}
|
|
160
|
-
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);
|
|
161
114
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
+
};
|
|
172
145
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
182
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
183
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
184
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
185
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
186
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
187
|
-
***************************************************************************** */
|
|
188
|
-
|
|
189
|
-
function __rest(s, e) {
|
|
190
|
-
var t = {};
|
|
191
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
192
|
-
t[p] = s[p];
|
|
193
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
194
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
195
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
196
|
-
t[p[i]] = s[p[i]];
|
|
197
|
-
}
|
|
198
|
-
return t;
|
|
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;
|
|
199
154
|
}
|
|
200
155
|
|
|
201
|
-
var
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
function useDrauu(target, options) {
|
|
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
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
+
};
|
|
298
271
|
}
|
|
299
272
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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
|
+
};
|
|
356
350
|
}
|
|
357
351
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return {
|
|
379
|
-
header,
|
|
380
|
-
payload,
|
|
381
|
-
};
|
|
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
|
+
};
|
|
382
372
|
}
|
|
383
373
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
isLoading,
|
|
413
|
-
progress,
|
|
414
|
-
start: nprogress__default['default'].start,
|
|
415
|
-
done: nprogress__default['default'].done,
|
|
416
|
-
remove: () => {
|
|
417
|
-
progress.value = null;
|
|
418
|
-
nprogress__default['default'].remove();
|
|
419
|
-
},
|
|
420
|
-
};
|
|
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
|
+
};
|
|
421
402
|
}
|
|
422
403
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
const src = vueDemi.ref(text);
|
|
432
|
-
const result = vueDemi.ref('');
|
|
433
|
-
vueDemi.watch(src, async (value) => {
|
|
434
|
-
if (src.value && shared.isClient)
|
|
435
|
-
result.value = await QRCode__default['default'].toDataURL(value, options);
|
|
436
|
-
}, { immediate: true });
|
|
437
|
-
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;
|
|
438
412
|
}
|
|
439
413
|
|
|
440
414
|
exports.createCookies = createCookies;
|