@vueuse/integrations 10.5.0 → 10.6.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 CHANGED
@@ -160,6 +160,8 @@ function useAxios(...args) {
160
160
  executeCounter += 1;
161
161
  const currentExecuteCounter = executeCounter;
162
162
  instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
163
+ if (isAborted.value)
164
+ return;
163
165
  response.value = r;
164
166
  const result2 = r.data;
165
167
  data.value = result2;
@@ -615,11 +617,14 @@ function useSortable(el, list, options = {}) {
615
617
  };
616
618
  const start = () => {
617
619
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
618
- if (!target)
620
+ if (!target || sortable !== void 0)
619
621
  return;
620
622
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
621
623
  };
622
- const stop = () => sortable == null ? void 0 : sortable.destroy();
624
+ const stop = () => {
625
+ sortable == null ? void 0 : sortable.destroy();
626
+ sortable = void 0;
627
+ };
623
628
  const option = (name, value) => {
624
629
  if (value !== void 0)
625
630
  sortable == null ? void 0 : sortable.option(name, value);
package/index.iife.js CHANGED
@@ -261,6 +261,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
261
261
  executeCounter += 1;
262
262
  const currentExecuteCounter = executeCounter;
263
263
  instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
264
+ if (isAborted.value)
265
+ return;
264
266
  response.value = r;
265
267
  const result2 = r.data;
266
268
  data.value = result2;
@@ -716,11 +718,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
716
718
  };
717
719
  const start = () => {
718
720
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
719
- if (!target)
721
+ if (!target || sortable !== void 0)
720
722
  return;
721
723
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
722
724
  };
723
- const stop = () => sortable == null ? void 0 : sortable.destroy();
725
+ const stop = () => {
726
+ sortable == null ? void 0 : sortable.destroy();
727
+ sortable = void 0;
728
+ };
724
729
  const option = (name, value) => {
725
730
  if (value !== void 0)
726
731
  sortable == null ? void 0 : sortable.option(name, value);
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- var VueDemi=function(l,o,H){if(l.install)return l;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),l;if(o.version.slice(0,4)==="2.7."){let h=function(b,P){var C,N={},B={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(E,k){return N[E]=k,this},directive:function(E,k){return k?(o.directive(E,k),B):o.directive(E)},mount:function(E,k){return C||(C=new o(Object.assign({propsData:P},b,{provide:Object.assign(N,b.provide)})),C.$mount(E,k),C)},unmount:function(){C&&(C.$destroy(),C=void 0)}};return B};var j=h;for(var n in o)l[n]=o[n];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.warn=o.util.warn,l.hasInjectionContext=()=>!!l.getCurrentInstance(),l.createApp=h}else if(o.version.slice(0,2)==="2.")if(H){for(var n in H)l[n]=H[n];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.hasInjectionContext=()=>!!l.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var n in o)l[n]=o[n];l.isVue2=!1,l.isVue3=!0,l.install=function(){},l.Vue=o,l.Vue2=void 0,l.version=o.version,l.set=function(h,b,P){return Array.isArray(h)?(h.length=Math.max(h.length,b),h.splice(b,1,P),P):(h[b]=P,P)},l.del=function(h,b){if(Array.isArray(h)){h.splice(b,1);return}delete h[b]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return l}(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(l,o,H,n,j,h,b,P,C,N,B,E,k,S,V,$){"use strict";const D=H.default||H;function ee(t,r,e={}){const{validateOption:a={},immediate:s=!0,manual:i=!1}=e,c=o.toRef(t),f=n.shallowRef(null),u=n.ref(!0),p=n.ref(!s||i),w=n.computed(()=>{var v;return((v=f.value)==null?void 0:v.errors)||[]}),y=n.computed(()=>{var v;return((v=f.value)==null?void 0:v.fields)||{}}),O=n.computed(()=>new D(o.toValue(r))),_=async()=>{u.value=!1,p.value=!1;try{await O.value.validate(c.value,a),p.value=!0,f.value=null}catch(v){f.value=v}finally{u.value=!0}return{pass:p.value,errorInfo:f.value,errors:w.value,errorFields:y.value}};i||n.watch([c,O],()=>_(),{immediate:s,deep:!0});const R={isFinished:u,pass:p,errors:w,errorInfo:f,errorFields:y,execute:_};function g(){return new Promise((v,F)=>{o.until(u).toBe(!0).then(()=>v(R)).catch(I=>F(I))})}return{...R,then(v,F){return g().then(v,F)}}}function te(...t){const r=typeof t[0]=="string"?t[0]:void 0,e=typeof r=="string"?1:0;let a={},s=j,i={immediate:!!e,shallow:!0};const c=A=>!!A?.request;t.length>0+e&&(c(t[0+e])?s=t[0+e]:a=t[0+e]),t.length>1+e&&c(t[1+e])&&(s=t[1+e]),(t.length===2+e&&!c(t[1+e])||t.length===3+e)&&(i=t[t.length-1]);const{initialData:f,shallow:u,onSuccess:p=o.noop,onError:w=o.noop,immediate:y,resetOnExecute:O=!1}=i,_=n.shallowRef(),R=(u?n.shallowRef:n.ref)(f),g=n.ref(!1),v=n.ref(!1),F=n.ref(!1),I=n.shallowRef(),G=j.CancelToken.source;let T=G();const U=A=>{g.value||!v.value||(T.cancel(A),T=G(),F.value=!0,v.value=!1,g.value=!1)},d=A=>{v.value=A,g.value=!A},L=()=>{O&&(R.value=f)},q=()=>new Promise((A,W)=>{o.until(g).toBe(!0).then(()=>I.value?W(I.value):A(Y))}),J={then:(...A)=>q().then(...A),catch:(...A)=>q().catch(...A)};let Q=0;const X=(A=r,W={})=>{I.value=void 0;const Z=typeof A=="string"?A:r??W.url;if(Z===void 0)return I.value=new j.AxiosError(j.AxiosError.ERR_INVALID_URL),g.value=!0,J;L(),U(),d(!0),Q+=1;const ve=Q;return s(Z,{...a,...typeof A=="object"?A:W,cancelToken:T.token}).then(m=>{_.value=m;const K=m.data;R.value=K,p(K)}).catch(m=>{I.value=m,w(m)}).finally(()=>{var m;(m=i.onFinish)==null||m.call(i),ve===Q&&d(!1)}),J};y&&r&&X();const Y={response:_,data:R,error:I,isFinished:g,isLoading:v,cancel:U,isAborted:F,isCanceled:F,abort:U,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,r,e){if(typeof t=="function")return n.computed(()=>x[r](o.toValue(t),e));const a=n.ref(t);return n.computed({get(){return x[r](a.value,e)},set(s){a.value=s}})}function oe(t){const r=new b(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:s=!1}={})=>z(e,{doNotParse:a,autoUpdateDependencies:s},r)}function z(t,{doNotParse:r=!1,autoUpdateDependencies:e=!1}={},a=new b){const s=e?[...t||[]]:t;let i=a.getAll({doNotParse:!0});const c=n.ref(0),f=()=>{const u=a.getAll({doNotParse:!0});ae(s||null,u,i)&&c.value++,i=u};return a.addChangeListener(f),o.tryOnScopeDispose(()=>{a.removeChangeListener(f)}),{get:(...u)=>(e&&s&&!s.includes(u[0])&&s.push(u[0]),c.value,a.get(u[0],{doNotParse:r,...u[1]})),getAll:(...u)=>(c.value,a.getAll({doNotParse:r,...u[0]})),set:(...u)=>a.set(...u),remove:(...u)=>a.remove(...u),addChangeListener:(...u)=>a.addChangeListener(...u),removeChangeListener:(...u)=>a.removeChangeListener(...u)}}function ae(t,r,e){if(!t)return!0;for(const a of t)if(r[a]!==e[a])return!0;return!1}function le(t,r){const e=n.ref();let a=[];const s=C.createEventHook(),i=C.createEventHook(),c=C.createEventHook(),f=C.createEventHook(),u=C.createEventHook(),p=n.ref(!1),w=n.ref(!1),y=n.ref(!1),O=n.ref(!1),_=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...r?.brush});n.watch(_,()=>{const d=e.value;d&&(d.brush=_.value,d.mode=_.value.mode)},{deep:!0});const R=()=>{var d;return(d=e.value)==null?void 0:d.undo()},g=()=>{var d;return(d=e.value)==null?void 0:d.redo()},v=()=>{var d;return(d=e.value)==null?void 0:d.clear()},F=()=>{var d;return(d=e.value)==null?void 0:d.cancel()},I=d=>{var L;return(L=e.value)==null?void 0:L.load(d)},G=()=>{var d;return(d=e.value)==null?void 0:d.dump()},T=()=>{var d;a.forEach(L=>L()),(d=e.value)==null||d.unmount()},U=()=>{e.value&&(p.value=e.value.canUndo(),w.value=e.value.canRedo(),y.value=e.value.altPressed,O.value=e.value.shiftPressed)};return n.watch(()=>C.unrefElement(t),d=>{!d||typeof SVGSVGElement>"u"||!(d instanceof SVGSVGElement)||(e.value&&T(),e.value=P.createDrauu({el:d,...r}),U(),a=[e.value.on("canceled",()=>i.trigger()),e.value.on("committed",L=>c.trigger(L)),e.value.on("start",()=>f.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{U(),s.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>T()),{drauuInstance:e,load:I,dump:G,clear:v,cancel:F,undo:R,redo:g,canUndo:p,canRedo:w,brush:_,onChanged:s.on,onCommitted:c.on,onStart:f.on,onEnd:u.on,onCanceled:i.on}}function re(t,r={}){let e;const{immediate:a,...s}=r,i=n.ref(!1),c=n.ref(!1),f=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=N.createFocusTrap(y,{...s,onActivate(){i.value=!0,r.onActivate&&r.onActivate()},onDeactivate(){i.value=!1,r.onDeactivate&&r.onDeactivate()}}),a&&f())},{flush:"post"}),C.tryOnScopeDispose(()=>u()),{hasFocus:i,isPaused:c,activate:f,deactivate:u,pause:p,unpause:w}}function se(t,r,e){const a=()=>{var c,f;return new B((c=o.toValue(r))!=null?c:[],(f=o.toValue(e))==null?void 0:f.fuseOptions)},s=n.ref(a());n.watch(()=>{var c;return(c=o.toValue(e))==null?void 0:c.fuseOptions},()=>{s.value=a()},{deep:!0}),n.watch(()=>o.toValue(r),c=>{s.value.setCollection(c)},{deep:!0});const i=n.computed(()=>{const c=o.toValue(e);if(c?.matchAllWhenSearchEmpty&&!o.toValue(t))return o.toValue(r).map((u,p)=>({item:u,refIndex:p}));const f=c?.resultLimit;return s.value.search(o.toValue(t),f?{limit:f}:void 0)});return{fuse:s,results:i}}function ue(t,r,e={}){const{flush:a="pre",deep:s=!0,shallow:i=!1,onError:c=v=>{console.error(v)},writeDefaults:f=!0}=e,u=n.ref(!1),p=(i?n.shallowRef:n.ref)(r),w=o.toValue(r);async function y(){try{const v=await E.get(t);v===void 0?w!=null&&f&&await E.set(t,w):p.value=v}catch(v){c(v)}u.value=!0}y();async function O(){try{p.value==null?await E.del(t):Array.isArray(p.value)?await E.update(t,()=>JSON.parse(JSON.stringify(p.value))):typeof p.value=="object"?await E.update(t,()=>({...p.value})):await E.update(t,()=>p.value)}catch(v){c(v)}}const{pause:_,resume:R}=C.watchPausable(p,()=>O(),{flush:a,deep:s});async function g(v){_(),p.value=v,await O(),R()}return{set:g,isFinished:u,data:p}}function ce(t,r={}){const{onError:e,fallbackValue:a=null}=r,s=(f,u)=>{try{return k(f,u)}catch(p){return e?.(p),a}},i=n.computed(()=>s(o.toValue(t),{header:!0})),c=n.computed(()=>s(o.toValue(t)));return{header:i,payload:c}}function ie(t=null,r){const e=n.ref(t),a=n.computed({set:i=>i?S.start():S.done(),get:()=>typeof e.value=="number"&&e.value<1});r&&S.configure(r);const s=S.set;return S.set=i=>(e.value=i,s.call(S,i)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&s.call(S,e.value)}),o.tryOnScopeDispose(S.remove),{isLoading:a,progress:e,start:S.start,done:S.done,remove:()=>{e.value=null,S.remove()}}}function fe(t,r){const e=o.toRef(t),a=n.ref("");return n.watch(e,async s=>{e.value&&o.isClient&&(a.value=await V.toDataURL(s,r))},{immediate:!0}),a}function de(t,r,e={}){let a;const{document:s=C.defaultDocument,...i}=e,c={onUpdate:w=>{M(r,w.oldIndex,w.newIndex)}},f=()=>{const w=typeof t=="string"?s?.querySelector(t):C.unrefElement(t);w&&(a=new $(w,{...c,...i}))},u=()=>a?.destroy(),p=(w,y)=>{if(y!==void 0)a?.option(w,y);else return a?.option(w)};return C.tryOnMounted(f),C.tryOnScopeDispose(u),{stop:u,start:f,option:p}}function M(t,r,e){const a=n.isRef(t),s=a?[...C.toValue(t)]:C.toValue(t);if(e>=0&&e<s.length){const i=s.splice(r,1)[0];n.nextTick(()=>{s.splice(e,0,i),a&&(t.value=s)})}}l.createCookies=oe,l.moveArrayElement=M,l.useAsyncValidator=ee,l.useAxios=te,l.useChangeCase=ne,l.useCookies=z,l.useDrauu=le,l.useFocusTrap=re,l.useFuse=se,l.useIDBKeyval=ue,l.useJwt=ce,l.useNProgress=ie,l.useQRCode=fe,l.useSortable=de})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
1
+ var VueDemi=function(r,o,H){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(b,P){var C,N={},B={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(E,k){return N[E]=k,this},directive:function(E,k){return k?(o.directive(E,k),B):o.directive(E)},mount:function(E,k){return C||(C=new o(Object.assign({propsData:P},b,{provide:Object.assign(N,b.provide)})),C.$mount(E,k),C)},unmount:function(){C&&(C.$destroy(),C=void 0)}};return B};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=()=>!!r.getCurrentInstance(),r.createApp=h}else if(o.version.slice(0,2)==="2.")if(H){for(var n in H)r[n]=H[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.hasInjectionContext=()=>!!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,b,P){return Array.isArray(h)?(h.length=Math.max(h.length,b),h.splice(b,1,P),P):(h[b]=P,P)},r.del=function(h,b){if(Array.isArray(h)){h.splice(b,1);return}delete h[b]}}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,H,n,j,h,b,P,C,N,B,E,k,S,V,$){"use strict";const D=H.default||H;function ee(t,l,e={}){const{validateOption:a={},immediate:s=!0,manual:i=!1}=e,c=o.toRef(t),f=n.shallowRef(null),u=n.ref(!0),p=n.ref(!s||i),w=n.computed(()=>{var v;return((v=f.value)==null?void 0:v.errors)||[]}),y=n.computed(()=>{var v;return((v=f.value)==null?void 0:v.fields)||{}}),F=n.computed(()=>new D(o.toValue(l))),_=async()=>{u.value=!1,p.value=!1;try{await F.value.validate(c.value,a),p.value=!0,f.value=null}catch(v){f.value=v}finally{u.value=!0}return{pass:p.value,errorInfo:f.value,errors:w.value,errorFields:y.value}};i||n.watch([c,F],()=>_(),{immediate:s,deep:!0});const R={isFinished:u,pass:p,errors:w,errorInfo:f,errorFields:y,execute:_};function g(){return new Promise((v,I)=>{o.until(u).toBe(!0).then(()=>v(R)).catch(O=>I(O))})}return{...R,then(v,I){return g().then(v,I)}}}function te(...t){const l=typeof t[0]=="string"?t[0]:void 0,e=typeof l=="string"?1:0;let a={},s=j,i={immediate:!!e,shallow:!0};const c=A=>!!A?.request;t.length>0+e&&(c(t[0+e])?s=t[0+e]:a=t[0+e]),t.length>1+e&&c(t[1+e])&&(s=t[1+e]),(t.length===2+e&&!c(t[1+e])||t.length===3+e)&&(i=t[t.length-1]);const{initialData:f,shallow:u,onSuccess:p=o.noop,onError:w=o.noop,immediate:y,resetOnExecute:F=!1}=i,_=n.shallowRef(),R=(u?n.shallowRef:n.ref)(f),g=n.ref(!1),v=n.ref(!1),I=n.ref(!1),O=n.shallowRef(),G=j.CancelToken.source;let T=G();const U=A=>{g.value||!v.value||(T.cancel(A),T=G(),I.value=!0,v.value=!1,g.value=!1)},d=A=>{v.value=A,g.value=!A},L=()=>{F&&(R.value=f)},q=()=>new Promise((A,W)=>{o.until(g).toBe(!0).then(()=>O.value?W(O.value):A(Y))}),J={then:(...A)=>q().then(...A),catch:(...A)=>q().catch(...A)};let Q=0;const X=(A=l,W={})=>{O.value=void 0;const Z=typeof A=="string"?A:l??W.url;if(Z===void 0)return O.value=new j.AxiosError(j.AxiosError.ERR_INVALID_URL),g.value=!0,J;L(),U(),d(!0),Q+=1;const ve=Q;return s(Z,{...a,...typeof A=="object"?A:W,cancelToken:T.token}).then(m=>{if(I.value)return;_.value=m;const K=m.data;R.value=K,p(K)}).catch(m=>{O.value=m,w(m)}).finally(()=>{var m;(m=i.onFinish)==null||m.call(i),ve===Q&&d(!1)}),J};y&&l&&X();const Y={response:_,data:R,error:O,isFinished:g,isLoading:v,cancel:U,isAborted:I,isCanceled:I,abort:U,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 b(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 b){const s=e?[...t||[]]:t;let i=a.getAll({doNotParse:!0});const c=n.ref(0),f=()=>{const u=a.getAll({doNotParse:!0});ae(s||null,u,i)&&c.value++,i=u};return a.addChangeListener(f),o.tryOnScopeDispose(()=>{a.removeChangeListener(f)}),{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(),i=C.createEventHook(),c=C.createEventHook(),f=C.createEventHook(),u=C.createEventHook(),p=n.ref(!1),w=n.ref(!1),y=n.ref(!1),F=n.ref(!1),_=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...l?.brush});n.watch(_,()=>{const d=e.value;d&&(d.brush=_.value,d.mode=_.value.mode)},{deep:!0});const R=()=>{var d;return(d=e.value)==null?void 0:d.undo()},g=()=>{var d;return(d=e.value)==null?void 0:d.redo()},v=()=>{var d;return(d=e.value)==null?void 0:d.clear()},I=()=>{var d;return(d=e.value)==null?void 0:d.cancel()},O=d=>{var L;return(L=e.value)==null?void 0:L.load(d)},G=()=>{var d;return(d=e.value)==null?void 0:d.dump()},T=()=>{var d;a.forEach(L=>L()),(d=e.value)==null||d.unmount()},U=()=>{e.value&&(p.value=e.value.canUndo(),w.value=e.value.canRedo(),y.value=e.value.altPressed,F.value=e.value.shiftPressed)};return n.watch(()=>C.unrefElement(t),d=>{!d||typeof SVGSVGElement>"u"||!(d instanceof SVGSVGElement)||(e.value&&T(),e.value=P.createDrauu({el:d,...l}),U(),a=[e.value.on("canceled",()=>i.trigger()),e.value.on("committed",L=>c.trigger(L)),e.value.on("start",()=>f.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{U(),s.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>T()),{drauuInstance:e,load:O,dump:G,clear:v,cancel:I,undo:R,redo:g,canUndo:p,canRedo:w,brush:_,onChanged:s.on,onCommitted:c.on,onStart:f.on,onEnd:u.on,onCanceled:i.on}}function le(t,l={}){let e;const{immediate:a,...s}=l,i=n.ref(!1),c=n.ref(!1),f=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=N.createFocusTrap(y,{...s,onActivate(){i.value=!0,l.onActivate&&l.onActivate()},onDeactivate(){i.value=!1,l.onDeactivate&&l.onDeactivate()}}),a&&f())},{flush:"post"}),C.tryOnScopeDispose(()=>u()),{hasFocus:i,isPaused:c,activate:f,deactivate:u,pause:p,unpause:w}}function se(t,l,e){const a=()=>{var c,f;return new B((c=o.toValue(l))!=null?c:[],(f=o.toValue(e))==null?void 0:f.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 i=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 f=c?.resultLimit;return s.value.search(o.toValue(t),f?{limit:f}:void 0)});return{fuse:s,results:i}}function ue(t,l,e={}){const{flush:a="pre",deep:s=!0,shallow:i=!1,onError:c=v=>{console.error(v)},writeDefaults:f=!0}=e,u=n.ref(!1),p=(i?n.shallowRef:n.ref)(l),w=o.toValue(l);async function y(){try{const v=await E.get(t);v===void 0?w!=null&&f&&await E.set(t,w):p.value=v}catch(v){c(v)}u.value=!0}y();async function F(){try{p.value==null?await E.del(t):Array.isArray(p.value)?await E.update(t,()=>JSON.parse(JSON.stringify(p.value))):typeof p.value=="object"?await E.update(t,()=>({...p.value})):await E.update(t,()=>p.value)}catch(v){c(v)}}const{pause:_,resume:R}=C.watchPausable(p,()=>F(),{flush:a,deep:s});async function g(v){_(),p.value=v,await F(),R()}return{set:g,isFinished:u,data:p}}function ce(t,l={}){const{onError:e,fallbackValue:a=null}=l,s=(f,u)=>{try{return k(f,u)}catch(p){return e?.(p),a}},i=n.computed(()=>s(o.toValue(t),{header:!0})),c=n.computed(()=>s(o.toValue(t)));return{header:i,payload:c}}function ie(t=null,l){const e=n.ref(t),a=n.computed({set:i=>i?S.start():S.done(),get:()=>typeof e.value=="number"&&e.value<1});l&&S.configure(l);const s=S.set;return S.set=i=>(e.value=i,s.call(S,i)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&s.call(S,e.value)}),o.tryOnScopeDispose(S.remove),{isLoading:a,progress:e,start:S.start,done:S.done,remove:()=>{e.value=null,S.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,...i}=e,c={onUpdate:w=>{M(l,w.oldIndex,w.newIndex)}},f=()=>{const w=typeof t=="string"?s?.querySelector(t):C.unrefElement(t);!w||a!==void 0||(a=new $(w,{...c,...i}))},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(f),C.tryOnScopeDispose(u),{stop:u,start:f,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 i=s.splice(l,1)[0];n.nextTick(()=>{s.splice(e,0,i),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);
package/index.mjs CHANGED
@@ -158,6 +158,8 @@ function useAxios(...args) {
158
158
  executeCounter += 1;
159
159
  const currentExecuteCounter = executeCounter;
160
160
  instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
161
+ if (isAborted.value)
162
+ return;
161
163
  response.value = r;
162
164
  const result2 = r.data;
163
165
  data.value = result2;
@@ -613,11 +615,14 @@ function useSortable(el, list, options = {}) {
613
615
  };
614
616
  const start = () => {
615
617
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
616
- if (!target)
618
+ if (!target || sortable !== void 0)
617
619
  return;
618
620
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
619
621
  };
620
- const stop = () => sortable == null ? void 0 : sortable.destroy();
622
+ const stop = () => {
623
+ sortable == null ? void 0 : sortable.destroy();
624
+ sortable = void 0;
625
+ };
621
626
  const option = (name, value) => {
622
627
  if (value !== void 0)
623
628
  sortable == null ? void 0 : sortable.option(name, value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/integrations",
3
- "version": "10.5.0",
3
+ "version": "10.6.0",
4
4
  "description": "Integration wrappers for utility libraries",
5
5
  "author": "Anthony Fu <https://github.com/antfu>",
6
6
  "license": "MIT",
@@ -145,19 +145,19 @@
145
145
  }
146
146
  },
147
147
  "dependencies": {
148
- "@vueuse/core": "10.5.0",
149
- "@vueuse/shared": "10.5.0",
148
+ "@vueuse/core": "10.6.0",
149
+ "@vueuse/shared": "10.6.0",
150
150
  "vue-demi": ">=0.14.6"
151
151
  },
152
152
  "devDependencies": {
153
- "@types/nprogress": "^0.2.1",
154
- "@types/qrcode": "^1.5.2",
155
- "@types/sortablejs": "^1.15.3",
153
+ "@types/nprogress": "^0.2.3",
154
+ "@types/qrcode": "^1.5.5",
155
+ "@types/sortablejs": "^1.15.5",
156
156
  "async-validator": "^4.2.5",
157
- "axios": "^1.5.1",
157
+ "axios": "^1.6.1",
158
158
  "change-case": "^4.1.2",
159
159
  "drauu": "^0.3.7",
160
- "focus-trap": "^7.5.3",
160
+ "focus-trap": "^7.5.4",
161
161
  "fuse.js": "^6.6.2",
162
162
  "idb-keyval": "^6.2.1",
163
163
  "jwt-decode": "^3.1.2",
package/useAxios.cjs CHANGED
@@ -81,6 +81,8 @@ function useAxios(...args) {
81
81
  executeCounter += 1;
82
82
  const currentExecuteCounter = executeCounter;
83
83
  instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
84
+ if (isAborted.value)
85
+ return;
84
86
  response.value = r;
85
87
  const result2 = r.data;
86
88
  data.value = result2;
package/useAxios.iife.js CHANGED
@@ -194,6 +194,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
194
194
  executeCounter += 1;
195
195
  const currentExecuteCounter = executeCounter;
196
196
  instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
197
+ if (isAborted.value)
198
+ return;
197
199
  response.value = r;
198
200
  const result2 = r.data;
199
201
  data.value = result2;
@@ -1 +1 @@
1
- var VueDemi=function(e,n,u){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 t=function(i,o){var l,v={},d={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(c,f){return v[c]=f,this},directive:function(c,f){return f?(n.directive(c,f),d):n.directive(c)},mount:function(c,f){return l||(l=new n(Object.assign({propsData:o},i,{provide:Object.assign(v,i.provide)})),l.$mount(c,f),l)},unmount:function(){l&&(l.$destroy(),l=void 0)}};return d};var R=t;for(var r in n)e[r]=n[r];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.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=t}else if(n.version.slice(0,2)==="2.")if(u){for(var r in u)e[r]=u[r];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var r in n)e[r]=n[r];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(t,i,o){return Array.isArray(t)?(t.length=Math.max(t.length,i),t.splice(i,1,o),o):(t[i]=o,o)},e.del=function(t,i){if(Array.isArray(t)){t.splice(i,1);return}delete t[i]}}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,u,r){"use strict";function R(...t){const i=typeof t[0]=="string"?t[0]:void 0,o=typeof i=="string"?1:0;let l={},v=r,d={immediate:!!o,shallow:!0};const c=s=>!!s?.request;t.length>0+o&&(c(t[0+o])?v=t[0+o]:l=t[0+o]),t.length>1+o&&c(t[1+o])&&(v=t[1+o]),(t.length===2+o&&!c(t[1+o])||t.length===3+o)&&(d=t[t.length-1]);const{initialData:f,shallow:S,onSuccess:U=u.noop,onError:$=u.noop,immediate:q,resetOnExecute:B=!1}=d,j=n.shallowRef(),w=(S?n.shallowRef:n.ref)(f),p=n.ref(!1),A=n.ref(!1),y=n.ref(!1),h=n.shallowRef(),P=r.CancelToken.source;let C=P();const x=s=>{p.value||!A.value||(C.cancel(s),C=P(),y.value=!0,A.value=!1,p.value=!1)},T=s=>{A.value=s,p.value=!s},M=()=>{B&&(w.value=f)},_=()=>new Promise((s,b)=>{u.until(p).toBe(!0).then(()=>h.value?b(h.value):s(F))}),I={then:(...s)=>_().then(...s),catch:(...s)=>_().catch(...s)};let E=0;const k=(s=i,b={})=>{h.value=void 0;const L=typeof s=="string"?s:i??b.url;if(L===void 0)return h.value=new r.AxiosError(r.AxiosError.ERR_INVALID_URL),p.value=!0,I;M(),x(),T(!0),E+=1;const N=E;return v(L,{...l,...typeof s=="object"?s:b,cancelToken:C.token}).then(a=>{j.value=a;const O=a.data;w.value=O,U(O)}).catch(a=>{h.value=a,$(a)}).finally(()=>{var a;(a=d.onFinish)==null||a.call(d),N===E&&T(!1)}),I};q&&i&&k();const F={response:j,data:w,error:h,isFinished:p,isLoading:A,cancel:x,isAborted:y,isCanceled:y,abort:x,execute:k};return{...F,...I}}e.useAxios=R})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
1
+ var VueDemi=function(e,n,u){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 t=function(i,o){var l,v={},d={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(c,f){return v[c]=f,this},directive:function(c,f){return f?(n.directive(c,f),d):n.directive(c)},mount:function(c,f){return l||(l=new n(Object.assign({propsData:o},i,{provide:Object.assign(v,i.provide)})),l.$mount(c,f),l)},unmount:function(){l&&(l.$destroy(),l=void 0)}};return d};var R=t;for(var r in n)e[r]=n[r];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.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=t}else if(n.version.slice(0,2)==="2.")if(u){for(var r in u)e[r]=u[r];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var r in n)e[r]=n[r];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(t,i,o){return Array.isArray(t)?(t.length=Math.max(t.length,i),t.splice(i,1,o),o):(t[i]=o,o)},e.del=function(t,i){if(Array.isArray(t)){t.splice(i,1);return}delete t[i]}}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,u,r){"use strict";function R(...t){const i=typeof t[0]=="string"?t[0]:void 0,o=typeof i=="string"?1:0;let l={},v=r,d={immediate:!!o,shallow:!0};const c=s=>!!s?.request;t.length>0+o&&(c(t[0+o])?v=t[0+o]:l=t[0+o]),t.length>1+o&&c(t[1+o])&&(v=t[1+o]),(t.length===2+o&&!c(t[1+o])||t.length===3+o)&&(d=t[t.length-1]);const{initialData:f,shallow:S,onSuccess:U=u.noop,onError:$=u.noop,immediate:q,resetOnExecute:B=!1}=d,j=n.shallowRef(),y=(S?n.shallowRef:n.ref)(f),p=n.ref(!1),A=n.ref(!1),b=n.ref(!1),h=n.shallowRef(),P=r.CancelToken.source;let C=P();const x=s=>{p.value||!A.value||(C.cancel(s),C=P(),b.value=!0,A.value=!1,p.value=!1)},T=s=>{A.value=s,p.value=!s},M=()=>{B&&(y.value=f)},_=()=>new Promise((s,w)=>{u.until(p).toBe(!0).then(()=>h.value?w(h.value):s(F))}),I={then:(...s)=>_().then(...s),catch:(...s)=>_().catch(...s)};let E=0;const k=(s=i,w={})=>{h.value=void 0;const L=typeof s=="string"?s:i??w.url;if(L===void 0)return h.value=new r.AxiosError(r.AxiosError.ERR_INVALID_URL),p.value=!0,I;M(),x(),T(!0),E+=1;const N=E;return v(L,{...l,...typeof s=="object"?s:w,cancelToken:C.token}).then(a=>{if(b.value)return;j.value=a;const O=a.data;y.value=O,U(O)}).catch(a=>{h.value=a,$(a)}).finally(()=>{var a;(a=d.onFinish)==null||a.call(d),N===E&&T(!1)}),I};q&&i&&k();const F={response:j,data:y,error:h,isFinished:p,isLoading:A,cancel:x,isAborted:b,isCanceled:b,abort:x,execute:k};return{...F,...I}}e.useAxios=R})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
package/useAxios.mjs CHANGED
@@ -79,6 +79,8 @@ function useAxios(...args) {
79
79
  executeCounter += 1;
80
80
  const currentExecuteCounter = executeCounter;
81
81
  instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
82
+ if (isAborted.value)
83
+ return;
82
84
  response.value = r;
83
85
  const result2 = r.data;
84
86
  data.value = result2;
@@ -14,11 +14,14 @@ function useSortable(el, list, options = {}) {
14
14
  };
15
15
  const start = () => {
16
16
  const target = typeof el === "string" ? document?.querySelector(el) : core.unrefElement(el);
17
- if (!target)
17
+ if (!target || sortable !== void 0)
18
18
  return;
19
19
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
20
20
  };
21
- const stop = () => sortable?.destroy();
21
+ const stop = () => {
22
+ sortable?.destroy();
23
+ sortable = void 0;
24
+ };
22
25
  const option = (name, value) => {
23
26
  if (value !== void 0)
24
27
  sortable?.option(name, value);
@@ -12,11 +12,14 @@ function useSortable(el, list, options = {}) {
12
12
  };
13
13
  const start = () => {
14
14
  const target = typeof el === "string" ? document?.querySelector(el) : unrefElement(el);
15
- if (!target)
15
+ if (!target || sortable !== void 0)
16
16
  return;
17
17
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
18
18
  };
19
- const stop = () => sortable?.destroy();
19
+ const stop = () => {
20
+ sortable?.destroy();
21
+ sortable = void 0;
22
+ };
20
23
  const option = (name, value) => {
21
24
  if (value !== void 0)
22
25
  sortable?.option(name, value);
package/useSortable.cjs CHANGED
@@ -14,11 +14,14 @@ function useSortable(el, list, options = {}) {
14
14
  };
15
15
  const start = () => {
16
16
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
17
- if (!target)
17
+ if (!target || sortable !== void 0)
18
18
  return;
19
19
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
20
20
  };
21
- const stop = () => sortable == null ? void 0 : sortable.destroy();
21
+ const stop = () => {
22
+ sortable == null ? void 0 : sortable.destroy();
23
+ sortable = void 0;
24
+ };
22
25
  const option = (name, value) => {
23
26
  if (value !== void 0)
24
27
  sortable == null ? void 0 : sortable.option(name, value);
@@ -127,11 +127,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
127
127
  };
128
128
  const start = () => {
129
129
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
130
- if (!target)
130
+ if (!target || sortable !== void 0)
131
131
  return;
132
132
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
133
133
  };
134
- const stop = () => sortable == null ? void 0 : sortable.destroy();
134
+ const stop = () => {
135
+ sortable == null ? void 0 : sortable.destroy();
136
+ sortable = void 0;
137
+ };
135
138
  const option = (name, value) => {
136
139
  if (value !== void 0)
137
140
  sortable == null ? void 0 : sortable.option(name, value);
@@ -1 +1 @@
1
- var VueDemi=function(n,t,a){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 e=function(o,f){var r,i={},l={config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),provide:function(c,d){return i[c]=d,this},directive:function(c,d){return d?(t.directive(c,d),l):t.directive(c)},mount:function(c,d){return r||(r=new t(Object.assign({propsData:f},o,{provide:Object.assign(i,o.provide)})),r.$mount(c,d),r)},unmount:function(){r&&(r.$destroy(),r=void 0)}};return l};var p=e;for(var s in t)n[s]=t[s];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=()=>!!n.getCurrentInstance(),n.createApp=e}else if(t.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=t,n.Vue2=t,n.version=t.version,n.hasInjectionContext=()=>!!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 s in t)n[s]=t[s];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=t,n.Vue2=void 0,n.version=t.version,n.set=function(e,o,f){return Array.isArray(e)?(e.length=Math.max(e.length,o),e.splice(o,1,f),f):(e[o]=f,f)},n.del=function(e,o){if(Array.isArray(e)){e.splice(o,1);return}delete e[o]}}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,a,s){"use strict";function p(o,f,r={}){let i;const{document:l=t.defaultDocument,...c}=r,d={onUpdate:u=>{e(f,u.oldIndex,u.newIndex)}},v=()=>{const u=typeof o=="string"?l?.querySelector(o):t.unrefElement(o);u&&(i=new a(u,{...d,...c}))},y=()=>i?.destroy(),h=(u,b)=>{if(b!==void 0)i?.option(u,b);else return i?.option(u)};return t.tryOnMounted(v),t.tryOnScopeDispose(y),{stop:y,start:v,option:h}}function e(o,f,r){const i=s.isRef(o),l=i?[...t.toValue(o)]:t.toValue(o);if(r>=0&&r<l.length){const c=l.splice(f,1)[0];s.nextTick(()=>{l.splice(r,0,c),i&&(o.value=l)})}}n.moveArrayElement=e,n.useSortable=p})(this.VueUse=this.VueUse||{},VueUse,Sortable,VueDemi);
1
+ var VueDemi=function(n,t,a){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 e=function(o,f){var i,r={},l={config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),provide:function(c,d){return r[c]=d,this},directive:function(c,d){return d?(t.directive(c,d),l):t.directive(c)},mount:function(c,d){return i||(i=new t(Object.assign({propsData:f},o,{provide:Object.assign(r,o.provide)})),i.$mount(c,d),i)},unmount:function(){i&&(i.$destroy(),i=void 0)}};return l};var v=e;for(var s in t)n[s]=t[s];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=()=>!!n.getCurrentInstance(),n.createApp=e}else if(t.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=t,n.Vue2=t,n.version=t.version,n.hasInjectionContext=()=>!!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 s in t)n[s]=t[s];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=t,n.Vue2=void 0,n.version=t.version,n.set=function(e,o,f){return Array.isArray(e)?(e.length=Math.max(e.length,o),e.splice(o,1,f),f):(e[o]=f,f)},n.del=function(e,o){if(Array.isArray(e)){e.splice(o,1);return}delete e[o]}}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,a,s){"use strict";function v(o,f,i={}){let r;const{document:l=t.defaultDocument,...c}=i,d={onUpdate:u=>{e(f,u.oldIndex,u.newIndex)}},p=()=>{const u=typeof o=="string"?l?.querySelector(o):t.unrefElement(o);!u||r!==void 0||(r=new a(u,{...d,...c}))},y=()=>{r?.destroy(),r=void 0},h=(u,b)=>{if(b!==void 0)r?.option(u,b);else return r?.option(u)};return t.tryOnMounted(p),t.tryOnScopeDispose(y),{stop:y,start:p,option:h}}function e(o,f,i){const r=s.isRef(o),l=r?[...t.toValue(o)]:t.toValue(o);if(i>=0&&i<l.length){const c=l.splice(f,1)[0];s.nextTick(()=>{l.splice(i,0,c),r&&(o.value=l)})}}n.moveArrayElement=e,n.useSortable=v})(this.VueUse=this.VueUse||{},VueUse,Sortable,VueDemi);
package/useSortable.mjs CHANGED
@@ -12,11 +12,14 @@ function useSortable(el, list, options = {}) {
12
12
  };
13
13
  const start = () => {
14
14
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
15
- if (!target)
15
+ if (!target || sortable !== void 0)
16
16
  return;
17
17
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
18
18
  };
19
- const stop = () => sortable == null ? void 0 : sortable.destroy();
19
+ const stop = () => {
20
+ sortable == null ? void 0 : sortable.destroy();
21
+ sortable = void 0;
22
+ };
20
23
  const option = (name, value) => {
21
24
  if (value !== void 0)
22
25
  sortable == null ? void 0 : sortable.option(name, value);