@vueuse/shared
Advanced tools
Comparing version 7.5.4 to 7.5.5
@@ -1206,3 +1206,3 @@ ;(function (window) { | ||
if (current.value >= vueDemi.unref(count)) | ||
stop(); | ||
vueDemi.nextTick(() => stop()); | ||
cb(...args); | ||
@@ -1215,3 +1215,3 @@ }, watchOptions); | ||
const stop = vueDemi.watch(source, (...args) => { | ||
stop(); | ||
vueDemi.nextTick(() => stop()); | ||
return cb(...args); | ||
@@ -1218,0 +1218,0 @@ }, options); |
@@ -1,1 +0,1 @@ | ||
(function(i){if(!i.VueDemi){var o={},O=i.Vue;if(O)if(O.version.slice(0,2)==="2."){var b=i.VueCompositionAPI;if(b){for(var g in b)o[g]=b[g];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=O,o.Vue2=O,o.version=O.version}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 g in O)o[g]=O[g];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=O,o.Vue2=void 0,o.version=O.version,o.set=function(h,w,m){return Array.isArray(h)?(h.length=Math.max(h.length,w),h.splice(w,1,m),m):(h[w]=m,m)},o.del=function(h,w){if(Array.isArray(h)){h.splice(w,1);return}delete h[w]}}else console.error("[vue-demi] Vue version "+O.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");i.VueDemi=o}})(window),function(i,o){"use strict";function O(...e){return o.computed(()=>e.every(t=>o.unref(t)))}function b(e,t){const r="sync",n=o.watch(e,u=>{t.value=u},{flush:r,immediate:!0}),a=o.watch(t,u=>{e.value=u},{flush:r,immediate:!0});return()=>{n(),a()}}function g(e,t){let r,n,a;const u=o.ref(!0);return o.watch(e,()=>{u.value=!0,a()},{flush:"sync"}),o.customRef((l,c)=>(n=l,a=c,{get(){return u.value&&(r=t(),u.value=!1),n(),r},set(){}}))}function h(e="this function"){if(!o.isVue3)throw new Error(`[VueUse] ${e} is only works on Vue 3.`)}function w(e,t,{enumerable:r=!1,unwrap:n=!0}={}){h();for(const[a,u]of Object.entries(t))a!=="value"&&(o.isRef(u)&&n?Object.defineProperty(e,a,{get(){return u.value},set(l){u.value=l},enumerable:r}):Object.defineProperty(e,a,{value:u,enumerable:r}));return e}function m(e,t={}){let r=e,n,a;const u=o.customRef((s,v)=>(n=s,a=v,{get(){return l()},set(y){c(y)}}));function l(s=!0){return s&&n(),r}function c(s,v=!0){var y,C;if(s===r)return;const P=r;((y=t.onBeforeChange)==null?void 0:y.call(t,s,P))!==!1&&(r=s,(C=t.onChanged)==null||C.call(t,s,P),v&&a())}return w(u,{get:l,set:c,untrackedGet:()=>l(!1),silentSet:s=>c(s,!1),peek:()=>l(!1),lay:s=>c(s,!1)},{enumerable:!0})}function Oe(){const e=[],t=a=>{const u=e.indexOf(a);u!==-1&&e.splice(u,1)};return{on:a=>(e.push(a),{off:()=>t(a)}),off:t,trigger:a=>{e.forEach(u=>u(a))}}}function he(e){let t=!1,r;const n=o.effectScope(!0);return()=>(t||(r=n.run(e),t=!0),r)}function A(e){return function(...t){return o.computed(()=>e.apply(this,t.map(r=>o.unref(r))))}}function j(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function we(e){let t=0,r,n;const a=()=>{t-=1,n&&t<=0&&(n.stop(),r=void 0,n=void 0)};return(...u)=>(t+=1,r||(n=o.effectScope(!0),r=n.run(()=>e(...u))),j(a),r)}const N=typeof window!="undefined",Pe=e=>typeof e!="undefined",ge=(e,...t)=>{e||console.warn(...t)},M=Object.prototype.toString,me=e=>typeof e=="boolean",be=e=>typeof e=="function",$e=e=>typeof e=="number",Se=e=>typeof e=="string",je=e=>M.call(e)==="[object Object]",Fe=e=>typeof window!="undefined"&&M.call(e)==="[object Window]",Ie=()=>Date.now(),U=()=>+Date.now(),Ee=(e,t,r)=>Math.min(r,Math.max(t,e)),B=()=>{},Te=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function $(e,t){function r(...n){e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})}return r}const F=e=>e();function R(e,t={}){let r,n;return u=>{const l=o.unref(e),c=o.unref(t.maxWait);if(r&&clearTimeout(r),l<=0||c!==void 0&&c<=0)return n&&(clearTimeout(n),n=null),u();c&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,u()},c)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,u()},l)}}function W(e,t=!0,r=!0){let n=0,a,u=!r;const l=()=>{a&&(clearTimeout(a),a=void 0)};return d=>{const _=o.unref(e),p=Date.now()-n;if(l(),_<=0)return n=Date.now(),d();p>_&&(n=Date.now(),u?u=!1:d()),t&&(a=setTimeout(()=>{n=Date.now(),r||(u=!0),l(),d()},_)),!r&&!a&&(a=setTimeout(()=>u=!0,_))}}function G(e=F){const t=o.ref(!0);function r(){t.value=!1}function n(){t.value=!0}return{isActive:t,pause:r,resume:n,eventFilter:(...u)=>{t.value&&e(...u)}}}function L(e,t=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(t?()=>a(r):n,e)})}function Ve(e){return e}function Ce(e){let t;function r(){return t||(t=e()),t}return r.reset=async()=>{const n=t;t=void 0,n&&await n},r}function Ae(e){return e()}function Ne(e,...t){return t.some(r=>r in e)}function Re(e,t){var r;if(typeof e=="number")return e+t;const n=((r=e.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:r[0])||"",a=e.slice(n.length),u=parseFloat(n)+t;return Number.isNaN(u)?e:u+a}function We(e,t,r=!1){return t.reduce((n,a)=>(a in e&&(!r||!e[a]===void 0)&&(n[a]=e[a]),n),{})}function H(e,t=200,r={}){return $(R(t,r),e)}function z(e,t=200,r={}){if(t<=0)return e;const n=o.ref(e.value),a=H(()=>{n.value=e.value},t,r);return o.watch(e,()=>a()),n}var q=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,Be=(e,t)=>{var r={};for(var n in e)Me.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&q)for(var n of q(e))t.indexOf(n)<0&&Ue.call(e,n)&&(r[n]=e[n]);return r};function S(e,t,r={}){const n=r,{eventFilter:a=F}=n,u=Be(n,["eventFilter"]);return o.watch(e,$(a,t),u)}var Ge=Object.defineProperty,Le=Object.defineProperties,He=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,X=(e,t,r)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ze=(e,t)=>{for(var r in t||(t={}))J.call(t,r)&&X(e,r,t[r]);if(I)for(var r of I(t))Q.call(t,r)&&X(e,r,t[r]);return e},qe=(e,t)=>Le(e,He(t)),Je=(e,t)=>{var r={};for(var n in e)J.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&I)for(var n of I(e))t.indexOf(n)<0&&Q.call(e,n)&&(r[n]=e[n]);return r};function Qe(e,t,r={}){const n=r,{debounce:a=0}=n,u=Je(n,["debounce"]);return S(e,t,qe(ze({},u),{eventFilter:R(a)}))}function Xe(e){const t=o.shallowRef();return o.watchSyncEffect(()=>{t.value=e()}),o.readonly(t)}function Ye(e,t){return t==null?o.unref(e):o.unref(e)[t]}var Ze=Object.defineProperty,Ke=Object.defineProperties,ke=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,K=(e,t,r)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,De=(e,t)=>{for(var r in t||(t={}))Y.call(t,r)&&K(e,r,t[r]);if(E)for(var r of E(t))Z.call(t,r)&&K(e,r,t[r]);return e},xe=(e,t)=>Ke(e,ke(t)),et=(e,t)=>{var r={};for(var n in e)Y.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&E)for(var n of E(e))t.indexOf(n)<0&&Z.call(e,n)&&(r[n]=e[n]);return r};function tt(e,t,r={}){const n=r,{eventFilter:a=F}=n,u=et(n,["eventFilter"]),l=$(a,t);let c,d,_;if(u.flush==="sync"){const p=o.ref(!1);d=()=>{},c=f=>{p.value=!0,f(),p.value=!1},_=o.watch(e,(...f)=>{p.value||l(...f)},u)}else{const p=[],f=o.ref(0),s=o.ref(0);d=()=>{f.value=s.value},p.push(o.watch(e,()=>{s.value++},xe(De({},u),{flush:"sync"}))),c=v=>{const y=s.value;v(),f.value+=s.value-y},p.push(o.watch(e,(...v)=>{const y=f.value>0&&f.value===s.value;f.value=0,s.value=0,!y&&l(...v)},u)),_=()=>{p.forEach(v=>v())}}return{stop:_,ignoreUpdates:c,ignorePrevAsyncUpdates:d}}function rt(e){return o.unref(e)!=null}var nt=Object.defineProperty,k=Object.getOwnPropertySymbols,ot=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,D=(e,t,r)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,it=(e,t)=>{for(var r in t||(t={}))ot.call(t,r)&&D(e,r,t[r]);if(k)for(var r of k(t))at.call(t,r)&&D(e,r,t[r]);return e};function ut(e,t){if(typeof Symbol!="undefined"){const r=it({},e);return Object.defineProperty(r,Symbol.iterator,{enumerable:!1,value(){let n=0;return{next:()=>({value:t[n++],done:n>t.length})}}}),r}else return Object.assign([...t],e)}function lt(e){return o.computed(()=>!o.unref(e))}function ct(...e){return o.computed(()=>e.some(t=>o.unref(t)))}var ft=Object.defineProperty,st=Object.defineProperties,pt=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,te=(e,t,r)=>t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dt=(e,t)=>{for(var r in t||(t={}))x.call(t,r)&&te(e,r,t[r]);if(T)for(var r of T(t))ee.call(t,r)&&te(e,r,t[r]);return e},_t=(e,t)=>st(e,pt(t)),vt=(e,t)=>{var r={};for(var n in e)x.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&T)for(var n of T(e))t.indexOf(n)<0&&ee.call(e,n)&&(r[n]=e[n]);return r};function yt(e,t,r={}){const n=r,{eventFilter:a}=n,u=vt(n,["eventFilter"]),{eventFilter:l,pause:c,resume:d,isActive:_}=G(a);return{stop:S(e,t,_t(dt({},u),{eventFilter:l})),pause:c,resume:d,isActive:_}}function Ot(e,t={}){let r=[];if(Array.isArray(t))r=t;else{const{includeOwnProperties:n=!0}=t;r.push(...Object.keys(e)),n&&r.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(r.map(n=>{const a=e[n];return[n,typeof a=="function"?A(a.bind(e)):a]}))}function ht(e,...t){return o.reactive(Object.fromEntries(t.map(r=>[r,o.toRef(e,r)])))}function wt(e,t){return o.computed({get(){var r;return(r=e.value)!=null?r:t},set(r){e.value=r}})}function Pt(...e){if(e.length===2){const[t,r]=e;t.value=r}if(e.length===3)if(o.isVue2)o.set(...e);else{const[t,r,n]=e;t[r]=n}}function gt(e,t,{flush:r="sync",deep:n=!1,immediate:a=!0}={}){return Array.isArray(t)||(t=[t]),o.watch(e,u=>t.forEach(l=>l.value=u),{flush:r,deep:n,immediate:a})}function re(e,t=200,r=!0,n=!0){return $(W(t,r,n),e)}function ne(e,t=200,r=!0,n=!0){if(t<=0)return e;const a=o.ref(e.value),u=re(()=>{a.value=e.value},t,r,n);return o.watch(e,()=>u()),a}var mt=Object.defineProperty,bt=Object.defineProperties,$t=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable,ie=(e,t,r)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,St=(e,t)=>{for(var r in t||(t={}))oe.call(t,r)&&ie(e,r,t[r]);if(V)for(var r of V(t))ae.call(t,r)&&ie(e,r,t[r]);return e},jt=(e,t)=>bt(e,$t(t)),Ft=(e,t)=>{var r={};for(var n in e)oe.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&V)for(var n of V(e))t.indexOf(n)<0&&ae.call(e,n)&&(r[n]=e[n]);return r};function It(e,t,r={}){const n=r,{throttle:a=0,trailing:u=!0,leading:l=!0}=n,c=Ft(n,["throttle","trailing","leading"]);return S(e,t,jt(St({},c),{eventFilter:W(a,u,l)}))}function Et(e){if(!o.isRef(e))return o.reactive(e);const t=new Proxy({},{get(r,n,a){return Reflect.get(e.value,n,a)},set(r,n,a){return e.value[n]=a,!0},deleteProperty(r,n){return Reflect.deleteProperty(e.value,n)},has(r,n){return Reflect.has(e.value,n)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return o.reactive(t)}var Tt=Object.defineProperty,Vt=Object.defineProperties,Ct=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,le=(e,t,r)=>t in e?Tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Rt=(e,t)=>{for(var r in t||(t={}))At.call(t,r)&&le(e,r,t[r]);if(ue)for(var r of ue(t))Nt.call(t,r)&&le(e,r,t[r]);return e},Wt=(e,t)=>Vt(e,Ct(t));function Mt(e){if(!o.isRef(e))return o.toRefs(e);const t=Array.isArray(e.value)?new Array(e.value.length):{};for(const r in e.value)t[r]=o.customRef(()=>({get(){return e.value[r]},set(n){if(Array.isArray(e.value)){const a=[...e.value];a[r]=n,e.value=a}else e.value=Wt(Rt({},e.value),{[r]:n})}}));return t}function Ut(e){o.getCurrentInstance()&&o.onBeforeUnmount(e)}function Bt(e,t=!0){o.getCurrentInstance()?o.onMounted(e):t?e():o.nextTick(e)}function Gt(e){o.getCurrentInstance()&&o.onUnmounted(e)}function Lt(e){let t=!1;function r(f,{flush:s="sync",deep:v=!1,timeout:y,throwOnTimeout:C}={}){let P=null;const ye=[new Promise(ur=>{P=o.watch(e,lr=>{f(lr)===!t&&(P==null||P(),ur())},{flush:s,deep:v,immediate:!0})})];return y&&ye.push(L(y,C).finally(()=>{P==null||P()})),Promise.race(ye)}function n(f,s){return r(v=>v===o.unref(f),s)}function a(f){return r(s=>Boolean(s),f)}function u(f){return n(null,f)}function l(f){return n(void 0,f)}function c(f){return r(Number.isNaN,f)}function d(f,s){return r(v=>{const y=Array.from(v);return y.includes(f)||y.includes(o.unref(f))},s)}function _(f){return p(1,f)}function p(f=1,s){let v=-1;return r(()=>(v+=1,v>=f),s)}return Array.isArray(o.unref(e))?{toMatch:r,toContains:d,changed:_,changedTimes:p,get not(){return t=!t,this}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:u,toBeNaN:c,toBeUndefined:l,changed:_,changedTimes:p,get not(){return t=!t,this}}}function Ht(e=0,t={}){const r=o.ref(e),{max:n=1/0,min:a=-1/0}=t,u=(p=1)=>r.value=Math.min(n,r.value+p),l=(p=1)=>r.value=Math.max(a,r.value-p),c=()=>r.value,d=p=>r.value=p;return{count:r,inc:u,dec:l,get:c,set:d,reset:(p=e)=>(e=p,d(p))}}function ce(e,t=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let u=null;const l=o.ref(!1);function c(){u&&(clearInterval(u),u=null)}function d(){l.value=!1,c()}function _(){t<=0||(l.value=!0,a&&e(),c(),u=setInterval(e,t))}return n&&N&&_(),j(d),{isActive:l,pause:d,resume:_}}var zt=Object.defineProperty,fe=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,se=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Qt=(e,t)=>{for(var r in t||(t={}))qt.call(t,r)&&se(e,r,t[r]);if(fe)for(var r of fe(t))Jt.call(t,r)&&se(e,r,t[r]);return e};function Xt(e=1e3,t={}){const{controls:r=!1,immediate:n=!0}=t,a=o.ref(0),u=ce(()=>a.value+=1,e,{immediate:n});return r?Qt({counter:a},u):a}function Yt(e,t={}){var r;const n=o.ref((r=t.initialValue)!=null?r:null);return o.watch(e,()=>n.value=U(),t),n}function pe(e,t,r={}){const{immediate:n=!0}=r,a=o.ref(!1);let u=null;function l(){u&&(clearTimeout(u),u=null)}function c(){a.value=!1,l()}function d(..._){l(),a.value=!0,u=setTimeout(()=>{a.value=!1,u=null,e(..._)},o.unref(t))}return n&&(a.value=!0,N&&d()),j(c),{isPending:a,start:d,stop:c}}var Zt=Object.defineProperty,de=Object.getOwnPropertySymbols,Kt=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,_e=(e,t,r)=>t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dt=(e,t)=>{for(var r in t||(t={}))Kt.call(t,r)&&_e(e,r,t[r]);if(de)for(var r of de(t))kt.call(t,r)&&_e(e,r,t[r]);return e};function xt(e=1e3,t={}){const{controls:r=!1}=t,n=pe(B,e,t),a=o.computed(()=>!n.isPending.value);return r?Dt({ready:a},n):a}function er(e=!1){if(o.isRef(e))return t=>{e.value=typeof t=="boolean"?t:!e.value};{const t=o.ref(e);return[t,n=>{t.value=typeof n=="boolean"?n:!t.value}]}}var ve=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,nr=(e,t)=>{var r={};for(var n in e)tr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ve)for(var n of ve(e))t.indexOf(n)<0&&rr.call(e,n)&&(r[n]=e[n]);return r};function or(e,t,r){const n=r,{count:a}=n,u=nr(n,["count"]),l=o.ref(0),c=S(e,(...d)=>{l.value+=1,l.value>=o.unref(a)&&c(),t(...d)},u);return{count:l,stop:c}}function ar(e,t,r){const n=o.watch(e,(...a)=>(n(),t(...a)),r)}function ir(e,t,r){return o.watch(e,(n,a,u)=>{n&&t(n,a,u)},r)}i.and=O,i.assert=ge,i.biSyncRef=b,i.bypassFilter=F,i.clamp=Ee,i.containsProp=Ne,i.controlledComputed=g,i.controlledRef=m,i.createEventHook=Oe,i.createFilterWrapper=$,i.createGlobalState=he,i.createReactiveFn=A,i.createSharedComposable=we,i.createSingletonPromise=Ce,i.debounceFilter=R,i.debouncedRef=z,i.debouncedWatch=Qe,i.eagerComputed=Xe,i.extendRef=w,i.get=Ye,i.identity=Ve,i.ignorableWatch=tt,i.increaseWithUnit=Re,i.invoke=Ae,i.isBoolean=me,i.isClient=N,i.isDef=Pe,i.isDefined=rt,i.isFunction=be,i.isNumber=$e,i.isObject=je,i.isString=Se,i.isWindow=Fe,i.makeDestructurable=ut,i.noop=B,i.not=lt,i.now=Ie,i.objectPick=We,i.or=ct,i.pausableFilter=G,i.pausableWatch=yt,i.promiseTimeout=L,i.rand=Te,i.reactify=A,i.reactifyObject=Ot,i.reactivePick=ht,i.refDefault=wt,i.set=Pt,i.syncRef=gt,i.throttleFilter=W,i.throttledRef=ne,i.throttledWatch=It,i.timestamp=U,i.toReactive=Et,i.toRefs=Mt,i.tryOnBeforeUnmount=Ut,i.tryOnMounted=Bt,i.tryOnScopeDispose=j,i.tryOnUnmounted=Gt,i.until=Lt,i.useCounter=Ht,i.useDebounce=z,i.useDebounceFn=H,i.useInterval=Xt,i.useIntervalFn=ce,i.useLastChanged=Yt,i.useThrottle=ne,i.useThrottleFn=re,i.useTimeout=xt,i.useTimeoutFn=pe,i.useToggle=er,i.watchAtMost=or,i.watchOnce=ar,i.watchWithFilter=S,i.whenever=ir,Object.defineProperty(i,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi); | ||
(function(i){if(!i.VueDemi){var o={},O=i.Vue;if(O)if(O.version.slice(0,2)==="2."){var m=i.VueCompositionAPI;if(m){for(var g in m)o[g]=m[g];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=O,o.Vue2=O,o.version=O.version}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 g in O)o[g]=O[g];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=O,o.Vue2=void 0,o.version=O.version,o.set=function(h,w,b){return Array.isArray(h)?(h.length=Math.max(h.length,w),h.splice(w,1,b),b):(h[w]=b,b)},o.del=function(h,w){if(Array.isArray(h)){h.splice(w,1);return}delete h[w]}}else console.error("[vue-demi] Vue version "+O.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");i.VueDemi=o}})(window),function(i,o){"use strict";function O(...e){return o.computed(()=>e.every(t=>o.unref(t)))}function m(e,t){const r="sync",n=o.watch(e,u=>{t.value=u},{flush:r,immediate:!0}),a=o.watch(t,u=>{e.value=u},{flush:r,immediate:!0});return()=>{n(),a()}}function g(e,t){let r,n,a;const u=o.ref(!0);return o.watch(e,()=>{u.value=!0,a()},{flush:"sync"}),o.customRef((l,c)=>(n=l,a=c,{get(){return u.value&&(r=t(),u.value=!1),n(),r},set(){}}))}function h(e="this function"){if(!o.isVue3)throw new Error(`[VueUse] ${e} is only works on Vue 3.`)}function w(e,t,{enumerable:r=!1,unwrap:n=!0}={}){h();for(const[a,u]of Object.entries(t))a!=="value"&&(o.isRef(u)&&n?Object.defineProperty(e,a,{get(){return u.value},set(l){u.value=l},enumerable:r}):Object.defineProperty(e,a,{value:u,enumerable:r}));return e}function b(e,t={}){let r=e,n,a;const u=o.customRef((s,v)=>(n=s,a=v,{get(){return l()},set(y){c(y)}}));function l(s=!0){return s&&n(),r}function c(s,v=!0){var y,C;if(s===r)return;const P=r;((y=t.onBeforeChange)==null?void 0:y.call(t,s,P))!==!1&&(r=s,(C=t.onChanged)==null||C.call(t,s,P),v&&a())}return w(u,{get:l,set:c,untrackedGet:()=>l(!1),silentSet:s=>c(s,!1),peek:()=>l(!1),lay:s=>c(s,!1)},{enumerable:!0})}function Oe(){const e=[],t=a=>{const u=e.indexOf(a);u!==-1&&e.splice(u,1)};return{on:a=>(e.push(a),{off:()=>t(a)}),off:t,trigger:a=>{e.forEach(u=>u(a))}}}function he(e){let t=!1,r;const n=o.effectScope(!0);return()=>(t||(r=n.run(e),t=!0),r)}function A(e){return function(...t){return o.computed(()=>e.apply(this,t.map(r=>o.unref(r))))}}function j(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function we(e){let t=0,r,n;const a=()=>{t-=1,n&&t<=0&&(n.stop(),r=void 0,n=void 0)};return(...u)=>(t+=1,r||(n=o.effectScope(!0),r=n.run(()=>e(...u))),j(a),r)}const N=typeof window!="undefined",Pe=e=>typeof e!="undefined",ge=(e,...t)=>{e||console.warn(...t)},M=Object.prototype.toString,be=e=>typeof e=="boolean",me=e=>typeof e=="function",$e=e=>typeof e=="number",Se=e=>typeof e=="string",je=e=>M.call(e)==="[object Object]",Fe=e=>typeof window!="undefined"&&M.call(e)==="[object Window]",Te=()=>Date.now(),U=()=>+Date.now(),Ie=(e,t,r)=>Math.min(r,Math.max(t,e)),B=()=>{},Ee=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function $(e,t){function r(...n){e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})}return r}const F=e=>e();function R(e,t={}){let r,n;return u=>{const l=o.unref(e),c=o.unref(t.maxWait);if(r&&clearTimeout(r),l<=0||c!==void 0&&c<=0)return n&&(clearTimeout(n),n=null),u();c&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,u()},c)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,u()},l)}}function W(e,t=!0,r=!0){let n=0,a,u=!r;const l=()=>{a&&(clearTimeout(a),a=void 0)};return d=>{const _=o.unref(e),p=Date.now()-n;if(l(),_<=0)return n=Date.now(),d();p>_&&(n=Date.now(),u?u=!1:d()),t&&(a=setTimeout(()=>{n=Date.now(),r||(u=!0),l(),d()},_)),!r&&!a&&(a=setTimeout(()=>u=!0,_))}}function G(e=F){const t=o.ref(!0);function r(){t.value=!1}function n(){t.value=!0}return{isActive:t,pause:r,resume:n,eventFilter:(...u)=>{t.value&&e(...u)}}}function L(e,t=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(t?()=>a(r):n,e)})}function Ve(e){return e}function Ce(e){let t;function r(){return t||(t=e()),t}return r.reset=async()=>{const n=t;t=void 0,n&&await n},r}function Ae(e){return e()}function Ne(e,...t){return t.some(r=>r in e)}function Re(e,t){var r;if(typeof e=="number")return e+t;const n=((r=e.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:r[0])||"",a=e.slice(n.length),u=parseFloat(n)+t;return Number.isNaN(u)?e:u+a}function We(e,t,r=!1){return t.reduce((n,a)=>(a in e&&(!r||!e[a]===void 0)&&(n[a]=e[a]),n),{})}function H(e,t=200,r={}){return $(R(t,r),e)}function z(e,t=200,r={}){if(t<=0)return e;const n=o.ref(e.value),a=H(()=>{n.value=e.value},t,r);return o.watch(e,()=>a()),n}var q=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,Be=(e,t)=>{var r={};for(var n in e)Me.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&q)for(var n of q(e))t.indexOf(n)<0&&Ue.call(e,n)&&(r[n]=e[n]);return r};function S(e,t,r={}){const n=r,{eventFilter:a=F}=n,u=Be(n,["eventFilter"]);return o.watch(e,$(a,t),u)}var Ge=Object.defineProperty,Le=Object.defineProperties,He=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,X=(e,t,r)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ze=(e,t)=>{for(var r in t||(t={}))J.call(t,r)&&X(e,r,t[r]);if(T)for(var r of T(t))Q.call(t,r)&&X(e,r,t[r]);return e},qe=(e,t)=>Le(e,He(t)),Je=(e,t)=>{var r={};for(var n in e)J.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&T)for(var n of T(e))t.indexOf(n)<0&&Q.call(e,n)&&(r[n]=e[n]);return r};function Qe(e,t,r={}){const n=r,{debounce:a=0}=n,u=Je(n,["debounce"]);return S(e,t,qe(ze({},u),{eventFilter:R(a)}))}function Xe(e){const t=o.shallowRef();return o.watchSyncEffect(()=>{t.value=e()}),o.readonly(t)}function Ye(e,t){return t==null?o.unref(e):o.unref(e)[t]}var Ze=Object.defineProperty,Ke=Object.defineProperties,ke=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,K=(e,t,r)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,De=(e,t)=>{for(var r in t||(t={}))Y.call(t,r)&&K(e,r,t[r]);if(I)for(var r of I(t))Z.call(t,r)&&K(e,r,t[r]);return e},xe=(e,t)=>Ke(e,ke(t)),et=(e,t)=>{var r={};for(var n in e)Y.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&I)for(var n of I(e))t.indexOf(n)<0&&Z.call(e,n)&&(r[n]=e[n]);return r};function tt(e,t,r={}){const n=r,{eventFilter:a=F}=n,u=et(n,["eventFilter"]),l=$(a,t);let c,d,_;if(u.flush==="sync"){const p=o.ref(!1);d=()=>{},c=f=>{p.value=!0,f(),p.value=!1},_=o.watch(e,(...f)=>{p.value||l(...f)},u)}else{const p=[],f=o.ref(0),s=o.ref(0);d=()=>{f.value=s.value},p.push(o.watch(e,()=>{s.value++},xe(De({},u),{flush:"sync"}))),c=v=>{const y=s.value;v(),f.value+=s.value-y},p.push(o.watch(e,(...v)=>{const y=f.value>0&&f.value===s.value;f.value=0,s.value=0,!y&&l(...v)},u)),_=()=>{p.forEach(v=>v())}}return{stop:_,ignoreUpdates:c,ignorePrevAsyncUpdates:d}}function rt(e){return o.unref(e)!=null}var nt=Object.defineProperty,k=Object.getOwnPropertySymbols,ot=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,D=(e,t,r)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,it=(e,t)=>{for(var r in t||(t={}))ot.call(t,r)&&D(e,r,t[r]);if(k)for(var r of k(t))at.call(t,r)&&D(e,r,t[r]);return e};function ut(e,t){if(typeof Symbol!="undefined"){const r=it({},e);return Object.defineProperty(r,Symbol.iterator,{enumerable:!1,value(){let n=0;return{next:()=>({value:t[n++],done:n>t.length})}}}),r}else return Object.assign([...t],e)}function lt(e){return o.computed(()=>!o.unref(e))}function ct(...e){return o.computed(()=>e.some(t=>o.unref(t)))}var ft=Object.defineProperty,st=Object.defineProperties,pt=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,te=(e,t,r)=>t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dt=(e,t)=>{for(var r in t||(t={}))x.call(t,r)&&te(e,r,t[r]);if(E)for(var r of E(t))ee.call(t,r)&&te(e,r,t[r]);return e},_t=(e,t)=>st(e,pt(t)),vt=(e,t)=>{var r={};for(var n in e)x.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&E)for(var n of E(e))t.indexOf(n)<0&&ee.call(e,n)&&(r[n]=e[n]);return r};function yt(e,t,r={}){const n=r,{eventFilter:a}=n,u=vt(n,["eventFilter"]),{eventFilter:l,pause:c,resume:d,isActive:_}=G(a);return{stop:S(e,t,_t(dt({},u),{eventFilter:l})),pause:c,resume:d,isActive:_}}function Ot(e,t={}){let r=[];if(Array.isArray(t))r=t;else{const{includeOwnProperties:n=!0}=t;r.push(...Object.keys(e)),n&&r.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(r.map(n=>{const a=e[n];return[n,typeof a=="function"?A(a.bind(e)):a]}))}function ht(e,...t){return o.reactive(Object.fromEntries(t.map(r=>[r,o.toRef(e,r)])))}function wt(e,t){return o.computed({get(){var r;return(r=e.value)!=null?r:t},set(r){e.value=r}})}function Pt(...e){if(e.length===2){const[t,r]=e;t.value=r}if(e.length===3)if(o.isVue2)o.set(...e);else{const[t,r,n]=e;t[r]=n}}function gt(e,t,{flush:r="sync",deep:n=!1,immediate:a=!0}={}){return Array.isArray(t)||(t=[t]),o.watch(e,u=>t.forEach(l=>l.value=u),{flush:r,deep:n,immediate:a})}function re(e,t=200,r=!0,n=!0){return $(W(t,r,n),e)}function ne(e,t=200,r=!0,n=!0){if(t<=0)return e;const a=o.ref(e.value),u=re(()=>{a.value=e.value},t,r,n);return o.watch(e,()=>u()),a}var bt=Object.defineProperty,mt=Object.defineProperties,$t=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable,ie=(e,t,r)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,St=(e,t)=>{for(var r in t||(t={}))oe.call(t,r)&&ie(e,r,t[r]);if(V)for(var r of V(t))ae.call(t,r)&&ie(e,r,t[r]);return e},jt=(e,t)=>mt(e,$t(t)),Ft=(e,t)=>{var r={};for(var n in e)oe.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&V)for(var n of V(e))t.indexOf(n)<0&&ae.call(e,n)&&(r[n]=e[n]);return r};function Tt(e,t,r={}){const n=r,{throttle:a=0,trailing:u=!0,leading:l=!0}=n,c=Ft(n,["throttle","trailing","leading"]);return S(e,t,jt(St({},c),{eventFilter:W(a,u,l)}))}function It(e){if(!o.isRef(e))return o.reactive(e);const t=new Proxy({},{get(r,n,a){return Reflect.get(e.value,n,a)},set(r,n,a){return e.value[n]=a,!0},deleteProperty(r,n){return Reflect.deleteProperty(e.value,n)},has(r,n){return Reflect.has(e.value,n)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return o.reactive(t)}var Et=Object.defineProperty,Vt=Object.defineProperties,Ct=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,le=(e,t,r)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Rt=(e,t)=>{for(var r in t||(t={}))At.call(t,r)&&le(e,r,t[r]);if(ue)for(var r of ue(t))Nt.call(t,r)&&le(e,r,t[r]);return e},Wt=(e,t)=>Vt(e,Ct(t));function Mt(e){if(!o.isRef(e))return o.toRefs(e);const t=Array.isArray(e.value)?new Array(e.value.length):{};for(const r in e.value)t[r]=o.customRef(()=>({get(){return e.value[r]},set(n){if(Array.isArray(e.value)){const a=[...e.value];a[r]=n,e.value=a}else e.value=Wt(Rt({},e.value),{[r]:n})}}));return t}function Ut(e){o.getCurrentInstance()&&o.onBeforeUnmount(e)}function Bt(e,t=!0){o.getCurrentInstance()?o.onMounted(e):t?e():o.nextTick(e)}function Gt(e){o.getCurrentInstance()&&o.onUnmounted(e)}function Lt(e){let t=!1;function r(f,{flush:s="sync",deep:v=!1,timeout:y,throwOnTimeout:C}={}){let P=null;const ye=[new Promise(ur=>{P=o.watch(e,lr=>{f(lr)===!t&&(P==null||P(),ur())},{flush:s,deep:v,immediate:!0})})];return y&&ye.push(L(y,C).finally(()=>{P==null||P()})),Promise.race(ye)}function n(f,s){return r(v=>v===o.unref(f),s)}function a(f){return r(s=>Boolean(s),f)}function u(f){return n(null,f)}function l(f){return n(void 0,f)}function c(f){return r(Number.isNaN,f)}function d(f,s){return r(v=>{const y=Array.from(v);return y.includes(f)||y.includes(o.unref(f))},s)}function _(f){return p(1,f)}function p(f=1,s){let v=-1;return r(()=>(v+=1,v>=f),s)}return Array.isArray(o.unref(e))?{toMatch:r,toContains:d,changed:_,changedTimes:p,get not(){return t=!t,this}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:u,toBeNaN:c,toBeUndefined:l,changed:_,changedTimes:p,get not(){return t=!t,this}}}function Ht(e=0,t={}){const r=o.ref(e),{max:n=1/0,min:a=-1/0}=t,u=(p=1)=>r.value=Math.min(n,r.value+p),l=(p=1)=>r.value=Math.max(a,r.value-p),c=()=>r.value,d=p=>r.value=p;return{count:r,inc:u,dec:l,get:c,set:d,reset:(p=e)=>(e=p,d(p))}}function ce(e,t=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let u=null;const l=o.ref(!1);function c(){u&&(clearInterval(u),u=null)}function d(){l.value=!1,c()}function _(){t<=0||(l.value=!0,a&&e(),c(),u=setInterval(e,t))}return n&&N&&_(),j(d),{isActive:l,pause:d,resume:_}}var zt=Object.defineProperty,fe=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,se=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Qt=(e,t)=>{for(var r in t||(t={}))qt.call(t,r)&&se(e,r,t[r]);if(fe)for(var r of fe(t))Jt.call(t,r)&&se(e,r,t[r]);return e};function Xt(e=1e3,t={}){const{controls:r=!1,immediate:n=!0}=t,a=o.ref(0),u=ce(()=>a.value+=1,e,{immediate:n});return r?Qt({counter:a},u):a}function Yt(e,t={}){var r;const n=o.ref((r=t.initialValue)!=null?r:null);return o.watch(e,()=>n.value=U(),t),n}function pe(e,t,r={}){const{immediate:n=!0}=r,a=o.ref(!1);let u=null;function l(){u&&(clearTimeout(u),u=null)}function c(){a.value=!1,l()}function d(..._){l(),a.value=!0,u=setTimeout(()=>{a.value=!1,u=null,e(..._)},o.unref(t))}return n&&(a.value=!0,N&&d()),j(c),{isPending:a,start:d,stop:c}}var Zt=Object.defineProperty,de=Object.getOwnPropertySymbols,Kt=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,_e=(e,t,r)=>t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dt=(e,t)=>{for(var r in t||(t={}))Kt.call(t,r)&&_e(e,r,t[r]);if(de)for(var r of de(t))kt.call(t,r)&&_e(e,r,t[r]);return e};function xt(e=1e3,t={}){const{controls:r=!1}=t,n=pe(B,e,t),a=o.computed(()=>!n.isPending.value);return r?Dt({ready:a},n):a}function er(e=!1){if(o.isRef(e))return t=>{e.value=typeof t=="boolean"?t:!e.value};{const t=o.ref(e);return[t,n=>{t.value=typeof n=="boolean"?n:!t.value}]}}var ve=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,nr=(e,t)=>{var r={};for(var n in e)tr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ve)for(var n of ve(e))t.indexOf(n)<0&&rr.call(e,n)&&(r[n]=e[n]);return r};function or(e,t,r){const n=r,{count:a}=n,u=nr(n,["count"]),l=o.ref(0),c=S(e,(...d)=>{l.value+=1,l.value>=o.unref(a)&&o.nextTick(()=>c()),t(...d)},u);return{count:l,stop:c}}function ar(e,t,r){const n=o.watch(e,(...a)=>(o.nextTick(()=>n()),t(...a)),r)}function ir(e,t,r){return o.watch(e,(n,a,u)=>{n&&t(n,a,u)},r)}i.and=O,i.assert=ge,i.biSyncRef=m,i.bypassFilter=F,i.clamp=Ie,i.containsProp=Ne,i.controlledComputed=g,i.controlledRef=b,i.createEventHook=Oe,i.createFilterWrapper=$,i.createGlobalState=he,i.createReactiveFn=A,i.createSharedComposable=we,i.createSingletonPromise=Ce,i.debounceFilter=R,i.debouncedRef=z,i.debouncedWatch=Qe,i.eagerComputed=Xe,i.extendRef=w,i.get=Ye,i.identity=Ve,i.ignorableWatch=tt,i.increaseWithUnit=Re,i.invoke=Ae,i.isBoolean=be,i.isClient=N,i.isDef=Pe,i.isDefined=rt,i.isFunction=me,i.isNumber=$e,i.isObject=je,i.isString=Se,i.isWindow=Fe,i.makeDestructurable=ut,i.noop=B,i.not=lt,i.now=Te,i.objectPick=We,i.or=ct,i.pausableFilter=G,i.pausableWatch=yt,i.promiseTimeout=L,i.rand=Ee,i.reactify=A,i.reactifyObject=Ot,i.reactivePick=ht,i.refDefault=wt,i.set=Pt,i.syncRef=gt,i.throttleFilter=W,i.throttledRef=ne,i.throttledWatch=Tt,i.timestamp=U,i.toReactive=It,i.toRefs=Mt,i.tryOnBeforeUnmount=Ut,i.tryOnMounted=Bt,i.tryOnScopeDispose=j,i.tryOnUnmounted=Gt,i.until=Lt,i.useCounter=Ht,i.useDebounce=z,i.useDebounceFn=H,i.useInterval=Xt,i.useIntervalFn=ce,i.useLastChanged=Yt,i.useThrottle=ne,i.useThrottleFn=re,i.useTimeout=xt,i.useTimeoutFn=pe,i.useToggle=er,i.watchAtMost=or,i.watchOnce=ar,i.watchWithFilter=S,i.whenever=ir,Object.defineProperty(i,"__esModule",{value:!0})}(this.VueUse=this.VueUse||{},VueDemi); |
{ | ||
"name": "@vueuse/shared", | ||
"version": "7.5.4", | ||
"version": "7.5.5", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "vue", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
153893