@vueuse/integrations 10.4.1 → 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;
@@ -298,7 +300,8 @@ function useDrauu(target, options) {
298
300
  cornerRadius: 0,
299
301
  dasharray: void 0,
300
302
  fill: "transparent",
301
- mode: "draw"
303
+ mode: "draw",
304
+ ...options == null ? void 0 : options.brush
302
305
  });
303
306
  vueDemi.watch(brush, () => {
304
307
  const instance = drauuInstance.value;
@@ -614,11 +617,14 @@ function useSortable(el, list, options = {}) {
614
617
  };
615
618
  const start = () => {
616
619
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
617
- if (!target)
620
+ if (!target || sortable !== void 0)
618
621
  return;
619
622
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
620
623
  };
621
- const stop = () => sortable == null ? void 0 : sortable.destroy();
624
+ const stop = () => {
625
+ sortable == null ? void 0 : sortable.destroy();
626
+ sortable = void 0;
627
+ };
622
628
  const option = (name, value) => {
623
629
  if (value !== void 0)
624
630
  sortable == null ? void 0 : sortable.option(name, value);
package/index.d.cts CHANGED
@@ -170,7 +170,7 @@ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCase
170
170
 
171
171
  /**
172
172
  * Creates a new {@link useCookies} function
173
- * @param {Object} req - incoming http request (for SSR)
173
+ * @param req - incoming http request (for SSR)
174
174
  * @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
175
175
  * @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
176
176
  */
@@ -193,11 +193,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
193
193
  };
194
194
  /**
195
195
  * Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
196
- * @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
197
- * @param {Object} options
198
- * @param {boolean} options.doNotParse - don't try parse value as JSON
199
- * @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
200
- * @param {Object} cookies - universal-cookie instance
196
+ * @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
197
+ * @param options
198
+ * @param options.doNotParse - don't try parse value as JSON
199
+ * @param options.autoUpdateDependencies - automatically update watching dependencies
200
+ * @param cookies - universal-cookie instance
201
201
  */
202
202
  declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
203
203
  doNotParse?: boolean | undefined;
@@ -290,9 +290,6 @@ interface UseFocusTrapReturn {
290
290
  * Reactive focus-trap
291
291
  *
292
292
  * @see https://vueuse.org/useFocusTrap
293
- * @param target The target element to trap focus within
294
- * @param options Focus trap options
295
- * @param autoFocus Focus trap automatically when mounted
296
293
  */
297
294
  declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
298
295
 
@@ -374,7 +371,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
374
371
  * Reactive decoded jwt token.
375
372
  *
376
373
  * @see https://vueuse.org/useJwt
377
- * @param jwt
378
374
  */
379
375
  declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
380
376
 
package/index.d.mts CHANGED
@@ -170,7 +170,7 @@ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCase
170
170
 
171
171
  /**
172
172
  * Creates a new {@link useCookies} function
173
- * @param {Object} req - incoming http request (for SSR)
173
+ * @param req - incoming http request (for SSR)
174
174
  * @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
175
175
  * @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
176
176
  */
@@ -193,11 +193,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
193
193
  };
194
194
  /**
195
195
  * Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
196
- * @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
197
- * @param {Object} options
198
- * @param {boolean} options.doNotParse - don't try parse value as JSON
199
- * @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
200
- * @param {Object} cookies - universal-cookie instance
196
+ * @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
197
+ * @param options
198
+ * @param options.doNotParse - don't try parse value as JSON
199
+ * @param options.autoUpdateDependencies - automatically update watching dependencies
200
+ * @param cookies - universal-cookie instance
201
201
  */
202
202
  declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
203
203
  doNotParse?: boolean | undefined;
@@ -290,9 +290,6 @@ interface UseFocusTrapReturn {
290
290
  * Reactive focus-trap
291
291
  *
292
292
  * @see https://vueuse.org/useFocusTrap
293
- * @param target The target element to trap focus within
294
- * @param options Focus trap options
295
- * @param autoFocus Focus trap automatically when mounted
296
293
  */
297
294
  declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
298
295
 
@@ -374,7 +371,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
374
371
  * Reactive decoded jwt token.
375
372
  *
376
373
  * @see https://vueuse.org/useJwt
377
- * @param jwt
378
374
  */
379
375
  declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
380
376
 
package/index.d.ts CHANGED
@@ -170,7 +170,7 @@ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCase
170
170
 
171
171
  /**
172
172
  * Creates a new {@link useCookies} function
173
- * @param {Object} req - incoming http request (for SSR)
173
+ * @param req - incoming http request (for SSR)
174
174
  * @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
175
175
  * @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
176
176
  */
@@ -193,11 +193,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
193
193
  };
194
194
  /**
195
195
  * Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
196
- * @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
197
- * @param {Object} options
198
- * @param {boolean} options.doNotParse - don't try parse value as JSON
199
- * @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
200
- * @param {Object} cookies - universal-cookie instance
196
+ * @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
197
+ * @param options
198
+ * @param options.doNotParse - don't try parse value as JSON
199
+ * @param options.autoUpdateDependencies - automatically update watching dependencies
200
+ * @param cookies - universal-cookie instance
201
201
  */
202
202
  declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
203
203
  doNotParse?: boolean | undefined;
@@ -290,9 +290,6 @@ interface UseFocusTrapReturn {
290
290
  * Reactive focus-trap
291
291
  *
292
292
  * @see https://vueuse.org/useFocusTrap
293
- * @param target The target element to trap focus within
294
- * @param options Focus trap options
295
- * @param autoFocus Focus trap automatically when mounted
296
293
  */
297
294
  declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
298
295
 
@@ -374,7 +371,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
374
371
  * Reactive decoded jwt token.
375
372
  *
376
373
  * @see https://vueuse.org/useJwt
377
- * @param jwt
378
374
  */
379
375
  declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
380
376
 
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;
@@ -399,7 +401,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
399
401
  cornerRadius: 0,
400
402
  dasharray: void 0,
401
403
  fill: "transparent",
402
- mode: "draw"
404
+ mode: "draw",
405
+ ...options == null ? void 0 : options.brush
403
406
  });
404
407
  vueDemi.watch(brush, () => {
405
408
  const instance = drauuInstance.value;
@@ -715,11 +718,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
715
718
  };
716
719
  const start = () => {
717
720
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
718
- if (!target)
721
+ if (!target || sortable !== void 0)
719
722
  return;
720
723
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
721
724
  };
722
- const stop = () => sortable == null ? void 0 : sortable.destroy();
725
+ const stop = () => {
726
+ sortable == null ? void 0 : sortable.destroy();
727
+ sortable = void 0;
728
+ };
723
729
  const option = (name, value) => {
724
730
  if (value !== void 0)
725
731
  sortable == null ? void 0 : sortable.option(name, value);
package/index.iife.min.js CHANGED
@@ -1 +1 @@
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)||{}}),O=n.computed(()=>new D(o.toValue(l))),_=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 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: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=l,W={})=>{I.value=void 0;const Z=typeof A=="string"?A:l??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&&l&&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,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),O=n.ref(!1),_=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});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,...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: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 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 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,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=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,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);
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;
@@ -296,7 +298,8 @@ function useDrauu(target, options) {
296
298
  cornerRadius: 0,
297
299
  dasharray: void 0,
298
300
  fill: "transparent",
299
- mode: "draw"
301
+ mode: "draw",
302
+ ...options == null ? void 0 : options.brush
300
303
  });
301
304
  watch(brush, () => {
302
305
  const instance = drauuInstance.value;
@@ -612,11 +615,14 @@ function useSortable(el, list, options = {}) {
612
615
  };
613
616
  const start = () => {
614
617
  const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
615
- if (!target)
618
+ if (!target || sortable !== void 0)
616
619
  return;
617
620
  sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
618
621
  };
619
- const stop = () => sortable == null ? void 0 : sortable.destroy();
622
+ const stop = () => {
623
+ sortable == null ? void 0 : sortable.destroy();
624
+ sortable = void 0;
625
+ };
620
626
  const option = (name, value) => {
621
627
  if (value !== void 0)
622
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.4.1",
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,25 +145,25 @@
145
145
  }
146
146
  },
147
147
  "dependencies": {
148
- "@vueuse/core": "10.4.1",
149
- "@vueuse/shared": "10.4.1",
150
- "vue-demi": ">=0.14.5"
148
+ "@vueuse/core": "10.6.0",
149
+ "@vueuse/shared": "10.6.0",
150
+ "vue-demi": ">=0.14.6"
151
151
  },
152
152
  "devDependencies": {
153
- "@types/nprogress": "^0.2.0",
154
- "@types/qrcode": "^1.5.1",
155
- "@types/sortablejs": "^1.15.1",
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.4.0",
157
+ "axios": "^1.6.1",
158
158
  "change-case": "^4.1.2",
159
- "drauu": "^0.3.3",
160
- "focus-trap": "^7.5.2",
159
+ "drauu": "^0.3.7",
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",
164
164
  "nprogress": "^0.2.0",
165
165
  "qrcode": "^1.5.3",
166
166
  "sortablejs": "^1.15.0",
167
- "universal-cookie": "^6.1.0"
167
+ "universal-cookie": "^6.1.1"
168
168
  }
169
169
  }
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;
package/useCookies.d.cts CHANGED
@@ -4,7 +4,7 @@ import { IncomingMessage } from 'node:http';
4
4
 
5
5
  /**
6
6
  * Creates a new {@link useCookies} function
7
- * @param {Object} req - incoming http request (for SSR)
7
+ * @param req - incoming http request (for SSR)
8
8
  * @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
9
9
  * @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
10
10
  */
@@ -27,11 +27,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
27
27
  };
28
28
  /**
29
29
  * Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
30
- * @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
31
- * @param {Object} options
32
- * @param {boolean} options.doNotParse - don't try parse value as JSON
33
- * @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
34
- * @param {Object} cookies - universal-cookie instance
30
+ * @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
31
+ * @param options
32
+ * @param options.doNotParse - don't try parse value as JSON
33
+ * @param options.autoUpdateDependencies - automatically update watching dependencies
34
+ * @param cookies - universal-cookie instance
35
35
  */
36
36
  declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
37
37
  doNotParse?: boolean | undefined;
package/useCookies.d.mts CHANGED
@@ -4,7 +4,7 @@ import { IncomingMessage } from 'node:http';
4
4
 
5
5
  /**
6
6
  * Creates a new {@link useCookies} function
7
- * @param {Object} req - incoming http request (for SSR)
7
+ * @param req - incoming http request (for SSR)
8
8
  * @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
9
9
  * @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
10
10
  */
@@ -27,11 +27,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
27
27
  };
28
28
  /**
29
29
  * Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
30
- * @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
31
- * @param {Object} options
32
- * @param {boolean} options.doNotParse - don't try parse value as JSON
33
- * @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
34
- * @param {Object} cookies - universal-cookie instance
30
+ * @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
31
+ * @param options
32
+ * @param options.doNotParse - don't try parse value as JSON
33
+ * @param options.autoUpdateDependencies - automatically update watching dependencies
34
+ * @param cookies - universal-cookie instance
35
35
  */
36
36
  declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
37
37
  doNotParse?: boolean | undefined;
package/useCookies.d.ts CHANGED
@@ -4,7 +4,7 @@ import { IncomingMessage } from 'node:http';
4
4
 
5
5
  /**
6
6
  * Creates a new {@link useCookies} function
7
- * @param {Object} req - incoming http request (for SSR)
7
+ * @param req - incoming http request (for SSR)
8
8
  * @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
9
9
  * @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
10
10
  */
@@ -27,11 +27,11 @@ declare function createCookies(req?: IncomingMessage): (dependencies?: string[]
27
27
  };
28
28
  /**
29
29
  * Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
30
- * @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
31
- * @param {Object} options
32
- * @param {boolean} options.doNotParse - don't try parse value as JSON
33
- * @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
34
- * @param {Object} cookies - universal-cookie instance
30
+ * @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
31
+ * @param options
32
+ * @param options.doNotParse - don't try parse value as JSON
33
+ * @param options.autoUpdateDependencies - automatically update watching dependencies
34
+ * @param cookies - universal-cookie instance
35
35
  */
36
36
  declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
37
37
  doNotParse?: boolean | undefined;
package/useDrauu.cjs CHANGED
@@ -24,7 +24,8 @@ function useDrauu(target, options) {
24
24
  cornerRadius: 0,
25
25
  dasharray: void 0,
26
26
  fill: "transparent",
27
- mode: "draw"
27
+ mode: "draw",
28
+ ...options == null ? void 0 : options.brush
28
29
  });
29
30
  vueDemi.watch(brush, () => {
30
31
  const instance = drauuInstance.value;
package/useDrauu.iife.js CHANGED
@@ -136,7 +136,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
136
136
  cornerRadius: 0,
137
137
  dasharray: void 0,
138
138
  fill: "transparent",
139
- mode: "draw"
139
+ mode: "draw",
140
+ ...options == null ? void 0 : options.brush
140
141
  });
141
142
  vueDemi.watch(brush, () => {
142
143
  const instance = drauuInstance.value;
@@ -1 +1 @@
1
- var VueDemi=function(e,n,d){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let s=function(a,c){var o,f={},v={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(i,l){return f[i]=l,this},directive:function(i,l){return l?(n.directive(i,l),v):n.directive(i)},mount:function(i,l){return o||(o=new n(Object.assign({propsData:c},a,{provide:Object.assign(f,a.provide)})),o.$mount(i,l),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return v};var h=s;for(var t in n)e[t]=n[t];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=s}else if(n.version.slice(0,2)==="2.")if(d){for(var t in d)e[t]=d[t];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 t in n)e[t]=n[t];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(s,a,c){return Array.isArray(s)?(s.length=Math.max(s.length,a),s.splice(a,1,c),c):(s[a]=c,c)},e.del=function(s,a){if(Array.isArray(s)){s.splice(a,1);return}delete s[a]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,n,d,t,h){"use strict";function s(a,c){const o=n.ref();let f=[];const v=t.createEventHook(),i=t.createEventHook(),l=t.createEventHook(),g=t.createEventHook(),b=t.createEventHook(),E=n.ref(!1),C=n.ref(!1),k=n.ref(!1),S=n.ref(!1),p=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});n.watch(p,()=>{const r=o.value;r&&(r.brush=p.value,r.mode=p.value.mode)},{deep:!0});const w=()=>{var r;return(r=o.value)==null?void 0:r.undo()},A=()=>{var r;return(r=o.value)==null?void 0:r.redo()},I=()=>{var r;return(r=o.value)==null?void 0:r.clear()},_=()=>{var r;return(r=o.value)==null?void 0:r.cancel()},P=r=>{var u;return(u=o.value)==null?void 0:u.load(r)},U=()=>{var r;return(r=o.value)==null?void 0:r.dump()},y=()=>{var r;f.forEach(u=>u()),(r=o.value)==null||r.unmount()},H=()=>{o.value&&(E.value=o.value.canUndo(),C.value=o.value.canRedo(),k.value=o.value.altPressed,S.value=o.value.shiftPressed)};return n.watch(()=>t.unrefElement(a),r=>{!r||typeof SVGSVGElement>"u"||!(r instanceof SVGSVGElement)||(o.value&&y(),o.value=d.createDrauu({el:r,...c}),H(),f=[o.value.on("canceled",()=>i.trigger()),o.value.on("committed",u=>l.trigger(u)),o.value.on("start",()=>g.trigger()),o.value.on("end",()=>b.trigger()),o.value.on("changed",()=>{H(),v.trigger()})])},{flush:"post"}),h.tryOnScopeDispose(()=>y()),{drauuInstance:o,load:P,dump:U,clear:I,cancel:_,undo:w,redo:A,canUndo:E,canRedo:C,brush:p,onChanged:v.on,onCommitted:l.on,onStart:g.on,onEnd:b.on,onCanceled:i.on}}e.useDrauu=s})(this.VueUse=this.VueUse||{},VueDemi,Drauu,VueUse,VueUse);
1
+ var VueDemi=function(e,n,d){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let s=function(a,i){var o,f={},v={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(l,c){return f[l]=c,this},directive:function(l,c){return c?(n.directive(l,c),v):n.directive(l)},mount:function(l,c){return o||(o=new n(Object.assign({propsData:i},a,{provide:Object.assign(f,a.provide)})),o.$mount(l,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return v};var h=s;for(var t in n)e[t]=n[t];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=s}else if(n.version.slice(0,2)==="2.")if(d){for(var t in d)e[t]=d[t];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 t in n)e[t]=n[t];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(s,a,i){return Array.isArray(s)?(s.length=Math.max(s.length,a),s.splice(a,1,i),i):(s[a]=i,i)},e.del=function(s,a){if(Array.isArray(s)){s.splice(a,1);return}delete s[a]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,n,d,t,h){"use strict";function s(a,i){const o=n.ref();let f=[];const v=t.createEventHook(),l=t.createEventHook(),c=t.createEventHook(),g=t.createEventHook(),b=t.createEventHook(),E=n.ref(!1),C=n.ref(!1),k=n.ref(!1),S=n.ref(!1),p=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...i?.brush});n.watch(p,()=>{const r=o.value;r&&(r.brush=p.value,r.mode=p.value.mode)},{deep:!0});const w=()=>{var r;return(r=o.value)==null?void 0:r.undo()},A=()=>{var r;return(r=o.value)==null?void 0:r.redo()},I=()=>{var r;return(r=o.value)==null?void 0:r.clear()},_=()=>{var r;return(r=o.value)==null?void 0:r.cancel()},P=r=>{var u;return(u=o.value)==null?void 0:u.load(r)},U=()=>{var r;return(r=o.value)==null?void 0:r.dump()},y=()=>{var r;f.forEach(u=>u()),(r=o.value)==null||r.unmount()},H=()=>{o.value&&(E.value=o.value.canUndo(),C.value=o.value.canRedo(),k.value=o.value.altPressed,S.value=o.value.shiftPressed)};return n.watch(()=>t.unrefElement(a),r=>{!r||typeof SVGSVGElement>"u"||!(r instanceof SVGSVGElement)||(o.value&&y(),o.value=d.createDrauu({el:r,...i}),H(),f=[o.value.on("canceled",()=>l.trigger()),o.value.on("committed",u=>c.trigger(u)),o.value.on("start",()=>g.trigger()),o.value.on("end",()=>b.trigger()),o.value.on("changed",()=>{H(),v.trigger()})])},{flush:"post"}),h.tryOnScopeDispose(()=>y()),{drauuInstance:o,load:P,dump:U,clear:I,cancel:_,undo:w,redo:A,canUndo:E,canRedo:C,brush:p,onChanged:v.on,onCommitted:c.on,onStart:g.on,onEnd:b.on,onCanceled:l.on}}e.useDrauu=s})(this.VueUse=this.VueUse||{},VueDemi,Drauu,VueUse,VueUse);
package/useDrauu.mjs CHANGED
@@ -22,7 +22,8 @@ function useDrauu(target, options) {
22
22
  cornerRadius: 0,
23
23
  dasharray: void 0,
24
24
  fill: "transparent",
25
- mode: "draw"
25
+ mode: "draw",
26
+ ...options == null ? void 0 : options.brush
26
27
  });
27
28
  watch(brush, () => {
28
29
  const instance = drauuInstance.value;
@@ -48,9 +48,6 @@ interface UseFocusTrapReturn {
48
48
  * Reactive focus-trap
49
49
  *
50
50
  * @see https://vueuse.org/useFocusTrap
51
- * @param target The target element to trap focus within
52
- * @param options Focus trap options
53
- * @param autoFocus Focus trap automatically when mounted
54
51
  */
55
52
  declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
56
53
 
@@ -48,9 +48,6 @@ interface UseFocusTrapReturn {
48
48
  * Reactive focus-trap
49
49
  *
50
50
  * @see https://vueuse.org/useFocusTrap
51
- * @param target The target element to trap focus within
52
- * @param options Focus trap options
53
- * @param autoFocus Focus trap automatically when mounted
54
51
  */
55
52
  declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
56
53
 
package/useFocusTrap.d.ts CHANGED
@@ -48,9 +48,6 @@ interface UseFocusTrapReturn {
48
48
  * Reactive focus-trap
49
49
  *
50
50
  * @see https://vueuse.org/useFocusTrap
51
- * @param target The target element to trap focus within
52
- * @param options Focus trap options
53
- * @param autoFocus Focus trap automatically when mounted
54
51
  */
55
52
  declare function useFocusTrap(target: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
56
53
 
package/useJwt.d.cts CHANGED
@@ -22,7 +22,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
22
22
  * Reactive decoded jwt token.
23
23
  *
24
24
  * @see https://vueuse.org/useJwt
25
- * @param jwt
26
25
  */
27
26
  declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
28
27
 
package/useJwt.d.mts CHANGED
@@ -22,7 +22,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
22
22
  * Reactive decoded jwt token.
23
23
  *
24
24
  * @see https://vueuse.org/useJwt
25
- * @param jwt
26
25
  */
27
26
  declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
28
27
 
package/useJwt.d.ts CHANGED
@@ -22,7 +22,6 @@ interface UseJwtReturn<Payload, Header, Fallback> {
22
22
  * Reactive decoded jwt token.
23
23
  *
24
24
  * @see https://vueuse.org/useJwt
25
- * @param jwt
26
25
  */
27
26
  declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
28
27
 
@@ -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);