@vueuse/integrations 10.6.1 → 10.7.1
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/README.md +15 -15
- package/index.cjs +1 -0
- package/index.iife.js +1 -0
- package/index.iife.min.js +1 -1
- package/index.mjs +1 -0
- package/package.json +10 -10
- package/useAxios.cjs +1 -0
- package/useAxios.iife.js +1 -0
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +1 -0
package/README.md
CHANGED
|
@@ -6,27 +6,27 @@
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
npm i
|
|
11
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm i @vueuse/integrations
|
|
11
|
+
```
|
|
12
12
|
|
|
13
13
|
## Functions
|
|
14
14
|
|
|
15
15
|
<!--GENERATED LIST, DO NOT MODIFY MANUALLY-->
|
|
16
16
|
<!--FUNCTIONS_LIST_STARTS-->
|
|
17
|
-
- [`useAsyncValidator`](https://vueuse.org/integrations/useAsyncValidator/) — wrapper for [`async-validator`](https://github.com/yiminghe/async-validator)
|
|
18
|
-
- [`useAxios`](https://vueuse.org/integrations/useAxios/) — wrapper for [`axios`](https://github.com/axios/axios)
|
|
19
|
-
- [`useChangeCase`](https://vueuse.org/integrations/useChangeCase/) — reactive wrapper for [`change-case`](https://github.com/blakeembrey/change-case)
|
|
20
|
-
- [`useCookies`](https://vueuse.org/integrations/useCookies/) — wrapper for [`universal-cookie`](https://www.npmjs.com/package/universal-cookie)
|
|
21
|
-
- [`useDrauu`](https://vueuse.org/integrations/useDrauu/) — reactive instance for [drauu](https://github.com/antfu/drauu)
|
|
22
|
-
- [`useFocusTrap`](https://vueuse.org/integrations/useFocusTrap/) — reactive wrapper for [`focus-trap`](https://github.com/focus-trap/focus-trap)
|
|
23
|
-
- [`useFuse`](https://vueuse.org/integrations/useFuse/) — easily implement fuzzy search using a composable with [Fuse.js](https://github.com/krisk/fuse)
|
|
24
|
-
- [`useIDBKeyval`](https://vueuse.org/integrations/useIDBKeyval/) — wrapper for [`idb-keyval`](https://www.npmjs.com/package/idb-keyval)
|
|
25
|
-
- [`useJwt`](https://vueuse.org/integrations/useJwt/) — wrapper for [`jwt-decode`](https://github.com/auth0/jwt-decode)
|
|
26
|
-
- [`useNProgress`](https://vueuse.org/integrations/useNProgress/) — reactive wrapper for [`nprogress`](https://github.com/rstacruz/nprogress)
|
|
27
|
-
- [`useQRCode`](https://vueuse.org/integrations/useQRCode/) — wrapper for [`qrcode`](https://github.com/soldair/node-qrcode)
|
|
28
|
-
- [`useSortable`](https://vueuse.org/integrations/useSortable/) — wrapper for [`sortable`](https://github.com/SortableJS/Sortable)
|
|
29
17
|
|
|
18
|
+
- [`useAsyncValidator`](https://vueuse.org/integrations/useAsyncValidator/) — wrapper for [`async-validator`](https://github.com/yiminghe/async-validator)
|
|
19
|
+
- [`useAxios`](https://vueuse.org/integrations/useAxios/) — wrapper for [`axios`](https://github.com/axios/axios)
|
|
20
|
+
- [`useChangeCase`](https://vueuse.org/integrations/useChangeCase/) — reactive wrapper for [`change-case`](https://github.com/blakeembrey/change-case)
|
|
21
|
+
- [`useCookies`](https://vueuse.org/integrations/useCookies/) — wrapper for [`universal-cookie`](https://www.npmjs.com/package/universal-cookie)
|
|
22
|
+
- [`useDrauu`](https://vueuse.org/integrations/useDrauu/) — reactive instance for [drauu](https://github.com/antfu/drauu)
|
|
23
|
+
- [`useFocusTrap`](https://vueuse.org/integrations/useFocusTrap/) — reactive wrapper for [`focus-trap`](https://github.com/focus-trap/focus-trap)
|
|
24
|
+
- [`useFuse`](https://vueuse.org/integrations/useFuse/) — easily implement fuzzy search using a composable with [Fuse.js](https://github.com/krisk/fuse)
|
|
25
|
+
- [`useIDBKeyval`](https://vueuse.org/integrations/useIDBKeyval/) — wrapper for [`idb-keyval`](https://www.npmjs.com/package/idb-keyval)
|
|
26
|
+
- [`useJwt`](https://vueuse.org/integrations/useJwt/) — wrapper for [`jwt-decode`](https://github.com/auth0/jwt-decode)
|
|
27
|
+
- [`useNProgress`](https://vueuse.org/integrations/useNProgress/) — reactive wrapper for [`nprogress`](https://github.com/rstacruz/nprogress)
|
|
28
|
+
- [`useQRCode`](https://vueuse.org/integrations/useQRCode/) — wrapper for [`qrcode`](https://github.com/soldair/node-qrcode)
|
|
29
|
+
- [`useSortable`](https://vueuse.org/integrations/useSortable/) — wrapper for [`sortable`](https://github.com/SortableJS/Sortable)
|
|
30
30
|
|
|
31
31
|
<!--FUNCTIONS_LIST_ENDS-->
|
|
32
32
|
|
package/index.cjs
CHANGED
|
@@ -159,6 +159,7 @@ function useAxios(...args) {
|
|
|
159
159
|
loading(true);
|
|
160
160
|
executeCounter += 1;
|
|
161
161
|
const currentExecuteCounter = executeCounter;
|
|
162
|
+
isAborted.value = false;
|
|
162
163
|
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
163
164
|
if (isAborted.value)
|
|
164
165
|
return;
|
package/index.iife.js
CHANGED
|
@@ -260,6 +260,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
260
260
|
loading(true);
|
|
261
261
|
executeCounter += 1;
|
|
262
262
|
const currentExecuteCounter = executeCounter;
|
|
263
|
+
isAborted.value = false;
|
|
263
264
|
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
264
265
|
if (isAborted.value)
|
|
265
266
|
return;
|
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)||{}}),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);
|
|
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)||{}}),F=n.computed(()=>new D(o.toValue(r))),_=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 I={isFinished:u,pass:p,errors:w,errorInfo:f,errorFields:y,execute:_};function g(){return new Promise((v,R)=>{o.until(u).toBe(!0).then(()=>v(I)).catch(O=>R(O))})}return{...I,then(v,R){return g().then(v,R)}}}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:F=!1}=i,_=n.shallowRef(),I=(u?n.shallowRef:n.ref)(f),g=n.ref(!1),v=n.ref(!1),R=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(),R.value=!0,v.value=!1,g.value=!1)},d=A=>{v.value=A,g.value=!A},L=()=>{F&&(I.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=r,W={})=>{O.value=void 0;const Z=typeof A=="string"?A:r??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 R.value=!1,s(Z,{...a,...typeof A=="object"?A:W,cancelToken:T.token}).then(m=>{if(R.value)return;_.value=m;const K=m.data;I.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&&r&&X();const Y={response:_,data:I,error:O,isFinished:g,isLoading:v,cancel:U,isAborted:R,isCanceled:R,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),F=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 I=()=>{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()},R=()=>{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,...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:O,dump:G,clear:v,cancel:R,undo:I,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 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:I}=C.watchPausable(p,()=>F(),{flush:a,deep:s});async function g(v){_(),p.value=v,await F(),I()}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!==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,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);
|
package/index.mjs
CHANGED
|
@@ -157,6 +157,7 @@ function useAxios(...args) {
|
|
|
157
157
|
loading(true);
|
|
158
158
|
executeCounter += 1;
|
|
159
159
|
const currentExecuteCounter = executeCounter;
|
|
160
|
+
isAborted.value = false;
|
|
160
161
|
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
161
162
|
if (isAborted.value)
|
|
162
163
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/integrations",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.1",
|
|
4
4
|
"description": "Integration wrappers for utility libraries",
|
|
5
5
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
"universal-cookie": "*"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
|
-
"
|
|
110
|
+
"async-validator": {
|
|
111
111
|
"optional": true
|
|
112
112
|
},
|
|
113
|
-
"
|
|
113
|
+
"axios": {
|
|
114
114
|
"optional": true
|
|
115
115
|
},
|
|
116
116
|
"change-case": {
|
|
@@ -137,24 +137,24 @@
|
|
|
137
137
|
"qrcode": {
|
|
138
138
|
"optional": true
|
|
139
139
|
},
|
|
140
|
-
"
|
|
140
|
+
"sortablejs": {
|
|
141
141
|
"optional": true
|
|
142
142
|
},
|
|
143
|
-
"
|
|
143
|
+
"universal-cookie": {
|
|
144
144
|
"optional": true
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
"dependencies": {
|
|
148
|
-
"@vueuse/core": "10.
|
|
149
|
-
"@vueuse/shared": "10.
|
|
148
|
+
"@vueuse/core": "10.7.1",
|
|
149
|
+
"@vueuse/shared": "10.7.1",
|
|
150
150
|
"vue-demi": ">=0.14.6"
|
|
151
151
|
},
|
|
152
152
|
"devDependencies": {
|
|
153
153
|
"@types/nprogress": "^0.2.3",
|
|
154
154
|
"@types/qrcode": "^1.5.5",
|
|
155
|
-
"@types/sortablejs": "^1.15.
|
|
155
|
+
"@types/sortablejs": "^1.15.7",
|
|
156
156
|
"async-validator": "^4.2.5",
|
|
157
|
-
"axios": "^1.6.
|
|
157
|
+
"axios": "^1.6.3",
|
|
158
158
|
"change-case": "^4.1.2",
|
|
159
159
|
"drauu": "^0.3.7",
|
|
160
160
|
"focus-trap": "^7.5.4",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"jwt-decode": "^3.1.2",
|
|
164
164
|
"nprogress": "^0.2.0",
|
|
165
165
|
"qrcode": "^1.5.3",
|
|
166
|
-
"sortablejs": "^1.15.
|
|
166
|
+
"sortablejs": "^1.15.1",
|
|
167
167
|
"universal-cookie": "^6.1.1"
|
|
168
168
|
}
|
|
169
169
|
}
|
package/useAxios.cjs
CHANGED
|
@@ -80,6 +80,7 @@ function useAxios(...args) {
|
|
|
80
80
|
loading(true);
|
|
81
81
|
executeCounter += 1;
|
|
82
82
|
const currentExecuteCounter = executeCounter;
|
|
83
|
+
isAborted.value = false;
|
|
83
84
|
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
84
85
|
if (isAborted.value)
|
|
85
86
|
return;
|
package/useAxios.iife.js
CHANGED
|
@@ -193,6 +193,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
193
193
|
loading(true);
|
|
194
194
|
executeCounter += 1;
|
|
195
195
|
const currentExecuteCounter = executeCounter;
|
|
196
|
+
isAborted.value = false;
|
|
196
197
|
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
197
198
|
if (isAborted.value)
|
|
198
199
|
return;
|
package/useAxios.iife.min.js
CHANGED
|
@@ -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(),y=(S?n.shallowRef:n.ref)(f),p=n.ref(!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(),y=(S?n.shallowRef:n.ref)(f),p=n.ref(!1),b=n.ref(!1),A=n.ref(!1),h=n.shallowRef(),P=r.CancelToken.source;let C=P();const x=s=>{p.value||!b.value||(C.cancel(s),C=P(),A.value=!0,b.value=!1,p.value=!1)},T=s=>{b.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 A.value=!1,v(L,{...l,...typeof s=="object"?s:w,cancelToken:C.token}).then(a=>{if(A.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:b,cancel:x,isAborted:A,isCanceled:A,abort:x,execute:k};return{...F,...I}}e.useAxios=R})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
|
package/useAxios.mjs
CHANGED
|
@@ -78,6 +78,7 @@ function useAxios(...args) {
|
|
|
78
78
|
loading(true);
|
|
79
79
|
executeCounter += 1;
|
|
80
80
|
const currentExecuteCounter = executeCounter;
|
|
81
|
+
isAborted.value = false;
|
|
81
82
|
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
82
83
|
if (isAborted.value)
|
|
83
84
|
return;
|