@vue/reactivity
Advanced tools
Comparing version 3.0.0-alpha.9 to 3.0.0-alpha.10
@@ -10,5 +10,6 @@ 'use strict'; | ||
let activeEffect; | ||
const ITERATE_KEY = Symbol('iterate'); | ||
const ITERATE_KEY = Symbol( 'iterate' ); | ||
const MAP_KEY_ITERATE_KEY = Symbol( 'Map key iterate' ); | ||
function isEffect(fn) { | ||
return fn != null && fn._isEffect === true; | ||
return fn && fn._isEffect === true; | ||
} | ||
@@ -120,8 +121,20 @@ function effect(fn, options = shared.EMPTY_OBJ) { | ||
const computedRunners = new Set(); | ||
const add = (effectsToAdd) => { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
if (type === "clear" /* CLEAR */) { | ||
// collection being cleared | ||
// trigger all effects for target | ||
depsMap.forEach(dep => { | ||
addRunners(effects, computedRunners, dep); | ||
}); | ||
depsMap.forEach(add); | ||
} | ||
@@ -131,3 +144,3 @@ else if (key === 'length' && shared.isArray(target)) { | ||
if (key === 'length' || key >= newValue) { | ||
addRunners(effects, computedRunners, dep); | ||
add(dep); | ||
} | ||
@@ -139,19 +152,33 @@ }); | ||
if (key !== void 0) { | ||
addRunners(effects, computedRunners, depsMap.get(key)); | ||
add(depsMap.get(key)); | ||
} | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
if (type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !shared.isArray(target)) || | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !shared.isArray(target)); | ||
if (isAddOrDelete || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
const iterationKey = shared.isArray(target) ? 'length' : ITERATE_KEY; | ||
addRunners(effects, computedRunners, depsMap.get(iterationKey)); | ||
add(depsMap.get(shared.isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
} | ||
} | ||
const run = (effect) => { | ||
scheduleRun(effect, target, type, key, { | ||
if ( effect.options.onTrigger) { | ||
effect.options.onTrigger({ | ||
effect, | ||
target, | ||
key, | ||
type, | ||
newValue, | ||
oldValue, | ||
oldTarget | ||
} | ||
); | ||
}); | ||
} | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
}; | ||
@@ -163,33 +190,2 @@ // Important: computed effects must be run first so that computed getters | ||
} | ||
function addRunners(effects, computedRunners, effectsToAdd) { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
function scheduleRun(effect, target, type, key, extraInfo) { | ||
if ( effect.options.onTrigger) { | ||
const event = { | ||
effect, | ||
target, | ||
key, | ||
type | ||
}; | ||
effect.options.onTrigger(extraInfo ? shared.extend(event, extraInfo) : event); | ||
} | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
} | ||
@@ -450,7 +446,8 @@ // global immutability lock | ||
const target = toRaw(this); | ||
const isPair = method === 'entries' || | ||
(method === Symbol.iterator && target instanceof Map); | ||
const isMap = target instanceof Map; | ||
const isPair = method === 'entries' || (method === Symbol.iterator && isMap); | ||
const isKeyOnly = method === 'keys' && isMap; | ||
const innerIterator = getProto(target)[method].apply(target, args); | ||
const wrap = isReadonly ? toReadonly : toReactive; | ||
track(target, "iterate" /* ITERATE */, ITERATE_KEY); | ||
track(target, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); | ||
// return a wrapped iterator which returns observed versions of the | ||
@@ -550,3 +547,4 @@ // values emitted from the real iterator | ||
isObservableType(shared.toRawType(value)) && | ||
!nonReactiveValues.has(value)); | ||
!nonReactiveValues.has(value) && | ||
!Object.isFrozen(value)); | ||
}; | ||
@@ -553,0 +551,0 @@ function reactive(target) { |
@@ -10,5 +10,6 @@ 'use strict'; | ||
let activeEffect; | ||
const ITERATE_KEY = Symbol('iterate'); | ||
const ITERATE_KEY = Symbol( ''); | ||
const MAP_KEY_ITERATE_KEY = Symbol( ''); | ||
function isEffect(fn) { | ||
return fn != null && fn._isEffect === true; | ||
return fn && fn._isEffect === true; | ||
} | ||
@@ -112,8 +113,20 @@ function effect(fn, options = shared.EMPTY_OBJ) { | ||
const computedRunners = new Set(); | ||
const add = (effectsToAdd) => { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
if (type === "clear" /* CLEAR */) { | ||
// collection being cleared | ||
// trigger all effects for target | ||
depsMap.forEach(dep => { | ||
addRunners(effects, computedRunners, dep); | ||
}); | ||
depsMap.forEach(add); | ||
} | ||
@@ -123,3 +136,3 @@ else if (key === 'length' && shared.isArray(target)) { | ||
if (key === 'length' || key >= newValue) { | ||
addRunners(effects, computedRunners, dep); | ||
add(dep); | ||
} | ||
@@ -131,14 +144,22 @@ }); | ||
if (key !== void 0) { | ||
addRunners(effects, computedRunners, depsMap.get(key)); | ||
add(depsMap.get(key)); | ||
} | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
if (type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !shared.isArray(target)) || | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !shared.isArray(target)); | ||
if (isAddOrDelete || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
const iterationKey = shared.isArray(target) ? 'length' : ITERATE_KEY; | ||
addRunners(effects, computedRunners, depsMap.get(iterationKey)); | ||
add(depsMap.get(shared.isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
} | ||
} | ||
const run = (effect) => { | ||
scheduleRun(effect); | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
}; | ||
@@ -150,24 +171,2 @@ // Important: computed effects must be run first so that computed getters | ||
} | ||
function addRunners(effects, computedRunners, effectsToAdd) { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
function scheduleRun(effect, target, type, key, extraInfo) { | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
} | ||
@@ -418,7 +417,8 @@ // global immutability lock | ||
const target = toRaw(this); | ||
const isPair = method === 'entries' || | ||
(method === Symbol.iterator && target instanceof Map); | ||
const isMap = target instanceof Map; | ||
const isPair = method === 'entries' || (method === Symbol.iterator && isMap); | ||
const isKeyOnly = method === 'keys' && isMap; | ||
const innerIterator = getProto(target)[method].apply(target, args); | ||
const wrap = isReadonly ? toReadonly : toReactive; | ||
track(target, "iterate" /* ITERATE */, ITERATE_KEY); | ||
track(target, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); | ||
// return a wrapped iterator which returns observed versions of the | ||
@@ -514,3 +514,4 @@ // values emitted from the real iterator | ||
isObservableType(shared.toRawType(value)) && | ||
!nonReactiveValues.has(value)); | ||
!nonReactiveValues.has(value) && | ||
!Object.isFrozen(value)); | ||
}; | ||
@@ -517,0 +518,0 @@ function reactive(target) { |
@@ -71,3 +71,3 @@ | ||
computed?: boolean; | ||
scheduler?: (run: Function) => void; | ||
scheduler?: (job: () => void) => void; | ||
onTrack?: (event: DebuggerEvent) => void; | ||
@@ -74,0 +74,0 @@ onTrigger?: (event: DebuggerEvent) => void; |
@@ -1,2 +0,2 @@ | ||
import { EMPTY_OBJ, isArray, extend, isSymbol, hasOwn, isObject, hasChanged, capitalize, toRawType, makeMap, isFunction, NOOP } from '@vue/shared'; | ||
import { EMPTY_OBJ, isArray, isSymbol, hasOwn, isObject, hasChanged, capitalize, toRawType, makeMap, isFunction, NOOP } from '@vue/shared'; | ||
@@ -6,5 +6,6 @@ const targetMap = new WeakMap(); | ||
let activeEffect; | ||
const ITERATE_KEY = Symbol('iterate'); | ||
const ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : ''); | ||
const MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : ''); | ||
function isEffect(fn) { | ||
return fn != null && fn._isEffect === true; | ||
return fn && fn._isEffect === true; | ||
} | ||
@@ -116,8 +117,20 @@ function effect(fn, options = EMPTY_OBJ) { | ||
const computedRunners = new Set(); | ||
const add = (effectsToAdd) => { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
if (type === "clear" /* CLEAR */) { | ||
// collection being cleared | ||
// trigger all effects for target | ||
depsMap.forEach(dep => { | ||
addRunners(effects, computedRunners, dep); | ||
}); | ||
depsMap.forEach(add); | ||
} | ||
@@ -127,3 +140,3 @@ else if (key === 'length' && isArray(target)) { | ||
if (key === 'length' || key >= newValue) { | ||
addRunners(effects, computedRunners, dep); | ||
add(dep); | ||
} | ||
@@ -135,20 +148,33 @@ }); | ||
if (key !== void 0) { | ||
addRunners(effects, computedRunners, depsMap.get(key)); | ||
add(depsMap.get(key)); | ||
} | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
if (type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !isArray(target)) || | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !isArray(target)); | ||
if (isAddOrDelete || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
const iterationKey = isArray(target) ? 'length' : ITERATE_KEY; | ||
addRunners(effects, computedRunners, depsMap.get(iterationKey)); | ||
add(depsMap.get(isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
} | ||
} | ||
const run = (effect) => { | ||
scheduleRun(effect, target, type, key, (process.env.NODE_ENV !== 'production') | ||
? { | ||
if ((process.env.NODE_ENV !== 'production') && effect.options.onTrigger) { | ||
effect.options.onTrigger({ | ||
effect, | ||
target, | ||
key, | ||
type, | ||
newValue, | ||
oldValue, | ||
oldTarget | ||
} | ||
: undefined); | ||
}); | ||
} | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
}; | ||
@@ -160,33 +186,2 @@ // Important: computed effects must be run first so that computed getters | ||
} | ||
function addRunners(effects, computedRunners, effectsToAdd) { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
function scheduleRun(effect, target, type, key, extraInfo) { | ||
if ((process.env.NODE_ENV !== 'production') && effect.options.onTrigger) { | ||
const event = { | ||
effect, | ||
target, | ||
key, | ||
type | ||
}; | ||
effect.options.onTrigger(extraInfo ? extend(event, extraInfo) : event); | ||
} | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
} | ||
@@ -448,7 +443,8 @@ // global immutability lock | ||
const target = toRaw(this); | ||
const isPair = method === 'entries' || | ||
(method === Symbol.iterator && target instanceof Map); | ||
const isMap = target instanceof Map; | ||
const isPair = method === 'entries' || (method === Symbol.iterator && isMap); | ||
const isKeyOnly = method === 'keys' && isMap; | ||
const innerIterator = getProto(target)[method].apply(target, args); | ||
const wrap = isReadonly ? toReadonly : toReactive; | ||
track(target, "iterate" /* ITERATE */, ITERATE_KEY); | ||
track(target, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); | ||
// return a wrapped iterator which returns observed versions of the | ||
@@ -548,3 +544,4 @@ // values emitted from the real iterator | ||
isObservableType(toRawType(value)) && | ||
!nonReactiveValues.has(value)); | ||
!nonReactiveValues.has(value) && | ||
!Object.isFrozen(value)); | ||
}; | ||
@@ -551,0 +548,0 @@ function reactive(target) { |
@@ -17,8 +17,2 @@ // Make a map and return a function for checking if a key | ||
; | ||
const extend = (a, b) => { | ||
for (const key in b) { | ||
a[key] = b[key]; | ||
} | ||
return a; | ||
}; | ||
const hasOwnProperty = Object.prototype.hasOwnProperty; | ||
@@ -51,5 +45,6 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key); | ||
let activeEffect; | ||
const ITERATE_KEY = Symbol('iterate'); | ||
const ITERATE_KEY = Symbol( 'iterate' ); | ||
const MAP_KEY_ITERATE_KEY = Symbol( 'Map key iterate' ); | ||
function isEffect(fn) { | ||
return fn != null && fn._isEffect === true; | ||
return fn && fn._isEffect === true; | ||
} | ||
@@ -161,8 +156,20 @@ function effect(fn, options = EMPTY_OBJ) { | ||
const computedRunners = new Set(); | ||
const add = (effectsToAdd) => { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
if (type === "clear" /* CLEAR */) { | ||
// collection being cleared | ||
// trigger all effects for target | ||
depsMap.forEach(dep => { | ||
addRunners(effects, computedRunners, dep); | ||
}); | ||
depsMap.forEach(add); | ||
} | ||
@@ -172,3 +179,3 @@ else if (key === 'length' && isArray(target)) { | ||
if (key === 'length' || key >= newValue) { | ||
addRunners(effects, computedRunners, dep); | ||
add(dep); | ||
} | ||
@@ -180,19 +187,33 @@ }); | ||
if (key !== void 0) { | ||
addRunners(effects, computedRunners, depsMap.get(key)); | ||
add(depsMap.get(key)); | ||
} | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
if (type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !isArray(target)) || | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !isArray(target)); | ||
if (isAddOrDelete || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
const iterationKey = isArray(target) ? 'length' : ITERATE_KEY; | ||
addRunners(effects, computedRunners, depsMap.get(iterationKey)); | ||
add(depsMap.get(isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
} | ||
} | ||
const run = (effect) => { | ||
scheduleRun(effect, target, type, key, { | ||
if ( effect.options.onTrigger) { | ||
effect.options.onTrigger({ | ||
effect, | ||
target, | ||
key, | ||
type, | ||
newValue, | ||
oldValue, | ||
oldTarget | ||
} | ||
); | ||
}); | ||
} | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
}; | ||
@@ -204,33 +225,2 @@ // Important: computed effects must be run first so that computed getters | ||
} | ||
function addRunners(effects, computedRunners, effectsToAdd) { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
function scheduleRun(effect, target, type, key, extraInfo) { | ||
if ( effect.options.onTrigger) { | ||
const event = { | ||
effect, | ||
target, | ||
key, | ||
type | ||
}; | ||
effect.options.onTrigger(extraInfo ? extend(event, extraInfo) : event); | ||
} | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
} | ||
@@ -491,7 +481,8 @@ // global immutability lock | ||
const target = toRaw(this); | ||
const isPair = method === 'entries' || | ||
(method === Symbol.iterator && target instanceof Map); | ||
const isMap = target instanceof Map; | ||
const isPair = method === 'entries' || (method === Symbol.iterator && isMap); | ||
const isKeyOnly = method === 'keys' && isMap; | ||
const innerIterator = getProto(target)[method].apply(target, args); | ||
const wrap = isReadonly ? toReadonly : toReactive; | ||
track(target, "iterate" /* ITERATE */, ITERATE_KEY); | ||
track(target, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); | ||
// return a wrapped iterator which returns observed versions of the | ||
@@ -591,3 +582,4 @@ // values emitted from the real iterator | ||
isObservableType(toRawType(value)) && | ||
!nonReactiveValues.has(value)); | ||
!nonReactiveValues.has(value) && | ||
!Object.isFrozen(value)); | ||
}; | ||
@@ -594,0 +586,0 @@ function reactive(target) { |
@@ -1,1 +0,1 @@ | ||
function t(t,e){const n=Object.create(null),r=t.split(",");for(let t=0;t<r.length;t++)n[r[t]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e={},n=()=>{},r=Object.prototype.hasOwnProperty,o=(t,e)=>r.call(t,e),c=Array.isArray,u=t=>"symbol"==typeof t,s=t=>null!==t&&"object"==typeof t,i=Object.prototype.toString,a=t=>(t=>i.call(t))(t).slice(8,-1),l=(t,e)=>t!==e&&(t==t||e==e),f=new WeakMap,d=[];let h;const p=Symbol("iterate");function g(t,n=e){(function(t){return null!=t&&!0===t._isEffect})(t)&&(t=t.raw);const r=function(t,e){const n=function(...e){return function(t,e,n){if(!t.active)return e(...n);if(!d.includes(t)){y(t);try{return R(),d.push(t),h=t,e(...n)}finally{d.pop(),k(),h=d[d.length-1]}}}(n,t,e)};return n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,n);return n.lazy||r(),r}function v(t){t.active&&(y(t),t.options.onStop&&t.options.onStop(),t.active=!1)}function y(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let w=!0;const S=[];function b(){S.push(w),w=!1}function R(){S.push(w),w=!0}function k(){const t=S.pop();w=void 0===t||t}function m(t,e,n){if(!w||void 0===h)return;let r=f.get(t);void 0===r&&f.set(t,r=new Map);let o=r.get(n);void 0===o&&r.set(n,o=new Set),o.has(h)||(o.add(h),h.deps.push(o))}function E(t,e,n,r,o,u){const s=f.get(t);if(void 0===s)return;const i=new Set,a=new Set;if("clear"===e)s.forEach(t=>{M(i,a,t)});else if("length"===n&&c(t))s.forEach((t,e)=>{("length"===e||e>=r)&&M(i,a,t)});else if(void 0!==n&&M(i,a,s.get(n)),"add"===e||"delete"===e&&!c(t)||"set"===e&&t instanceof Map){const e=c(t)?"length":p;M(i,a,s.get(e))}const l=t=>{!function(t,e,n,r,o){void 0!==t.options.scheduler?t.options.scheduler(t):t()}(t)};a.forEach(l),i.forEach(l)}function M(t,e,n){void 0!==n&&n.forEach(n=>{n===h&&w||(n.options.computed?e.add(n):t.add(n))})}let W=!0;function O(){W=!0}function _(){W=!1}const P=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(u)),j=N(),x=N(!1,!0),z=N(!0),A=N(!0,!0),K={};function N(t=!1,e=!1){return function(n,r,i){if(c(n)&&o(K,r))return Reflect.get(K,r,i);const a=Reflect.get(n,r,i);return u(r)&&P.has(r)?a:e?(m(n,0,r),a):xt(a)&&!c(n)?a.value:(m(n,0,r),s(a)?t?Rt(a):bt(a):a)}}["includes","indexOf","lastIndexOf"].forEach(t=>{K[t]=function(...e){const n=Ot(this);for(let t=0,e=this.length;t<e;t++)m(n,0,t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(Ot)):r}});const V=q(),C=q(!1,!0),I=q(!0),L=q(!0,!0);function q(t=!1,e=!1){return function(n,r,u,s){if(t&&W)return!0;const i=n[r];if(!e&&(u=Ot(u),!c(n)&&xt(i)&&!xt(u)))return i.value=u,!0;const a=o(n,r),f=Reflect.set(n,r,u,s);return n===Ot(s)&&(a?l(u,i)&&E(n,"set",r,u):E(n,"add",r,u)),f}}function B(t,e){const n=o(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&E(t,"delete",e,void 0),r}function D(t,e){const n=Reflect.has(t,e);return m(t,0,e),n}function F(t){return m(t,0,p),Reflect.ownKeys(t)}const G={get:j,set:V,deleteProperty:B,has:D,ownKeys:F},H={get:z,set:I,has:D,ownKeys:F,deleteProperty:(t,e)=>!!W||B(t,e)},J={...G,get:x,set:C},Q={...H,get:A,set:L},T=t=>s(t)?bt(t):t,U=t=>s(t)?Rt(t):t,X=t=>Reflect.getPrototypeOf(t);function Y(t,e,n){t=Ot(t);const r=Ot(e);m(t,0,r);const{has:o,get:c}=X(t);return o.call(t,e)?n(c.call(t,e)):o.call(t,r)?n(c.call(t,r)):void 0}function Z(t){const e=Ot(this),n=Ot(t);m(e,0,n);const r=X(e).has;return r.call(e,t)||r.call(e,n)}function $(t){return m(t=Ot(t),0,p),Reflect.get(X(t),"size",t)}function tt(t){t=Ot(t);const e=Ot(this),n=X(e),r=n.has.call(e,t),o=n.add.call(e,t);return r||E(e,"add",t,t),o}function et(t,e){e=Ot(e),t=Ot(t);const n=Ot(this),r=X(n),o=r.has.call(n,t),c=r.get.call(n,t),u=r.set.call(n,t,e);return o?l(e,c)&&E(n,"set",t,e):E(n,"add",t,e),u}function nt(t){const e=Ot(this),{has:n,get:r,delete:o}=X(e);let c=n.call(e,t);c||(t=Ot(t),c=n.call(e,t));r&&r.call(e,t);const u=o.call(e,t);return c&&E(e,"delete",t,void 0),u}function rt(){const t=Ot(this),e=0!==t.size,n=X(t).clear.call(t);return e&&E(t,"clear",void 0,void 0),n}function ot(t){return function(e,n){const r=this,o=Ot(r),c=t?U:T;return m(o,0,p),X(o).forEach.call(o,(function(t,n){return e.call(r,c(t),c(n),r)}),n)}}function ct(t,e){return function(...n){const r=Ot(this),o="entries"===t||t===Symbol.iterator&&r instanceof Map,c=X(r)[t].apply(r,n),u=e?U:T;return m(r,0,p),{next(){const{value:t,done:e}=c.next();return e?{value:t,done:e}:{value:o?[u(t[0]),u(t[1])]:u(t),done:e}},[Symbol.iterator](){return this}}}}function ut(t,e){return function(...n){return W?"delete"!==e&&this:t.apply(this,n)}}const st={get(t){return Y(this,t,T)},get size(){return $(this)},has:Z,add:tt,set:et,delete:nt,clear:rt,forEach:ot(!1)},it={get(t){return Y(this,t,U)},get size(){return $(this)},has:Z,add:ut(tt,"add"),set:ut(et,"set"),delete:ut(nt,"delete"),clear:ut(rt,"clear"),forEach:ot(!0)};function at(t){return(e,n,r)=>Reflect.get(o(t,n)&&n in e?t:e,n,r)}["keys","values","entries",Symbol.iterator].forEach(t=>{st[t]=ct(t,!1),it[t]=ct(t,!0)});const lt={get:at(st)},ft={get:at(it)},dt=new WeakMap,ht=new WeakMap,pt=new WeakMap,gt=new WeakMap,vt=new WeakSet,yt=new WeakSet,wt=new Set([Set,Map,WeakMap,WeakSet]),St=t("Object,Array,Map,Set,WeakMap,WeakSet");function bt(t){return gt.has(t)?t:vt.has(t)?Rt(t):xt(t)?t:Et(t,dt,ht,G,lt)}function Rt(t){return ht.has(t)&&(t=ht.get(t)),Et(t,pt,gt,H,ft)}function kt(t){return Et(t,pt,gt,Q,ft)}function mt(t){return Et(t,dt,ht,J,lt)}function Et(t,e,n,r,o){if(!s(t))return t;let c=e.get(t);if(void 0!==c)return c;if(n.has(t))return t;if((u=t)._isVue||u._isVNode||!St(a(u))||yt.has(u))return t;var u;const i=wt.has(t.constructor)?o:r;return c=new Proxy(t,i),e.set(t,c),n.set(c,t),c}function Mt(t){return ht.has(t)||gt.has(t)}function Wt(t){return gt.has(t)}function Ot(t){return ht.get(t)||gt.get(t)||t}function _t(t){return vt.add(t),t}function Pt(t){return yt.add(t),t}const jt=t=>s(t)?bt(t):t;function xt(t){return!!t&&!0===t._isRef}function zt(t){return Kt(t)}function At(t){return Kt(t,!0)}function Kt(t,e=!1){if(xt(t))return t;e||(t=jt(t));const n={_isRef:!0,get value(){return m(n,0,"value"),t},set value(r){t=e?r:jt(r),E(n,"set","value",void 0)}};return n}function Nt(t){return xt(t)?t.value:t}function Vt(t){const e={};for(const n in t)e[n]=Ct(t,n);return e}function Ct(t,e){return{_isRef:!0,get value(){return t[e]},set value(n){t[e]=n}}}function It(t){let e,r;"function"==typeof t?(e=t,r=n):(e=t.get,r=t.set);let o,c,u=!0;const s=g(e,{lazy:!0,computed:!0,scheduler:()=>{u||(u=!0,E(c,"set","value"))}});return c={_isRef:!0,effect:s,get value(){return u&&(o=s(),u=!1),m(c,0,"value"),o},set value(t){r(t)}},c}export{p as ITERATE_KEY,It as computed,g as effect,R as enableTracking,Mt as isReactive,Wt as isReadonly,xt as isRef,O as lock,Pt as markNonReactive,_t as markReadonly,b as pauseTracking,bt as reactive,Rt as readonly,zt as ref,k as resetTracking,mt as shallowReactive,kt as shallowReadonly,At as shallowRef,v as stop,Ot as toRaw,Vt as toRefs,m as track,E as trigger,_ as unlock,Nt as unref}; | ||
function t(t,e){const n=Object.create(null),r=t.split(",");for(let t=0;t<r.length;t++)n[r[t]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e={},n=()=>{},r=Object.prototype.hasOwnProperty,o=(t,e)=>r.call(t,e),c=Array.isArray,u=t=>"symbol"==typeof t,s=t=>null!==t&&"object"==typeof t,i=Object.prototype.toString,a=t=>(t=>i.call(t))(t).slice(8,-1),l=(t,e)=>t!==e&&(t==t||e==e),f=new WeakMap,d=[];let h;const p=Symbol(""),g=Symbol("");function v(t,n=e){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const r=function(t,e){const n=function(...e){return function(t,e,n){if(!t.active)return e(...n);if(!d.includes(t)){w(t);try{return m(),d.push(t),h=t,e(...n)}finally{d.pop(),M(),h=d[d.length-1]}}}(n,t,e)};return n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,n);return n.lazy||r(),r}function y(t){t.active&&(w(t),t.options.onStop&&t.options.onStop(),t.active=!1)}function w(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let S=!0;const b=[];function k(){b.push(S),S=!1}function m(){b.push(S),S=!0}function M(){const t=b.pop();S=void 0===t||t}function R(t,e,n){if(!S||void 0===h)return;let r=f.get(t);void 0===r&&f.set(t,r=new Map);let o=r.get(n);void 0===o&&r.set(n,o=new Set),o.has(h)||(o.add(h),h.deps.push(o))}function E(t,e,n,r,o,u){const s=f.get(t);if(void 0===s)return;const i=new Set,a=new Set,l=t=>{void 0!==t&&t.forEach(t=>{t===h&&S||(t.options.computed?a.add(t):i.add(t))})};if("clear"===e)s.forEach(l);else if("length"===n&&c(t))s.forEach((t,e)=>{("length"===e||e>=r)&&l(t)});else{void 0!==n&&l(s.get(n));const r="add"===e||"delete"===e&&!c(t);(r||"set"===e&&t instanceof Map)&&l(s.get(c(t)?"length":p)),r&&t instanceof Map&&l(s.get(g))}const d=t=>{void 0!==t.options.scheduler?t.options.scheduler(t):t()};a.forEach(d),i.forEach(d)}let O=!0;function W(){O=!0}function _(){O=!1}const j=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(u)),z=N(),P=N(!1,!0),x=N(!0),A=N(!0,!0),K={};function N(t=!1,e=!1){return function(n,r,i){if(c(n)&&o(K,r))return Reflect.get(K,r,i);const a=Reflect.get(n,r,i);return u(r)&&j.has(r)?a:e?(R(n,0,r),a):Pt(a)&&!c(n)?a.value:(R(n,0,r),s(a)?t?kt(a):bt(a):a)}}["includes","indexOf","lastIndexOf"].forEach(t=>{K[t]=function(...e){const n=Wt(this);for(let t=0,e=this.length;t<e;t++)R(n,0,t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(Wt)):r}});const V=L(),C=L(!1,!0),F=L(!0),I=L(!0,!0);function L(t=!1,e=!1){return function(n,r,u,s){if(t&&O)return!0;const i=n[r];if(!e&&(u=Wt(u),!c(n)&&Pt(i)&&!Pt(u)))return i.value=u,!0;const a=o(n,r),f=Reflect.set(n,r,u,s);return n===Wt(s)&&(a?l(u,i)&&E(n,"set",r,u):E(n,"add",r,u)),f}}function q(t,e){const n=o(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&E(t,"delete",e,void 0),r}function B(t,e){const n=Reflect.has(t,e);return R(t,0,e),n}function D(t){return R(t,0,p),Reflect.ownKeys(t)}const G={get:z,set:V,deleteProperty:q,has:B,ownKeys:D},H={get:x,set:F,has:B,ownKeys:D,deleteProperty:(t,e)=>!!O||q(t,e)},J={...G,get:P,set:C},Q={...H,get:A,set:I},T=t=>s(t)?bt(t):t,U=t=>s(t)?kt(t):t,X=t=>Reflect.getPrototypeOf(t);function Y(t,e,n){t=Wt(t);const r=Wt(e);R(t,0,r);const{has:o,get:c}=X(t);return o.call(t,e)?n(c.call(t,e)):o.call(t,r)?n(c.call(t,r)):void 0}function Z(t){const e=Wt(this),n=Wt(t);R(e,0,n);const r=X(e).has;return r.call(e,t)||r.call(e,n)}function $(t){return R(t=Wt(t),0,p),Reflect.get(X(t),"size",t)}function tt(t){t=Wt(t);const e=Wt(this),n=X(e),r=n.has.call(e,t),o=n.add.call(e,t);return r||E(e,"add",t,t),o}function et(t,e){e=Wt(e),t=Wt(t);const n=Wt(this),r=X(n),o=r.has.call(n,t),c=r.get.call(n,t),u=r.set.call(n,t,e);return o?l(e,c)&&E(n,"set",t,e):E(n,"add",t,e),u}function nt(t){const e=Wt(this),{has:n,get:r,delete:o}=X(e);let c=n.call(e,t);c||(t=Wt(t),c=n.call(e,t));r&&r.call(e,t);const u=o.call(e,t);return c&&E(e,"delete",t,void 0),u}function rt(){const t=Wt(this),e=0!==t.size,n=X(t).clear.call(t);return e&&E(t,"clear",void 0,void 0),n}function ot(t){return function(e,n){const r=this,o=Wt(r),c=t?U:T;return R(o,0,p),X(o).forEach.call(o,(function(t,n){return e.call(r,c(t),c(n),r)}),n)}}function ct(t,e){return function(...n){const r=Wt(this),o=r instanceof Map,c="entries"===t||t===Symbol.iterator&&o,u="keys"===t&&o,s=X(r)[t].apply(r,n),i=e?U:T;return R(r,0,u?g:p),{next(){const{value:t,done:e}=s.next();return e?{value:t,done:e}:{value:c?[i(t[0]),i(t[1])]:i(t),done:e}},[Symbol.iterator](){return this}}}}function ut(t,e){return function(...n){return O?"delete"!==e&&this:t.apply(this,n)}}const st={get(t){return Y(this,t,T)},get size(){return $(this)},has:Z,add:tt,set:et,delete:nt,clear:rt,forEach:ot(!1)},it={get(t){return Y(this,t,U)},get size(){return $(this)},has:Z,add:ut(tt,"add"),set:ut(et,"set"),delete:ut(nt,"delete"),clear:ut(rt,"clear"),forEach:ot(!0)};function at(t){return(e,n,r)=>Reflect.get(o(t,n)&&n in e?t:e,n,r)}["keys","values","entries",Symbol.iterator].forEach(t=>{st[t]=ct(t,!1),it[t]=ct(t,!0)});const lt={get:at(st)},ft={get:at(it)},dt=new WeakMap,ht=new WeakMap,pt=new WeakMap,gt=new WeakMap,vt=new WeakSet,yt=new WeakSet,wt=new Set([Set,Map,WeakMap,WeakSet]),St=t("Object,Array,Map,Set,WeakMap,WeakSet");function bt(t){return gt.has(t)?t:vt.has(t)?kt(t):Pt(t)?t:Rt(t,dt,ht,G,lt)}function kt(t){return ht.has(t)&&(t=ht.get(t)),Rt(t,pt,gt,H,ft)}function mt(t){return Rt(t,pt,gt,Q,ft)}function Mt(t){return Rt(t,dt,ht,J,lt)}function Rt(t,e,n,r,o){if(!s(t))return t;let c=e.get(t);if(void 0!==c)return c;if(n.has(t))return t;if((u=t)._isVue||u._isVNode||!St(a(u))||yt.has(u)||Object.isFrozen(u))return t;var u;const i=wt.has(t.constructor)?o:r;return c=new Proxy(t,i),e.set(t,c),n.set(c,t),c}function Et(t){return ht.has(t)||gt.has(t)}function Ot(t){return gt.has(t)}function Wt(t){return ht.get(t)||gt.get(t)||t}function _t(t){return vt.add(t),t}function jt(t){return yt.add(t),t}const zt=t=>s(t)?bt(t):t;function Pt(t){return!!t&&!0===t._isRef}function xt(t){return Kt(t)}function At(t){return Kt(t,!0)}function Kt(t,e=!1){if(Pt(t))return t;e||(t=zt(t));const n={_isRef:!0,get value(){return R(n,0,"value"),t},set value(r){t=e?r:zt(r),E(n,"set","value",void 0)}};return n}function Nt(t){return Pt(t)?t.value:t}function Vt(t){const e={};for(const n in t)e[n]=Ct(t,n);return e}function Ct(t,e){return{_isRef:!0,get value(){return t[e]},set value(n){t[e]=n}}}function Ft(t){let e,r;"function"==typeof t?(e=t,r=n):(e=t.get,r=t.set);let o,c,u=!0;const s=v(e,{lazy:!0,computed:!0,scheduler:()=>{u||(u=!0,E(c,"set","value"))}});return c={_isRef:!0,effect:s,get value(){return u&&(o=s(),u=!1),R(c,0,"value"),o},set value(t){r(t)}},c}export{p as ITERATE_KEY,Ft as computed,v as effect,m as enableTracking,Et as isReactive,Ot as isReadonly,Pt as isRef,W as lock,jt as markNonReactive,_t as markReadonly,k as pauseTracking,bt as reactive,kt as readonly,xt as ref,M as resetTracking,Mt as shallowReactive,mt as shallowReadonly,At as shallowRef,y as stop,Wt as toRaw,Vt as toRefs,R as track,E as trigger,_ as unlock,Nt as unref}; |
@@ -20,8 +20,2 @@ var VueReactivity = (function (exports) { | ||
; | ||
const extend = (a, b) => { | ||
for (const key in b) { | ||
a[key] = b[key]; | ||
} | ||
return a; | ||
}; | ||
const hasOwnProperty = Object.prototype.hasOwnProperty; | ||
@@ -54,5 +48,6 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key); | ||
let activeEffect; | ||
const ITERATE_KEY = Symbol('iterate'); | ||
const ITERATE_KEY = Symbol( 'iterate' ); | ||
const MAP_KEY_ITERATE_KEY = Symbol( 'Map key iterate' ); | ||
function isEffect(fn) { | ||
return fn != null && fn._isEffect === true; | ||
return fn && fn._isEffect === true; | ||
} | ||
@@ -164,8 +159,20 @@ function effect(fn, options = EMPTY_OBJ) { | ||
const computedRunners = new Set(); | ||
const add = (effectsToAdd) => { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
if (type === "clear" /* CLEAR */) { | ||
// collection being cleared | ||
// trigger all effects for target | ||
depsMap.forEach(dep => { | ||
addRunners(effects, computedRunners, dep); | ||
}); | ||
depsMap.forEach(add); | ||
} | ||
@@ -175,3 +182,3 @@ else if (key === 'length' && isArray(target)) { | ||
if (key === 'length' || key >= newValue) { | ||
addRunners(effects, computedRunners, dep); | ||
add(dep); | ||
} | ||
@@ -183,19 +190,33 @@ }); | ||
if (key !== void 0) { | ||
addRunners(effects, computedRunners, depsMap.get(key)); | ||
add(depsMap.get(key)); | ||
} | ||
// also run for iteration key on ADD | DELETE | Map.SET | ||
if (type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !isArray(target)) || | ||
const isAddOrDelete = type === "add" /* ADD */ || | ||
(type === "delete" /* DELETE */ && !isArray(target)); | ||
if (isAddOrDelete || | ||
(type === "set" /* SET */ && target instanceof Map)) { | ||
const iterationKey = isArray(target) ? 'length' : ITERATE_KEY; | ||
addRunners(effects, computedRunners, depsMap.get(iterationKey)); | ||
add(depsMap.get(isArray(target) ? 'length' : ITERATE_KEY)); | ||
} | ||
if (isAddOrDelete && target instanceof Map) { | ||
add(depsMap.get(MAP_KEY_ITERATE_KEY)); | ||
} | ||
} | ||
const run = (effect) => { | ||
scheduleRun(effect, target, type, key, { | ||
if ( effect.options.onTrigger) { | ||
effect.options.onTrigger({ | ||
effect, | ||
target, | ||
key, | ||
type, | ||
newValue, | ||
oldValue, | ||
oldTarget | ||
} | ||
); | ||
}); | ||
} | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
}; | ||
@@ -207,33 +228,2 @@ // Important: computed effects must be run first so that computed getters | ||
} | ||
function addRunners(effects, computedRunners, effectsToAdd) { | ||
if (effectsToAdd !== void 0) { | ||
effectsToAdd.forEach(effect => { | ||
if (effect !== activeEffect || !shouldTrack) { | ||
if (effect.options.computed) { | ||
computedRunners.add(effect); | ||
} | ||
else { | ||
effects.add(effect); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
function scheduleRun(effect, target, type, key, extraInfo) { | ||
if ( effect.options.onTrigger) { | ||
const event = { | ||
effect, | ||
target, | ||
key, | ||
type | ||
}; | ||
effect.options.onTrigger(extraInfo ? extend(event, extraInfo) : event); | ||
} | ||
if (effect.options.scheduler !== void 0) { | ||
effect.options.scheduler(effect); | ||
} | ||
else { | ||
effect(); | ||
} | ||
} | ||
@@ -494,7 +484,8 @@ // global immutability lock | ||
const target = toRaw(this); | ||
const isPair = method === 'entries' || | ||
(method === Symbol.iterator && target instanceof Map); | ||
const isMap = target instanceof Map; | ||
const isPair = method === 'entries' || (method === Symbol.iterator && isMap); | ||
const isKeyOnly = method === 'keys' && isMap; | ||
const innerIterator = getProto(target)[method].apply(target, args); | ||
const wrap = isReadonly ? toReadonly : toReactive; | ||
track(target, "iterate" /* ITERATE */, ITERATE_KEY); | ||
track(target, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); | ||
// return a wrapped iterator which returns observed versions of the | ||
@@ -594,3 +585,4 @@ // values emitted from the real iterator | ||
isObservableType(toRawType(value)) && | ||
!nonReactiveValues.has(value)); | ||
!nonReactiveValues.has(value) && | ||
!Object.isFrozen(value)); | ||
}; | ||
@@ -597,0 +589,0 @@ function reactive(target) { |
@@ -1,1 +0,1 @@ | ||
var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),r=t.split(",");for(let t=0;t<r.length;t++)n[r[t]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n={},r=()=>{},o=Object.prototype.hasOwnProperty,c=(t,e)=>o.call(t,e),u=Array.isArray,s=t=>"symbol"==typeof t,i=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),d=new WeakMap,h=[];let p;const g=Symbol("iterate");function v(t,e=n){(function(t){return null!=t&&!0===t._isEffect})(t)&&(t=t.raw);const r=function(t,e){const n=function(...e){return function(t,e,n){if(!t.active)return e(...n);if(!h.includes(t)){y(t);try{return k(),h.push(t),p=t,e(...n)}finally{h.pop(),S(),p=h[h.length-1]}}}(n,t,e)};return n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,e);return e.lazy||r(),r}function y(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let w=!0;const R=[];function k(){R.push(w),w=!0}function S(){const t=R.pop();w=void 0===t||t}function m(t,e,n){if(!w||void 0===p)return;let r=d.get(t);void 0===r&&d.set(t,r=new Map);let o=r.get(n);void 0===o&&r.set(n,o=new Set),o.has(p)||(o.add(p),p.deps.push(o))}function E(t,e,n,r,o,c){const s=d.get(t);if(void 0===s)return;const i=new Set,a=new Set;if("clear"===e)s.forEach(t=>{b(i,a,t)});else if("length"===n&&u(t))s.forEach((t,e)=>{("length"===e||e>=r)&&b(i,a,t)});else if(void 0!==n&&b(i,a,s.get(n)),"add"===e||"delete"===e&&!u(t)||"set"===e&&t instanceof Map){const e=u(t)?"length":g;b(i,a,s.get(e))}const l=t=>{!function(t,e,n,r,o){void 0!==t.options.scheduler?t.options.scheduler(t):t()}(t)};a.forEach(l),i.forEach(l)}function b(t,e,n){void 0!==n&&n.forEach(n=>{n===p&&w||(n.options.computed?e.add(n):t.add(n))})}let M=!0;const W=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(s)),O=x(),_=x(!1,!0),P=x(!0),j=x(!0,!0),z={};function x(t=!1,e=!1){return function(n,r,o){if(u(n)&&c(z,r))return Reflect.get(z,r,o);const a=Reflect.get(n,r,o);return s(r)&&W.has(r)?a:e?(m(n,0,r),a):mt(a)&&!u(n)?a.value:(m(n,0,r),i(a)?t?wt(a):yt(a):a)}}["includes","indexOf","lastIndexOf"].forEach(t=>{z[t]=function(...e){const n=kt(this);for(let t=0,e=this.length;t<e;t++)m(n,0,t+"");const r=n[t](...e);return-1===r||!1===r?n[t](...e.map(kt)):r}});const T=V(),A=V(!1,!0),K=V(!0),N=V(!0,!0);function V(t=!1,e=!1){return function(n,r,o,s){if(t&&M)return!0;const i=n[r];if(!e&&(o=kt(o),!u(n)&&mt(i)&&!mt(o)))return i.value=o,!0;const a=c(n,r),l=Reflect.set(n,r,o,s);return n===kt(s)&&(a?f(o,i)&&E(n,"set",r,o):E(n,"add",r,o)),l}}function I(t,e){const n=c(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&E(t,"delete",e,void 0),r}function C(t,e){const n=Reflect.has(t,e);return m(t,0,e),n}function L(t){return m(t,0,g),Reflect.ownKeys(t)}const Y={get:O,set:T,deleteProperty:I,has:C,ownKeys:L},q={get:P,set:K,has:C,ownKeys:L,deleteProperty:(t,e)=>!!M||I(t,e)},B={...Y,get:_,set:A},D={...q,get:j,set:N},F=t=>i(t)?yt(t):t,G=t=>i(t)?wt(t):t,H=t=>Reflect.getPrototypeOf(t);function J(t,e,n){t=kt(t);const r=kt(e);m(t,0,r);const{has:o,get:c}=H(t);return o.call(t,e)?n(c.call(t,e)):o.call(t,r)?n(c.call(t,r)):void 0}function Q(t){const e=kt(this),n=kt(t);m(e,0,n);const r=H(e).has;return r.call(e,t)||r.call(e,n)}function U(t){return m(t=kt(t),0,g),Reflect.get(H(t),"size",t)}function X(t){t=kt(t);const e=kt(this),n=H(e),r=n.has.call(e,t),o=n.add.call(e,t);return r||E(e,"add",t,t),o}function Z(t,e){e=kt(e),t=kt(t);const n=kt(this),r=H(n),o=r.has.call(n,t),c=r.get.call(n,t),u=r.set.call(n,t,e);return o?f(e,c)&&E(n,"set",t,e):E(n,"add",t,e),u}function $(t){const e=kt(this),{has:n,get:r,delete:o}=H(e);let c=n.call(e,t);c||(t=kt(t),c=n.call(e,t));r&&r.call(e,t);const u=o.call(e,t);return c&&E(e,"delete",t,void 0),u}function tt(){const t=kt(this),e=0!==t.size,n=H(t).clear.call(t);return e&&E(t,"clear",void 0,void 0),n}function et(t){return function(e,n){const r=this,o=kt(r),c=t?G:F;return m(o,0,g),H(o).forEach.call(o,(function(t,n){return e.call(r,c(t),c(n),r)}),n)}}function nt(t,e){return function(...n){const r=kt(this),o="entries"===t||t===Symbol.iterator&&r instanceof Map,c=H(r)[t].apply(r,n),u=e?G:F;return m(r,0,g),{next(){const{value:t,done:e}=c.next();return e?{value:t,done:e}:{value:o?[u(t[0]),u(t[1])]:u(t),done:e}},[Symbol.iterator](){return this}}}}function rt(t,e){return function(...n){return M?"delete"!==e&&this:t.apply(this,n)}}const ot={get(t){return J(this,t,F)},get size(){return U(this)},has:Q,add:X,set:Z,delete:$,clear:tt,forEach:et(!1)},ct={get(t){return J(this,t,G)},get size(){return U(this)},has:Q,add:rt(X,"add"),set:rt(Z,"set"),delete:rt($,"delete"),clear:rt(tt,"clear"),forEach:et(!0)};function ut(t){return(e,n,r)=>Reflect.get(c(t,n)&&n in e?t:e,n,r)}["keys","values","entries",Symbol.iterator].forEach(t=>{ot[t]=nt(t,!1),ct[t]=nt(t,!0)});const st={get:ut(ot)},it={get:ut(ct)},at=new WeakMap,lt=new WeakMap,ft=new WeakMap,dt=new WeakMap,ht=new WeakSet,pt=new WeakSet,gt=new Set([Set,Map,WeakMap,WeakSet]),vt=e("Object,Array,Map,Set,WeakMap,WeakSet");function yt(t){return dt.has(t)?t:ht.has(t)?wt(t):mt(t)?t:Rt(t,at,lt,Y,st)}function wt(t){return lt.has(t)&&(t=lt.get(t)),Rt(t,ft,dt,q,it)}function Rt(t,e,n,r,o){if(!i(t))return t;let c=e.get(t);if(void 0!==c)return c;if(n.has(t))return t;if((u=t)._isVue||u._isVNode||!vt(l(u))||pt.has(u))return t;var u;const s=gt.has(t.constructor)?o:r;return c=new Proxy(t,s),e.set(t,c),n.set(c,t),c}function kt(t){return lt.get(t)||dt.get(t)||t}const St=t=>i(t)?yt(t):t;function mt(t){return!!t&&!0===t._isRef}function Et(t,e=!1){if(mt(t))return t;e||(t=St(t));const n={_isRef:!0,get value(){return m(n,0,"value"),t},set value(r){t=e?r:St(r),E(n,"set","value",void 0)}};return n}function bt(t,e){return{_isRef:!0,get value(){return t[e]},set value(n){t[e]=n}}}return t.ITERATE_KEY=g,t.computed=function(t){let e,n;"function"==typeof t?(e=t,n=r):(e=t.get,n=t.set);let o,c,u=!0;const s=v(e,{lazy:!0,computed:!0,scheduler:()=>{u||(u=!0,E(c,"set","value"))}});return c={_isRef:!0,effect:s,get value(){return u&&(o=s(),u=!1),m(c,0,"value"),o},set value(t){n(t)}},c},t.effect=v,t.enableTracking=k,t.isReactive=function(t){return lt.has(t)||dt.has(t)},t.isReadonly=function(t){return dt.has(t)},t.isRef=mt,t.lock=function(){M=!0},t.markNonReactive=function(t){return pt.add(t),t},t.markReadonly=function(t){return ht.add(t),t},t.pauseTracking=function(){R.push(w),w=!1},t.reactive=yt,t.readonly=wt,t.ref=function(t){return Et(t)},t.resetTracking=S,t.shallowReactive=function(t){return Rt(t,at,lt,B,st)},t.shallowReadonly=function(t){return Rt(t,ft,dt,D,it)},t.shallowRef=function(t){return Et(t,!0)},t.stop=function(t){t.active&&(y(t),t.options.onStop&&t.options.onStop(),t.active=!1)},t.toRaw=kt,t.toRefs=function(t){const e={};for(const n in t)e[n]=bt(t,n);return e},t.track=m,t.trigger=E,t.unlock=function(){M=!1},t.unref=function(t){return mt(t)?t.value:t},t}({}); | ||
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.prototype.hasOwnProperty,c=(e,t)=>o.call(e,t),s=Array.isArray,u=e=>"symbol"==typeof e,a=e=>null!==e&&"object"==typeof e,i=Object.prototype.toString,l=e=>(e=>i.call(e))(e).slice(8,-1),f=(e,t)=>e!==t&&(e==e||t==t),d=new WeakMap,h=[];let p;const g=Symbol(""),v=Symbol("");function y(e,t=n){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const r=function(e,t){const n=function(...t){return function(e,t,n){if(!e.active)return t(...n);if(!h.includes(e)){w(e);try{return S(),h.push(e),p=e,t(...n)}finally{h.pop(),b(),p=h[h.length-1]}}}(n,e,t)};return n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,t);return t.lazy||r(),r}function w(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let R=!0;const k=[];function S(){k.push(R),R=!0}function b(){const e=k.pop();R=void 0===e||e}function m(e,t,n){if(!R||void 0===p)return;let r=d.get(e);void 0===r&&d.set(e,r=new Map);let o=r.get(n);void 0===o&&r.set(n,o=new Set),o.has(p)||(o.add(p),p.deps.push(o))}function E(e,t,n,r,o,c){const u=d.get(e);if(void 0===u)return;const a=new Set,i=new Set,l=e=>{void 0!==e&&e.forEach(e=>{e===p&&R||(e.options.computed?i.add(e):a.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(v))}const f=e=>{void 0!==e.options.scheduler?e.options.scheduler(e):e()};i.forEach(f),a.forEach(f)}let M=!0;const O=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(u)),W=x(),_=x(!1,!0),j=x(!0),z=x(!0,!0),P={};function x(e=!1,t=!1){return function(n,r,o){if(s(n)&&c(P,r))return Reflect.get(P,r,o);const i=Reflect.get(n,r,o);return u(r)&&O.has(r)?i:t?(m(n,0,r),i):be(i)&&!s(n)?i.value:(m(n,0,r),a(i)?e?we(i):ye(i):i)}}["includes","indexOf","lastIndexOf"].forEach(e=>{P[e]=function(...t){const n=ke(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(ke)):r}});const T=V(),A=V(!1,!0),K=V(!0),N=V(!0,!0);function V(e=!1,t=!1){return function(n,r,o,u){if(e&&M)return!0;const a=n[r];if(!t&&(o=ke(o),!s(n)&&be(a)&&!be(o)))return a.value=o,!0;const i=c(n,r),l=Reflect.set(n,r,o,u);return n===ke(u)&&(i?f(o,a)&&E(n,"set",r,o):E(n,"add",r,o)),l}}function I(e,t){const n=c(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&E(e,"delete",t,void 0),r}function C(e,t){const n=Reflect.has(e,t);return m(e,0,t),n}function F(e){return m(e,0,g),Reflect.ownKeys(e)}const L={get:W,set:T,deleteProperty:I,has:C,ownKeys:F},Y={get:j,set:K,has:C,ownKeys:F,deleteProperty:(e,t)=>!!M||I(e,t)},q={...L,get:_,set:A},B={...Y,get:z,set:N},D=e=>a(e)?ye(e):e,G=e=>a(e)?we(e):e,H=e=>Reflect.getPrototypeOf(e);function J(e,t,n){e=ke(e);const r=ke(t);m(e,0,r);const{has:o,get:c}=H(e);return o.call(e,t)?n(c.call(e,t)):o.call(e,r)?n(c.call(e,r)):void 0}function Q(e){const t=ke(this),n=ke(e);m(t,0,n);const r=H(t).has;return r.call(t,e)||r.call(t,n)}function U(e){return m(e=ke(e),0,g),Reflect.get(H(e),"size",e)}function X(e){e=ke(e);const t=ke(this),n=H(t),r=n.has.call(t,e),o=n.add.call(t,e);return r||E(t,"add",e,e),o}function Z(e,t){t=ke(t),e=ke(e);const n=ke(this),r=H(n),o=r.has.call(n,e),c=r.get.call(n,e),s=r.set.call(n,e,t);return o?f(t,c)&&E(n,"set",e,t):E(n,"add",e,t),s}function $(e){const t=ke(this),{has:n,get:r,delete:o}=H(t);let c=n.call(t,e);c||(e=ke(e),c=n.call(t,e));r&&r.call(t,e);const s=o.call(t,e);return c&&E(t,"delete",e,void 0),s}function ee(){const e=ke(this),t=0!==e.size,n=H(e).clear.call(e);return t&&E(e,"clear",void 0,void 0),n}function te(e){return function(t,n){const r=this,o=ke(r),c=e?G:D;return m(o,0,g),H(o).forEach.call(o,(function(e,n){return t.call(r,c(e),c(n),r)}),n)}}function ne(e,t){return function(...n){const r=ke(this),o=r instanceof Map,c="entries"===e||e===Symbol.iterator&&o,s="keys"===e&&o,u=H(r)[e].apply(r,n),a=t?G:D;return m(r,0,s?v:g),{next(){const{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:c?[a(e[0]),a(e[1])]:a(e),done:t}},[Symbol.iterator](){return this}}}}function re(e,t){return function(...n){return M?"delete"!==t&&this:e.apply(this,n)}}const oe={get(e){return J(this,e,D)},get size(){return U(this)},has:Q,add:X,set:Z,delete:$,clear:ee,forEach:te(!1)},ce={get(e){return J(this,e,G)},get size(){return U(this)},has:Q,add:re(X,"add"),set:re(Z,"set"),delete:re($,"delete"),clear:re(ee,"clear"),forEach:te(!0)};function se(e){return(t,n,r)=>Reflect.get(c(e,n)&&n in t?e:t,n,r)}["keys","values","entries",Symbol.iterator].forEach(e=>{oe[e]=ne(e,!1),ce[e]=ne(e,!0)});const ue={get:se(oe)},ae={get:se(ce)},ie=new WeakMap,le=new WeakMap,fe=new WeakMap,de=new WeakMap,he=new WeakSet,pe=new WeakSet,ge=new Set([Set,Map,WeakMap,WeakSet]),ve=t("Object,Array,Map,Set,WeakMap,WeakSet");function ye(e){return de.has(e)?e:he.has(e)?we(e):be(e)?e:Re(e,ie,le,L,ue)}function we(e){return le.has(e)&&(e=le.get(e)),Re(e,fe,de,Y,ae)}function Re(e,t,n,r,o){if(!a(e))return e;let c=t.get(e);if(void 0!==c)return c;if(n.has(e))return e;if((s=e)._isVue||s._isVNode||!ve(l(s))||pe.has(s)||Object.isFrozen(s))return e;var s;const u=ge.has(e.constructor)?o:r;return c=new Proxy(e,u),t.set(e,c),n.set(c,e),c}function ke(e){return le.get(e)||de.get(e)||e}const Se=e=>a(e)?ye(e):e;function be(e){return!!e&&!0===e._isRef}function me(e,t=!1){if(be(e))return e;t||(e=Se(e));const n={_isRef:!0,get value(){return m(n,0,"value"),e},set value(r){e=t?r:Se(r),E(n,"set","value",void 0)}};return n}function Ee(e,t){return{_isRef:!0,get value(){return e[t]},set value(n){e[t]=n}}}return e.ITERATE_KEY=g,e.computed=function(e){let t,n;"function"==typeof e?(t=e,n=r):(t=e.get,n=e.set);let o,c,s=!0;const u=y(t,{lazy:!0,computed:!0,scheduler:()=>{s||(s=!0,E(c,"set","value"))}});return c={_isRef:!0,effect:u,get value(){return s&&(o=u(),s=!1),m(c,0,"value"),o},set value(e){n(e)}},c},e.effect=y,e.enableTracking=S,e.isReactive=function(e){return le.has(e)||de.has(e)},e.isReadonly=function(e){return de.has(e)},e.isRef=be,e.lock=function(){M=!0},e.markNonReactive=function(e){return pe.add(e),e},e.markReadonly=function(e){return he.add(e),e},e.pauseTracking=function(){k.push(R),R=!1},e.reactive=ye,e.readonly=we,e.ref=function(e){return me(e)},e.resetTracking=b,e.shallowReactive=function(e){return Re(e,ie,le,q,ue)},e.shallowReadonly=function(e){return Re(e,fe,de,B,ae)},e.shallowRef=function(e){return me(e,!0)},e.stop=function(e){e.active&&(w(e),e.options.onStop&&e.options.onStop(),e.active=!1)},e.toRaw=ke,e.toRefs=function(e){const t={};for(const n in e)t[n]=Ee(e,n);return t},e.track=m,e.trigger=E,e.unlock=function(){M=!1},e.unref=function(e){return be(e)?e.value:e},e}({}); |
{ | ||
"name": "@vue/reactivity", | ||
"version": "3.0.0-alpha.9", | ||
"version": "3.0.0-alpha.10", | ||
"description": "@vue/reactivity", | ||
@@ -37,4 +37,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"@vue/shared": "3.0.0-alpha.9" | ||
"@vue/shared": "3.0.0-alpha.10" | ||
} | ||
} |
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
145341
3851
13
+ Added@vue/shared@3.0.0-alpha.10(transitive)
- Removed@vue/shared@3.0.0-alpha.9(transitive)
Updated@vue/shared@3.0.0-alpha.10