@vue/reactivity 3.2.21 → 3.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/reactivity.cjs.js +10 -6
- package/dist/reactivity.cjs.prod.js +10 -6
- package/dist/reactivity.d.ts +8 -6
- package/dist/reactivity.esm-browser.js +10 -6
- package/dist/reactivity.esm-browser.prod.js +1 -1
- package/dist/reactivity.esm-bundler.js +10 -6
- package/dist/reactivity.global.js +10 -6
- package/dist/reactivity.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/reactivity.cjs.js
CHANGED
|
@@ -129,7 +129,7 @@ const targetMap = new WeakMap();
|
|
|
129
129
|
let effectTrackDepth = 0;
|
|
130
130
|
let trackOpBit = 1;
|
|
131
131
|
/**
|
|
132
|
-
* The bitwise track markers support at most 30 levels
|
|
132
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
133
133
|
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
134
134
|
* When recursion depth is greater, fall back to using a full cleanup.
|
|
135
135
|
*/
|
|
@@ -450,7 +450,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
|
|
|
450
450
|
function createSetter(shallow = false) {
|
|
451
451
|
return function set(target, key, value, receiver) {
|
|
452
452
|
let oldValue = target[key];
|
|
453
|
-
if (!shallow) {
|
|
453
|
+
if (!shallow && !isReadonly(value)) {
|
|
454
454
|
value = toRaw(value);
|
|
455
455
|
oldValue = toRaw(oldValue);
|
|
456
456
|
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
@@ -1035,21 +1035,25 @@ function toRefs(object) {
|
|
|
1035
1035
|
return ret;
|
|
1036
1036
|
}
|
|
1037
1037
|
class ObjectRefImpl {
|
|
1038
|
-
constructor(_object, _key) {
|
|
1038
|
+
constructor(_object, _key, _defaultValue) {
|
|
1039
1039
|
this._object = _object;
|
|
1040
1040
|
this._key = _key;
|
|
1041
|
+
this._defaultValue = _defaultValue;
|
|
1041
1042
|
this.__v_isRef = true;
|
|
1042
1043
|
}
|
|
1043
1044
|
get value() {
|
|
1044
|
-
|
|
1045
|
+
const val = this._object[this._key];
|
|
1046
|
+
return val === undefined ? this._defaultValue : val;
|
|
1045
1047
|
}
|
|
1046
1048
|
set value(newVal) {
|
|
1047
1049
|
this._object[this._key] = newVal;
|
|
1048
1050
|
}
|
|
1049
1051
|
}
|
|
1050
|
-
function toRef(object, key) {
|
|
1052
|
+
function toRef(object, key, defaultValue) {
|
|
1051
1053
|
const val = object[key];
|
|
1052
|
-
return isRef(val)
|
|
1054
|
+
return isRef(val)
|
|
1055
|
+
? val
|
|
1056
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1053
1057
|
}
|
|
1054
1058
|
|
|
1055
1059
|
class ComputedRefImpl {
|
|
@@ -118,7 +118,7 @@ const targetMap = new WeakMap();
|
|
|
118
118
|
let effectTrackDepth = 0;
|
|
119
119
|
let trackOpBit = 1;
|
|
120
120
|
/**
|
|
121
|
-
* The bitwise track markers support at most 30 levels
|
|
121
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
122
122
|
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
123
123
|
* When recursion depth is greater, fall back to using a full cleanup.
|
|
124
124
|
*/
|
|
@@ -427,7 +427,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
|
|
|
427
427
|
function createSetter(shallow = false) {
|
|
428
428
|
return function set(target, key, value, receiver) {
|
|
429
429
|
let oldValue = target[key];
|
|
430
|
-
if (!shallow) {
|
|
430
|
+
if (!shallow && !isReadonly(value)) {
|
|
431
431
|
value = toRaw(value);
|
|
432
432
|
oldValue = toRaw(oldValue);
|
|
433
433
|
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
@@ -966,21 +966,25 @@ function toRefs(object) {
|
|
|
966
966
|
return ret;
|
|
967
967
|
}
|
|
968
968
|
class ObjectRefImpl {
|
|
969
|
-
constructor(_object, _key) {
|
|
969
|
+
constructor(_object, _key, _defaultValue) {
|
|
970
970
|
this._object = _object;
|
|
971
971
|
this._key = _key;
|
|
972
|
+
this._defaultValue = _defaultValue;
|
|
972
973
|
this.__v_isRef = true;
|
|
973
974
|
}
|
|
974
975
|
get value() {
|
|
975
|
-
|
|
976
|
+
const val = this._object[this._key];
|
|
977
|
+
return val === undefined ? this._defaultValue : val;
|
|
976
978
|
}
|
|
977
979
|
set value(newVal) {
|
|
978
980
|
this._object[this._key] = newVal;
|
|
979
981
|
}
|
|
980
982
|
}
|
|
981
|
-
function toRef(object, key) {
|
|
983
|
+
function toRef(object, key, defaultValue) {
|
|
982
984
|
const val = object[key];
|
|
983
|
-
return isRef(val)
|
|
985
|
+
return isRef(val)
|
|
986
|
+
? val
|
|
987
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
984
988
|
}
|
|
985
989
|
|
|
986
990
|
class ComputedRefImpl {
|
package/dist/reactivity.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
|
|
4
4
|
|
|
5
5
|
declare type CollectionTypes = IterableCollections | WeakCollections;
|
|
6
6
|
|
|
7
|
-
declare const ComoutedRefSymbol: unique symbol;
|
|
8
|
-
|
|
9
7
|
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
|
10
8
|
|
|
11
9
|
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
|
@@ -14,14 +12,16 @@ export declare type ComputedGetter<T> = (...args: any[]) => T;
|
|
|
14
12
|
|
|
15
13
|
export declare interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
|
16
14
|
readonly value: T;
|
|
17
|
-
[
|
|
15
|
+
[ComputedRefSymbol]: true;
|
|
18
16
|
}
|
|
19
17
|
|
|
18
|
+
declare const ComputedRefSymbol: unique symbol;
|
|
19
|
+
|
|
20
20
|
export declare type ComputedSetter<T> = (v: T) => void;
|
|
21
21
|
|
|
22
22
|
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
|
23
23
|
|
|
24
|
-
declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
|
24
|
+
export declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
|
25
25
|
get: () => T;
|
|
26
26
|
set: (value: T) => void;
|
|
27
27
|
};
|
|
@@ -231,7 +231,7 @@ export declare function shallowReadonly<T extends object>(target: T): Readonly<{
|
|
|
231
231
|
[K in keyof T]: UnwrapNestedRefs<T[K]>;
|
|
232
232
|
}>;
|
|
233
233
|
|
|
234
|
-
declare type ShallowRef<T = any> = Ref<T> & {
|
|
234
|
+
export declare type ShallowRef<T = any> = Ref<T> & {
|
|
235
235
|
[ShallowRefMarker]?: true;
|
|
236
236
|
};
|
|
237
237
|
|
|
@@ -256,8 +256,10 @@ export declare type ToRef<T> = [T] extends [Ref] ? T : Ref<T>;
|
|
|
256
256
|
|
|
257
257
|
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
258
258
|
|
|
259
|
+
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
|
260
|
+
|
|
259
261
|
export declare type ToRefs<T = any> = {
|
|
260
|
-
[K in keyof T]:
|
|
262
|
+
[K in keyof T]: ToRef<T[K]>;
|
|
261
263
|
};
|
|
262
264
|
|
|
263
265
|
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
|
@@ -182,7 +182,7 @@ const targetMap = new WeakMap();
|
|
|
182
182
|
let effectTrackDepth = 0;
|
|
183
183
|
let trackOpBit = 1;
|
|
184
184
|
/**
|
|
185
|
-
* The bitwise track markers support at most 30 levels
|
|
185
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
186
186
|
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
187
187
|
* When recursion depth is greater, fall back to using a full cleanup.
|
|
188
188
|
*/
|
|
@@ -503,7 +503,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
|
|
|
503
503
|
function createSetter(shallow = false) {
|
|
504
504
|
return function set(target, key, value, receiver) {
|
|
505
505
|
let oldValue = target[key];
|
|
506
|
-
if (!shallow) {
|
|
506
|
+
if (!shallow && !isReadonly(value)) {
|
|
507
507
|
value = toRaw(value);
|
|
508
508
|
oldValue = toRaw(oldValue);
|
|
509
509
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
@@ -1088,21 +1088,25 @@ function toRefs(object) {
|
|
|
1088
1088
|
return ret;
|
|
1089
1089
|
}
|
|
1090
1090
|
class ObjectRefImpl {
|
|
1091
|
-
constructor(_object, _key) {
|
|
1091
|
+
constructor(_object, _key, _defaultValue) {
|
|
1092
1092
|
this._object = _object;
|
|
1093
1093
|
this._key = _key;
|
|
1094
|
+
this._defaultValue = _defaultValue;
|
|
1094
1095
|
this.__v_isRef = true;
|
|
1095
1096
|
}
|
|
1096
1097
|
get value() {
|
|
1097
|
-
|
|
1098
|
+
const val = this._object[this._key];
|
|
1099
|
+
return val === undefined ? this._defaultValue : val;
|
|
1098
1100
|
}
|
|
1099
1101
|
set value(newVal) {
|
|
1100
1102
|
this._object[this._key] = newVal;
|
|
1101
1103
|
}
|
|
1102
1104
|
}
|
|
1103
|
-
function toRef(object, key) {
|
|
1105
|
+
function toRef(object, key, defaultValue) {
|
|
1104
1106
|
const val = object[key];
|
|
1105
|
-
return isRef(val)
|
|
1107
|
+
return isRef(val)
|
|
1108
|
+
? val
|
|
1109
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1106
1110
|
}
|
|
1107
1111
|
|
|
1108
1112
|
class ComputedRefImpl {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"symbol"==typeof t,u=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),a=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,f=(t,e)=>!Object.is(t,e);let _;const d=[];class p{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&_&&(this.parent=_,this.index=(_.scopes||(_.scopes=[])).push(this)-1)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(d.push(this),_=this)}off(){this.active&&(d.pop(),_=d[d.length-1])}stop(t){if(this.active){if(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.scopes&&this.scopes.forEach((t=>t.stop(!0))),this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function v(t){return new p(t)}function g(t,e){(e=e||_)&&e.active&&e.effects.push(t)}function y(){return _}function w(t){_&&_.cleanups.push(t)}const b=t=>{const e=new Set(t);return e.w=0,e.n=0,e},R=t=>(t.w&O)>0,k=t=>(t.n&O)>0,m=new WeakMap;let j=0,O=1;const S=[];let E;const x=Symbol(""),P=Symbol("");class M{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],g(this,n)}run(){if(!this.active)return this.fn();if(!S.includes(this))try{return S.push(E=this),K(),O=1<<++j,j<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=O})(this):z(this),this.fn()}finally{j<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];R(i)&&!k(i)?i.delete(t):e[n++]=i,i.w&=~O,i.n&=~O}e.length=n}})(this),O=1<<--j,B(),S.pop();const t=S.length;E=t>0?S[t-1]:void 0}}stop(){this.active&&(z(this),this.onStop&&this.onStop(),this.active=!1)}}function z(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function W(t,e){t.effect&&(t=t.effect.fn);const s=new M(t);e&&(n(s,e),e.scope&&g(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i}function A(t){t.effect.stop()}let N=!0;const V=[];function I(){V.push(N),N=!1}function K(){V.push(N),N=!0}function B(){const t=V.pop();N=void 0===t||t}function C(t,e,n){if(!L())return;let s=m.get(t);s||m.set(t,s=new Map);let i=s.get(n);i||s.set(n,i=b()),q(i)}function L(){return N&&void 0!==E}function q(t,e){let n=!1;j<=30?k(t)||(t.n|=O,n=!R(t)):n=!t.has(E),n&&(t.add(E),E.deps.push(t))}function D(t,e,n,s,i,o){const u=m.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===n&&r(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&h.push(t)}));else switch(void 0!==n&&h.push(u.get(n)),e){case"add":r(t)?a(n)&&h.push(u.get("length")):(h.push(u.get(x)),c(t)&&h.push(u.get(P)));break;case"delete":r(t)||(h.push(u.get(x)),c(t)&&h.push(u.get(P)));break;case"set":c(t)&&h.push(u.get(x))}if(1===h.length)h[0]&&F(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);F(b(t))}}function F(t,e){for(const n of r(t)?t:[...t])(n!==E||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const G=t("__proto__,__v_isRef,__isVue"),H=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(o)),J=Z(),Q=Z(!1,!0),T=Z(!0),U=Z(!0,!0),X=Y();function Y(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Ct(this);for(let e=0,i=this.length;e<i;e++)C(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Ct)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){I();const n=Ct(this)[e].apply(this,t);return B(),n}})),t}function Z(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&c===(t?e?Pt:xt:e?Et:St).get(n))return n;const h=r(n);if(!t&&h&&i(X,s))return Reflect.get(X,s,c);const l=Reflect.get(n,s,c);if(o(s)?H.has(s):G(s))return l;if(t||C(n,0,s),e)return l;if(Ht(l)){return!h||!a(s)?l.value:l}return u(l)?t?At(l):zt(l):l}}function $(t=!1){return function(e,n,s,c){let o=e[n];if(!t&&(s=Ct(s),o=Ct(o),!r(e)&&Ht(o)&&!Ht(s)))return o.value=s,!0;const u=r(e)&&a(n)?Number(n)<e.length:i(e,n),h=Reflect.set(e,n,s,c);return e===Ct(c)&&(u?f(s,o)&&D(e,"set",n,s):D(e,"add",n,s)),h}}const tt={get:J,set:$(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&D(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return o(e)&&H.has(e)||C(t,0,e),n},ownKeys:function(t){return C(t,0,r(t)?"length":x),Reflect.ownKeys(t)}},et={get:T,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},nt=n({},tt,{get:Q,set:$(!0)}),st=n({},et,{get:U}),it=t=>t,rt=t=>Reflect.getPrototypeOf(t);function ct(t,e,n=!1,s=!1){const i=Ct(t=t.__v_raw),r=Ct(e);e!==r&&!n&&C(i,0,e),!n&&C(i,0,r);const{has:c}=rt(i),o=s?it:n?Dt:qt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function ot(t,e=!1){const n=this.__v_raw,s=Ct(n),i=Ct(t);return t!==i&&!e&&C(s,0,t),!e&&C(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function ut(t,e=!1){return t=t.__v_raw,!e&&C(Ct(t),0,x),Reflect.get(t,"size",t)}function ht(t){t=Ct(t);const e=Ct(this);return rt(e).has.call(e,t)||(e.add(t),D(e,"add",t,t)),this}function lt(t,e){e=Ct(e);const n=Ct(this),{has:s,get:i}=rt(n);let r=s.call(n,t);r||(t=Ct(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?f(e,c)&&D(n,"set",t,e):D(n,"add",t,e),this}function at(t){const e=Ct(this),{has:n,get:s}=rt(e);let i=n.call(e,t);i||(t=Ct(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&D(e,"delete",t,void 0),r}function ft(){const t=Ct(this),e=0!==t.size,n=t.clear();return e&&D(t,"clear",void 0,void 0),n}function _t(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Ct(r),o=e?it:t?Dt:qt;return!t&&C(c,0,x),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function dt(t,e,n){return function(...s){const i=this.__v_raw,r=Ct(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,l=i[t](...s),a=n?it:e?Dt:qt;return!e&&C(r,0,h?P:x),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[a(t[0]),a(t[1])]:a(t),done:e}},[Symbol.iterator](){return this}}}}function pt(t){return function(...e){return"delete"!==t&&this}}function vt(){const t={get(t){return ct(this,t)},get size(){return ut(this)},has:ot,add:ht,set:lt,delete:at,clear:ft,forEach:_t(!1,!1)},e={get(t){return ct(this,t,!1,!0)},get size(){return ut(this)},has:ot,add:ht,set:lt,delete:at,clear:ft,forEach:_t(!1,!0)},n={get(t){return ct(this,t,!0)},get size(){return ut(this,!0)},has(t){return ot.call(this,t,!0)},add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear"),forEach:_t(!0,!1)},s={get(t){return ct(this,t,!0,!0)},get size(){return ut(this,!0)},has(t){return ot.call(this,t,!0)},add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear"),forEach:_t(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=dt(i,!1,!1),n[i]=dt(i,!0,!1),e[i]=dt(i,!1,!0),s[i]=dt(i,!0,!0)})),[t,n,e,s]}const[gt,yt,wt,bt]=vt();function Rt(t,e){const n=e?t?bt:wt:t?yt:gt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const kt={get:Rt(!1,!1)},mt={get:Rt(!1,!0)},jt={get:Rt(!0,!1)},Ot={get:Rt(!0,!0)},St=new WeakMap,Et=new WeakMap,xt=new WeakMap,Pt=new WeakMap;function Mt(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=>l(t).slice(8,-1))(t))}function zt(t){return t&&t.__v_isReadonly?t:Vt(t,!1,tt,kt,St)}function Wt(t){return Vt(t,!1,nt,mt,Et)}function At(t){return Vt(t,!0,et,jt,xt)}function Nt(t){return Vt(t,!0,st,Ot,Pt)}function Vt(t,e,n,s,i){if(!u(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=Mt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function It(t){return Kt(t)?It(t.__v_raw):!(!t||!t.__v_isReactive)}function Kt(t){return!(!t||!t.__v_isReadonly)}function Bt(t){return It(t)||Kt(t)}function Ct(t){const e=t&&t.__v_raw;return e?Ct(e):t}function Lt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const qt=t=>u(t)?zt(t):t,Dt=t=>u(t)?At(t):t;function Ft(t){L()&&((t=Ct(t)).dep||(t.dep=b()),q(t.dep))}function Gt(t,e){(t=Ct(t)).dep&&F(t.dep)}function Ht(t){return Boolean(t&&!0===t.__v_isRef)}function Jt(t){return Tt(t,!1)}function Qt(t){return Tt(t,!0)}function Tt(t,e){return Ht(t)?t:new Ut(t,e)}class Ut{constructor(t,e){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Ct(t),this._value=e?t:qt(t)}get value(){return Ft(this),this._value}set value(t){t=this._shallow?t:Ct(t),f(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:qt(t),Gt(this))}}function Xt(t){Gt(t)}function Yt(t){return Ht(t)?t.value:t}const Zt={get:(t,e,n)=>Yt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Ht(i)&&!Ht(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};function $t(t){return It(t)?t:new Proxy(t,Zt)}class te{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Ft(this)),(()=>Gt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function ee(t){return new te(t)}function ne(t){const e=r(t)?new Array(t.length):{};for(const n in t)e[n]=ie(t,n);return e}class se{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 ie(t,e){const n=t[e];return Ht(n)?n:new se(t,e)}class re{constructor(t,e,n){this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.effect=new M(t,(()=>{this._dirty||(this._dirty=!0,Gt(this))})),this.__v_isReadonly=n}get value(){const t=Ct(this);return Ft(t),t._dirty&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function ce(t,n){let s,i;const r="function"==typeof t;r?(s=t,i=e):(s=t.get,i=t.set);return new re(s,i,r||!i)}var oe;const ue=Promise.resolve(),he=[];let le=!1;const ae=()=>{for(let t=0;t<he.length;t++)he[t]();he.length=0,le=!1};class fe{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[oe]=!0;let n=!1,s=!1;this.effect=new M(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,he.push((()=>{this.effect.active&&this._get()!==t&&Gt(this),s=!1})),le||(le=!0,ue.then(ae))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=!0}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Ft(this),Ct(this)._get()}}function _e(t){return new fe(t)}oe="__v_isReadonly";export{p as EffectScope,x as ITERATE_KEY,M as ReactiveEffect,ce as computed,ee as customRef,_e as deferredComputed,W as effect,v as effectScope,K as enableTracking,y as getCurrentScope,Bt as isProxy,It as isReactive,Kt as isReadonly,Ht as isRef,Lt as markRaw,w as onScopeDispose,I as pauseTracking,$t as proxyRefs,zt as reactive,At as readonly,Jt as ref,B as resetTracking,Wt as shallowReactive,Nt as shallowReadonly,Qt as shallowRef,A as stop,Ct as toRaw,ie as toRef,ne as toRefs,C as track,D as trigger,Xt as triggerRef,Yt as unref};
|
|
1
|
+
function t(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"symbol"==typeof t,u=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),a=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,f=(t,e)=>!Object.is(t,e);let _;const d=[];class p{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&_&&(this.parent=_,this.index=(_.scopes||(_.scopes=[])).push(this)-1)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(d.push(this),_=this)}off(){this.active&&(d.pop(),_=d[d.length-1])}stop(t){if(this.active){if(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.scopes&&this.scopes.forEach((t=>t.stop(!0))),this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function v(t){return new p(t)}function g(t,e){(e=e||_)&&e.active&&e.effects.push(t)}function y(){return _}function w(t){_&&_.cleanups.push(t)}const b=t=>{const e=new Set(t);return e.w=0,e.n=0,e},R=t=>(t.w&O)>0,k=t=>(t.n&O)>0,m=new WeakMap;let j=0,O=1;const S=[];let E;const x=Symbol(""),P=Symbol("");class M{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],g(this,n)}run(){if(!this.active)return this.fn();if(!S.includes(this))try{return S.push(E=this),K(),O=1<<++j,j<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=O})(this):z(this),this.fn()}finally{j<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];R(i)&&!k(i)?i.delete(t):e[n++]=i,i.w&=~O,i.n&=~O}e.length=n}})(this),O=1<<--j,B(),S.pop();const t=S.length;E=t>0?S[t-1]:void 0}}stop(){this.active&&(z(this),this.onStop&&this.onStop(),this.active=!1)}}function z(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function W(t,e){t.effect&&(t=t.effect.fn);const s=new M(t);e&&(n(s,e),e.scope&&g(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i}function V(t){t.effect.stop()}let A=!0;const N=[];function I(){N.push(A),A=!1}function K(){N.push(A),A=!0}function B(){const t=N.pop();A=void 0===t||t}function C(t,e,n){if(!L())return;let s=m.get(t);s||m.set(t,s=new Map);let i=s.get(n);i||s.set(n,i=b()),q(i)}function L(){return A&&void 0!==E}function q(t,e){let n=!1;j<=30?k(t)||(t.n|=O,n=!R(t)):n=!t.has(E),n&&(t.add(E),E.deps.push(t))}function D(t,e,n,s,i,o){const u=m.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===n&&r(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&h.push(t)}));else switch(void 0!==n&&h.push(u.get(n)),e){case"add":r(t)?a(n)&&h.push(u.get("length")):(h.push(u.get(x)),c(t)&&h.push(u.get(P)));break;case"delete":r(t)||(h.push(u.get(x)),c(t)&&h.push(u.get(P)));break;case"set":c(t)&&h.push(u.get(x))}if(1===h.length)h[0]&&F(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);F(b(t))}}function F(t,e){for(const n of r(t)?t:[...t])(n!==E||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const G=t("__proto__,__v_isRef,__isVue"),H=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(o)),J=Z(),Q=Z(!1,!0),T=Z(!0),U=Z(!0,!0),X=Y();function Y(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Ct(this);for(let e=0,i=this.length;e<i;e++)C(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Ct)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){I();const n=Ct(this)[e].apply(this,t);return B(),n}})),t}function Z(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&c===(t?e?Pt:xt:e?Et:St).get(n))return n;const h=r(n);if(!t&&h&&i(X,s))return Reflect.get(X,s,c);const l=Reflect.get(n,s,c);if(o(s)?H.has(s):G(s))return l;if(t||C(n,0,s),e)return l;if(Ht(l)){return!h||!a(s)?l.value:l}return u(l)?t?Vt(l):zt(l):l}}function $(t=!1){return function(e,n,s,c){let o=e[n];if(!t&&!Kt(s)&&(s=Ct(s),o=Ct(o),!r(e)&&Ht(o)&&!Ht(s)))return o.value=s,!0;const u=r(e)&&a(n)?Number(n)<e.length:i(e,n),h=Reflect.set(e,n,s,c);return e===Ct(c)&&(u?f(s,o)&&D(e,"set",n,s):D(e,"add",n,s)),h}}const tt={get:J,set:$(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&D(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return o(e)&&H.has(e)||C(t,0,e),n},ownKeys:function(t){return C(t,0,r(t)?"length":x),Reflect.ownKeys(t)}},et={get:T,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},nt=n({},tt,{get:Q,set:$(!0)}),st=n({},et,{get:U}),it=t=>t,rt=t=>Reflect.getPrototypeOf(t);function ct(t,e,n=!1,s=!1){const i=Ct(t=t.__v_raw),r=Ct(e);e!==r&&!n&&C(i,0,e),!n&&C(i,0,r);const{has:c}=rt(i),o=s?it:n?Dt:qt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function ot(t,e=!1){const n=this.__v_raw,s=Ct(n),i=Ct(t);return t!==i&&!e&&C(s,0,t),!e&&C(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function ut(t,e=!1){return t=t.__v_raw,!e&&C(Ct(t),0,x),Reflect.get(t,"size",t)}function ht(t){t=Ct(t);const e=Ct(this);return rt(e).has.call(e,t)||(e.add(t),D(e,"add",t,t)),this}function lt(t,e){e=Ct(e);const n=Ct(this),{has:s,get:i}=rt(n);let r=s.call(n,t);r||(t=Ct(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?f(e,c)&&D(n,"set",t,e):D(n,"add",t,e),this}function at(t){const e=Ct(this),{has:n,get:s}=rt(e);let i=n.call(e,t);i||(t=Ct(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&D(e,"delete",t,void 0),r}function ft(){const t=Ct(this),e=0!==t.size,n=t.clear();return e&&D(t,"clear",void 0,void 0),n}function _t(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Ct(r),o=e?it:t?Dt:qt;return!t&&C(c,0,x),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function dt(t,e,n){return function(...s){const i=this.__v_raw,r=Ct(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,l=i[t](...s),a=n?it:e?Dt:qt;return!e&&C(r,0,h?P:x),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[a(t[0]),a(t[1])]:a(t),done:e}},[Symbol.iterator](){return this}}}}function pt(t){return function(...e){return"delete"!==t&&this}}function vt(){const t={get(t){return ct(this,t)},get size(){return ut(this)},has:ot,add:ht,set:lt,delete:at,clear:ft,forEach:_t(!1,!1)},e={get(t){return ct(this,t,!1,!0)},get size(){return ut(this)},has:ot,add:ht,set:lt,delete:at,clear:ft,forEach:_t(!1,!0)},n={get(t){return ct(this,t,!0)},get size(){return ut(this,!0)},has(t){return ot.call(this,t,!0)},add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear"),forEach:_t(!0,!1)},s={get(t){return ct(this,t,!0,!0)},get size(){return ut(this,!0)},has(t){return ot.call(this,t,!0)},add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear"),forEach:_t(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=dt(i,!1,!1),n[i]=dt(i,!0,!1),e[i]=dt(i,!1,!0),s[i]=dt(i,!0,!0)})),[t,n,e,s]}const[gt,yt,wt,bt]=vt();function Rt(t,e){const n=e?t?bt:wt:t?yt:gt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const kt={get:Rt(!1,!1)},mt={get:Rt(!1,!0)},jt={get:Rt(!0,!1)},Ot={get:Rt(!0,!0)},St=new WeakMap,Et=new WeakMap,xt=new WeakMap,Pt=new WeakMap;function Mt(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=>l(t).slice(8,-1))(t))}function zt(t){return t&&t.__v_isReadonly?t:Nt(t,!1,tt,kt,St)}function Wt(t){return Nt(t,!1,nt,mt,Et)}function Vt(t){return Nt(t,!0,et,jt,xt)}function At(t){return Nt(t,!0,st,Ot,Pt)}function Nt(t,e,n,s,i){if(!u(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=Mt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function It(t){return Kt(t)?It(t.__v_raw):!(!t||!t.__v_isReactive)}function Kt(t){return!(!t||!t.__v_isReadonly)}function Bt(t){return It(t)||Kt(t)}function Ct(t){const e=t&&t.__v_raw;return e?Ct(e):t}function Lt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const qt=t=>u(t)?zt(t):t,Dt=t=>u(t)?Vt(t):t;function Ft(t){L()&&((t=Ct(t)).dep||(t.dep=b()),q(t.dep))}function Gt(t,e){(t=Ct(t)).dep&&F(t.dep)}function Ht(t){return Boolean(t&&!0===t.__v_isRef)}function Jt(t){return Tt(t,!1)}function Qt(t){return Tt(t,!0)}function Tt(t,e){return Ht(t)?t:new Ut(t,e)}class Ut{constructor(t,e){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Ct(t),this._value=e?t:qt(t)}get value(){return Ft(this),this._value}set value(t){t=this._shallow?t:Ct(t),f(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:qt(t),Gt(this))}}function Xt(t){Gt(t)}function Yt(t){return Ht(t)?t.value:t}const Zt={get:(t,e,n)=>Yt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Ht(i)&&!Ht(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};function $t(t){return It(t)?t:new Proxy(t,Zt)}class te{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Ft(this)),(()=>Gt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function ee(t){return new te(t)}function ne(t){const e=r(t)?new Array(t.length):{};for(const n in t)e[n]=ie(t,n);return e}class se{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}}function ie(t,e,n){const s=t[e];return Ht(s)?s:new se(t,e,n)}class re{constructor(t,e,n){this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.effect=new M(t,(()=>{this._dirty||(this._dirty=!0,Gt(this))})),this.__v_isReadonly=n}get value(){const t=Ct(this);return Ft(t),t._dirty&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function ce(t,n){let s,i;const r="function"==typeof t;r?(s=t,i=e):(s=t.get,i=t.set);return new re(s,i,r||!i)}var oe;const ue=Promise.resolve(),he=[];let le=!1;const ae=()=>{for(let t=0;t<he.length;t++)he[t]();he.length=0,le=!1};class fe{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[oe]=!0;let n=!1,s=!1;this.effect=new M(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,he.push((()=>{this.effect.active&&this._get()!==t&&Gt(this),s=!1})),le||(le=!0,ue.then(ae))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=!0}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Ft(this),Ct(this)._get()}}function _e(t){return new fe(t)}oe="__v_isReadonly";export{p as EffectScope,x as ITERATE_KEY,M as ReactiveEffect,ce as computed,ee as customRef,_e as deferredComputed,W as effect,v as effectScope,K as enableTracking,y as getCurrentScope,Bt as isProxy,It as isReactive,Kt as isReadonly,Ht as isRef,Lt as markRaw,w as onScopeDispose,I as pauseTracking,$t as proxyRefs,zt as reactive,Vt as readonly,Jt as ref,B as resetTracking,Wt as shallowReactive,At as shallowReadonly,Qt as shallowRef,V as stop,Ct as toRaw,ie as toRef,ne as toRefs,C as track,D as trigger,Xt as triggerRef,Yt as unref};
|
|
@@ -125,7 +125,7 @@ const targetMap = new WeakMap();
|
|
|
125
125
|
let effectTrackDepth = 0;
|
|
126
126
|
let trackOpBit = 1;
|
|
127
127
|
/**
|
|
128
|
-
* The bitwise track markers support at most 30 levels
|
|
128
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
129
129
|
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
130
130
|
* When recursion depth is greater, fall back to using a full cleanup.
|
|
131
131
|
*/
|
|
@@ -454,7 +454,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
|
|
|
454
454
|
function createSetter(shallow = false) {
|
|
455
455
|
return function set(target, key, value, receiver) {
|
|
456
456
|
let oldValue = target[key];
|
|
457
|
-
if (!shallow) {
|
|
457
|
+
if (!shallow && !isReadonly(value)) {
|
|
458
458
|
value = toRaw(value);
|
|
459
459
|
oldValue = toRaw(oldValue);
|
|
460
460
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
@@ -1046,21 +1046,25 @@ function toRefs(object) {
|
|
|
1046
1046
|
return ret;
|
|
1047
1047
|
}
|
|
1048
1048
|
class ObjectRefImpl {
|
|
1049
|
-
constructor(_object, _key) {
|
|
1049
|
+
constructor(_object, _key, _defaultValue) {
|
|
1050
1050
|
this._object = _object;
|
|
1051
1051
|
this._key = _key;
|
|
1052
|
+
this._defaultValue = _defaultValue;
|
|
1052
1053
|
this.__v_isRef = true;
|
|
1053
1054
|
}
|
|
1054
1055
|
get value() {
|
|
1055
|
-
|
|
1056
|
+
const val = this._object[this._key];
|
|
1057
|
+
return val === undefined ? this._defaultValue : val;
|
|
1056
1058
|
}
|
|
1057
1059
|
set value(newVal) {
|
|
1058
1060
|
this._object[this._key] = newVal;
|
|
1059
1061
|
}
|
|
1060
1062
|
}
|
|
1061
|
-
function toRef(object, key) {
|
|
1063
|
+
function toRef(object, key, defaultValue) {
|
|
1062
1064
|
const val = object[key];
|
|
1063
|
-
return isRef(val)
|
|
1065
|
+
return isRef(val)
|
|
1066
|
+
? val
|
|
1067
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1064
1068
|
}
|
|
1065
1069
|
|
|
1066
1070
|
class ComputedRefImpl {
|
|
@@ -185,7 +185,7 @@ var VueReactivity = (function (exports) {
|
|
|
185
185
|
let effectTrackDepth = 0;
|
|
186
186
|
let trackOpBit = 1;
|
|
187
187
|
/**
|
|
188
|
-
* The bitwise track markers support at most 30 levels
|
|
188
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
189
189
|
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
190
190
|
* When recursion depth is greater, fall back to using a full cleanup.
|
|
191
191
|
*/
|
|
@@ -506,7 +506,7 @@ var VueReactivity = (function (exports) {
|
|
|
506
506
|
function createSetter(shallow = false) {
|
|
507
507
|
return function set(target, key, value, receiver) {
|
|
508
508
|
let oldValue = target[key];
|
|
509
|
-
if (!shallow) {
|
|
509
|
+
if (!shallow && !isReadonly(value)) {
|
|
510
510
|
value = toRaw(value);
|
|
511
511
|
oldValue = toRaw(oldValue);
|
|
512
512
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
@@ -1091,21 +1091,25 @@ var VueReactivity = (function (exports) {
|
|
|
1091
1091
|
return ret;
|
|
1092
1092
|
}
|
|
1093
1093
|
class ObjectRefImpl {
|
|
1094
|
-
constructor(_object, _key) {
|
|
1094
|
+
constructor(_object, _key, _defaultValue) {
|
|
1095
1095
|
this._object = _object;
|
|
1096
1096
|
this._key = _key;
|
|
1097
|
+
this._defaultValue = _defaultValue;
|
|
1097
1098
|
this.__v_isRef = true;
|
|
1098
1099
|
}
|
|
1099
1100
|
get value() {
|
|
1100
|
-
|
|
1101
|
+
const val = this._object[this._key];
|
|
1102
|
+
return val === undefined ? this._defaultValue : val;
|
|
1101
1103
|
}
|
|
1102
1104
|
set value(newVal) {
|
|
1103
1105
|
this._object[this._key] = newVal;
|
|
1104
1106
|
}
|
|
1105
1107
|
}
|
|
1106
|
-
function toRef(object, key) {
|
|
1108
|
+
function toRef(object, key, defaultValue) {
|
|
1107
1109
|
const val = object[key];
|
|
1108
|
-
return isRef(val)
|
|
1110
|
+
return isRef(val)
|
|
1111
|
+
? val
|
|
1112
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1109
1113
|
}
|
|
1110
1114
|
|
|
1111
1115
|
class ComputedRefImpl {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),s=t.split(",");for(let r=0;r<s.length;r++)n[s[r]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n=()=>{},s=Object.assign,r=Object.prototype.hasOwnProperty,i=(t,e)=>r.call(t,e),c=Array.isArray,o=t=>"[object Map]"===h(t),u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,h=t=>l.call(t),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>!Object.is(t,e);let p;const d=[];class v{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&p&&(this.parent=p,this.index=(p.scopes||(p.scopes=[])).push(this)-1)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(d.push(this),p=this)}off(){this.active&&(d.pop(),p=d[d.length-1])}stop(t){if(this.active){if(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.scopes&&this.scopes.forEach((t=>t.stop(!0))),this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function g(t,e){(e=e||p)&&e.active&&e.effects.push(t)}const y=t=>{const e=new Set(t);return e.w=0,e.n=0,e},w=t=>(t.w&m)>0,R=t=>(t.n&m)>0,b=new WeakMap;let k=0,m=1;const E=[];let S;const j=Symbol(""),O=Symbol("");class x{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],g(this,n)}run(){if(!this.active)return this.fn();if(!E.includes(this))try{return E.push(S=this),A(),m=1<<++k,k<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=m})(this):P(this),this.fn()}finally{k<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const r=e[s];w(r)&&!R(r)?r.delete(t):e[n++]=r,r.w&=~m,r.n&=~m}e.length=n}})(this),m=1<<--k,T(),E.pop();const t=E.length;S=t>0?E[t-1]:void 0}}stop(){this.active&&(P(this),this.onStop&&this.onStop(),this.active=!1)}}function P(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let M=!0;const z=[];function W(){z.push(M),M=!1}function A(){z.push(M),M=!0}function T(){const t=z.pop();M=void 0===t||t}function V(t,e,n){if(!N())return;let s=b.get(t);s||b.set(t,s=new Map);let r=s.get(n);r||s.set(n,r=y()),C(r)}function N(){return M&&void 0!==S}function C(t,e){let n=!1;k<=30?R(t)||(t.n|=m,n=!w(t)):n=!t.has(S),n&&(t.add(S),S.deps.push(t))}function I(t,e,n,s,r,i){const u=b.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===n&&c(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&a.push(t)}));else switch(void 0!==n&&a.push(u.get(n)),e){case"add":c(t)?f(n)&&a.push(u.get("length")):(a.push(u.get(j)),o(t)&&a.push(u.get(O)));break;case"delete":c(t)||(a.push(u.get(j)),o(t)&&a.push(u.get(O)));break;case"set":o(t)&&a.push(u.get(j))}if(1===a.length)a[0]&&K(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);K(y(t))}}function K(t,e){for(const n of c(t)?t:[...t])(n!==S||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const B=e("__proto__,__v_isRef,__isVue"),D=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(u)),L=J(),Y=J(!1,!0),q=J(!0),F=J(!0,!0),G=H();function H(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Wt(this);for(let e=0,r=this.length;e<r;e++)V(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Wt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){W();const n=Wt(this)[e].apply(this,t);return T(),n}})),t}function J(t=!1,e=!1){return function(n,s,r){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&r===(t?e?St:Et:e?mt:kt).get(n))return n;const o=c(n);if(!t&&o&&i(G,s))return Reflect.get(G,s,r);const l=Reflect.get(n,s,r);if(u(s)?D.has(s):B(s))return l;if(t||V(n,0,s),e)return l;if(Ct(l)){return!o||!f(s)?l.value:l}return a(l)?t?xt(l):Ot(l):l}}function Q(t=!1){return function(e,n,s,r){let o=e[n];if(!t&&(s=Wt(s),o=Wt(o),!c(e)&&Ct(o)&&!Ct(s)))return o.value=s,!0;const u=c(e)&&f(n)?Number(n)<e.length:i(e,n),a=Reflect.set(e,n,s,r);return e===Wt(r)&&(u?_(s,o)&&I(e,"set",n,s):I(e,"add",n,s)),a}}const U={get:L,set:Q(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&I(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return u(e)&&D.has(e)||V(t,0,e),n},ownKeys:function(t){return V(t,0,c(t)?"length":j),Reflect.ownKeys(t)}},X={get:q,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},Z=s({},U,{get:Y,set:Q(!0)}),$=s({},X,{get:F}),tt=t=>t,et=t=>Reflect.getPrototypeOf(t);function nt(t,e,n=!1,s=!1){const r=Wt(t=t.__v_raw),i=Wt(e);e!==i&&!n&&V(r,0,e),!n&&V(r,0,i);const{has:c}=et(r),o=s?tt:n?Tt:At;return c.call(r,e)?o(t.get(e)):c.call(r,i)?o(t.get(i)):void(t!==r&&t.get(e))}function st(t,e=!1){const n=this.__v_raw,s=Wt(n),r=Wt(t);return t!==r&&!e&&V(s,0,t),!e&&V(s,0,r),t===r?n.has(t):n.has(t)||n.has(r)}function rt(t,e=!1){return t=t.__v_raw,!e&&V(Wt(t),0,j),Reflect.get(t,"size",t)}function it(t){t=Wt(t);const e=Wt(this);return et(e).has.call(e,t)||(e.add(t),I(e,"add",t,t)),this}function ct(t,e){e=Wt(e);const n=Wt(this),{has:s,get:r}=et(n);let i=s.call(n,t);i||(t=Wt(t),i=s.call(n,t));const c=r.call(n,t);return n.set(t,e),i?_(e,c)&&I(n,"set",t,e):I(n,"add",t,e),this}function ot(t){const e=Wt(this),{has:n,get:s}=et(e);let r=n.call(e,t);r||(t=Wt(t),r=n.call(e,t)),s&&s.call(e,t);const i=e.delete(t);return r&&I(e,"delete",t,void 0),i}function ut(){const t=Wt(this),e=0!==t.size,n=t.clear();return e&&I(t,"clear",void 0,void 0),n}function at(t,e){return function(n,s){const r=this,i=r.__v_raw,c=Wt(i),o=e?tt:t?Tt:At;return!t&&V(c,0,j),i.forEach(((t,e)=>n.call(s,o(t),o(e),r)))}}function lt(t,e,n){return function(...s){const r=this.__v_raw,i=Wt(r),c=o(i),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,l=r[t](...s),h=n?tt:e?Tt:At;return!e&&V(i,0,a?O:j),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[h(t[0]),h(t[1])]:h(t),done:e}},[Symbol.iterator](){return this}}}}function ht(t){return function(...e){return"delete"!==t&&this}}function ft(){const t={get(t){return nt(this,t)},get size(){return rt(this)},has:st,add:it,set:ct,delete:ot,clear:ut,forEach:at(!1,!1)},e={get(t){return nt(this,t,!1,!0)},get size(){return rt(this)},has:st,add:it,set:ct,delete:ot,clear:ut,forEach:at(!1,!0)},n={get(t){return nt(this,t,!0)},get size(){return rt(this,!0)},has(t){return st.call(this,t,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:at(!0,!1)},s={get(t){return nt(this,t,!0,!0)},get size(){return rt(this,!0)},has(t){return st.call(this,t,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:at(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((r=>{t[r]=lt(r,!1,!1),n[r]=lt(r,!0,!1),e[r]=lt(r,!1,!0),s[r]=lt(r,!0,!0)})),[t,n,e,s]}const[_t,pt,dt,vt]=ft();function gt(t,e){const n=e?t?vt:dt:t?pt:_t;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const yt={get:gt(!1,!1)},wt={get:gt(!1,!0)},Rt={get:gt(!0,!1)},bt={get:gt(!0,!0)},kt=new WeakMap,mt=new WeakMap,Et=new WeakMap,St=new WeakMap;function jt(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 Ot(t){return t&&t.__v_isReadonly?t:Pt(t,!1,U,yt,kt)}function xt(t){return Pt(t,!0,X,Rt,Et)}function Pt(t,e,n,s,r){if(!a(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=r.get(t);if(i)return i;const c=jt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return r.set(t,o),o}function Mt(t){return zt(t)?Mt(t.__v_raw):!(!t||!t.__v_isReactive)}function zt(t){return!(!t||!t.__v_isReadonly)}function Wt(t){const e=t&&t.__v_raw;return e?Wt(e):t}const At=t=>a(t)?Ot(t):t,Tt=t=>a(t)?xt(t):t;function Vt(t){N()&&((t=Wt(t)).dep||(t.dep=y()),C(t.dep))}function Nt(t,e){(t=Wt(t)).dep&&K(t.dep)}function Ct(t){return Boolean(t&&!0===t.__v_isRef)}function It(t,e){return Ct(t)?t:new Kt(t,e)}class Kt{constructor(t,e){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Wt(t),this._value=e?t:At(t)}get value(){return Vt(this),this._value}set value(t){t=this._shallow?t:Wt(t),_(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:At(t),Nt(this))}}function Bt(t){return Ct(t)?t.value:t}const Dt={get:(t,e,n)=>Bt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const r=t[e];return Ct(r)&&!Ct(n)?(r.value=n,!0):Reflect.set(t,e,n,s)}};class Lt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Vt(this)),(()=>Nt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Yt{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 qt(t,e){const n=t[e];return Ct(n)?n:new Yt(t,e)}class Ft{constructor(t,e,n){this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.effect=new x(t,(()=>{this._dirty||(this._dirty=!0,Nt(this))})),this.__v_isReadonly=n}get value(){const t=Wt(this);return Vt(t),t._dirty&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}var Gt;const Ht=Promise.resolve(),Jt=[];let Qt=!1;const Ut=()=>{for(let t=0;t<Jt.length;t++)Jt[t]();Jt.length=0,Qt=!1};class Xt{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[Gt]=!0;let n=!1,s=!1;this.effect=new x(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,Jt.push((()=>{this.effect.active&&this._get()!==t&&Nt(this),s=!1})),Qt||(Qt=!0,Ht.then(Ut))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=!0}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Vt(this),Wt(this)._get()}}return Gt="__v_isReadonly",t.EffectScope=v,t.ITERATE_KEY=j,t.ReactiveEffect=x,t.computed=function(t,e){let s,r;const i="function"==typeof t;return i?(s=t,r=n):(s=t.get,r=t.set),new Ft(s,r,i||!r)},t.customRef=function(t){return new Lt(t)},t.deferredComputed=function(t){return new Xt(t)},t.effect=function(t,e){t.effect&&(t=t.effect.fn);const n=new x(t);e&&(s(n,e),e.scope&&g(n,e.scope)),e&&e.lazy||n.run();const r=n.run.bind(n);return r.effect=n,r},t.effectScope=function(t){return new v(t)},t.enableTracking=A,t.getCurrentScope=function(){return p},t.isProxy=function(t){return Mt(t)||zt(t)},t.isReactive=Mt,t.isReadonly=zt,t.isRef=Ct,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){p&&p.cleanups.push(t)},t.pauseTracking=W,t.proxyRefs=function(t){return Mt(t)?t:new Proxy(t,Dt)},t.reactive=Ot,t.readonly=xt,t.ref=function(t){return It(t,!1)},t.resetTracking=T,t.shallowReactive=function(t){return Pt(t,!1,Z,wt,mt)},t.shallowReadonly=function(t){return Pt(t,!0,$,bt,St)},t.shallowRef=function(t){return It(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Wt,t.toRef=qt,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=qt(t,n);return e},t.track=V,t.trigger=I,t.triggerRef=function(t){Nt(t)},t.unref=Bt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
1
|
+
var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n=()=>{},s=Object.assign,i=Object.prototype.hasOwnProperty,r=(t,e)=>i.call(t,e),c=Array.isArray,o=t=>"[object Map]"===h(t),u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,h=t=>l.call(t),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>!Object.is(t,e);let d;const p=[];class v{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&d&&(this.parent=d,this.index=(d.scopes||(d.scopes=[])).push(this)-1)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(p.push(this),d=this)}off(){this.active&&(p.pop(),d=p[p.length-1])}stop(t){if(this.active){if(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.scopes&&this.scopes.forEach((t=>t.stop(!0))),this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function g(t,e){(e=e||d)&&e.active&&e.effects.push(t)}const y=t=>{const e=new Set(t);return e.w=0,e.n=0,e},w=t=>(t.w&m)>0,R=t=>(t.n&m)>0,b=new WeakMap;let k=0,m=1;const E=[];let S;const j=Symbol(""),O=Symbol("");class x{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],g(this,n)}run(){if(!this.active)return this.fn();if(!E.includes(this))try{return E.push(S=this),W(),m=1<<++k,k<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=m})(this):P(this),this.fn()}finally{k<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];w(i)&&!R(i)?i.delete(t):e[n++]=i,i.w&=~m,i.n&=~m}e.length=n}})(this),m=1<<--k,A(),E.pop();const t=E.length;S=t>0?E[t-1]:void 0}}stop(){this.active&&(P(this),this.onStop&&this.onStop(),this.active=!1)}}function P(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let M=!0;const z=[];function V(){z.push(M),M=!1}function W(){z.push(M),M=!0}function A(){const t=z.pop();M=void 0===t||t}function T(t,e,n){if(!N())return;let s=b.get(t);s||b.set(t,s=new Map);let i=s.get(n);i||s.set(n,i=y()),C(i)}function N(){return M&&void 0!==S}function C(t,e){let n=!1;k<=30?R(t)||(t.n|=m,n=!w(t)):n=!t.has(S),n&&(t.add(S),S.deps.push(t))}function I(t,e,n,s,i,r){const u=b.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===n&&c(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&a.push(t)}));else switch(void 0!==n&&a.push(u.get(n)),e){case"add":c(t)?f(n)&&a.push(u.get("length")):(a.push(u.get(j)),o(t)&&a.push(u.get(O)));break;case"delete":c(t)||(a.push(u.get(j)),o(t)&&a.push(u.get(O)));break;case"set":o(t)&&a.push(u.get(j))}if(1===a.length)a[0]&&K(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);K(y(t))}}function K(t,e){for(const n of c(t)?t:[...t])(n!==S||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const B=e("__proto__,__v_isRef,__isVue"),D=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(u)),L=J(),Y=J(!1,!0),q=J(!0),F=J(!0,!0),G=H();function H(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Vt(this);for(let e=0,i=this.length;e<i;e++)T(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Vt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){V();const n=Vt(this)[e].apply(this,t);return A(),n}})),t}function J(t=!1,e=!1){return function(n,s,i){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&i===(t?e?St:Et:e?mt:kt).get(n))return n;const o=c(n);if(!t&&o&&r(G,s))return Reflect.get(G,s,i);const l=Reflect.get(n,s,i);if(u(s)?D.has(s):B(s))return l;if(t||T(n,0,s),e)return l;if(Ct(l)){return!o||!f(s)?l.value:l}return a(l)?t?xt(l):Ot(l):l}}function Q(t=!1){return function(e,n,s,i){let o=e[n];if(!t&&!zt(s)&&(s=Vt(s),o=Vt(o),!c(e)&&Ct(o)&&!Ct(s)))return o.value=s,!0;const u=c(e)&&f(n)?Number(n)<e.length:r(e,n),a=Reflect.set(e,n,s,i);return e===Vt(i)&&(u?_(s,o)&&I(e,"set",n,s):I(e,"add",n,s)),a}}const U={get:L,set:Q(),deleteProperty:function(t,e){const n=r(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&I(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return u(e)&&D.has(e)||T(t,0,e),n},ownKeys:function(t){return T(t,0,c(t)?"length":j),Reflect.ownKeys(t)}},X={get:q,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},Z=s({},U,{get:Y,set:Q(!0)}),$=s({},X,{get:F}),tt=t=>t,et=t=>Reflect.getPrototypeOf(t);function nt(t,e,n=!1,s=!1){const i=Vt(t=t.__v_raw),r=Vt(e);e!==r&&!n&&T(i,0,e),!n&&T(i,0,r);const{has:c}=et(i),o=s?tt:n?At:Wt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function st(t,e=!1){const n=this.__v_raw,s=Vt(n),i=Vt(t);return t!==i&&!e&&T(s,0,t),!e&&T(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function it(t,e=!1){return t=t.__v_raw,!e&&T(Vt(t),0,j),Reflect.get(t,"size",t)}function rt(t){t=Vt(t);const e=Vt(this);return et(e).has.call(e,t)||(e.add(t),I(e,"add",t,t)),this}function ct(t,e){e=Vt(e);const n=Vt(this),{has:s,get:i}=et(n);let r=s.call(n,t);r||(t=Vt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?_(e,c)&&I(n,"set",t,e):I(n,"add",t,e),this}function ot(t){const e=Vt(this),{has:n,get:s}=et(e);let i=n.call(e,t);i||(t=Vt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&I(e,"delete",t,void 0),r}function ut(){const t=Vt(this),e=0!==t.size,n=t.clear();return e&&I(t,"clear",void 0,void 0),n}function at(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Vt(r),o=e?tt:t?At:Wt;return!t&&T(c,0,j),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function lt(t,e,n){return function(...s){const i=this.__v_raw,r=Vt(i),c=o(r),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,l=i[t](...s),h=n?tt:e?At:Wt;return!e&&T(r,0,a?O:j),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[h(t[0]),h(t[1])]:h(t),done:e}},[Symbol.iterator](){return this}}}}function ht(t){return function(...e){return"delete"!==t&&this}}function ft(){const t={get(t){return nt(this,t)},get size(){return it(this)},has:st,add:rt,set:ct,delete:ot,clear:ut,forEach:at(!1,!1)},e={get(t){return nt(this,t,!1,!0)},get size(){return it(this)},has:st,add:rt,set:ct,delete:ot,clear:ut,forEach:at(!1,!0)},n={get(t){return nt(this,t,!0)},get size(){return it(this,!0)},has(t){return st.call(this,t,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:at(!0,!1)},s={get(t){return nt(this,t,!0,!0)},get size(){return it(this,!0)},has(t){return st.call(this,t,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:at(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=lt(i,!1,!1),n[i]=lt(i,!0,!1),e[i]=lt(i,!1,!0),s[i]=lt(i,!0,!0)})),[t,n,e,s]}const[_t,dt,pt,vt]=ft();function gt(t,e){const n=e?t?vt:pt:t?dt:_t;return(e,s,i)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(r(n,s)&&s in e?n:e,s,i)}const yt={get:gt(!1,!1)},wt={get:gt(!1,!0)},Rt={get:gt(!0,!1)},bt={get:gt(!0,!0)},kt=new WeakMap,mt=new WeakMap,Et=new WeakMap,St=new WeakMap;function jt(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 Ot(t){return t&&t.__v_isReadonly?t:Pt(t,!1,U,yt,kt)}function xt(t){return Pt(t,!0,X,Rt,Et)}function Pt(t,e,n,s,i){if(!a(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=jt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function Mt(t){return zt(t)?Mt(t.__v_raw):!(!t||!t.__v_isReactive)}function zt(t){return!(!t||!t.__v_isReadonly)}function Vt(t){const e=t&&t.__v_raw;return e?Vt(e):t}const Wt=t=>a(t)?Ot(t):t,At=t=>a(t)?xt(t):t;function Tt(t){N()&&((t=Vt(t)).dep||(t.dep=y()),C(t.dep))}function Nt(t,e){(t=Vt(t)).dep&&K(t.dep)}function Ct(t){return Boolean(t&&!0===t.__v_isRef)}function It(t,e){return Ct(t)?t:new Kt(t,e)}class Kt{constructor(t,e){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Vt(t),this._value=e?t:Wt(t)}get value(){return Tt(this),this._value}set value(t){t=this._shallow?t:Vt(t),_(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:Wt(t),Nt(this))}}function Bt(t){return Ct(t)?t.value:t}const Dt={get:(t,e,n)=>Bt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Ct(i)&&!Ct(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};class Lt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Tt(this)),(()=>Nt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Yt{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}}function qt(t,e,n){const s=t[e];return Ct(s)?s:new Yt(t,e,n)}class Ft{constructor(t,e,n){this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.effect=new x(t,(()=>{this._dirty||(this._dirty=!0,Nt(this))})),this.__v_isReadonly=n}get value(){const t=Vt(this);return Tt(t),t._dirty&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}var Gt;const Ht=Promise.resolve(),Jt=[];let Qt=!1;const Ut=()=>{for(let t=0;t<Jt.length;t++)Jt[t]();Jt.length=0,Qt=!1};class Xt{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[Gt]=!0;let n=!1,s=!1;this.effect=new x(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,Jt.push((()=>{this.effect.active&&this._get()!==t&&Nt(this),s=!1})),Qt||(Qt=!0,Ht.then(Ut))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=!0}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Tt(this),Vt(this)._get()}}return Gt="__v_isReadonly",t.EffectScope=v,t.ITERATE_KEY=j,t.ReactiveEffect=x,t.computed=function(t,e){let s,i;const r="function"==typeof t;return r?(s=t,i=n):(s=t.get,i=t.set),new Ft(s,i,r||!i)},t.customRef=function(t){return new Lt(t)},t.deferredComputed=function(t){return new Xt(t)},t.effect=function(t,e){t.effect&&(t=t.effect.fn);const n=new x(t);e&&(s(n,e),e.scope&&g(n,e.scope)),e&&e.lazy||n.run();const i=n.run.bind(n);return i.effect=n,i},t.effectScope=function(t){return new v(t)},t.enableTracking=W,t.getCurrentScope=function(){return d},t.isProxy=function(t){return Mt(t)||zt(t)},t.isReactive=Mt,t.isReadonly=zt,t.isRef=Ct,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){d&&d.cleanups.push(t)},t.pauseTracking=V,t.proxyRefs=function(t){return Mt(t)?t:new Proxy(t,Dt)},t.reactive=Ot,t.readonly=xt,t.ref=function(t){return It(t,!1)},t.resetTracking=A,t.shallowReactive=function(t){return Pt(t,!1,Z,wt,mt)},t.shallowReadonly=function(t){return Pt(t,!0,$,bt,St)},t.shallowRef=function(t){return It(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Vt,t.toRef=qt,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=qt(t,n);return e},t.track=T,t.trigger=I,t.triggerRef=function(t){Nt(t)},t.unref=Bt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/reactivity",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.25",
|
|
4
4
|
"description": "@vue/reactivity",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/reactivity.esm-bundler.js",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/reactivity#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@vue/shared": "3.2.
|
|
39
|
+
"@vue/shared": "3.2.25"
|
|
40
40
|
}
|
|
41
41
|
}
|