@vue/reactivity
Advanced tools
Comparing version 3.0.0-rc.8 to 3.0.0-rc.9
@@ -145,9 +145,10 @@ 'use strict'; | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
const shouldTriggerIteration = (type === "add" /* ADD */ && | ||
(!shared.isArray(target) || shared.isIntegerKey(key))) || | ||
(type === "delete" /* DELETE */ && !shared.isArray(target)); | ||
if (isAddOrDelete || | ||
if (shouldTriggerIteration || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
add(depsMap.get(shared.isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
if (shouldTriggerIteration && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
@@ -234,5 +235,3 @@ } | ||
// ref unwrapping - does not apply for Array + integer key. | ||
const shouldUnwrap = !targetIsArray || | ||
keyIsSymbol || | ||
'' + parseInt(key, 10) !== key; | ||
const shouldUnwrap = !targetIsArray || !shared.isIntegerKey(key); | ||
return shouldUnwrap ? res.value : res; | ||
@@ -261,3 +260,5 @@ } | ||
} | ||
const hadKey = shared.hasOwn(target, key); | ||
const hadKey = shared.isArray(target) && shared.isIntegerKey(key) | ||
? Number(key) < target.length | ||
: shared.hasOwn(target, key); | ||
const result = Reflect.set(target, key, value, receiver); | ||
@@ -362,3 +363,5 @@ // don't trigger if target is something up in the prototype chain of original | ||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey); | ||
return target.has(key) || target.has(rawKey); | ||
return key === rawKey | ||
? target.has(key) | ||
: target.has(key) || target.has(rawKey); | ||
} | ||
@@ -365,0 +368,0 @@ function size(target, isReadonly = false) { |
@@ -137,9 +137,10 @@ 'use strict'; | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
const shouldTriggerIteration = (type === "add" /* ADD */ && | ||
(!shared.isArray(target) || shared.isIntegerKey(key))) || | ||
(type === "delete" /* DELETE */ && !shared.isArray(target)); | ||
if (isAddOrDelete || | ||
if (shouldTriggerIteration || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
add(depsMap.get(shared.isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
if (shouldTriggerIteration && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
@@ -215,5 +216,3 @@ } | ||
// ref unwrapping - does not apply for Array + integer key. | ||
const shouldUnwrap = !targetIsArray || | ||
keyIsSymbol || | ||
'' + parseInt(key, 10) !== key; | ||
const shouldUnwrap = !targetIsArray || !shared.isIntegerKey(key); | ||
return shouldUnwrap ? res.value : res; | ||
@@ -242,3 +241,5 @@ } | ||
} | ||
const hadKey = shared.hasOwn(target, key); | ||
const hadKey = shared.isArray(target) && shared.isIntegerKey(key) | ||
? Number(key) < target.length | ||
: shared.hasOwn(target, key); | ||
const result = Reflect.set(target, key, value, receiver); | ||
@@ -337,3 +338,5 @@ // don't trigger if target is something up in the prototype chain of original | ||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey); | ||
return target.has(key) || target.has(rawKey); | ||
return key === rawKey | ||
? target.has(key) | ||
: target.has(key) || target.has(rawKey); | ||
} | ||
@@ -340,0 +343,0 @@ function size(target, isReadonly = false) { |
@@ -8,2 +8,3 @@ const EMPTY_OBJ = Object.freeze({}) | ||
const isFunction = (val) => typeof val === 'function'; | ||
const isString = (val) => typeof val === 'string'; | ||
const isSymbol = (val) => typeof val === 'symbol'; | ||
@@ -16,2 +17,3 @@ const isObject = (val) => val !== null && typeof val === 'object'; | ||
}; | ||
const isIntegerKey = (key) => isString(key) && key[0] !== '-' && '' + parseInt(key, 10) === key; | ||
const cacheStringFunction = (fn) => { | ||
@@ -178,9 +180,10 @@ const cache = Object.create(null); | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
const shouldTriggerIteration = (type === "add" /* ADD */ && | ||
(!isArray(target) || isIntegerKey(key))) || | ||
(type === "delete" /* DELETE */ && !isArray(target)); | ||
if (isAddOrDelete || | ||
if (shouldTriggerIteration || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
add(depsMap.get(isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
if (shouldTriggerIteration && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
@@ -267,5 +270,3 @@ } | ||
// ref unwrapping - does not apply for Array + integer key. | ||
const shouldUnwrap = !targetIsArray || | ||
keyIsSymbol || | ||
'' + parseInt(key, 10) !== key; | ||
const shouldUnwrap = !targetIsArray || !isIntegerKey(key); | ||
return shouldUnwrap ? res.value : res; | ||
@@ -294,3 +295,5 @@ } | ||
} | ||
const hadKey = hasOwn(target, key); | ||
const hadKey = isArray(target) && isIntegerKey(key) | ||
? Number(key) < target.length | ||
: hasOwn(target, key); | ||
const result = Reflect.set(target, key, value, receiver); | ||
@@ -395,3 +398,5 @@ // don't trigger if target is something up in the prototype chain of original | ||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey); | ||
return target.has(key) || target.has(rawKey); | ||
return key === rawKey | ||
? target.has(key) | ||
: target.has(key) || target.has(rawKey); | ||
} | ||
@@ -398,0 +403,0 @@ function size(target, isReadonly = false) { |
@@ -1,1 +0,1 @@ | ||
const t={},e=()=>{},n=Object.assign,r=Object.prototype.hasOwnProperty,s=(t,e)=>r.call(t,e),i=Array.isArray,o=t=>"function"==typeof t,c=t=>"symbol"==typeof t,u=t=>null!==t&&"object"==typeof t,a=Object.prototype.toString,l=t=>(t=>a.call(t))(t).slice(8,-1),f=(t,e)=>t!==e&&(t==t||e==e),_=new WeakMap,h=[];let v;const d=Symbol(""),g=Symbol("");function p(e,n=t){(function(t){return t&&!0===t._isEffect})(e)&&(e=e.raw);const r=function(t,e){const n=function(){if(!n.active)return e.scheduler?void 0:t();if(!h.includes(n)){R(n);try{return k(),h.push(n),v=n,t()}finally{h.pop(),m(),v=h[h.length-1]}}};return n.id=w++,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(e,n);return n.lazy||r(),r}function y(t){t.active&&(R(t),t.options.onStop&&t.options.onStop(),t.active=!1)}let w=0;function R(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let b=!0;const S=[];function E(){S.push(b),b=!1}function k(){S.push(b),b=!0}function m(){const t=S.pop();b=void 0===t||t}function O(t,e,n){if(!b||void 0===v)return;let r=_.get(t);r||_.set(t,r=new Map);let s=r.get(n);s||r.set(n,s=new Set),s.has(v)||(s.add(v),v.deps.push(s))}function j(t,e,n,r,s,o){const c=_.get(t);if(!c)return;const u=new Set,a=t=>{t&&t.forEach(t=>{t!==v&&u.add(t)})};if("clear"===e)c.forEach(a);else if("length"===n&&i(t))c.forEach((t,e)=>{("length"===e||e>=r)&&a(t)});else{void 0!==n&&a(c.get(n));const r="add"===e||"delete"===e&&!i(t);(r||"set"===e&&t instanceof Map)&&a(c.get(i(t)?"length":d)),r&&t instanceof Map&&a(c.get(g))}u.forEach(t=>{t.options.scheduler?t.options.scheduler(t):t()})}const M=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(c)),P=K(),x=K(!1,!0),z=K(!0),W=K(!0,!0),A={};function K(t=!1,e=!1){return function(n,r,o){if("__v_isReactive"===r)return!t;if("__v_isReadonly"===r)return t;if("__v_raw"===r&&o===(t?lt:at).get(n))return n;const a=i(n);if(a&&s(A,r))return Reflect.get(A,r,o);const l=Reflect.get(n,r,o),f=c(r);if(f?M.has(r):"__proto__"===r||"__v_isRef"===r)return l;if(t||O(n,0,r),e)return l;if(St(l)){return!a||f||""+parseInt(r,10)!==r?l.value:l}return u(l)?t?ht(l):ft(l):l}}["includes","indexOf","lastIndexOf"].forEach(t=>{A[t]=function(...e){const n=wt(this);for(let t=0,e=this.length;t<e;t++)O(n,0,t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(wt)):r}});function V(t=!1){return function(e,n,r,o){const c=e[n];if(!t&&(r=wt(r),!i(e)&&St(c)&&!St(r)))return c.value=r,!0;const u=s(e,n),a=Reflect.set(e,n,r,o);return e===wt(o)&&(u?f(r,c)&&j(e,"set",n,r):j(e,"add",n,r)),a}}function I(t,e){const n=Reflect.has(t,e);return c(e)&&M.has(e)||O(t,0,e),n}function B(t){return O(t,0,d),Reflect.ownKeys(t)}const N={get:P,set:V(),deleteProperty:function(t,e){const n=s(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&j(t,"delete",e,void 0),r},has:I,ownKeys:B},q={get:z,has:I,ownKeys:B,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},C=n({},N,{get:x,set:V(!0)}),D=n({},q,{get:W}),F=t=>u(t)?ft(t):t,G=t=>u(t)?ht(t):t,H=t=>t,J=t=>Reflect.getPrototypeOf(t);function L(t,e,n=!1,r=!1){const s=wt(t=t.__v_raw),i=wt(e);e!==i&&!n&&O(s,0,e),!n&&O(s,0,i);const{has:o}=J(s),c=n?G:r?H:F;return o.call(s,e)?c(t.get(e)):o.call(s,i)?c(t.get(i)):void 0}function Q(t,e=!1){const n=this.__v_raw,r=wt(n),s=wt(t);return t!==s&&!e&&O(r,0,t),!e&&O(r,0,s),n.has(t)||n.has(s)}function T(t,e=!1){return t=t.__v_raw,!e&&O(wt(t),0,d),Reflect.get(t,"size",t)}function U(t){t=wt(t);const e=wt(this),n=J(e),r=n.has.call(e,t),s=n.add.call(e,t);return r||j(e,"add",t,t),s}function X(t,e){e=wt(e);const n=wt(this),{has:r,get:s,set:i}=J(n);let o=r.call(n,t);o||(t=wt(t),o=r.call(n,t));const c=s.call(n,t),u=i.call(n,t,e);return o?f(e,c)&&j(n,"set",t,e):j(n,"add",t,e),u}function Y(t){const e=wt(this),{has:n,get:r,delete:s}=J(e);let i=n.call(e,t);i||(t=wt(t),i=n.call(e,t));r&&r.call(e,t);const o=s.call(e,t);return i&&j(e,"delete",t,void 0),o}function Z(){const t=wt(this),e=0!==t.size,n=J(t).clear.call(t);return e&&j(t,"clear",void 0,void 0),n}function $(t,e){return function(n,r){const s=this,i=s.__v_raw,o=wt(i),c=t?G:e?H:F;return!t&&O(o,0,d),i.forEach((t,e)=>n.call(r,c(t),c(e),s))}}function tt(t,e,n){return function(...r){const s=this.__v_raw,i=wt(s),o=i instanceof Map,c="entries"===t||t===Symbol.iterator&&o,u="keys"===t&&o,a=s[t](...r),l=e?G:n?H:F;return!e&&O(i,0,u?g:d),{next(){const{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:c?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function et(t){return function(...e){return"delete"!==t&&this}}const nt={get(t){return L(this,t)},get size(){return T(this)},has:Q,add:U,set:X,delete:Y,clear:Z,forEach:$(!1,!1)},rt={get(t){return L(this,t,!1,!0)},get size(){return T(this)},has:Q,add:U,set:X,delete:Y,clear:Z,forEach:$(!1,!0)},st={get(t){return L(this,t,!0)},get size(){return T(this,!0)},has(t){return Q.call(this,t,!0)},add:et("add"),set:et("set"),delete:et("delete"),clear:et("clear"),forEach:$(!0,!1)};function it(t,e){const n=e?rt:t?st:nt;return(e,r,i)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(s(n,r)&&r in e?n:e,r,i)}["keys","values","entries",Symbol.iterator].forEach(t=>{nt[t]=tt(t,!1,!1),st[t]=tt(t,!0,!1),rt[t]=tt(t,!1,!0)});const ot={get:it(!1,!1)},ct={get:it(!1,!0)},ut={get:it(!0,!1)},at=new WeakMap,lt=new WeakMap;function ft(t){return t&&t.__v_isReadonly?t:dt(t,!1,N,ot)}function _t(t){return dt(t,!1,C,ct)}function ht(t){return dt(t,!0,q,ut)}function vt(t){return dt(t,!0,D,ut)}function dt(t,e,n,r){if(!u(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const s=e?lt:at,i=s.get(t);if(i)return i;const o=(c=t).__v_skip||!Object.isExtensible(c)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(l(c));var c;if(0===o)return t;const a=new Proxy(t,2===o?r:n);return s.set(t,a),a}function gt(t){return pt(t)?gt(t.__v_raw):!(!t||!t.__v_isReactive)}function pt(t){return!(!t||!t.__v_isReadonly)}function yt(t){return gt(t)||pt(t)}function wt(t){return t&&wt(t.__v_raw)||t}function Rt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const bt=t=>u(t)?ft(t):t;function St(t){return Boolean(t&&!0===t.__v_isRef)}function Et(t){return Ot(t)}function kt(t){return Ot(t,!0)}class mt{constructor(t,e=!1){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:bt(t)}get value(){return O(wt(this),0,"value"),this._value}set value(t){f(wt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:bt(t),j(wt(this),"set","value",t))}}function Ot(t,e=!1){return St(t)?t:new mt(t,e)}function jt(t){j(t,"set","value",void 0)}function Mt(t){return St(t)?t.value:t}const Pt={get:(t,e,n)=>Mt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return St(s)&&!St(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};function xt(t){return gt(t)?t:new Proxy(t,Pt)}class zt{constructor(t){this.__v_isRef=!0;const{get:e,set:n}=t(()=>O(this,0,"value"),()=>j(this,"set","value"));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function Wt(t){return new zt(t)}function At(t){const e=i(t)?new Array(t.length):{};for(const n in t)e[n]=Vt(t,n);return e}class Kt{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 Vt(t,e){return new Kt(t,e)}class It{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=p(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,j(wt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),O(wt(this),0,"value"),this._value}set value(t){this._setter(t)}}function Bt(t){let n,r;return o(t)?(n=t,r=e):(n=t.get,r=t.set),new It(n,r,o(t)||!t.set)}export{d as ITERATE_KEY,Bt as computed,Wt as customRef,p as effect,k as enableTracking,yt as isProxy,gt as isReactive,pt as isReadonly,St as isRef,Rt as markRaw,E as pauseTracking,xt as proxyRefs,ft as reactive,ht as readonly,Et as ref,m as resetTracking,_t as shallowReactive,vt as shallowReadonly,kt as shallowRef,y as stop,wt as toRaw,Vt as toRef,At as toRefs,O as track,j as trigger,jt as triggerRef,Mt as unref}; | ||
const t={},e=()=>{},n=Object.assign,r=Object.prototype.hasOwnProperty,s=(t,e)=>r.call(t,e),i=Array.isArray,o=t=>"function"==typeof t,c=t=>"symbol"==typeof t,u=t=>null!==t&&"object"==typeof t,a=Object.prototype.toString,l=t=>(t=>a.call(t))(t).slice(8,-1),f=t=>"string"==typeof t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>t!==e&&(t==t||e==e),h=new WeakMap,v=[];let d;const g=Symbol(""),p=Symbol("");function y(e,n=t){(function(t){return t&&!0===t._isEffect})(e)&&(e=e.raw);const r=function(t,e){const n=function(){if(!n.active)return e.scheduler?void 0:t();if(!v.includes(n)){b(n);try{return k(),v.push(n),d=n,t()}finally{v.pop(),O(),d=v[v.length-1]}}};return n.id=R++,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(e,n);return n.lazy||r(),r}function w(t){t.active&&(b(t),t.options.onStop&&t.options.onStop(),t.active=!1)}let R=0;function b(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 m=[];function E(){m.push(S),S=!1}function k(){m.push(S),S=!0}function O(){const t=m.pop();S=void 0===t||t}function j(t,e,n){if(!S||void 0===d)return;let r=h.get(t);r||h.set(t,r=new Map);let s=r.get(n);s||r.set(n,s=new Set),s.has(d)||(s.add(d),d.deps.push(s))}function M(t,e,n,r,s,o){const c=h.get(t);if(!c)return;const u=new Set,a=t=>{t&&t.forEach(t=>{t!==d&&u.add(t)})};if("clear"===e)c.forEach(a);else if("length"===n&&i(t))c.forEach((t,e)=>{("length"===e||e>=r)&&a(t)});else{void 0!==n&&a(c.get(n));const r="add"===e&&(!i(t)||f(n))||"delete"===e&&!i(t);(r||"set"===e&&t instanceof Map)&&a(c.get(i(t)?"length":g)),r&&t instanceof Map&&a(c.get(p))}u.forEach(t=>{t.options.scheduler?t.options.scheduler(t):t()})}const P=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(c)),x=V(),z=V(!1,!0),W=V(!0),A=V(!0,!0),K={};function V(t=!1,e=!1){return function(n,r,o){if("__v_isReactive"===r)return!t;if("__v_isReadonly"===r)return t;if("__v_raw"===r&&o===(t?ft:lt).get(n))return n;const a=i(n);if(a&&s(K,r))return Reflect.get(K,r,o);const l=Reflect.get(n,r,o);if(c(r)?P.has(r):"__proto__"===r||"__v_isRef"===r)return l;if(t||j(n,0,r),e)return l;if(mt(l)){return!a||!f(r)?l.value:l}return u(l)?t?vt(l):_t(l):l}}["includes","indexOf","lastIndexOf"].forEach(t=>{K[t]=function(...e){const n=Rt(this);for(let t=0,e=this.length;t<e;t++)j(n,0,t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(Rt)):r}});function I(t=!1){return function(e,n,r,o){const c=e[n];if(!t&&(r=Rt(r),!i(e)&&mt(c)&&!mt(r)))return c.value=r,!0;const u=i(e)&&f(n)?Number(n)<e.length:s(e,n),a=Reflect.set(e,n,r,o);return e===Rt(o)&&(u?_(r,c)&&M(e,"set",n,r):M(e,"add",n,r)),a}}function N(t,e){const n=Reflect.has(t,e);return c(e)&&P.has(e)||j(t,0,e),n}function B(t){return j(t,0,g),Reflect.ownKeys(t)}const q={get:x,set:I(),deleteProperty:function(t,e){const n=s(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&M(t,"delete",e,void 0),r},has:N,ownKeys:B},C={get:W,has:N,ownKeys:B,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},D=n({},q,{get:z,set:I(!0)}),F=n({},C,{get:A}),G=t=>u(t)?_t(t):t,H=t=>u(t)?vt(t):t,J=t=>t,L=t=>Reflect.getPrototypeOf(t);function Q(t,e,n=!1,r=!1){const s=Rt(t=t.__v_raw),i=Rt(e);e!==i&&!n&&j(s,0,e),!n&&j(s,0,i);const{has:o}=L(s),c=n?H:r?J:G;return o.call(s,e)?c(t.get(e)):o.call(s,i)?c(t.get(i)):void 0}function T(t,e=!1){const n=this.__v_raw,r=Rt(n),s=Rt(t);return t!==s&&!e&&j(r,0,t),!e&&j(r,0,s),t===s?n.has(t):n.has(t)||n.has(s)}function U(t,e=!1){return t=t.__v_raw,!e&&j(Rt(t),0,g),Reflect.get(t,"size",t)}function X(t){t=Rt(t);const e=Rt(this),n=L(e),r=n.has.call(e,t),s=n.add.call(e,t);return r||M(e,"add",t,t),s}function Y(t,e){e=Rt(e);const n=Rt(this),{has:r,get:s,set:i}=L(n);let o=r.call(n,t);o||(t=Rt(t),o=r.call(n,t));const c=s.call(n,t),u=i.call(n,t,e);return o?_(e,c)&&M(n,"set",t,e):M(n,"add",t,e),u}function Z(t){const e=Rt(this),{has:n,get:r,delete:s}=L(e);let i=n.call(e,t);i||(t=Rt(t),i=n.call(e,t));r&&r.call(e,t);const o=s.call(e,t);return i&&M(e,"delete",t,void 0),o}function $(){const t=Rt(this),e=0!==t.size,n=L(t).clear.call(t);return e&&M(t,"clear",void 0,void 0),n}function tt(t,e){return function(n,r){const s=this,i=s.__v_raw,o=Rt(i),c=t?H:e?J:G;return!t&&j(o,0,g),i.forEach((t,e)=>n.call(r,c(t),c(e),s))}}function et(t,e,n){return function(...r){const s=this.__v_raw,i=Rt(s),o=i instanceof Map,c="entries"===t||t===Symbol.iterator&&o,u="keys"===t&&o,a=s[t](...r),l=e?H:n?J:G;return!e&&j(i,0,u?p:g),{next(){const{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:c?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function nt(t){return function(...e){return"delete"!==t&&this}}const rt={get(t){return Q(this,t)},get size(){return U(this)},has:T,add:X,set:Y,delete:Z,clear:$,forEach:tt(!1,!1)},st={get(t){return Q(this,t,!1,!0)},get size(){return U(this)},has:T,add:X,set:Y,delete:Z,clear:$,forEach:tt(!1,!0)},it={get(t){return Q(this,t,!0)},get size(){return U(this,!0)},has(t){return T.call(this,t,!0)},add:nt("add"),set:nt("set"),delete:nt("delete"),clear:nt("clear"),forEach:tt(!0,!1)};function ot(t,e){const n=e?st:t?it:rt;return(e,r,i)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(s(n,r)&&r in e?n:e,r,i)}["keys","values","entries",Symbol.iterator].forEach(t=>{rt[t]=et(t,!1,!1),it[t]=et(t,!0,!1),st[t]=et(t,!1,!0)});const ct={get:ot(!1,!1)},ut={get:ot(!1,!0)},at={get:ot(!0,!1)},lt=new WeakMap,ft=new WeakMap;function _t(t){return t&&t.__v_isReadonly?t:gt(t,!1,q,ct)}function ht(t){return gt(t,!1,D,ut)}function vt(t){return gt(t,!0,C,at)}function dt(t){return gt(t,!0,F,at)}function gt(t,e,n,r){if(!u(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const s=e?ft:lt,i=s.get(t);if(i)return i;const o=(c=t).__v_skip||!Object.isExtensible(c)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(l(c));var c;if(0===o)return t;const a=new Proxy(t,2===o?r:n);return s.set(t,a),a}function pt(t){return yt(t)?pt(t.__v_raw):!(!t||!t.__v_isReactive)}function yt(t){return!(!t||!t.__v_isReadonly)}function wt(t){return pt(t)||yt(t)}function Rt(t){return t&&Rt(t.__v_raw)||t}function bt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const St=t=>u(t)?_t(t):t;function mt(t){return Boolean(t&&!0===t.__v_isRef)}function Et(t){return jt(t)}function kt(t){return jt(t,!0)}class Ot{constructor(t,e=!1){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:St(t)}get value(){return j(Rt(this),0,"value"),this._value}set value(t){_(Rt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:St(t),M(Rt(this),"set","value",t))}}function jt(t,e=!1){return mt(t)?t:new Ot(t,e)}function Mt(t){M(t,"set","value",void 0)}function Pt(t){return mt(t)?t.value:t}const xt={get:(t,e,n)=>Pt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return mt(s)&&!mt(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};function zt(t){return pt(t)?t:new Proxy(t,xt)}class Wt{constructor(t){this.__v_isRef=!0;const{get:e,set:n}=t(()=>j(this,0,"value"),()=>M(this,"set","value"));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function At(t){return new Wt(t)}function Kt(t){const e=i(t)?new Array(t.length):{};for(const n in t)e[n]=It(t,n);return e}class Vt{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 It(t,e){return new Vt(t,e)}class Nt{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=y(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,M(Rt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),j(Rt(this),0,"value"),this._value}set value(t){this._setter(t)}}function Bt(t){let n,r;return o(t)?(n=t,r=e):(n=t.get,r=t.set),new Nt(n,r,o(t)||!t.set)}export{g as ITERATE_KEY,Bt as computed,At as customRef,y as effect,k as enableTracking,wt as isProxy,pt as isReactive,yt as isReadonly,mt as isRef,bt as markRaw,E as pauseTracking,zt as proxyRefs,_t as reactive,vt as readonly,Et as ref,O as resetTracking,ht as shallowReactive,dt as shallowReadonly,kt as shallowRef,w as stop,Rt as toRaw,It as toRef,Kt as toRefs,j as track,M as trigger,Mt as triggerRef,Pt as unref}; |
@@ -1,2 +0,2 @@ | ||
import { EMPTY_OBJ, isArray, isSymbol, extend, hasOwn, isObject, hasChanged, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared'; | ||
import { EMPTY_OBJ, isArray, isIntegerKey, isSymbol, extend, hasOwn, isObject, hasChanged, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared'; | ||
@@ -141,9 +141,10 @@ const targetMap = new WeakMap(); | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
const shouldTriggerIteration = (type === "add" /* ADD */ && | ||
(!isArray(target) || isIntegerKey(key))) || | ||
(type === "delete" /* DELETE */ && !isArray(target)); | ||
if (isAddOrDelete || | ||
if (shouldTriggerIteration || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
add(depsMap.get(isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
if (shouldTriggerIteration && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
@@ -230,5 +231,3 @@ } | ||
// ref unwrapping - does not apply for Array + integer key. | ||
const shouldUnwrap = !targetIsArray || | ||
keyIsSymbol || | ||
'' + parseInt(key, 10) !== key; | ||
const shouldUnwrap = !targetIsArray || !isIntegerKey(key); | ||
return shouldUnwrap ? res.value : res; | ||
@@ -257,3 +256,5 @@ } | ||
} | ||
const hadKey = hasOwn(target, key); | ||
const hadKey = isArray(target) && isIntegerKey(key) | ||
? Number(key) < target.length | ||
: hasOwn(target, key); | ||
const result = Reflect.set(target, key, value, receiver); | ||
@@ -358,3 +359,5 @@ // don't trigger if target is something up in the prototype chain of original | ||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey); | ||
return target.has(key) || target.has(rawKey); | ||
return key === rawKey | ||
? target.has(key) | ||
: target.has(key) || target.has(rawKey); | ||
} | ||
@@ -361,0 +364,0 @@ function size(target, isReadonly = false) { |
@@ -11,2 +11,3 @@ var VueReactivity = (function (exports) { | ||
const isFunction = (val) => typeof val === 'function'; | ||
const isString = (val) => typeof val === 'string'; | ||
const isSymbol = (val) => typeof val === 'symbol'; | ||
@@ -19,2 +20,3 @@ const isObject = (val) => val !== null && typeof val === 'object'; | ||
}; | ||
const isIntegerKey = (key) => isString(key) && key[0] !== '-' && '' + parseInt(key, 10) === key; | ||
const cacheStringFunction = (fn) => { | ||
@@ -181,9 +183,10 @@ const cache = Object.create(null); | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
const shouldTriggerIteration = (type === "add" /* ADD */ && | ||
(!isArray(target) || isIntegerKey(key))) || | ||
(type === "delete" /* DELETE */ && !isArray(target)); | ||
if (isAddOrDelete || | ||
if (shouldTriggerIteration || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
add(depsMap.get(isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
if (shouldTriggerIteration && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
@@ -270,5 +273,3 @@ } | ||
// ref unwrapping - does not apply for Array + integer key. | ||
const shouldUnwrap = !targetIsArray || | ||
keyIsSymbol || | ||
'' + parseInt(key, 10) !== key; | ||
const shouldUnwrap = !targetIsArray || !isIntegerKey(key); | ||
return shouldUnwrap ? res.value : res; | ||
@@ -297,3 +298,5 @@ } | ||
} | ||
const hadKey = hasOwn(target, key); | ||
const hadKey = isArray(target) && isIntegerKey(key) | ||
? Number(key) < target.length | ||
: hasOwn(target, key); | ||
const result = Reflect.set(target, key, value, receiver); | ||
@@ -398,3 +401,5 @@ // don't trigger if target is something up in the prototype chain of original | ||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey); | ||
return target.has(key) || target.has(rawKey); | ||
return key === rawKey | ||
? target.has(key) | ||
: target.has(key) || target.has(rawKey); | ||
} | ||
@@ -401,0 +406,0 @@ function size(target, isReadonly = false) { |
@@ -1,1 +0,1 @@ | ||
var VueReactivity=function(t){"use strict";const e={},n=()=>{},r=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),o=Array.isArray,c=t=>"function"==typeof t,u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,f=t=>(t=>l.call(t))(t).slice(8,-1),_=(t,e)=>t!==e&&(t==t||e==e),h=new WeakMap,v=[];let d;const g=Symbol(""),y=Symbol("");function p(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 e.scheduler?void 0:t();if(!v.includes(n)){R(n);try{return E(),v.push(n),d=n,t()}finally{v.pop(),m(),d=v[v.length-1]}}};return n.id=w++,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,n);return n.lazy||r(),r}let w=0;function R(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let b=!0;const k=[];function E(){k.push(b),b=!0}function m(){const t=k.pop();b=void 0===t||t}function S(t,e,n){if(!b||void 0===d)return;let r=h.get(t);r||h.set(t,r=new Map);let s=r.get(n);s||r.set(n,s=new Set),s.has(d)||(s.add(d),d.deps.push(s))}function O(t,e,n,r,s,i){const c=h.get(t);if(!c)return;const u=new Set,a=t=>{t&&t.forEach(t=>{t!==d&&u.add(t)})};if("clear"===e)c.forEach(a);else if("length"===n&&o(t))c.forEach((t,e)=>{("length"===e||e>=r)&&a(t)});else{void 0!==n&&a(c.get(n));const r="add"===e||"delete"===e&&!o(t);(r||"set"===e&&t instanceof Map)&&a(c.get(o(t)?"length":g)),r&&t instanceof Map&&a(c.get(y))}u.forEach(t=>{t.options.scheduler?t.options.scheduler(t):t()})}const j=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(u)),P=T(),x=T(!1,!0),M=T(!0),z=T(!0,!0),A={};function T(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?at:ut).get(n))return n;const c=o(n);if(c&&i(A,r))return Reflect.get(A,r,s);const l=Reflect.get(n,r,s),f=u(r);if(f?j.has(r):"__proto__"===r||"__v_isRef"===r)return l;if(t||S(n,0,r),e)return l;if(yt(l)){return!c||f||""+parseInt(r,10)!==r?l.value:l}return a(l)?t?ft(l):lt(l):l}}["includes","indexOf","lastIndexOf"].forEach(t=>{A[t]=function(...e){const n=dt(this);for(let t=0,e=this.length;t<e;t++)S(n,0,t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(dt)):r}});function W(t=!1){return function(e,n,r,s){const c=e[n];if(!t&&(r=dt(r),!o(e)&&yt(c)&&!yt(r)))return c.value=r,!0;const u=i(e,n),a=Reflect.set(e,n,r,s);return e===dt(s)&&(u?_(r,c)&&O(e,"set",n,r):O(e,"add",n,r)),a}}function K(t,e){const n=Reflect.has(t,e);return u(e)&&j.has(e)||S(t,0,e),n}function V(t){return S(t,0,g),Reflect.ownKeys(t)}const I={get:P,set:W(),deleteProperty:function(t,e){const n=i(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&O(t,"delete",e,void 0),r},has:K,ownKeys:V},B={get:M,has:K,ownKeys:V,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},N=r({},I,{get:x,set:W(!0)}),Y=r({},B,{get:z}),q=t=>a(t)?lt(t):t,C=t=>a(t)?ft(t):t,D=t=>t,F=t=>Reflect.getPrototypeOf(t);function G(t,e,n=!1,r=!1){const s=dt(t=t.__v_raw),i=dt(e);e!==i&&!n&&S(s,0,e),!n&&S(s,0,i);const{has:o}=F(s),c=n?C:r?D:q;return o.call(s,e)?c(t.get(e)):o.call(s,i)?c(t.get(i)):void 0}function H(t,e=!1){const n=this.__v_raw,r=dt(n),s=dt(t);return t!==s&&!e&&S(r,0,t),!e&&S(r,0,s),n.has(t)||n.has(s)}function J(t,e=!1){return t=t.__v_raw,!e&&S(dt(t),0,g),Reflect.get(t,"size",t)}function L(t){t=dt(t);const e=dt(this),n=F(e),r=n.has.call(e,t),s=n.add.call(e,t);return r||O(e,"add",t,t),s}function Q(t,e){e=dt(e);const n=dt(this),{has:r,get:s,set:i}=F(n);let o=r.call(n,t);o||(t=dt(t),o=r.call(n,t));const c=s.call(n,t),u=i.call(n,t,e);return o?_(e,c)&&O(n,"set",t,e):O(n,"add",t,e),u}function U(t){const e=dt(this),{has:n,get:r,delete:s}=F(e);let i=n.call(e,t);i||(t=dt(t),i=n.call(e,t));r&&r.call(e,t);const o=s.call(e,t);return i&&O(e,"delete",t,void 0),o}function X(){const t=dt(this),e=0!==t.size,n=F(t).clear.call(t);return e&&O(t,"clear",void 0,void 0),n}function Z(t,e){return function(n,r){const s=this,i=s.__v_raw,o=dt(i),c=t?C:e?D:q;return!t&&S(o,0,g),i.forEach((t,e)=>n.call(r,c(t),c(e),s))}}function $(t,e,n){return function(...r){const s=this.__v_raw,i=dt(s),o=i instanceof Map,c="entries"===t||t===Symbol.iterator&&o,u="keys"===t&&o,a=s[t](...r),l=e?C:n?D:q;return!e&&S(i,0,u?y:g),{next(){const{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:c?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function tt(t){return function(...e){return"delete"!==t&&this}}const et={get(t){return G(this,t)},get size(){return J(this)},has:H,add:L,set:Q,delete:U,clear:X,forEach:Z(!1,!1)},nt={get(t){return G(this,t,!1,!0)},get size(){return J(this)},has:H,add:L,set:Q,delete:U,clear:X,forEach:Z(!1,!0)},rt={get(t){return G(this,t,!0)},get size(){return J(this,!0)},has(t){return H.call(this,t,!0)},add:tt("add"),set:tt("set"),delete:tt("delete"),clear:tt("clear"),forEach:Z(!0,!1)};function st(t,e){const n=e?nt:t?rt:et;return(e,r,s)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(i(n,r)&&r in e?n:e,r,s)}["keys","values","entries",Symbol.iterator].forEach(t=>{et[t]=$(t,!1,!1),rt[t]=$(t,!0,!1),nt[t]=$(t,!1,!0)});const it={get:st(!1,!1)},ot={get:st(!1,!0)},ct={get:st(!0,!1)},ut=new WeakMap,at=new WeakMap;function lt(t){return t&&t.__v_isReadonly?t:_t(t,!1,I,it)}function ft(t){return _t(t,!0,B,ct)}function _t(t,e,n,r){if(!a(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const s=e?at:ut,i=s.get(t);if(i)return i;const o=(c=t).__v_skip||!Object.isExtensible(c)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(f(c));var c;if(0===o)return t;const u=new Proxy(t,2===o?r:n);return s.set(t,u),u}function ht(t){return vt(t)?ht(t.__v_raw):!(!t||!t.__v_isReactive)}function vt(t){return!(!t||!t.__v_isReadonly)}function dt(t){return t&&dt(t.__v_raw)||t}const gt=t=>a(t)?lt(t):t;function yt(t){return Boolean(t&&!0===t.__v_isRef)}class pt{constructor(t,e=!1){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:gt(t)}get value(){return S(dt(this),0,"value"),this._value}set value(t){_(dt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:gt(t),O(dt(this),"set","value",t))}}function wt(t,e=!1){return yt(t)?t:new pt(t,e)}function Rt(t){return yt(t)?t.value:t}const bt={get:(t,e,n)=>Rt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return yt(s)&&!yt(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};class kt{constructor(t){this.__v_isRef=!0;const{get:e,set:n}=t(()=>S(this,0,"value"),()=>O(this,"set","value"));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Et{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 mt(t,e){return new Et(t,e)}class St{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=p(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,O(dt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),S(dt(this),0,"value"),this._value}set value(t){this._setter(t)}}return t.ITERATE_KEY=g,t.computed=function(t){let e,r;return c(t)?(e=t,r=n):(e=t.get,r=t.set),new St(e,r,c(t)||!t.set)},t.customRef=function(t){return new kt(t)},t.effect=p,t.enableTracking=E,t.isProxy=function(t){return ht(t)||vt(t)},t.isReactive=ht,t.isReadonly=vt,t.isRef=yt,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=function(){k.push(b),b=!1},t.proxyRefs=function(t){return ht(t)?t:new Proxy(t,bt)},t.reactive=lt,t.readonly=ft,t.ref=function(t){return wt(t)},t.resetTracking=m,t.shallowReactive=function(t){return _t(t,!1,N,ot)},t.shallowReadonly=function(t){return _t(t,!0,Y,ct)},t.shallowRef=function(t){return wt(t,!0)},t.stop=function(t){t.active&&(R(t),t.options.onStop&&t.options.onStop(),t.active=!1)},t.toRaw=dt,t.toRef=mt,t.toRefs=function(t){const e=o(t)?new Array(t.length):{};for(const n in t)e[n]=mt(t,n);return e},t.track=S,t.trigger=O,t.triggerRef=function(t){O(t,"set","value",void 0)},t.unref=Rt,t}({}); | ||
var VueReactivity=function(t){"use strict";const e={},n=()=>{},r=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),o=Array.isArray,c=t=>"function"==typeof t,u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,f=t=>(t=>l.call(t))(t).slice(8,-1),_=t=>"string"==typeof t&&"-"!==t[0]&&""+parseInt(t,10)===t,h=(t,e)=>t!==e&&(t==t||e==e),v=new WeakMap,d=[];let g;const y=Symbol(""),p=Symbol("");function w(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 e.scheduler?void 0:t();if(!d.includes(n)){b(n);try{return E(),d.push(n),g=n,t()}finally{d.pop(),S(),g=d[d.length-1]}}};return n.id=R++,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,n);return n.lazy||r(),r}let R=0;function b(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let k=!0;const m=[];function E(){m.push(k),k=!0}function S(){const t=m.pop();k=void 0===t||t}function O(t,e,n){if(!k||void 0===g)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(g)||(s.add(g),g.deps.push(s))}function j(t,e,n,r,s,i){const c=v.get(t);if(!c)return;const u=new Set,a=t=>{t&&t.forEach(t=>{t!==g&&u.add(t)})};if("clear"===e)c.forEach(a);else if("length"===n&&o(t))c.forEach((t,e)=>{("length"===e||e>=r)&&a(t)});else{void 0!==n&&a(c.get(n));const r="add"===e&&(!o(t)||_(n))||"delete"===e&&!o(t);(r||"set"===e&&t instanceof Map)&&a(c.get(o(t)?"length":y)),r&&t instanceof Map&&a(c.get(p))}u.forEach(t=>{t.options.scheduler?t.options.scheduler(t):t()})}const P=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(u)),x=W(),M=W(!1,!0),z=W(!0),A=W(!0,!0),T={};function W(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?lt:at).get(n))return n;const c=o(n);if(c&&i(T,r))return Reflect.get(T,r,s);const l=Reflect.get(n,r,s);if(u(r)?P.has(r):"__proto__"===r||"__v_isRef"===r)return l;if(t||O(n,0,r),e)return l;if(pt(l)){return!c||!_(r)?l.value:l}return a(l)?t?_t(l):ft(l):l}}["includes","indexOf","lastIndexOf"].forEach(t=>{T[t]=function(...e){const n=gt(this);for(let t=0,e=this.length;t<e;t++)O(n,0,t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(gt)):r}});function K(t=!1){return function(e,n,r,s){const c=e[n];if(!t&&(r=gt(r),!o(e)&&pt(c)&&!pt(r)))return c.value=r,!0;const u=o(e)&&_(n)?Number(n)<e.length:i(e,n),a=Reflect.set(e,n,r,s);return e===gt(s)&&(u?h(r,c)&&j(e,"set",n,r):j(e,"add",n,r)),a}}function V(t,e){const n=Reflect.has(t,e);return u(e)&&P.has(e)||O(t,0,e),n}function I(t){return O(t,0,y),Reflect.ownKeys(t)}const N={get:x,set:K(),deleteProperty:function(t,e){const n=i(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&j(t,"delete",e,void 0),r},has:V,ownKeys:I},B={get:z,has:V,ownKeys:I,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},Y=r({},N,{get:M,set:K(!0)}),q=r({},B,{get:A}),C=t=>a(t)?ft(t):t,D=t=>a(t)?_t(t):t,F=t=>t,G=t=>Reflect.getPrototypeOf(t);function H(t,e,n=!1,r=!1){const s=gt(t=t.__v_raw),i=gt(e);e!==i&&!n&&O(s,0,e),!n&&O(s,0,i);const{has:o}=G(s),c=n?D:r?F:C;return o.call(s,e)?c(t.get(e)):o.call(s,i)?c(t.get(i)):void 0}function J(t,e=!1){const n=this.__v_raw,r=gt(n),s=gt(t);return t!==s&&!e&&O(r,0,t),!e&&O(r,0,s),t===s?n.has(t):n.has(t)||n.has(s)}function L(t,e=!1){return t=t.__v_raw,!e&&O(gt(t),0,y),Reflect.get(t,"size",t)}function Q(t){t=gt(t);const e=gt(this),n=G(e),r=n.has.call(e,t),s=n.add.call(e,t);return r||j(e,"add",t,t),s}function U(t,e){e=gt(e);const n=gt(this),{has:r,get:s,set:i}=G(n);let o=r.call(n,t);o||(t=gt(t),o=r.call(n,t));const c=s.call(n,t),u=i.call(n,t,e);return o?h(e,c)&&j(n,"set",t,e):j(n,"add",t,e),u}function X(t){const e=gt(this),{has:n,get:r,delete:s}=G(e);let i=n.call(e,t);i||(t=gt(t),i=n.call(e,t));r&&r.call(e,t);const o=s.call(e,t);return i&&j(e,"delete",t,void 0),o}function Z(){const t=gt(this),e=0!==t.size,n=G(t).clear.call(t);return e&&j(t,"clear",void 0,void 0),n}function $(t,e){return function(n,r){const s=this,i=s.__v_raw,o=gt(i),c=t?D:e?F:C;return!t&&O(o,0,y),i.forEach((t,e)=>n.call(r,c(t),c(e),s))}}function tt(t,e,n){return function(...r){const s=this.__v_raw,i=gt(s),o=i instanceof Map,c="entries"===t||t===Symbol.iterator&&o,u="keys"===t&&o,a=s[t](...r),l=e?D:n?F:C;return!e&&O(i,0,u?p:y),{next(){const{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:c?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function et(t){return function(...e){return"delete"!==t&&this}}const nt={get(t){return H(this,t)},get size(){return L(this)},has:J,add:Q,set:U,delete:X,clear:Z,forEach:$(!1,!1)},rt={get(t){return H(this,t,!1,!0)},get size(){return L(this)},has:J,add:Q,set:U,delete:X,clear:Z,forEach:$(!1,!0)},st={get(t){return H(this,t,!0)},get size(){return L(this,!0)},has(t){return J.call(this,t,!0)},add:et("add"),set:et("set"),delete:et("delete"),clear:et("clear"),forEach:$(!0,!1)};function it(t,e){const n=e?rt:t?st:nt;return(e,r,s)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(i(n,r)&&r in e?n:e,r,s)}["keys","values","entries",Symbol.iterator].forEach(t=>{nt[t]=tt(t,!1,!1),st[t]=tt(t,!0,!1),rt[t]=tt(t,!1,!0)});const ot={get:it(!1,!1)},ct={get:it(!1,!0)},ut={get:it(!0,!1)},at=new WeakMap,lt=new WeakMap;function ft(t){return t&&t.__v_isReadonly?t:ht(t,!1,N,ot)}function _t(t){return ht(t,!0,B,ut)}function ht(t,e,n,r){if(!a(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const s=e?lt:at,i=s.get(t);if(i)return i;const o=(c=t).__v_skip||!Object.isExtensible(c)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(f(c));var c;if(0===o)return t;const u=new Proxy(t,2===o?r:n);return s.set(t,u),u}function vt(t){return dt(t)?vt(t.__v_raw):!(!t||!t.__v_isReactive)}function dt(t){return!(!t||!t.__v_isReadonly)}function gt(t){return t&>(t.__v_raw)||t}const yt=t=>a(t)?ft(t):t;function pt(t){return Boolean(t&&!0===t.__v_isRef)}class wt{constructor(t,e=!1){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:yt(t)}get value(){return O(gt(this),0,"value"),this._value}set value(t){h(gt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:yt(t),j(gt(this),"set","value",t))}}function Rt(t,e=!1){return pt(t)?t:new wt(t,e)}function bt(t){return pt(t)?t.value:t}const kt={get:(t,e,n)=>bt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return pt(s)&&!pt(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};class mt{constructor(t){this.__v_isRef=!0;const{get:e,set:n}=t(()=>O(this,0,"value"),()=>j(this,"set","value"));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Et{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 St(t,e){return new Et(t,e)}class Ot{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=w(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,j(gt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),O(gt(this),0,"value"),this._value}set value(t){this._setter(t)}}return t.ITERATE_KEY=y,t.computed=function(t){let e,r;return c(t)?(e=t,r=n):(e=t.get,r=t.set),new Ot(e,r,c(t)||!t.set)},t.customRef=function(t){return new mt(t)},t.effect=w,t.enableTracking=E,t.isProxy=function(t){return vt(t)||dt(t)},t.isReactive=vt,t.isReadonly=dt,t.isRef=pt,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=function(){m.push(k),k=!1},t.proxyRefs=function(t){return vt(t)?t:new Proxy(t,kt)},t.reactive=ft,t.readonly=_t,t.ref=function(t){return Rt(t)},t.resetTracking=S,t.shallowReactive=function(t){return ht(t,!1,Y,ct)},t.shallowReadonly=function(t){return ht(t,!0,q,ut)},t.shallowRef=function(t){return Rt(t,!0)},t.stop=function(t){t.active&&(b(t),t.options.onStop&&t.options.onStop(),t.active=!1)},t.toRaw=gt,t.toRef=St,t.toRefs=function(t){const e=o(t)?new Array(t.length):{};for(const n in t)e[n]=St(t,n);return e},t.track=O,t.trigger=j,t.triggerRef=function(t){j(t,"set","value",void 0)},t.unref=bt,t}({}); |
{ | ||
"name": "@vue/reactivity", | ||
"version": "3.0.0-rc.8", | ||
"version": "3.0.0-rc.9", | ||
"description": "@vue/reactivity", | ||
@@ -38,4 +38,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"@vue/shared": "3.0.0-rc.8" | ||
"@vue/shared": "3.0.0-rc.9" | ||
} | ||
} |
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
169986
4433
+ Added@vue/shared@3.0.0-rc.9(transitive)
- Removed@vue/shared@3.0.0-rc.8(transitive)
Updated@vue/shared@3.0.0-rc.9