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