@vueuse/integrations 10.8.0 → 10.9.0
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 +1 -6
- package/index.iife.js +1 -6
- package/index.iife.min.js +1 -1
- package/index.mjs +2 -7
- package/package.json +3 -3
- package/useIDBKeyval.cjs +1 -6
- package/useIDBKeyval.iife.js +1 -6
- package/useIDBKeyval.iife.min.js +1 -1
- package/useIDBKeyval.mjs +2 -7
package/index.cjs
CHANGED
|
@@ -518,12 +518,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
518
518
|
if (data.value == null) {
|
|
519
519
|
await idbKeyval.del(key);
|
|
520
520
|
} else {
|
|
521
|
-
|
|
522
|
-
await idbKeyval.update(key, () => JSON.parse(JSON.stringify(data.value)));
|
|
523
|
-
else if (typeof data.value === "object")
|
|
524
|
-
await idbKeyval.update(key, () => ({ ...data.value }));
|
|
525
|
-
else
|
|
526
|
-
await idbKeyval.update(key, () => data.value);
|
|
521
|
+
await idbKeyval.update(key, () => vueDemi.toRaw(data.value));
|
|
527
522
|
}
|
|
528
523
|
} catch (e) {
|
|
529
524
|
onError(e);
|
package/index.iife.js
CHANGED
|
@@ -623,12 +623,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
623
623
|
if (data.value == null) {
|
|
624
624
|
await idbKeyval.del(key);
|
|
625
625
|
} else {
|
|
626
|
-
|
|
627
|
-
await idbKeyval.update(key, () => JSON.parse(JSON.stringify(data.value)));
|
|
628
|
-
else if (typeof data.value === "object")
|
|
629
|
-
await idbKeyval.update(key, () => ({ ...data.value }));
|
|
630
|
-
else
|
|
631
|
-
await idbKeyval.update(key, () => data.value);
|
|
626
|
+
await idbKeyval.update(key, () => vueDemi.toRaw(data.value));
|
|
632
627
|
}
|
|
633
628
|
} catch (e) {
|
|
634
629
|
onError(e);
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(r,o,T){if(r.install)return r;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(o.version.slice(0,4)==="2.7."){let h=function(E,k){var C,B={},G={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(b,L){return B[b]=L,this},directive:function(b,L){return L?(o.directive(b,L),G):o.directive(b)},mount:function(b,L){return C||(C=new o(Object.assign({propsData:k},E,{provide:Object.assign(B,E.provide)})),C.$mount(b,L),C)},unmount:function(){C&&(C.$destroy(),C=void 0)}};return G};var j=h;for(var n in o)r[n]=o[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.warn=o.util.warn,r.hasInjectionContext=function(){return!!r.getCurrentInstance()},r.createApp=h}else if(o.version.slice(0,2)==="2.")if(T){for(var n in T)r[n]=T[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.hasInjectionContext=function(){return!!r.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)r[n]=o[n];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=o,r.Vue2=void 0,r.version=o.version,r.set=function(h,E,k){return Array.isArray(h)?(h.length=Math.max(h.length,E),h.splice(E,1,k),k):(h[E]=k,k)},r.del=function(h,E){if(Array.isArray(h)){h.splice(E,1);return}delete h[E]}}else console.error("[vue-demi] Vue version "+o.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,o,T,n,j,h,E,k,C,B,G,b,L,_,V,$){"use strict";const D=T.default||T;function ee(t,l,e={}){const{validateOption:a={},immediate:s=!0,manual:f=!1}=e,c=o.toRef(t),i=n.shallowRef(null),u=n.ref(!0),p=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)||{}}),R=n.computed(()=>new D(o.toValue(l))),g=async()=>{u.value=!1,p.value=!1;try{await R.value.validate(c.value,a),p.value=!0,i.value=null}catch(d){i.value=d}finally{u.value=!0}return{pass:p.value,errorInfo:i.value,errors:w.value,errorFields:y.value}};f||n.watch([c,R],()=>g(),{immediate:s,deep:!0});const I={isFinished:u,pass:p,errors:w,errorInfo:i,errorFields:y,execute:g};function O(){return new Promise((d,S)=>{o.until(u).toBe(!0).then(()=>d(I)).catch(F=>S(F))})}return{...I,then(d,S){return O().then(d,S)}}}function te(...t){const l=typeof t[0]=="string"?t[0]:void 0,e=typeof l=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let s={},f=j,c=a;const i=A=>!!A?.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:p,onSuccess:w=o.noop,onError:y=o.noop,immediate:R,resetOnExecute:g=!1}=c,I=n.shallowRef(),O=(p?n.shallowRef:n.ref)(u),d=n.ref(!1),S=n.ref(!1),F=n.ref(!1),m=n.shallowRef(),N=j.CancelToken.source;let U=N();const v=A=>{d.value||!S.value||(U.cancel(A),U=N(),F.value=!0,S.value=!1,d.value=!1)},P=A=>{S.value=A,d.value=!A},ve=()=>{g&&(O.value=u)},q=()=>new Promise((A,W)=>{o.until(d).toBe(!0).then(()=>m.value?W(m.value):A(Y))}),J={then:(...A)=>q().then(...A),catch:(...A)=>q().catch(...A)};let Q=0;const X=(A=l,W={})=>{m.value=void 0;const Z=typeof A=="string"?A:l??W.url;if(Z===void 0)return m.value=new j.AxiosError(j.AxiosError.ERR_INVALID_URL),d.value=!0,J;ve(),c.abortPrevious!==!1&&v(),P(!0),Q+=1;const pe=Q;return F.value=!1,f(Z,{...s,...typeof A=="object"?A:W,cancelToken:U.token}).then(H=>{if(F.value)return;I.value=H;const K=H.data;O.value=K,w(K)}).catch(H=>{m.value=H,y(H)}).finally(()=>{var H;(H=c.onFinish)==null||H.call(c),pe===Q&&P(!1)}),J};R&&l&&X();const Y={response:I,data:O,error:m,isFinished:d,isLoading:S,cancel:v,isAborted:F,isCanceled:F,abort:v,execute:X};return{...Y,...J}}var x=Object.freeze({__proto__:null,camelCase:h.camelCase,capitalCase:h.capitalCase,constantCase:h.constantCase,dotCase:h.dotCase,headerCase:h.headerCase,noCase:h.noCase,paramCase:h.paramCase,pascalCase:h.pascalCase,pathCase:h.pathCase,sentenceCase:h.sentenceCase,snakeCase:h.snakeCase});function ne(t,l,e){if(typeof t=="function")return n.computed(()=>x[l](o.toValue(t),e));const a=n.ref(t);return n.computed({get(){return x[l](a.value,e)},set(s){a.value=s}})}function oe(t){const l=new E(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:s=!1}={})=>z(e,{doNotParse:a,autoUpdateDependencies:s},l)}function z(t,{doNotParse:l=!1,autoUpdateDependencies:e=!1}={},a=new E){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:l,...u[1]})),getAll:(...u)=>(c.value,a.getAll({doNotParse:l,...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,l,e){if(!t)return!0;for(const a of t)if(l[a]!==e[a])return!0;return!1}function re(t,l){const e=n.ref();let a=[];const s=C.createEventHook(),f=C.createEventHook(),c=C.createEventHook(),i=C.createEventHook(),u=C.createEventHook(),p=n.ref(!1),w=n.ref(!1),y=n.ref(!1),R=n.ref(!1),g=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...l?.brush});n.watch(g,()=>{const v=e.value;v&&(v.brush=g.value,v.mode=g.value.mode)},{deep:!0});const I=()=>{var v;return(v=e.value)==null?void 0:v.undo()},O=()=>{var v;return(v=e.value)==null?void 0:v.redo()},d=()=>{var v;return(v=e.value)==null?void 0:v.clear()},S=()=>{var v;return(v=e.value)==null?void 0:v.cancel()},F=v=>{var P;return(P=e.value)==null?void 0:P.load(v)},m=()=>{var v;return(v=e.value)==null?void 0:v.dump()},N=()=>{var v;a.forEach(P=>P()),(v=e.value)==null||v.unmount()},U=()=>{e.value&&(p.value=e.value.canUndo(),w.value=e.value.canRedo(),y.value=e.value.altPressed,R.value=e.value.shiftPressed)};return n.watch(()=>C.unrefElement(t),v=>{!v||typeof SVGSVGElement>"u"||!(v instanceof SVGSVGElement)||(e.value&&N(),e.value=k.createDrauu({el:v,...l}),U(),a=[e.value.on("canceled",()=>f.trigger()),e.value.on("committed",P=>c.trigger(P)),e.value.on("start",()=>i.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{U(),s.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>N()),{drauuInstance:e,load:F,dump:m,clear:d,cancel:S,undo:I,redo:O,canUndo:p,canRedo:w,brush:g,onChanged:s.on,onCommitted:c.on,onStart:i.on,onEnd:u.on,onCanceled:f.on}}function le(t,l={}){let e;const{immediate:a,...s}=l,f=n.ref(!1),c=n.ref(!1),i=y=>e&&e.activate(y),u=y=>e&&e.deactivate(y),p=()=>{e&&(e.pause(),c.value=!0)},w=()=>{e&&(e.unpause(),c.value=!1)};return n.watch(()=>C.unrefElement(t),y=>{y&&(e=B.createFocusTrap(y,{...s,onActivate(){f.value=!0,l.onActivate&&l.onActivate()},onDeactivate(){f.value=!1,l.onDeactivate&&l.onDeactivate()}}),a&&i())},{flush:"post"}),C.tryOnScopeDispose(()=>u()),{hasFocus:f,isPaused:c,activate:i,deactivate:u,pause:p,unpause:w}}function se(t,l,e){const a=()=>{var c,i;return new G((c=o.toValue(l))!=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(l),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(l).map((u,p)=>({item:u,refIndex:p}));const i=c?.resultLimit;return s.value.search(o.toValue(t),i?{limit:i}:void 0)});return{fuse:s,results:f}}function ue(t,l,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),p=(f?n.shallowRef:n.ref)(l),w=o.toValue(l);async function y(){try{const d=await b.get(t);d===void 0?w!=null&&i&&await b.set(t,w):p.value=d}catch(d){c(d)}u.value=!0}y();async function R(){try{p.value==null?await b.del(t):Array.isArray(p.value)?await b.update(t,()=>JSON.parse(JSON.stringify(p.value))):typeof p.value=="object"?await b.update(t,()=>({...p.value})):await b.update(t,()=>p.value)}catch(d){c(d)}}const{pause:g,resume:I}=C.watchPausable(p,()=>R(),{flush:a,deep:s});async function O(d){g(),p.value=d,await R(),I()}return{set:O,isFinished:u,data:p}}function ce(t,l={}){const{onError:e,fallbackValue:a=null}=l,s=(i,u)=>{try{return L(i,u)}catch(p){return e?.(p),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,l){const e=n.ref(t),a=n.computed({set:f=>f?_.start():_.done(),get:()=>typeof e.value=="number"&&e.value<1});l&&_.configure(l);const s=_.set;return _.set=f=>(e.value=f,s.call(_,f)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&s.call(_,e.value)}),o.tryOnScopeDispose(_.remove),{isLoading:a,progress:e,start:_.start,done:_.done,remove:()=>{e.value=null,_.remove()}}}function fe(t,l){const e=o.toRef(t),a=n.ref("");return n.watch(e,async s=>{e.value&&o.isClient&&(a.value=await V.toDataURL(s,l))},{immediate:!0}),a}function de(t,l,e={}){let a;const{document:s=C.defaultDocument,...f}=e,c={onUpdate:w=>{M(l,w.oldIndex,w.newIndex)}},i=()=>{const w=typeof t=="string"?s?.querySelector(t):C.unrefElement(t);!w||a!==void 0||(a=new $(w,{...c,...f}))},u=()=>{a?.destroy(),a=void 0},p=(w,y)=>{if(y!==void 0)a?.option(w,y);else return a?.option(w)};return C.tryOnMounted(i),C.tryOnScopeDispose(u),{stop:u,start:i,option:p}}function M(t,l,e){const a=n.isRef(t),s=a?[...C.toValue(t)]:C.toValue(t);if(e>=0&&e<s.length){const f=s.splice(l,1)[0];n.nextTick(()=>{s.splice(e,0,f),a&&(t.value=s)})}}r.createCookies=oe,r.moveArrayElement=M,r.useAsyncValidator=ee,r.useAxios=te,r.useChangeCase=ne,r.useCookies=z,r.useDrauu=re,r.useFocusTrap=le,r.useFuse=se,r.useIDBKeyval=ue,r.useJwt=ce,r.useNProgress=ie,r.useQRCode=fe,r.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(r,o,T){if(r.install)return r;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(o.version.slice(0,4)==="2.7."){let p=function(A,k){var h,G={},N={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(E,L){return G[E]=L,this},directive:function(E,L){return L?(o.directive(E,L),N):o.directive(E)},mount:function(E,L){return h||(h=new o(Object.assign({propsData:k},A,{provide:Object.assign(G,A.provide)})),h.$mount(E,L),h)},unmount:function(){h&&(h.$destroy(),h=void 0)}};return N};var j=p;for(var n in o)r[n]=o[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.warn=o.util.warn,r.hasInjectionContext=function(){return!!r.getCurrentInstance()},r.createApp=p}else if(o.version.slice(0,2)==="2.")if(T){for(var n in T)r[n]=T[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.hasInjectionContext=function(){return!!r.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)r[n]=o[n];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=o,r.Vue2=void 0,r.version=o.version,r.set=function(p,A,k){return Array.isArray(p)?(p.length=Math.max(p.length,A),p.splice(A,1,k),k):(p[A]=k,k)},r.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 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,o,T,n,j,p,A,k,h,G,N,E,L,_,V,$){"use strict";const D=T.default||T;function ee(t,l,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(l))),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],()=>R(),{immediate:s,deep:!0});const S={isFinished:u,pass:C,errors:w,errorInfo:i,errorFields:y,execute:R};function F(){return new Promise((d,g)=>{o.until(u).toBe(!0).then(()=>d(S)).catch(O=>g(O))})}return{...S,then(d,g){return F().then(d,g)}}}function te(...t){const l=typeof t[0]=="string"?t[0]:void 0,e=typeof l=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let s={},f=j,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:R=!1}=c,S=n.shallowRef(),F=(C?n.shallowRef:n.ref)(u),d=n.ref(!1),g=n.ref(!1),O=n.ref(!1),m=n.shallowRef(),B=j.CancelToken.source;let U=B();const v=b=>{d.value||!g.value||(U.cancel(b),U=B(),O.value=!0,g.value=!1,d.value=!1)},P=b=>{g.value=b,d.value=!b},ve=()=>{R&&(F.value=u)},J=()=>new Promise((b,W)=>{o.until(d).toBe(!0).then(()=>m.value?W(m.value):b(X))}),Q={then:(...b)=>J().then(...b),catch:(...b)=>J().catch(...b)};let x=0;const K=(b=l,W={})=>{m.value=void 0;const Y=typeof b=="string"?b:l??W.url;if(Y===void 0)return m.value=new j.AxiosError(j.AxiosError.ERR_INVALID_URL),d.value=!0,Q;ve(),c.abortPrevious!==!1&&v(),P(!0),x+=1;const pe=x;return O.value=!1,f(Y,{...s,...typeof b=="object"?b:W,cancelToken:U.token}).then(H=>{if(O.value)return;S.value=H;const Z=H.data;F.value=Z,w(Z)}).catch(H=>{m.value=H,y(H)}).finally(()=>{var H;(H=c.onFinish)==null||H.call(c),pe===x&&P(!1)}),Q};I&&l&&K();const X={response:S,data:F,error:m,isFinished:d,isLoading:g,cancel:v,isAborted:O,isCanceled:O,abort:v,execute:K};return{...X,...Q}}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,l,e){if(typeof t=="function")return n.computed(()=>z[l](o.toValue(t),e));const a=n.ref(t);return n.computed({get(){return z[l](a.value,e)},set(s){a.value=s}})}function oe(t){const l=new A(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:s=!1}={})=>M(e,{doNotParse:a,autoUpdateDependencies:s},l)}function M(t,{doNotParse:l=!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:l,...u[1]})),getAll:(...u)=>(c.value,a.getAll({doNotParse:l,...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,l,e){if(!t)return!0;for(const a of t)if(l[a]!==e[a])return!0;return!1}function re(t,l){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),R=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...l?.brush});n.watch(R,()=>{const v=e.value;v&&(v.brush=R.value,v.mode=R.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()},g=()=>{var v;return(v=e.value)==null?void 0:v.cancel()},O=v=>{var P;return(P=e.value)==null?void 0:P.load(v)},m=()=>{var v;return(v=e.value)==null?void 0:v.dump()},B=()=>{var v;a.forEach(P=>P()),(v=e.value)==null||v.unmount()},U=()=>{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&&B(),e.value=k.createDrauu({el:v,...l}),U(),a=[e.value.on("canceled",()=>f.trigger()),e.value.on("committed",P=>c.trigger(P)),e.value.on("start",()=>i.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{U(),s.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>B()),{drauuInstance:e,load:O,dump:m,clear:d,cancel:g,undo:S,redo:F,canUndo:C,canRedo:w,brush:R,onChanged:s.on,onCommitted:c.on,onStart:i.on,onEnd:u.on,onCanceled:f.on}}function le(t,l={}){let e;const{immediate:a,...s}=l,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,l.onActivate&&l.onActivate()},onDeactivate(){f.value=!1,l.onDeactivate&&l.onDeactivate()}}),a&&i())},{flush:"post"}),h.tryOnScopeDispose(()=>u()),{hasFocus:f,isPaused:c,activate:i,deactivate:u,pause:C,unpause:w}}function se(t,l,e){const a=()=>{var c,i;return new N((c=o.toValue(l))!=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(l),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(l).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,l,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)(l),w=o.toValue(l);async function y(){try{const d=await E.get(t);d===void 0?w!=null&&i&&await E.set(t,w):C.value=d}catch(d){c(d)}u.value=!0}y();async function I(){try{C.value==null?await E.del(t):await E.update(t,()=>n.toRaw(C.value))}catch(d){c(d)}}const{pause:R,resume:S}=h.watchPausable(C,()=>I(),{flush:a,deep:s});async function F(d){R(),C.value=d,await I(),S()}return{set:F,isFinished:u,data:C}}function ce(t,l={}){const{onError:e,fallbackValue:a=null}=l,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,l){const e=n.ref(t),a=n.computed({set:f=>f?_.start():_.done(),get:()=>typeof e.value=="number"&&e.value<1});l&&_.configure(l);const s=_.set;return _.set=f=>(e.value=f,s.call(_,f)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&s.call(_,e.value)}),o.tryOnScopeDispose(_.remove),{isLoading:a,progress:e,start:_.start,done:_.done,remove:()=>{e.value=null,_.remove()}}}function fe(t,l){const e=o.toRef(t),a=n.ref("");return n.watch(e,async s=>{e.value&&o.isClient&&(a.value=await V.toDataURL(s,l))},{immediate:!0}),a}function de(t,l,e={}){let a;const{document:s=h.defaultDocument,...f}=e,c={onUpdate:w=>{q(l,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,l,e){const a=n.isRef(t),s=a?[...h.toValue(t)]:h.toValue(t);if(e>=0&&e<s.length){const f=s.splice(l,1)[0];n.nextTick(()=>{s.splice(e,0,f),a&&(t.value=s)})}}r.createCookies=oe,r.moveArrayElement=q,r.useAsyncValidator=ee,r.useAxios=te,r.useChangeCase=ne,r.useCookies=M,r.useDrauu=re,r.useFocusTrap=le,r.useFuse=se,r.useIDBKeyval=ue,r.useJwt=ce,r.useNProgress=ie,r.useQRCode=fe,r.useSortable=de})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toRef, toValue, until, noop, tryOnScopeDispose, isClient } from '@vueuse/shared';
|
|
2
2
|
import Schema from 'async-validator';
|
|
3
|
-
import { shallowRef, ref, computed, watch, watchEffect, isRef, nextTick } from 'vue-demi';
|
|
3
|
+
import { shallowRef, ref, computed, watch, toRaw, watchEffect, isRef, 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';
|
|
@@ -516,12 +516,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
516
516
|
if (data.value == null) {
|
|
517
517
|
await del(key);
|
|
518
518
|
} else {
|
|
519
|
-
|
|
520
|
-
await update(key, () => JSON.parse(JSON.stringify(data.value)));
|
|
521
|
-
else if (typeof data.value === "object")
|
|
522
|
-
await update(key, () => ({ ...data.value }));
|
|
523
|
-
else
|
|
524
|
-
await update(key, () => data.value);
|
|
519
|
+
await update(key, () => toRaw(data.value));
|
|
525
520
|
}
|
|
526
521
|
} catch (e) {
|
|
527
522
|
onError(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/integrations",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.9.0",
|
|
4
4
|
"description": "Integration wrappers for utility libraries",
|
|
5
5
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
"dependencies": {
|
|
148
|
-
"@vueuse/core": "10.
|
|
149
|
-
"@vueuse/shared": "10.
|
|
148
|
+
"@vueuse/core": "10.9.0",
|
|
149
|
+
"@vueuse/shared": "10.9.0",
|
|
150
150
|
"vue-demi": ">=0.14.7"
|
|
151
151
|
},
|
|
152
152
|
"devDependencies": {
|
package/useIDBKeyval.cjs
CHANGED
|
@@ -38,12 +38,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
38
38
|
if (data.value == null) {
|
|
39
39
|
await idbKeyval.del(key);
|
|
40
40
|
} else {
|
|
41
|
-
|
|
42
|
-
await idbKeyval.update(key, () => JSON.parse(JSON.stringify(data.value)));
|
|
43
|
-
else if (typeof data.value === "object")
|
|
44
|
-
await idbKeyval.update(key, () => ({ ...data.value }));
|
|
45
|
-
else
|
|
46
|
-
await idbKeyval.update(key, () => data.value);
|
|
41
|
+
await idbKeyval.update(key, () => vueDemi.toRaw(data.value));
|
|
47
42
|
}
|
|
48
43
|
} catch (e) {
|
|
49
44
|
onError(e);
|
package/useIDBKeyval.iife.js
CHANGED
|
@@ -154,12 +154,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
154
154
|
if (data.value == null) {
|
|
155
155
|
await idbKeyval.del(key);
|
|
156
156
|
} else {
|
|
157
|
-
|
|
158
|
-
await idbKeyval.update(key, () => JSON.parse(JSON.stringify(data.value)));
|
|
159
|
-
else if (typeof data.value === "object")
|
|
160
|
-
await idbKeyval.update(key, () => ({ ...data.value }));
|
|
161
|
-
else
|
|
162
|
-
await idbKeyval.update(key, () => data.value);
|
|
157
|
+
await idbKeyval.update(key, () => vueDemi.toRaw(data.value));
|
|
163
158
|
}
|
|
164
159
|
} catch (e) {
|
|
165
160
|
onError(e);
|
package/useIDBKeyval.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(n,t,
|
|
1
|
+
var VueDemi=function(n,t,u){if(n.install)return n;if(!t)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(t.version.slice(0,4)==="2.7."){let r=function(s,a){var o,v={},p={config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),provide:function(f,c){return v[f]=c,this},directive:function(f,c){return c?(t.directive(f,c),p):t.directive(f)},mount:function(f,c){return o||(o=new t(Object.assign({propsData:a},s,{provide:Object.assign(v,s.provide)})),o.$mount(f,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return p};var d=r;for(var e in t)n[e]=t[e];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=t,n.Vue2=t,n.version=t.version,n.warn=t.util.warn,n.hasInjectionContext=function(){return!!n.getCurrentInstance()},n.createApp=r}else if(t.version.slice(0,2)==="2.")if(u){for(var e in u)n[e]=u[e];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=t,n.Vue2=t,n.version=t.version,n.hasInjectionContext=function(){return!!n.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(t.version.slice(0,2)==="3."){for(var e in t)n[e]=t[e];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=t,n.Vue2=void 0,n.version=t.version,n.set=function(r,s,a){return Array.isArray(r)?(r.length=Math.max(r.length,s),r.splice(s,1,a),a):(r[s]=a,a)},n.del=function(r,s){if(Array.isArray(r)){r.splice(s,1);return}delete r[s]}}else console.error("[vue-demi] Vue version "+t.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,t,u,e,d){"use strict";function r(s,a,o={}){const{flush:v="pre",deep:p=!0,shallow:f=!1,onError:c=i=>{console.error(i)},writeDefaults:b=!0}=o,w=e.ref(!1),l=(f?e.shallowRef:e.ref)(a),h=t.toValue(a);async function y(){try{const i=await d.get(s);i===void 0?h!=null&&b&&await d.set(s,h):l.value=i}catch(i){c(i)}w.value=!0}y();async function I(){try{l.value==null?await d.del(s):await d.update(s,()=>e.toRaw(l.value))}catch(i){c(i)}}const{pause:A,resume:x}=u.watchPausable(l,()=>I(),{flush:v,deep:p});async function C(i){A(),l.value=i,await I(),x()}return{set:C,isFinished:w,data:l}}n.useIDBKeyval=r})(this.VueUse=this.VueUse||{},VueUse,VueUse,VueDemi,idbKeyval);
|
package/useIDBKeyval.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toValue } from '@vueuse/shared';
|
|
2
2
|
import { watchPausable } from '@vueuse/core';
|
|
3
|
-
import { ref, shallowRef } from 'vue-demi';
|
|
3
|
+
import { ref, shallowRef, toRaw } from 'vue-demi';
|
|
4
4
|
import { get, set, del, update } from 'idb-keyval';
|
|
5
5
|
|
|
6
6
|
function useIDBKeyval(key, initialValue, options = {}) {
|
|
@@ -36,12 +36,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
|
|
|
36
36
|
if (data.value == null) {
|
|
37
37
|
await del(key);
|
|
38
38
|
} else {
|
|
39
|
-
|
|
40
|
-
await update(key, () => JSON.parse(JSON.stringify(data.value)));
|
|
41
|
-
else if (typeof data.value === "object")
|
|
42
|
-
await update(key, () => ({ ...data.value }));
|
|
43
|
-
else
|
|
44
|
-
await update(key, () => data.value);
|
|
39
|
+
await update(key, () => toRaw(data.value));
|
|
45
40
|
}
|
|
46
41
|
} catch (e) {
|
|
47
42
|
onError(e);
|