@vueuse/integrations 10.9.0 → 10.10.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 +4 -5
- package/index.iife.js +4 -5
- package/index.iife.min.js +1 -1
- package/index.mjs +4 -5
- package/package.json +4 -4
- package/useAxios.cjs +4 -5
- package/useAxios.iife.js +4 -5
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +4 -5
package/index.cjs
CHANGED
|
@@ -121,13 +121,12 @@ function useAxios(...args) {
|
|
|
121
121
|
const isLoading = vueDemi.ref(false);
|
|
122
122
|
const isAborted = vueDemi.ref(false);
|
|
123
123
|
const error = vueDemi.shallowRef();
|
|
124
|
-
|
|
125
|
-
let cancelToken = cancelTokenSource();
|
|
124
|
+
let abortController = new AbortController();
|
|
126
125
|
const abort = (message) => {
|
|
127
126
|
if (isFinished.value || !isLoading.value)
|
|
128
127
|
return;
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
abortController.abort(message);
|
|
129
|
+
abortController = new AbortController();
|
|
131
130
|
isAborted.value = true;
|
|
132
131
|
isLoading.value = false;
|
|
133
132
|
isFinished.value = false;
|
|
@@ -163,7 +162,7 @@ function useAxios(...args) {
|
|
|
163
162
|
executeCounter += 1;
|
|
164
163
|
const currentExecuteCounter = executeCounter;
|
|
165
164
|
isAborted.value = false;
|
|
166
|
-
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config,
|
|
165
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
|
167
166
|
if (isAborted.value)
|
|
168
167
|
return;
|
|
169
168
|
response.value = r;
|
package/index.iife.js
CHANGED
|
@@ -226,13 +226,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
226
226
|
const isLoading = vueDemi.ref(false);
|
|
227
227
|
const isAborted = vueDemi.ref(false);
|
|
228
228
|
const error = vueDemi.shallowRef();
|
|
229
|
-
|
|
230
|
-
let cancelToken = cancelTokenSource();
|
|
229
|
+
let abortController = new AbortController();
|
|
231
230
|
const abort = (message) => {
|
|
232
231
|
if (isFinished.value || !isLoading.value)
|
|
233
232
|
return;
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
abortController.abort(message);
|
|
234
|
+
abortController = new AbortController();
|
|
236
235
|
isAborted.value = true;
|
|
237
236
|
isLoading.value = false;
|
|
238
237
|
isFinished.value = false;
|
|
@@ -268,7 +267,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
268
267
|
executeCounter += 1;
|
|
269
268
|
const currentExecuteCounter = executeCounter;
|
|
270
269
|
isAborted.value = false;
|
|
271
|
-
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config,
|
|
270
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
|
272
271
|
if (isAborted.value)
|
|
273
272
|
return;
|
|
274
273
|
response.value = r;
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(r,o,T){if(r.install)return r;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(o.version.slice(0,4)==="2.7."){let p=function(A,k){var h,G={},N={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(E,L){return G[E]=L,this},directive:function(E,L){return L?(o.directive(E,L),N):o.directive(E)},mount:function(E,L){return h||(h=new o(Object.assign({propsData:k},A,{provide:Object.assign(G,A.provide)})),h.$mount(E,L),h)},unmount:function(){h&&(h.$destroy(),h=void 0)}};return N};var j=p;for(var n in o)r[n]=o[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.warn=o.util.warn,r.hasInjectionContext=function(){return!!r.getCurrentInstance()},r.createApp=p}else if(o.version.slice(0,2)==="2.")if(T){for(var n in T)r[n]=T[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.hasInjectionContext=function(){return!!r.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var n in o)r[n]=o[n];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=o,r.Vue2=void 0,r.version=o.version,r.set=function(p,A,k){return Array.isArray(p)?(p.length=Math.max(p.length,A),p.splice(A,1,k),k):(p[A]=k,k)},r.del=function(p,A){if(Array.isArray(p)){p.splice(A,1);return}delete p[A]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return r}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(r,o,T,n,j,p,A,k,h,G,N,E,L,_,V,$){"use strict";const D=T.default||T;function ee(t,l,e={}){const{validateOption:a={},immediate:s=!0,manual:f=!1}=e,c=o.toRef(t),i=n.shallowRef(null),u=n.ref(!0),C=n.ref(!s||f),w=n.computed(()=>{var d;return((d=i.value)==null?void 0:d.errors)||[]}),y=n.computed(()=>{var d;return((d=i.value)==null?void 0:d.fields)||{}}),I=n.computed(()=>new D(o.toValue(l))),R=async()=>{u.value=!1,C.value=!1;try{await I.value.validate(c.value,a),C.value=!0,i.value=null}catch(d){i.value=d}finally{u.value=!0}return{pass:C.value,errorInfo:i.value,errors:w.value,errorFields:y.value}};f||n.watch([c,I],()=>R(),{immediate:s,deep:!0});const S={isFinished:u,pass:C,errors:w,errorInfo:i,errorFields:y,execute:R};function F(){return new Promise((d,g)=>{o.until(u).toBe(!0).then(()=>d(S)).catch(O=>g(O))})}return{...S,then(d,g){return F().then(d,g)}}}function te(...t){const l=typeof t[0]=="string"?t[0]:void 0,e=typeof l=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let s={},f=j,c=a;const i=b=>!!b?.request;t.length>0+e&&(i(t[0+e])?f=t[0+e]:s=t[0+e]),t.length>1+e&&i(t[1+e])&&(f=t[1+e]),(t.length===2+e&&!i(t[1+e])||t.length===3+e)&&(c=t[t.length-1]||a);const{initialData:u,shallow:C,onSuccess:w=o.noop,onError:y=o.noop,immediate:I,resetOnExecute:R=!1}=c,S=n.shallowRef(),F=(C?n.shallowRef:n.ref)(u),d=n.ref(!1),g=n.ref(!1),O=n.ref(!1),m=n.shallowRef(),B=j.CancelToken.source;let U=B();const v=b=>{d.value||!g.value||(U.cancel(b),U=B(),O.value=!0,g.value=!1,d.value=!1)},P=b=>{g.value=b,d.value=!b},ve=()=>{R&&(F.value=u)},J=()=>new Promise((b,W)=>{o.until(d).toBe(!0).then(()=>m.value?W(m.value):b(X))}),Q={then:(...b)=>J().then(...b),catch:(...b)=>J().catch(...b)};let x=0;const K=(b=l,W={})=>{m.value=void 0;const Y=typeof b=="string"?b:l??W.url;if(Y===void 0)return m.value=new j.AxiosError(j.AxiosError.ERR_INVALID_URL),d.value=!0,Q;ve(),c.abortPrevious!==!1&&v(),P(!0),x+=1;const pe=x;return O.value=!1,f(Y,{...s,...typeof b=="object"?b:W,cancelToken:U.token}).then(H=>{if(O.value)return;S.value=H;const Z=H.data;F.value=Z,w(Z)}).catch(H=>{m.value=H,y(H)}).finally(()=>{var H;(H=c.onFinish)==null||H.call(c),pe===x&&P(!1)}),Q};I&&l&&K();const X={response:S,data:F,error:m,isFinished:d,isLoading:g,cancel:v,isAborted:O,isCanceled:O,abort:v,execute:K};return{...X,...Q}}var z=Object.freeze({__proto__:null,camelCase:p.camelCase,capitalCase:p.capitalCase,constantCase:p.constantCase,dotCase:p.dotCase,headerCase:p.headerCase,noCase:p.noCase,paramCase:p.paramCase,pascalCase:p.pascalCase,pathCase:p.pathCase,sentenceCase:p.sentenceCase,snakeCase:p.snakeCase});function ne(t,l,e){if(typeof t=="function")return n.computed(()=>z[l](o.toValue(t),e));const a=n.ref(t);return n.computed({get(){return z[l](a.value,e)},set(s){a.value=s}})}function oe(t){const l=new A(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:s=!1}={})=>M(e,{doNotParse:a,autoUpdateDependencies:s},l)}function M(t,{doNotParse:l=!1,autoUpdateDependencies:e=!1}={},a=new A){const s=e?[...t||[]]:t;let f=a.getAll({doNotParse:!0});const c=n.ref(0),i=()=>{const u=a.getAll({doNotParse:!0});ae(s||null,u,f)&&c.value++,f=u};return a.addChangeListener(i),o.tryOnScopeDispose(()=>{a.removeChangeListener(i)}),{get:(...u)=>(e&&s&&!s.includes(u[0])&&s.push(u[0]),c.value,a.get(u[0],{doNotParse:l,...u[1]})),getAll:(...u)=>(c.value,a.getAll({doNotParse:l,...u[0]})),set:(...u)=>a.set(...u),remove:(...u)=>a.remove(...u),addChangeListener:(...u)=>a.addChangeListener(...u),removeChangeListener:(...u)=>a.removeChangeListener(...u)}}function ae(t,l,e){if(!t)return!0;for(const a of t)if(l[a]!==e[a])return!0;return!1}function re(t,l){const e=n.ref();let a=[];const s=h.createEventHook(),f=h.createEventHook(),c=h.createEventHook(),i=h.createEventHook(),u=h.createEventHook(),C=n.ref(!1),w=n.ref(!1),y=n.ref(!1),I=n.ref(!1),R=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...l?.brush});n.watch(R,()=>{const v=e.value;v&&(v.brush=R.value,v.mode=R.value.mode)},{deep:!0});const S=()=>{var v;return(v=e.value)==null?void 0:v.undo()},F=()=>{var v;return(v=e.value)==null?void 0:v.redo()},d=()=>{var v;return(v=e.value)==null?void 0:v.clear()},g=()=>{var v;return(v=e.value)==null?void 0:v.cancel()},O=v=>{var P;return(P=e.value)==null?void 0:P.load(v)},m=()=>{var v;return(v=e.value)==null?void 0:v.dump()},B=()=>{var v;a.forEach(P=>P()),(v=e.value)==null||v.unmount()},U=()=>{e.value&&(C.value=e.value.canUndo(),w.value=e.value.canRedo(),y.value=e.value.altPressed,I.value=e.value.shiftPressed)};return n.watch(()=>h.unrefElement(t),v=>{!v||typeof SVGSVGElement>"u"||!(v instanceof SVGSVGElement)||(e.value&&B(),e.value=k.createDrauu({el:v,...l}),U(),a=[e.value.on("canceled",()=>f.trigger()),e.value.on("committed",P=>c.trigger(P)),e.value.on("start",()=>i.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{U(),s.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>B()),{drauuInstance:e,load:O,dump:m,clear:d,cancel:g,undo:S,redo:F,canUndo:C,canRedo:w,brush:R,onChanged:s.on,onCommitted:c.on,onStart:i.on,onEnd:u.on,onCanceled:f.on}}function le(t,l={}){let e;const{immediate:a,...s}=l,f=n.ref(!1),c=n.ref(!1),i=y=>e&&e.activate(y),u=y=>e&&e.deactivate(y),C=()=>{e&&(e.pause(),c.value=!0)},w=()=>{e&&(e.unpause(),c.value=!1)};return n.watch(()=>h.unrefElement(t),y=>{y&&(e=G.createFocusTrap(y,{...s,onActivate(){f.value=!0,l.onActivate&&l.onActivate()},onDeactivate(){f.value=!1,l.onDeactivate&&l.onDeactivate()}}),a&&i())},{flush:"post"}),h.tryOnScopeDispose(()=>u()),{hasFocus:f,isPaused:c,activate:i,deactivate:u,pause:C,unpause:w}}function se(t,l,e){const a=()=>{var c,i;return new N((c=o.toValue(l))!=null?c:[],(i=o.toValue(e))==null?void 0:i.fuseOptions)},s=n.ref(a());n.watch(()=>{var c;return(c=o.toValue(e))==null?void 0:c.fuseOptions},()=>{s.value=a()},{deep:!0}),n.watch(()=>o.toValue(l),c=>{s.value.setCollection(c)},{deep:!0});const f=n.computed(()=>{const c=o.toValue(e);if(c?.matchAllWhenSearchEmpty&&!o.toValue(t))return o.toValue(l).map((u,C)=>({item:u,refIndex:C}));const i=c?.resultLimit;return s.value.search(o.toValue(t),i?{limit:i}:void 0)});return{fuse:s,results:f}}function ue(t,l,e={}){const{flush:a="pre",deep:s=!0,shallow:f=!1,onError:c=d=>{console.error(d)},writeDefaults:i=!0}=e,u=n.ref(!1),C=(f?n.shallowRef:n.ref)(l),w=o.toValue(l);async function y(){try{const d=await E.get(t);d===void 0?w!=null&&i&&await E.set(t,w):C.value=d}catch(d){c(d)}u.value=!0}y();async function I(){try{C.value==null?await E.del(t):await E.update(t,()=>n.toRaw(C.value))}catch(d){c(d)}}const{pause:R,resume:S}=h.watchPausable(C,()=>I(),{flush:a,deep:s});async function F(d){R(),C.value=d,await I(),S()}return{set:F,isFinished:u,data:C}}function ce(t,l={}){const{onError:e,fallbackValue:a=null}=l,s=(i,u)=>{try{return L(i,u)}catch(C){return e?.(C),a}},f=n.computed(()=>s(o.toValue(t),{header:!0})),c=n.computed(()=>s(o.toValue(t)));return{header:f,payload:c}}function ie(t=null,l){const e=n.ref(t),a=n.computed({set:f=>f?_.start():_.done(),get:()=>typeof e.value=="number"&&e.value<1});l&&_.configure(l);const s=_.set;return _.set=f=>(e.value=f,s.call(_,f)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&s.call(_,e.value)}),o.tryOnScopeDispose(_.remove),{isLoading:a,progress:e,start:_.start,done:_.done,remove:()=>{e.value=null,_.remove()}}}function fe(t,l){const e=o.toRef(t),a=n.ref("");return n.watch(e,async s=>{e.value&&o.isClient&&(a.value=await V.toDataURL(s,l))},{immediate:!0}),a}function de(t,l,e={}){let a;const{document:s=h.defaultDocument,...f}=e,c={onUpdate:w=>{q(l,w.oldIndex,w.newIndex)}},i=()=>{const w=typeof t=="string"?s?.querySelector(t):h.unrefElement(t);!w||a!==void 0||(a=new $(w,{...c,...f}))},u=()=>{a?.destroy(),a=void 0},C=(w,y)=>{if(y!==void 0)a?.option(w,y);else return a?.option(w)};return h.tryOnMounted(i),h.tryOnScopeDispose(u),{stop:u,start:i,option:C}}function q(t,l,e){const a=n.isRef(t),s=a?[...h.toValue(t)]:h.toValue(t);if(e>=0&&e<s.length){const f=s.splice(l,1)[0];n.nextTick(()=>{s.splice(e,0,f),a&&(t.value=s)})}}r.createCookies=oe,r.moveArrayElement=q,r.useAsyncValidator=ee,r.useAxios=te,r.useChangeCase=ne,r.useCookies=M,r.useDrauu=re,r.useFocusTrap=le,r.useFuse=se,r.useIDBKeyval=ue,r.useJwt=ce,r.useNProgress=ie,r.useQRCode=fe,r.useSortable=de})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
|
|
1
|
+
var VueDemi=function(r,o,U){if(r.install)return r;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(o.version.slice(0,4)==="2.7."){let p=function(A,P){var h,G={},N={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(E,L){return G[E]=L,this},directive:function(E,L){return L?(o.directive(E,L),N):o.directive(E)},mount:function(E,L){return h||(h=new o(Object.assign({propsData:P},A,{provide:Object.assign(G,A.provide)})),h.$mount(E,L),h)},unmount:function(){h&&(h.$destroy(),h=void 0)}};return N};var B=p;for(var n in o)r[n]=o[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.warn=o.util.warn,r.hasInjectionContext=function(){return!!r.getCurrentInstance()},r.createApp=p}else if(o.version.slice(0,2)==="2.")if(U){for(var n in U)r[n]=U[n];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=o,r.Vue2=o,r.version=o.version,r.hasInjectionContext=function(){return!!r.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var n in o)r[n]=o[n];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=o,r.Vue2=void 0,r.version=o.version,r.set=function(p,A,P){return Array.isArray(p)?(p.length=Math.max(p.length,A),p.splice(A,1,P),P):(p[A]=P,P)},r.del=function(p,A){if(Array.isArray(p)){p.splice(A,1);return}delete p[A]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return r}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(r,o,U,n,B,p,A,P,h,G,N,E,L,g,V,$){"use strict";const D=U.default||U;function ee(t,l,e={}){const{validateOption:a={},immediate:s=!0,manual:f=!1}=e,c=o.toRef(t),i=n.shallowRef(null),u=n.ref(!0),C=n.ref(!s||f),w=n.computed(()=>{var d;return((d=i.value)==null?void 0:d.errors)||[]}),y=n.computed(()=>{var d;return((d=i.value)==null?void 0:d.fields)||{}}),I=n.computed(()=>new D(o.toValue(l))),_=async()=>{u.value=!1,C.value=!1;try{await I.value.validate(c.value,a),C.value=!0,i.value=null}catch(d){i.value=d}finally{u.value=!0}return{pass:C.value,errorInfo:i.value,errors:w.value,errorFields:y.value}};f||n.watch([c,I],()=>_(),{immediate:s,deep:!0});const S={isFinished:u,pass:C,errors:w,errorInfo:i,errorFields:y,execute:_};function F(){return new Promise((d,R)=>{o.until(u).toBe(!0).then(()=>d(S)).catch(O=>R(O))})}return{...S,then(d,R){return F().then(d,R)}}}function te(...t){const l=typeof t[0]=="string"?t[0]:void 0,e=typeof l=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let s={},f=B,c=a;const i=b=>!!b?.request;t.length>0+e&&(i(t[0+e])?f=t[0+e]:s=t[0+e]),t.length>1+e&&i(t[1+e])&&(f=t[1+e]),(t.length===2+e&&!i(t[1+e])||t.length===3+e)&&(c=t[t.length-1]||a);const{initialData:u,shallow:C,onSuccess:w=o.noop,onError:y=o.noop,immediate:I,resetOnExecute:_=!1}=c,S=n.shallowRef(),F=(C?n.shallowRef:n.ref)(u),d=n.ref(!1),R=n.ref(!1),O=n.ref(!1),k=n.shallowRef();let j=new AbortController;const T=b=>{d.value||!R.value||(j.abort(b),j=new AbortController,O.value=!0,R.value=!1,d.value=!1)},v=b=>{R.value=b,d.value=!b},m=()=>{_&&(F.value=u)},J=()=>new Promise((b,W)=>{o.until(d).toBe(!0).then(()=>k.value?W(k.value):b(X))}),x={then:(...b)=>J().then(...b),catch:(...b)=>J().catch(...b)};let Q=0;const K=(b=l,W={})=>{k.value=void 0;const Y=typeof b=="string"?b:l??W.url;if(Y===void 0)return k.value=new B.AxiosError(B.AxiosError.ERR_INVALID_URL),d.value=!0,x;m(),c.abortPrevious!==!1&&T(),v(!0),Q+=1;const ve=Q;return O.value=!1,f(Y,{...s,...typeof b=="object"?b:W,signal:j.signal}).then(H=>{if(O.value)return;S.value=H;const Z=H.data;F.value=Z,w(Z)}).catch(H=>{k.value=H,y(H)}).finally(()=>{var H;(H=c.onFinish)==null||H.call(c),ve===Q&&v(!1)}),x};I&&l&&K();const X={response:S,data:F,error:k,isFinished:d,isLoading:R,cancel:T,isAborted:O,isCanceled:O,abort:T,execute:K};return{...X,...x}}var z=Object.freeze({__proto__:null,camelCase:p.camelCase,capitalCase:p.capitalCase,constantCase:p.constantCase,dotCase:p.dotCase,headerCase:p.headerCase,noCase:p.noCase,paramCase:p.paramCase,pascalCase:p.pascalCase,pathCase:p.pathCase,sentenceCase:p.sentenceCase,snakeCase:p.snakeCase});function ne(t,l,e){if(typeof t=="function")return n.computed(()=>z[l](o.toValue(t),e));const a=n.ref(t);return n.computed({get(){return z[l](a.value,e)},set(s){a.value=s}})}function oe(t){const l=new A(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:s=!1}={})=>M(e,{doNotParse:a,autoUpdateDependencies:s},l)}function M(t,{doNotParse:l=!1,autoUpdateDependencies:e=!1}={},a=new A){const s=e?[...t||[]]:t;let f=a.getAll({doNotParse:!0});const c=n.ref(0),i=()=>{const u=a.getAll({doNotParse:!0});ae(s||null,u,f)&&c.value++,f=u};return a.addChangeListener(i),o.tryOnScopeDispose(()=>{a.removeChangeListener(i)}),{get:(...u)=>(e&&s&&!s.includes(u[0])&&s.push(u[0]),c.value,a.get(u[0],{doNotParse:l,...u[1]})),getAll:(...u)=>(c.value,a.getAll({doNotParse:l,...u[0]})),set:(...u)=>a.set(...u),remove:(...u)=>a.remove(...u),addChangeListener:(...u)=>a.addChangeListener(...u),removeChangeListener:(...u)=>a.removeChangeListener(...u)}}function ae(t,l,e){if(!t)return!0;for(const a of t)if(l[a]!==e[a])return!0;return!1}function re(t,l){const e=n.ref();let a=[];const s=h.createEventHook(),f=h.createEventHook(),c=h.createEventHook(),i=h.createEventHook(),u=h.createEventHook(),C=n.ref(!1),w=n.ref(!1),y=n.ref(!1),I=n.ref(!1),_=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...l?.brush});n.watch(_,()=>{const v=e.value;v&&(v.brush=_.value,v.mode=_.value.mode)},{deep:!0});const S=()=>{var v;return(v=e.value)==null?void 0:v.undo()},F=()=>{var v;return(v=e.value)==null?void 0:v.redo()},d=()=>{var v;return(v=e.value)==null?void 0:v.clear()},R=()=>{var v;return(v=e.value)==null?void 0:v.cancel()},O=v=>{var m;return(m=e.value)==null?void 0:m.load(v)},k=()=>{var v;return(v=e.value)==null?void 0:v.dump()},j=()=>{var v;a.forEach(m=>m()),(v=e.value)==null||v.unmount()},T=()=>{e.value&&(C.value=e.value.canUndo(),w.value=e.value.canRedo(),y.value=e.value.altPressed,I.value=e.value.shiftPressed)};return n.watch(()=>h.unrefElement(t),v=>{!v||typeof SVGSVGElement>"u"||!(v instanceof SVGSVGElement)||(e.value&&j(),e.value=P.createDrauu({el:v,...l}),T(),a=[e.value.on("canceled",()=>f.trigger()),e.value.on("committed",m=>c.trigger(m)),e.value.on("start",()=>i.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{T(),s.trigger()})])},{flush:"post"}),o.tryOnScopeDispose(()=>j()),{drauuInstance:e,load:O,dump:k,clear:d,cancel:R,undo:S,redo:F,canUndo:C,canRedo:w,brush:_,onChanged:s.on,onCommitted:c.on,onStart:i.on,onEnd:u.on,onCanceled:f.on}}function le(t,l={}){let e;const{immediate:a,...s}=l,f=n.ref(!1),c=n.ref(!1),i=y=>e&&e.activate(y),u=y=>e&&e.deactivate(y),C=()=>{e&&(e.pause(),c.value=!0)},w=()=>{e&&(e.unpause(),c.value=!1)};return n.watch(()=>h.unrefElement(t),y=>{y&&(e=G.createFocusTrap(y,{...s,onActivate(){f.value=!0,l.onActivate&&l.onActivate()},onDeactivate(){f.value=!1,l.onDeactivate&&l.onDeactivate()}}),a&&i())},{flush:"post"}),h.tryOnScopeDispose(()=>u()),{hasFocus:f,isPaused:c,activate:i,deactivate:u,pause:C,unpause:w}}function se(t,l,e){const a=()=>{var c,i;return new N((c=o.toValue(l))!=null?c:[],(i=o.toValue(e))==null?void 0:i.fuseOptions)},s=n.ref(a());n.watch(()=>{var c;return(c=o.toValue(e))==null?void 0:c.fuseOptions},()=>{s.value=a()},{deep:!0}),n.watch(()=>o.toValue(l),c=>{s.value.setCollection(c)},{deep:!0});const f=n.computed(()=>{const c=o.toValue(e);if(c?.matchAllWhenSearchEmpty&&!o.toValue(t))return o.toValue(l).map((u,C)=>({item:u,refIndex:C}));const i=c?.resultLimit;return s.value.search(o.toValue(t),i?{limit:i}:void 0)});return{fuse:s,results:f}}function ue(t,l,e={}){const{flush:a="pre",deep:s=!0,shallow:f=!1,onError:c=d=>{console.error(d)},writeDefaults:i=!0}=e,u=n.ref(!1),C=(f?n.shallowRef:n.ref)(l),w=o.toValue(l);async function y(){try{const d=await E.get(t);d===void 0?w!=null&&i&&await E.set(t,w):C.value=d}catch(d){c(d)}u.value=!0}y();async function I(){try{C.value==null?await E.del(t):await E.update(t,()=>n.toRaw(C.value))}catch(d){c(d)}}const{pause:_,resume:S}=h.watchPausable(C,()=>I(),{flush:a,deep:s});async function F(d){_(),C.value=d,await I(),S()}return{set:F,isFinished:u,data:C}}function ce(t,l={}){const{onError:e,fallbackValue:a=null}=l,s=(i,u)=>{try{return L(i,u)}catch(C){return e?.(C),a}},f=n.computed(()=>s(o.toValue(t),{header:!0})),c=n.computed(()=>s(o.toValue(t)));return{header:f,payload:c}}function ie(t=null,l){const e=n.ref(t),a=n.computed({set:f=>f?g.start():g.done(),get:()=>typeof e.value=="number"&&e.value<1});l&&g.configure(l);const s=g.set;return g.set=f=>(e.value=f,s.call(g,f)),n.watchEffect(()=>{typeof e.value=="number"&&o.isClient&&s.call(g,e.value)}),o.tryOnScopeDispose(g.remove),{isLoading:a,progress:e,start:g.start,done:g.done,remove:()=>{e.value=null,g.remove()}}}function fe(t,l){const e=o.toRef(t),a=n.ref("");return n.watch(e,async s=>{e.value&&o.isClient&&(a.value=await V.toDataURL(s,l))},{immediate:!0}),a}function de(t,l,e={}){let a;const{document:s=h.defaultDocument,...f}=e,c={onUpdate:w=>{q(l,w.oldIndex,w.newIndex)}},i=()=>{const w=typeof t=="string"?s?.querySelector(t):h.unrefElement(t);!w||a!==void 0||(a=new $(w,{...c,...f}))},u=()=>{a?.destroy(),a=void 0},C=(w,y)=>{if(y!==void 0)a?.option(w,y);else return a?.option(w)};return h.tryOnMounted(i),h.tryOnScopeDispose(u),{stop:u,start:i,option:C}}function q(t,l,e){const a=n.isRef(t),s=a?[...h.toValue(t)]:h.toValue(t);if(e>=0&&e<s.length){const f=s.splice(l,1)[0];n.nextTick(()=>{s.splice(e,0,f),a&&(t.value=s)})}}r.createCookies=oe,r.moveArrayElement=q,r.useAsyncValidator=ee,r.useAxios=te,r.useChangeCase=ne,r.useCookies=M,r.useDrauu=re,r.useFocusTrap=le,r.useFuse=se,r.useIDBKeyval=ue,r.useJwt=ce,r.useNProgress=ie,r.useQRCode=fe,r.useSortable=de})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
|
package/index.mjs
CHANGED
|
@@ -119,13 +119,12 @@ function useAxios(...args) {
|
|
|
119
119
|
const isLoading = ref(false);
|
|
120
120
|
const isAborted = ref(false);
|
|
121
121
|
const error = shallowRef();
|
|
122
|
-
|
|
123
|
-
let cancelToken = cancelTokenSource();
|
|
122
|
+
let abortController = new AbortController();
|
|
124
123
|
const abort = (message) => {
|
|
125
124
|
if (isFinished.value || !isLoading.value)
|
|
126
125
|
return;
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
abortController.abort(message);
|
|
127
|
+
abortController = new AbortController();
|
|
129
128
|
isAborted.value = true;
|
|
130
129
|
isLoading.value = false;
|
|
131
130
|
isFinished.value = false;
|
|
@@ -161,7 +160,7 @@ function useAxios(...args) {
|
|
|
161
160
|
executeCounter += 1;
|
|
162
161
|
const currentExecuteCounter = executeCounter;
|
|
163
162
|
isAborted.value = false;
|
|
164
|
-
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config,
|
|
163
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
|
165
164
|
if (isAborted.value)
|
|
166
165
|
return;
|
|
167
166
|
response.value = r;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/integrations",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.10.0",
|
|
4
4
|
"description": "Integration wrappers for utility libraries",
|
|
5
5
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
"dependencies": {
|
|
148
|
-
"@vueuse/core": "10.
|
|
149
|
-
"@vueuse/shared": "10.
|
|
148
|
+
"@vueuse/core": "10.10.0",
|
|
149
|
+
"@vueuse/shared": "10.10.0",
|
|
150
150
|
"vue-demi": ">=0.14.7"
|
|
151
151
|
},
|
|
152
152
|
"devDependencies": {
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"@types/qrcode": "^1.5.5",
|
|
155
155
|
"@types/sortablejs": "^1.15.8",
|
|
156
156
|
"async-validator": "^4.2.5",
|
|
157
|
-
"axios": "^1.
|
|
157
|
+
"axios": "^1.7.2",
|
|
158
158
|
"change-case": "^4.1.2",
|
|
159
159
|
"drauu": "^0.3.7",
|
|
160
160
|
"focus-trap": "^7.5.4",
|
package/useAxios.cjs
CHANGED
|
@@ -42,13 +42,12 @@ function useAxios(...args) {
|
|
|
42
42
|
const isLoading = vueDemi.ref(false);
|
|
43
43
|
const isAborted = vueDemi.ref(false);
|
|
44
44
|
const error = vueDemi.shallowRef();
|
|
45
|
-
|
|
46
|
-
let cancelToken = cancelTokenSource();
|
|
45
|
+
let abortController = new AbortController();
|
|
47
46
|
const abort = (message) => {
|
|
48
47
|
if (isFinished.value || !isLoading.value)
|
|
49
48
|
return;
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
abortController.abort(message);
|
|
50
|
+
abortController = new AbortController();
|
|
52
51
|
isAborted.value = true;
|
|
53
52
|
isLoading.value = false;
|
|
54
53
|
isFinished.value = false;
|
|
@@ -84,7 +83,7 @@ function useAxios(...args) {
|
|
|
84
83
|
executeCounter += 1;
|
|
85
84
|
const currentExecuteCounter = executeCounter;
|
|
86
85
|
isAborted.value = false;
|
|
87
|
-
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config,
|
|
86
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
|
88
87
|
if (isAborted.value)
|
|
89
88
|
return;
|
|
90
89
|
response.value = r;
|
package/useAxios.iife.js
CHANGED
|
@@ -159,13 +159,12 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
159
159
|
const isLoading = vueDemi.ref(false);
|
|
160
160
|
const isAborted = vueDemi.ref(false);
|
|
161
161
|
const error = vueDemi.shallowRef();
|
|
162
|
-
|
|
163
|
-
let cancelToken = cancelTokenSource();
|
|
162
|
+
let abortController = new AbortController();
|
|
164
163
|
const abort = (message) => {
|
|
165
164
|
if (isFinished.value || !isLoading.value)
|
|
166
165
|
return;
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
abortController.abort(message);
|
|
167
|
+
abortController = new AbortController();
|
|
169
168
|
isAborted.value = true;
|
|
170
169
|
isLoading.value = false;
|
|
171
170
|
isFinished.value = false;
|
|
@@ -201,7 +200,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
201
200
|
executeCounter += 1;
|
|
202
201
|
const currentExecuteCounter = executeCounter;
|
|
203
202
|
isAborted.value = false;
|
|
204
|
-
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config,
|
|
203
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
|
205
204
|
if (isAborted.value)
|
|
206
205
|
return;
|
|
207
206
|
response.value = r;
|
package/useAxios.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(
|
|
1
|
+
var VueDemi=function(t,n,u){if(t.install)return t;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),t;if(n.version.slice(0,4)==="2.7."){let e=function(s,o){var f,h={},d={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(l,c){return h[l]=c,this},directive:function(l,c){return c?(n.directive(l,c),d):n.directive(l)},mount:function(l,c){return f||(f=new n(Object.assign({propsData:o},s,{provide:Object.assign(h,s.provide)})),f.$mount(l,c),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return d};var P=e;for(var i in n)t[i]=n[i];t.isVue2=!0,t.isVue3=!1,t.install=function(){},t.Vue=n,t.Vue2=n,t.version=n.version,t.warn=n.util.warn,t.hasInjectionContext=function(){return!!t.getCurrentInstance()},t.createApp=e}else if(n.version.slice(0,2)==="2.")if(u){for(var i in u)t[i]=u[i];t.isVue2=!0,t.isVue3=!1,t.install=function(){},t.Vue=n,t.Vue2=n,t.version=n.version,t.hasInjectionContext=function(){return!!t.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 i in n)t[i]=n[i];t.isVue2=!1,t.isVue3=!0,t.install=function(){},t.Vue=n,t.Vue2=void 0,t.version=n.version,t.set=function(e,s,o){return Array.isArray(e)?(e.length=Math.max(e.length,s),e.splice(s,1,o),o):(e[s]=o,o)},t.del=function(e,s){if(Array.isArray(e)){e.splice(s,1);return}delete e[s]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return t}(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(t,n,u,i){"use strict";function P(...e){const s=typeof e[0]=="string"?e[0]:void 0,o=typeof s=="string"?1:0,f={immediate:!!o,shallow:!0,abortPrevious:!0};let h={},d=i,l=f;const c=r=>!!r?.request;e.length>0+o&&(c(e[0+o])?d=e[0+o]:h=e[0+o]),e.length>1+o&&c(e[1+o])&&(d=e[1+o]),(e.length===2+o&&!c(e[1+o])||e.length===3+o)&&(l=e[e.length-1]||f);const{initialData:R,shallow:g,onSuccess:q=u.noop,onError:B=u.noop,immediate:M,resetOnExecute:N=!1}=l,j=n.shallowRef(),C=(g?n.shallowRef:n.ref)(R),v=n.ref(!1),A=n.ref(!1),b=n.ref(!1),p=n.shallowRef();let y=new AbortController;const x=r=>{v.value||!A.value||(y.abort(r),y=new AbortController,b.value=!0,A.value=!1,v.value=!1)},O=r=>{A.value=r,v.value=!r},S=()=>{N&&(C.value=R)},_=()=>new Promise((r,w)=>{u.until(v).toBe(!0).then(()=>p.value?w(p.value):r(L))}),I={then:(...r)=>_().then(...r),catch:(...r)=>_().catch(...r)};let E=0;const F=(r=s,w={})=>{p.value=void 0;const U=typeof r=="string"?r:s??w.url;if(U===void 0)return p.value=new i.AxiosError(i.AxiosError.ERR_INVALID_URL),v.value=!0,I;S(),l.abortPrevious!==!1&&x(),O(!0),E+=1;const z=E;return b.value=!1,d(U,{...h,...typeof r=="object"?r:w,signal:y.signal}).then(a=>{if(b.value)return;j.value=a;const $=a.data;C.value=$,q($)}).catch(a=>{p.value=a,B(a)}).finally(()=>{var a;(a=l.onFinish)==null||a.call(l),z===E&&O(!1)}),I};M&&s&&F();const L={response:j,data:C,error:p,isFinished:v,isLoading:A,cancel:x,isAborted:b,isCanceled:b,abort:x,execute:F};return{...L,...I}}t.useAxios=P})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
|
package/useAxios.mjs
CHANGED
|
@@ -40,13 +40,12 @@ function useAxios(...args) {
|
|
|
40
40
|
const isLoading = ref(false);
|
|
41
41
|
const isAborted = ref(false);
|
|
42
42
|
const error = shallowRef();
|
|
43
|
-
|
|
44
|
-
let cancelToken = cancelTokenSource();
|
|
43
|
+
let abortController = new AbortController();
|
|
45
44
|
const abort = (message) => {
|
|
46
45
|
if (isFinished.value || !isLoading.value)
|
|
47
46
|
return;
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
abortController.abort(message);
|
|
48
|
+
abortController = new AbortController();
|
|
50
49
|
isAborted.value = true;
|
|
51
50
|
isLoading.value = false;
|
|
52
51
|
isFinished.value = false;
|
|
@@ -82,7 +81,7 @@ function useAxios(...args) {
|
|
|
82
81
|
executeCounter += 1;
|
|
83
82
|
const currentExecuteCounter = executeCounter;
|
|
84
83
|
isAborted.value = false;
|
|
85
|
-
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config,
|
|
84
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
|
86
85
|
if (isAborted.value)
|
|
87
86
|
return;
|
|
88
87
|
response.value = r;
|