@vueuse/integrations 10.11.0 → 11.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -4,18 +4,37 @@ var shared = require('@vueuse/shared');
4
4
  var Schema = require('async-validator');
5
5
  var vueDemi = require('vue-demi');
6
6
  var axios = require('axios');
7
- var changeCase$1 = require('change-case');
7
+ var changeCase = require('change-case');
8
8
  var Cookie = require('universal-cookie');
9
9
  var drauu = require('drauu');
10
10
  var core = require('@vueuse/core');
11
11
  var focusTrap = require('focus-trap');
12
12
  var Fuse = require('fuse.js');
13
13
  var idbKeyval = require('idb-keyval');
14
- var jwt_decode = require('jwt-decode');
14
+ var jwtDecode = require('jwt-decode');
15
15
  var nprogress = require('nprogress');
16
16
  var QRCode = require('qrcode');
17
17
  var Sortable = require('sortablejs');
18
18
 
19
+ function _interopNamespaceDefault(e) {
20
+ var n = Object.create(null);
21
+ if (e) {
22
+ Object.keys(e).forEach(function (k) {
23
+ if (k !== 'default') {
24
+ var d = Object.getOwnPropertyDescriptor(e, k);
25
+ Object.defineProperty(n, k, d.get ? d : {
26
+ enumerable: true,
27
+ get: function () { return e[k]; }
28
+ });
29
+ }
30
+ });
31
+ }
32
+ n.default = e;
33
+ return Object.freeze(n);
34
+ }
35
+
36
+ var changeCase__namespace = /*#__PURE__*/_interopNamespaceDefault(changeCase);
37
+
19
38
  const AsyncValidatorSchema = Schema.default || Schema;
20
39
  function useAsyncValidator(value, rules, options = {}) {
21
40
  const {
@@ -201,28 +220,23 @@ function useAxios(...args) {
201
220
  };
202
221
  }
203
222
 
204
- var changeCase = /*#__PURE__*/Object.freeze({
205
- __proto__: null,
206
- camelCase: changeCase$1.camelCase,
207
- capitalCase: changeCase$1.capitalCase,
208
- constantCase: changeCase$1.constantCase,
209
- dotCase: changeCase$1.dotCase,
210
- headerCase: changeCase$1.headerCase,
211
- noCase: changeCase$1.noCase,
212
- paramCase: changeCase$1.paramCase,
213
- pascalCase: changeCase$1.pascalCase,
214
- pathCase: changeCase$1.pathCase,
215
- sentenceCase: changeCase$1.sentenceCase,
216
- snakeCase: changeCase$1.snakeCase
217
- });
218
-
223
+ const changeCaseTransforms = /* @__PURE__ */ Object.values(changeCase__namespace).filter((v) => typeof v === "function" && v.name.endsWith("Case")).reduce((acc, fn) => {
224
+ acc[fn.name] = fn;
225
+ return acc;
226
+ }, {});
219
227
  function useChangeCase(input, type, options) {
228
+ const typeRef = vueDemi.computed(() => {
229
+ const t = shared.toValue(type);
230
+ if (!changeCaseTransforms[t])
231
+ throw new Error(`Invalid change case type "${t}"`);
232
+ return t;
233
+ });
220
234
  if (typeof input === "function")
221
- return vueDemi.computed(() => changeCase[type](shared.toValue(input), options));
235
+ return vueDemi.computed(() => changeCaseTransforms[typeRef.value](shared.toValue(input), shared.toValue(options)));
222
236
  const text = vueDemi.ref(input);
223
237
  return vueDemi.computed({
224
238
  get() {
225
- return changeCase[type](text.value, options);
239
+ return changeCaseTransforms[typeRef.value](text.value, shared.toValue(options));
226
240
  },
227
241
  set(value) {
228
242
  text.value = value;
@@ -413,12 +427,19 @@ function useFocusTrap(target, options = {}) {
413
427
  isPaused.value = false;
414
428
  }
415
429
  };
430
+ const targets = vueDemi.computed(() => {
431
+ const _targets = shared.toValue(target);
432
+ return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
433
+ const _el = shared.toValue(el);
434
+ return typeof _el === "string" ? _el : core.unrefElement(_el);
435
+ }).filter(shared.notNullish);
436
+ });
416
437
  vueDemi.watch(
417
- () => core.unrefElement(target),
418
- (el) => {
419
- if (!el)
438
+ targets,
439
+ (els) => {
440
+ if (!els.length)
420
441
  return;
421
- trap = focusTrap.createFocusTrap(el, {
442
+ trap = focusTrap.createFocusTrap(els, {
422
443
  ...focusTrapOptions,
423
444
  onActivate() {
424
445
  hasFocus.value = true;
@@ -549,7 +570,7 @@ function useJwt(encodedJwt, options = {}) {
549
570
  } = options;
550
571
  const decodeWithFallback = (encodedJwt2, options2) => {
551
572
  try {
552
- return jwt_decode(encodedJwt2, options2);
573
+ return jwtDecode.jwtDecode(encodedJwt2, options2);
553
574
  } catch (err) {
554
575
  onError == null ? void 0 : onError(err);
555
576
  return fallbackValue;
package/index.d.cts CHANGED
@@ -3,14 +3,16 @@ import { ValidateError, ValidateOption, Rules } from 'async-validator';
3
3
  import * as vue_demi from 'vue-demi';
4
4
  import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
5
5
  import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
6
- import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
6
+ import * as changeCase from 'change-case';
7
+ import { Options } from 'change-case';
7
8
  import * as universal_cookie from 'universal-cookie';
8
9
  import universal_cookie__default from 'universal-cookie';
9
10
  import { IncomingMessage } from 'node:http';
10
11
  import { Options as Options$1, Drauu, Brush } from 'drauu';
11
- import { EventHookOn, MaybeComputedElementRef, Fn, MaybeElementRef, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
12
+ import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
12
13
  import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
13
- import Fuse from 'fuse.js';
14
+ import * as fuse_js from 'fuse.js';
15
+ import { IFuseOptions, FuseResult } from 'fuse.js';
14
16
  import { JwtPayload, JwtHeader } from 'jwt-decode';
15
17
  import nprogress, { NProgressOptions } from 'nprogress';
16
18
  import QRCode from 'qrcode';
@@ -155,24 +157,14 @@ declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: Axios
155
157
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
156
158
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
157
159
 
158
- declare const changeCase_camelCase: typeof camelCase;
159
- declare const changeCase_capitalCase: typeof capitalCase;
160
- declare const changeCase_constantCase: typeof constantCase;
161
- declare const changeCase_dotCase: typeof dotCase;
162
- declare const changeCase_headerCase: typeof headerCase;
163
- declare const changeCase_noCase: typeof noCase;
164
- declare const changeCase_paramCase: typeof paramCase;
165
- declare const changeCase_pascalCase: typeof pascalCase;
166
- declare const changeCase_pathCase: typeof pathCase;
167
- declare const changeCase_sentenceCase: typeof sentenceCase;
168
- declare const changeCase_snakeCase: typeof snakeCase;
169
- declare namespace changeCase {
170
- export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
171
- }
172
-
173
- type ChangeCaseType = keyof typeof changeCase;
174
- declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
175
- declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
160
+ type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
161
+ type FilterKeys<T> = {
162
+ [K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
163
+ };
164
+ type ChangeCaseKeys = FilterKeys<typeof changeCase>;
165
+ type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
166
+ declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
167
+ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
176
168
 
177
169
  /**
178
170
  * Creates a new {@link useCookies} function
@@ -191,7 +183,7 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
191
183
  /**
192
184
  * Reactive get all cookies
193
185
  */
194
- getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
186
+ getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
195
187
  set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
196
188
  remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
197
189
  addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
@@ -216,7 +208,7 @@ declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUp
216
208
  /**
217
209
  * Reactive get all cookies
218
210
  */
219
- getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
211
+ getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
220
212
  set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
221
213
  remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
222
214
  addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
@@ -297,9 +289,9 @@ interface UseFocusTrapReturn {
297
289
  *
298
290
  * @see https://vueuse.org/useFocusTrap
299
291
  */
300
- declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
292
+ declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
301
293
 
302
- type FuseOptions<T> = Fuse.IFuseOptions<T>;
294
+ type FuseOptions<T> = IFuseOptions<T>;
303
295
  interface UseFuseOptions<T> {
304
296
  fuseOptions?: FuseOptions<T>;
305
297
  resultLimit?: number;
@@ -307,14 +299,14 @@ interface UseFuseOptions<T> {
307
299
  }
308
300
  declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
309
301
  fuse: vue_demi.Ref<{
310
- search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
311
- setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
302
+ search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
303
+ setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
312
304
  add: (doc: DataItem) => void;
313
305
  remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
314
306
  removeAt: (idx: number) => void;
315
- getIndex: () => Fuse.FuseIndex<DataItem>;
307
+ getIndex: () => fuse_js.FuseIndex<DataItem>;
316
308
  }>;
317
- results: ComputedRef<Fuse.FuseResult<DataItem>[]>;
309
+ results: ComputedRef<FuseResult<DataItem>[]>;
318
310
  };
319
311
  type UseFuseReturn = ReturnType<typeof useFuse>;
320
312
 
@@ -390,7 +382,7 @@ declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null |
390
382
  isLoading: vue_demi.WritableComputedRef<boolean>;
391
383
  progress: vue_demi.Ref<number | (() => number | null | undefined) | null | undefined>;
392
384
  start: () => nprogress.NProgress;
393
- done: (force?: boolean | undefined) => nprogress.NProgress;
385
+ done: (force?: boolean) => nprogress.NProgress;
394
386
  remove: () => void;
395
387
  };
396
388
  type UseNProgressReturn = ReturnType<typeof useNProgress>;
package/index.d.mts CHANGED
@@ -3,14 +3,16 @@ import { ValidateError, ValidateOption, Rules } from 'async-validator';
3
3
  import * as vue_demi from 'vue-demi';
4
4
  import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
5
5
  import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
6
- import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
6
+ import * as changeCase from 'change-case';
7
+ import { Options } from 'change-case';
7
8
  import * as universal_cookie from 'universal-cookie';
8
9
  import universal_cookie__default from 'universal-cookie';
9
10
  import { IncomingMessage } from 'node:http';
10
11
  import { Options as Options$1, Drauu, Brush } from 'drauu';
11
- import { EventHookOn, MaybeComputedElementRef, Fn, MaybeElementRef, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
12
+ import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
12
13
  import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
13
- import Fuse from 'fuse.js';
14
+ import * as fuse_js from 'fuse.js';
15
+ import { IFuseOptions, FuseResult } from 'fuse.js';
14
16
  import { JwtPayload, JwtHeader } from 'jwt-decode';
15
17
  import nprogress, { NProgressOptions } from 'nprogress';
16
18
  import QRCode from 'qrcode';
@@ -155,24 +157,14 @@ declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: Axios
155
157
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
156
158
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
157
159
 
158
- declare const changeCase_camelCase: typeof camelCase;
159
- declare const changeCase_capitalCase: typeof capitalCase;
160
- declare const changeCase_constantCase: typeof constantCase;
161
- declare const changeCase_dotCase: typeof dotCase;
162
- declare const changeCase_headerCase: typeof headerCase;
163
- declare const changeCase_noCase: typeof noCase;
164
- declare const changeCase_paramCase: typeof paramCase;
165
- declare const changeCase_pascalCase: typeof pascalCase;
166
- declare const changeCase_pathCase: typeof pathCase;
167
- declare const changeCase_sentenceCase: typeof sentenceCase;
168
- declare const changeCase_snakeCase: typeof snakeCase;
169
- declare namespace changeCase {
170
- export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
171
- }
172
-
173
- type ChangeCaseType = keyof typeof changeCase;
174
- declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
175
- declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
160
+ type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
161
+ type FilterKeys<T> = {
162
+ [K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
163
+ };
164
+ type ChangeCaseKeys = FilterKeys<typeof changeCase>;
165
+ type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
166
+ declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
167
+ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
176
168
 
177
169
  /**
178
170
  * Creates a new {@link useCookies} function
@@ -191,7 +183,7 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
191
183
  /**
192
184
  * Reactive get all cookies
193
185
  */
194
- getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
186
+ getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
195
187
  set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
196
188
  remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
197
189
  addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
@@ -216,7 +208,7 @@ declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUp
216
208
  /**
217
209
  * Reactive get all cookies
218
210
  */
219
- getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
211
+ getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
220
212
  set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
221
213
  remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
222
214
  addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
@@ -297,9 +289,9 @@ interface UseFocusTrapReturn {
297
289
  *
298
290
  * @see https://vueuse.org/useFocusTrap
299
291
  */
300
- declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
292
+ declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
301
293
 
302
- type FuseOptions<T> = Fuse.IFuseOptions<T>;
294
+ type FuseOptions<T> = IFuseOptions<T>;
303
295
  interface UseFuseOptions<T> {
304
296
  fuseOptions?: FuseOptions<T>;
305
297
  resultLimit?: number;
@@ -307,14 +299,14 @@ interface UseFuseOptions<T> {
307
299
  }
308
300
  declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
309
301
  fuse: vue_demi.Ref<{
310
- search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
311
- setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
302
+ search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
303
+ setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
312
304
  add: (doc: DataItem) => void;
313
305
  remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
314
306
  removeAt: (idx: number) => void;
315
- getIndex: () => Fuse.FuseIndex<DataItem>;
307
+ getIndex: () => fuse_js.FuseIndex<DataItem>;
316
308
  }>;
317
- results: ComputedRef<Fuse.FuseResult<DataItem>[]>;
309
+ results: ComputedRef<FuseResult<DataItem>[]>;
318
310
  };
319
311
  type UseFuseReturn = ReturnType<typeof useFuse>;
320
312
 
@@ -390,7 +382,7 @@ declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null |
390
382
  isLoading: vue_demi.WritableComputedRef<boolean>;
391
383
  progress: vue_demi.Ref<number | (() => number | null | undefined) | null | undefined>;
392
384
  start: () => nprogress.NProgress;
393
- done: (force?: boolean | undefined) => nprogress.NProgress;
385
+ done: (force?: boolean) => nprogress.NProgress;
394
386
  remove: () => void;
395
387
  };
396
388
  type UseNProgressReturn = ReturnType<typeof useNProgress>;
package/index.d.ts CHANGED
@@ -3,14 +3,16 @@ import { ValidateError, ValidateOption, Rules } from 'async-validator';
3
3
  import * as vue_demi from 'vue-demi';
4
4
  import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
5
5
  import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
6
- import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
6
+ import * as changeCase from 'change-case';
7
+ import { Options } from 'change-case';
7
8
  import * as universal_cookie from 'universal-cookie';
8
9
  import universal_cookie__default from 'universal-cookie';
9
10
  import { IncomingMessage } from 'node:http';
10
11
  import { Options as Options$1, Drauu, Brush } from 'drauu';
11
- import { EventHookOn, MaybeComputedElementRef, Fn, MaybeElementRef, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
12
+ import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
12
13
  import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
13
- import Fuse from 'fuse.js';
14
+ import * as fuse_js from 'fuse.js';
15
+ import { IFuseOptions, FuseResult } from 'fuse.js';
14
16
  import { JwtPayload, JwtHeader } from 'jwt-decode';
15
17
  import nprogress, { NProgressOptions } from 'nprogress';
16
18
  import QRCode from 'qrcode';
@@ -155,24 +157,14 @@ declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: Axios
155
157
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
156
158
  declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
157
159
 
158
- declare const changeCase_camelCase: typeof camelCase;
159
- declare const changeCase_capitalCase: typeof capitalCase;
160
- declare const changeCase_constantCase: typeof constantCase;
161
- declare const changeCase_dotCase: typeof dotCase;
162
- declare const changeCase_headerCase: typeof headerCase;
163
- declare const changeCase_noCase: typeof noCase;
164
- declare const changeCase_paramCase: typeof paramCase;
165
- declare const changeCase_pascalCase: typeof pascalCase;
166
- declare const changeCase_pathCase: typeof pathCase;
167
- declare const changeCase_sentenceCase: typeof sentenceCase;
168
- declare const changeCase_snakeCase: typeof snakeCase;
169
- declare namespace changeCase {
170
- export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
171
- }
172
-
173
- type ChangeCaseType = keyof typeof changeCase;
174
- declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
175
- declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
160
+ type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
161
+ type FilterKeys<T> = {
162
+ [K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
163
+ };
164
+ type ChangeCaseKeys = FilterKeys<typeof changeCase>;
165
+ type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
166
+ declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
167
+ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
176
168
 
177
169
  /**
178
170
  * Creates a new {@link useCookies} function
@@ -191,7 +183,7 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
191
183
  /**
192
184
  * Reactive get all cookies
193
185
  */
194
- getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
186
+ getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
195
187
  set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
196
188
  remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
197
189
  addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
@@ -216,7 +208,7 @@ declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUp
216
208
  /**
217
209
  * Reactive get all cookies
218
210
  */
219
- getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
211
+ getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
220
212
  set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
221
213
  remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
222
214
  addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
@@ -297,9 +289,9 @@ interface UseFocusTrapReturn {
297
289
  *
298
290
  * @see https://vueuse.org/useFocusTrap
299
291
  */
300
- declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
292
+ declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
301
293
 
302
- type FuseOptions<T> = Fuse.IFuseOptions<T>;
294
+ type FuseOptions<T> = IFuseOptions<T>;
303
295
  interface UseFuseOptions<T> {
304
296
  fuseOptions?: FuseOptions<T>;
305
297
  resultLimit?: number;
@@ -307,14 +299,14 @@ interface UseFuseOptions<T> {
307
299
  }
308
300
  declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
309
301
  fuse: vue_demi.Ref<{
310
- search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
311
- setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
302
+ search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
303
+ setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
312
304
  add: (doc: DataItem) => void;
313
305
  remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
314
306
  removeAt: (idx: number) => void;
315
- getIndex: () => Fuse.FuseIndex<DataItem>;
307
+ getIndex: () => fuse_js.FuseIndex<DataItem>;
316
308
  }>;
317
- results: ComputedRef<Fuse.FuseResult<DataItem>[]>;
309
+ results: ComputedRef<FuseResult<DataItem>[]>;
318
310
  };
319
311
  type UseFuseReturn = ReturnType<typeof useFuse>;
320
312
 
@@ -390,7 +382,7 @@ declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null |
390
382
  isLoading: vue_demi.WritableComputedRef<boolean>;
391
383
  progress: vue_demi.Ref<number | (() => number | null | undefined) | null | undefined>;
392
384
  start: () => nprogress.NProgress;
393
- done: (force?: boolean | undefined) => nprogress.NProgress;
385
+ done: (force?: boolean) => nprogress.NProgress;
394
386
  remove: () => void;
395
387
  };
396
388
  type UseNProgressReturn = ReturnType<typeof useNProgress>;
package/index.iife.js CHANGED
@@ -118,9 +118,28 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
118
118
  (globalThis || self).VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
119
119
  );
120
120
  ;
121
- ;(function (exports, shared, Schema, vueDemi, axios, changeCase$1, Cookie, drauu, core, focusTrap, Fuse, idbKeyval, jwt_decode, nprogress, QRCode, Sortable) {
121
+ ;(function (exports, shared, Schema, vueDemi, axios, changeCase, Cookie, drauu, core, focusTrap, Fuse, idbKeyval, jwtDecode, nprogress, QRCode, Sortable) {
122
122
  'use strict';
123
123
 
124
+ function _interopNamespaceDefault(e) {
125
+ var n = Object.create(null);
126
+ if (e) {
127
+ Object.keys(e).forEach(function (k) {
128
+ if (k !== 'default') {
129
+ var d = Object.getOwnPropertyDescriptor(e, k);
130
+ Object.defineProperty(n, k, d.get ? d : {
131
+ enumerable: true,
132
+ get: function () { return e[k]; }
133
+ });
134
+ }
135
+ });
136
+ }
137
+ n.default = e;
138
+ return Object.freeze(n);
139
+ }
140
+
141
+ var changeCase__namespace = /*#__PURE__*/_interopNamespaceDefault(changeCase);
142
+
124
143
  const AsyncValidatorSchema = Schema.default || Schema;
125
144
  function useAsyncValidator(value, rules, options = {}) {
126
145
  const {
@@ -306,28 +325,23 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
306
325
  };
307
326
  }
308
327
 
309
- var changeCase = /*#__PURE__*/Object.freeze({
310
- __proto__: null,
311
- camelCase: changeCase$1.camelCase,
312
- capitalCase: changeCase$1.capitalCase,
313
- constantCase: changeCase$1.constantCase,
314
- dotCase: changeCase$1.dotCase,
315
- headerCase: changeCase$1.headerCase,
316
- noCase: changeCase$1.noCase,
317
- paramCase: changeCase$1.paramCase,
318
- pascalCase: changeCase$1.pascalCase,
319
- pathCase: changeCase$1.pathCase,
320
- sentenceCase: changeCase$1.sentenceCase,
321
- snakeCase: changeCase$1.snakeCase
322
- });
323
-
328
+ const changeCaseTransforms = /* @__PURE__ */ Object.values(changeCase__namespace).filter((v) => typeof v === "function" && v.name.endsWith("Case")).reduce((acc, fn) => {
329
+ acc[fn.name] = fn;
330
+ return acc;
331
+ }, {});
324
332
  function useChangeCase(input, type, options) {
333
+ const typeRef = vueDemi.computed(() => {
334
+ const t = shared.toValue(type);
335
+ if (!changeCaseTransforms[t])
336
+ throw new Error(`Invalid change case type "${t}"`);
337
+ return t;
338
+ });
325
339
  if (typeof input === "function")
326
- return vueDemi.computed(() => changeCase[type](shared.toValue(input), options));
340
+ return vueDemi.computed(() => changeCaseTransforms[typeRef.value](shared.toValue(input), shared.toValue(options)));
327
341
  const text = vueDemi.ref(input);
328
342
  return vueDemi.computed({
329
343
  get() {
330
- return changeCase[type](text.value, options);
344
+ return changeCaseTransforms[typeRef.value](text.value, shared.toValue(options));
331
345
  },
332
346
  set(value) {
333
347
  text.value = value;
@@ -518,12 +532,19 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
518
532
  isPaused.value = false;
519
533
  }
520
534
  };
535
+ const targets = vueDemi.computed(() => {
536
+ const _targets = shared.toValue(target);
537
+ return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
538
+ const _el = shared.toValue(el);
539
+ return typeof _el === "string" ? _el : core.unrefElement(_el);
540
+ }).filter(shared.notNullish);
541
+ });
521
542
  vueDemi.watch(
522
- () => core.unrefElement(target),
523
- (el) => {
524
- if (!el)
543
+ targets,
544
+ (els) => {
545
+ if (!els.length)
525
546
  return;
526
- trap = focusTrap.createFocusTrap(el, {
547
+ trap = focusTrap.createFocusTrap(els, {
527
548
  ...focusTrapOptions,
528
549
  onActivate() {
529
550
  hasFocus.value = true;
@@ -654,7 +675,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
654
675
  } = options;
655
676
  const decodeWithFallback = (encodedJwt2, options2) => {
656
677
  try {
657
- return jwt_decode(encodedJwt2, options2);
678
+ return jwtDecode.jwtDecode(encodedJwt2, options2);
658
679
  } catch (err) {
659
680
  onError == null ? void 0 : onError(err);
660
681
  return fallbackValue;
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- var VueDemi=function(l,o,T){if(l.install)return l;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),l;if(o.version.slice(0,4)==="2.7."){let p=function(A,P){var h,G={},N={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(g,L){return G[g]=L,this},directive:function(g,L){return L?(o.directive(g,L),N):o.directive(g)},mount:function(g,L){return h||(h=new o(Object.assign({propsData:P},A,{provide:Object.assign(G,A.provide)})),h.$mount(g,L),h)},unmount:function(){h&&(h.$destroy(),h=void 0)}};return N};var B=p;for(var n in o)l[n]=o[n];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.warn=o.util.warn,l.hasInjectionContext=function(){return!!l.getCurrentInstance()},l.createApp=p}else if(o.version.slice(0,2)==="2.")if(T){for(var n in T)l[n]=T[n];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.hasInjectionContext=function(){return!!l.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var n in o)l[n]=o[n];l.isVue2=!1,l.isVue3=!0,l.install=function(){},l.Vue=o,l.Vue2=void 0,l.version=o.version,l.set=function(p,A,P){return Array.isArray(p)?(p.length=Math.max(p.length,A),p.splice(A,1,P),P):(p[A]=P,P)},l.del=function(p,A){if(Array.isArray(p)){p.splice(A,1);return}delete p[A]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return l}((globalThis||self).VueDemi=(globalThis||self).VueDemi||(typeof VueDemi<"u"?VueDemi:{}),(globalThis||self).Vue||(typeof Vue<"u"?Vue:void 0),(globalThis||self).VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(l,o,T,n,B,p,A,P,h,G,N,g,L,E,V,$){"use strict";const D=T.default||T;function ee(t,r,e={}){const{validateOption:a={},immediate:s=!0,manual:f=!1}=e,c=o.toRef(t),i=n.shallowRef(null),u=n.ref(!0),C=n.ref(!s||f),w=n.computed(()=>{var d;return((d=i.value)==null?void 0:d.errors)||[]}),y=n.computed(()=>{var d;return((d=i.value)==null?void 0:d.fields)||{}}),I=n.computed(()=>new D(o.toValue(r))),_=async()=>{u.value=!1,C.value=!1;try{await I.value.validate(c.value,a),C.value=!0,i.value=null}catch(d){i.value=d}finally{u.value=!0}return{pass:C.value,errorInfo:i.value,errors:w.value,errorFields:y.value}};f||n.watch([c,I],()=>_(),{immediate:s,deep:!0});const S={isFinished:u,pass:C,errors:w,errorInfo:i,errorFields:y,execute:_};function F(){return new Promise((d,R)=>{o.until(u).toBe(!0).then(()=>d(S)).catch(O=>R(O))})}return{...S,then(d,R){return F().then(d,R)}}}function te(...t){const r=typeof t[0]=="string"?t[0]:void 0,e=typeof r=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let s={},f=B,c=a;const i=b=>!!b?.request;t.length>0+e&&(i(t[0+e])?f=t[0+e]:s=t[0+e]),t.length>1+e&&i(t[1+e])&&(f=t[1+e]),(t.length===2+e&&!i(t[1+e])||t.length===3+e)&&(c=t[t.length-1]||a);const{initialData:u,shallow:C,onSuccess:w=o.noop,onError:y=o.noop,immediate:I,resetOnExecute:_=!1}=c,S=n.shallowRef(),F=(C?n.shallowRef:n.ref)(u),d=n.ref(!1),R=n.ref(!1),O=n.ref(!1),k=n.shallowRef();let U=new AbortController;const j=b=>{d.value||!R.value||(U.abort(b),U=new AbortController,O.value=!0,R.value=!1,d.value=!1)},v=b=>{R.value=b,d.value=!b},m=()=>{_&&(F.value=u)},J=()=>new Promise((b,W)=>{o.until(d).toBe(!0).then(()=>k.value?W(k.value):b(X))}),x={then:(...b)=>J().then(...b),catch:(...b)=>J().catch(...b)};let Q=0;const K=(b=r,W={})=>{k.value=void 0;const Y=typeof b=="string"?b:r??W.url;if(Y===void 0)return k.value=new B.AxiosError(B.AxiosError.ERR_INVALID_URL),d.value=!0,x;m(),c.abortPrevious!==!1&&j(),v(!0),Q+=1;const ve=Q;return O.value=!1,f(Y,{...s,...typeof b=="object"?b:W,signal:U.signal}).then(H=>{if(O.value)return;S.value=H;const Z=H.data;F.value=Z,w(Z)}).catch(H=>{k.value=H,y(H)}).finally(()=>{var H;(H=c.onFinish)==null||H.call(c),ve===Q&&v(!1)}),x};I&&r&&K();const X={response:S,data:F,error:k,isFinished:d,isLoading:R,cancel:j,isAborted:O,isCanceled:O,abort:j,execute:K};return{...X,...x}}var z=Object.freeze({__proto__:null,camelCase:p.camelCase,capitalCase:p.capitalCase,constantCase:p.constantCase,dotCase:p.dotCase,headerCase:p.headerCase,noCase:p.noCase,paramCase:p.paramCase,pascalCase:p.pascalCase,pathCase:p.pathCase,sentenceCase:p.sentenceCase,snakeCase:p.snakeCase});function ne(t,r,e){if(typeof t=="function")return n.computed(()=>z[r](o.toValue(t),e));const a=n.ref(t);return n.computed({get(){return z[r](a.value,e)},set(s){a.value=s}})}function oe(t){const r=new A(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:s=!1}={})=>M(e,{doNotParse:a,autoUpdateDependencies:s},r)}function M(t,{doNotParse:r=!1,autoUpdateDependencies:e=!1}={},a=new A){const s=e?[...t||[]]:t;let f=a.getAll({doNotParse:!0});const c=n.ref(0),i=()=>{const u=a.getAll({doNotParse:!0});ae(s||null,u,f)&&c.value++,f=u};return a.addChangeListener(i),o.tryOnScopeDispose(()=>{a.removeChangeListener(i)}),{get:(...u)=>(e&&s&&!s.includes(u[0])&&s.push(u[0]),c.value,a.get(u[0],{doNotParse:r,...u[1]})),getAll:(...u)=>(c.value,a.getAll({doNotParse:r,...u[0]})),set:(...u)=>a.set(...u),remove:(...u)=>a.remove(...u),addChangeListener:(...u)=>a.addChangeListener(...u),removeChangeListener:(...u)=>a.removeChangeListener(...u)}}function ae(t,r,e){if(!t)return!0;for(const a of t)if(r[a]!==e[a])return!0;return!1}function le(t,r){const e=n.ref();let a=[];const s=h.createEventHook(),f=h.createEventHook(),c=h.createEventHook(),i=h.createEventHook(),u=h.createEventHook(),C=n.ref(!1),w=n.ref(!1),y=n.ref(!1),I=n.ref(!1),_=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...r?.brush});n.watch(_,()=>{const v=e.value;v&&(v.brush=_.value,v.mode=_.value.mode)},{deep:!0});const S=()=>{var v;return(v=e.value)==null?void 0:v.undo()},F=()=>{var v;return(v=e.value)==null?void 0:v.redo()},d=()=>{var v;return(v=e.value)==null?void 0:v.clear()},R=()=>{var v;return(v=e.value)==null?void 0:v.cancel()},O=v=>{var m;return(m=e.value)==null?void 0:m.load(v)},k=()=>{var v;return(v=e.value)==null?void 0:v.dump()},U=()=>{var v;a.forEach(m=>m()),(v=e.value)==null||v.unmount()},j=()=>{e.value&&(C.value=e.value.canUndo(),w.value=e.value.canRedo(),y.value=e.value.altPressed,I.value=e.value.shiftPressed)};return n.watch(()=>h.unrefElement(t),v=>{!v||typeof SVGSVGElement>"u"||!(v instanceof SVGSVGElement)||(e.value&&U(),e.value=P.createDrauu({el:v,...r}),j(),a=[e.value.on("canceled",()=>f.trigger()),e.value.on("committed",m=>c.trigger(m)),e.value.on("start",()=>i.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{j(),s.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>U()),{drauuInstance:e,load:O,dump:k,clear:d,cancel:R,undo:S,redo:F,canUndo:C,canRedo:w,brush:_,onChanged:s.on,onCommitted:c.on,onStart:i.on,onEnd:u.on,onCanceled:f.on}}function re(t,r={}){let e;const{immediate:a,...s}=r,f=n.ref(!1),c=n.ref(!1),i=y=>e&&e.activate(y),u=y=>e&&e.deactivate(y),C=()=>{e&&(e.pause(),c.value=!0)},w=()=>{e&&(e.unpause(),c.value=!1)};return n.watch(()=>h.unrefElement(t),y=>{y&&(e=G.createFocusTrap(y,{...s,onActivate(){f.value=!0,r.onActivate&&r.onActivate()},onDeactivate(){f.value=!1,r.onDeactivate&&r.onDeactivate()}}),a&&i())},{flush:"post"}),h.tryOnScopeDispose(()=>u()),{hasFocus:f,isPaused:c,activate:i,deactivate:u,pause:C,unpause:w}}function se(t,r,e){const a=()=>{var c,i;return new N((c=o.toValue(r))!=null?c:[],(i=o.toValue(e))==null?void 0:i.fuseOptions)},s=n.ref(a());n.watch(()=>{var c;return(c=o.toValue(e))==null?void 0:c.fuseOptions},()=>{s.value=a()},{deep:!0}),n.watch(()=>o.toValue(r),c=>{s.value.setCollection(c)},{deep:!0});const f=n.computed(()=>{const c=o.toValue(e);if(c?.matchAllWhenSearchEmpty&&!o.toValue(t))return o.toValue(r).map((u,C)=>({item:u,refIndex:C}));const i=c?.resultLimit;return s.value.search(o.toValue(t),i?{limit:i}:void 0)});return{fuse:s,results:f}}function ue(t,r,e={}){const{flush:a="pre",deep:s=!0,shallow:f=!1,onError:c=d=>{console.error(d)},writeDefaults:i=!0}=e,u=n.ref(!1),C=(f?n.shallowRef:n.ref)(r),w=o.toValue(r);async function y(){try{const d=await g.get(t);d===void 0?w!=null&&i&&await g.set(t,w):C.value=d}catch(d){c(d)}u.value=!0}y();async function I(){try{C.value==null?await g.del(t):await g.update(t,()=>n.toRaw(C.value))}catch(d){c(d)}}const{pause:_,resume:S}=h.watchPausable(C,()=>I(),{flush:a,deep:s});async function F(d){_(),C.value=d,await I(),S()}return{set:F,isFinished:u,data:C}}function ce(t,r={}){const{onError:e,fallbackValue:a=null}=r,s=(i,u)=>{try{return L(i,u)}catch(C){return e?.(C),a}},f=n.computed(()=>s(o.toValue(t),{header:!0})),c=n.computed(()=>s(o.toValue(t)));return{header:f,payload:c}}function ie(t=null,r){const e=n.ref(t),a=n.computed({set:f=>f?E.start():E.done(),get:()=>typeof e.value=="number"&&e.value<1});r&&E.configure(r);const s=E.set;return E.set=f=>(e.value=f,s.call(E,f)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&s.call(E,e.value)}),o.tryOnScopeDispose(E.remove),{isLoading:a,progress:e,start:E.start,done:E.done,remove:()=>{e.value=null,E.remove()}}}function fe(t,r){const e=o.toRef(t),a=n.ref("");return n.watch(e,async s=>{e.value&&o.isClient&&(a.value=await V.toDataURL(s,r))},{immediate:!0}),a}function de(t,r,e={}){let a;const{document:s=h.defaultDocument,...f}=e,c={onUpdate:w=>{q(r,w.oldIndex,w.newIndex)}},i=()=>{const w=typeof t=="string"?s?.querySelector(t):h.unrefElement(t);!w||a!==void 0||(a=new $(w,{...c,...f}))},u=()=>{a?.destroy(),a=void 0},C=(w,y)=>{if(y!==void 0)a?.option(w,y);else return a?.option(w)};return h.tryOnMounted(i),h.tryOnScopeDispose(u),{stop:u,start:i,option:C}}function q(t,r,e){const a=n.isRef(t),s=a?[...h.toValue(t)]:h.toValue(t);if(e>=0&&e<s.length){const f=s.splice(r,1)[0];n.nextTick(()=>{s.splice(e,0,f),a&&(t.value=s)})}}l.createCookies=oe,l.moveArrayElement=q,l.useAsyncValidator=ee,l.useAxios=te,l.useChangeCase=ne,l.useCookies=M,l.useDrauu=le,l.useFocusTrap=re,l.useFuse=se,l.useIDBKeyval=ue,l.useJwt=ce,l.useNProgress=ie,l.useQRCode=fe,l.useSortable=de})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
1
+ var VueDemi=function(l,n,H){if(l.install)return l;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),l;if(n.version.slice(0,4)==="2.7."){let g=function(O,F){var p,W={},B={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(_,j){return W[_]=j,this},directive:function(_,j){return j?(n.directive(_,j),B):n.directive(_)},mount:function(_,j){return p||(p=new n(Object.assign({propsData:F},O,{provide:Object.assign(W,O.provide)})),p.$mount(_,j),p)},unmount:function(){p&&(p.$destroy(),p=void 0)}};return B};var N=g;for(var o in n)l[o]=n[o];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=n,l.Vue2=n,l.version=n.version,l.warn=n.util.warn,l.hasInjectionContext=function(){return!!l.getCurrentInstance()},l.createApp=g}else if(n.version.slice(0,2)==="2.")if(H){for(var o in H)l[o]=H[o];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=n,l.Vue2=n,l.version=n.version,l.hasInjectionContext=function(){return!!l.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var o in n)l[o]=n[o];l.isVue2=!1,l.isVue3=!0,l.install=function(){},l.Vue=n,l.Vue2=void 0,l.version=n.version,l.set=function(g,O,F){return Array.isArray(g)?(g.length=Math.max(g.length,O),g.splice(O,1,F),F):(g[O]=F,F)},l.del=function(g,O){if(Array.isArray(g)){g.splice(O,1);return}delete g[O]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return l}((globalThis||self).VueDemi=(globalThis||self).VueDemi||(typeof VueDemi<"u"?VueDemi:{}),(globalThis||self).Vue||(typeof Vue<"u"?Vue:void 0),(globalThis||self).VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(l,n,H,o,N,g,O,F,p,W,B,_,j,R,Z,V){"use strict";function D(t){var r=Object.create(null);return t&&Object.keys(t).forEach(function(e){if(e!=="default"){var a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,a.get?a:{enumerable:!0,get:function(){return t[e]}})}}),r.default=t,Object.freeze(r)}var ee=D(g);const te=H.default||H;function ne(t,r,e={}){const{validateOption:a={},immediate:s=!0,manual:i=!1}=e,c=n.toRef(t),f=o.shallowRef(null),u=o.ref(!0),h=o.ref(!s||i),w=o.computed(()=>{var d;return((d=f.value)==null?void 0:d.errors)||[]}),b=o.computed(()=>{var d;return((d=f.value)==null?void 0:d.fields)||{}}),y=o.computed(()=>new te(n.toValue(r))),A=async()=>{u.value=!1,h.value=!1;try{await y.value.validate(c.value,a),h.value=!0,f.value=null}catch(d){f.value=d}finally{u.value=!0}return{pass:h.value,errorInfo:f.value,errors:w.value,errorFields:b.value}};i||o.watch([c,y],()=>A(),{immediate:s,deep:!0});const E={isFinished:u,pass:h,errors:w,errorInfo:f,errorFields:b,execute:A};function P(){return new Promise((d,I)=>{n.until(u).toBe(!0).then(()=>d(E)).catch(S=>I(S))})}return{...E,then(d,I){return P().then(d,I)}}}function oe(...t){const r=typeof t[0]=="string"?t[0]:void 0,e=typeof r=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let s={},i=N,c=a;const f=C=>!!C?.request;t.length>0+e&&(f(t[0+e])?i=t[0+e]:s=t[0+e]),t.length>1+e&&f(t[1+e])&&(i=t[1+e]),(t.length===2+e&&!f(t[1+e])||t.length===3+e)&&(c=t[t.length-1]||a);const{initialData:u,shallow:h,onSuccess:w=n.noop,onError:b=n.noop,immediate:y,resetOnExecute:A=!1}=c,E=o.shallowRef(),P=(h?o.shallowRef:o.ref)(u),d=o.ref(!1),I=o.ref(!1),S=o.ref(!1),m=o.shallowRef();let U=new AbortController;const k=C=>{d.value||!I.value||(U.abort(C),U=new AbortController,S.value=!0,I.value=!1,d.value=!1)},v=C=>{I.value=C,d.value=!C},L=()=>{A&&(P.value=u)},q=()=>new Promise((C,G)=>{n.until(d).toBe(!0).then(()=>m.value?G(m.value):C(K))}),Q={then:(...C)=>q().then(...C),catch:(...C)=>q().catch(...C)};let $=0;const J=(C=r,G={})=>{m.value=void 0;const X=typeof C=="string"?C:r??G.url;if(X===void 0)return m.value=new N.AxiosError(N.AxiosError.ERR_INVALID_URL),d.value=!0,Q;L(),c.abortPrevious!==!1&&k(),v(!0),$+=1;const he=$;return S.value=!1,i(X,{...s,...typeof C=="object"?C:G,signal:U.signal}).then(T=>{if(S.value)return;E.value=T;const Y=T.data;P.value=Y,w(Y)}).catch(T=>{m.value=T,b(T)}).finally(()=>{var T;(T=c.onFinish)==null||T.call(c),he===$&&v(!1)}),Q};y&&r&&J();const K={response:E,data:P,error:m,isFinished:d,isLoading:I,cancel:k,isAborted:S,isCanceled:S,abort:k,execute:J};return{...K,...Q}}const x=Object.values(ee).filter(t=>typeof t=="function"&&t.name.endsWith("Case")).reduce((t,r)=>(t[r.name]=r,t),{});function ae(t,r,e){const a=o.computed(()=>{const i=n.toValue(r);if(!x[i])throw new Error(`Invalid change case type "${i}"`);return i});if(typeof t=="function")return o.computed(()=>x[a.value](n.toValue(t),n.toValue(e)));const s=o.ref(t);return o.computed({get(){return x[a.value](s.value,n.toValue(e))},set(i){s.value=i}})}function re(t){const r=new O(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:s=!1}={})=>z(e,{doNotParse:a,autoUpdateDependencies:s},r)}function z(t,{doNotParse:r=!1,autoUpdateDependencies:e=!1}={},a=new O){const s=e?[...t||[]]:t;let i=a.getAll({doNotParse:!0});const c=o.ref(0),f=()=>{const u=a.getAll({doNotParse:!0});le(s||null,u,i)&&c.value++,i=u};return a.addChangeListener(f),n.tryOnScopeDispose(()=>{a.removeChangeListener(f)}),{get:(...u)=>(e&&s&&!s.includes(u[0])&&s.push(u[0]),c.value,a.get(u[0],{doNotParse:r,...u[1]})),getAll:(...u)=>(c.value,a.getAll({doNotParse:r,...u[0]})),set:(...u)=>a.set(...u),remove:(...u)=>a.remove(...u),addChangeListener:(...u)=>a.addChangeListener(...u),removeChangeListener:(...u)=>a.removeChangeListener(...u)}}function le(t,r,e){if(!t)return!0;for(const a of t)if(r[a]!==e[a])return!0;return!1}function se(t,r){const e=o.ref();let a=[];const s=p.createEventHook(),i=p.createEventHook(),c=p.createEventHook(),f=p.createEventHook(),u=p.createEventHook(),h=o.ref(!1),w=o.ref(!1),b=o.ref(!1),y=o.ref(!1),A=o.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...r?.brush});o.watch(A,()=>{const v=e.value;v&&(v.brush=A.value,v.mode=A.value.mode)},{deep:!0});const E=()=>{var v;return(v=e.value)==null?void 0:v.undo()},P=()=>{var v;return(v=e.value)==null?void 0:v.redo()},d=()=>{var v;return(v=e.value)==null?void 0:v.clear()},I=()=>{var v;return(v=e.value)==null?void 0:v.cancel()},S=v=>{var L;return(L=e.value)==null?void 0:L.load(v)},m=()=>{var v;return(v=e.value)==null?void 0:v.dump()},U=()=>{var v;a.forEach(L=>L()),(v=e.value)==null||v.unmount()},k=()=>{e.value&&(h.value=e.value.canUndo(),w.value=e.value.canRedo(),b.value=e.value.altPressed,y.value=e.value.shiftPressed)};return o.watch(()=>p.unrefElement(t),v=>{!v||typeof SVGSVGElement>"u"||!(v instanceof SVGSVGElement)||(e.value&&U(),e.value=F.createDrauu({el:v,...r}),k(),a=[e.value.on("canceled",()=>i.trigger()),e.value.on("committed",L=>c.trigger(L)),e.value.on("start",()=>f.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{k(),s.trigger()})])},{flush:"post"}),n.tryOnScopeDispose(()=>U()),{drauuInstance:e,load:S,dump:m,clear:d,cancel:I,undo:E,redo:P,canUndo:h,canRedo:w,brush:A,onChanged:s.on,onCommitted:c.on,onStart:f.on,onEnd:u.on,onCanceled:i.on}}function ue(t,r={}){let e;const{immediate:a,...s}=r,i=o.ref(!1),c=o.ref(!1),f=y=>e&&e.activate(y),u=y=>e&&e.deactivate(y),h=()=>{e&&(e.pause(),c.value=!0)},w=()=>{e&&(e.unpause(),c.value=!1)},b=o.computed(()=>{const y=n.toValue(t);return(Array.isArray(y)?y:[y]).map(A=>{const E=n.toValue(A);return typeof E=="string"?E:p.unrefElement(E)}).filter(n.notNullish)});return o.watch(b,y=>{y.length&&(e=W.createFocusTrap(y,{...s,onActivate(){i.value=!0,r.onActivate&&r.onActivate()},onDeactivate(){i.value=!1,r.onDeactivate&&r.onDeactivate()}}),a&&f())},{flush:"post"}),p.tryOnScopeDispose(()=>u()),{hasFocus:i,isPaused:c,activate:f,deactivate:u,pause:h,unpause:w}}function ce(t,r,e){const a=()=>{var c,f;return new B((c=n.toValue(r))!=null?c:[],(f=n.toValue(e))==null?void 0:f.fuseOptions)},s=o.ref(a());o.watch(()=>{var c;return(c=n.toValue(e))==null?void 0:c.fuseOptions},()=>{s.value=a()},{deep:!0}),o.watch(()=>n.toValue(r),c=>{s.value.setCollection(c)},{deep:!0});const i=o.computed(()=>{const c=n.toValue(e);if(c?.matchAllWhenSearchEmpty&&!n.toValue(t))return n.toValue(r).map((u,h)=>({item:u,refIndex:h}));const f=c?.resultLimit;return s.value.search(n.toValue(t),f?{limit:f}:void 0)});return{fuse:s,results:i}}function ie(t,r,e={}){const{flush:a="pre",deep:s=!0,shallow:i=!1,onError:c=d=>{console.error(d)},writeDefaults:f=!0}=e,u=o.ref(!1),h=(i?o.shallowRef:o.ref)(r),w=n.toValue(r);async function b(){try{const d=await _.get(t);d===void 0?w!=null&&f&&await _.set(t,w):h.value=d}catch(d){c(d)}u.value=!0}b();async function y(){try{h.value==null?await _.del(t):await _.update(t,()=>o.toRaw(h.value))}catch(d){c(d)}}const{pause:A,resume:E}=p.watchPausable(h,()=>y(),{flush:a,deep:s});async function P(d){A(),h.value=d,await y(),E()}return{set:P,isFinished:u,data:h}}function fe(t,r={}){const{onError:e,fallbackValue:a=null}=r,s=(f,u)=>{try{return j.jwtDecode(f,u)}catch(h){return e?.(h),a}},i=o.computed(()=>s(n.toValue(t),{header:!0})),c=o.computed(()=>s(n.toValue(t)));return{header:i,payload:c}}function de(t=null,r){const e=o.ref(t),a=o.computed({set:i=>i?R.start():R.done(),get:()=>typeof e.value=="number"&&e.value<1});r&&R.configure(r);const s=R.set;return R.set=i=>(e.value=i,s.call(R,i)),o.watchEffect(()=>{typeof e.value=="number"&&n.isClient&&s.call(R,e.value)}),n.tryOnScopeDispose(R.remove),{isLoading:a,progress:e,start:R.start,done:R.done,remove:()=>{e.value=null,R.remove()}}}function ve(t,r){const e=n.toRef(t),a=o.ref("");return o.watch(e,async s=>{e.value&&n.isClient&&(a.value=await Z.toDataURL(s,r))},{immediate:!0}),a}function pe(t,r,e={}){let a;const{document:s=p.defaultDocument,...i}=e,c={onUpdate:w=>{M(r,w.oldIndex,w.newIndex)}},f=()=>{const w=typeof t=="string"?s?.querySelector(t):p.unrefElement(t);!w||a!==void 0||(a=new V(w,{...c,...i}))},u=()=>{a?.destroy(),a=void 0},h=(w,b)=>{if(b!==void 0)a?.option(w,b);else return a?.option(w)};return p.tryOnMounted(f),p.tryOnScopeDispose(u),{stop:u,start:f,option:h}}function M(t,r,e){const a=o.isRef(t),s=a?[...p.toValue(t)]:p.toValue(t);if(e>=0&&e<s.length){const i=s.splice(r,1)[0];o.nextTick(()=>{s.splice(e,0,i),a&&(t.value=s)})}}l.createCookies=re,l.moveArrayElement=M,l.useAsyncValidator=ne,l.useAxios=oe,l.useChangeCase=ae,l.useCookies=z,l.useDrauu=se,l.useFocusTrap=ue,l.useFuse=ce,l.useIDBKeyval=ie,l.useJwt=fe,l.useNProgress=de,l.useQRCode=ve,l.useSortable=pe})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);