@vue/reactivity 3.2.12 → 3.2.13
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/dist/reactivity.cjs.js +3 -2
- package/dist/reactivity.cjs.prod.js +3 -2
- package/dist/reactivity.esm-browser.js +3 -2
- package/dist/reactivity.esm-browser.prod.js +1 -1
- package/dist/reactivity.esm-bundler.js +3 -2
- package/dist/reactivity.global.js +3 -2
- package/dist/reactivity.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/reactivity.cjs.js
CHANGED
|
@@ -1084,7 +1084,8 @@ class ComputedRefImpl {
|
|
|
1084
1084
|
function computed(getterOrOptions, debugOptions) {
|
|
1085
1085
|
let getter;
|
|
1086
1086
|
let setter;
|
|
1087
|
-
|
|
1087
|
+
const onlyGetter = shared.isFunction(getterOrOptions);
|
|
1088
|
+
if (onlyGetter) {
|
|
1088
1089
|
getter = getterOrOptions;
|
|
1089
1090
|
setter = () => {
|
|
1090
1091
|
console.warn('Write operation failed: computed value is readonly');
|
|
@@ -1095,7 +1096,7 @@ function computed(getterOrOptions, debugOptions) {
|
|
|
1095
1096
|
getter = getterOrOptions.get;
|
|
1096
1097
|
setter = getterOrOptions.set;
|
|
1097
1098
|
}
|
|
1098
|
-
const cRef = new ComputedRefImpl(getter, setter,
|
|
1099
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
|
|
1099
1100
|
if (debugOptions) {
|
|
1100
1101
|
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1101
1102
|
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
@@ -1015,7 +1015,8 @@ class ComputedRefImpl {
|
|
|
1015
1015
|
function computed(getterOrOptions, debugOptions) {
|
|
1016
1016
|
let getter;
|
|
1017
1017
|
let setter;
|
|
1018
|
-
|
|
1018
|
+
const onlyGetter = shared.isFunction(getterOrOptions);
|
|
1019
|
+
if (onlyGetter) {
|
|
1019
1020
|
getter = getterOrOptions;
|
|
1020
1021
|
setter = shared.NOOP;
|
|
1021
1022
|
}
|
|
@@ -1023,7 +1024,7 @@ function computed(getterOrOptions, debugOptions) {
|
|
|
1023
1024
|
getter = getterOrOptions.get;
|
|
1024
1025
|
setter = getterOrOptions.set;
|
|
1025
1026
|
}
|
|
1026
|
-
const cRef = new ComputedRefImpl(getter, setter,
|
|
1027
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
|
|
1027
1028
|
return cRef;
|
|
1028
1029
|
}
|
|
1029
1030
|
|
|
@@ -1137,7 +1137,8 @@ class ComputedRefImpl {
|
|
|
1137
1137
|
function computed(getterOrOptions, debugOptions) {
|
|
1138
1138
|
let getter;
|
|
1139
1139
|
let setter;
|
|
1140
|
-
|
|
1140
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1141
|
+
if (onlyGetter) {
|
|
1141
1142
|
getter = getterOrOptions;
|
|
1142
1143
|
setter = () => {
|
|
1143
1144
|
console.warn('Write operation failed: computed value is readonly');
|
|
@@ -1148,7 +1149,7 @@ function computed(getterOrOptions, debugOptions) {
|
|
|
1148
1149
|
getter = getterOrOptions.get;
|
|
1149
1150
|
setter = getterOrOptions.set;
|
|
1150
1151
|
}
|
|
1151
|
-
const cRef = new ComputedRefImpl(getter, setter,
|
|
1152
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
|
|
1152
1153
|
if (debugOptions) {
|
|
1153
1154
|
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1154
1155
|
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),r=Array.isArray,c=t=>"[object Map]"===a(t),o=t=>"function"==typeof t,u=t=>"symbol"==typeof t,h=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,a=t=>l.call(t),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>!Object.is(t,e);let d;const p=[];class v{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&d&&(this.parent=d,this.index=(d.scopes||(d.scopes=[])).push(this)-1)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(p.push(this),d=this)}off(){this.active&&(p.pop(),d=p[p.length-1])}stop(t){if(this.active){if(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.scopes&&this.scopes.forEach((t=>t.stop(!0))),this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function g(t){return new v(t)}function y(t,e){(e=e||d)&&e.active&&e.effects.push(t)}function w(){return d}function b(t){d&&d.cleanups.push(t)}const R=t=>{const e=new Set(t);return e.w=0,e.n=0,e},k=t=>(t.w&S)>0,m=t=>(t.n&S)>0,j=new WeakMap;let O=0,S=1;const E=[];let x;const P=Symbol(""),M=Symbol("");class z{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],y(this,n)}run(){if(!this.active)return this.fn();if(!E.includes(this))try{return E.push(x=this),B(),S=1<<++O,O<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=S})(this):W(this),this.fn()}finally{O<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];k(i)&&!m(i)?i.delete(t):e[n++]=i,i.w&=~S,i.n&=~S}e.length=n}})(this),S=1<<--O,C(),E.pop();const t=E.length;x=t>0?E[t-1]:void 0}}stop(){this.active&&(W(this),this.onStop&&this.onStop(),this.active=!1)}}function W(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function A(t,e){t.effect&&(t=t.effect.fn);const s=new z(t);e&&(n(s,e),e.scope&&y(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i}function N(t){t.effect.stop()}let V=!0;const I=[];function K(){I.push(V),V=!1}function B(){I.push(V),V=!0}function C(){const t=I.pop();V=void 0===t||t}function L(t,e,n){if(!q())return;let s=j.get(t);s||j.set(t,s=new Map);let i=s.get(n);i||s.set(n,i=R()),D(i)}function q(){return V&&void 0!==x}function D(t,e){let n=!1;O<=30?m(t)||(t.n|=S,n=!k(t)):n=!t.has(x),n&&(t.add(x),x.deps.push(t))}function F(t,e,n,s,i,o){const u=j.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===n&&r(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&h.push(t)}));else switch(void 0!==n&&h.push(u.get(n)),e){case"add":r(t)?f(n)&&h.push(u.get("length")):(h.push(u.get(P)),c(t)&&h.push(u.get(M)));break;case"delete":r(t)||(h.push(u.get(P)),c(t)&&h.push(u.get(M)));break;case"set":c(t)&&h.push(u.get(P))}if(1===h.length)h[0]&&G(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);G(R(t))}}function G(t,e){for(const n of r(t)?t:[...t])(n!==x||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const H=t("__proto__,__v_isRef,__isVue"),J=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(u)),Q=$(),T=$(!1,!0),U=$(!0),X=$(!0,!0),Y=Z();function Z(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Dt(this);for(let e=0,i=this.length;e<i;e++)L(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Dt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){K();const n=Dt(this)[e].apply(this,t);return C(),n}})),t}function $(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&c===(t?e?Wt:zt:e?Mt:Pt).get(n))return n;const o=r(n);if(!t&&o&&i(Y,s))return Reflect.get(Y,s,c);const l=Reflect.get(n,s,c);if(u(s)?J.has(s):H(s))return l;if(t||L(n,0,s),e)return l;if(Qt(l)){return!o||!f(s)?l.value:l}return h(l)?t?It(l):Nt(l):l}}function tt(t=!1){return function(e,n,s,c){let o=e[n];if(!t&&(s=Dt(s),o=Dt(o),!r(e)&&Qt(o)&&!Qt(s)))return o.value=s,!0;const u=r(e)&&f(n)?Number(n)<e.length:i(e,n),h=Reflect.set(e,n,s,c);return e===Dt(c)&&(u?_(s,o)&&F(e,"set",n,s):F(e,"add",n,s)),h}}const et={get:Q,set:tt(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&F(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return u(e)&&J.has(e)||L(t,0,e),n},ownKeys:function(t){return L(t,0,r(t)?"length":P),Reflect.ownKeys(t)}},nt={get:U,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},st=n({},et,{get:T,set:tt(!0)}),it=n({},nt,{get:X}),rt=t=>h(t)?Nt(t):t,ct=t=>h(t)?It(t):t,ot=t=>t,ut=t=>Reflect.getPrototypeOf(t);function ht(t,e,n=!1,s=!1){const i=Dt(t=t.__v_raw),r=Dt(e);e!==r&&!n&&L(i,0,e),!n&&L(i,0,r);const{has:c}=ut(i),o=s?ot:n?ct:rt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function lt(t,e=!1){const n=this.__v_raw,s=Dt(n),i=Dt(t);return t!==i&&!e&&L(s,0,t),!e&&L(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function at(t,e=!1){return t=t.__v_raw,!e&&L(Dt(t),0,P),Reflect.get(t,"size",t)}function ft(t){t=Dt(t);const e=Dt(this);return ut(e).has.call(e,t)||(e.add(t),F(e,"add",t,t)),this}function _t(t,e){e=Dt(e);const n=Dt(this),{has:s,get:i}=ut(n);let r=s.call(n,t);r||(t=Dt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?_(e,c)&&F(n,"set",t,e):F(n,"add",t,e),this}function dt(t){const e=Dt(this),{has:n,get:s}=ut(e);let i=n.call(e,t);i||(t=Dt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&F(e,"delete",t,void 0),r}function pt(){const t=Dt(this),e=0!==t.size,n=t.clear();return e&&F(t,"clear",void 0,void 0),n}function vt(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Dt(r),o=e?ot:t?ct:rt;return!t&&L(c,0,P),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function gt(t,e,n){return function(...s){const i=this.__v_raw,r=Dt(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,l=i[t](...s),a=n?ot:e?ct:rt;return!e&&L(r,0,h?M:P),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[a(t[0]),a(t[1])]:a(t),done:e}},[Symbol.iterator](){return this}}}}function yt(t){return function(...e){return"delete"!==t&&this}}function wt(){const t={get(t){return ht(this,t)},get size(){return at(this)},has:lt,add:ft,set:_t,delete:dt,clear:pt,forEach:vt(!1,!1)},e={get(t){return ht(this,t,!1,!0)},get size(){return at(this)},has:lt,add:ft,set:_t,delete:dt,clear:pt,forEach:vt(!1,!0)},n={get(t){return ht(this,t,!0)},get size(){return at(this,!0)},has(t){return lt.call(this,t,!0)},add:yt("add"),set:yt("set"),delete:yt("delete"),clear:yt("clear"),forEach:vt(!0,!1)},s={get(t){return ht(this,t,!0,!0)},get size(){return at(this,!0)},has(t){return lt.call(this,t,!0)},add:yt("add"),set:yt("set"),delete:yt("delete"),clear:yt("clear"),forEach:vt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=gt(i,!1,!1),n[i]=gt(i,!0,!1),e[i]=gt(i,!1,!0),s[i]=gt(i,!0,!0)})),[t,n,e,s]}const[bt,Rt,kt,mt]=wt();function jt(t,e){const n=e?t?mt:kt:t?Rt:bt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const Ot={get:jt(!1,!1)},St={get:jt(!1,!0)},Et={get:jt(!0,!1)},xt={get:jt(!0,!0)},Pt=new WeakMap,Mt=new WeakMap,zt=new WeakMap,Wt=new WeakMap;function At(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>a(t).slice(8,-1))(t))}function Nt(t){return t&&t.__v_isReadonly?t:Bt(t,!1,et,Ot,Pt)}function Vt(t){return Bt(t,!1,st,St,Mt)}function It(t){return Bt(t,!0,nt,Et,zt)}function Kt(t){return Bt(t,!0,it,xt,Wt)}function Bt(t,e,n,s,i){if(!h(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=At(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function Ct(t){return Lt(t)?Ct(t.__v_raw):!(!t||!t.__v_isReactive)}function Lt(t){return!(!t||!t.__v_isReadonly)}function qt(t){return Ct(t)||Lt(t)}function Dt(t){const e=t&&t.__v_raw;return e?Dt(e):t}function Ft(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}function Gt(t){q()&&((t=Dt(t)).dep||(t.dep=R()),D(t.dep))}function Ht(t,e){(t=Dt(t)).dep&&G(t.dep)}const Jt=t=>h(t)?Nt(t):t;function Qt(t){return Boolean(t&&!0===t.__v_isRef)}function Tt(t){return Yt(t,!1)}function Ut(t){return Yt(t,!0)}class Xt{constructor(t,e){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Dt(t),this._value=e?t:Jt(t)}get value(){return Gt(this),this._value}set value(t){t=this._shallow?t:Dt(t),_(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:Jt(t),Ht(this))}}function Yt(t,e){return Qt(t)?t:new Xt(t,e)}function Zt(t){Ht(t)}function $t(t){return Qt(t)?t.value:t}const te={get:(t,e,n)=>$t(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Qt(i)&&!Qt(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};function ee(t){return Ct(t)?t:new Proxy(t,te)}class ne{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Gt(this)),(()=>Ht(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function se(t){return new ne(t)}function ie(t){const e=r(t)?new Array(t.length):{};for(const n in t)e[n]=ce(t,n);return e}class re{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}function ce(t,e){const n=t[e];return Qt(n)?n:new re(t,e)}class oe{constructor(t,e,n){this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.effect=new z(t,(()=>{this._dirty||(this._dirty=!0,Ht(this))})),this.__v_isReadonly=n}get value(){const t=Dt(this);return Gt(t),t._dirty&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function ue(t,n){let s,i;o(t)?(s=t,i=e):(s=t.get,i=t.set);return new oe(s,i,o(t)||!t.set)}var he;const le=Promise.resolve(),ae=[];let fe=!1;const _e=()=>{for(let t=0;t<ae.length;t++)ae[t]();ae.length=0,fe=!1};class de{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[he]=!0;let n=!1,s=!1;this.effect=new z(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,ae.push((()=>{this.effect.active&&this._get()!==t&&Ht(this),s=!1})),fe||(fe=!0,le.then(_e))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=!0}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Gt(this),Dt(this)._get()}}function pe(t){return new de(t)}he="__v_isReadonly";export{v as EffectScope,P as ITERATE_KEY,z as ReactiveEffect,ue as computed,se as customRef,pe as deferredComputed,A as effect,g as effectScope,B as enableTracking,w as getCurrentScope,qt as isProxy,Ct as isReactive,Lt as isReadonly,Qt as isRef,Ft as markRaw,b as onScopeDispose,K as pauseTracking,ee as proxyRefs,Nt as reactive,It as readonly,Tt as ref,C as resetTracking,Vt as shallowReactive,Kt as shallowReadonly,Ut as shallowRef,N as stop,Dt as toRaw,ce as toRef,ie as toRefs,L as track,F as trigger,Zt as triggerRef,$t as unref};
|
|
1
|
+
function t(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"symbol"==typeof t,u=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),a=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,f=(t,e)=>!Object.is(t,e);let _;const d=[];class p{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&_&&(this.parent=_,this.index=(_.scopes||(_.scopes=[])).push(this)-1)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(d.push(this),_=this)}off(){this.active&&(d.pop(),_=d[d.length-1])}stop(t){if(this.active){if(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.scopes&&this.scopes.forEach((t=>t.stop(!0))),this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function v(t){return new p(t)}function g(t,e){(e=e||_)&&e.active&&e.effects.push(t)}function y(){return _}function w(t){_&&_.cleanups.push(t)}const b=t=>{const e=new Set(t);return e.w=0,e.n=0,e},R=t=>(t.w&O)>0,k=t=>(t.n&O)>0,m=new WeakMap;let j=0,O=1;const S=[];let E;const x=Symbol(""),P=Symbol("");class M{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],g(this,n)}run(){if(!this.active)return this.fn();if(!S.includes(this))try{return S.push(E=this),K(),O=1<<++j,j<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=O})(this):z(this),this.fn()}finally{j<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];R(i)&&!k(i)?i.delete(t):e[n++]=i,i.w&=~O,i.n&=~O}e.length=n}})(this),O=1<<--j,B(),S.pop();const t=S.length;E=t>0?S[t-1]:void 0}}stop(){this.active&&(z(this),this.onStop&&this.onStop(),this.active=!1)}}function z(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function W(t,e){t.effect&&(t=t.effect.fn);const s=new M(t);e&&(n(s,e),e.scope&&g(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i}function A(t){t.effect.stop()}let N=!0;const V=[];function I(){V.push(N),N=!1}function K(){V.push(N),N=!0}function B(){const t=V.pop();N=void 0===t||t}function C(t,e,n){if(!L())return;let s=m.get(t);s||m.set(t,s=new Map);let i=s.get(n);i||s.set(n,i=b()),q(i)}function L(){return N&&void 0!==E}function q(t,e){let n=!1;j<=30?k(t)||(t.n|=O,n=!R(t)):n=!t.has(E),n&&(t.add(E),E.deps.push(t))}function D(t,e,n,s,i,o){const u=m.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===n&&r(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&h.push(t)}));else switch(void 0!==n&&h.push(u.get(n)),e){case"add":r(t)?a(n)&&h.push(u.get("length")):(h.push(u.get(x)),c(t)&&h.push(u.get(P)));break;case"delete":r(t)||(h.push(u.get(x)),c(t)&&h.push(u.get(P)));break;case"set":c(t)&&h.push(u.get(x))}if(1===h.length)h[0]&&F(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);F(b(t))}}function F(t,e){for(const n of r(t)?t:[...t])(n!==E||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const G=t("__proto__,__v_isRef,__isVue"),H=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(o)),J=Z(),Q=Z(!1,!0),T=Z(!0),U=Z(!0,!0),X=Y();function Y(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=qt(this);for(let e=0,i=this.length;e<i;e++)C(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(qt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){I();const n=qt(this)[e].apply(this,t);return B(),n}})),t}function Z(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&c===(t?e?zt:Mt:e?Pt:xt).get(n))return n;const h=r(n);if(!t&&h&&i(X,s))return Reflect.get(X,s,c);const l=Reflect.get(n,s,c);if(o(s)?H.has(s):G(s))return l;if(t||C(n,0,s),e)return l;if(Jt(l)){return!h||!a(s)?l.value:l}return u(l)?t?Vt(l):At(l):l}}function $(t=!1){return function(e,n,s,c){let o=e[n];if(!t&&(s=qt(s),o=qt(o),!r(e)&&Jt(o)&&!Jt(s)))return o.value=s,!0;const u=r(e)&&a(n)?Number(n)<e.length:i(e,n),h=Reflect.set(e,n,s,c);return e===qt(c)&&(u?f(s,o)&&D(e,"set",n,s):D(e,"add",n,s)),h}}const tt={get:J,set:$(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&D(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return o(e)&&H.has(e)||C(t,0,e),n},ownKeys:function(t){return C(t,0,r(t)?"length":x),Reflect.ownKeys(t)}},et={get:T,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},nt=n({},tt,{get:Q,set:$(!0)}),st=n({},et,{get:U}),it=t=>u(t)?At(t):t,rt=t=>u(t)?Vt(t):t,ct=t=>t,ot=t=>Reflect.getPrototypeOf(t);function ut(t,e,n=!1,s=!1){const i=qt(t=t.__v_raw),r=qt(e);e!==r&&!n&&C(i,0,e),!n&&C(i,0,r);const{has:c}=ot(i),o=s?ct:n?rt:it;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function ht(t,e=!1){const n=this.__v_raw,s=qt(n),i=qt(t);return t!==i&&!e&&C(s,0,t),!e&&C(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function lt(t,e=!1){return t=t.__v_raw,!e&&C(qt(t),0,x),Reflect.get(t,"size",t)}function at(t){t=qt(t);const e=qt(this);return ot(e).has.call(e,t)||(e.add(t),D(e,"add",t,t)),this}function ft(t,e){e=qt(e);const n=qt(this),{has:s,get:i}=ot(n);let r=s.call(n,t);r||(t=qt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?f(e,c)&&D(n,"set",t,e):D(n,"add",t,e),this}function _t(t){const e=qt(this),{has:n,get:s}=ot(e);let i=n.call(e,t);i||(t=qt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&D(e,"delete",t,void 0),r}function dt(){const t=qt(this),e=0!==t.size,n=t.clear();return e&&D(t,"clear",void 0,void 0),n}function pt(t,e){return function(n,s){const i=this,r=i.__v_raw,c=qt(r),o=e?ct:t?rt:it;return!t&&C(c,0,x),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function vt(t,e,n){return function(...s){const i=this.__v_raw,r=qt(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,l=i[t](...s),a=n?ct:e?rt:it;return!e&&C(r,0,h?P:x),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[a(t[0]),a(t[1])]:a(t),done:e}},[Symbol.iterator](){return this}}}}function gt(t){return function(...e){return"delete"!==t&&this}}function yt(){const t={get(t){return ut(this,t)},get size(){return lt(this)},has:ht,add:at,set:ft,delete:_t,clear:dt,forEach:pt(!1,!1)},e={get(t){return ut(this,t,!1,!0)},get size(){return lt(this)},has:ht,add:at,set:ft,delete:_t,clear:dt,forEach:pt(!1,!0)},n={get(t){return ut(this,t,!0)},get size(){return lt(this,!0)},has(t){return ht.call(this,t,!0)},add:gt("add"),set:gt("set"),delete:gt("delete"),clear:gt("clear"),forEach:pt(!0,!1)},s={get(t){return ut(this,t,!0,!0)},get size(){return lt(this,!0)},has(t){return ht.call(this,t,!0)},add:gt("add"),set:gt("set"),delete:gt("delete"),clear:gt("clear"),forEach:pt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=vt(i,!1,!1),n[i]=vt(i,!0,!1),e[i]=vt(i,!1,!0),s[i]=vt(i,!0,!0)})),[t,n,e,s]}const[wt,bt,Rt,kt]=yt();function mt(t,e){const n=e?t?kt:Rt:t?bt:wt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const jt={get:mt(!1,!1)},Ot={get:mt(!1,!0)},St={get:mt(!0,!1)},Et={get:mt(!0,!0)},xt=new WeakMap,Pt=new WeakMap,Mt=new WeakMap,zt=new WeakMap;function Wt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>l(t).slice(8,-1))(t))}function At(t){return t&&t.__v_isReadonly?t:Kt(t,!1,tt,jt,xt)}function Nt(t){return Kt(t,!1,nt,Ot,Pt)}function Vt(t){return Kt(t,!0,et,St,Mt)}function It(t){return Kt(t,!0,st,Et,zt)}function Kt(t,e,n,s,i){if(!u(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=Wt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function Bt(t){return Ct(t)?Bt(t.__v_raw):!(!t||!t.__v_isReactive)}function Ct(t){return!(!t||!t.__v_isReadonly)}function Lt(t){return Bt(t)||Ct(t)}function qt(t){const e=t&&t.__v_raw;return e?qt(e):t}function Dt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}function Ft(t){L()&&((t=qt(t)).dep||(t.dep=b()),q(t.dep))}function Gt(t,e){(t=qt(t)).dep&&F(t.dep)}const Ht=t=>u(t)?At(t):t;function Jt(t){return Boolean(t&&!0===t.__v_isRef)}function Qt(t){return Xt(t,!1)}function Tt(t){return Xt(t,!0)}class Ut{constructor(t,e){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:qt(t),this._value=e?t:Ht(t)}get value(){return Ft(this),this._value}set value(t){t=this._shallow?t:qt(t),f(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:Ht(t),Gt(this))}}function Xt(t,e){return Jt(t)?t:new Ut(t,e)}function Yt(t){Gt(t)}function Zt(t){return Jt(t)?t.value:t}const $t={get:(t,e,n)=>Zt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Jt(i)&&!Jt(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};function te(t){return Bt(t)?t:new Proxy(t,$t)}class ee{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Ft(this)),(()=>Gt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function ne(t){return new ee(t)}function se(t){const e=r(t)?new Array(t.length):{};for(const n in t)e[n]=re(t,n);return e}class ie{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}function re(t,e){const n=t[e];return Jt(n)?n:new ie(t,e)}class ce{constructor(t,e,n){this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.effect=new M(t,(()=>{this._dirty||(this._dirty=!0,Gt(this))})),this.__v_isReadonly=n}get value(){const t=qt(this);return Ft(t),t._dirty&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function oe(t,n){let s,i;const r="function"==typeof t;r?(s=t,i=e):(s=t.get,i=t.set);return new ce(s,i,r||!i)}var ue;const he=Promise.resolve(),le=[];let ae=!1;const fe=()=>{for(let t=0;t<le.length;t++)le[t]();le.length=0,ae=!1};class _e{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[ue]=!0;let n=!1,s=!1;this.effect=new M(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,le.push((()=>{this.effect.active&&this._get()!==t&&Gt(this),s=!1})),ae||(ae=!0,he.then(fe))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=!0}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Ft(this),qt(this)._get()}}function de(t){return new _e(t)}ue="__v_isReadonly";export{p as EffectScope,x as ITERATE_KEY,M as ReactiveEffect,oe as computed,ne as customRef,de as deferredComputed,W as effect,v as effectScope,K as enableTracking,y as getCurrentScope,Lt as isProxy,Bt as isReactive,Ct as isReadonly,Jt as isRef,Dt as markRaw,w as onScopeDispose,I as pauseTracking,te as proxyRefs,At as reactive,Vt as readonly,Qt as ref,B as resetTracking,Nt as shallowReactive,It as shallowReadonly,Tt as shallowRef,A as stop,qt as toRaw,re as toRef,se as toRefs,C as track,D as trigger,Yt as triggerRef,Zt as unref};
|
|
@@ -1095,7 +1095,8 @@ class ComputedRefImpl {
|
|
|
1095
1095
|
function computed(getterOrOptions, debugOptions) {
|
|
1096
1096
|
let getter;
|
|
1097
1097
|
let setter;
|
|
1098
|
-
|
|
1098
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1099
|
+
if (onlyGetter) {
|
|
1099
1100
|
getter = getterOrOptions;
|
|
1100
1101
|
setter = (process.env.NODE_ENV !== 'production')
|
|
1101
1102
|
? () => {
|
|
@@ -1107,7 +1108,7 @@ function computed(getterOrOptions, debugOptions) {
|
|
|
1107
1108
|
getter = getterOrOptions.get;
|
|
1108
1109
|
setter = getterOrOptions.set;
|
|
1109
1110
|
}
|
|
1110
|
-
const cRef = new ComputedRefImpl(getter, setter,
|
|
1111
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
|
|
1111
1112
|
if ((process.env.NODE_ENV !== 'production') && debugOptions) {
|
|
1112
1113
|
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1113
1114
|
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
@@ -1140,7 +1140,8 @@ var VueReactivity = (function (exports) {
|
|
|
1140
1140
|
function computed(getterOrOptions, debugOptions) {
|
|
1141
1141
|
let getter;
|
|
1142
1142
|
let setter;
|
|
1143
|
-
|
|
1143
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1144
|
+
if (onlyGetter) {
|
|
1144
1145
|
getter = getterOrOptions;
|
|
1145
1146
|
setter = () => {
|
|
1146
1147
|
console.warn('Write operation failed: computed value is readonly');
|
|
@@ -1151,7 +1152,7 @@ var VueReactivity = (function (exports) {
|
|
|
1151
1152
|
getter = getterOrOptions.get;
|
|
1152
1153
|
setter = getterOrOptions.set;
|
|
1153
1154
|
}
|
|
1154
|
-
const cRef = new ComputedRefImpl(getter, setter,
|
|
1155
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
|
|
1155
1156
|
if (debugOptions) {
|
|
1156
1157
|
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1157
1158
|
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),s=t.split(",");for(let r=0;r<s.length;r++)n[s[r]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n=()=>{},s=Object.assign,r=Object.prototype.hasOwnProperty,i=(t,e)=>r.call(t,e),c=Array.isArray,o=t=>"[object Map]"===f(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,l=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,f=t=>h.call(t),_=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,p=(t,e)=>!Object.is(t,e);let d;const v=[];class g{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&d&&(this.parent=d,this.index=(d.scopes||(d.scopes=[])).push(this)-1)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(v.push(this),d=this)}off(){this.active&&(v.pop(),d=v[v.length-1])}stop(t){if(this.active){if(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.scopes&&this.scopes.forEach((t=>t.stop(!0))),this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function y(t,e){(e=e||d)&&e.active&&e.effects.push(t)}const w=t=>{const e=new Set(t);return e.w=0,e.n=0,e},R=t=>(t.w&E)>0,b=t=>(t.n&E)>0,k=new WeakMap;let m=0,E=1;const S=[];let j;const O=Symbol(""),x=Symbol("");class P{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],y(this,n)}run(){if(!this.active)return this.fn();if(!S.includes(this))try{return S.push(j=this),T(),E=1<<++m,m<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=E})(this):M(this),this.fn()}finally{m<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const r=e[s];R(r)&&!b(r)?r.delete(t):e[n++]=r,r.w&=~E,r.n&=~E}e.length=n}})(this),E=1<<--m,V(),S.pop();const t=S.length;j=t>0?S[t-1]:void 0}}stop(){this.active&&(M(this),this.onStop&&this.onStop(),this.active=!1)}}function M(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let z=!0;const W=[];function A(){W.push(z),z=!1}function T(){W.push(z),z=!0}function V(){const t=W.pop();z=void 0===t||t}function N(t,e,n){if(!C())return;let s=k.get(t);s||k.set(t,s=new Map);let r=s.get(n);r||s.set(n,r=w()),I(r)}function C(){return z&&void 0!==j}function I(t,e){let n=!1;m<=30?b(t)||(t.n|=E,n=!R(t)):n=!t.has(j),n&&(t.add(j),j.deps.push(t))}function K(t,e,n,s,r,i){const u=k.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===n&&c(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&a.push(t)}));else switch(void 0!==n&&a.push(u.get(n)),e){case"add":c(t)?_(n)&&a.push(u.get("length")):(a.push(u.get(O)),o(t)&&a.push(u.get(x)));break;case"delete":c(t)||(a.push(u.get(O)),o(t)&&a.push(u.get(x)));break;case"set":o(t)&&a.push(u.get(O))}if(1===a.length)a[0]&&B(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);B(w(t))}}function B(t,e){for(const n of c(t)?t:[...t])(n!==j||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const D=e("__proto__,__v_isRef,__isVue"),L=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(a)),Y=Q(),q=Q(!1,!0),F=Q(!0),G=Q(!0,!0),H=J();function J(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Vt(this);for(let e=0,r=this.length;e<r;e++)N(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Vt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){A();const n=Vt(this)[e].apply(this,t);return V(),n}})),t}function Q(t=!1,e=!1){return function(n,s,r){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&r===(t?e?xt:Ot:e?jt:St).get(n))return n;const o=c(n);if(!t&&o&&i(H,s))return Reflect.get(H,s,r);const u=Reflect.get(n,s,r);if(a(s)?L.has(s):D(s))return u;if(t||N(n,0,s),e)return u;if(Kt(u)){return!o||!_(s)?u.value:u}return l(u)?t?zt(u):Mt(u):u}}function U(t=!1){return function(e,n,s,r){let o=e[n];if(!t&&(s=Vt(s),o=Vt(o),!c(e)&&Kt(o)&&!Kt(s)))return o.value=s,!0;const u=c(e)&&_(n)?Number(n)<e.length:i(e,n),a=Reflect.set(e,n,s,r);return e===Vt(r)&&(u?p(s,o)&&K(e,"set",n,s):K(e,"add",n,s)),a}}const X={get:Y,set:U(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&K(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return a(e)&&L.has(e)||N(t,0,e),n},ownKeys:function(t){return N(t,0,c(t)?"length":O),Reflect.ownKeys(t)}},Z={get:F,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},$=s({},X,{get:q,set:U(!0)}),tt=s({},Z,{get:G}),et=t=>l(t)?Mt(t):t,nt=t=>l(t)?zt(t):t,st=t=>t,rt=t=>Reflect.getPrototypeOf(t);function it(t,e,n=!1,s=!1){const r=Vt(t=t.__v_raw),i=Vt(e);e!==i&&!n&&N(r,0,e),!n&&N(r,0,i);const{has:c}=rt(r),o=s?st:n?nt:et;return c.call(r,e)?o(t.get(e)):c.call(r,i)?o(t.get(i)):void(t!==r&&t.get(e))}function ct(t,e=!1){const n=this.__v_raw,s=Vt(n),r=Vt(t);return t!==r&&!e&&N(s,0,t),!e&&N(s,0,r),t===r?n.has(t):n.has(t)||n.has(r)}function ot(t,e=!1){return t=t.__v_raw,!e&&N(Vt(t),0,O),Reflect.get(t,"size",t)}function ut(t){t=Vt(t);const e=Vt(this);return rt(e).has.call(e,t)||(e.add(t),K(e,"add",t,t)),this}function at(t,e){e=Vt(e);const n=Vt(this),{has:s,get:r}=rt(n);let i=s.call(n,t);i||(t=Vt(t),i=s.call(n,t));const c=r.call(n,t);return n.set(t,e),i?p(e,c)&&K(n,"set",t,e):K(n,"add",t,e),this}function lt(t){const e=Vt(this),{has:n,get:s}=rt(e);let r=n.call(e,t);r||(t=Vt(t),r=n.call(e,t)),s&&s.call(e,t);const i=e.delete(t);return r&&K(e,"delete",t,void 0),i}function ht(){const t=Vt(this),e=0!==t.size,n=t.clear();return e&&K(t,"clear",void 0,void 0),n}function ft(t,e){return function(n,s){const r=this,i=r.__v_raw,c=Vt(i),o=e?st:t?nt:et;return!t&&N(c,0,O),i.forEach(((t,e)=>n.call(s,o(t),o(e),r)))}}function _t(t,e,n){return function(...s){const r=this.__v_raw,i=Vt(r),c=o(i),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,l=r[t](...s),h=n?st:e?nt:et;return!e&&N(i,0,a?x:O),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[h(t[0]),h(t[1])]:h(t),done:e}},[Symbol.iterator](){return this}}}}function pt(t){return function(...e){return"delete"!==t&&this}}function dt(){const t={get(t){return it(this,t)},get size(){return ot(this)},has:ct,add:ut,set:at,delete:lt,clear:ht,forEach:ft(!1,!1)},e={get(t){return it(this,t,!1,!0)},get size(){return ot(this)},has:ct,add:ut,set:at,delete:lt,clear:ht,forEach:ft(!1,!0)},n={get(t){return it(this,t,!0)},get size(){return ot(this,!0)},has(t){return ct.call(this,t,!0)},add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear"),forEach:ft(!0,!1)},s={get(t){return it(this,t,!0,!0)},get size(){return ot(this,!0)},has(t){return ct.call(this,t,!0)},add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear"),forEach:ft(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((r=>{t[r]=_t(r,!1,!1),n[r]=_t(r,!0,!1),e[r]=_t(r,!1,!0),s[r]=_t(r,!0,!0)})),[t,n,e,s]}const[vt,gt,yt,wt]=dt();function Rt(t,e){const n=e?t?wt:yt:t?gt:vt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const bt={get:Rt(!1,!1)},kt={get:Rt(!1,!0)},mt={get:Rt(!0,!1)},Et={get:Rt(!0,!0)},St=new WeakMap,jt=new WeakMap,Ot=new WeakMap,xt=new WeakMap;function Pt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>f(t).slice(8,-1))(t))}function Mt(t){return t&&t.__v_isReadonly?t:Wt(t,!1,X,bt,St)}function zt(t){return Wt(t,!0,Z,mt,Ot)}function Wt(t,e,n,s,r){if(!l(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=r.get(t);if(i)return i;const c=Pt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return r.set(t,o),o}function At(t){return Tt(t)?At(t.__v_raw):!(!t||!t.__v_isReactive)}function Tt(t){return!(!t||!t.__v_isReadonly)}function Vt(t){const e=t&&t.__v_raw;return e?Vt(e):t}function Nt(t){C()&&((t=Vt(t)).dep||(t.dep=w()),I(t.dep))}function Ct(t,e){(t=Vt(t)).dep&&B(t.dep)}const It=t=>l(t)?Mt(t):t;function Kt(t){return Boolean(t&&!0===t.__v_isRef)}class Bt{constructor(t,e){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Vt(t),this._value=e?t:It(t)}get value(){return Nt(this),this._value}set value(t){t=this._shallow?t:Vt(t),p(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:It(t),Ct(this))}}function Dt(t,e){return Kt(t)?t:new Bt(t,e)}function Lt(t){return Kt(t)?t.value:t}const Yt={get:(t,e,n)=>Lt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const r=t[e];return Kt(r)&&!Kt(n)?(r.value=n,!0):Reflect.set(t,e,n,s)}};class qt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Nt(this)),(()=>Ct(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Ft{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}function Gt(t,e){const n=t[e];return Kt(n)?n:new Ft(t,e)}class Ht{constructor(t,e,n){this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.effect=new P(t,(()=>{this._dirty||(this._dirty=!0,Ct(this))})),this.__v_isReadonly=n}get value(){const t=Vt(this);return Nt(t),t._dirty&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}var Jt;const Qt=Promise.resolve(),Ut=[];let Xt=!1;const Zt=()=>{for(let t=0;t<Ut.length;t++)Ut[t]();Ut.length=0,Xt=!1};class $t{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[Jt]=!0;let n=!1,s=!1;this.effect=new P(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,Ut.push((()=>{this.effect.active&&this._get()!==t&&Ct(this),s=!1})),Xt||(Xt=!0,Qt.then(Zt))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=!0}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Nt(this),Vt(this)._get()}}return Jt="__v_isReadonly",t.EffectScope=g,t.ITERATE_KEY=O,t.ReactiveEffect=P,t.computed=function(t,e){let s,r;return u(t)?(s=t,r=n):(s=t.get,r=t.set),new Ht(s,r,u(t)||!t.set)},t.customRef=function(t){return new qt(t)},t.deferredComputed=function(t){return new $t(t)},t.effect=function(t,e){t.effect&&(t=t.effect.fn);const n=new P(t);e&&(s(n,e),e.scope&&y(n,e.scope)),e&&e.lazy||n.run();const r=n.run.bind(n);return r.effect=n,r},t.effectScope=function(t){return new g(t)},t.enableTracking=T,t.getCurrentScope=function(){return d},t.isProxy=function(t){return At(t)||Tt(t)},t.isReactive=At,t.isReadonly=Tt,t.isRef=Kt,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){d&&d.cleanups.push(t)},t.pauseTracking=A,t.proxyRefs=function(t){return At(t)?t:new Proxy(t,Yt)},t.reactive=Mt,t.readonly=zt,t.ref=function(t){return Dt(t,!1)},t.resetTracking=V,t.shallowReactive=function(t){return Wt(t,!1,$,kt,jt)},t.shallowReadonly=function(t){return Wt(t,!0,tt,Et,xt)},t.shallowRef=function(t){return Dt(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Vt,t.toRef=Gt,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=Gt(t,n);return e},t.track=N,t.trigger=K,t.triggerRef=function(t){Ct(t)},t.unref=Lt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
1
|
+
var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),s=t.split(",");for(let r=0;r<s.length;r++)n[s[r]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n=()=>{},s=Object.assign,r=Object.prototype.hasOwnProperty,i=(t,e)=>r.call(t,e),c=Array.isArray,o=t=>"[object Map]"===h(t),u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,h=t=>l.call(t),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>!Object.is(t,e);let p;const d=[];class v{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&p&&(this.parent=p,this.index=(p.scopes||(p.scopes=[])).push(this)-1)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(d.push(this),p=this)}off(){this.active&&(d.pop(),p=d[d.length-1])}stop(t){if(this.active){if(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.scopes&&this.scopes.forEach((t=>t.stop(!0))),this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function g(t,e){(e=e||p)&&e.active&&e.effects.push(t)}const y=t=>{const e=new Set(t);return e.w=0,e.n=0,e},w=t=>(t.w&m)>0,R=t=>(t.n&m)>0,b=new WeakMap;let k=0,m=1;const E=[];let S;const j=Symbol(""),O=Symbol("");class x{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],g(this,n)}run(){if(!this.active)return this.fn();if(!E.includes(this))try{return E.push(S=this),A(),m=1<<++k,k<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=m})(this):P(this),this.fn()}finally{k<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const r=e[s];w(r)&&!R(r)?r.delete(t):e[n++]=r,r.w&=~m,r.n&=~m}e.length=n}})(this),m=1<<--k,T(),E.pop();const t=E.length;S=t>0?E[t-1]:void 0}}stop(){this.active&&(P(this),this.onStop&&this.onStop(),this.active=!1)}}function P(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let M=!0;const z=[];function W(){z.push(M),M=!1}function A(){z.push(M),M=!0}function T(){const t=z.pop();M=void 0===t||t}function V(t,e,n){if(!N())return;let s=b.get(t);s||b.set(t,s=new Map);let r=s.get(n);r||s.set(n,r=y()),C(r)}function N(){return M&&void 0!==S}function C(t,e){let n=!1;k<=30?R(t)||(t.n|=m,n=!w(t)):n=!t.has(S),n&&(t.add(S),S.deps.push(t))}function I(t,e,n,s,r,i){const u=b.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===n&&c(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&a.push(t)}));else switch(void 0!==n&&a.push(u.get(n)),e){case"add":c(t)?f(n)&&a.push(u.get("length")):(a.push(u.get(j)),o(t)&&a.push(u.get(O)));break;case"delete":c(t)||(a.push(u.get(j)),o(t)&&a.push(u.get(O)));break;case"set":o(t)&&a.push(u.get(j))}if(1===a.length)a[0]&&K(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);K(y(t))}}function K(t,e){for(const n of c(t)?t:[...t])(n!==S||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const B=e("__proto__,__v_isRef,__isVue"),D=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(u)),L=J(),Y=J(!1,!0),q=J(!0),F=J(!0,!0),G=H();function H(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Tt(this);for(let e=0,r=this.length;e<r;e++)V(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Tt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){W();const n=Tt(this)[e].apply(this,t);return T(),n}})),t}function J(t=!1,e=!1){return function(n,s,r){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&r===(t?e?Ot:jt:e?St:Et).get(n))return n;const o=c(n);if(!t&&o&&i(G,s))return Reflect.get(G,s,r);const l=Reflect.get(n,s,r);if(u(s)?D.has(s):B(s))return l;if(t||V(n,0,s),e)return l;if(It(l)){return!o||!f(s)?l.value:l}return a(l)?t?Mt(l):Pt(l):l}}function Q(t=!1){return function(e,n,s,r){let o=e[n];if(!t&&(s=Tt(s),o=Tt(o),!c(e)&&It(o)&&!It(s)))return o.value=s,!0;const u=c(e)&&f(n)?Number(n)<e.length:i(e,n),a=Reflect.set(e,n,s,r);return e===Tt(r)&&(u?_(s,o)&&I(e,"set",n,s):I(e,"add",n,s)),a}}const U={get:L,set:Q(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&I(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return u(e)&&D.has(e)||V(t,0,e),n},ownKeys:function(t){return V(t,0,c(t)?"length":j),Reflect.ownKeys(t)}},X={get:q,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},Z=s({},U,{get:Y,set:Q(!0)}),$=s({},X,{get:F}),tt=t=>a(t)?Pt(t):t,et=t=>a(t)?Mt(t):t,nt=t=>t,st=t=>Reflect.getPrototypeOf(t);function rt(t,e,n=!1,s=!1){const r=Tt(t=t.__v_raw),i=Tt(e);e!==i&&!n&&V(r,0,e),!n&&V(r,0,i);const{has:c}=st(r),o=s?nt:n?et:tt;return c.call(r,e)?o(t.get(e)):c.call(r,i)?o(t.get(i)):void(t!==r&&t.get(e))}function it(t,e=!1){const n=this.__v_raw,s=Tt(n),r=Tt(t);return t!==r&&!e&&V(s,0,t),!e&&V(s,0,r),t===r?n.has(t):n.has(t)||n.has(r)}function ct(t,e=!1){return t=t.__v_raw,!e&&V(Tt(t),0,j),Reflect.get(t,"size",t)}function ot(t){t=Tt(t);const e=Tt(this);return st(e).has.call(e,t)||(e.add(t),I(e,"add",t,t)),this}function ut(t,e){e=Tt(e);const n=Tt(this),{has:s,get:r}=st(n);let i=s.call(n,t);i||(t=Tt(t),i=s.call(n,t));const c=r.call(n,t);return n.set(t,e),i?_(e,c)&&I(n,"set",t,e):I(n,"add",t,e),this}function at(t){const e=Tt(this),{has:n,get:s}=st(e);let r=n.call(e,t);r||(t=Tt(t),r=n.call(e,t)),s&&s.call(e,t);const i=e.delete(t);return r&&I(e,"delete",t,void 0),i}function lt(){const t=Tt(this),e=0!==t.size,n=t.clear();return e&&I(t,"clear",void 0,void 0),n}function ht(t,e){return function(n,s){const r=this,i=r.__v_raw,c=Tt(i),o=e?nt:t?et:tt;return!t&&V(c,0,j),i.forEach(((t,e)=>n.call(s,o(t),o(e),r)))}}function ft(t,e,n){return function(...s){const r=this.__v_raw,i=Tt(r),c=o(i),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,l=r[t](...s),h=n?nt:e?et:tt;return!e&&V(i,0,a?O:j),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[h(t[0]),h(t[1])]:h(t),done:e}},[Symbol.iterator](){return this}}}}function _t(t){return function(...e){return"delete"!==t&&this}}function pt(){const t={get(t){return rt(this,t)},get size(){return ct(this)},has:it,add:ot,set:ut,delete:at,clear:lt,forEach:ht(!1,!1)},e={get(t){return rt(this,t,!1,!0)},get size(){return ct(this)},has:it,add:ot,set:ut,delete:at,clear:lt,forEach:ht(!1,!0)},n={get(t){return rt(this,t,!0)},get size(){return ct(this,!0)},has(t){return it.call(this,t,!0)},add:_t("add"),set:_t("set"),delete:_t("delete"),clear:_t("clear"),forEach:ht(!0,!1)},s={get(t){return rt(this,t,!0,!0)},get size(){return ct(this,!0)},has(t){return it.call(this,t,!0)},add:_t("add"),set:_t("set"),delete:_t("delete"),clear:_t("clear"),forEach:ht(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((r=>{t[r]=ft(r,!1,!1),n[r]=ft(r,!0,!1),e[r]=ft(r,!1,!0),s[r]=ft(r,!0,!0)})),[t,n,e,s]}const[dt,vt,gt,yt]=pt();function wt(t,e){const n=e?t?yt:gt:t?vt:dt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const Rt={get:wt(!1,!1)},bt={get:wt(!1,!0)},kt={get:wt(!0,!1)},mt={get:wt(!0,!0)},Et=new WeakMap,St=new WeakMap,jt=new WeakMap,Ot=new WeakMap;function xt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>h(t).slice(8,-1))(t))}function Pt(t){return t&&t.__v_isReadonly?t:zt(t,!1,U,Rt,Et)}function Mt(t){return zt(t,!0,X,kt,jt)}function zt(t,e,n,s,r){if(!a(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=r.get(t);if(i)return i;const c=xt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return r.set(t,o),o}function Wt(t){return At(t)?Wt(t.__v_raw):!(!t||!t.__v_isReactive)}function At(t){return!(!t||!t.__v_isReadonly)}function Tt(t){const e=t&&t.__v_raw;return e?Tt(e):t}function Vt(t){N()&&((t=Tt(t)).dep||(t.dep=y()),C(t.dep))}function Nt(t,e){(t=Tt(t)).dep&&K(t.dep)}const Ct=t=>a(t)?Pt(t):t;function It(t){return Boolean(t&&!0===t.__v_isRef)}class Kt{constructor(t,e){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Tt(t),this._value=e?t:Ct(t)}get value(){return Vt(this),this._value}set value(t){t=this._shallow?t:Tt(t),_(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:Ct(t),Nt(this))}}function Bt(t,e){return It(t)?t:new Kt(t,e)}function Dt(t){return It(t)?t.value:t}const Lt={get:(t,e,n)=>Dt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const r=t[e];return It(r)&&!It(n)?(r.value=n,!0):Reflect.set(t,e,n,s)}};class Yt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Vt(this)),(()=>Nt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class qt{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}function Ft(t,e){const n=t[e];return It(n)?n:new qt(t,e)}class Gt{constructor(t,e,n){this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.effect=new x(t,(()=>{this._dirty||(this._dirty=!0,Nt(this))})),this.__v_isReadonly=n}get value(){const t=Tt(this);return Vt(t),t._dirty&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}var Ht;const Jt=Promise.resolve(),Qt=[];let Ut=!1;const Xt=()=>{for(let t=0;t<Qt.length;t++)Qt[t]();Qt.length=0,Ut=!1};class Zt{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[Ht]=!0;let n=!1,s=!1;this.effect=new x(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,Qt.push((()=>{this.effect.active&&this._get()!==t&&Nt(this),s=!1})),Ut||(Ut=!0,Jt.then(Xt))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=!0}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Vt(this),Tt(this)._get()}}return Ht="__v_isReadonly",t.EffectScope=v,t.ITERATE_KEY=j,t.ReactiveEffect=x,t.computed=function(t,e){let s,r;const i="function"==typeof t;return i?(s=t,r=n):(s=t.get,r=t.set),new Gt(s,r,i||!r)},t.customRef=function(t){return new Yt(t)},t.deferredComputed=function(t){return new Zt(t)},t.effect=function(t,e){t.effect&&(t=t.effect.fn);const n=new x(t);e&&(s(n,e),e.scope&&g(n,e.scope)),e&&e.lazy||n.run();const r=n.run.bind(n);return r.effect=n,r},t.effectScope=function(t){return new v(t)},t.enableTracking=A,t.getCurrentScope=function(){return p},t.isProxy=function(t){return Wt(t)||At(t)},t.isReactive=Wt,t.isReadonly=At,t.isRef=It,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){p&&p.cleanups.push(t)},t.pauseTracking=W,t.proxyRefs=function(t){return Wt(t)?t:new Proxy(t,Lt)},t.reactive=Pt,t.readonly=Mt,t.ref=function(t){return Bt(t,!1)},t.resetTracking=T,t.shallowReactive=function(t){return zt(t,!1,Z,bt,St)},t.shallowReadonly=function(t){return zt(t,!0,$,mt,Ot)},t.shallowRef=function(t){return Bt(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Tt,t.toRef=Ft,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=Ft(t,n);return e},t.track=V,t.trigger=I,t.triggerRef=function(t){Nt(t)},t.unref=Dt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/reactivity",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.13",
|
|
4
4
|
"description": "@vue/reactivity",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/reactivity.esm-bundler.js",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/reactivity#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@vue/shared": "3.2.
|
|
39
|
+
"@vue/shared": "3.2.13"
|
|
40
40
|
}
|
|
41
41
|
}
|