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