@vueuse/integrations 10.0.0-beta.2 → 10.0.0-beta.4

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 (66) hide show
  1. package/index.cjs +130 -83
  2. package/index.d.ts +30 -42
  3. package/index.iife.js +130 -83
  4. package/index.iife.min.js +1 -1
  5. package/index.mjs +133 -86
  6. package/package.json +5 -5
  7. package/useAsyncValidator/component.cjs +7 -3
  8. package/useAsyncValidator/component.mjs +8 -4
  9. package/useAsyncValidator.cjs +7 -3
  10. package/useAsyncValidator.d.ts +2 -2
  11. package/useAsyncValidator.iife.js +7 -3
  12. package/useAsyncValidator.iife.min.js +1 -1
  13. package/useAsyncValidator.mjs +8 -4
  14. package/useAxios.cjs +25 -17
  15. package/useAxios.d.ts +18 -30
  16. package/useAxios.iife.js +25 -17
  17. package/useAxios.iife.min.js +1 -1
  18. package/useAxios.mjs +26 -18
  19. package/useChangeCase.cjs +1 -1
  20. package/useChangeCase.d.ts +2 -2
  21. package/useChangeCase.iife.js +1 -1
  22. package/useChangeCase.iife.min.js +1 -1
  23. package/useChangeCase.mjs +2 -2
  24. package/useCookies.cjs +11 -1
  25. package/useCookies.iife.js +11 -1
  26. package/useCookies.iife.min.js +1 -1
  27. package/useCookies.mjs +11 -1
  28. package/useDrauu.cjs +22 -18
  29. package/useDrauu.iife.js +22 -18
  30. package/useDrauu.iife.min.js +1 -1
  31. package/useDrauu.mjs +22 -18
  32. package/useFocusTrap/component.cjs +10 -6
  33. package/useFocusTrap/component.mjs +10 -6
  34. package/useFocusTrap.cjs +22 -18
  35. package/useFocusTrap.iife.js +22 -18
  36. package/useFocusTrap.iife.min.js +1 -1
  37. package/useFocusTrap.mjs +22 -18
  38. package/useFuse.cjs +25 -14
  39. package/useFuse.d.ts +2 -2
  40. package/useFuse.iife.js +25 -14
  41. package/useFuse.iife.min.js +1 -1
  42. package/useFuse.mjs +27 -16
  43. package/useIDBKeyval.cjs +1 -1
  44. package/useIDBKeyval.d.ts +2 -2
  45. package/useIDBKeyval.iife.js +1 -1
  46. package/useIDBKeyval.iife.min.js +1 -1
  47. package/useIDBKeyval.mjs +2 -2
  48. package/useJwt.cjs +2 -2
  49. package/useJwt.d.ts +2 -2
  50. package/useJwt.iife.js +2 -2
  51. package/useJwt.iife.min.js +1 -1
  52. package/useJwt.mjs +3 -3
  53. package/useNProgress.d.ts +2 -2
  54. package/useNProgress.iife.min.js +1 -1
  55. package/useQRCode.cjs +9 -5
  56. package/useQRCode.d.ts +2 -2
  57. package/useQRCode.iife.js +9 -5
  58. package/useQRCode.iife.min.js +1 -1
  59. package/useQRCode.mjs +10 -6
  60. package/useSortable/component.cjs +6 -3
  61. package/useSortable/component.mjs +8 -5
  62. package/useSortable.cjs +6 -3
  63. package/useSortable.d.ts +4 -4
  64. package/useSortable.iife.js +7 -5
  65. package/useSortable.iife.min.js +1 -1
  66. package/useSortable.mjs +7 -4
package/useDrauu.iife.js CHANGED
@@ -196,24 +196,28 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
196
196
  shiftPressed.value = drauuInstance.value.shiftPressed;
197
197
  }
198
198
  };
199
- vueDemi.watch(() => core.unrefElement(target), (el) => {
200
- if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
201
- return;
202
- if (drauuInstance.value)
203
- cleanup();
204
- drauuInstance.value = drauu.createDrauu(__spreadValues({ el }, options));
205
- syncStatus();
206
- disposables = [
207
- drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
208
- drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
209
- drauuInstance.value.on("start", () => onStartHook.trigger()),
210
- drauuInstance.value.on("end", () => onEndHook.trigger()),
211
- drauuInstance.value.on("changed", () => {
212
- syncStatus();
213
- onChangedHook.trigger();
214
- })
215
- ];
216
- }, { flush: "post" });
199
+ vueDemi.watch(
200
+ () => core.unrefElement(target),
201
+ (el) => {
202
+ if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
203
+ return;
204
+ if (drauuInstance.value)
205
+ cleanup();
206
+ drauuInstance.value = drauu.createDrauu(__spreadValues({ el }, options));
207
+ syncStatus();
208
+ disposables = [
209
+ drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
210
+ drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
211
+ drauuInstance.value.on("start", () => onStartHook.trigger()),
212
+ drauuInstance.value.on("end", () => onEndHook.trigger()),
213
+ drauuInstance.value.on("changed", () => {
214
+ syncStatus();
215
+ onChangedHook.trigger();
216
+ })
217
+ ];
218
+ },
219
+ { flush: "post" }
220
+ );
217
221
  shared.tryOnScopeDispose(() => cleanup());
218
222
  return {
219
223
  drauuInstance,
@@ -1 +1 @@
1
- var VueDemi=function(r,n,f){if(r.install)return r;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(n.version.slice(0,4)==="2.7."){let a=function(l,c){var u,v={},p={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(d,t){return v[d]=t,this},directive:function(d,t){return t?(n.directive(d,t),p):n.directive(d)},mount:function(d,t){return u||(u=new n(Object.assign({propsData:c},l,{provide:Object.assign(v,l.provide)})),u.$mount(d,t),u)},unmount:function(){u&&(u.$destroy(),u=void 0)}};return p};var A=a;for(var s in n)r[s]=n[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.warn=n.util.warn,r.createApp=a}else if(n.version.slice(0,2)==="2.")if(f){for(var s in f)r[s]=f[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.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 s in n)r[s]=n[s];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=n,r.Vue2=void 0,r.version=n.version,r.set=function(a,l,c){return Array.isArray(a)?(a.length=Math.max(a.length,l),a.splice(l,1,c),c):(a[l]=c,c)},r.del=function(a,l){if(Array.isArray(a)){a.splice(l,1);return}delete a[l]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return r}(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(r,n,f,s,A){"use strict";var a=Object.defineProperty,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,v=(t,i,e)=>i in t?a(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,p=(t,i)=>{for(var e in i||(i={}))c.call(i,e)&&v(t,e,i[e]);if(l)for(var e of l(i))u.call(i,e)&&v(t,e,i[e]);return t};function d(t,i){const e=n.ref();let g=[];const y=s.createEventHook(),b=s.createEventHook(),E=s.createEventHook(),P=s.createEventHook(),w=s.createEventHook(),O=n.ref(!1),H=n.ref(!1),C=n.ref(!1),m=n.ref(!1),h=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});n.watch(h,()=>{const o=e.value;o&&(o.brush=h.value,o.mode=h.value.mode)},{deep:!0});const U=()=>{var o;return(o=e.value)==null?void 0:o.undo()},I=()=>{var o;return(o=e.value)==null?void 0:o.redo()},j=()=>{var o;return(o=e.value)==null?void 0:o.clear()},G=()=>{var o;return(o=e.value)==null?void 0:o.cancel()},x=o=>{var _;return(_=e.value)==null?void 0:_.load(o)},R=()=>{var o;return(o=e.value)==null?void 0:o.dump()},S=()=>{var o;g.forEach(_=>_()),(o=e.value)==null||o.unmount()},k=()=>{e.value&&(O.value=e.value.canUndo(),H.value=e.value.canRedo(),C.value=e.value.altPressed,m.value=e.value.shiftPressed)};return n.watch(()=>s.unrefElement(t),o=>{!o||typeof SVGSVGElement=="undefined"||!(o instanceof SVGSVGElement)||(e.value&&S(),e.value=f.createDrauu(p({el:o},i)),k(),g=[e.value.on("canceled",()=>b.trigger()),e.value.on("committed",()=>E.trigger()),e.value.on("start",()=>P.trigger()),e.value.on("end",()=>w.trigger()),e.value.on("changed",()=>{k(),y.trigger()})])},{flush:"post"}),A.tryOnScopeDispose(()=>S()),{drauuInstance:e,load:x,dump:R,clear:j,cancel:G,undo:U,redo:I,canUndo:O,canRedo:H,brush:h,onChanged:y.on,onCommitted:E.on,onStart:P.on,onEnd:w.on,onCanceled:b.on}}r.useDrauu=d})(this.VueUse=this.VueUse||{},VueDemi,Drauu,VueUse,VueUse);
1
+ var VueDemi=function(r,n,f){if(r.install)return r;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(n.version.slice(0,4)==="2.7."){let a=function(l,c){var u,v={},p={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(d,t){return v[d]=t,this},directive:function(d,t){return t?(n.directive(d,t),p):n.directive(d)},mount:function(d,t){return u||(u=new n(Object.assign({propsData:c},l,{provide:Object.assign(v,l.provide)})),u.$mount(d,t),u)},unmount:function(){u&&(u.$destroy(),u=void 0)}};return p};var A=a;for(var s in n)r[s]=n[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.warn=n.util.warn,r.createApp=a}else if(n.version.slice(0,2)==="2.")if(f){for(var s in f)r[s]=f[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.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 s in n)r[s]=n[s];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=n,r.Vue2=void 0,r.version=n.version,r.set=function(a,l,c){return Array.isArray(a)?(a.length=Math.max(a.length,l),a.splice(l,1,c),c):(a[l]=c,c)},r.del=function(a,l){if(Array.isArray(a)){a.splice(l,1);return}delete a[l]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return r}(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(r,n,f,s,A){"use strict";var a=Object.defineProperty,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,v=(t,i,e)=>i in t?a(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,p=(t,i)=>{for(var e in i||(i={}))c.call(i,e)&&v(t,e,i[e]);if(l)for(var e of l(i))u.call(i,e)&&v(t,e,i[e]);return t};function d(t,i){const e=n.ref();let g=[];const y=s.createEventHook(),b=s.createEventHook(),E=s.createEventHook(),P=s.createEventHook(),w=s.createEventHook(),O=n.ref(!1),H=n.ref(!1),C=n.ref(!1),m=n.ref(!1),h=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});n.watch(h,()=>{const o=e.value;o&&(o.brush=h.value,o.mode=h.value.mode)},{deep:!0});const U=()=>{var o;return(o=e.value)==null?void 0:o.undo()},I=()=>{var o;return(o=e.value)==null?void 0:o.redo()},j=()=>{var o;return(o=e.value)==null?void 0:o.clear()},G=()=>{var o;return(o=e.value)==null?void 0:o.cancel()},x=o=>{var _;return(_=e.value)==null?void 0:_.load(o)},R=()=>{var o;return(o=e.value)==null?void 0:o.dump()},S=()=>{var o;g.forEach(_=>_()),(o=e.value)==null||o.unmount()},k=()=>{e.value&&(O.value=e.value.canUndo(),H.value=e.value.canRedo(),C.value=e.value.altPressed,m.value=e.value.shiftPressed)};return n.watch(()=>s.unrefElement(t),o=>{!o||typeof SVGSVGElement>"u"||!(o instanceof SVGSVGElement)||(e.value&&S(),e.value=f.createDrauu(p({el:o},i)),k(),g=[e.value.on("canceled",()=>b.trigger()),e.value.on("committed",()=>E.trigger()),e.value.on("start",()=>P.trigger()),e.value.on("end",()=>w.trigger()),e.value.on("changed",()=>{k(),y.trigger()})])},{flush:"post"}),A.tryOnScopeDispose(()=>S()),{drauuInstance:e,load:x,dump:R,clear:j,cancel:G,undo:U,redo:I,canUndo:O,canRedo:H,brush:h,onChanged:y.on,onCommitted:E.on,onStart:P.on,onEnd:w.on,onCanceled:b.on}}r.useDrauu=d})(this.VueUse=this.VueUse||{},VueDemi,Drauu,VueUse,VueUse);
package/useDrauu.mjs CHANGED
@@ -84,24 +84,28 @@ function useDrauu(target, options) {
84
84
  shiftPressed.value = drauuInstance.value.shiftPressed;
85
85
  }
86
86
  };
87
- watch(() => unrefElement(target), (el) => {
88
- if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
89
- return;
90
- if (drauuInstance.value)
91
- cleanup();
92
- drauuInstance.value = createDrauu(__spreadValues({ el }, options));
93
- syncStatus();
94
- disposables = [
95
- drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
96
- drauuInstance.value.on("committed", () => onCommittedHook.trigger()),
97
- drauuInstance.value.on("start", () => onStartHook.trigger()),
98
- drauuInstance.value.on("end", () => onEndHook.trigger()),
99
- drauuInstance.value.on("changed", () => {
100
- syncStatus();
101
- onChangedHook.trigger();
102
- })
103
- ];
104
- }, { flush: "post" });
87
+ watch(
88
+ () => unrefElement(target),
89
+ (el) => {
90
+ if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
91
+ return;
92
+ if (drauuInstance.value)
93
+ cleanup();
94
+ drauuInstance.value = 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
+ },
107
+ { flush: "post" }
108
+ );
105
109
  tryOnScopeDispose(() => cleanup());
106
110
  return {
107
111
  drauuInstance,
@@ -12,12 +12,16 @@ const UseFocusTrap = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
12
12
  const target = vueDemi.ref();
13
13
  const activate = () => trap && trap.activate();
14
14
  const deactivate = () => trap && trap.deactivate();
15
- vueDemi.watch(() => core.unrefElement(target), (el) => {
16
- if (!el)
17
- return;
18
- trap = focusTrap.createFocusTrap(el, props.options || {});
19
- activate();
20
- }, { flush: "post" });
15
+ vueDemi.watch(
16
+ () => core.unrefElement(target),
17
+ (el) => {
18
+ if (!el)
19
+ return;
20
+ trap = focusTrap.createFocusTrap(el, props.options || {});
21
+ activate();
22
+ },
23
+ { flush: "post" }
24
+ );
21
25
  vueDemi.onScopeDispose(() => deactivate());
22
26
  return () => {
23
27
  if (slots.default)
@@ -10,12 +10,16 @@ const UseFocusTrap = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
10
10
  const target = ref();
11
11
  const activate = () => trap && trap.activate();
12
12
  const deactivate = () => trap && trap.deactivate();
13
- watch(() => unrefElement(target), (el) => {
14
- if (!el)
15
- return;
16
- trap = createFocusTrap(el, props.options || {});
17
- activate();
18
- }, { flush: "post" });
13
+ watch(
14
+ () => unrefElement(target),
15
+ (el) => {
16
+ if (!el)
17
+ return;
18
+ trap = createFocusTrap(el, props.options || {});
19
+ activate();
20
+ },
21
+ { flush: "post" }
22
+ );
19
23
  onScopeDispose(() => deactivate());
20
24
  return () => {
21
25
  if (slots.default)
package/useFocusTrap.cjs CHANGED
@@ -54,24 +54,28 @@ function useFocusTrap(target, options = {}) {
54
54
  isPaused.value = false;
55
55
  }
56
56
  };
57
- vueDemi.watch(() => core.unrefElement(target), (el) => {
58
- if (!el)
59
- return;
60
- trap = focusTrap.createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
61
- onActivate() {
62
- hasFocus.value = true;
63
- if (options.onActivate)
64
- options.onActivate();
65
- },
66
- onDeactivate() {
67
- hasFocus.value = false;
68
- if (options.onDeactivate)
69
- options.onDeactivate();
70
- }
71
- }));
72
- if (immediate)
73
- activate();
74
- }, { flush: "post" });
57
+ vueDemi.watch(
58
+ () => core.unrefElement(target),
59
+ (el) => {
60
+ if (!el)
61
+ return;
62
+ trap = focusTrap.createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
63
+ onActivate() {
64
+ hasFocus.value = true;
65
+ if (options.onActivate)
66
+ options.onActivate();
67
+ },
68
+ onDeactivate() {
69
+ hasFocus.value = false;
70
+ if (options.onDeactivate)
71
+ options.onDeactivate();
72
+ }
73
+ }));
74
+ if (immediate)
75
+ activate();
76
+ },
77
+ { flush: "post" }
78
+ );
75
79
  core.tryOnScopeDispose(() => deactivate());
76
80
  return {
77
81
  hasFocus,
@@ -165,24 +165,28 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
165
165
  isPaused.value = false;
166
166
  }
167
167
  };
168
- vueDemi.watch(() => core.unrefElement(target), (el) => {
169
- if (!el)
170
- return;
171
- trap = focusTrap.createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
172
- onActivate() {
173
- hasFocus.value = true;
174
- if (options.onActivate)
175
- options.onActivate();
176
- },
177
- onDeactivate() {
178
- hasFocus.value = false;
179
- if (options.onDeactivate)
180
- options.onDeactivate();
181
- }
182
- }));
183
- if (immediate)
184
- activate();
185
- }, { flush: "post" });
168
+ vueDemi.watch(
169
+ () => core.unrefElement(target),
170
+ (el) => {
171
+ if (!el)
172
+ return;
173
+ trap = focusTrap.createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
174
+ onActivate() {
175
+ hasFocus.value = true;
176
+ if (options.onActivate)
177
+ options.onActivate();
178
+ },
179
+ onDeactivate() {
180
+ hasFocus.value = false;
181
+ if (options.onDeactivate)
182
+ options.onDeactivate();
183
+ }
184
+ }));
185
+ if (immediate)
186
+ activate();
187
+ },
188
+ { flush: "post" }
189
+ );
186
190
  core.tryOnScopeDispose(() => deactivate());
187
191
  return {
188
192
  hasFocus,
@@ -1 +1 @@
1
- var VueDemi=function(r,n,u){if(r.install)return r;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(n.version.slice(0,4)==="2.7."){let s=function(a,f){var c,_={},O={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(l,p){return _[l]=p,this},directive:function(l,p){return p?(n.directive(l,p),O):n.directive(l)},mount:function(l,p){return c||(c=new n(Object.assign({propsData:f},a,{provide:Object.assign(_,a.provide)})),c.$mount(l,p),c)},unmount:function(){c&&(c.$destroy(),c=void 0)}};return O};var w=s;for(var v in n)r[v]=n[v];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.warn=n.util.warn,r.createApp=s}else if(n.version.slice(0,2)==="2.")if(u){for(var v in u)r[v]=u[v];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.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 v in n)r[v]=n[v];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=n,r.Vue2=void 0,r.version=n.version,r.set=function(s,a,f){return Array.isArray(s)?(s.length=Math.max(s.length,a),s.splice(a,1,f),f):(s[a]=f,f)},r.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 r}(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(r,n,u,v){"use strict";var w=Object.defineProperty,s=Object.defineProperties,a=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,O=(i,t,e)=>t in i?w(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,l=(i,t)=>{for(var e in t||(t={}))c.call(t,e)&&O(i,e,t[e]);if(f)for(var e of f(t))_.call(t,e)&&O(i,e,t[e]);return i},p=(i,t)=>s(i,a(t)),A=(i,t)=>{var e={};for(var o in i)c.call(i,o)&&t.indexOf(o)<0&&(e[o]=i[o]);if(i!=null&&f)for(var o of f(i))t.indexOf(o)<0&&_.call(i,o)&&(e[o]=i[o]);return e};function j(i,t={}){let e;const o=t,{immediate:g}=o,T=A(o,["immediate"]),h=u.ref(!1),P=u.ref(!1),b=d=>e&&e.activate(d),y=d=>e&&e.deactivate(d),x=()=>{e&&(e.pause(),P.value=!0)},F=()=>{e&&(e.unpause(),P.value=!1)};return u.watch(()=>n.unrefElement(i),d=>{!d||(e=v.createFocusTrap(d,p(l({},T),{onActivate(){h.value=!0,t.onActivate&&t.onActivate()},onDeactivate(){h.value=!1,t.onDeactivate&&t.onDeactivate()}})),g&&b())},{flush:"post"}),n.tryOnScopeDispose(()=>y()),{hasFocus:h,isPaused:P,activate:b,deactivate:y,pause:x,unpause:F}}r.useFocusTrap=j})(this.VueUse=this.VueUse||{},VueUse,VueDemi,focusTrap);
1
+ var VueDemi=function(r,n,u){if(r.install)return r;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(n.version.slice(0,4)==="2.7."){let s=function(a,f){var c,_={},O={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(l,p){return _[l]=p,this},directive:function(l,p){return p?(n.directive(l,p),O):n.directive(l)},mount:function(l,p){return c||(c=new n(Object.assign({propsData:f},a,{provide:Object.assign(_,a.provide)})),c.$mount(l,p),c)},unmount:function(){c&&(c.$destroy(),c=void 0)}};return O};var w=s;for(var v in n)r[v]=n[v];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.warn=n.util.warn,r.createApp=s}else if(n.version.slice(0,2)==="2.")if(u){for(var v in u)r[v]=u[v];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.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 v in n)r[v]=n[v];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=n,r.Vue2=void 0,r.version=n.version,r.set=function(s,a,f){return Array.isArray(s)?(s.length=Math.max(s.length,a),s.splice(a,1,f),f):(s[a]=f,f)},r.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 r}(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(r,n,u,v){"use strict";var w=Object.defineProperty,s=Object.defineProperties,a=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,O=(i,t,e)=>t in i?w(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,l=(i,t)=>{for(var e in t||(t={}))c.call(t,e)&&O(i,e,t[e]);if(f)for(var e of f(t))_.call(t,e)&&O(i,e,t[e]);return i},p=(i,t)=>s(i,a(t)),A=(i,t)=>{var e={};for(var o in i)c.call(i,o)&&t.indexOf(o)<0&&(e[o]=i[o]);if(i!=null&&f)for(var o of f(i))t.indexOf(o)<0&&_.call(i,o)&&(e[o]=i[o]);return e};function j(i,t={}){let e;const o=t,{immediate:g}=o,T=A(o,["immediate"]),h=u.ref(!1),P=u.ref(!1),b=d=>e&&e.activate(d),y=d=>e&&e.deactivate(d),x=()=>{e&&(e.pause(),P.value=!0)},F=()=>{e&&(e.unpause(),P.value=!1)};return u.watch(()=>n.unrefElement(i),d=>{d&&(e=v.createFocusTrap(d,p(l({},T),{onActivate(){h.value=!0,t.onActivate&&t.onActivate()},onDeactivate(){h.value=!1,t.onDeactivate&&t.onDeactivate()}})),g&&b())},{flush:"post"}),n.tryOnScopeDispose(()=>y()),{hasFocus:h,isPaused:P,activate:b,deactivate:y,pause:x,unpause:F}}r.useFocusTrap=j})(this.VueUse=this.VueUse||{},VueUse,VueDemi,focusTrap);
package/useFocusTrap.mjs CHANGED
@@ -52,24 +52,28 @@ function useFocusTrap(target, options = {}) {
52
52
  isPaused.value = false;
53
53
  }
54
54
  };
55
- watch(() => unrefElement(target), (el) => {
56
- if (!el)
57
- return;
58
- trap = createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
59
- onActivate() {
60
- hasFocus.value = true;
61
- if (options.onActivate)
62
- options.onActivate();
63
- },
64
- onDeactivate() {
65
- hasFocus.value = false;
66
- if (options.onDeactivate)
67
- options.onDeactivate();
68
- }
69
- }));
70
- if (immediate)
71
- activate();
72
- }, { flush: "post" });
55
+ watch(
56
+ () => unrefElement(target),
57
+ (el) => {
58
+ if (!el)
59
+ return;
60
+ trap = createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
61
+ onActivate() {
62
+ hasFocus.value = true;
63
+ if (options.onActivate)
64
+ options.onActivate();
65
+ },
66
+ onDeactivate() {
67
+ hasFocus.value = false;
68
+ if (options.onDeactivate)
69
+ options.onDeactivate();
70
+ }
71
+ }));
72
+ if (immediate)
73
+ activate();
74
+ },
75
+ { flush: "post" }
76
+ );
73
77
  tryOnScopeDispose(() => deactivate());
74
78
  return {
75
79
  hasFocus,
package/useFuse.cjs CHANGED
@@ -7,24 +7,35 @@ var shared = require('@vueuse/shared');
7
7
  function useFuse(search, data, options) {
8
8
  const createFuse = () => {
9
9
  var _a, _b;
10
- return new Fuse((_a = shared.resolveUnref(data)) != null ? _a : [], (_b = shared.resolveUnref(options)) == null ? void 0 : _b.fuseOptions);
10
+ return new Fuse(
11
+ (_a = shared.toValue(data)) != null ? _a : [],
12
+ (_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
13
+ );
11
14
  };
12
15
  const fuse = vueDemi.ref(createFuse());
13
- vueDemi.watch(() => {
14
- var _a;
15
- return (_a = shared.resolveUnref(options)) == null ? void 0 : _a.fuseOptions;
16
- }, () => {
17
- fuse.value = createFuse();
18
- }, { deep: true });
19
- vueDemi.watch(() => shared.resolveUnref(data), (newData) => {
20
- fuse.value.setCollection(newData);
21
- }, { deep: true });
16
+ vueDemi.watch(
17
+ () => {
18
+ var _a;
19
+ return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
20
+ },
21
+ () => {
22
+ fuse.value = createFuse();
23
+ },
24
+ { deep: true }
25
+ );
26
+ vueDemi.watch(
27
+ () => shared.toValue(data),
28
+ (newData) => {
29
+ fuse.value.setCollection(newData);
30
+ },
31
+ { deep: true }
32
+ );
22
33
  const results = vueDemi.computed(() => {
23
- const resolved = shared.resolveUnref(options);
24
- if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !vueDemi.unref(search))
25
- return shared.resolveUnref(data).map((item, index) => ({ item, refIndex: index }));
34
+ const resolved = shared.toValue(options);
35
+ if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
36
+ return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
26
37
  const limit = resolved == null ? void 0 : resolved.resultLimit;
27
- return fuse.value.search(shared.resolveUnref(search), limit ? { limit } : void 0);
38
+ return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
28
39
  });
29
40
  return {
30
41
  fuse,
package/useFuse.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as vue_demi from 'vue-demi';
2
2
  import { ComputedRef } from 'vue-demi';
3
3
  import Fuse from 'fuse.js';
4
- import { MaybeComputedRef } from '@vueuse/shared';
4
+ import { MaybeRefOrGetter } from '@vueuse/shared';
5
5
 
6
6
  type FuseOptions<T> = Fuse.IFuseOptions<T>;
7
7
  interface UseFuseOptions<T> {
@@ -9,7 +9,7 @@ interface UseFuseOptions<T> {
9
9
  resultLimit?: number;
10
10
  matchAllWhenSearchEmpty?: boolean;
11
11
  }
12
- declare function useFuse<DataItem>(search: MaybeComputedRef<string>, data: MaybeComputedRef<DataItem[]>, options?: MaybeComputedRef<UseFuseOptions<DataItem>>): {
12
+ declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
13
13
  fuse: vue_demi.Ref<{
14
14
  search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
15
15
  setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
package/useFuse.iife.js CHANGED
@@ -118,24 +118,35 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
118
118
  function useFuse(search, data, options) {
119
119
  const createFuse = () => {
120
120
  var _a, _b;
121
- return new Fuse((_a = shared.resolveUnref(data)) != null ? _a : [], (_b = shared.resolveUnref(options)) == null ? void 0 : _b.fuseOptions);
121
+ return new Fuse(
122
+ (_a = shared.toValue(data)) != null ? _a : [],
123
+ (_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
124
+ );
122
125
  };
123
126
  const fuse = vueDemi.ref(createFuse());
124
- vueDemi.watch(() => {
125
- var _a;
126
- return (_a = shared.resolveUnref(options)) == null ? void 0 : _a.fuseOptions;
127
- }, () => {
128
- fuse.value = createFuse();
129
- }, { deep: true });
130
- vueDemi.watch(() => shared.resolveUnref(data), (newData) => {
131
- fuse.value.setCollection(newData);
132
- }, { deep: true });
127
+ vueDemi.watch(
128
+ () => {
129
+ var _a;
130
+ return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
131
+ },
132
+ () => {
133
+ fuse.value = createFuse();
134
+ },
135
+ { deep: true }
136
+ );
137
+ vueDemi.watch(
138
+ () => shared.toValue(data),
139
+ (newData) => {
140
+ fuse.value.setCollection(newData);
141
+ },
142
+ { deep: true }
143
+ );
133
144
  const results = vueDemi.computed(() => {
134
- const resolved = shared.resolveUnref(options);
135
- if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !vueDemi.unref(search))
136
- return shared.resolveUnref(data).map((item, index) => ({ item, refIndex: index }));
145
+ const resolved = shared.toValue(options);
146
+ if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
147
+ return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
137
148
  const limit = resolved == null ? void 0 : resolved.resultLimit;
138
- return fuse.value.search(shared.resolveUnref(search), limit ? { limit } : void 0);
149
+ return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
139
150
  });
140
151
  return {
141
152
  fuse,
@@ -1 +1 @@
1
- var VueDemi=function(n,e,u){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 i=function(o,l){var f,c={},v={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(r,t){return c[r]=t,this},directive:function(r,t){return t?(e.directive(r,t),v):e.directive(r)},mount:function(r,t){return f||(f=new e(Object.assign({propsData:l},o,{provide:Object.assign(c,o.provide)})),f.$mount(r,t),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return v};var d=i;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=i}else if(e.version.slice(0,2)==="2.")if(u){for(var s in u)n[s]=u[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(i,o,l){return Array.isArray(i)?(i.length=Math.max(i.length,o),i.splice(o,1,l),l):(i[o]=l,l)},n.del=function(i,o){if(Array.isArray(i)){i.splice(o,1);return}delete i[o]}}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,u,s){"use strict";function d(i,o,l){const f=()=>{var r,t;return new e((r=s.resolveUnref(o))!=null?r:[],(t=s.resolveUnref(l))==null?void 0:t.fuseOptions)},c=u.ref(f());u.watch(()=>{var r;return(r=s.resolveUnref(l))==null?void 0:r.fuseOptions},()=>{c.value=f()},{deep:!0}),u.watch(()=>s.resolveUnref(o),r=>{c.value.setCollection(r)},{deep:!0});const v=u.computed(()=>{const r=s.resolveUnref(l);if((r==null?void 0:r.matchAllWhenSearchEmpty)&&!u.unref(i))return s.resolveUnref(o).map((p,a)=>({item:p,refIndex:a}));const t=r==null?void 0:r.resultLimit;return c.value.search(s.resolveUnref(i),t?{limit:t}:void 0)});return{fuse:c,results:v}}n.useFuse=d})(this.VueUse=this.VueUse||{},Fuse,VueDemi,VueUse);
1
+ var VueDemi=function(n,e,f){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 o=function(t,u){var l,c={},v={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(i,s){return c[i]=s,this},directive:function(i,s){return s?(e.directive(i,s),v):e.directive(i)},mount:function(i,s){return l||(l=new e(Object.assign({propsData:u},t,{provide:Object.assign(c,t.provide)})),l.$mount(i,s),l)},unmount:function(){l&&(l.$destroy(),l=void 0)}};return v};var d=o;for(var r in e)n[r]=e[r];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=o}else if(e.version.slice(0,2)==="2.")if(f){for(var r in f)n[r]=f[r];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 r in e)n[r]=e[r];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=e,n.Vue2=void 0,n.version=e.version,n.set=function(o,t,u){return Array.isArray(o)?(o.length=Math.max(o.length,t),o.splice(t,1,u),u):(o[t]=u,u)},n.del=function(o,t){if(Array.isArray(o)){o.splice(t,1);return}delete o[t]}}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,f,r){"use strict";function d(o,t,u){const l=()=>{var i,s;return new e((i=r.toValue(t))!=null?i:[],(s=r.toValue(u))==null?void 0:s.fuseOptions)},c=f.ref(l());f.watch(()=>{var i;return(i=r.toValue(u))==null?void 0:i.fuseOptions},()=>{c.value=l()},{deep:!0}),f.watch(()=>r.toValue(t),i=>{c.value.setCollection(i)},{deep:!0});const v=f.computed(()=>{const i=r.toValue(u);if(i?.matchAllWhenSearchEmpty&&!r.toValue(o))return r.toValue(t).map((a,p)=>({item:a,refIndex:p}));const s=i?.resultLimit;return c.value.search(r.toValue(o),s?{limit:s}:void 0)});return{fuse:c,results:v}}n.useFuse=d})(this.VueUse=this.VueUse||{},Fuse,VueDemi,VueUse);
package/useFuse.mjs CHANGED
@@ -1,28 +1,39 @@
1
1
  import Fuse from 'fuse.js';
2
- import { ref, watch, computed, unref } from 'vue-demi';
3
- import { resolveUnref } from '@vueuse/shared';
2
+ import { ref, watch, computed } from 'vue-demi';
3
+ import { toValue } from '@vueuse/shared';
4
4
 
5
5
  function useFuse(search, data, options) {
6
6
  const createFuse = () => {
7
7
  var _a, _b;
8
- return new Fuse((_a = resolveUnref(data)) != null ? _a : [], (_b = resolveUnref(options)) == null ? void 0 : _b.fuseOptions);
8
+ return new Fuse(
9
+ (_a = toValue(data)) != null ? _a : [],
10
+ (_b = toValue(options)) == null ? void 0 : _b.fuseOptions
11
+ );
9
12
  };
10
13
  const fuse = ref(createFuse());
11
- watch(() => {
12
- var _a;
13
- return (_a = resolveUnref(options)) == null ? void 0 : _a.fuseOptions;
14
- }, () => {
15
- fuse.value = createFuse();
16
- }, { deep: true });
17
- watch(() => resolveUnref(data), (newData) => {
18
- fuse.value.setCollection(newData);
19
- }, { deep: true });
14
+ watch(
15
+ () => {
16
+ var _a;
17
+ return (_a = toValue(options)) == null ? void 0 : _a.fuseOptions;
18
+ },
19
+ () => {
20
+ fuse.value = createFuse();
21
+ },
22
+ { deep: true }
23
+ );
24
+ watch(
25
+ () => toValue(data),
26
+ (newData) => {
27
+ fuse.value.setCollection(newData);
28
+ },
29
+ { deep: true }
30
+ );
20
31
  const results = computed(() => {
21
- const resolved = resolveUnref(options);
22
- if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !unref(search))
23
- return resolveUnref(data).map((item, index) => ({ item, refIndex: index }));
32
+ const resolved = toValue(options);
33
+ if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !toValue(search))
34
+ return toValue(data).map((item, index) => ({ item, refIndex: index }));
24
35
  const limit = resolved == null ? void 0 : resolved.resultLimit;
25
- return fuse.value.search(resolveUnref(search), limit ? { limit } : void 0);
36
+ return fuse.value.search(toValue(search), limit ? { limit } : void 0);
26
37
  });
27
38
  return {
28
39
  fuse,
package/useIDBKeyval.cjs CHANGED
@@ -32,7 +32,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
32
32
  } = options;
33
33
  const isFinished = vueDemi.ref(false);
34
34
  const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(initialValue);
35
- const rawInit = shared.resolveUnref(initialValue);
35
+ const rawInit = shared.toValue(initialValue);
36
36
  async function read() {
37
37
  try {
38
38
  const rawValue = await idbKeyval.get(key);
package/useIDBKeyval.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfigurableFlush, MaybeComputedRef, RemovableRef } from '@vueuse/shared';
1
+ import { ConfigurableFlush, MaybeRefOrGetter, RemovableRef } from '@vueuse/shared';
2
2
  import { Ref } from 'vue-demi';
3
3
 
4
4
  interface UseIDBOptions extends ConfigurableFlush {
@@ -33,7 +33,7 @@ interface UseIDBOptions extends ConfigurableFlush {
33
33
  * @param initialValue
34
34
  * @param options
35
35
  */
36
- declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeComputedRef<T>, options?: UseIDBOptions): {
36
+ declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): {
37
37
  data: RemovableRef<T>;
38
38
  isFinished: Ref<boolean>;
39
39
  };
@@ -143,7 +143,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
143
143
  } = options;
144
144
  const isFinished = vueDemi.ref(false);
145
145
  const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(initialValue);
146
- const rawInit = shared.resolveUnref(initialValue);
146
+ const rawInit = shared.toValue(initialValue);
147
147
  async function read() {
148
148
  try {
149
149
  const rawValue = await idbKeyval.get(key);
@@ -1 +1 @@
1
- var VueDemi=function(r,n,c){if(r.install)return r;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(n.version.slice(0,4)==="2.7."){let o=function(a,u){var f,d={},v={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(e,t){return d[e]=t,this},directive:function(e,t){return t?(n.directive(e,t),v):n.directive(e)},mount:function(e,t){return f||(f=new n(Object.assign({propsData:u},a,{provide:Object.assign(d,a.provide)})),f.$mount(e,t),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return v};var O=o;for(var s in n)r[s]=n[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.warn=n.util.warn,r.createApp=o}else if(n.version.slice(0,2)==="2.")if(c){for(var s in c)r[s]=c[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.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 s in n)r[s]=n[s];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=n,r.Vue2=void 0,r.version=n.version,r.set=function(o,a,u){return Array.isArray(o)?(o.length=Math.max(o.length,a),o.splice(a,1,u),u):(o[a]=u,u)},r.del=function(o,a){if(Array.isArray(o)){o.splice(a,1);return}delete o[a]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return r}(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(r,n,c,s){"use strict";var O=Object.defineProperty,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,f=(e,t,i)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,d=(e,t)=>{for(var i in t||(t={}))a.call(t,i)&&f(e,i,t[i]);if(o)for(var i of o(t))u.call(t,i)&&f(e,i,t[i]);return e};function v(e,t,i={}){const{flush:_="pre",deep:A=!0,shallow:P=!1,onError:h=p=>{console.error(p)},writeDefaults:b=!0}=i,y=c.ref(!1),l=(P?c.shallowRef:c.ref)(t),w=n.resolveUnref(t);async function I(){try{const p=await s.get(e);p===void 0?w!=null&&b&&await s.set(e,w):l.value=p}catch(p){h(p)}y.value=!0}I();async function g(){try{l.value==null?await s.del(e):Array.isArray(l.value)?await s.update(e,()=>JSON.parse(JSON.stringify(l.value))):typeof l.value=="object"?await s.update(e,()=>d({},l.value)):await s.update(e,()=>l.value)}catch(p){h(p)}}return c.watch(l,()=>g(),{flush:_,deep:A}),{isFinished:y,data:l}}r.useIDBKeyval=v})(this.VueUse=this.VueUse||{},VueUse,VueDemi,idbKeyval);
1
+ var VueDemi=function(r,n,c){if(r.install)return r;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(n.version.slice(0,4)==="2.7."){let s=function(a,u){var f,d={},v={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(e,t){return d[e]=t,this},directive:function(e,t){return t?(n.directive(e,t),v):n.directive(e)},mount:function(e,t){return f||(f=new n(Object.assign({propsData:u},a,{provide:Object.assign(d,a.provide)})),f.$mount(e,t),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return v};var O=s;for(var o in n)r[o]=n[o];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.warn=n.util.warn,r.createApp=s}else if(n.version.slice(0,2)==="2.")if(c){for(var o in c)r[o]=c[o];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.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 o in n)r[o]=n[o];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=n,r.Vue2=void 0,r.version=n.version,r.set=function(s,a,u){return Array.isArray(s)?(s.length=Math.max(s.length,a),s.splice(a,1,u),u):(s[a]=u,u)},r.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 r}(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(r,n,c,o){"use strict";var O=Object.defineProperty,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,f=(e,t,i)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,d=(e,t)=>{for(var i in t||(t={}))a.call(t,i)&&f(e,i,t[i]);if(s)for(var i of s(t))u.call(t,i)&&f(e,i,t[i]);return e};function v(e,t,i={}){const{flush:_="pre",deep:A=!0,shallow:P=!1,onError:h=p=>{console.error(p)},writeDefaults:b=!0}=i,y=c.ref(!1),l=(P?c.shallowRef:c.ref)(t),w=n.toValue(t);async function I(){try{const p=await o.get(e);p===void 0?w!=null&&b&&await o.set(e,w):l.value=p}catch(p){h(p)}y.value=!0}I();async function g(){try{l.value==null?await o.del(e):Array.isArray(l.value)?await o.update(e,()=>JSON.parse(JSON.stringify(l.value))):typeof l.value=="object"?await o.update(e,()=>d({},l.value)):await o.update(e,()=>l.value)}catch(p){h(p)}}return c.watch(l,()=>g(),{flush:_,deep:A}),{isFinished:y,data:l}}r.useIDBKeyval=v})(this.VueUse=this.VueUse||{},VueUse,VueDemi,idbKeyval);
package/useIDBKeyval.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { resolveUnref } from '@vueuse/shared';
1
+ import { toValue } from '@vueuse/shared';
2
2
  import { ref, shallowRef, watch } from 'vue-demi';
3
3
  import { get, set, del, update } from 'idb-keyval';
4
4
 
@@ -30,7 +30,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
30
30
  } = options;
31
31
  const isFinished = ref(false);
32
32
  const data = (shallow ? shallowRef : ref)(initialValue);
33
- const rawInit = resolveUnref(initialValue);
33
+ const rawInit = toValue(initialValue);
34
34
  async function read() {
35
35
  try {
36
36
  const rawValue = await get(key);
package/useJwt.cjs CHANGED
@@ -17,8 +17,8 @@ function useJwt(encodedJwt, options = {}) {
17
17
  return fallbackValue;
18
18
  }
19
19
  };
20
- const header = vueDemi.computed(() => decodeWithFallback(shared.resolveUnref(encodedJwt), { header: true }));
21
- const payload = vueDemi.computed(() => decodeWithFallback(shared.resolveUnref(encodedJwt)));
20
+ const header = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt), { header: true }));
21
+ const payload = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt)));
22
22
  return {
23
23
  header,
24
24
  payload
package/useJwt.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ComputedRef } from 'vue-demi';
2
- import { MaybeComputedRef } from '@vueuse/shared';
2
+ import { MaybeRefOrGetter } from '@vueuse/shared';
3
3
  import { JwtPayload, JwtHeader } from 'jwt-decode';
4
4
 
5
5
  interface UseJwtOptions<Fallback> {
@@ -24,6 +24,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
24
24
  * @see https://vueuse.org/useJwt
25
25
  * @param jwt
26
26
  */
27
- declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeComputedRef<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
27
+ declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
28
28
 
29
29
  export { UseJwtOptions, UseJwtReturn, useJwt };
package/useJwt.iife.js CHANGED
@@ -128,8 +128,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
128
128
  return fallbackValue;
129
129
  }
130
130
  };
131
- const header = vueDemi.computed(() => decodeWithFallback(shared.resolveUnref(encodedJwt), { header: true }));
132
- const payload = vueDemi.computed(() => decodeWithFallback(shared.resolveUnref(encodedJwt)));
131
+ const header = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt), { header: true }));
132
+ const payload = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt)));
133
133
  return {
134
134
  header,
135
135
  payload