@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/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
- * Wrapper for axios.
75
- *
76
- * @see https://vueuse.org/useAxios
77
- * @param url
78
- * @param config
79
- */
80
- function useAxios(url, ...args) {
81
- let config = {};
82
- let instance = axios__default['default'];
83
- if (args.length > 0) {
84
- /**
85
- * Unable to use `instanceof` here becuase of (https://github.com/axios/axios/issues/737)
86
- * so instead we are checking if there is a `requset` on the object to see if it is an
87
- * axios instance
88
- */
89
- if ('request' in args[0])
90
- instance = args[0];
91
- else
92
- config = args[0];
93
- }
94
- if (args.length > 1) {
95
- if ('request' in args[1])
96
- instance = args[1];
97
- }
98
- const response = vueDemi.shallowRef();
99
- const data = vueDemi.shallowRef();
100
- const isFinished = vueDemi.ref(false);
101
- const isLoading = vueDemi.ref(true);
102
- const aborted = vueDemi.ref(false);
103
- const error = vueDemi.shallowRef();
104
- const cancelToken = axios__default['default'].CancelToken.source();
105
- const abort = (message) => {
106
- if (isFinished.value || !isLoading.value)
107
- return;
108
- cancelToken.cancel(message);
109
- aborted.value = true;
110
- isLoading.value = false;
111
- isFinished.value = false;
112
- };
113
- instance(url, Object.assign(Object.assign({}, config), { cancelToken: cancelToken.token }))
114
- .then((r) => {
115
- response.value = r;
116
- data.value = r.data;
117
- })
118
- .catch((e) => {
119
- error.value = e;
120
- })
121
- .finally(() => {
122
- isLoading.value = false;
123
- isFinished.value = true;
124
- });
125
- return {
126
- response,
127
- data,
128
- error,
129
- finished: isFinished,
130
- loading: isLoading,
131
- isFinished,
132
- isLoading,
133
- cancel: abort,
134
- canceled: aborted,
135
- aborted,
136
- abort,
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
- * Creates a new {@link useCookies} function
142
- * @param {Object} req - incoming http request (for SSR)
143
- * @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
144
- * @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
145
- */
146
- function createCookies(req) {
147
- const universalCookie = new Cookie__default['default'](req ? req.headers.cookie : null);
148
- return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
149
- }
150
- /**
151
- * Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
152
- * @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
153
- * @param {Object} options
154
- * @param {boolean} options.doNotParse - don't try parse value as JSON
155
- * @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
156
- * @param {Object} cookies - universal-cookie instance
157
- */
158
- function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie__default['default']()) {
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
- Copyright (c) Microsoft Corporation.
215
-
216
- Permission to use, copy, modify, and/or distribute this software for any
217
- purpose with or without fee is hereby granted.
218
-
219
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
220
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
221
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
222
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
223
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
224
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
225
- PERFORMANCE OF THIS SOFTWARE.
226
- ***************************************************************************** */
227
-
228
- function __rest(s, e) {
229
- var t = {};
230
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
231
- t[p] = s[p];
232
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
233
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
234
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
235
- t[p[i]] = s[p[i]];
236
- }
237
- return t;
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
- * Get the dom element of a ref of element or Vue component instance
242
- *
243
- * @param elRef
244
- */
245
- function unrefElement(elRef) {
246
- var _a, _b;
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 SwipeDirection;
252
- (function (SwipeDirection) {
253
- SwipeDirection["UP"] = "UP";
254
- SwipeDirection["RIGHT"] = "RIGHT";
255
- SwipeDirection["DOWN"] = "DOWN";
256
- SwipeDirection["LEFT"] = "LEFT";
257
- SwipeDirection["NONE"] = "NONE";
258
- })(SwipeDirection || (SwipeDirection = {}));
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
- * Reactive focus-trap
262
- *
263
- * @see https://vueuse.org/useFocusTrap
264
- * @param target The target element to trap focus within
265
- * @param options Focus trap options
266
- * @param autoFocus Focus trap automatically when mounted
267
- */
268
- function useFocusTrap(target, options = {}) {
269
- let trap;
270
- const { immediate } = options, focusTrapOptions = __rest(options, ["immediate"]);
271
- const hasFocus = vueDemi.ref(false);
272
- const isPaused = vueDemi.ref(false);
273
- const activate = (opts) => trap && trap.activate(opts);
274
- const deactivate = (opts) => trap && trap.deactivate(opts);
275
- const pause = () => {
276
- if (trap) {
277
- trap.pause();
278
- isPaused.value = true;
279
- }
280
- };
281
- const unpause = () => {
282
- if (trap) {
283
- trap.unpause();
284
- isPaused.value = false;
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
- };
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
- * Reactive decoded jwt token.
320
- *
321
- * @see https://vueuse.org/useJwt
322
- * @param jwt
323
- */
324
- function useJwt(encodedJwt, options = {}) {
325
- const encodedJwtRef = vueDemi.ref(encodedJwt);
326
- const { onError, fallbackValue = null, } = options;
327
- const decodeWithFallback = (encodedJwt, options) => {
328
- try {
329
- return jwt_decode__default['default'](encodedJwt, options);
330
- }
331
- catch (err) {
332
- onError === null || onError === void 0 ? void 0 : onError(err);
333
- return fallbackValue;
334
- }
335
- };
336
- const header = vueDemi.computed(() => decodeWithFallback(encodedJwtRef.value, { header: true }));
337
- const payload = vueDemi.computed(() => decodeWithFallback(encodedJwtRef.value));
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
- * Reactive progress bar.
346
- *
347
- * @see https://vueuse.org/useNProgress
348
- * @param currentProgress
349
- * @param options
350
- */
351
- function useNProgress(currentProgress = null, options) {
352
- const progress = vueDemi.isRef(currentProgress)
353
- ? currentProgress
354
- : vueDemi.ref(currentProgress);
355
- const isLoading = vueDemi.computed({
356
- set: load => load ? nprogress__default['default'].start() : nprogress__default['default'].done(),
357
- get: () => shared.isNumber(progress.value) && progress.value < 1,
358
- });
359
- if (options)
360
- nprogress__default['default'].configure(options);
361
- const setProgress = nprogress__default['default'].set;
362
- nprogress__default['default'].set = (n) => {
363
- progress.value = n;
364
- return setProgress.call(nprogress__default['default'], n);
365
- };
366
- vueDemi.watchEffect(() => {
367
- if (shared.isNumber(progress.value))
368
- setProgress.call(nprogress__default['default'], progress.value);
369
- });
370
- shared.tryOnScopeDispose(nprogress__default['default'].remove);
371
- return {
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
- * Wrapper for qrcode.
385
- *
386
- * @see https://vueuse.org/useQRCode
387
- * @param text
388
- * @param options
389
- */
390
- function useQRCode(text, options) {
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);