@vue/reactivity 3.1.3 → 3.1.4
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 +5 -16
- package/dist/reactivity.cjs.prod.js +5 -16
- package/dist/reactivity.esm-browser.js +5 -16
- package/dist/reactivity.esm-browser.prod.js +1 -1
- package/dist/reactivity.esm-bundler.js +5 -16
- package/dist/reactivity.global.js +5 -16
- package/dist/reactivity.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/reactivity.cjs.js
CHANGED
|
@@ -763,13 +763,10 @@ function shallowRef(value) {
|
|
|
763
763
|
return createRef(value, true);
|
|
764
764
|
}
|
|
765
765
|
class RefImpl {
|
|
766
|
-
_rawValue;
|
|
767
|
-
_shallow;
|
|
768
|
-
_value;
|
|
769
|
-
__v_isRef = true;
|
|
770
766
|
constructor(_rawValue, _shallow) {
|
|
771
767
|
this._rawValue = _rawValue;
|
|
772
768
|
this._shallow = _shallow;
|
|
769
|
+
this.__v_isRef = true;
|
|
773
770
|
this._value = _shallow ? _rawValue : convert(_rawValue);
|
|
774
771
|
}
|
|
775
772
|
get value() {
|
|
@@ -815,10 +812,8 @@ function proxyRefs(objectWithRefs) {
|
|
|
815
812
|
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
816
813
|
}
|
|
817
814
|
class CustomRefImpl {
|
|
818
|
-
_get;
|
|
819
|
-
_set;
|
|
820
|
-
__v_isRef = true;
|
|
821
815
|
constructor(factory) {
|
|
816
|
+
this.__v_isRef = true;
|
|
822
817
|
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
|
823
818
|
this._get = get;
|
|
824
819
|
this._set = set;
|
|
@@ -844,12 +839,10 @@ function toRefs(object) {
|
|
|
844
839
|
return ret;
|
|
845
840
|
}
|
|
846
841
|
class ObjectRefImpl {
|
|
847
|
-
_object;
|
|
848
|
-
_key;
|
|
849
|
-
__v_isRef = true;
|
|
850
842
|
constructor(_object, _key) {
|
|
851
843
|
this._object = _object;
|
|
852
844
|
this._key = _key;
|
|
845
|
+
this.__v_isRef = true;
|
|
853
846
|
}
|
|
854
847
|
get value() {
|
|
855
848
|
return this._object[this._key];
|
|
@@ -865,14 +858,10 @@ function toRef(object, key) {
|
|
|
865
858
|
}
|
|
866
859
|
|
|
867
860
|
class ComputedRefImpl {
|
|
868
|
-
_setter;
|
|
869
|
-
_value;
|
|
870
|
-
_dirty = true;
|
|
871
|
-
effect;
|
|
872
|
-
__v_isRef = true;
|
|
873
|
-
["__v_isReadonly" /* IS_READONLY */];
|
|
874
861
|
constructor(getter, _setter, isReadonly) {
|
|
875
862
|
this._setter = _setter;
|
|
863
|
+
this._dirty = true;
|
|
864
|
+
this.__v_isRef = true;
|
|
876
865
|
this.effect = effect(getter, {
|
|
877
866
|
lazy: true,
|
|
878
867
|
scheduler: () => {
|
|
@@ -710,13 +710,10 @@ function shallowRef(value) {
|
|
|
710
710
|
return createRef(value, true);
|
|
711
711
|
}
|
|
712
712
|
class RefImpl {
|
|
713
|
-
_rawValue;
|
|
714
|
-
_shallow;
|
|
715
|
-
_value;
|
|
716
|
-
__v_isRef = true;
|
|
717
713
|
constructor(_rawValue, _shallow) {
|
|
718
714
|
this._rawValue = _rawValue;
|
|
719
715
|
this._shallow = _shallow;
|
|
716
|
+
this.__v_isRef = true;
|
|
720
717
|
this._value = _shallow ? _rawValue : convert(_rawValue);
|
|
721
718
|
}
|
|
722
719
|
get value() {
|
|
@@ -762,10 +759,8 @@ function proxyRefs(objectWithRefs) {
|
|
|
762
759
|
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
763
760
|
}
|
|
764
761
|
class CustomRefImpl {
|
|
765
|
-
_get;
|
|
766
|
-
_set;
|
|
767
|
-
__v_isRef = true;
|
|
768
762
|
constructor(factory) {
|
|
763
|
+
this.__v_isRef = true;
|
|
769
764
|
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
|
770
765
|
this._get = get;
|
|
771
766
|
this._set = set;
|
|
@@ -788,12 +783,10 @@ function toRefs(object) {
|
|
|
788
783
|
return ret;
|
|
789
784
|
}
|
|
790
785
|
class ObjectRefImpl {
|
|
791
|
-
_object;
|
|
792
|
-
_key;
|
|
793
|
-
__v_isRef = true;
|
|
794
786
|
constructor(_object, _key) {
|
|
795
787
|
this._object = _object;
|
|
796
788
|
this._key = _key;
|
|
789
|
+
this.__v_isRef = true;
|
|
797
790
|
}
|
|
798
791
|
get value() {
|
|
799
792
|
return this._object[this._key];
|
|
@@ -809,14 +802,10 @@ function toRef(object, key) {
|
|
|
809
802
|
}
|
|
810
803
|
|
|
811
804
|
class ComputedRefImpl {
|
|
812
|
-
_setter;
|
|
813
|
-
_value;
|
|
814
|
-
_dirty = true;
|
|
815
|
-
effect;
|
|
816
|
-
__v_isRef = true;
|
|
817
|
-
["__v_isReadonly" /* IS_READONLY */];
|
|
818
805
|
constructor(getter, _setter, isReadonly) {
|
|
819
806
|
this._setter = _setter;
|
|
807
|
+
this._dirty = true;
|
|
808
|
+
this.__v_isRef = true;
|
|
820
809
|
this.effect = effect(getter, {
|
|
821
810
|
lazy: true,
|
|
822
811
|
scheduler: () => {
|
|
@@ -816,13 +816,10 @@ function shallowRef(value) {
|
|
|
816
816
|
return createRef(value, true);
|
|
817
817
|
}
|
|
818
818
|
class RefImpl {
|
|
819
|
-
_rawValue;
|
|
820
|
-
_shallow;
|
|
821
|
-
_value;
|
|
822
|
-
__v_isRef = true;
|
|
823
819
|
constructor(_rawValue, _shallow) {
|
|
824
820
|
this._rawValue = _rawValue;
|
|
825
821
|
this._shallow = _shallow;
|
|
822
|
+
this.__v_isRef = true;
|
|
826
823
|
this._value = _shallow ? _rawValue : convert(_rawValue);
|
|
827
824
|
}
|
|
828
825
|
get value() {
|
|
@@ -868,10 +865,8 @@ function proxyRefs(objectWithRefs) {
|
|
|
868
865
|
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
869
866
|
}
|
|
870
867
|
class CustomRefImpl {
|
|
871
|
-
_get;
|
|
872
|
-
_set;
|
|
873
|
-
__v_isRef = true;
|
|
874
868
|
constructor(factory) {
|
|
869
|
+
this.__v_isRef = true;
|
|
875
870
|
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
|
876
871
|
this._get = get;
|
|
877
872
|
this._set = set;
|
|
@@ -897,12 +892,10 @@ function toRefs(object) {
|
|
|
897
892
|
return ret;
|
|
898
893
|
}
|
|
899
894
|
class ObjectRefImpl {
|
|
900
|
-
_object;
|
|
901
|
-
_key;
|
|
902
|
-
__v_isRef = true;
|
|
903
895
|
constructor(_object, _key) {
|
|
904
896
|
this._object = _object;
|
|
905
897
|
this._key = _key;
|
|
898
|
+
this.__v_isRef = true;
|
|
906
899
|
}
|
|
907
900
|
get value() {
|
|
908
901
|
return this._object[this._key];
|
|
@@ -918,14 +911,10 @@ function toRef(object, key) {
|
|
|
918
911
|
}
|
|
919
912
|
|
|
920
913
|
class ComputedRefImpl {
|
|
921
|
-
_setter;
|
|
922
|
-
_value;
|
|
923
|
-
_dirty = true;
|
|
924
|
-
effect;
|
|
925
|
-
__v_isRef = true;
|
|
926
|
-
["__v_isReadonly" /* IS_READONLY */];
|
|
927
914
|
constructor(getter, _setter, isReadonly) {
|
|
928
915
|
this._setter = _setter;
|
|
916
|
+
this._dirty = true;
|
|
917
|
+
this.__v_isRef = true;
|
|
929
918
|
this.effect = effect(getter, {
|
|
930
919
|
lazy: true,
|
|
931
920
|
scheduler: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,e){const n=Object.create(null),r=t.split(",");for(let s=0;s<r.length;s++)n[r[s]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e={},n=()=>{},r=Object.assign,s=Object.prototype.hasOwnProperty,o=(t,e)=>s.call(t,e),
|
|
1
|
+
function t(t,e){const n=Object.create(null),r=t.split(",");for(let s=0;s<r.length;s++)n[r[s]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e={},n=()=>{},r=Object.assign,s=Object.prototype.hasOwnProperty,o=(t,e)=>s.call(t,e),i=Array.isArray,c=t=>"[object Map]"===_(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,l=t=>null!==t&&"object"==typeof t,f=Object.prototype.toString,_=t=>f.call(t),h=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,d=(t,e)=>t!==e&&(t==t||e==e),v=new WeakMap,g=[];let p;const y=Symbol(""),w=Symbol("");function R(t,n=e){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const r=function(t,e){const n=function(){if(!n.active)return t();if(!g.includes(n)){E(n);try{return O(),g.push(n),p=n,t()}finally{g.pop(),M(),p=g[g.length-1]}}};return n.id=k++,n.allowRecurse=!!e.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,n);return n.lazy||r(),r}function b(t){t.active&&(E(t),t.options.onStop&&t.options.onStop(),t.active=!1)}let k=0;function E(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let S=!0;const j=[];function m(){j.push(S),S=!1}function O(){j.push(S),S=!0}function M(){const t=j.pop();S=void 0===t||t}function P(t,e,n){if(!S||void 0===p)return;let r=v.get(t);r||v.set(t,r=new Map);let s=r.get(n);s||r.set(n,s=new Set),s.has(p)||(s.add(p),p.deps.push(s))}function x(t,e,n,r,s,o){const u=v.get(t);if(!u)return;const a=new Set,l=t=>{t&&t.forEach((t=>{(t!==p||t.allowRecurse)&&a.add(t)}))};if("clear"===e)u.forEach(l);else if("length"===n&&i(t))u.forEach(((t,e)=>{("length"===e||e>=r)&&l(t)}));else switch(void 0!==n&&l(u.get(n)),e){case"add":i(t)?h(n)&&l(u.get("length")):(l(u.get(y)),c(t)&&l(u.get(w)));break;case"delete":i(t)||(l(u.get(y)),c(t)&&l(u.get(w)));break;case"set":c(t)&&l(u.get(y))}a.forEach((t=>{t.options.scheduler?t.options.scheduler(t):t()}))}const z=t("__proto__,__v_isRef,__isVue"),W=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(a)),A=C(),N=C(!1,!0),V=C(!0),I=C(!0,!0),K=B();function B(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{const n=Array.prototype[e];t[e]=function(...t){const e=Mt(this);for(let n=0,s=this.length;n<s;n++)P(e,0,n+"");const r=n.apply(e,t);return-1===r||!1===r?n.apply(e,t.map(Mt)):r}})),["push","pop","shift","unshift","splice"].forEach((e=>{const n=Array.prototype[e];t[e]=function(...t){m();const e=n.apply(this,t);return M(),e}})),t}function C(t=!1,e=!1){return function(n,r,s){if("__v_isReactive"===r)return!t;if("__v_isReadonly"===r)return t;if("__v_raw"===r&&s===(t?e?yt:pt:e?gt:vt).get(n))return n;const c=i(n);if(!t&&c&&o(K,r))return Reflect.get(K,r,s);const u=Reflect.get(n,r,s);if(a(r)?W.has(r):z(r))return u;if(t||P(n,0,r),e)return u;if(zt(u)){return!c||!h(r)?u.value:u}return l(u)?t?kt(u):Rt(u):u}}function L(t=!1){return function(e,n,r,s){let c=e[n];if(!t&&(r=Mt(r),c=Mt(c),!i(e)&&zt(c)&&!zt(r)))return c.value=r,!0;const u=i(e)&&h(n)?Number(n)<e.length:o(e,n),a=Reflect.set(e,n,r,s);return e===Mt(s)&&(u?d(r,c)&&x(e,"set",n,r):x(e,"add",n,r)),a}}const q={get:A,set:L(),deleteProperty:function(t,e){const n=o(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&x(t,"delete",e,void 0),r},has:function(t,e){const n=Reflect.has(t,e);return a(e)&&W.has(e)||P(t,0,e),n},ownKeys:function(t){return P(t,0,i(t)?"length":y),Reflect.ownKeys(t)}},D={get:V,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},F=r({},q,{get:N,set:L(!0)}),G=r({},D,{get:I}),H=t=>l(t)?Rt(t):t,J=t=>l(t)?kt(t):t,Q=t=>t,T=t=>Reflect.getPrototypeOf(t);function U(t,e,n=!1,r=!1){const s=Mt(t=t.__v_raw),o=Mt(e);e!==o&&!n&&P(s,0,e),!n&&P(s,0,o);const{has:i}=T(s),c=r?Q:n?J:H;return i.call(s,e)?c(t.get(e)):i.call(s,o)?c(t.get(o)):void(t!==s&&t.get(e))}function X(t,e=!1){const n=this.__v_raw,r=Mt(n),s=Mt(t);return t!==s&&!e&&P(r,0,t),!e&&P(r,0,s),t===s?n.has(t):n.has(t)||n.has(s)}function Y(t,e=!1){return t=t.__v_raw,!e&&P(Mt(t),0,y),Reflect.get(t,"size",t)}function Z(t){t=Mt(t);const e=Mt(this);return T(e).has.call(e,t)||(e.add(t),x(e,"add",t,t)),this}function $(t,e){e=Mt(e);const n=Mt(this),{has:r,get:s}=T(n);let o=r.call(n,t);o||(t=Mt(t),o=r.call(n,t));const i=s.call(n,t);return n.set(t,e),o?d(e,i)&&x(n,"set",t,e):x(n,"add",t,e),this}function tt(t){const e=Mt(this),{has:n,get:r}=T(e);let s=n.call(e,t);s||(t=Mt(t),s=n.call(e,t)),r&&r.call(e,t);const o=e.delete(t);return s&&x(e,"delete",t,void 0),o}function et(){const t=Mt(this),e=0!==t.size,n=t.clear();return e&&x(t,"clear",void 0,void 0),n}function nt(t,e){return function(n,r){const s=this,o=s.__v_raw,i=Mt(o),c=e?Q:t?J:H;return!t&&P(i,0,y),o.forEach(((t,e)=>n.call(r,c(t),c(e),s)))}}function rt(t,e,n){return function(...r){const s=this.__v_raw,o=Mt(s),i=c(o),u="entries"===t||t===Symbol.iterator&&i,a="keys"===t&&i,l=s[t](...r),f=n?Q:e?J:H;return!e&&P(o,0,a?w:y),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[f(t[0]),f(t[1])]:f(t),done:e}},[Symbol.iterator](){return this}}}}function st(t){return function(...e){return"delete"!==t&&this}}function ot(){const t={get(t){return U(this,t)},get size(){return Y(this)},has:X,add:Z,set:$,delete:tt,clear:et,forEach:nt(!1,!1)},e={get(t){return U(this,t,!1,!0)},get size(){return Y(this)},has:X,add:Z,set:$,delete:tt,clear:et,forEach:nt(!1,!0)},n={get(t){return U(this,t,!0)},get size(){return Y(this,!0)},has(t){return X.call(this,t,!0)},add:st("add"),set:st("set"),delete:st("delete"),clear:st("clear"),forEach:nt(!0,!1)},r={get(t){return U(this,t,!0,!0)},get size(){return Y(this,!0)},has(t){return X.call(this,t,!0)},add:st("add"),set:st("set"),delete:st("delete"),clear:st("clear"),forEach:nt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((s=>{t[s]=rt(s,!1,!1),n[s]=rt(s,!0,!1),e[s]=rt(s,!1,!0),r[s]=rt(s,!0,!0)})),[t,n,e,r]}const[it,ct,ut,at]=ot();function lt(t,e){const n=e?t?at:ut:t?ct:it;return(e,r,s)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(o(n,r)&&r in e?n:e,r,s)}const ft={get:lt(!1,!1)},_t={get:lt(!1,!0)},ht={get:lt(!0,!1)},dt={get:lt(!0,!0)},vt=new WeakMap,gt=new WeakMap,pt=new WeakMap,yt=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=>_(t).slice(8,-1))(t))}function Rt(t){return t&&t.__v_isReadonly?t:St(t,!1,q,ft,vt)}function bt(t){return St(t,!1,F,_t,gt)}function kt(t){return St(t,!0,D,ht,pt)}function Et(t){return St(t,!0,G,dt,yt)}function St(t,e,n,r,s){if(!l(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const o=s.get(t);if(o)return o;const i=wt(t);if(0===i)return t;const c=new Proxy(t,2===i?r:n);return s.set(t,c),c}function jt(t){return mt(t)?jt(t.__v_raw):!(!t||!t.__v_isReactive)}function mt(t){return!(!t||!t.__v_isReadonly)}function Ot(t){return jt(t)||mt(t)}function Mt(t){return t&&Mt(t.__v_raw)||t}function Pt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const xt=t=>l(t)?Rt(t):t;function zt(t){return Boolean(t&&!0===t.__v_isRef)}function Wt(t){return Vt(t)}function At(t){return Vt(t,!0)}class Nt{constructor(t,e){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:xt(t)}get value(){return P(Mt(this),0,"value"),this._value}set value(t){d(Mt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:xt(t),x(Mt(this),"set","value",t))}}function Vt(t,e=!1){return zt(t)?t:new Nt(t,e)}function It(t){x(Mt(t),"set","value",void 0)}function Kt(t){return zt(t)?t.value:t}const Bt={get:(t,e,n)=>Kt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return zt(s)&&!zt(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};function Ct(t){return jt(t)?t:new Proxy(t,Bt)}class Lt{constructor(t){this.__v_isRef=!0;const{get:e,set:n}=t((()=>P(this,0,"value")),(()=>x(this,"set","value")));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function qt(t){return new Lt(t)}function Dt(t){const e=i(t)?new Array(t.length):{};for(const n in t)e[n]=Gt(t,n);return e}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){return zt(t[e])?t[e]:new Ft(t,e)}class Ht{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=R(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,x(Mt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){const t=Mt(this);return t._dirty&&(t._value=this.effect(),t._dirty=!1),P(t,0,"value"),t._value}set value(t){this._setter(t)}}function Jt(t){let e,r;return u(t)?(e=t,r=n):(e=t.get,r=t.set),new Ht(e,r,u(t)||!t.set)}export{y as ITERATE_KEY,Jt as computed,qt as customRef,R as effect,O as enableTracking,Ot as isProxy,jt as isReactive,mt as isReadonly,zt as isRef,Pt as markRaw,m as pauseTracking,Ct as proxyRefs,Rt as reactive,kt as readonly,Wt as ref,M as resetTracking,bt as shallowReactive,Et as shallowReadonly,At as shallowRef,b as stop,Mt as toRaw,Gt as toRef,Dt as toRefs,P as track,x as trigger,It as triggerRef,Kt as unref};
|
|
@@ -760,13 +760,10 @@ function shallowRef(value) {
|
|
|
760
760
|
return createRef(value, true);
|
|
761
761
|
}
|
|
762
762
|
class RefImpl {
|
|
763
|
-
_rawValue;
|
|
764
|
-
_shallow;
|
|
765
|
-
_value;
|
|
766
|
-
__v_isRef = true;
|
|
767
763
|
constructor(_rawValue, _shallow) {
|
|
768
764
|
this._rawValue = _rawValue;
|
|
769
765
|
this._shallow = _shallow;
|
|
766
|
+
this.__v_isRef = true;
|
|
770
767
|
this._value = _shallow ? _rawValue : convert(_rawValue);
|
|
771
768
|
}
|
|
772
769
|
get value() {
|
|
@@ -812,10 +809,8 @@ function proxyRefs(objectWithRefs) {
|
|
|
812
809
|
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
813
810
|
}
|
|
814
811
|
class CustomRefImpl {
|
|
815
|
-
_get;
|
|
816
|
-
_set;
|
|
817
|
-
__v_isRef = true;
|
|
818
812
|
constructor(factory) {
|
|
813
|
+
this.__v_isRef = true;
|
|
819
814
|
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
|
820
815
|
this._get = get;
|
|
821
816
|
this._set = set;
|
|
@@ -841,12 +836,10 @@ function toRefs(object) {
|
|
|
841
836
|
return ret;
|
|
842
837
|
}
|
|
843
838
|
class ObjectRefImpl {
|
|
844
|
-
_object;
|
|
845
|
-
_key;
|
|
846
|
-
__v_isRef = true;
|
|
847
839
|
constructor(_object, _key) {
|
|
848
840
|
this._object = _object;
|
|
849
841
|
this._key = _key;
|
|
842
|
+
this.__v_isRef = true;
|
|
850
843
|
}
|
|
851
844
|
get value() {
|
|
852
845
|
return this._object[this._key];
|
|
@@ -862,14 +855,10 @@ function toRef(object, key) {
|
|
|
862
855
|
}
|
|
863
856
|
|
|
864
857
|
class ComputedRefImpl {
|
|
865
|
-
_setter;
|
|
866
|
-
_value;
|
|
867
|
-
_dirty = true;
|
|
868
|
-
effect;
|
|
869
|
-
__v_isRef = true;
|
|
870
|
-
["__v_isReadonly" /* IS_READONLY */];
|
|
871
858
|
constructor(getter, _setter, isReadonly) {
|
|
872
859
|
this._setter = _setter;
|
|
860
|
+
this._dirty = true;
|
|
861
|
+
this.__v_isRef = true;
|
|
873
862
|
this.effect = effect(getter, {
|
|
874
863
|
lazy: true,
|
|
875
864
|
scheduler: () => {
|
|
@@ -819,13 +819,10 @@ var VueReactivity = (function (exports) {
|
|
|
819
819
|
return createRef(value, true);
|
|
820
820
|
}
|
|
821
821
|
class RefImpl {
|
|
822
|
-
_rawValue;
|
|
823
|
-
_shallow;
|
|
824
|
-
_value;
|
|
825
|
-
__v_isRef = true;
|
|
826
822
|
constructor(_rawValue, _shallow) {
|
|
827
823
|
this._rawValue = _rawValue;
|
|
828
824
|
this._shallow = _shallow;
|
|
825
|
+
this.__v_isRef = true;
|
|
829
826
|
this._value = _shallow ? _rawValue : convert(_rawValue);
|
|
830
827
|
}
|
|
831
828
|
get value() {
|
|
@@ -871,10 +868,8 @@ var VueReactivity = (function (exports) {
|
|
|
871
868
|
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
872
869
|
}
|
|
873
870
|
class CustomRefImpl {
|
|
874
|
-
_get;
|
|
875
|
-
_set;
|
|
876
|
-
__v_isRef = true;
|
|
877
871
|
constructor(factory) {
|
|
872
|
+
this.__v_isRef = true;
|
|
878
873
|
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
|
879
874
|
this._get = get;
|
|
880
875
|
this._set = set;
|
|
@@ -900,12 +895,10 @@ var VueReactivity = (function (exports) {
|
|
|
900
895
|
return ret;
|
|
901
896
|
}
|
|
902
897
|
class ObjectRefImpl {
|
|
903
|
-
_object;
|
|
904
|
-
_key;
|
|
905
|
-
__v_isRef = true;
|
|
906
898
|
constructor(_object, _key) {
|
|
907
899
|
this._object = _object;
|
|
908
900
|
this._key = _key;
|
|
901
|
+
this.__v_isRef = true;
|
|
909
902
|
}
|
|
910
903
|
get value() {
|
|
911
904
|
return this._object[this._key];
|
|
@@ -921,14 +914,10 @@ var VueReactivity = (function (exports) {
|
|
|
921
914
|
}
|
|
922
915
|
|
|
923
916
|
class ComputedRefImpl {
|
|
924
|
-
_setter;
|
|
925
|
-
_value;
|
|
926
|
-
_dirty = true;
|
|
927
|
-
effect;
|
|
928
|
-
__v_isRef = true;
|
|
929
|
-
["__v_isReadonly" /* IS_READONLY */];
|
|
930
917
|
constructor(getter, _setter, isReadonly) {
|
|
931
918
|
this._setter = _setter;
|
|
919
|
+
this._dirty = true;
|
|
920
|
+
this.__v_isRef = true;
|
|
932
921
|
this.effect = effect(getter, {
|
|
933
922
|
lazy: true,
|
|
934
923
|
scheduler: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueReactivity=function(
|
|
1
|
+
var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),r=t.split(",");for(let s=0;s<r.length;s++)n[r[s]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n={},r=()=>{},s=Object.assign,i=Object.prototype.hasOwnProperty,o=(t,e)=>i.call(t,e),c=Array.isArray,u=t=>"[object Map]"===h(t),a=t=>"function"==typeof t,l=t=>"symbol"==typeof t,f=t=>null!==t&&"object"==typeof t,_=Object.prototype.toString,h=t=>_.call(t),d=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,v=(t,e)=>t!==e&&(t==t||e==e),g=new WeakMap,p=[];let y;const w=Symbol(""),R=Symbol("");function b(t,e=n){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const r=function(t,e){const n=function(){if(!n.active)return t();if(!p.includes(n)){E(n);try{return O(),p.push(n),y=n,t()}finally{p.pop(),P(),y=p[p.length-1]}}};return n.id=k++,n.allowRecurse=!!e.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,e);return e.lazy||r(),r}let k=0;function E(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 S=[];function j(){S.push(m),m=!1}function O(){S.push(m),m=!0}function P(){const t=S.pop();m=void 0===t||t}function M(t,e,n){if(!m||void 0===y)return;let r=g.get(t);r||g.set(t,r=new Map);let s=r.get(n);s||r.set(n,s=new Set),s.has(y)||(s.add(y),y.deps.push(s))}function x(t,e,n,r,s,i){const o=g.get(t);if(!o)return;const a=new Set,l=t=>{t&&t.forEach((t=>{(t!==y||t.allowRecurse)&&a.add(t)}))};if("clear"===e)o.forEach(l);else if("length"===n&&c(t))o.forEach(((t,e)=>{("length"===e||e>=r)&&l(t)}));else switch(void 0!==n&&l(o.get(n)),e){case"add":c(t)?d(n)&&l(o.get("length")):(l(o.get(w)),u(t)&&l(o.get(R)));break;case"delete":c(t)||(l(o.get(w)),u(t)&&l(o.get(R)));break;case"set":u(t)&&l(o.get(w))}a.forEach((t=>{t.options.scheduler?t.options.scheduler(t):t()}))}const z=e("__proto__,__v_isRef,__isVue"),A=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(l)),W=B(),T=B(!1,!0),V=B(!0),N=B(!0,!0),I=K();function K(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{const n=Array.prototype[e];t[e]=function(...t){const e=St(this);for(let n=0,s=this.length;n<s;n++)M(e,0,n+"");const r=n.apply(e,t);return-1===r||!1===r?n.apply(e,t.map(St)):r}})),["push","pop","shift","unshift","splice"].forEach((e=>{const n=Array.prototype[e];t[e]=function(...t){j();const e=n.apply(this,t);return P(),e}})),t}function B(t=!1,e=!1){return function(n,r,s){if("__v_isReactive"===r)return!t;if("__v_isReadonly"===r)return t;if("__v_raw"===r&&s===(t?e?yt:pt:e?gt:vt).get(n))return n;const i=c(n);if(!t&&i&&o(I,r))return Reflect.get(I,r,s);const u=Reflect.get(n,r,s);if(l(r)?A.has(r):z(r))return u;if(t||M(n,0,r),e)return u;if(Ot(u)){return!i||!d(r)?u.value:u}return f(u)?t?bt(u):Rt(u):u}}function C(t=!1){return function(e,n,r,s){let i=e[n];if(!t&&(r=St(r),i=St(i),!c(e)&&Ot(i)&&!Ot(r)))return i.value=r,!0;const u=c(e)&&d(n)?Number(n)<e.length:o(e,n),a=Reflect.set(e,n,r,s);return e===St(s)&&(u?v(r,i)&&x(e,"set",n,r):x(e,"add",n,r)),a}}const L={get:W,set:C(),deleteProperty:function(t,e){const n=o(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&x(t,"delete",e,void 0),r},has:function(t,e){const n=Reflect.has(t,e);return l(e)&&A.has(e)||M(t,0,e),n},ownKeys:function(t){return M(t,0,c(t)?"length":w),Reflect.ownKeys(t)}},Y={get:V,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},q=s({},L,{get:T,set:C(!0)}),D=s({},Y,{get:N}),F=t=>f(t)?Rt(t):t,G=t=>f(t)?bt(t):t,H=t=>t,J=t=>Reflect.getPrototypeOf(t);function Q(t,e,n=!1,r=!1){const s=St(t=t.__v_raw),i=St(e);e!==i&&!n&&M(s,0,e),!n&&M(s,0,i);const{has:o}=J(s),c=r?H:n?G:F;return o.call(s,e)?c(t.get(e)):o.call(s,i)?c(t.get(i)):void(t!==s&&t.get(e))}function U(t,e=!1){const n=this.__v_raw,r=St(n),s=St(t);return t!==s&&!e&&M(r,0,t),!e&&M(r,0,s),t===s?n.has(t):n.has(t)||n.has(s)}function X(t,e=!1){return t=t.__v_raw,!e&&M(St(t),0,w),Reflect.get(t,"size",t)}function Z(t){t=St(t);const e=St(this);return J(e).has.call(e,t)||(e.add(t),x(e,"add",t,t)),this}function $(t,e){e=St(e);const n=St(this),{has:r,get:s}=J(n);let i=r.call(n,t);i||(t=St(t),i=r.call(n,t));const o=s.call(n,t);return n.set(t,e),i?v(e,o)&&x(n,"set",t,e):x(n,"add",t,e),this}function tt(t){const e=St(this),{has:n,get:r}=J(e);let s=n.call(e,t);s||(t=St(t),s=n.call(e,t)),r&&r.call(e,t);const i=e.delete(t);return s&&x(e,"delete",t,void 0),i}function et(){const t=St(this),e=0!==t.size,n=t.clear();return e&&x(t,"clear",void 0,void 0),n}function nt(t,e){return function(n,r){const s=this,i=s.__v_raw,o=St(i),c=e?H:t?G:F;return!t&&M(o,0,w),i.forEach(((t,e)=>n.call(r,c(t),c(e),s)))}}function rt(t,e,n){return function(...r){const s=this.__v_raw,i=St(s),o=u(i),c="entries"===t||t===Symbol.iterator&&o,a="keys"===t&&o,l=s[t](...r),f=n?H:e?G:F;return!e&&M(i,0,a?R:w),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:c?[f(t[0]),f(t[1])]:f(t),done:e}},[Symbol.iterator](){return this}}}}function st(t){return function(...e){return"delete"!==t&&this}}function it(){const t={get(t){return Q(this,t)},get size(){return X(this)},has:U,add:Z,set:$,delete:tt,clear:et,forEach:nt(!1,!1)},e={get(t){return Q(this,t,!1,!0)},get size(){return X(this)},has:U,add:Z,set:$,delete:tt,clear:et,forEach:nt(!1,!0)},n={get(t){return Q(this,t,!0)},get size(){return X(this,!0)},has(t){return U.call(this,t,!0)},add:st("add"),set:st("set"),delete:st("delete"),clear:st("clear"),forEach:nt(!0,!1)},r={get(t){return Q(this,t,!0,!0)},get size(){return X(this,!0)},has(t){return U.call(this,t,!0)},add:st("add"),set:st("set"),delete:st("delete"),clear:st("clear"),forEach:nt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((s=>{t[s]=rt(s,!1,!1),n[s]=rt(s,!0,!1),e[s]=rt(s,!1,!0),r[s]=rt(s,!0,!0)})),[t,n,e,r]}const[ot,ct,ut,at]=it();function lt(t,e){const n=e?t?at:ut:t?ct:ot;return(e,r,s)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(o(n,r)&&r in e?n:e,r,s)}const ft={get:lt(!1,!1)},_t={get:lt(!1,!0)},ht={get:lt(!0,!1)},dt={get:lt(!0,!0)},vt=new WeakMap,gt=new WeakMap,pt=new WeakMap,yt=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=>h(t).slice(8,-1))(t))}function Rt(t){return t&&t.__v_isReadonly?t:kt(t,!1,L,ft,vt)}function bt(t){return kt(t,!0,Y,ht,pt)}function kt(t,e,n,r,s){if(!f(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=s.get(t);if(i)return i;const o=wt(t);if(0===o)return t;const c=new Proxy(t,2===o?r:n);return s.set(t,c),c}function Et(t){return mt(t)?Et(t.__v_raw):!(!t||!t.__v_isReactive)}function mt(t){return!(!t||!t.__v_isReadonly)}function St(t){return t&&St(t.__v_raw)||t}const jt=t=>f(t)?Rt(t):t;function Ot(t){return Boolean(t&&!0===t.__v_isRef)}class Pt{constructor(t,e){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:jt(t)}get value(){return M(St(this),0,"value"),this._value}set value(t){v(St(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:jt(t),x(St(this),"set","value",t))}}function Mt(t,e=!1){return Ot(t)?t:new Pt(t,e)}function xt(t){return Ot(t)?t.value:t}const zt={get:(t,e,n)=>xt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return Ot(s)&&!Ot(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};class At{constructor(t){this.__v_isRef=!0;const{get:e,set:n}=t((()=>M(this,0,"value")),(()=>x(this,"set","value")));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Wt{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 Tt(t,e){return Ot(t[e])?t[e]:new Wt(t,e)}class Vt{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=b(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,x(St(this),"set","value"))}}),this.__v_isReadonly=n}get value(){const t=St(this);return t._dirty&&(t._value=this.effect(),t._dirty=!1),M(t,0,"value"),t._value}set value(t){this._setter(t)}}return t.ITERATE_KEY=w,t.computed=function(t){let e,n;return a(t)?(e=t,n=r):(e=t.get,n=t.set),new Vt(e,n,a(t)||!t.set)},t.customRef=function(t){return new At(t)},t.effect=b,t.enableTracking=O,t.isProxy=function(t){return Et(t)||mt(t)},t.isReactive=Et,t.isReadonly=mt,t.isRef=Ot,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.pauseTracking=j,t.proxyRefs=function(t){return Et(t)?t:new Proxy(t,zt)},t.reactive=Rt,t.readonly=bt,t.ref=function(t){return Mt(t)},t.resetTracking=P,t.shallowReactive=function(t){return kt(t,!1,q,_t,gt)},t.shallowReadonly=function(t){return kt(t,!0,D,dt,yt)},t.shallowRef=function(t){return Mt(t,!0)},t.stop=function(t){t.active&&(E(t),t.options.onStop&&t.options.onStop(),t.active=!1)},t.toRaw=St,t.toRef=Tt,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=Tt(t,n);return e},t.track=M,t.trigger=x,t.triggerRef=function(t){x(St(t),"set","value",void 0)},t.unref=xt,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.1.
|
|
3
|
+
"version": "3.1.4",
|
|
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.1.
|
|
39
|
+
"@vue/shared": "3.1.4"
|
|
40
40
|
}
|
|
41
41
|
}
|