Socket
Socket
Sign inDemoInstall

@vue/reactivity

Package Overview
Dependencies
Maintainers
1
Versions
229
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/reactivity - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

22

dist/reactivity.cjs.js

@@ -635,15 +635,23 @@ 'use strict';

}
// Return a reactive-copy of the original object, where only the root level
// properties are reactive, and does NOT unwrap refs nor recursively convert
// returned properties.
/**
* Return a shallowly-reactive copy of the original object, where only the root
* level properties are reactive. It also does not auto-unwrap refs (even at the
* root level).
*/
function shallowReactive(target) {
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
}
/**
* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
function readonly(target) {
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
}
// Return a reactive-copy of the original object, where only the root level
// properties are readonly, and does NOT unwrap refs nor recursively convert
// returned properties.
// This is used for creating the props proxy object for stateful components.
/**
* Returns a reactive-copy of the original object, where only the root level
* properties are readonly, and does NOT unwrap refs nor recursively convert
* returned properties.
* This is used for creating the props proxy object for stateful components.
*/
function shallowReadonly(target) {

@@ -650,0 +658,0 @@ return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);

@@ -585,15 +585,23 @@ 'use strict';

}
// Return a reactive-copy of the original object, where only the root level
// properties are reactive, and does NOT unwrap refs nor recursively convert
// returned properties.
/**
* Return a shallowly-reactive copy of the original object, where only the root
* level properties are reactive. It also does not auto-unwrap refs (even at the
* root level).
*/
function shallowReactive(target) {
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
}
/**
* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
function readonly(target) {
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
}
// Return a reactive-copy of the original object, where only the root level
// properties are readonly, and does NOT unwrap refs nor recursively convert
// returned properties.
// This is used for creating the props proxy object for stateful components.
/**
* Returns a reactive-copy of the original object, where only the root level
* properties are readonly, and does NOT unwrap refs nor recursively convert
* returned properties.
* This is used for creating the props proxy object for stateful components.
*/
function shallowReadonly(target) {

@@ -600,0 +608,0 @@ return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);

@@ -70,2 +70,24 @@

/**
* Creates a reactive copy of the original object.
*
* The reactive conversion is "deep"—it affects all nested properties. In the
* ES2015 Proxy based implementation, the returned proxy is **not** equal to the
* original object. It is recommended to work exclusively with the reactive
* proxy and avoid relying on the original object.
*
* A reactive object also automatically unwraps refs contained in it, so you
* don't need to use `.value` when accessing and mutating their value:
*
* ```js
* const count = ref(0)
* const obj = reactive({
* count
* })
*
* obj.count++
* obj.count // -> 1
* count.value // -> 1
* ```
*/
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;

@@ -100,2 +122,6 @@

/**
* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;

@@ -114,3 +140,3 @@

export declare function ref<T extends object>(value: T): T extends Ref ? T : Ref<UnwrapRef<T>>;
export declare function ref<T extends object>(value: T): ToRef<T>;

@@ -145,4 +171,15 @@ export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;

/**
* Return a shallowly-reactive copy of the original object, where only the root
* level properties are reactive. It also does not auto-unwrap refs (even at the
* root level).
*/
export declare function shallowReactive<T extends object>(target: T): T;
/**
* Returns a reactive-copy of the original object, where only the root level
* properties are readonly, and does NOT unwrap refs nor recursively convert
* returned properties.
* This is used for creating the props proxy object for stateful components.
*/
export declare function shallowReadonly<T extends object>(target: T): Readonly<{

@@ -221,6 +258,8 @@ [K in keyof T]: UnwrapNestedRefs<T[K]>;

export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): Ref<T[K]>;
declare type ToRef<T> = T extends Ref ? T : Ref<UnwrapRef<T>>;
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
export declare type ToRefs<T = any> = {
[K in keyof T]: Ref<T[K]>;
[K in keyof T]: ToRef<T[K]>;
};

@@ -227,0 +266,0 @@

@@ -672,15 +672,23 @@ const EMPTY_OBJ = Object.freeze({})

}
// Return a reactive-copy of the original object, where only the root level
// properties are reactive, and does NOT unwrap refs nor recursively convert
// returned properties.
/**
* Return a shallowly-reactive copy of the original object, where only the root
* level properties are reactive. It also does not auto-unwrap refs (even at the
* root level).
*/
function shallowReactive(target) {
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
}
/**
* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
function readonly(target) {
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
}
// Return a reactive-copy of the original object, where only the root level
// properties are readonly, and does NOT unwrap refs nor recursively convert
// returned properties.
// This is used for creating the props proxy object for stateful components.
/**
* Returns a reactive-copy of the original object, where only the root level
* properties are readonly, and does NOT unwrap refs nor recursively convert
* returned properties.
* This is used for creating the props proxy object for stateful components.
*/
function shallowReadonly(target) {

@@ -687,0 +695,0 @@ return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);

@@ -632,15 +632,23 @@ import { EMPTY_OBJ, isArray, isMap, isIntegerKey, isSymbol, extend, hasOwn, isObject, hasChanged, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';

}
// Return a reactive-copy of the original object, where only the root level
// properties are reactive, and does NOT unwrap refs nor recursively convert
// returned properties.
/**
* Return a shallowly-reactive copy of the original object, where only the root
* level properties are reactive. It also does not auto-unwrap refs (even at the
* root level).
*/
function shallowReactive(target) {
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
}
/**
* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
function readonly(target) {
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
}
// Return a reactive-copy of the original object, where only the root level
// properties are readonly, and does NOT unwrap refs nor recursively convert
// returned properties.
// This is used for creating the props proxy object for stateful components.
/**
* Returns a reactive-copy of the original object, where only the root level
* properties are readonly, and does NOT unwrap refs nor recursively convert
* returned properties.
* This is used for creating the props proxy object for stateful components.
*/
function shallowReadonly(target) {

@@ -647,0 +655,0 @@ return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);

@@ -675,15 +675,23 @@ var VueReactivity = (function (exports) {

}
// Return a reactive-copy of the original object, where only the root level
// properties are reactive, and does NOT unwrap refs nor recursively convert
// returned properties.
/**
* Return a shallowly-reactive copy of the original object, where only the root
* level properties are reactive. It also does not auto-unwrap refs (even at the
* root level).
*/
function shallowReactive(target) {
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
}
/**
* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
function readonly(target) {
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
}
// Return a reactive-copy of the original object, where only the root level
// properties are readonly, and does NOT unwrap refs nor recursively convert
// returned properties.
// This is used for creating the props proxy object for stateful components.
/**
* Returns a reactive-copy of the original object, where only the root level
* properties are readonly, and does NOT unwrap refs nor recursively convert
* returned properties.
* This is used for creating the props proxy object for stateful components.
*/
function shallowReadonly(target) {

@@ -918,4 +926,6 @@ return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);

Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}({}));

@@ -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=>"[object Map]"===h(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,l=t=>null!==t&&"object"==typeof t,f=Object.prototype.toString,h=t=>f.call(t),_=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,v=(t,e)=>t!==e&&(t==t||e==e),d=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 e.scheduler?void 0:t();if(!g.includes(n)){k(n);try{return j(),g.push(n),p=n,t()}finally{g.pop(),O(),p=g[g.length-1]}}};return n.id=b++,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}let b=0;function k(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let E=!0;const m=[];function S(){m.push(E),E=!1}function j(){m.push(E),E=!0}function O(){const t=m.pop();E=void 0===t||t}function P(t,e,n){if(!E||void 0===p)return;let r=d.get(t);r||d.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,i){const u=d.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&&o(t))u.forEach((t,e)=>{("length"===e||e>=r)&&l(t)});else switch(void 0!==n&&l(u.get(n)),e){case"add":o(t)?_(n)&&l(u.get("length")):(l(u.get(y)),c(t)&&l(u.get(w)));break;case"delete":o(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=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(a)),A=V(),M=V(!1,!0),T=V(!0),W=V(!0,!0),N={};function V(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(N,r))return Reflect.get(N,r,s);const u=Reflect.get(n,r,s);if(a(r)?z.has(r):"__proto__"===r||"__v_isRef"===r)return u;if(t||P(n,0,r),e)return u;if(wt(u)){return!c||!_(r)?u.value:u}return l(u)?t?_t(u):ht(u):u}}["includes","indexOf","lastIndexOf"].forEach(t=>{const e=Array.prototype[t];N[t]=function(...t){const n=pt(this);for(let t=0,e=this.length;t<e;t++)P(n,0,t+"");const r=e.apply(n,t);return-1===r||!1===r?e.apply(n,t.map(pt)):r}}),["push","pop","shift","unshift","splice"].forEach(t=>{const e=Array.prototype[t];N[t]=function(...t){S();const n=e.apply(this,t);return O(),n}});function I(t=!1){return function(e,n,r,s){const c=e[n];if(!t&&(r=pt(r),!o(e)&&wt(c)&&!wt(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===pt(s)&&(u?v(r,c)&&x(e,"set",n,r):x(e,"add",n,r)),a}}const K={get:A,set:I(),deleteProperty:function(t,e){const n=i(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)&&z.has(e)||P(t,0,e),n},ownKeys:function(t){return P(t,0,o(t)?"length":y),Reflect.ownKeys(t)}},B={get:T,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},Y=r({},K,{get:M,set:I(!0)}),q=r({},B,{get:W}),C=t=>l(t)?ht(t):t,D=t=>l(t)?_t(t):t,F=t=>t,G=t=>Reflect.getPrototypeOf(t);function H(t,e,n=!1,r=!1){const s=pt(t=t.__v_raw),i=pt(e);e!==i&&!n&&P(s,0,e),!n&&P(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=pt(n),s=pt(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 L(t,e=!1){return t=t.__v_raw,!e&&P(pt(t),0,y),Reflect.get(t,"size",t)}function Q(t){t=pt(t);const e=pt(this),n=G(e).has.call(e,t),r=e.add(t);return n||x(e,"add",t,t),r}function U(t,e){e=pt(e);const n=pt(this),{has:r,get:s}=G(n);let i=r.call(n,t);i||(t=pt(t),i=r.call(n,t));const o=s.call(n,t),c=n.set(t,e);return i?v(e,o)&&x(n,"set",t,e):x(n,"add",t,e),c}function X(t){const e=pt(this),{has:n,get:r}=G(e);let s=n.call(e,t);s||(t=pt(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 Z(){const t=pt(this),e=0!==t.size,n=t.clear();return e&&x(t,"clear",void 0,void 0),n}function $(t,e){return function(n,r){const s=this,i=s.__v_raw,o=pt(i),c=t?D:e?F:C;return!t&&P(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=pt(s),o=c(i),u="entries"===t||t===Symbol.iterator&&o,a="keys"===t&&o,l=s[t](...r),f=e?D:n?F:C;return!e&&P(i,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 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.__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 ht(t){return t&&t.__v_isReadonly?t:vt(t,!1,K,ot)}function _t(t){return vt(t,!0,B,ut)}function vt(t,e,n,r){if(!l(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=ft(t);if(0===o)return t;const c=new Proxy(t,2===o?r:n);return s.set(t,c),c}function dt(t){return gt(t)?dt(t.__v_raw):!(!t||!t.__v_isReactive)}function gt(t){return!(!t||!t.__v_isReadonly)}function pt(t){return t&&pt(t.__v_raw)||t}const yt=t=>l(t)?ht(t):t;function wt(t){return Boolean(t&&!0===t.__v_isRef)}class Rt{constructor(t,e=!1){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:yt(t)}get value(){return P(pt(this),0,"value"),this._value}set value(t){v(pt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:yt(t),x(pt(this),"set","value",t))}}function bt(t,e=!1){return wt(t)?t:new Rt(t,e)}function kt(t){return wt(t)?t.value:t}const Et={get:(t,e,n)=>kt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return wt(s)&&!wt(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(()=>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)}}class St{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 jt(t,e){return wt(t[e])?t[e]:new St(t,e)}class Ot{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(pt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),P(pt(this),0,"value"),this._value}set value(t){this._setter(t)}}return t.ITERATE_KEY=y,t.computed=function(t){let e,r;return u(t)?(e=t,r=n):(e=t.get,r=t.set),new Ot(e,r,u(t)||!t.set)},t.customRef=function(t){return new mt(t)},t.effect=R,t.enableTracking=j,t.isProxy=function(t){return dt(t)||gt(t)},t.isReactive=dt,t.isReadonly=gt,t.isRef=wt,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=S,t.proxyRefs=function(t){return dt(t)?t:new Proxy(t,Et)},t.reactive=ht,t.readonly=_t,t.ref=function(t){return bt(t)},t.resetTracking=O,t.shallowReactive=function(t){return vt(t,!1,Y,ct)},t.shallowReadonly=function(t){return vt(t,!0,q,ut)},t.shallowRef=function(t){return bt(t,!0)},t.stop=function(t){t.active&&(k(t),t.options.onStop&&t.options.onStop(),t.active=!1)},t.toRaw=pt,t.toRef=jt,t.toRefs=function(t){const e=o(t)?new Array(t.length):{};for(const n in t)e[n]=jt(t,n);return e},t.track=P,t.trigger=x,t.triggerRef=function(t){x(pt(t),"set","value",void 0)},t.unref=kt,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=>"[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,v=(t,e)=>t!==e&&(t==t||e==e),d=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 e.scheduler?void 0:t();if(!g.includes(n)){k(n);try{return j(),g.push(n),p=n,t()}finally{g.pop(),O(),p=g[g.length-1]}}};return n.id=b++,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}let b=0;function k(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let E=!0;const m=[];function S(){m.push(E),E=!1}function j(){m.push(E),E=!0}function O(){const t=m.pop();E=void 0===t||t}function P(t,e,n){if(!E||void 0===p)return;let r=d.get(t);r||d.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,i){const u=d.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&&o(t))u.forEach((t,e)=>{("length"===e||e>=r)&&l(t)});else switch(void 0!==n&&l(u.get(n)),e){case"add":o(t)?h(n)&&l(u.get("length")):(l(u.get(y)),c(t)&&l(u.get(w)));break;case"delete":o(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 M=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(a)),z=V(),A=V(!1,!0),T=V(!0),W=V(!0,!0),N={};function V(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(N,r))return Reflect.get(N,r,s);const u=Reflect.get(n,r,s);if(a(r)?M.has(r):"__proto__"===r||"__v_isRef"===r)return u;if(t||P(n,0,r),e)return u;if(wt(u)){return!c||!h(r)?u.value:u}return l(u)?t?ht(u):_t(u):u}}["includes","indexOf","lastIndexOf"].forEach(t=>{const e=Array.prototype[t];N[t]=function(...t){const n=pt(this);for(let t=0,e=this.length;t<e;t++)P(n,0,t+"");const r=e.apply(n,t);return-1===r||!1===r?e.apply(n,t.map(pt)):r}}),["push","pop","shift","unshift","splice"].forEach(t=>{const e=Array.prototype[t];N[t]=function(...t){S();const n=e.apply(this,t);return O(),n}});function I(t=!1){return function(e,n,r,s){const c=e[n];if(!t&&(r=pt(r),!o(e)&&wt(c)&&!wt(r)))return c.value=r,!0;const u=o(e)&&h(n)?Number(n)<e.length:i(e,n),a=Reflect.set(e,n,r,s);return e===pt(s)&&(u?v(r,c)&&x(e,"set",n,r):x(e,"add",n,r)),a}}const K={get:z,set:I(),deleteProperty:function(t,e){const n=i(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)&&M.has(e)||P(t,0,e),n},ownKeys:function(t){return P(t,0,o(t)?"length":y),Reflect.ownKeys(t)}},B={get:T,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},Y=r({},K,{get:A,set:I(!0)}),q=r({},B,{get:W}),C=t=>l(t)?_t(t):t,D=t=>l(t)?ht(t):t,F=t=>t,G=t=>Reflect.getPrototypeOf(t);function H(t,e,n=!1,r=!1){const s=pt(t=t.__v_raw),i=pt(e);e!==i&&!n&&P(s,0,e),!n&&P(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=pt(n),s=pt(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 L(t,e=!1){return t=t.__v_raw,!e&&P(pt(t),0,y),Reflect.get(t,"size",t)}function Q(t){t=pt(t);const e=pt(this),n=G(e).has.call(e,t),r=e.add(t);return n||x(e,"add",t,t),r}function U(t,e){e=pt(e);const n=pt(this),{has:r,get:s}=G(n);let i=r.call(n,t);i||(t=pt(t),i=r.call(n,t));const o=s.call(n,t),c=n.set(t,e);return i?v(e,o)&&x(n,"set",t,e):x(n,"add",t,e),c}function X(t){const e=pt(this),{has:n,get:r}=G(e);let s=n.call(e,t);s||(t=pt(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 Z(){const t=pt(this),e=0!==t.size,n=t.clear();return e&&x(t,"clear",void 0,void 0),n}function $(t,e){return function(n,r){const s=this,i=s.__v_raw,o=pt(i),c=t?D:e?F:C;return!t&&P(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=pt(s),o=c(i),u="entries"===t||t===Symbol.iterator&&o,a="keys"===t&&o,l=s[t](...r),f=e?D:n?F:C;return!e&&P(i,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 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.__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 _t(t){return t&&t.__v_isReadonly?t:vt(t,!1,K,ot)}function ht(t){return vt(t,!0,B,ut)}function vt(t,e,n,r){if(!l(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=ft(t);if(0===o)return t;const c=new Proxy(t,2===o?r:n);return s.set(t,c),c}function dt(t){return gt(t)?dt(t.__v_raw):!(!t||!t.__v_isReactive)}function gt(t){return!(!t||!t.__v_isReadonly)}function pt(t){return t&&pt(t.__v_raw)||t}const yt=t=>l(t)?_t(t):t;function wt(t){return Boolean(t&&!0===t.__v_isRef)}class Rt{constructor(t,e=!1){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:yt(t)}get value(){return P(pt(this),0,"value"),this._value}set value(t){v(pt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:yt(t),x(pt(this),"set","value",t))}}function bt(t,e=!1){return wt(t)?t:new Rt(t,e)}function kt(t){return wt(t)?t.value:t}const Et={get:(t,e,n)=>kt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return wt(s)&&!wt(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(()=>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)}}class St{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 jt(t,e){return wt(t[e])?t[e]:new St(t,e)}class Ot{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(pt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),P(pt(this),0,"value"),this._value}set value(t){this._setter(t)}}return t.ITERATE_KEY=y,t.computed=function(t){let e,r;return u(t)?(e=t,r=n):(e=t.get,r=t.set),new Ot(e,r,u(t)||!t.set)},t.customRef=function(t){return new mt(t)},t.effect=R,t.enableTracking=j,t.isProxy=function(t){return dt(t)||gt(t)},t.isReactive=dt,t.isReadonly=gt,t.isRef=wt,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=S,t.proxyRefs=function(t){return dt(t)?t:new Proxy(t,Et)},t.reactive=_t,t.readonly=ht,t.ref=function(t){return bt(t)},t.resetTracking=O,t.shallowReactive=function(t){return vt(t,!1,Y,ct)},t.shallowReadonly=function(t){return vt(t,!0,q,ut)},t.shallowRef=function(t){return bt(t,!0)},t.stop=function(t){t.active&&(k(t),t.options.onStop&&t.options.onStop(),t.active=!1)},t.toRaw=pt,t.toRef=jt,t.toRefs=function(t){const e=o(t)?new Array(t.length):{};for(const n in t)e[n]=jt(t,n);return e},t.track=P,t.trigger=x,t.triggerRef=function(t){x(pt(t),"set","value",void 0)},t.unref=kt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
{
"name": "@vue/reactivity",
"version": "3.0.2",
"version": "3.0.3",
"description": "@vue/reactivity",

@@ -39,4 +39,4 @@ "main": "index.js",

"dependencies": {
"@vue/shared": "3.0.2"
"@vue/shared": "3.0.3"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc