@vueuse/integrations 10.0.0-beta.2 → 10.0.0-beta.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.
Files changed (49) hide show
  1. package/index.cjs +93 -58
  2. package/index.d.ts +2 -22
  3. package/index.iife.js +93 -58
  4. package/index.iife.min.js +1 -1
  5. package/index.mjs +94 -59
  6. package/package.json +5 -5
  7. package/useAsyncValidator/component.cjs +5 -1
  8. package/useAsyncValidator/component.mjs +5 -1
  9. package/useAsyncValidator.cjs +5 -1
  10. package/useAsyncValidator.iife.js +5 -1
  11. package/useAsyncValidator.iife.min.js +1 -1
  12. package/useAsyncValidator.mjs +5 -1
  13. package/useAxios.cjs +0 -4
  14. package/useAxios.d.ts +2 -22
  15. package/useAxios.iife.js +0 -4
  16. package/useAxios.iife.min.js +1 -1
  17. package/useAxios.mjs +0 -4
  18. package/useChangeCase.iife.min.js +1 -1
  19. package/useCookies.cjs +11 -1
  20. package/useCookies.iife.js +11 -1
  21. package/useCookies.iife.min.js +1 -1
  22. package/useCookies.mjs +11 -1
  23. package/useDrauu.cjs +22 -18
  24. package/useDrauu.iife.js +22 -18
  25. package/useDrauu.iife.min.js +1 -1
  26. package/useDrauu.mjs +22 -18
  27. package/useFocusTrap/component.cjs +10 -6
  28. package/useFocusTrap/component.mjs +10 -6
  29. package/useFocusTrap.cjs +22 -18
  30. package/useFocusTrap.iife.js +22 -18
  31. package/useFocusTrap.iife.min.js +1 -1
  32. package/useFocusTrap.mjs +22 -18
  33. package/useFuse.cjs +21 -10
  34. package/useFuse.iife.js +21 -10
  35. package/useFuse.iife.min.js +1 -1
  36. package/useFuse.mjs +21 -10
  37. package/useIDBKeyval.iife.min.js +1 -1
  38. package/useJwt.iife.min.js +1 -1
  39. package/useNProgress.iife.min.js +1 -1
  40. package/useQRCode.cjs +8 -4
  41. package/useQRCode.iife.js +8 -4
  42. package/useQRCode.iife.min.js +1 -1
  43. package/useQRCode.mjs +8 -4
  44. package/useSortable/component.cjs +5 -2
  45. package/useSortable/component.mjs +6 -3
  46. package/useSortable.cjs +5 -2
  47. package/useSortable.iife.js +6 -4
  48. package/useSortable.iife.min.js +1 -1
  49. package/useSortable.mjs +5 -2
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolveRef, resolveUnref, until, isString, isFunction, tryOnScopeDispose, isNumber, isClient } from '@vueuse/shared';
2
2
  import Schema from 'async-validator';
3
- import { shallowRef, ref, computed, watch, unref, watchEffect } from 'vue-demi';
3
+ import { shallowRef, ref, computed, watch, unref, watchEffect, nextTick } from 'vue-demi';
4
4
  import axios, { AxiosError } from 'axios';
5
5
  import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase } from 'change-case';
6
6
  import Cookie from 'universal-cookie';
@@ -73,7 +73,11 @@ function useAsyncValidator(value, rules, options = {}) {
73
73
  };
74
74
  };
75
75
  if (!manual) {
76
- watch([valueRef, validator], () => execute(), { immediate, deep: true });
76
+ watch(
77
+ [valueRef, validator],
78
+ () => execute(),
79
+ { immediate, deep: true }
80
+ );
77
81
  }
78
82
  const shell = {
79
83
  isFinished,
@@ -194,14 +198,10 @@ function useAxios(...args) {
194
198
  response,
195
199
  data,
196
200
  error,
197
- finished: isFinished,
198
- loading: isLoading,
199
201
  isFinished,
200
202
  isLoading,
201
203
  cancel: abort,
202
204
  isAborted,
203
- canceled: isAborted,
204
- aborted: isAborted,
205
205
  isCanceled: isAborted,
206
206
  abort,
207
207
  execute
@@ -266,7 +266,11 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
266
266
  const touches = ref(0);
267
267
  const onChange = () => {
268
268
  const newCookies = cookies.getAll({ doNotParse: true });
269
- if (shouldUpdate(watchingDependencies || null, newCookies, previousCookies))
269
+ if (shouldUpdate(
270
+ watchingDependencies || null,
271
+ newCookies,
272
+ previousCookies
273
+ ))
270
274
  touches.value++;
271
275
  previousCookies = newCookies;
272
276
  };
@@ -275,12 +279,18 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
275
279
  cookies.removeChangeListener(onChange);
276
280
  });
277
281
  return {
282
+ /**
283
+ * Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
284
+ */
278
285
  get: (...args) => {
279
286
  if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
280
287
  watchingDependencies.push(args[0]);
281
288
  touches.value;
282
289
  return cookies.get(args[0], __spreadValues$4({ doNotParse }, args[1]));
283
290
  },
291
+ /**
292
+ * Reactive get all cookies
293
+ */
284
294
  getAll: (...args) => {
285
295
  touches.value;
286
296
  return cookies.getAll(__spreadValues$4({ doNotParse }, args[0]));
@@ -382,24 +392,28 @@ function useDrauu(target, options) {
382
392
  shiftPressed.value = drauuInstance.value.shiftPressed;
383
393
  }
384
394
  };
385
- watch(() => unrefElement(target), (el) => {
386
- if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
387
- return;
388
- if (drauuInstance.value)
389
- cleanup();
390
- drauuInstance.value = createDrauu(__spreadValues$3({ el }, options));
391
- syncStatus();
392
- disposables = [
393
- drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
394
- drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
395
- drauuInstance.value.on("start", () => onStartHook.trigger()),
396
- drauuInstance.value.on("end", () => onEndHook.trigger()),
397
- drauuInstance.value.on("changed", () => {
398
- syncStatus();
399
- onChangedHook.trigger();
400
- })
401
- ];
402
- }, { flush: "post" });
395
+ watch(
396
+ () => unrefElement(target),
397
+ (el) => {
398
+ if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
399
+ return;
400
+ if (drauuInstance.value)
401
+ cleanup();
402
+ drauuInstance.value = createDrauu(__spreadValues$3({ el }, options));
403
+ syncStatus();
404
+ disposables = [
405
+ drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
406
+ drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
407
+ drauuInstance.value.on("start", () => onStartHook.trigger()),
408
+ drauuInstance.value.on("end", () => onEndHook.trigger()),
409
+ drauuInstance.value.on("changed", () => {
410
+ syncStatus();
411
+ onChangedHook.trigger();
412
+ })
413
+ ];
414
+ },
415
+ { flush: "post" }
416
+ );
403
417
  tryOnScopeDispose(() => cleanup());
404
418
  return {
405
419
  drauuInstance,
@@ -470,24 +484,28 @@ function useFocusTrap(target, options = {}) {
470
484
  isPaused.value = false;
471
485
  }
472
486
  };
473
- watch(() => unrefElement(target), (el) => {
474
- if (!el)
475
- return;
476
- trap = createFocusTrap(el, __spreadProps(__spreadValues$2({}, focusTrapOptions), {
477
- onActivate() {
478
- hasFocus.value = true;
479
- if (options.onActivate)
480
- options.onActivate();
481
- },
482
- onDeactivate() {
483
- hasFocus.value = false;
484
- if (options.onDeactivate)
485
- options.onDeactivate();
486
- }
487
- }));
488
- if (immediate)
489
- activate();
490
- }, { flush: "post" });
487
+ watch(
488
+ () => unrefElement(target),
489
+ (el) => {
490
+ if (!el)
491
+ return;
492
+ trap = createFocusTrap(el, __spreadProps(__spreadValues$2({}, focusTrapOptions), {
493
+ onActivate() {
494
+ hasFocus.value = true;
495
+ if (options.onActivate)
496
+ options.onActivate();
497
+ },
498
+ onDeactivate() {
499
+ hasFocus.value = false;
500
+ if (options.onDeactivate)
501
+ options.onDeactivate();
502
+ }
503
+ }));
504
+ if (immediate)
505
+ activate();
506
+ },
507
+ { flush: "post" }
508
+ );
491
509
  tryOnScopeDispose$1(() => deactivate());
492
510
  return {
493
511
  hasFocus,
@@ -502,18 +520,29 @@ function useFocusTrap(target, options = {}) {
502
520
  function useFuse(search, data, options) {
503
521
  const createFuse = () => {
504
522
  var _a, _b;
505
- return new Fuse((_a = resolveUnref(data)) != null ? _a : [], (_b = resolveUnref(options)) == null ? void 0 : _b.fuseOptions);
523
+ return new Fuse(
524
+ (_a = resolveUnref(data)) != null ? _a : [],
525
+ (_b = resolveUnref(options)) == null ? void 0 : _b.fuseOptions
526
+ );
506
527
  };
507
528
  const fuse = ref(createFuse());
508
- watch(() => {
509
- var _a;
510
- return (_a = resolveUnref(options)) == null ? void 0 : _a.fuseOptions;
511
- }, () => {
512
- fuse.value = createFuse();
513
- }, { deep: true });
514
- watch(() => resolveUnref(data), (newData) => {
515
- fuse.value.setCollection(newData);
516
- }, { deep: true });
529
+ watch(
530
+ () => {
531
+ var _a;
532
+ return (_a = resolveUnref(options)) == null ? void 0 : _a.fuseOptions;
533
+ },
534
+ () => {
535
+ fuse.value = createFuse();
536
+ },
537
+ { deep: true }
538
+ );
539
+ watch(
540
+ () => resolveUnref(data),
541
+ (newData) => {
542
+ fuse.value.setCollection(newData);
543
+ },
544
+ { deep: true }
545
+ );
517
546
  const results = computed(() => {
518
547
  const resolved = resolveUnref(options);
519
548
  if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !unref(search))
@@ -645,10 +674,14 @@ function useNProgress(currentProgress = null, options) {
645
674
  function useQRCode(text, options) {
646
675
  const src = resolveRef(text);
647
676
  const result = ref("");
648
- watch(src, async (value) => {
649
- if (src.value && isClient)
650
- result.value = await QRCode.toDataURL(value, options);
651
- }, { immediate: true });
677
+ watch(
678
+ src,
679
+ async (value) => {
680
+ if (src.value && isClient)
681
+ result.value = await QRCode.toDataURL(value, options);
682
+ },
683
+ { immediate: true }
684
+ );
652
685
  return result;
653
686
  }
654
687
 
@@ -701,8 +734,10 @@ function useSortable(el, list, options = {}) {
701
734
  }
702
735
  function moveArrayElement(list, from, to) {
703
736
  const array = resolveUnref$1(list);
704
- if (to >= 0 && to < array.length)
705
- array.splice(to, 0, array.splice(from, 1)[0]);
737
+ if (to >= 0 && to < array.length) {
738
+ const element = array.splice(from, 1)[0];
739
+ nextTick(() => array.splice(to, 0, element));
740
+ }
706
741
  }
707
742
 
708
743
  export { createCookies, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/integrations",
3
- "version": "10.0.0-beta.2",
3
+ "version": "10.0.0-beta.3",
4
4
  "description": "Integration wrappers for utility libraries",
5
5
  "author": "Anthony Fu <https://github.com/antfu>",
6
6
  "license": "MIT",
@@ -161,16 +161,16 @@
161
161
  }
162
162
  },
163
163
  "dependencies": {
164
- "@vueuse/core": "10.0.0-beta.2",
165
- "@vueuse/shared": "10.0.0-beta.2",
164
+ "@vueuse/core": "10.0.0-beta.3",
165
+ "@vueuse/shared": "10.0.0-beta.3",
166
166
  "vue-demi": "*"
167
167
  },
168
168
  "devDependencies": {
169
169
  "@types/nprogress": "^0.2.0",
170
170
  "@types/qrcode": "^1.5.0",
171
- "@types/sortablejs": "^1.15.0",
171
+ "@types/sortablejs": "^1.15.1",
172
172
  "async-validator": "^4.2.5",
173
- "axios": "^1.3.4",
173
+ "axios": "^1.3.5",
174
174
  "change-case": "^4.1.2",
175
175
  "drauu": "^0.3.2",
176
176
  "focus-trap": "^7.4.0",
@@ -63,7 +63,11 @@ function useAsyncValidator(value, rules, options = {}) {
63
63
  };
64
64
  };
65
65
  if (!manual) {
66
- vueDemi.watch([valueRef, validator], () => execute(), { immediate, deep: true });
66
+ vueDemi.watch(
67
+ [valueRef, validator],
68
+ () => execute(),
69
+ { immediate, deep: true }
70
+ );
67
71
  }
68
72
  const shell = {
69
73
  isFinished,
@@ -61,7 +61,11 @@ function useAsyncValidator(value, rules, options = {}) {
61
61
  };
62
62
  };
63
63
  if (!manual) {
64
- watch([valueRef, validator], () => execute(), { immediate, deep: true });
64
+ watch(
65
+ [valueRef, validator],
66
+ () => execute(),
67
+ { immediate, deep: true }
68
+ );
65
69
  }
66
70
  const shell = {
67
71
  isFinished,
@@ -63,7 +63,11 @@ function useAsyncValidator(value, rules, options = {}) {
63
63
  };
64
64
  };
65
65
  if (!manual) {
66
- vueDemi.watch([valueRef, validator], () => execute(), { immediate, deep: true });
66
+ vueDemi.watch(
67
+ [valueRef, validator],
68
+ () => execute(),
69
+ { immediate, deep: true }
70
+ );
67
71
  }
68
72
  const shell = {
69
73
  isFinished,
@@ -174,7 +174,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
174
174
  };
175
175
  };
176
176
  if (!manual) {
177
- vueDemi.watch([valueRef, validator], () => execute(), { immediate, deep: true });
177
+ vueDemi.watch(
178
+ [valueRef, validator],
179
+ () => execute(),
180
+ { immediate, deep: true }
181
+ );
178
182
  }
179
183
  const shell = {
180
184
  isFinished,
@@ -1 +1 @@
1
- var VueDemi=function(e,r,v){if(e.install)return e;if(!r)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(r.version.slice(0,4)==="2.7."){let o=function(i,c){var f,y={},h={config:r.config,use:r.use.bind(r),mixin:r.mixin.bind(r),component:r.component.bind(r),provide:function(u,d){return y[u]=d,this},directive:function(u,d){return d?(r.directive(u,d),h):r.directive(u)},mount:function(u,d){return f||(f=new r(Object.assign({propsData:c},i,{provide:Object.assign(y,i.provide)})),f.$mount(u,d),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return h};var F=o;for(var n in r)e[n]=r[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=r,e.Vue2=r,e.version=r.version,e.warn=r.util.warn,e.createApp=o}else if(r.version.slice(0,2)==="2.")if(v){for(var n in v)e[n]=v[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=r,e.Vue2=r,e.version=r.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(r.version.slice(0,2)==="3."){for(var n in r)e[n]=r[n];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=r,e.Vue2=void 0,e.version=r.version,e.set=function(o,i,c){return Array.isArray(o)?(o.length=Math.max(o.length,i),o.splice(i,1,c),c):(o[i]=c,c)},e.del=function(o,i){if(Array.isArray(o)){o.splice(i,1);return}delete o[i]}}else console.error("[vue-demi] Vue version "+r.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(e,r,v,n){"use strict";var F=Object.defineProperty,o=Object.defineProperties,i=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,h=(a,t,s)=>t in a?F(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,u=(a,t)=>{for(var s in t||(t={}))f.call(t,s)&&h(a,s,t[s]);if(c)for(var s of c(t))y.call(t,s)&&h(a,s,t[s]);return a},d=(a,t)=>o(a,i(t));const R=v.default||v;function E(a,t,s={}){const{validateOption:S={},immediate:P=!0,manual:b=!1}=s,A=r.resolveRef(a),p=n.shallowRef(null),_=n.ref(!0),w=n.ref(!P||b),j=n.computed(()=>{var l;return((l=p.value)==null?void 0:l.errors)||[]}),I=n.computed(()=>{var l;return((l=p.value)==null?void 0:l.fields)||{}}),g=n.computed(()=>new R(r.resolveUnref(t))),U=async()=>{_.value=!1,w.value=!1;try{await g.value.validate(A.value,S),w.value=!0,p.value=null}catch(l){p.value=l}finally{_.value=!0}return{pass:w.value,errorInfo:p.value,errors:j.value,errorFields:I.value}};b||n.watch([A,g],()=>U(),{immediate:P,deep:!0});const x={isFinished:_,pass:w,errors:j,errorInfo:p,errorFields:I,execute:U};function $(){return new Promise((l,O)=>{r.until(_).toBe(!0).then(()=>l(x)).catch(B=>O(B))})}return d(u({},x),{then(l,O){return $().then(l,O)}})}e.useAsyncValidator=E})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi);
1
+ var VueDemi=function(e,r,v){if(e.install)return e;if(!r)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(r.version.slice(0,4)==="2.7."){let o=function(i,c){var f,y={},h={config:r.config,use:r.use.bind(r),mixin:r.mixin.bind(r),component:r.component.bind(r),provide:function(u,d){return y[u]=d,this},directive:function(u,d){return d?(r.directive(u,d),h):r.directive(u)},mount:function(u,d){return f||(f=new r(Object.assign({propsData:c},i,{provide:Object.assign(y,i.provide)})),f.$mount(u,d),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return h};var F=o;for(var n in r)e[n]=r[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=r,e.Vue2=r,e.version=r.version,e.warn=r.util.warn,e.createApp=o}else if(r.version.slice(0,2)==="2.")if(v){for(var n in v)e[n]=v[n];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=r,e.Vue2=r,e.version=r.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(r.version.slice(0,2)==="3."){for(var n in r)e[n]=r[n];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=r,e.Vue2=void 0,e.version=r.version,e.set=function(o,i,c){return Array.isArray(o)?(o.length=Math.max(o.length,i),o.splice(i,1,c),c):(o[i]=c,c)},e.del=function(o,i){if(Array.isArray(o)){o.splice(i,1);return}delete o[i]}}else console.error("[vue-demi] Vue version "+r.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,r,v,n){"use strict";var F=Object.defineProperty,o=Object.defineProperties,i=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,h=(a,t,s)=>t in a?F(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,u=(a,t)=>{for(var s in t||(t={}))f.call(t,s)&&h(a,s,t[s]);if(c)for(var s of c(t))y.call(t,s)&&h(a,s,t[s]);return a},d=(a,t)=>o(a,i(t));const R=v.default||v;function E(a,t,s={}){const{validateOption:S={},immediate:P=!0,manual:b=!1}=s,A=r.resolveRef(a),p=n.shallowRef(null),_=n.ref(!0),w=n.ref(!P||b),j=n.computed(()=>{var l;return((l=p.value)==null?void 0:l.errors)||[]}),I=n.computed(()=>{var l;return((l=p.value)==null?void 0:l.fields)||{}}),g=n.computed(()=>new R(r.resolveUnref(t))),U=async()=>{_.value=!1,w.value=!1;try{await g.value.validate(A.value,S),w.value=!0,p.value=null}catch(l){p.value=l}finally{_.value=!0}return{pass:w.value,errorInfo:p.value,errors:j.value,errorFields:I.value}};b||n.watch([A,g],()=>U(),{immediate:P,deep:!0});const x={isFinished:_,pass:w,errors:j,errorInfo:p,errorFields:I,execute:U};function $(){return new Promise((l,O)=>{r.until(_).toBe(!0).then(()=>l(x)).catch(B=>O(B))})}return d(u({},x),{then(l,O){return $().then(l,O)}})}e.useAsyncValidator=E})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi);
@@ -61,7 +61,11 @@ function useAsyncValidator(value, rules, options = {}) {
61
61
  };
62
62
  };
63
63
  if (!manual) {
64
- watch([valueRef, validator], () => execute(), { immediate, deep: true });
64
+ watch(
65
+ [valueRef, validator],
66
+ () => execute(),
67
+ { immediate, deep: true }
68
+ );
65
69
  }
66
70
  const shell = {
67
71
  isFinished,
package/useAxios.cjs CHANGED
@@ -103,14 +103,10 @@ function useAxios(...args) {
103
103
  response,
104
104
  data,
105
105
  error,
106
- finished: isFinished,
107
- loading: isLoading,
108
106
  isFinished,
109
107
  isLoading,
110
108
  cancel: abort,
111
109
  isAborted,
112
- canceled: isAborted,
113
- aborted: isAborted,
114
110
  isCanceled: isAborted,
115
111
  abort,
116
112
  execute
package/useAxios.d.ts CHANGED
@@ -31,31 +31,11 @@ interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
31
31
  */
32
32
  abort: (message?: string | undefined) => void;
33
33
  /**
34
- * isFinished alias
35
- * @deprecated use `isFinished` instead
36
- */
37
- finished: Ref<boolean>;
38
- /**
39
- * isLoading alias
40
- * @deprecated use `isLoading` instead
41
- */
42
- loading: Ref<boolean>;
43
- /**
44
- * isAborted alias
45
- * @deprecated use `isAborted` instead
46
- */
47
- aborted: Ref<boolean>;
48
- /**
49
- * abort alias
34
+ * Alias to `abort`
50
35
  */
51
36
  cancel: (message?: string | undefined) => void;
52
37
  /**
53
- * isAborted alias
54
- * @deprecated use `isCanceled` instead
55
- */
56
- canceled: Ref<boolean>;
57
- /**
58
- * isAborted alias
38
+ * Alice to `isAborted`
59
39
  */
60
40
  isCanceled: Ref<boolean>;
61
41
  }
package/useAxios.iife.js CHANGED
@@ -214,14 +214,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
214
214
  response,
215
215
  data,
216
216
  error,
217
- finished: isFinished,
218
- loading: isLoading,
219
217
  isFinished,
220
218
  isLoading,
221
219
  cancel: abort,
222
220
  isAborted,
223
- canceled: isAborted,
224
- aborted: isAborted,
225
221
  isCanceled: isAborted,
226
222
  abort,
227
223
  execute
@@ -1 +1 @@
1
- var VueDemi=function(e,n,_){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let s=function(c,u){var a,O={},b={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(f,d){return O[f]=d,this},directive:function(f,d){return d?(n.directive(f,d),b):n.directive(f)},mount:function(f,d){return a||(a=new n(Object.assign({propsData:u},c,{provide:Object.assign(O,c.provide)})),a.$mount(f,d),a)},unmount:function(){a&&(a.$destroy(),a=void 0)}};return b};var q=s;for(var l in n)e[l]=n[l];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.warn=n.util.warn,e.createApp=s}else if(n.version.slice(0,2)==="2.")if(_){for(var l in _)e[l]=_[l];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version}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 l in n)e[l]=n[l];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(s,c,u){return Array.isArray(s)?(s.length=Math.max(s.length,c),s.splice(c,1,u),u):(s[c]=u,u)},e.del=function(s,c){if(Array.isArray(s)){s.splice(c,1);return}delete s[c]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(e,n,_,l){"use strict";var q=Object.defineProperty,s=Object.defineProperties,c=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,b=(r,t,o)=>t in r?q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,f=(r,t)=>{for(var o in t||(t={}))a.call(t,o)&&b(r,o,t[o]);if(u)for(var o of u(t))O.call(t,o)&&b(r,o,t[o]);return r},d=(r,t)=>s(r,c(t));function B(...r){const t=typeof r[0]=="string"?r[0]:void 0,o=_.isString(t)?1:0;let C={},I=l,v={immediate:!!o,shallow:!0};const E=i=>!!(i==null?void 0:i.request);r.length>0+o&&(E(r[0+o])?I=r[0+o]:C=r[0+o]),r.length>1+o&&E(r[1+o])&&(I=r[1+o]),(r.length===2+o&&!E(r[1+o])||r.length===3+o)&&(v=r[r.length-1]);const T=n.shallowRef(),g=v.shallow?n.shallowRef():n.ref(),h=n.ref(!1),y=n.ref(!1),P=n.ref(!1),j=n.shallowRef(),F=l.CancelToken.source;let R=F();const S=i=>{h.value||!y.value||(R.cancel(i),R=F(),P.value=!0,y.value=!1,h.value=!1)},L=i=>{y.value=i,h.value=!i},M=()=>new Promise((i,w)=>{_.until(h).toBe(!0).then(()=>i(U)).catch(w)}),x=(i,w)=>M().then(i,w),N=(i=t,w={})=>{j.value=void 0;const $=typeof i=="string"?i:t??w.url;return $===void 0?(j.value=new l.AxiosError(l.AxiosError.ERR_INVALID_URL),h.value=!0,{then:x}):(S(),L(!0),I($,d(f(f({},C),typeof i=="object"?i:w),{cancelToken:R.token})).then(p=>{var A;T.value=p;const k=p.data;g.value=k,(A=v.onSuccess)==null||A.call(v,k)}).catch(p=>{var A;j.value=p,(A=v.onError)==null||A.call(v,p)}).finally(()=>{var p;(p=v.onFinish)==null||p.call(v),L(!1)}),{then:x})};v.immediate&&t&&N();const U={response:T,data:g,error:j,finished:h,loading:y,isFinished:h,isLoading:y,cancel:S,isAborted:P,canceled:P,aborted:P,isCanceled:P,abort:S,execute:N};return d(f({},U),{then:x})}e.useAxios=B})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
1
+ var VueDemi=function(e,n,h){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let s=function(c,u){var f,P={},y={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(a,d){return P[a]=d,this},directive:function(a,d){return d?(n.directive(a,d),y):n.directive(a)},mount:function(a,d){return f||(f=new n(Object.assign({propsData:u},c,{provide:Object.assign(P,c.provide)})),f.$mount(a,d),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return y};var q=s;for(var l in n)e[l]=n[l];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.warn=n.util.warn,e.createApp=s}else if(n.version.slice(0,2)==="2.")if(h){for(var l in h)e[l]=h[l];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version}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 l in n)e[l]=n[l];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(s,c,u){return Array.isArray(s)?(s.length=Math.max(s.length,c),s.splice(c,1,u),u):(s[c]=u,u)},e.del=function(s,c){if(Array.isArray(s)){s.splice(c,1);return}delete s[c]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,n,h,l){"use strict";var q=Object.defineProperty,s=Object.defineProperties,c=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,y=(r,t,o)=>t in r?q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,a=(r,t)=>{for(var o in t||(t={}))f.call(t,o)&&y(r,o,t[o]);if(u)for(var o of u(t))P.call(t,o)&&y(r,o,t[o]);return r},d=(r,t)=>s(r,c(t));function B(...r){const t=typeof r[0]=="string"?r[0]:void 0,o=h.isString(t)?1:0;let C={},j=l,v={immediate:!!o,shallow:!0};const I=i=>!!i?.request;r.length>0+o&&(I(r[0+o])?j=r[0+o]:C=r[0+o]),r.length>1+o&&I(r[1+o])&&(j=r[1+o]),(r.length===2+o&&!I(r[1+o])||r.length===3+o)&&(v=r[r.length-1]);const T=n.shallowRef(),F=v.shallow?n.shallowRef():n.ref(),_=n.ref(!1),A=n.ref(!1),E=n.ref(!1),O=n.shallowRef(),L=l.CancelToken.source;let R=L();const S=i=>{_.value||!A.value||(R.cancel(i),R=L(),E.value=!0,A.value=!1,_.value=!1)},g=i=>{A.value=i,_.value=!i},M=()=>new Promise((i,w)=>{h.until(_).toBe(!0).then(()=>i(U)).catch(w)}),x=(i,w)=>M().then(i,w),N=(i=t,w={})=>{O.value=void 0;const $=typeof i=="string"?i:t??w.url;return $===void 0?(O.value=new l.AxiosError(l.AxiosError.ERR_INVALID_URL),_.value=!0,{then:x}):(S(),g(!0),j($,d(a(a({},C),typeof i=="object"?i:w),{cancelToken:R.token})).then(p=>{var b;T.value=p;const k=p.data;F.value=k,(b=v.onSuccess)==null||b.call(v,k)}).catch(p=>{var b;O.value=p,(b=v.onError)==null||b.call(v,p)}).finally(()=>{var p;(p=v.onFinish)==null||p.call(v),g(!1)}),{then:x})};v.immediate&&t&&N();const U={response:T,data:F,error:O,isFinished:_,isLoading:A,cancel:S,isAborted:E,isCanceled:E,abort:S,execute:N};return d(a({},U),{then:x})}e.useAxios=B})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
package/useAxios.mjs CHANGED
@@ -101,14 +101,10 @@ function useAxios(...args) {
101
101
  response,
102
102
  data,
103
103
  error,
104
- finished: isFinished,
105
- loading: isLoading,
106
104
  isFinished,
107
105
  isLoading,
108
106
  cancel: abort,
109
107
  isAborted,
110
- canceled: isAborted,
111
- aborted: isAborted,
112
108
  isCanceled: isAborted,
113
109
  abort,
114
110
  execute
@@ -1 +1 @@
1
- var VueDemi=function(n,e,a){if(n.install)return n;if(!e)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(e.version.slice(0,4)==="2.7."){let r=function(i,t){var o,l={},d={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(f,c){return l[f]=c,this},directive:function(f,c){return c?(e.directive(f,c),d):e.directive(f)},mount:function(f,c){return o||(o=new e(Object.assign({propsData:t},i,{provide:Object.assign(l,i.provide)})),o.$mount(f,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return d};var p=r;for(var s in e)n[s]=e[s];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.warn=e.util.warn,n.createApp=r}else if(e.version.slice(0,2)==="2.")if(a){for(var s in a)n[s]=a[s];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(e.version.slice(0,2)==="3."){for(var s in e)n[s]=e[s];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=e,n.Vue2=void 0,n.version=e.version,n.set=function(r,i,t){return Array.isArray(r)?(r.length=Math.max(r.length,i),r.splice(i,1,t),t):(r[i]=t,t)},n.del=function(r,i){if(Array.isArray(r)){r.splice(i,1);return}delete r[i]}}else console.error("[vue-demi] Vue version "+e.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(n,e,a,s){"use strict";var p=Object.freeze({__proto__:null,camelCase:s.camelCase,capitalCase:s.capitalCase,constantCase:s.constantCase,dotCase:s.dotCase,headerCase:s.headerCase,noCase:s.noCase,paramCase:s.paramCase,pascalCase:s.pascalCase,pathCase:s.pathCase,sentenceCase:s.sentenceCase,snakeCase:s.snakeCase});function r(i,t,o){if(e.isFunction(i))return a.computed(()=>p[t](e.resolveUnref(i),o));const l=a.ref(i);return a.computed({get(){return p[t](l.value,o)},set(d){l.value=d}})}n.useChangeCase=r})(this.VueUse=this.VueUse||{},VueUse,VueDemi,changeCase);
1
+ var VueDemi=function(n,e,a){if(n.install)return n;if(!e)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(e.version.slice(0,4)==="2.7."){let r=function(i,t){var o,l={},d={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(f,c){return l[f]=c,this},directive:function(f,c){return c?(e.directive(f,c),d):e.directive(f)},mount:function(f,c){return o||(o=new e(Object.assign({propsData:t},i,{provide:Object.assign(l,i.provide)})),o.$mount(f,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return d};var p=r;for(var s in e)n[s]=e[s];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.warn=e.util.warn,n.createApp=r}else if(e.version.slice(0,2)==="2.")if(a){for(var s in a)n[s]=a[s];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(e.version.slice(0,2)==="3."){for(var s in e)n[s]=e[s];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=e,n.Vue2=void 0,n.version=e.version,n.set=function(r,i,t){return Array.isArray(r)?(r.length=Math.max(r.length,i),r.splice(i,1,t),t):(r[i]=t,t)},n.del=function(r,i){if(Array.isArray(r)){r.splice(i,1);return}delete r[i]}}else console.error("[vue-demi] Vue version "+e.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,e,a,s){"use strict";var p=Object.freeze({__proto__:null,camelCase:s.camelCase,capitalCase:s.capitalCase,constantCase:s.constantCase,dotCase:s.dotCase,headerCase:s.headerCase,noCase:s.noCase,paramCase:s.paramCase,pascalCase:s.pascalCase,pathCase:s.pathCase,sentenceCase:s.sentenceCase,snakeCase:s.snakeCase});function r(i,t,o){if(e.isFunction(i))return a.computed(()=>p[t](e.resolveUnref(i),o));const l=a.ref(i);return a.computed({get(){return p[t](l.value,o)},set(d){l.value=d}})}n.useChangeCase=r})(this.VueUse=this.VueUse||{},VueUse,VueDemi,changeCase);
package/useCookies.cjs CHANGED
@@ -30,7 +30,11 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
30
30
  const touches = vueDemi.ref(0);
31
31
  const onChange = () => {
32
32
  const newCookies = cookies.getAll({ doNotParse: true });
33
- if (shouldUpdate(watchingDependencies || null, newCookies, previousCookies))
33
+ if (shouldUpdate(
34
+ watchingDependencies || null,
35
+ newCookies,
36
+ previousCookies
37
+ ))
34
38
  touches.value++;
35
39
  previousCookies = newCookies;
36
40
  };
@@ -39,12 +43,18 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
39
43
  cookies.removeChangeListener(onChange);
40
44
  });
41
45
  return {
46
+ /**
47
+ * Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
48
+ */
42
49
  get: (...args) => {
43
50
  if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
44
51
  watchingDependencies.push(args[0]);
45
52
  touches.value;
46
53
  return cookies.get(args[0], __spreadValues({ doNotParse }, args[1]));
47
54
  },
55
+ /**
56
+ * Reactive get all cookies
57
+ */
48
58
  getAll: (...args) => {
49
59
  touches.value;
50
60
  return cookies.getAll(__spreadValues({ doNotParse }, args[0]));
@@ -141,7 +141,11 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
141
141
  const touches = vueDemi.ref(0);
142
142
  const onChange = () => {
143
143
  const newCookies = cookies.getAll({ doNotParse: true });
144
- if (shouldUpdate(watchingDependencies || null, newCookies, previousCookies))
144
+ if (shouldUpdate(
145
+ watchingDependencies || null,
146
+ newCookies,
147
+ previousCookies
148
+ ))
145
149
  touches.value++;
146
150
  previousCookies = newCookies;
147
151
  };
@@ -150,12 +154,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
150
154
  cookies.removeChangeListener(onChange);
151
155
  });
152
156
  return {
157
+ /**
158
+ * Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
159
+ */
153
160
  get: (...args) => {
154
161
  if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
155
162
  watchingDependencies.push(args[0]);
156
163
  touches.value;
157
164
  return cookies.get(args[0], __spreadValues({ doNotParse }, args[1]));
158
165
  },
166
+ /**
167
+ * Reactive get all cookies
168
+ */
159
169
  getAll: (...args) => {
160
170
  touches.value;
161
171
  return cookies.getAll(__spreadValues({ doNotParse }, args[0]));
@@ -1 +1 @@
1
- var VueDemi=function(e,n,h){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let s=function(a,c){var u,C={},g={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(v,d){return C[v]=d,this},directive:function(v,d){return d?(n.directive(v,d),g):n.directive(v)},mount:function(v,d){return u||(u=new n(Object.assign({propsData:c},a,{provide:Object.assign(C,a.provide)})),u.$mount(v,d),u)},unmount:function(){u&&(u.$destroy(),u=void 0)}};return g};var b=s;for(var l in n)e[l]=n[l];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.warn=n.util.warn,e.createApp=s}else if(n.version.slice(0,2)==="2.")if(h){for(var l in h)e[l]=h[l];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version}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 l in n)e[l]=n[l];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(s,a,c){return Array.isArray(s)?(s.length=Math.max(s.length,a),s.splice(a,1,c),c):(s[a]=c,c)},e.del=function(s,a){if(Array.isArray(s)){s.splice(a,1);return}delete s[a]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(e,n,h,l){"use strict";var b=Object.defineProperty,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable,u=(o,r,t)=>r in o?b(o,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[r]=t,C=(o,r)=>{for(var t in r||(r={}))a.call(r,t)&&u(o,t,r[t]);if(s)for(var t of s(r))c.call(r,t)&&u(o,t,r[t]);return o};function g(o){const r=new l(o?o.headers.cookie:null);return(t,{doNotParse:f=!1,autoUpdateDependencies:p=!1}={})=>v(t,{doNotParse:f,autoUpdateDependencies:p},r)}function v(o,{doNotParse:r=!1,autoUpdateDependencies:t=!1}={},f=new l){const p=t?[...o||[]]:o;let w=f.getAll({doNotParse:!0});const y=h.ref(0),_=()=>{const i=f.getAll({doNotParse:!0});d(p||null,i,w)&&y.value++,w=i};return f.addChangeListener(_),n.tryOnScopeDispose(()=>{f.removeChangeListener(_)}),{get:(...i)=>(t&&p&&!p.includes(i[0])&&p.push(i[0]),y.value,f.get(i[0],C({doNotParse:r},i[1]))),getAll:(...i)=>(y.value,f.getAll(C({doNotParse:r},i[0]))),set:(...i)=>f.set(...i),remove:(...i)=>f.remove(...i),addChangeListener:(...i)=>f.addChangeListener(...i),removeChangeListener:(...i)=>f.removeChangeListener(...i)}}function d(o,r,t){if(!o)return!0;for(const f of o)if(r[f]!==t[f])return!0;return!1}e.createCookies=g,e.useCookies=v})(this.VueUse=this.VueUse||{},VueUse,VueDemi,UniversalCookie);
1
+ var VueDemi=function(e,n,h){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let s=function(a,c){var u,C={},g={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(v,d){return C[v]=d,this},directive:function(v,d){return d?(n.directive(v,d),g):n.directive(v)},mount:function(v,d){return u||(u=new n(Object.assign({propsData:c},a,{provide:Object.assign(C,a.provide)})),u.$mount(v,d),u)},unmount:function(){u&&(u.$destroy(),u=void 0)}};return g};var b=s;for(var l in n)e[l]=n[l];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.warn=n.util.warn,e.createApp=s}else if(n.version.slice(0,2)==="2.")if(h){for(var l in h)e[l]=h[l];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version}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 l in n)e[l]=n[l];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(s,a,c){return Array.isArray(s)?(s.length=Math.max(s.length,a),s.splice(a,1,c),c):(s[a]=c,c)},e.del=function(s,a){if(Array.isArray(s)){s.splice(a,1);return}delete s[a]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,n,h,l){"use strict";var b=Object.defineProperty,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable,u=(o,r,t)=>r in o?b(o,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[r]=t,C=(o,r)=>{for(var t in r||(r={}))a.call(r,t)&&u(o,t,r[t]);if(s)for(var t of s(r))c.call(r,t)&&u(o,t,r[t]);return o};function g(o){const r=new l(o?o.headers.cookie:null);return(t,{doNotParse:f=!1,autoUpdateDependencies:p=!1}={})=>v(t,{doNotParse:f,autoUpdateDependencies:p},r)}function v(o,{doNotParse:r=!1,autoUpdateDependencies:t=!1}={},f=new l){const p=t?[...o||[]]:o;let w=f.getAll({doNotParse:!0});const y=h.ref(0),_=()=>{const i=f.getAll({doNotParse:!0});d(p||null,i,w)&&y.value++,w=i};return f.addChangeListener(_),n.tryOnScopeDispose(()=>{f.removeChangeListener(_)}),{get:(...i)=>(t&&p&&!p.includes(i[0])&&p.push(i[0]),y.value,f.get(i[0],C({doNotParse:r},i[1]))),getAll:(...i)=>(y.value,f.getAll(C({doNotParse:r},i[0]))),set:(...i)=>f.set(...i),remove:(...i)=>f.remove(...i),addChangeListener:(...i)=>f.addChangeListener(...i),removeChangeListener:(...i)=>f.removeChangeListener(...i)}}function d(o,r,t){if(!o)return!0;for(const f of o)if(r[f]!==t[f])return!0;return!1}e.createCookies=g,e.useCookies=v})(this.VueUse=this.VueUse||{},VueUse,VueDemi,UniversalCookie);
package/useCookies.mjs CHANGED
@@ -28,7 +28,11 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
28
28
  const touches = ref(0);
29
29
  const onChange = () => {
30
30
  const newCookies = cookies.getAll({ doNotParse: true });
31
- if (shouldUpdate(watchingDependencies || null, newCookies, previousCookies))
31
+ if (shouldUpdate(
32
+ watchingDependencies || null,
33
+ newCookies,
34
+ previousCookies
35
+ ))
32
36
  touches.value++;
33
37
  previousCookies = newCookies;
34
38
  };
@@ -37,12 +41,18 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
37
41
  cookies.removeChangeListener(onChange);
38
42
  });
39
43
  return {
44
+ /**
45
+ * Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
46
+ */
40
47
  get: (...args) => {
41
48
  if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
42
49
  watchingDependencies.push(args[0]);
43
50
  touches.value;
44
51
  return cookies.get(args[0], __spreadValues({ doNotParse }, args[1]));
45
52
  },
53
+ /**
54
+ * Reactive get all cookies
55
+ */
46
56
  getAll: (...args) => {
47
57
  touches.value;
48
58
  return cookies.getAll(__spreadValues({ doNotParse }, args[0]));
package/useDrauu.cjs CHANGED
@@ -86,24 +86,28 @@ function useDrauu(target, options) {
86
86
  shiftPressed.value = drauuInstance.value.shiftPressed;
87
87
  }
88
88
  };
89
- vueDemi.watch(() => core.unrefElement(target), (el) => {
90
- if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
91
- return;
92
- if (drauuInstance.value)
93
- cleanup();
94
- drauuInstance.value = drauu.createDrauu(__spreadValues({ el }, options));
95
- syncStatus();
96
- disposables = [
97
- drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
98
- drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
99
- drauuInstance.value.on("start", () => onStartHook.trigger()),
100
- drauuInstance.value.on("end", () => onEndHook.trigger()),
101
- drauuInstance.value.on("changed", () => {
102
- syncStatus();
103
- onChangedHook.trigger();
104
- })
105
- ];
106
- }, { flush: "post" });
89
+ vueDemi.watch(
90
+ () => core.unrefElement(target),
91
+ (el) => {
92
+ if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
93
+ return;
94
+ if (drauuInstance.value)
95
+ cleanup();
96
+ drauuInstance.value = drauu.createDrauu(__spreadValues({ el }, options));
97
+ syncStatus();
98
+ disposables = [
99
+ drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
100
+ drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
101
+ drauuInstance.value.on("start", () => onStartHook.trigger()),
102
+ drauuInstance.value.on("end", () => onEndHook.trigger()),
103
+ drauuInstance.value.on("changed", () => {
104
+ syncStatus();
105
+ onChangedHook.trigger();
106
+ })
107
+ ];
108
+ },
109
+ { flush: "post" }
110
+ );
107
111
  shared.tryOnScopeDispose(() => cleanup());
108
112
  return {
109
113
  drauuInstance,