@vue/reactivity
Advanced tools
Comparing version 3.0.0-rc.4 to 3.0.0-rc.5
@@ -120,7 +120,3 @@ 'use strict'; | ||
if (effectsToAdd) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
effects.add(effect); | ||
} | ||
}); | ||
effectsToAdd.forEach(effect => effects.add(effect)); | ||
} | ||
@@ -284,3 +280,5 @@ }; | ||
const result = Reflect.has(target, key); | ||
track(target, "has" /* HAS */, key); | ||
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) { | ||
track(target, "has" /* HAS */, key); | ||
} | ||
return result; | ||
@@ -674,3 +672,3 @@ } | ||
value = shallow ? newVal : convert(newVal); | ||
trigger(r, "set" /* SET */, 'value', { newValue: newVal } ); | ||
trigger(r, "set" /* SET */, 'value', newVal); | ||
} | ||
@@ -682,3 +680,3 @@ } | ||
function triggerRef(ref) { | ||
trigger(ref, "set" /* SET */, 'value', { newValue: ref.value } ); | ||
trigger(ref, "set" /* SET */, 'value', ref.value ); | ||
} | ||
@@ -688,2 +686,20 @@ function unref(ref) { | ||
} | ||
const shallowUnwrapHandlers = { | ||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | ||
set: (target, key, value, receiver) => { | ||
const oldValue = target[key]; | ||
if (isRef(oldValue) && !isRef(value)) { | ||
oldValue.value = value; | ||
return true; | ||
} | ||
else { | ||
return Reflect.set(target, key, value, receiver); | ||
} | ||
} | ||
}; | ||
function proxyRefs(objectWithRefs) { | ||
return isReactive(objectWithRefs) | ||
? objectWithRefs | ||
: new Proxy(objectWithRefs, shallowUnwrapHandlers); | ||
} | ||
function customRef(factory) { | ||
@@ -781,2 +797,3 @@ const { get, set } = factory(() => track(r, "get" /* GET */, 'value'), () => trigger(r, "set" /* SET */, 'value')); | ||
exports.pauseTracking = pauseTracking; | ||
exports.proxyRefs = proxyRefs; | ||
exports.reactive = reactive; | ||
@@ -783,0 +800,0 @@ exports.readonly = readonly; |
@@ -112,7 +112,3 @@ 'use strict'; | ||
if (effectsToAdd) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
effects.add(effect); | ||
} | ||
}); | ||
effectsToAdd.forEach(effect => effects.add(effect)); | ||
} | ||
@@ -265,3 +261,5 @@ }; | ||
const result = Reflect.has(target, key); | ||
track(target, "has" /* HAS */, key); | ||
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) { | ||
track(target, "has" /* HAS */, key); | ||
} | ||
return result; | ||
@@ -621,3 +619,3 @@ } | ||
value = shallow ? newVal : convert(newVal); | ||
trigger(r, "set" /* SET */, 'value', void 0); | ||
trigger(r, "set" /* SET */, 'value', newVal); | ||
} | ||
@@ -634,2 +632,20 @@ } | ||
} | ||
const shallowUnwrapHandlers = { | ||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | ||
set: (target, key, value, receiver) => { | ||
const oldValue = target[key]; | ||
if (isRef(oldValue) && !isRef(value)) { | ||
oldValue.value = value; | ||
return true; | ||
} | ||
else { | ||
return Reflect.set(target, key, value, receiver); | ||
} | ||
} | ||
}; | ||
function proxyRefs(objectWithRefs) { | ||
return isReactive(objectWithRefs) | ||
? objectWithRefs | ||
: new Proxy(objectWithRefs, shallowUnwrapHandlers); | ||
} | ||
function customRef(factory) { | ||
@@ -721,2 +737,3 @@ const { get, set } = factory(() => track(r, "get" /* GET */, 'value'), () => trigger(r, "set" /* SET */, 'value')); | ||
exports.pauseTracking = pauseTracking; | ||
exports.proxyRefs = proxyRefs; | ||
exports.reactive = reactive; | ||
@@ -723,0 +740,0 @@ exports.readonly = readonly; |
@@ -68,2 +68,4 @@ | ||
export declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>; | ||
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>; | ||
@@ -150,2 +152,6 @@ | ||
export declare type ShallowUnwrapRef<T> = { | ||
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K]; | ||
}; | ||
declare function stop_2(effect: ReactiveEffect): void; | ||
@@ -152,0 +158,0 @@ export { stop_2 as stop } |
@@ -167,7 +167,3 @@ /** | ||
if (effectsToAdd) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
effects.add(effect); | ||
} | ||
}); | ||
effectsToAdd.forEach(effect => effects.add(effect)); | ||
} | ||
@@ -331,3 +327,5 @@ }; | ||
const result = Reflect.has(target, key); | ||
track(target, "has" /* HAS */, key); | ||
if (!isSymbol(key) || !builtInSymbols.has(key)) { | ||
track(target, "has" /* HAS */, key); | ||
} | ||
return result; | ||
@@ -721,3 +719,3 @@ } | ||
value = shallow ? newVal : convert(newVal); | ||
trigger(r, "set" /* SET */, 'value', { newValue: newVal } ); | ||
trigger(r, "set" /* SET */, 'value', newVal); | ||
} | ||
@@ -729,3 +727,3 @@ } | ||
function triggerRef(ref) { | ||
trigger(ref, "set" /* SET */, 'value', { newValue: ref.value } ); | ||
trigger(ref, "set" /* SET */, 'value', ref.value ); | ||
} | ||
@@ -735,2 +733,20 @@ function unref(ref) { | ||
} | ||
const shallowUnwrapHandlers = { | ||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | ||
set: (target, key, value, receiver) => { | ||
const oldValue = target[key]; | ||
if (isRef(oldValue) && !isRef(value)) { | ||
oldValue.value = value; | ||
return true; | ||
} | ||
else { | ||
return Reflect.set(target, key, value, receiver); | ||
} | ||
} | ||
}; | ||
function proxyRefs(objectWithRefs) { | ||
return isReactive(objectWithRefs) | ||
? objectWithRefs | ||
: new Proxy(objectWithRefs, shallowUnwrapHandlers); | ||
} | ||
function customRef(factory) { | ||
@@ -817,2 +833,2 @@ const { get, set } = factory(() => track(r, "get" /* GET */, 'value'), () => trigger(r, "set" /* SET */, 'value')); | ||
export { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref }; | ||
export { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref }; |
@@ -1,1 +0,1 @@ | ||
function e(e,t){const n=Object.create(null),r=e.split(",");for(let e=0;e<r.length;e++)n[r[e]]=!0;return t?e=>!!n[e.toLowerCase()]:e=>!!n[e]}const t={},n=()=>{},r=Object.assign,o=Object.prototype.hasOwnProperty,c=(e,t)=>o.call(e,t),s=Array.isArray,u=e=>"function"==typeof e,i=e=>"symbol"==typeof e,l=e=>null!==e&&"object"==typeof e,a=Object.prototype.toString,f=e=>(e=>a.call(e))(e).slice(8,-1),_=(e,t)=>e!==t&&(e==e||t==t),v=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},d=new WeakMap,h=[];let p;const g=Symbol(""),y=Symbol("");function R(e,n=t){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const r=function(e,t){const n=function(){if(!n.active)return t.scheduler?void 0:e();if(!h.includes(n)){S(n);try{return j(),h.push(n),p=n,e()}finally{h.pop(),k(),p=h[h.length-1]}}};return n.id=b++,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,n);return n.lazy||r(),r}function w(e){e.active&&(S(e),e.options.onStop&&e.options.onStop(),e.active=!1)}let b=0;function S(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let O=!0;const m=[];function E(){m.push(O),O=!1}function j(){m.push(O),O=!0}function k(){const e=m.pop();O=void 0===e||e}function M(e,t,n){if(!O||void 0===p)return;let r=d.get(e);r||d.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=new Set),o.has(p)||(o.add(p),p.deps.push(o))}function z(e,t,n,r,o,c){const u=d.get(e);if(!u)return;const i=new Set,l=e=>{e&&e.forEach(e=>{e===p&&O||i.add(e)})};if("clear"===t)u.forEach(l);else if("length"===n&&s(e))u.forEach((e,t)=>{("length"===t||t>=r)&&l(e)});else{void 0!==n&&l(u.get(n));const r="add"===t||"delete"===t&&!s(e);(r||"set"===t&&e instanceof Map)&&l(u.get(s(e)?"length":g)),r&&e instanceof Map&&l(u.get(y))}i.forEach(e=>{e.options.scheduler?e.options.scheduler(e):e()})}const P=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(i)),x=F(),W=F(!1,!0),A=F(!0),K=F(!0,!0),C={};function F(e=!1,t=!1){return function(n,r,o){if("__v_isReactive"===r)return!e;if("__v_isReadonly"===r)return e;if("__v_raw"===r&&o===(e?n.__v_readonly:n.__v_reactive))return n;const u=s(n);if(u&&c(C,r))return Reflect.get(C,r,o);const a=Reflect.get(n,r,o);return(i(r)?P.has(r):"__proto__"===r||"__v_isRef"===r)?a:(e||M(n,0,r),t?a:me(a)?u?a:a.value:l(a)?e?he(a):ve(a):a)}}["includes","indexOf","lastIndexOf"].forEach(e=>{C[e]=function(...t){const n=be(this);for(let e=0,t=this.length;e<t;e++)M(n,0,e+"");const r=n[e](...t);return-1===r||!1===r?n[e](...t.map(be)):r}});function I(e=!1){return function(t,n,r,o){const u=t[n];if(!e&&(r=be(r),!s(t)&&me(u)&&!me(r)))return u.value=r,!0;const i=c(t,n),l=Reflect.set(t,n,r,o);return t===be(o)&&(i?_(r,u)&&z(t,"set",n,r):z(t,"add",n,r)),l}}function L(e,t){const n=Reflect.has(e,t);return M(e,0,t),n}function N(e){return M(e,0,g),Reflect.ownKeys(e)}const q={get:x,set:I(),deleteProperty:function(e,t){const n=c(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&z(e,"delete",t,void 0),r},has:L,ownKeys:N},B={get:A,has:L,ownKeys:N,set:(e,t)=>!0,deleteProperty:(e,t)=>!0},D=r({},q,{get:W,set:I(!0)}),G=r({},B,{get:K}),H=e=>l(e)?ve(e):e,J=e=>l(e)?he(e):e,Q=e=>e,T=e=>Reflect.getPrototypeOf(e);function U(e,t,n){e=be(e);const r=be(t);t!==r&&M(e,0,t),M(e,0,r);const{has:o,get:c}=T(e);return o.call(e,t)?n(c.call(e,t)):o.call(e,r)?n(c.call(e,r)):void 0}function V(e){const t=be(this),n=be(e);e!==n&&M(t,0,e),M(t,0,n);const r=T(t).has;return r.call(t,e)||r.call(t,n)}function X(e){return M(e=be(e),0,g),Reflect.get(T(e),"size",e)}function Y(e){e=be(e);const t=be(this),n=T(t),r=n.has.call(t,e),o=n.add.call(t,e);return r||z(t,"add",e,e),o}function Z(e,t){t=be(t);const n=be(this),{has:r,get:o,set:c}=T(n);let s=r.call(n,e);s||(e=be(e),s=r.call(n,e));const u=o.call(n,e),i=c.call(n,e,t);return s?_(t,u)&&z(n,"set",e,t):z(n,"add",e,t),i}function $(e){const t=be(this),{has:n,get:r,delete:o}=T(t);let c=n.call(t,e);c||(e=be(e),c=n.call(t,e));r&&r.call(t,e);const s=o.call(t,e);return c&&z(t,"delete",e,void 0),s}function ee(){const e=be(this),t=0!==e.size,n=T(e).clear.call(e);return t&&z(e,"clear",void 0,void 0),n}function te(e,t){return function(n,r){const o=this,c=be(o),s=e?J:t?Q:H;return!e&&M(c,0,g),T(c).forEach.call(c,(function(e,t){return n.call(r,s(e),s(t),o)}))}}function ne(e,t,n){return function(...r){const o=be(this),c=o instanceof Map,s="entries"===e||e===Symbol.iterator&&c,u="keys"===e&&c,i=T(o)[e].apply(o,r),l=t?J:n?Q:H;return!t&&M(o,0,u?y:g),{next(){const{value:e,done:t}=i.next();return t?{value:e,done:t}:{value:s?[l(e[0]),l(e[1])]:l(e),done:t}},[Symbol.iterator](){return this}}}}function re(e){return function(...t){return"delete"!==e&&this}}const oe={get(e){return U(this,e,H)},get size(){return X(this)},has:V,add:Y,set:Z,delete:$,clear:ee,forEach:te(!1,!1)},ce={get(e){return U(this,e,Q)},get size(){return X(this)},has:V,add:Y,set:Z,delete:$,clear:ee,forEach:te(!1,!0)},se={get(e){return U(this,e,J)},get size(){return X(this)},has:V,add:re("add"),set:re("set"),delete:re("delete"),clear:re("clear"),forEach:te(!0,!1)};function ue(e,t){const n=t?ce:e?se:oe;return(t,r,o)=>"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(c(n,r)&&r in t?n:t,r,o)}["keys","values","entries",Symbol.iterator].forEach(e=>{oe[e]=ne(e,!1,!1),se[e]=ne(e,!0,!1),ce[e]=ne(e,!1,!0)});const ie={get:ue(!1,!1)},le={get:ue(!1,!0)},ae={get:ue(!0,!1)},fe=new Set([Set,Map,WeakMap,WeakSet]),_e=e("Object,Array,Map,Set,WeakMap,WeakSet");function ve(e){return e&&e.__v_isReadonly?e:ge(e,!1,q,ie)}function de(e){return ge(e,!1,D,le)}function he(e){return ge(e,!0,B,ae)}function pe(e){return ge(e,!0,G,ae)}function ge(e,t,n,r){if(!l(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const o=t?"__v_readonly":"__v_reactive";if(c(e,o))return e[o];if((s=e).__v_skip||!_e(f(s))||Object.isFrozen(s))return e;var s;const u=new Proxy(e,fe.has(e.constructor)?r:n);return v(e,o,u),u}function ye(e){return Re(e)?ye(e.__v_raw):!(!e||!e.__v_isReactive)}function Re(e){return!(!e||!e.__v_isReadonly)}function we(e){return ye(e)||Re(e)}function be(e){return e&&be(e.__v_raw)||e}function Se(e){return v(e,"__v_skip",!0),e}const Oe=e=>l(e)?ve(e):e;function me(e){return!!e&&!0===e.__v_isRef}function Ee(e){return ke(e)}function je(e){return ke(e,!0)}function ke(e,t=!1){if(me(e))return e;let n=t?e:Oe(e);const r={__v_isRef:!0,get value(){return M(r,0,"value"),n},set value(o){_(be(o),e)&&(e=o,n=t?o:Oe(o),z(r,"set","value",void 0))}};return r}function Me(e){z(e,"set","value",void 0)}function ze(e){return me(e)?e.value:e}function Pe(e){const{get:t,set:n}=e(()=>M(r,0,"value"),()=>z(r,"set","value")),r={__v_isRef:!0,get value(){return t()},set value(e){n(e)}};return r}function xe(e){const t={};for(const n in e)t[n]=We(e,n);return t}function We(e,t){return{__v_isRef:!0,get value(){return e[t]},set value(n){e[t]=n}}}function Ae(e){let t,r;u(e)?(t=e,r=n):(t=e.get,r=e.set);let o,c,s=!0;const i=R(t,{lazy:!0,scheduler:()=>{s||(s=!0,z(c,"set","value"))}});return c={__v_isRef:!0,__v_isReadonly:u(e)||!e.set,effect:i,get value(){return s&&(o=i(),s=!1),M(c,0,"value"),o},set value(e){r(e)}},c}export{g as ITERATE_KEY,Ae as computed,Pe as customRef,R as effect,j as enableTracking,we as isProxy,ye as isReactive,Re as isReadonly,me as isRef,Se as markRaw,E as pauseTracking,ve as reactive,he as readonly,Ee as ref,k as resetTracking,de as shallowReactive,pe as shallowReadonly,je as shallowRef,w as stop,be as toRaw,We as toRef,xe as toRefs,M as track,z as trigger,Me as triggerRef,ze as unref}; | ||
function e(e,t){const n=Object.create(null),r=e.split(",");for(let e=0;e<r.length;e++)n[r[e]]=!0;return t?e=>!!n[e.toLowerCase()]:e=>!!n[e]}const t={},n=()=>{},r=Object.assign,o=Object.prototype.hasOwnProperty,c=(e,t)=>o.call(e,t),s=Array.isArray,u=e=>"function"==typeof e,i=e=>"symbol"==typeof e,l=e=>null!==e&&"object"==typeof e,a=Object.prototype.toString,f=e=>(e=>a.call(e))(e).slice(8,-1),_=(e,t)=>e!==t&&(e==e||t==t),v=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},d=new WeakMap,h=[];let p;const g=Symbol(""),y=Symbol("");function R(e,n=t){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const r=function(e,t){const n=function(){if(!n.active)return t.scheduler?void 0:e();if(!h.includes(n)){S(n);try{return j(),h.push(n),p=n,e()}finally{h.pop(),k(),p=h[h.length-1]}}};return n.id=b++,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,n);return n.lazy||r(),r}function w(e){e.active&&(S(e),e.options.onStop&&e.options.onStop(),e.active=!1)}let b=0;function S(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let O=!0;const m=[];function E(){m.push(O),O=!1}function j(){m.push(O),O=!0}function k(){const e=m.pop();O=void 0===e||e}function M(e,t,n){if(!O||void 0===p)return;let r=d.get(e);r||d.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=new Set),o.has(p)||(o.add(p),p.deps.push(o))}function P(e,t,n,r,o,c){const u=d.get(e);if(!u)return;const i=new Set,l=e=>{e&&e.forEach(e=>i.add(e))};if("clear"===t)u.forEach(l);else if("length"===n&&s(e))u.forEach((e,t)=>{("length"===t||t>=r)&&l(e)});else{void 0!==n&&l(u.get(n));const r="add"===t||"delete"===t&&!s(e);(r||"set"===t&&e instanceof Map)&&l(u.get(s(e)?"length":g)),r&&e instanceof Map&&l(u.get(y))}i.forEach(e=>{e.options.scheduler?e.options.scheduler(e):e()})}const z=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(i)),x=F(),W=F(!1,!0),A=F(!0),K=F(!0,!0),C={};function F(e=!1,t=!1){return function(n,r,o){if("__v_isReactive"===r)return!e;if("__v_isReadonly"===r)return e;if("__v_raw"===r&&o===(e?n.__v_readonly:n.__v_reactive))return n;const u=s(n);if(u&&c(C,r))return Reflect.get(C,r,o);const a=Reflect.get(n,r,o);return(i(r)?z.has(r):"__proto__"===r||"__v_isRef"===r)?a:(e||M(n,0,r),t?a:me(a)?u?a:a.value:l(a)?e?he(a):ve(a):a)}}["includes","indexOf","lastIndexOf"].forEach(e=>{C[e]=function(...t){const n=be(this);for(let e=0,t=this.length;e<t;e++)M(n,0,e+"");const r=n[e](...t);return-1===r||!1===r?n[e](...t.map(be)):r}});function I(e=!1){return function(t,n,r,o){const u=t[n];if(!e&&(r=be(r),!s(t)&&me(u)&&!me(r)))return u.value=r,!0;const i=c(t,n),l=Reflect.set(t,n,r,o);return t===be(o)&&(i?_(r,u)&&P(t,"set",n,r):P(t,"add",n,r)),l}}function L(e,t){const n=Reflect.has(e,t);return i(t)&&z.has(t)||M(e,0,t),n}function N(e){return M(e,0,g),Reflect.ownKeys(e)}const q={get:x,set:I(),deleteProperty:function(e,t){const n=c(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&P(e,"delete",t,void 0),r},has:L,ownKeys:N},B={get:A,has:L,ownKeys:N,set:(e,t)=>!0,deleteProperty:(e,t)=>!0},D=r({},q,{get:W,set:I(!0)}),G=r({},B,{get:K}),H=e=>l(e)?ve(e):e,J=e=>l(e)?he(e):e,Q=e=>e,T=e=>Reflect.getPrototypeOf(e);function U(e,t,n){e=be(e);const r=be(t);t!==r&&M(e,0,t),M(e,0,r);const{has:o,get:c}=T(e);return o.call(e,t)?n(c.call(e,t)):o.call(e,r)?n(c.call(e,r)):void 0}function V(e){const t=be(this),n=be(e);e!==n&&M(t,0,e),M(t,0,n);const r=T(t).has;return r.call(t,e)||r.call(t,n)}function X(e){return M(e=be(e),0,g),Reflect.get(T(e),"size",e)}function Y(e){e=be(e);const t=be(this),n=T(t),r=n.has.call(t,e),o=n.add.call(t,e);return r||P(t,"add",e,e),o}function Z(e,t){t=be(t);const n=be(this),{has:r,get:o,set:c}=T(n);let s=r.call(n,e);s||(e=be(e),s=r.call(n,e));const u=o.call(n,e),i=c.call(n,e,t);return s?_(t,u)&&P(n,"set",e,t):P(n,"add",e,t),i}function $(e){const t=be(this),{has:n,get:r,delete:o}=T(t);let c=n.call(t,e);c||(e=be(e),c=n.call(t,e));r&&r.call(t,e);const s=o.call(t,e);return c&&P(t,"delete",e,void 0),s}function ee(){const e=be(this),t=0!==e.size,n=T(e).clear.call(e);return t&&P(e,"clear",void 0,void 0),n}function te(e,t){return function(n,r){const o=this,c=be(o),s=e?J:t?Q:H;return!e&&M(c,0,g),T(c).forEach.call(c,(function(e,t){return n.call(r,s(e),s(t),o)}))}}function ne(e,t,n){return function(...r){const o=be(this),c=o instanceof Map,s="entries"===e||e===Symbol.iterator&&c,u="keys"===e&&c,i=T(o)[e].apply(o,r),l=t?J:n?Q:H;return!t&&M(o,0,u?y:g),{next(){const{value:e,done:t}=i.next();return t?{value:e,done:t}:{value:s?[l(e[0]),l(e[1])]:l(e),done:t}},[Symbol.iterator](){return this}}}}function re(e){return function(...t){return"delete"!==e&&this}}const oe={get(e){return U(this,e,H)},get size(){return X(this)},has:V,add:Y,set:Z,delete:$,clear:ee,forEach:te(!1,!1)},ce={get(e){return U(this,e,Q)},get size(){return X(this)},has:V,add:Y,set:Z,delete:$,clear:ee,forEach:te(!1,!0)},se={get(e){return U(this,e,J)},get size(){return X(this)},has:V,add:re("add"),set:re("set"),delete:re("delete"),clear:re("clear"),forEach:te(!0,!1)};function ue(e,t){const n=t?ce:e?se:oe;return(t,r,o)=>"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(c(n,r)&&r in t?n:t,r,o)}["keys","values","entries",Symbol.iterator].forEach(e=>{oe[e]=ne(e,!1,!1),se[e]=ne(e,!0,!1),ce[e]=ne(e,!1,!0)});const ie={get:ue(!1,!1)},le={get:ue(!1,!0)},ae={get:ue(!0,!1)},fe=new Set([Set,Map,WeakMap,WeakSet]),_e=e("Object,Array,Map,Set,WeakMap,WeakSet");function ve(e){return e&&e.__v_isReadonly?e:ge(e,!1,q,ie)}function de(e){return ge(e,!1,D,le)}function he(e){return ge(e,!0,B,ae)}function pe(e){return ge(e,!0,G,ae)}function ge(e,t,n,r){if(!l(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const o=t?"__v_readonly":"__v_reactive";if(c(e,o))return e[o];if((s=e).__v_skip||!_e(f(s))||Object.isFrozen(s))return e;var s;const u=new Proxy(e,fe.has(e.constructor)?r:n);return v(e,o,u),u}function ye(e){return Re(e)?ye(e.__v_raw):!(!e||!e.__v_isReactive)}function Re(e){return!(!e||!e.__v_isReadonly)}function we(e){return ye(e)||Re(e)}function be(e){return e&&be(e.__v_raw)||e}function Se(e){return v(e,"__v_skip",!0),e}const Oe=e=>l(e)?ve(e):e;function me(e){return!!e&&!0===e.__v_isRef}function Ee(e){return ke(e)}function je(e){return ke(e,!0)}function ke(e,t=!1){if(me(e))return e;let n=t?e:Oe(e);const r={__v_isRef:!0,get value(){return M(r,0,"value"),n},set value(o){_(be(o),e)&&(e=o,n=t?o:Oe(o),P(r,"set","value",o))}};return r}function Me(e){P(e,"set","value",void 0)}function Pe(e){return me(e)?e.value:e}const ze={get:(e,t,n)=>Pe(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return me(o)&&!me(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function xe(e){return ye(e)?e:new Proxy(e,ze)}function We(e){const{get:t,set:n}=e(()=>M(r,0,"value"),()=>P(r,"set","value")),r={__v_isRef:!0,get value(){return t()},set value(e){n(e)}};return r}function Ae(e){const t={};for(const n in e)t[n]=Ke(e,n);return t}function Ke(e,t){return{__v_isRef:!0,get value(){return e[t]},set value(n){e[t]=n}}}function Ce(e){let t,r;u(e)?(t=e,r=n):(t=e.get,r=e.set);let o,c,s=!0;const i=R(t,{lazy:!0,scheduler:()=>{s||(s=!0,P(c,"set","value"))}});return c={__v_isRef:!0,__v_isReadonly:u(e)||!e.set,effect:i,get value(){return s&&(o=i(),s=!1),M(c,0,"value"),o},set value(e){r(e)}},c}export{g as ITERATE_KEY,Ce as computed,We as customRef,R as effect,j as enableTracking,we as isProxy,ye as isReactive,Re as isReadonly,me as isRef,Se as markRaw,E as pauseTracking,xe as proxyRefs,ve as reactive,he as readonly,Ee as ref,k as resetTracking,de as shallowReactive,pe as shallowReadonly,je as shallowRef,w as stop,be as toRaw,Ke as toRef,Ae as toRefs,M as track,P as trigger,Me as triggerRef,Pe as unref}; |
@@ -116,7 +116,3 @@ import { EMPTY_OBJ, isArray, isSymbol, extend, hasOwn, isObject, hasChanged, capitalize, toRawType, def, makeMap, isFunction, NOOP } from '@vue/shared'; | ||
if (effectsToAdd) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
effects.add(effect); | ||
} | ||
}); | ||
effectsToAdd.forEach(effect => effects.add(effect)); | ||
} | ||
@@ -280,3 +276,5 @@ }; | ||
const result = Reflect.has(target, key); | ||
track(target, "has" /* HAS */, key); | ||
if (!isSymbol(key) || !builtInSymbols.has(key)) { | ||
track(target, "has" /* HAS */, key); | ||
} | ||
return result; | ||
@@ -671,3 +669,3 @@ } | ||
value = shallow ? newVal : convert(newVal); | ||
trigger(r, "set" /* SET */, 'value', (process.env.NODE_ENV !== 'production') ? { newValue: newVal } : void 0); | ||
trigger(r, "set" /* SET */, 'value', newVal); | ||
} | ||
@@ -679,3 +677,3 @@ } | ||
function triggerRef(ref) { | ||
trigger(ref, "set" /* SET */, 'value', (process.env.NODE_ENV !== 'production') ? { newValue: ref.value } : void 0); | ||
trigger(ref, "set" /* SET */, 'value', (process.env.NODE_ENV !== 'production') ? ref.value : void 0); | ||
} | ||
@@ -685,2 +683,20 @@ function unref(ref) { | ||
} | ||
const shallowUnwrapHandlers = { | ||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | ||
set: (target, key, value, receiver) => { | ||
const oldValue = target[key]; | ||
if (isRef(oldValue) && !isRef(value)) { | ||
oldValue.value = value; | ||
return true; | ||
} | ||
else { | ||
return Reflect.set(target, key, value, receiver); | ||
} | ||
} | ||
}; | ||
function proxyRefs(objectWithRefs) { | ||
return isReactive(objectWithRefs) | ||
? objectWithRefs | ||
: new Proxy(objectWithRefs, shallowUnwrapHandlers); | ||
} | ||
function customRef(factory) { | ||
@@ -768,2 +784,2 @@ const { get, set } = factory(() => track(r, "get" /* GET */, 'value'), () => trigger(r, "set" /* SET */, 'value')); | ||
export { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref }; | ||
export { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref }; |
@@ -170,7 +170,3 @@ var VueReactivity = (function (exports) { | ||
if (effectsToAdd) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
effects.add(effect); | ||
} | ||
}); | ||
effectsToAdd.forEach(effect => effects.add(effect)); | ||
} | ||
@@ -334,3 +330,5 @@ }; | ||
const result = Reflect.has(target, key); | ||
track(target, "has" /* HAS */, key); | ||
if (!isSymbol(key) || !builtInSymbols.has(key)) { | ||
track(target, "has" /* HAS */, key); | ||
} | ||
return result; | ||
@@ -724,3 +722,3 @@ } | ||
value = shallow ? newVal : convert(newVal); | ||
trigger(r, "set" /* SET */, 'value', { newValue: newVal } ); | ||
trigger(r, "set" /* SET */, 'value', newVal); | ||
} | ||
@@ -732,3 +730,3 @@ } | ||
function triggerRef(ref) { | ||
trigger(ref, "set" /* SET */, 'value', { newValue: ref.value } ); | ||
trigger(ref, "set" /* SET */, 'value', ref.value ); | ||
} | ||
@@ -738,2 +736,20 @@ function unref(ref) { | ||
} | ||
const shallowUnwrapHandlers = { | ||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | ||
set: (target, key, value, receiver) => { | ||
const oldValue = target[key]; | ||
if (isRef(oldValue) && !isRef(value)) { | ||
oldValue.value = value; | ||
return true; | ||
} | ||
else { | ||
return Reflect.set(target, key, value, receiver); | ||
} | ||
} | ||
}; | ||
function proxyRefs(objectWithRefs) { | ||
return isReactive(objectWithRefs) | ||
? objectWithRefs | ||
: new Proxy(objectWithRefs, shallowUnwrapHandlers); | ||
} | ||
function customRef(factory) { | ||
@@ -831,2 +847,3 @@ const { get, set } = factory(() => track(r, "get" /* GET */, 'value'), () => trigger(r, "set" /* SET */, 'value')); | ||
exports.pauseTracking = pauseTracking; | ||
exports.proxyRefs = proxyRefs; | ||
exports.reactive = reactive; | ||
@@ -833,0 +850,0 @@ exports.readonly = readonly; |
@@ -1,1 +0,1 @@ | ||
var VueReactivity=function(e){"use strict";function t(e,t){const n=Object.create(null),r=e.split(",");for(let e=0;e<r.length;e++)n[r[e]]=!0;return t?e=>!!n[e.toLowerCase()]:e=>!!n[e]}const n={},r=()=>{},o=Object.assign,c=Object.prototype.hasOwnProperty,s=(e,t)=>c.call(e,t),i=Array.isArray,u=e=>"function"==typeof e,a=e=>"symbol"==typeof e,l=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,_=e=>(e=>f.call(e))(e).slice(8,-1),v=(e,t)=>e!==t&&(e==e||t==t),d=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},h=new WeakMap,g=[];let p;const y=Symbol(""),R=Symbol("");function w(e,t=n){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const r=function(e,t){const n=function(){if(!n.active)return t.scheduler?void 0:e();if(!g.includes(n)){S(n);try{return k(),g.push(n),p=n,e()}finally{g.pop(),O(),p=g[g.length-1]}}};return n.id=b++,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,t);return t.lazy||r(),r}let b=0;function S(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let m=!0;const E=[];function k(){E.push(m),m=!0}function O(){const e=E.pop();m=void 0===e||e}function j(e,t,n){if(!m||void 0===p)return;let r=h.get(e);r||h.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=new Set),o.has(p)||(o.add(p),p.deps.push(o))}function M(e,t,n,r,o,c){const s=h.get(e);if(!s)return;const u=new Set,a=e=>{e&&e.forEach(e=>{e===p&&m||u.add(e)})};if("clear"===t)s.forEach(a);else if("length"===n&&i(e))s.forEach((e,t)=>{("length"===t||t>=r)&&a(e)});else{void 0!==n&&a(s.get(n));const r="add"===t||"delete"===t&&!i(e);(r||"set"===t&&e instanceof Map)&&a(s.get(i(e)?"length":y)),r&&e instanceof Map&&a(s.get(R))}u.forEach(e=>{e.options.scheduler?e.options.scheduler(e):e()})}const P=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(a)),z=K(),x=K(!1,!0),T=K(!0),W=K(!0,!0),A={};function K(e=!1,t=!1){return function(n,r,o){if("__v_isReactive"===r)return!e;if("__v_isReadonly"===r)return e;if("__v_raw"===r&&o===(e?n.__v_readonly:n.__v_reactive))return n;const c=i(n);if(c&&s(A,r))return Reflect.get(A,r,o);const u=Reflect.get(n,r,o);return(a(r)?P.has(r):"__proto__"===r||"__v_isRef"===r)?u:(e||j(n,0,r),t?u:Re(u)?c?u:u.value:l(u)?e?ve(u):_e(u):u)}}["includes","indexOf","lastIndexOf"].forEach(e=>{A[e]=function(...t){const n=pe(this);for(let e=0,t=this.length;e<t;e++)j(n,0,e+"");const r=n[e](...t);return-1===r||!1===r?n[e](...t.map(pe)):r}});function I(e=!1){return function(t,n,r,o){const c=t[n];if(!e&&(r=pe(r),!i(t)&&Re(c)&&!Re(r)))return c.value=r,!0;const u=s(t,n),a=Reflect.set(t,n,r,o);return t===pe(o)&&(u?v(r,c)&&M(t,"set",n,r):M(t,"add",n,r)),a}}function C(e,t){const n=Reflect.has(e,t);return j(e,0,t),n}function F(e){return j(e,0,y),Reflect.ownKeys(e)}const L={get:z,set:I(),deleteProperty:function(e,t){const n=s(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&M(e,"delete",t,void 0),r},has:C,ownKeys:F},N={get:T,has:C,ownKeys:F,set:(e,t)=>!0,deleteProperty:(e,t)=>!0},V=o({},L,{get:x,set:I(!0)}),Y=o({},N,{get:W}),q=e=>l(e)?_e(e):e,B=e=>l(e)?ve(e):e,D=e=>e,G=e=>Reflect.getPrototypeOf(e);function H(e,t,n){e=pe(e);const r=pe(t);t!==r&&j(e,0,t),j(e,0,r);const{has:o,get:c}=G(e);return o.call(e,t)?n(c.call(e,t)):o.call(e,r)?n(c.call(e,r)):void 0}function J(e){const t=pe(this),n=pe(e);e!==n&&j(t,0,e),j(t,0,n);const r=G(t).has;return r.call(t,e)||r.call(t,n)}function Q(e){return j(e=pe(e),0,y),Reflect.get(G(e),"size",e)}function U(e){e=pe(e);const t=pe(this),n=G(t),r=n.has.call(t,e),o=n.add.call(t,e);return r||M(t,"add",e,e),o}function X(e,t){t=pe(t);const n=pe(this),{has:r,get:o,set:c}=G(n);let s=r.call(n,e);s||(e=pe(e),s=r.call(n,e));const i=o.call(n,e),u=c.call(n,e,t);return s?v(t,i)&&M(n,"set",e,t):M(n,"add",e,t),u}function Z(e){const t=pe(this),{has:n,get:r,delete:o}=G(t);let c=n.call(t,e);c||(e=pe(e),c=n.call(t,e));r&&r.call(t,e);const s=o.call(t,e);return c&&M(t,"delete",e,void 0),s}function $(){const e=pe(this),t=0!==e.size,n=G(e).clear.call(e);return t&&M(e,"clear",void 0,void 0),n}function ee(e,t){return function(n,r){const o=this,c=pe(o),s=e?B:t?D:q;return!e&&j(c,0,y),G(c).forEach.call(c,(function(e,t){return n.call(r,s(e),s(t),o)}))}}function te(e,t,n){return function(...r){const o=pe(this),c=o instanceof Map,s="entries"===e||e===Symbol.iterator&&c,i="keys"===e&&c,u=G(o)[e].apply(o,r),a=t?B:n?D:q;return!t&&j(o,0,i?R:y),{next(){const{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:s?[a(e[0]),a(e[1])]:a(e),done:t}},[Symbol.iterator](){return this}}}}function ne(e){return function(...t){return"delete"!==e&&this}}const re={get(e){return H(this,e,q)},get size(){return Q(this)},has:J,add:U,set:X,delete:Z,clear:$,forEach:ee(!1,!1)},oe={get(e){return H(this,e,D)},get size(){return Q(this)},has:J,add:U,set:X,delete:Z,clear:$,forEach:ee(!1,!0)},ce={get(e){return H(this,e,B)},get size(){return Q(this)},has:J,add:ne("add"),set:ne("set"),delete:ne("delete"),clear:ne("clear"),forEach:ee(!0,!1)};function se(e,t){const n=t?oe:e?ce:re;return(t,r,o)=>"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(s(n,r)&&r in t?n:t,r,o)}["keys","values","entries",Symbol.iterator].forEach(e=>{re[e]=te(e,!1,!1),ce[e]=te(e,!0,!1),oe[e]=te(e,!1,!0)});const ie={get:se(!1,!1)},ue={get:se(!1,!0)},ae={get:se(!0,!1)},le=new Set([Set,Map,WeakMap,WeakSet]),fe=t("Object,Array,Map,Set,WeakMap,WeakSet");function _e(e){return e&&e.__v_isReadonly?e:de(e,!1,L,ie)}function ve(e){return de(e,!0,N,ae)}function de(e,t,n,r){if(!l(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const o=t?"__v_readonly":"__v_reactive";if(s(e,o))return e[o];if((c=e).__v_skip||!fe(_(c))||Object.isFrozen(c))return e;var c;const i=new Proxy(e,le.has(e.constructor)?r:n);return d(e,o,i),i}function he(e){return ge(e)?he(e.__v_raw):!(!e||!e.__v_isReactive)}function ge(e){return!(!e||!e.__v_isReadonly)}function pe(e){return e&&pe(e.__v_raw)||e}const ye=e=>l(e)?_e(e):e;function Re(e){return!!e&&!0===e.__v_isRef}function we(e,t=!1){if(Re(e))return e;let n=t?e:ye(e);const r={__v_isRef:!0,get value(){return j(r,0,"value"),n},set value(o){v(pe(o),e)&&(e=o,n=t?o:ye(o),M(r,"set","value",void 0))}};return r}function be(e,t){return{__v_isRef:!0,get value(){return e[t]},set value(n){e[t]=n}}}return e.ITERATE_KEY=y,e.computed=function(e){let t,n;u(e)?(t=e,n=r):(t=e.get,n=e.set);let o,c,s=!0;const i=w(t,{lazy:!0,scheduler:()=>{s||(s=!0,M(c,"set","value"))}});return c={__v_isRef:!0,__v_isReadonly:u(e)||!e.set,effect:i,get value(){return s&&(o=i(),s=!1),j(c,0,"value"),o},set value(e){n(e)}},c},e.customRef=function(e){const{get:t,set:n}=e(()=>j(r,0,"value"),()=>M(r,"set","value")),r={__v_isRef:!0,get value(){return t()},set value(e){n(e)}};return r},e.effect=w,e.enableTracking=k,e.isProxy=function(e){return he(e)||ge(e)},e.isReactive=he,e.isReadonly=ge,e.isRef=Re,e.markRaw=function(e){return d(e,"__v_skip",!0),e},e.pauseTracking=function(){E.push(m),m=!1},e.reactive=_e,e.readonly=ve,e.ref=function(e){return we(e)},e.resetTracking=O,e.shallowReactive=function(e){return de(e,!1,V,ue)},e.shallowReadonly=function(e){return de(e,!0,Y,ae)},e.shallowRef=function(e){return we(e,!0)},e.stop=function(e){e.active&&(S(e),e.options.onStop&&e.options.onStop(),e.active=!1)},e.toRaw=pe,e.toRef=be,e.toRefs=function(e){const t={};for(const n in e)t[n]=be(e,n);return t},e.track=j,e.trigger=M,e.triggerRef=function(e){M(e,"set","value",void 0)},e.unref=function(e){return Re(e)?e.value:e},e}({}); | ||
var VueReactivity=function(e){"use strict";function t(e,t){const n=Object.create(null),r=e.split(",");for(let e=0;e<r.length;e++)n[r[e]]=!0;return t?e=>!!n[e.toLowerCase()]:e=>!!n[e]}const n={},r=()=>{},o=Object.assign,c=Object.prototype.hasOwnProperty,s=(e,t)=>c.call(e,t),i=Array.isArray,u=e=>"function"==typeof e,a=e=>"symbol"==typeof e,l=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,_=e=>(e=>f.call(e))(e).slice(8,-1),v=(e,t)=>e!==t&&(e==e||t==t),d=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},h=new WeakMap,g=[];let p;const y=Symbol(""),R=Symbol("");function w(e,t=n){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const r=function(e,t){const n=function(){if(!n.active)return t.scheduler?void 0:e();if(!g.includes(n)){S(n);try{return k(),g.push(n),p=n,e()}finally{g.pop(),O(),p=g[g.length-1]}}};return n.id=b++,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,t);return t.lazy||r(),r}let b=0;function S(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let m=!0;const E=[];function k(){E.push(m),m=!0}function O(){const e=E.pop();m=void 0===e||e}function P(e,t,n){if(!m||void 0===p)return;let r=h.get(e);r||h.set(e,r=new Map);let o=r.get(n);o||r.set(n,o=new Set),o.has(p)||(o.add(p),p.deps.push(o))}function j(e,t,n,r,o,c){const s=h.get(e);if(!s)return;const u=new Set,a=e=>{e&&e.forEach(e=>u.add(e))};if("clear"===t)s.forEach(a);else if("length"===n&&i(e))s.forEach((e,t)=>{("length"===t||t>=r)&&a(e)});else{void 0!==n&&a(s.get(n));const r="add"===t||"delete"===t&&!i(e);(r||"set"===t&&e instanceof Map)&&a(s.get(i(e)?"length":y)),r&&e instanceof Map&&a(s.get(R))}u.forEach(e=>{e.options.scheduler?e.options.scheduler(e):e()})}const M=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(a)),x=K(),z=K(!1,!0),T=K(!0),W=K(!0,!0),A={};function K(e=!1,t=!1){return function(n,r,o){if("__v_isReactive"===r)return!e;if("__v_isReadonly"===r)return e;if("__v_raw"===r&&o===(e?n.__v_readonly:n.__v_reactive))return n;const c=i(n);if(c&&s(A,r))return Reflect.get(A,r,o);const u=Reflect.get(n,r,o);return(a(r)?M.has(r):"__proto__"===r||"__v_isRef"===r)?u:(e||P(n,0,r),t?u:Re(u)?c?u:u.value:l(u)?e?ve(u):_e(u):u)}}["includes","indexOf","lastIndexOf"].forEach(e=>{A[e]=function(...t){const n=pe(this);for(let e=0,t=this.length;e<t;e++)P(n,0,e+"");const r=n[e](...t);return-1===r||!1===r?n[e](...t.map(pe)):r}});function I(e=!1){return function(t,n,r,o){const c=t[n];if(!e&&(r=pe(r),!i(t)&&Re(c)&&!Re(r)))return c.value=r,!0;const u=s(t,n),a=Reflect.set(t,n,r,o);return t===pe(o)&&(u?v(r,c)&&j(t,"set",n,r):j(t,"add",n,r)),a}}function C(e,t){const n=Reflect.has(e,t);return a(t)&&M.has(t)||P(e,0,t),n}function F(e){return P(e,0,y),Reflect.ownKeys(e)}const L={get:x,set:I(),deleteProperty:function(e,t){const n=s(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&j(e,"delete",t,void 0),r},has:C,ownKeys:F},N={get:T,has:C,ownKeys:F,set:(e,t)=>!0,deleteProperty:(e,t)=>!0},V=o({},L,{get:z,set:I(!0)}),Y=o({},N,{get:W}),q=e=>l(e)?_e(e):e,B=e=>l(e)?ve(e):e,D=e=>e,G=e=>Reflect.getPrototypeOf(e);function H(e,t,n){e=pe(e);const r=pe(t);t!==r&&P(e,0,t),P(e,0,r);const{has:o,get:c}=G(e);return o.call(e,t)?n(c.call(e,t)):o.call(e,r)?n(c.call(e,r)):void 0}function J(e){const t=pe(this),n=pe(e);e!==n&&P(t,0,e),P(t,0,n);const r=G(t).has;return r.call(t,e)||r.call(t,n)}function Q(e){return P(e=pe(e),0,y),Reflect.get(G(e),"size",e)}function U(e){e=pe(e);const t=pe(this),n=G(t),r=n.has.call(t,e),o=n.add.call(t,e);return r||j(t,"add",e,e),o}function X(e,t){t=pe(t);const n=pe(this),{has:r,get:o,set:c}=G(n);let s=r.call(n,e);s||(e=pe(e),s=r.call(n,e));const i=o.call(n,e),u=c.call(n,e,t);return s?v(t,i)&&j(n,"set",e,t):j(n,"add",e,t),u}function Z(e){const t=pe(this),{has:n,get:r,delete:o}=G(t);let c=n.call(t,e);c||(e=pe(e),c=n.call(t,e));r&&r.call(t,e);const s=o.call(t,e);return c&&j(t,"delete",e,void 0),s}function $(){const e=pe(this),t=0!==e.size,n=G(e).clear.call(e);return t&&j(e,"clear",void 0,void 0),n}function ee(e,t){return function(n,r){const o=this,c=pe(o),s=e?B:t?D:q;return!e&&P(c,0,y),G(c).forEach.call(c,(function(e,t){return n.call(r,s(e),s(t),o)}))}}function te(e,t,n){return function(...r){const o=pe(this),c=o instanceof Map,s="entries"===e||e===Symbol.iterator&&c,i="keys"===e&&c,u=G(o)[e].apply(o,r),a=t?B:n?D:q;return!t&&P(o,0,i?R:y),{next(){const{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:s?[a(e[0]),a(e[1])]:a(e),done:t}},[Symbol.iterator](){return this}}}}function ne(e){return function(...t){return"delete"!==e&&this}}const re={get(e){return H(this,e,q)},get size(){return Q(this)},has:J,add:U,set:X,delete:Z,clear:$,forEach:ee(!1,!1)},oe={get(e){return H(this,e,D)},get size(){return Q(this)},has:J,add:U,set:X,delete:Z,clear:$,forEach:ee(!1,!0)},ce={get(e){return H(this,e,B)},get size(){return Q(this)},has:J,add:ne("add"),set:ne("set"),delete:ne("delete"),clear:ne("clear"),forEach:ee(!0,!1)};function se(e,t){const n=t?oe:e?ce:re;return(t,r,o)=>"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(s(n,r)&&r in t?n:t,r,o)}["keys","values","entries",Symbol.iterator].forEach(e=>{re[e]=te(e,!1,!1),ce[e]=te(e,!0,!1),oe[e]=te(e,!1,!0)});const ie={get:se(!1,!1)},ue={get:se(!1,!0)},ae={get:se(!0,!1)},le=new Set([Set,Map,WeakMap,WeakSet]),fe=t("Object,Array,Map,Set,WeakMap,WeakSet");function _e(e){return e&&e.__v_isReadonly?e:de(e,!1,L,ie)}function ve(e){return de(e,!0,N,ae)}function de(e,t,n,r){if(!l(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const o=t?"__v_readonly":"__v_reactive";if(s(e,o))return e[o];if((c=e).__v_skip||!fe(_(c))||Object.isFrozen(c))return e;var c;const i=new Proxy(e,le.has(e.constructor)?r:n);return d(e,o,i),i}function he(e){return ge(e)?he(e.__v_raw):!(!e||!e.__v_isReactive)}function ge(e){return!(!e||!e.__v_isReadonly)}function pe(e){return e&&pe(e.__v_raw)||e}const ye=e=>l(e)?_e(e):e;function Re(e){return!!e&&!0===e.__v_isRef}function we(e,t=!1){if(Re(e))return e;let n=t?e:ye(e);const r={__v_isRef:!0,get value(){return P(r,0,"value"),n},set value(o){v(pe(o),e)&&(e=o,n=t?o:ye(o),j(r,"set","value",o))}};return r}function be(e){return Re(e)?e.value:e}const Se={get:(e,t,n)=>be(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return Re(o)&&!Re(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function me(e,t){return{__v_isRef:!0,get value(){return e[t]},set value(n){e[t]=n}}}return e.ITERATE_KEY=y,e.computed=function(e){let t,n;u(e)?(t=e,n=r):(t=e.get,n=e.set);let o,c,s=!0;const i=w(t,{lazy:!0,scheduler:()=>{s||(s=!0,j(c,"set","value"))}});return c={__v_isRef:!0,__v_isReadonly:u(e)||!e.set,effect:i,get value(){return s&&(o=i(),s=!1),P(c,0,"value"),o},set value(e){n(e)}},c},e.customRef=function(e){const{get:t,set:n}=e(()=>P(r,0,"value"),()=>j(r,"set","value")),r={__v_isRef:!0,get value(){return t()},set value(e){n(e)}};return r},e.effect=w,e.enableTracking=k,e.isProxy=function(e){return he(e)||ge(e)},e.isReactive=he,e.isReadonly=ge,e.isRef=Re,e.markRaw=function(e){return d(e,"__v_skip",!0),e},e.pauseTracking=function(){E.push(m),m=!1},e.proxyRefs=function(e){return he(e)?e:new Proxy(e,Se)},e.reactive=_e,e.readonly=ve,e.ref=function(e){return we(e)},e.resetTracking=O,e.shallowReactive=function(e){return de(e,!1,V,ue)},e.shallowReadonly=function(e){return de(e,!0,Y,ae)},e.shallowRef=function(e){return we(e,!0)},e.stop=function(e){e.active&&(S(e),e.options.onStop&&e.options.onStop(),e.active=!1)},e.toRaw=pe,e.toRef=me,e.toRefs=function(e){const t={};for(const n in e)t[n]=me(e,n);return t},e.track=P,e.trigger=j,e.triggerRef=function(e){j(e,"set","value",void 0)},e.unref=be,e}({}); |
{ | ||
"name": "@vue/reactivity", | ||
"version": "3.0.0-rc.4", | ||
"version": "3.0.0-rc.5", | ||
"description": "@vue/reactivity", | ||
@@ -38,4 +38,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"@vue/shared": "3.0.0-rc.4" | ||
"@vue/shared": "3.0.0-rc.5" | ||
} | ||
} |
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
160837
4249
15
+ Added@vue/shared@3.0.0-rc.5(transitive)
- Removed@vue/shared@3.0.0-rc.4(transitive)
Updated@vue/shared@3.0.0-rc.5