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