@vueuse/integrations
Advanced tools
Comparing version 4.4.1 to 4.5.0
@@ -49,2 +49,3 @@ 'use strict'; | ||
const finished = vueDemi.ref(false); | ||
const loading = vueDemi.ref(true); | ||
const canceled = vueDemi.ref(false); | ||
@@ -56,2 +57,4 @@ const error = vueDemi.ref(); | ||
canceled.value = true; | ||
loading.value = false; | ||
finished.value = false; | ||
}; | ||
@@ -62,6 +65,8 @@ instance(url, Object.assign(Object.assign({}, config), { cancelToken: cancelToken.token })) | ||
data.value = r.data; | ||
finished.value = true; | ||
}) | ||
.catch((e) => { | ||
error.value = e; | ||
}) | ||
.finally(() => { | ||
loading.value = false; | ||
finished.value = true; | ||
@@ -74,2 +79,3 @@ }); | ||
finished, | ||
loading, | ||
cancel, | ||
@@ -76,0 +82,0 @@ canceled, |
@@ -1,4 +0,6 @@ | ||
import { Ref, ComputedRef, WritableComputedRef } from 'vue-demi'; | ||
import * as vue_demi from 'vue-demi'; | ||
import { Ref, ComputedRef } from 'vue-demi'; | ||
import { AxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosError } from 'axios'; | ||
import universal_cookie, { CookieGetOptions, CookieSetOptions, CookieChangeListener } from 'universal-cookie'; | ||
import * as universal_cookie from 'universal-cookie'; | ||
import universal_cookie__default from 'universal-cookie'; | ||
import { IncomingMessage } from 'http'; | ||
@@ -14,2 +16,3 @@ import { MaybeRef } from '@vueuse/shared'; | ||
finished: Ref<boolean>; | ||
loading: Ref<boolean>; | ||
canceled: Ref<boolean>; | ||
@@ -35,11 +38,11 @@ error: Ref<AxiosError<T> | undefined>; | ||
*/ | ||
get: <T = any>(name: string, options?: CookieGetOptions | undefined) => T; | ||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T; | ||
/** | ||
* Reactive get all cookies | ||
*/ | ||
getAll: <T_1 = any>(options?: CookieGetOptions | undefined) => T_1; | ||
set: (name: string, value: any, options?: CookieSetOptions | undefined) => void; | ||
remove: (name: string, options?: CookieSetOptions | undefined) => void; | ||
addChangeListener: (callback: CookieChangeListener) => void; | ||
removeChangeListener: (callback: CookieChangeListener) => void; | ||
getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1; | ||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void; | ||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void; | ||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void; | ||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void; | ||
}; | ||
@@ -57,15 +60,15 @@ /** | ||
autoUpdateDependencies?: boolean | undefined; | ||
}, cookies?: universal_cookie): { | ||
}, cookies?: universal_cookie__default): { | ||
/** | ||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies | ||
*/ | ||
get: <T = any>(name: string, options?: CookieGetOptions | undefined) => T; | ||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T; | ||
/** | ||
* Reactive get all cookies | ||
*/ | ||
getAll: <T_1 = any>(options?: CookieGetOptions | undefined) => T_1; | ||
set: (name: string, value: any, options?: CookieSetOptions | undefined) => void; | ||
remove: (name: string, options?: CookieSetOptions | undefined) => void; | ||
addChangeListener: (callback: CookieChangeListener) => void; | ||
removeChangeListener: (callback: CookieChangeListener) => void; | ||
getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1; | ||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void; | ||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void; | ||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void; | ||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void; | ||
}; | ||
@@ -105,4 +108,4 @@ | ||
declare function useNProgress(currentProgress?: MaybeRef<number | null | undefined>, options?: NProgressOptions | undefined): { | ||
isLoading: WritableComputedRef<boolean>; | ||
progress: Ref<number | null | undefined>; | ||
isLoading: vue_demi.WritableComputedRef<boolean>; | ||
progress: vue_demi.Ref<number | null | undefined>; | ||
start: () => nprogress.NProgress; | ||
@@ -120,4 +123,4 @@ done: (force?: boolean | undefined) => nprogress.NProgress; | ||
*/ | ||
declare function useQRCode(text: MaybeRef<string>, options?: QRCode.QRCodeToDataURLOptions): Ref<string>; | ||
declare function useQRCode(text: MaybeRef<string>, options?: QRCode.QRCodeToDataURLOptions): vue_demi.Ref<string>; | ||
export { JwtOptions, JwtResult, createCookies, useAxios, useCookies, useJwt, useNProgress, useQRCode }; |
@@ -37,2 +37,3 @@ import { ref, computed, isRef, watchEffect, watch } from 'vue-demi'; | ||
const finished = ref(false); | ||
const loading = ref(true); | ||
const canceled = ref(false); | ||
@@ -44,2 +45,4 @@ const error = ref(); | ||
canceled.value = true; | ||
loading.value = false; | ||
finished.value = false; | ||
}; | ||
@@ -50,6 +53,8 @@ instance(url, Object.assign(Object.assign({}, config), { cancelToken: cancelToken.token })) | ||
data.value = r.data; | ||
finished.value = true; | ||
}) | ||
.catch((e) => { | ||
error.value = e; | ||
}) | ||
.finally(() => { | ||
loading.value = false; | ||
finished.value = true; | ||
@@ -62,2 +67,3 @@ }); | ||
finished, | ||
loading, | ||
cancel, | ||
@@ -64,0 +70,0 @@ canceled, |
@@ -101,2 +101,3 @@ ;(function (window) { | ||
const finished = vueDemi.ref(false); | ||
const loading = vueDemi.ref(true); | ||
const canceled = vueDemi.ref(false); | ||
@@ -108,2 +109,4 @@ const error = vueDemi.ref(); | ||
canceled.value = true; | ||
loading.value = false; | ||
finished.value = false; | ||
}; | ||
@@ -114,6 +117,8 @@ instance(url, Object.assign(Object.assign({}, config), { cancelToken: cancelToken.token })) | ||
data.value = r.data; | ||
finished.value = true; | ||
}) | ||
.catch((e) => { | ||
error.value = e; | ||
}) | ||
.finally(() => { | ||
loading.value = false; | ||
finished.value = true; | ||
@@ -126,2 +131,3 @@ }); | ||
finished, | ||
loading, | ||
cancel, | ||
@@ -128,0 +134,0 @@ canceled, |
@@ -1,1 +0,1 @@ | ||
!function(e){if(!e.VueDemi){var t={},n=e.Vue;if(n)if("2."===n.version.slice(0,2)){var o=e.VueCompositionAPI;if(o){for(var r in o)t[r]=o[r];t.isVue2=!0,t.isVue3=!1,t.install=function(){},t.Vue=n,t.Vue2=n,t.version=n.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if("3."===n.version.slice(0,2)){for(var r in n)t[r]=n[r];t.isVue2=!1,t.isVue3=!0,t.install=function(){},t.Vue=n,t.Vue2=void 0,t.version=n.version,t.set=function(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)},t.del=function(e,t){Array.isArray(e)?e.splice(t,1):delete e[t]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");e.VueDemi=t}}(window),function(e,t,n,o,r,u,s,a){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(n),d=i(r),c=i(u),f=i(s),v=i(a);function m(e,{doNotParse:n=!1,autoUpdateDependencies:r=!1}={},u=new d.default){const s=r?[...e||[]]:e;let a=u.getAll({doNotParse:!0});const i=t.ref(0),l=()=>{const e=u.getAll({doNotParse:!0});(function(e,t,n){if(!e)return!0;for(const o of e)if(t[o]!==n[o])return!0;return!1})(s||null,e,a)&&i.value++,a=e};return o.tryOnMounted((()=>{u.addChangeListener(l)})),o.tryOnUnmounted((()=>{u.removeChangeListener(l)})),{get:(...e)=>(r&&s&&!s.includes(e[0])&&s.push(e[0]),i.value,u.get(e[0],Object.assign({doNotParse:n},e[1]))),getAll:(...e)=>(i.value,u.getAll(Object.assign({doNotParse:n},e[0]))),set:(...e)=>u.set(...e),remove:(...e)=>u.remove(...e),addChangeListener:(...e)=>u.addChangeListener(...e),removeChangeListener:(...e)=>u.removeChangeListener(...e)}}e.createCookies=function(e){const t=new d.default(e?e.headers.cookie:null);return(e,{doNotParse:n=!1,autoUpdateDependencies:o=!1}={})=>m(e,{doNotParse:n,autoUpdateDependencies:o},t)},e.useAxios=function(e,...n){let o={},r=l.default;n.length>0&&("request"in n[0]?r=n[0]:o=n[0]),n.length>1&&"request"in n[1]&&(r=n[1]);const u=t.ref(null),s=t.ref(void 0),a=t.ref(!1),i=t.ref(!1),d=t.ref(),c=l.default.CancelToken.source();return r(e,Object.assign(Object.assign({},o),{cancelToken:c.token})).then((e=>{u.value=e,s.value=e.data,a.value=!0})).catch((e=>{d.value=e,a.value=!0})),{response:u,data:s,error:d,finished:a,cancel:e=>{c.cancel(e),i.value=!0},canceled:i}},e.useCookies=m,e.useJwt=function(e,n={}){const o=t.ref(e),{onError:r,fallbackValue:u=null}=n,s=(e,t)=>{try{return c.default(e,t)}catch(e){return null==r||r(e),u}};return{header:t.computed((()=>s(o.value,{header:!0}))),payload:t.computed((()=>s(o.value)))}},e.useNProgress=function(e=null,n){const r=t.isRef(e)?e:t.ref(e),u=t.computed({set:e=>e?f.default.start():f.default.done(),get:()=>o.isNumber(r.value)&&r.value<1});n&&f.default.configure(n);const s=f.default.set;return f.default.set=e=>(r.value=e,s.call(f.default,e)),t.watchEffect((()=>{o.isNumber(r.value)&&s.call(f.default,r.value)})),o.tryOnUnmounted(f.default.remove),{isLoading:u,progress:r,start:f.default.start,done:f.default.done,remove:()=>{r.value=null,f.default.remove()}}},e.useQRCode=function(e,n){const r=t.ref(e),u=t.ref("");return t.watch(r,(async e=>{r.value&&o.isClient&&(u.value=await v.default.toDataURL(e,n))}),{immediate:!0}),u},Object.defineProperty(e,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi,axios,VueUse,UniversalCookie,jwt_decode,nprogress,QRCode); | ||
!function(e){if(!e.VueDemi){var t={},n=e.Vue;if(n)if("2."===n.version.slice(0,2)){var o=e.VueCompositionAPI;if(o){for(var r in o)t[r]=o[r];t.isVue2=!0,t.isVue3=!1,t.install=function(){},t.Vue=n,t.Vue2=n,t.version=n.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.")}else if("3."===n.version.slice(0,2)){for(var r in n)t[r]=n[r];t.isVue2=!1,t.isVue3=!0,t.install=function(){},t.Vue=n,t.Vue2=void 0,t.version=n.version,t.set=function(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)},t.del=function(e,t){Array.isArray(e)?e.splice(t,1):delete e[t]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");e.VueDemi=t}}(window),function(e,t,n,o,r,u,a,s){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(n),d=i(r),c=i(u),f=i(a),v=i(s);function m(e,{doNotParse:n=!1,autoUpdateDependencies:r=!1}={},u=new d.default){const a=r?[...e||[]]:e;let s=u.getAll({doNotParse:!0});const i=t.ref(0),l=()=>{const e=u.getAll({doNotParse:!0});(function(e,t,n){if(!e)return!0;for(const o of e)if(t[o]!==n[o])return!0;return!1})(a||null,e,s)&&i.value++,s=e};return o.tryOnMounted((()=>{u.addChangeListener(l)})),o.tryOnUnmounted((()=>{u.removeChangeListener(l)})),{get:(...e)=>(r&&a&&!a.includes(e[0])&&a.push(e[0]),i.value,u.get(e[0],Object.assign({doNotParse:n},e[1]))),getAll:(...e)=>(i.value,u.getAll(Object.assign({doNotParse:n},e[0]))),set:(...e)=>u.set(...e),remove:(...e)=>u.remove(...e),addChangeListener:(...e)=>u.addChangeListener(...e),removeChangeListener:(...e)=>u.removeChangeListener(...e)}}e.createCookies=function(e){const t=new d.default(e?e.headers.cookie:null);return(e,{doNotParse:n=!1,autoUpdateDependencies:o=!1}={})=>m(e,{doNotParse:n,autoUpdateDependencies:o},t)},e.useAxios=function(e,...n){let o={},r=l.default;n.length>0&&("request"in n[0]?r=n[0]:o=n[0]),n.length>1&&"request"in n[1]&&(r=n[1]);const u=t.ref(null),a=t.ref(void 0),s=t.ref(!1),i=t.ref(!0),d=t.ref(!1),c=t.ref(),f=l.default.CancelToken.source();return r(e,Object.assign(Object.assign({},o),{cancelToken:f.token})).then((e=>{u.value=e,a.value=e.data})).catch((e=>{c.value=e})).finally((()=>{i.value=!1,s.value=!0})),{response:u,data:a,error:c,finished:s,loading:i,cancel:e=>{f.cancel(e),d.value=!0,i.value=!1,s.value=!1},canceled:d}},e.useCookies=m,e.useJwt=function(e,n={}){const o=t.ref(e),{onError:r,fallbackValue:u=null}=n,a=(e,t)=>{try{return c.default(e,t)}catch(e){return null==r||r(e),u}};return{header:t.computed((()=>a(o.value,{header:!0}))),payload:t.computed((()=>a(o.value)))}},e.useNProgress=function(e=null,n){const r=t.isRef(e)?e:t.ref(e),u=t.computed({set:e=>e?f.default.start():f.default.done(),get:()=>o.isNumber(r.value)&&r.value<1});n&&f.default.configure(n);const a=f.default.set;return f.default.set=e=>(r.value=e,a.call(f.default,e)),t.watchEffect((()=>{o.isNumber(r.value)&&a.call(f.default,r.value)})),o.tryOnUnmounted(f.default.remove),{isLoading:u,progress:r,start:f.default.start,done:f.default.done,remove:()=>{r.value=null,f.default.remove()}}},e.useQRCode=function(e,n){const r=t.ref(e),u=t.ref("");return t.watch(r,(async e=>{r.value&&o.isClient&&(u.value=await v.default.toDataURL(e,n))}),{immediate:!0}),u},Object.defineProperty(e,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi,axios,VueUse,UniversalCookie,jwt_decode,nprogress,QRCode); |
{ | ||
"name": "@vueuse/integrations", | ||
"description": "Integration wrappers for utility libraries", | ||
"version": "4.4.1", | ||
"version": "4.5.0", | ||
"main": "./dist/index.cjs.js", | ||
@@ -30,3 +30,3 @@ "types": "./dist/index.d.ts", | ||
"dependencies": { | ||
"@vueuse/shared": "4.4.1", | ||
"@vueuse/shared": "4.5.0", | ||
"vue-demi": "latest" | ||
@@ -33,0 +33,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40582
874
+ Added@vueuse/shared@4.5.0(transitive)
- Removed@vueuse/shared@4.4.1(transitive)
Updated@vueuse/shared@4.5.0