@vue/reactivity 3.4.0-alpha.3 → 3.4.0-beta.1
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 +36 -7
- package/dist/reactivity.cjs.prod.js +36 -7
- package/dist/reactivity.d.ts +5 -10
- package/dist/reactivity.esm-browser.js +34 -8
- package/dist/reactivity.esm-browser.prod.js +1 -1
- package/dist/reactivity.esm-bundler.js +34 -8
- package/dist/reactivity.global.js +36 -7
- package/dist/reactivity.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/reactivity.cjs.js
CHANGED
|
@@ -455,8 +455,13 @@ class BaseReactiveHandler {
|
|
|
455
455
|
return isReadonly2;
|
|
456
456
|
} else if (key === "__v_isShallow") {
|
|
457
457
|
return shallow;
|
|
458
|
-
} else if (key === "__v_raw"
|
|
459
|
-
|
|
458
|
+
} else if (key === "__v_raw") {
|
|
459
|
+
if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
460
|
+
// this means the reciever is a user proxy of the reactive proxy
|
|
461
|
+
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
462
|
+
return target;
|
|
463
|
+
}
|
|
464
|
+
return;
|
|
460
465
|
}
|
|
461
466
|
const targetIsArray = shared.isArray(target);
|
|
462
467
|
if (!isReadonly2) {
|
|
@@ -492,17 +497,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
492
497
|
}
|
|
493
498
|
set(target, key, value, receiver) {
|
|
494
499
|
let oldValue = target[key];
|
|
495
|
-
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
496
|
-
return false;
|
|
497
|
-
}
|
|
498
500
|
if (!this._shallow) {
|
|
501
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
499
502
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
500
503
|
oldValue = toRaw(oldValue);
|
|
501
504
|
value = toRaw(value);
|
|
502
505
|
}
|
|
503
506
|
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
504
|
-
|
|
505
|
-
|
|
507
|
+
if (isOldValueReadonly) {
|
|
508
|
+
return false;
|
|
509
|
+
} else {
|
|
510
|
+
oldValue.value = value;
|
|
511
|
+
return true;
|
|
512
|
+
}
|
|
506
513
|
}
|
|
507
514
|
}
|
|
508
515
|
const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
|
|
@@ -1197,9 +1204,31 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1197
1204
|
|
|
1198
1205
|
const deferredComputed = computed;
|
|
1199
1206
|
|
|
1207
|
+
const TrackOpTypes = {
|
|
1208
|
+
"GET": "get",
|
|
1209
|
+
"HAS": "has",
|
|
1210
|
+
"ITERATE": "iterate"
|
|
1211
|
+
};
|
|
1212
|
+
const TriggerOpTypes = {
|
|
1213
|
+
"SET": "set",
|
|
1214
|
+
"ADD": "add",
|
|
1215
|
+
"DELETE": "delete",
|
|
1216
|
+
"CLEAR": "clear"
|
|
1217
|
+
};
|
|
1218
|
+
const ReactiveFlags = {
|
|
1219
|
+
"SKIP": "__v_skip",
|
|
1220
|
+
"IS_REACTIVE": "__v_isReactive",
|
|
1221
|
+
"IS_READONLY": "__v_isReadonly",
|
|
1222
|
+
"IS_SHALLOW": "__v_isShallow",
|
|
1223
|
+
"RAW": "__v_raw"
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1200
1226
|
exports.EffectScope = EffectScope;
|
|
1201
1227
|
exports.ITERATE_KEY = ITERATE_KEY;
|
|
1202
1228
|
exports.ReactiveEffect = ReactiveEffect;
|
|
1229
|
+
exports.ReactiveFlags = ReactiveFlags;
|
|
1230
|
+
exports.TrackOpTypes = TrackOpTypes;
|
|
1231
|
+
exports.TriggerOpTypes = TriggerOpTypes;
|
|
1203
1232
|
exports.computed = computed;
|
|
1204
1233
|
exports.customRef = customRef;
|
|
1205
1234
|
exports.deferredComputed = deferredComputed;
|
|
@@ -422,8 +422,13 @@ class BaseReactiveHandler {
|
|
|
422
422
|
return isReadonly2;
|
|
423
423
|
} else if (key === "__v_isShallow") {
|
|
424
424
|
return shallow;
|
|
425
|
-
} else if (key === "__v_raw"
|
|
426
|
-
|
|
425
|
+
} else if (key === "__v_raw") {
|
|
426
|
+
if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
427
|
+
// this means the reciever is a user proxy of the reactive proxy
|
|
428
|
+
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
429
|
+
return target;
|
|
430
|
+
}
|
|
431
|
+
return;
|
|
427
432
|
}
|
|
428
433
|
const targetIsArray = shared.isArray(target);
|
|
429
434
|
if (!isReadonly2) {
|
|
@@ -459,17 +464,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
459
464
|
}
|
|
460
465
|
set(target, key, value, receiver) {
|
|
461
466
|
let oldValue = target[key];
|
|
462
|
-
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
463
|
-
return false;
|
|
464
|
-
}
|
|
465
467
|
if (!this._shallow) {
|
|
468
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
466
469
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
467
470
|
oldValue = toRaw(oldValue);
|
|
468
471
|
value = toRaw(value);
|
|
469
472
|
}
|
|
470
473
|
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
471
|
-
|
|
472
|
-
|
|
474
|
+
if (isOldValueReadonly) {
|
|
475
|
+
return false;
|
|
476
|
+
} else {
|
|
477
|
+
oldValue.value = value;
|
|
478
|
+
return true;
|
|
479
|
+
}
|
|
473
480
|
}
|
|
474
481
|
}
|
|
475
482
|
const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
|
|
@@ -1106,9 +1113,31 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1106
1113
|
|
|
1107
1114
|
const deferredComputed = computed;
|
|
1108
1115
|
|
|
1116
|
+
const TrackOpTypes = {
|
|
1117
|
+
"GET": "get",
|
|
1118
|
+
"HAS": "has",
|
|
1119
|
+
"ITERATE": "iterate"
|
|
1120
|
+
};
|
|
1121
|
+
const TriggerOpTypes = {
|
|
1122
|
+
"SET": "set",
|
|
1123
|
+
"ADD": "add",
|
|
1124
|
+
"DELETE": "delete",
|
|
1125
|
+
"CLEAR": "clear"
|
|
1126
|
+
};
|
|
1127
|
+
const ReactiveFlags = {
|
|
1128
|
+
"SKIP": "__v_skip",
|
|
1129
|
+
"IS_REACTIVE": "__v_isReactive",
|
|
1130
|
+
"IS_READONLY": "__v_isReadonly",
|
|
1131
|
+
"IS_SHALLOW": "__v_isShallow",
|
|
1132
|
+
"RAW": "__v_raw"
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1109
1135
|
exports.EffectScope = EffectScope;
|
|
1110
1136
|
exports.ITERATE_KEY = ITERATE_KEY;
|
|
1111
1137
|
exports.ReactiveEffect = ReactiveEffect;
|
|
1138
|
+
exports.ReactiveFlags = ReactiveFlags;
|
|
1139
|
+
exports.TrackOpTypes = TrackOpTypes;
|
|
1140
|
+
exports.TriggerOpTypes = TriggerOpTypes;
|
|
1112
1141
|
exports.computed = computed;
|
|
1113
1142
|
exports.customRef = customRef;
|
|
1114
1143
|
exports.deferredComputed = deferredComputed;
|
package/dist/reactivity.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { IfAny } from '@vue/shared';
|
|
2
2
|
|
|
3
|
-
export declare
|
|
3
|
+
export declare enum TrackOpTypes {
|
|
4
4
|
GET = "get",
|
|
5
5
|
HAS = "has",
|
|
6
6
|
ITERATE = "iterate"
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
8
|
+
export declare enum TriggerOpTypes {
|
|
9
9
|
SET = "set",
|
|
10
10
|
ADD = "add",
|
|
11
11
|
DELETE = "delete",
|
|
12
12
|
CLEAR = "clear"
|
|
13
13
|
}
|
|
14
|
-
export declare
|
|
14
|
+
export declare enum ReactiveFlags {
|
|
15
15
|
SKIP = "__v_skip",
|
|
16
16
|
IS_REACTIVE = "__v_isReactive",
|
|
17
17
|
IS_READONLY = "__v_isReadonly",
|
|
@@ -403,10 +403,6 @@ export type Raw<T> = T & {
|
|
|
403
403
|
*/
|
|
404
404
|
export declare function markRaw<T extends object>(value: T): Raw<T>;
|
|
405
405
|
|
|
406
|
-
type CollectionTypes = IterableCollections | WeakCollections;
|
|
407
|
-
type IterableCollections = Map<any, any> | Set<any>;
|
|
408
|
-
type WeakCollections = WeakMap<any, any> | WeakSet<any>;
|
|
409
|
-
|
|
410
406
|
declare const RefSymbol: unique symbol;
|
|
411
407
|
declare const RawSymbol: unique symbol;
|
|
412
408
|
export interface Ref<T = any> {
|
|
@@ -432,7 +428,6 @@ export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
|
|
|
432
428
|
* @param value - The object to wrap in the ref.
|
|
433
429
|
* @see {@link https://vuejs.org/api/reactivity-core.html#ref}
|
|
434
430
|
*/
|
|
435
|
-
export declare function ref<T extends Ref>(value: T): T;
|
|
436
431
|
export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;
|
|
437
432
|
export declare function ref<T = any>(): Ref<T | undefined>;
|
|
438
433
|
declare const ShallowRefMarker: unique symbol;
|
|
@@ -624,9 +619,9 @@ export type ShallowUnwrapRef<T> = {
|
|
|
624
619
|
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K] extends Ref<infer V> | undefined ? unknown extends V ? undefined : V | undefined : T[K];
|
|
625
620
|
};
|
|
626
621
|
export type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
|
627
|
-
type UnwrapRefSimple<T> = T extends Function |
|
|
622
|
+
type UnwrapRefSimple<T> = T extends Function | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
|
628
623
|
[RawSymbol]?: true;
|
|
629
|
-
} ? T : T extends ReadonlyArray<any> ? {
|
|
624
|
+
} ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> : T extends ReadonlyArray<any> ? {
|
|
630
625
|
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
|
631
626
|
} : T extends object & {
|
|
632
627
|
[ShallowReactiveMarker]?: never;
|
|
@@ -490,8 +490,13 @@ class BaseReactiveHandler {
|
|
|
490
490
|
return isReadonly2;
|
|
491
491
|
} else if (key === "__v_isShallow") {
|
|
492
492
|
return shallow;
|
|
493
|
-
} else if (key === "__v_raw"
|
|
494
|
-
|
|
493
|
+
} else if (key === "__v_raw") {
|
|
494
|
+
if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
495
|
+
// this means the reciever is a user proxy of the reactive proxy
|
|
496
|
+
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
497
|
+
return target;
|
|
498
|
+
}
|
|
499
|
+
return;
|
|
495
500
|
}
|
|
496
501
|
const targetIsArray = isArray(target);
|
|
497
502
|
if (!isReadonly2) {
|
|
@@ -527,17 +532,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
527
532
|
}
|
|
528
533
|
set(target, key, value, receiver) {
|
|
529
534
|
let oldValue = target[key];
|
|
530
|
-
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
535
|
if (!this._shallow) {
|
|
536
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
534
537
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
535
538
|
oldValue = toRaw(oldValue);
|
|
536
539
|
value = toRaw(value);
|
|
537
540
|
}
|
|
538
541
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
539
|
-
|
|
540
|
-
|
|
542
|
+
if (isOldValueReadonly) {
|
|
543
|
+
return false;
|
|
544
|
+
} else {
|
|
545
|
+
oldValue.value = value;
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
541
548
|
}
|
|
542
549
|
}
|
|
543
550
|
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
|
@@ -1232,4 +1239,23 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1232
1239
|
|
|
1233
1240
|
const deferredComputed = computed;
|
|
1234
1241
|
|
|
1235
|
-
|
|
1242
|
+
const TrackOpTypes = {
|
|
1243
|
+
"GET": "get",
|
|
1244
|
+
"HAS": "has",
|
|
1245
|
+
"ITERATE": "iterate"
|
|
1246
|
+
};
|
|
1247
|
+
const TriggerOpTypes = {
|
|
1248
|
+
"SET": "set",
|
|
1249
|
+
"ADD": "add",
|
|
1250
|
+
"DELETE": "delete",
|
|
1251
|
+
"CLEAR": "clear"
|
|
1252
|
+
};
|
|
1253
|
+
const ReactiveFlags = {
|
|
1254
|
+
"SKIP": "__v_skip",
|
|
1255
|
+
"IS_REACTIVE": "__v_isReactive",
|
|
1256
|
+
"IS_READONLY": "__v_isReadonly",
|
|
1257
|
+
"IS_SHALLOW": "__v_isShallow",
|
|
1258
|
+
"RAW": "__v_raw"
|
|
1259
|
+
};
|
|
1260
|
+
|
|
1261
|
+
export { EffectScope, ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, computed, customRef, deferredComputed, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, pauseScheduling, pauseTracking, proxyRefs, reactive, readonly, ref, resetScheduling, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, track, trigger, triggerRef, unref };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,e){const s=new Set(t.split(","));return e?t=>s.has(t.toLowerCase()):t=>s.has(t)}const e=()=>{},s=Object.assign,n=Object.prototype.hasOwnProperty,i=(t,e)=>n.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"function"==typeof t,u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),f=t=>l(t).slice(8,-1),_=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,d=(t,e)=>!Object.is(t,e);let p,v;class g{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=p,!t&&p&&(this.index=(p.scopes||(p.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=p;try{return p=this,t()}finally{p=e}}}on(){p=this}off(){p=this.parent}stop(t){if(this._active){let e,s;for(e=0,s=this.effects.length;e<s;e++)this.effects[e].stop();for(e=0,s=this.cleanups.length;e<s;e++)this.cleanups[e]();if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function y(t){return new g(t)}function w(t,e=p){e&&e.active&&e.effects.push(t)}function b(){return p}function R(t){p&&p.cleanups.push(t)}class k{constructor(t,e,s,n){this.fn=t,this.trigger=e,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=3,this._trackId=0,this._runnings=0,this._queryings=0,this._depsLength=0,w(this,n)}get dirty(){if(1===this._dirtyLevel){this._dirtyLevel=0,this._queryings++,z();for(const t of this.deps)if(t.computed&&(m(t.computed),this._dirtyLevel>=2))break;W(),this._queryings--}return this._dirtyLevel>=2}set dirty(t){this._dirtyLevel=t?3:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=P,e=v;try{return P=!0,v=this,this._runnings++,L(this),this.fn()}finally{S(this),this._runnings--,v=e,P=t}}stop(){var t;this.active&&(L(this),S(this),null==(t=this.onStop)||t.call(this),this.active=!1)}}function m(t){return t.value}function L(t){t._trackId++,t._depsLength=0}function S(t){if(t.deps&&t.deps.length>t._depsLength){for(let e=t._depsLength;e<t.deps.length;e++)O(t.deps[e],t);t.deps.length=t._depsLength}}function O(t,e){const s=t.get(e);void 0!==s&&e._trackId!==s&&(t.delete(e),0===t.size&&t.cleanup())}function j(t,n){t.effect instanceof k&&(t=t.effect.fn);const i=new k(t,e,(()=>{i.dirty&&i.run()}));n&&(s(i,n),n.scope&&w(i,n.scope)),n&&n.lazy||i.run();const r=i.run.bind(i);return r.effect=i,r}function x(t){t.effect.stop()}let P=!0,E=0;const M=[];function z(){M.push(P),P=!1}function I(){M.push(P),P=!0}function W(){const t=M.pop();P=void 0===t||t}function V(){E++}function N(){for(E--;!E&&A.length;)A.shift()()}function q(t,e,s){if(e.get(t)!==t._trackId){e.set(t,t._trackId);const s=t.deps[t._depsLength];s!==e?(s&&O(s,t),t.deps[t._depsLength++]=e):t._depsLength++}}const A=[];function K(t,e,s){V();for(const n of t.keys())if((n.allowRecurse||!n._runnings)&&n._dirtyLevel<e&&(!n._runnings||2!==e)){const t=n._dirtyLevel;n._dirtyLevel=e,0!==t||n._queryings&&2===e||(n.trigger(),n.scheduler&&A.push(n.scheduler))}N()}const C=(t,e)=>{const s=new Map;return s.cleanup=t,s.computed=e,s},B=new WeakMap,D=Symbol(""),F=Symbol("");function G(t,e,s){if(P&&v){let e=B.get(t);e||B.set(t,e=new Map);let n=e.get(s);n||e.set(s,n=C((()=>e.delete(s)))),q(v,n)}}function H(t,e,s,n,i,o){const a=B.get(t);if(!a)return;let h=[];if("clear"===e)h=[...a.values()];else if("length"===s&&r(t)){const t=Number(n);a.forEach(((e,s)=>{("length"===s||!u(s)&&s>=t)&&h.push(e)}))}else switch(void 0!==s&&h.push(a.get(s)),e){case"add":r(t)?_(s)&&h.push(a.get("length")):(h.push(a.get(D)),c(t)&&h.push(a.get(F)));break;case"delete":r(t)||(h.push(a.get(D)),c(t)&&h.push(a.get(F)));break;case"set":c(t)&&h.push(a.get(D))}V();for(const r of h)r&&K(r,3);N()}const J=t("__proto__,__v_isRef,__isVue"),Q=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(u)),T=U();function U(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const s=Kt(this);for(let e=0,i=this.length;e<i;e++)G(s,0,e+"");const n=s[e](...t);return-1===n||!1===n?s[e](...t.map(Kt)):n}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){z(),V();const s=Kt(this)[e].apply(this,t);return N(),W(),s}})),t}function X(t){const e=Kt(this);return G(e,0,t),e.hasOwnProperty(t)}class Y{constructor(t=!1,e=!1){this._isReadonly=t,this._shallow=e}get(t,e,s){const n=this._isReadonly,c=this._shallow;if("__v_isReactive"===e)return!n;if("__v_isReadonly"===e)return n;if("__v_isShallow"===e)return c;if("__v_raw"===e&&s===(n?c?Pt:xt:c?jt:Ot).get(t))return t;const o=r(t);if(!n){if(o&&i(T,e))return Reflect.get(T,e,s);if("hasOwnProperty"===e)return X}const h=Reflect.get(t,e,s);return(u(e)?Q.has(e):J(e))?h:(n||G(t,0,e),c?h:Qt(h)?o&&_(e)?h:h.value:a(h)?n?zt(h):Et(h):h)}}class Z extends Y{constructor(t=!1){super(!1,t)}set(t,e,s,n){let c=t[e];if(Nt(c)&&Qt(c)&&!Qt(s))return!1;if(!this._shallow&&(qt(s)||Nt(s)||(c=Kt(c),s=Kt(s)),!r(t)&&Qt(c)&&!Qt(s)))return c.value=s,!0;const o=r(t)&&_(e)?Number(e)<t.length:i(t,e),u=Reflect.set(t,e,s,n);return t===Kt(n)&&(o?d(s,c)&&H(t,"set",e,s):H(t,"add",e,s)),u}deleteProperty(t,e){const s=i(t,e),n=Reflect.deleteProperty(t,e);return n&&s&&H(t,"delete",e,void 0),n}has(t,e){const s=Reflect.has(t,e);return u(e)&&Q.has(e)||G(t,0,e),s}ownKeys(t){return G(t,0,r(t)?"length":D),Reflect.ownKeys(t)}}class $ extends Y{constructor(t=!1){super(!0,t)}set(t,e){return!0}deleteProperty(t,e){return!0}}const tt=new Z,et=new $,st=new Z(!0),nt=new $(!0),it=t=>t,rt=t=>Reflect.getPrototypeOf(t);function ct(t,e,s=!1,n=!1){const i=Kt(t=t.__v_raw),r=Kt(e);s||(d(e,r)&&G(i,0,e),G(i,0,r));const{has:c}=rt(i),o=n?it:s?Dt:Bt;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 s=this.__v_raw,n=Kt(s),i=Kt(t);return e||(d(t,i)&&G(n,0,t),G(n,0,i)),t===i?s.has(t):s.has(t)||s.has(i)}function ut(t,e=!1){return t=t.__v_raw,!e&&G(Kt(t),0,D),Reflect.get(t,"size",t)}function at(t){t=Kt(t);const e=Kt(this);return rt(e).has.call(e,t)||(e.add(t),H(e,"add",t,t)),this}function ht(t,e){e=Kt(e);const s=Kt(this),{has:n,get:i}=rt(s);let r=n.call(s,t);r||(t=Kt(t),r=n.call(s,t));const c=i.call(s,t);return s.set(t,e),r?d(e,c)&&H(s,"set",t,e):H(s,"add",t,e),this}function lt(t){const e=Kt(this),{has:s,get:n}=rt(e);let i=s.call(e,t);i||(t=Kt(t),i=s.call(e,t)),n&&n.call(e,t);const r=e.delete(t);return i&&H(e,"delete",t,void 0),r}function ft(){const t=Kt(this),e=0!==t.size,s=t.clear();return e&&H(t,"clear",void 0,void 0),s}function _t(t,e){return function(s,n){const i=this,r=i.__v_raw,c=Kt(r),o=e?it:t?Dt:Bt;return!t&&G(c,0,D),r.forEach(((t,e)=>s.call(n,o(t),o(e),i)))}}function dt(t,e,s){return function(...n){const i=this.__v_raw,r=Kt(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,a="keys"===t&&o,h=i[t](...n),l=s?it:e?Dt:Bt;return!e&&G(r,0,a?F:D),{next(){const{value:t,done:e}=h.next();return e?{value:t,done:e}:{value:u?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function pt(t){return function(...e){return"delete"!==t&&("clear"===t?void 0:this)}}function vt(){const t={get(t){return ct(this,t)},get size(){return ut(this)},has:ot,add:at,set:ht,delete:lt,clear:ft,forEach:_t(!1,!1)},e={get(t){return ct(this,t,!1,!0)},get size(){return ut(this)},has:ot,add:at,set:ht,delete:lt,clear:ft,forEach:_t(!1,!0)},s={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)},n={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),s[i]=dt(i,!0,!1),e[i]=dt(i,!1,!0),n[i]=dt(i,!0,!0)})),[t,s,e,n]}const[gt,yt,wt,bt]=vt();function Rt(t,e){const s=e?t?bt:wt:t?yt:gt;return(e,n,r)=>"__v_isReactive"===n?!t:"__v_isReadonly"===n?t:"__v_raw"===n?e:Reflect.get(i(s,n)&&n in e?s:e,n,r)}const kt={get:Rt(!1,!1)},mt={get:Rt(!1,!0)},Lt={get:Rt(!0,!1)},St={get:Rt(!0,!0)},Ot=new WeakMap,jt=new WeakMap,xt=new WeakMap,Pt=new WeakMap;function Et(t){return Nt(t)?t:Wt(t,!1,tt,kt,Ot)}function Mt(t){return Wt(t,!1,st,mt,jt)}function zt(t){return Wt(t,!0,et,Lt,xt)}function It(t){return Wt(t,!0,nt,St,Pt)}function Wt(t,e,s,n,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=(o=t).__v_skip||!Object.isExtensible(o)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(f(o));var o;if(0===c)return t;const u=new Proxy(t,2===c?n:s);return i.set(t,u),u}function Vt(t){return Nt(t)?Vt(t.__v_raw):!(!t||!t.__v_isReactive)}function Nt(t){return!(!t||!t.__v_isReadonly)}function qt(t){return!(!t||!t.__v_isShallow)}function At(t){return Vt(t)||Nt(t)}function Kt(t){const e=t&&t.__v_raw;return e?Kt(e):t}function Ct(t){return((t,e,s)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:s})})(t,"__v_skip",!0),t}const Bt=t=>a(t)?Et(t):t,Dt=t=>a(t)?zt(t):t;class Ft{constructor(t,e,s,n){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new k((()=>t(this._value)),(()=>Jt(this,1))),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s}get value(){const t=Kt(this);return Ht(t),t._cacheable&&!t.effect.dirty||d(t._value,t._value=t.effect.run())&&Jt(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function Gt(t,s,n=!1){let i,r;const c=o(t);c?(i=t,r=e):(i=t.get,r=t.set);return new Ft(i,r,c||!r,n)}function Ht(t){P&&v&&(t=Kt(t),q(v,t.dep||(t.dep=C((()=>t.dep=void 0),t instanceof Ft?t:void 0))))}function Jt(t,e=3,s){const n=(t=Kt(t)).dep;n&&K(n,e)}function Qt(t){return!(!t||!0!==t.__v_isRef)}function Tt(t){return Xt(t,!1)}function Ut(t){return Xt(t,!0)}function Xt(t,e){return Qt(t)?t:new Yt(t,e)}class Yt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Kt(t),this._value=e?t:Bt(t)}get value(){return Ht(this),this._value}set value(t){const e=this.__v_isShallow||qt(t)||Nt(t);t=e?t:Kt(t),d(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:Bt(t),Jt(this,3))}}function Zt(t){Jt(t,3)}function $t(t){return Qt(t)?t.value:t}function te(t){return o(t)?t():$t(t)}const ee={get:(t,e,s)=>$t(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return Qt(i)&&!Qt(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function se(t){return Vt(t)?t:new Proxy(t,ee)}class ne{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:s}=t((()=>Ht(this)),(()=>Jt(this)));this._get=e,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}function ie(t){return new ne(t)}function re(t){const e=r(t)?new Array(t.length):{};for(const s in t)e[s]=ae(t,s);return e}class ce{constructor(t,e,s){this._object=t,this._key=e,this._defaultValue=s,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}get dep(){return t=Kt(this._object),e=this._key,null==(s=B.get(t))?void 0:s.get(e);var t,e,s}}class oe{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function ue(t,e,s){return Qt(t)?t:o(t)?new oe(t):a(t)&&arguments.length>1?ae(t,e,s):Tt(t)}function ae(t,e,s){const n=t[e];return Qt(n)?n:new ce(t,e,s)}const he=Gt;export{g as EffectScope,D as ITERATE_KEY,k as ReactiveEffect,Gt as computed,ie as customRef,he as deferredComputed,j as effect,y as effectScope,I as enableTracking,b as getCurrentScope,At as isProxy,Vt as isReactive,Nt as isReadonly,Qt as isRef,qt as isShallow,Ct as markRaw,R as onScopeDispose,V as pauseScheduling,z as pauseTracking,se as proxyRefs,Et as reactive,zt as readonly,Tt as ref,N as resetScheduling,W as resetTracking,Mt as shallowReactive,It as shallowReadonly,Ut as shallowRef,x as stop,Kt as toRaw,ue as toRef,re as toRefs,te as toValue,G as track,H as trigger,Zt as triggerRef,$t as unref};
|
|
1
|
+
function t(t,e){const s=new Set(t.split(","));return e?t=>s.has(t.toLowerCase()):t=>s.has(t)}const e=()=>{},s=Object.assign,n=Object.prototype.hasOwnProperty,i=(t,e)=>n.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"function"==typeof t,u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),_=t=>l(t).slice(8,-1),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,d=(t,e)=>!Object.is(t,e);let p,v;class g{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=p,!t&&p&&(this.index=(p.scopes||(p.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=p;try{return p=this,t()}finally{p=e}}}on(){p=this}off(){p=this.parent}stop(t){if(this._active){let e,s;for(e=0,s=this.effects.length;e<s;e++)this.effects[e].stop();for(e=0,s=this.cleanups.length;e<s;e++)this.cleanups[e]();if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function y(t){return new g(t)}function w(t,e=p){e&&e.active&&e.effects.push(t)}function R(){return p}function b(t){p&&p.cleanups.push(t)}class k{constructor(t,e,s,n){this.fn=t,this.trigger=e,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=3,this._trackId=0,this._runnings=0,this._queryings=0,this._depsLength=0,w(this,n)}get dirty(){if(1===this._dirtyLevel){this._dirtyLevel=0,this._queryings++,A();for(const t of this.deps)if(t.computed&&(S(t.computed),this._dirtyLevel>=2))break;W(),this._queryings--}return this._dirtyLevel>=2}set dirty(t){this._dirtyLevel=t?3:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=x,e=v;try{return x=!0,v=this,this._runnings++,L(this),this.fn()}finally{E(this),this._runnings--,v=e,x=t}}stop(){var t;this.active&&(L(this),E(this),null==(t=this.onStop)||t.call(this),this.active=!1)}}function S(t){return t.value}function L(t){t._trackId++,t._depsLength=0}function E(t){if(t.deps&&t.deps.length>t._depsLength){for(let e=t._depsLength;e<t.deps.length;e++)O(t.deps[e],t);t.deps.length=t._depsLength}}function O(t,e){const s=t.get(e);void 0!==s&&e._trackId!==s&&(t.delete(e),0===t.size&&t.cleanup())}function m(t,n){t.effect instanceof k&&(t=t.effect.fn);const i=new k(t,e,(()=>{i.dirty&&i.run()}));n&&(s(i,n),n.scope&&w(i,n.scope)),n&&n.lazy||i.run();const r=i.run.bind(i);return r.effect=i,r}function j(t){t.effect.stop()}let x=!0,P=0;const I=[];function A(){I.push(x),x=!1}function M(){I.push(x),x=!0}function W(){const t=I.pop();x=void 0===t||t}function z(){P++}function V(){for(P--;!P&&T.length;)T.shift()()}function N(t,e,s){if(e.get(t)!==t._trackId){e.set(t,t._trackId);const s=t.deps[t._depsLength];s!==e?(s&&O(s,t),t.deps[t._depsLength++]=e):t._depsLength++}}const T=[];function q(t,e,s){z();for(const n of t.keys())if((n.allowRecurse||!n._runnings)&&n._dirtyLevel<e&&(!n._runnings||2!==e)){const t=n._dirtyLevel;n._dirtyLevel=e,0!==t||n._queryings&&2===e||(n.trigger(),n.scheduler&&T.push(n.scheduler))}V()}const D=(t,e)=>{const s=new Map;return s.cleanup=t,s.computed=e,s},C=new WeakMap,K=Symbol(""),H=Symbol("");function G(t,e,s){if(x&&v){let e=C.get(t);e||C.set(t,e=new Map);let n=e.get(s);n||e.set(s,n=D((()=>e.delete(s)))),N(v,n)}}function Y(t,e,s,n,i,o){const a=C.get(t);if(!a)return;let h=[];if("clear"===e)h=[...a.values()];else if("length"===s&&r(t)){const t=Number(n);a.forEach(((e,s)=>{("length"===s||!u(s)&&s>=t)&&h.push(e)}))}else switch(void 0!==s&&h.push(a.get(s)),e){case"add":r(t)?f(s)&&h.push(a.get("length")):(h.push(a.get(K)),c(t)&&h.push(a.get(H)));break;case"delete":r(t)||(h.push(a.get(K)),c(t)&&h.push(a.get(H)));break;case"set":c(t)&&h.push(a.get(K))}z();for(const r of h)r&&q(r,3);V()}const B=t("__proto__,__v_isRef,__isVue"),F=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(u)),J=Q();function Q(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const s=qt(this);for(let e=0,i=this.length;e<i;e++)G(s,0,e+"");const n=s[e](...t);return-1===n||!1===n?s[e](...t.map(qt)):n}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){A(),z();const s=qt(this)[e].apply(this,t);return V(),W(),s}})),t}function U(t){const e=qt(this);return G(e,0,t),e.hasOwnProperty(t)}class X{constructor(t=!1,e=!1){this._isReadonly=t,this._shallow=e}get(t,e,s){const n=this._isReadonly,c=this._shallow;if("__v_isReactive"===e)return!n;if("__v_isReadonly"===e)return n;if("__v_isShallow"===e)return c;if("__v_raw"===e)return s===(n?c?xt:jt:c?mt:Ot).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const o=r(t);if(!n){if(o&&i(J,e))return Reflect.get(J,e,s);if("hasOwnProperty"===e)return U}const h=Reflect.get(t,e,s);return(u(e)?F.has(e):B(e))?h:(n||G(t,0,e),c?h:Ft(h)?o&&f(e)?h:h.value:a(h)?n?At(h):Pt(h):h)}}class Z extends X{constructor(t=!1){super(!1,t)}set(t,e,s,n){let c=t[e];if(!this._shallow){const e=Vt(c);if(Nt(s)||Vt(s)||(c=qt(c),s=qt(s)),!r(t)&&Ft(c)&&!Ft(s))return!e&&(c.value=s,!0)}const o=r(t)&&f(e)?Number(e)<t.length:i(t,e),u=Reflect.set(t,e,s,n);return t===qt(n)&&(o?d(s,c)&&Y(t,"set",e,s):Y(t,"add",e,s)),u}deleteProperty(t,e){const s=i(t,e),n=Reflect.deleteProperty(t,e);return n&&s&&Y(t,"delete",e,void 0),n}has(t,e){const s=Reflect.has(t,e);return u(e)&&F.has(e)||G(t,0,e),s}ownKeys(t){return G(t,0,r(t)?"length":K),Reflect.ownKeys(t)}}class $ extends X{constructor(t=!1){super(!0,t)}set(t,e){return!0}deleteProperty(t,e){return!0}}const tt=new Z,et=new $,st=new Z(!0),nt=new $(!0),it=t=>t,rt=t=>Reflect.getPrototypeOf(t);function ct(t,e,s=!1,n=!1){const i=qt(t=t.__v_raw),r=qt(e);s||(d(e,r)&&G(i,0,e),G(i,0,r));const{has:c}=rt(i),o=n?it:s?Kt:Ct;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 s=this.__v_raw,n=qt(s),i=qt(t);return e||(d(t,i)&&G(n,0,t),G(n,0,i)),t===i?s.has(t):s.has(t)||s.has(i)}function ut(t,e=!1){return t=t.__v_raw,!e&&G(qt(t),0,K),Reflect.get(t,"size",t)}function at(t){t=qt(t);const e=qt(this);return rt(e).has.call(e,t)||(e.add(t),Y(e,"add",t,t)),this}function ht(t,e){e=qt(e);const s=qt(this),{has:n,get:i}=rt(s);let r=n.call(s,t);r||(t=qt(t),r=n.call(s,t));const c=i.call(s,t);return s.set(t,e),r?d(e,c)&&Y(s,"set",t,e):Y(s,"add",t,e),this}function lt(t){const e=qt(this),{has:s,get:n}=rt(e);let i=s.call(e,t);i||(t=qt(t),i=s.call(e,t)),n&&n.call(e,t);const r=e.delete(t);return i&&Y(e,"delete",t,void 0),r}function _t(){const t=qt(this),e=0!==t.size,s=t.clear();return e&&Y(t,"clear",void 0,void 0),s}function ft(t,e){return function(s,n){const i=this,r=i.__v_raw,c=qt(r),o=e?it:t?Kt:Ct;return!t&&G(c,0,K),r.forEach(((t,e)=>s.call(n,o(t),o(e),i)))}}function dt(t,e,s){return function(...n){const i=this.__v_raw,r=qt(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,a="keys"===t&&o,h=i[t](...n),l=s?it:e?Kt:Ct;return!e&&G(r,0,a?H:K),{next(){const{value:t,done:e}=h.next();return e?{value:t,done:e}:{value:u?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function pt(t){return function(...e){return"delete"!==t&&("clear"===t?void 0:this)}}function vt(){const t={get(t){return ct(this,t)},get size(){return ut(this)},has:ot,add:at,set:ht,delete:lt,clear:_t,forEach:ft(!1,!1)},e={get(t){return ct(this,t,!1,!0)},get size(){return ut(this)},has:ot,add:at,set:ht,delete:lt,clear:_t,forEach:ft(!1,!0)},s={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:ft(!0,!1)},n={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:ft(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=dt(i,!1,!1),s[i]=dt(i,!0,!1),e[i]=dt(i,!1,!0),n[i]=dt(i,!0,!0)})),[t,s,e,n]}const[gt,yt,wt,Rt]=vt();function bt(t,e){const s=e?t?Rt:wt:t?yt:gt;return(e,n,r)=>"__v_isReactive"===n?!t:"__v_isReadonly"===n?t:"__v_raw"===n?e:Reflect.get(i(s,n)&&n in e?s:e,n,r)}const kt={get:bt(!1,!1)},St={get:bt(!1,!0)},Lt={get:bt(!0,!1)},Et={get:bt(!0,!0)},Ot=new WeakMap,mt=new WeakMap,jt=new WeakMap,xt=new WeakMap;function Pt(t){return Vt(t)?t:Wt(t,!1,tt,kt,Ot)}function It(t){return Wt(t,!1,st,St,mt)}function At(t){return Wt(t,!0,et,Lt,jt)}function Mt(t){return Wt(t,!0,nt,Et,xt)}function Wt(t,e,s,n,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=(o=t).__v_skip||!Object.isExtensible(o)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(_(o));var o;if(0===c)return t;const u=new Proxy(t,2===c?n:s);return i.set(t,u),u}function zt(t){return Vt(t)?zt(t.__v_raw):!(!t||!t.__v_isReactive)}function Vt(t){return!(!t||!t.__v_isReadonly)}function Nt(t){return!(!t||!t.__v_isShallow)}function Tt(t){return zt(t)||Vt(t)}function qt(t){const e=t&&t.__v_raw;return e?qt(e):t}function Dt(t){return((t,e,s)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:s})})(t,"__v_skip",!0),t}const Ct=t=>a(t)?Pt(t):t,Kt=t=>a(t)?At(t):t;class Ht{constructor(t,e,s,n){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new k((()=>t(this._value)),(()=>Bt(this,1))),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s}get value(){const t=qt(this);return Yt(t),t._cacheable&&!t.effect.dirty||d(t._value,t._value=t.effect.run())&&Bt(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function Gt(t,s,n=!1){let i,r;const c=o(t);c?(i=t,r=e):(i=t.get,r=t.set);return new Ht(i,r,c||!r,n)}function Yt(t){x&&v&&(t=qt(t),N(v,t.dep||(t.dep=D((()=>t.dep=void 0),t instanceof Ht?t:void 0))))}function Bt(t,e=3,s){const n=(t=qt(t)).dep;n&&q(n,e)}function Ft(t){return!(!t||!0!==t.__v_isRef)}function Jt(t){return Ut(t,!1)}function Qt(t){return Ut(t,!0)}function Ut(t,e){return Ft(t)?t:new Xt(t,e)}class Xt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:qt(t),this._value=e?t:Ct(t)}get value(){return Yt(this),this._value}set value(t){const e=this.__v_isShallow||Nt(t)||Vt(t);t=e?t:qt(t),d(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:Ct(t),Bt(this,3))}}function Zt(t){Bt(t,3)}function $t(t){return Ft(t)?t.value:t}function te(t){return o(t)?t():$t(t)}const ee={get:(t,e,s)=>$t(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return Ft(i)&&!Ft(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function se(t){return zt(t)?t:new Proxy(t,ee)}class ne{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:s}=t((()=>Yt(this)),(()=>Bt(this)));this._get=e,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}function ie(t){return new ne(t)}function re(t){const e=r(t)?new Array(t.length):{};for(const s in t)e[s]=ae(t,s);return e}class ce{constructor(t,e,s){this._object=t,this._key=e,this._defaultValue=s,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}get dep(){return t=qt(this._object),e=this._key,null==(s=C.get(t))?void 0:s.get(e);var t,e,s}}class oe{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function ue(t,e,s){return Ft(t)?t:o(t)?new oe(t):a(t)&&arguments.length>1?ae(t,e,s):Jt(t)}function ae(t,e,s){const n=t[e];return Ft(n)?n:new ce(t,e,s)}const he=Gt,le={GET:"get",HAS:"has",ITERATE:"iterate"},_e={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},fe={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw"};export{g as EffectScope,K as ITERATE_KEY,k as ReactiveEffect,fe as ReactiveFlags,le as TrackOpTypes,_e as TriggerOpTypes,Gt as computed,ie as customRef,he as deferredComputed,m as effect,y as effectScope,M as enableTracking,R as getCurrentScope,Tt as isProxy,zt as isReactive,Vt as isReadonly,Ft as isRef,Nt as isShallow,Dt as markRaw,b as onScopeDispose,z as pauseScheduling,A as pauseTracking,se as proxyRefs,Pt as reactive,At as readonly,Jt as ref,V as resetScheduling,W as resetTracking,It as shallowReactive,Mt as shallowReadonly,Qt as shallowRef,j as stop,qt as toRaw,ue as toRef,re as toRefs,te as toValue,G as track,Y as trigger,Zt as triggerRef,$t as unref};
|
|
@@ -451,8 +451,13 @@ class BaseReactiveHandler {
|
|
|
451
451
|
return isReadonly2;
|
|
452
452
|
} else if (key === "__v_isShallow") {
|
|
453
453
|
return shallow;
|
|
454
|
-
} else if (key === "__v_raw"
|
|
455
|
-
|
|
454
|
+
} else if (key === "__v_raw") {
|
|
455
|
+
if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
456
|
+
// this means the reciever is a user proxy of the reactive proxy
|
|
457
|
+
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
458
|
+
return target;
|
|
459
|
+
}
|
|
460
|
+
return;
|
|
456
461
|
}
|
|
457
462
|
const targetIsArray = isArray(target);
|
|
458
463
|
if (!isReadonly2) {
|
|
@@ -488,17 +493,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
488
493
|
}
|
|
489
494
|
set(target, key, value, receiver) {
|
|
490
495
|
let oldValue = target[key];
|
|
491
|
-
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
492
|
-
return false;
|
|
493
|
-
}
|
|
494
496
|
if (!this._shallow) {
|
|
497
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
495
498
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
496
499
|
oldValue = toRaw(oldValue);
|
|
497
500
|
value = toRaw(value);
|
|
498
501
|
}
|
|
499
502
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
500
|
-
|
|
501
|
-
|
|
503
|
+
if (isOldValueReadonly) {
|
|
504
|
+
return false;
|
|
505
|
+
} else {
|
|
506
|
+
oldValue.value = value;
|
|
507
|
+
return true;
|
|
508
|
+
}
|
|
502
509
|
}
|
|
503
510
|
}
|
|
504
511
|
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
|
@@ -1193,4 +1200,23 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1193
1200
|
|
|
1194
1201
|
const deferredComputed = computed;
|
|
1195
1202
|
|
|
1196
|
-
|
|
1203
|
+
const TrackOpTypes = {
|
|
1204
|
+
"GET": "get",
|
|
1205
|
+
"HAS": "has",
|
|
1206
|
+
"ITERATE": "iterate"
|
|
1207
|
+
};
|
|
1208
|
+
const TriggerOpTypes = {
|
|
1209
|
+
"SET": "set",
|
|
1210
|
+
"ADD": "add",
|
|
1211
|
+
"DELETE": "delete",
|
|
1212
|
+
"CLEAR": "clear"
|
|
1213
|
+
};
|
|
1214
|
+
const ReactiveFlags = {
|
|
1215
|
+
"SKIP": "__v_skip",
|
|
1216
|
+
"IS_REACTIVE": "__v_isReactive",
|
|
1217
|
+
"IS_READONLY": "__v_isReadonly",
|
|
1218
|
+
"IS_SHALLOW": "__v_isShallow",
|
|
1219
|
+
"RAW": "__v_raw"
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
export { EffectScope, ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, computed, customRef, deferredComputed, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, pauseScheduling, pauseTracking, proxyRefs, reactive, readonly, ref, resetScheduling, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, track, trigger, triggerRef, unref };
|
|
@@ -493,8 +493,13 @@ var VueReactivity = (function (exports) {
|
|
|
493
493
|
return isReadonly2;
|
|
494
494
|
} else if (key === "__v_isShallow") {
|
|
495
495
|
return shallow;
|
|
496
|
-
} else if (key === "__v_raw"
|
|
497
|
-
|
|
496
|
+
} else if (key === "__v_raw") {
|
|
497
|
+
if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
498
|
+
// this means the reciever is a user proxy of the reactive proxy
|
|
499
|
+
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
500
|
+
return target;
|
|
501
|
+
}
|
|
502
|
+
return;
|
|
498
503
|
}
|
|
499
504
|
const targetIsArray = isArray(target);
|
|
500
505
|
if (!isReadonly2) {
|
|
@@ -530,17 +535,19 @@ var VueReactivity = (function (exports) {
|
|
|
530
535
|
}
|
|
531
536
|
set(target, key, value, receiver) {
|
|
532
537
|
let oldValue = target[key];
|
|
533
|
-
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
534
|
-
return false;
|
|
535
|
-
}
|
|
536
538
|
if (!this._shallow) {
|
|
539
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
537
540
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
538
541
|
oldValue = toRaw(oldValue);
|
|
539
542
|
value = toRaw(value);
|
|
540
543
|
}
|
|
541
544
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
542
|
-
|
|
543
|
-
|
|
545
|
+
if (isOldValueReadonly) {
|
|
546
|
+
return false;
|
|
547
|
+
} else {
|
|
548
|
+
oldValue.value = value;
|
|
549
|
+
return true;
|
|
550
|
+
}
|
|
544
551
|
}
|
|
545
552
|
}
|
|
546
553
|
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
|
@@ -1235,9 +1242,31 @@ var VueReactivity = (function (exports) {
|
|
|
1235
1242
|
|
|
1236
1243
|
const deferredComputed = computed;
|
|
1237
1244
|
|
|
1245
|
+
const TrackOpTypes = {
|
|
1246
|
+
"GET": "get",
|
|
1247
|
+
"HAS": "has",
|
|
1248
|
+
"ITERATE": "iterate"
|
|
1249
|
+
};
|
|
1250
|
+
const TriggerOpTypes = {
|
|
1251
|
+
"SET": "set",
|
|
1252
|
+
"ADD": "add",
|
|
1253
|
+
"DELETE": "delete",
|
|
1254
|
+
"CLEAR": "clear"
|
|
1255
|
+
};
|
|
1256
|
+
const ReactiveFlags = {
|
|
1257
|
+
"SKIP": "__v_skip",
|
|
1258
|
+
"IS_REACTIVE": "__v_isReactive",
|
|
1259
|
+
"IS_READONLY": "__v_isReadonly",
|
|
1260
|
+
"IS_SHALLOW": "__v_isShallow",
|
|
1261
|
+
"RAW": "__v_raw"
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1238
1264
|
exports.EffectScope = EffectScope;
|
|
1239
1265
|
exports.ITERATE_KEY = ITERATE_KEY;
|
|
1240
1266
|
exports.ReactiveEffect = ReactiveEffect;
|
|
1267
|
+
exports.ReactiveFlags = ReactiveFlags;
|
|
1268
|
+
exports.TrackOpTypes = TrackOpTypes;
|
|
1269
|
+
exports.TriggerOpTypes = TriggerOpTypes;
|
|
1241
1270
|
exports.computed = computed;
|
|
1242
1271
|
exports.customRef = customRef;
|
|
1243
1272
|
exports.deferredComputed = deferredComputed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueReactivity=function(t){"use strict";function e(t,e){const s=new Set(t.split(","));return e?t=>s.has(t.toLowerCase()):t=>s.has(t)}const s=()=>{},n=Object.assign,r=Object.prototype.hasOwnProperty,i=(t,e)=>r.call(t,e),c=Array.isArray,o=t=>"[object Map]"===f(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,h=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,f=t=>l.call(t),_=t=>f(t).slice(8,-1),d=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,p=(t,e)=>!Object.is(t,e);let v,g;class y{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=v,!t&&v&&(this.index=(v.scopes||(v.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=v;try{return v=this,t()}finally{v=e}}}on(){v=this}off(){v=this.parent}stop(t){if(this._active){let e,s;for(e=0,s=this.effects.length;e<s;e++)this.effects[e].stop();for(e=0,s=this.cleanups.length;e<s;e++)this.cleanups[e]();if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function w(t,e=v){e&&e.active&&e.effects.push(t)}class R{constructor(t,e,s,n){this.fn=t,this.trigger=e,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=3,this._trackId=0,this._runnings=0,this._queryings=0,this._depsLength=0,w(this,n)}get dirty(){if(1===this._dirtyLevel){this._dirtyLevel=0,this._queryings++,O();for(const t of this.deps)if(t.computed&&(b(t.computed),this._dirtyLevel>=2))break;j(),this._queryings--}return this._dirtyLevel>=2}set dirty(t){this._dirtyLevel=t?3:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=L,e=g;try{return L=!0,g=this,this._runnings++,k(this),this.fn()}finally{S(this),this._runnings--,g=e,L=t}}stop(){var t;this.active&&(k(this),S(this),null==(t=this.onStop)||t.call(this),this.active=!1)}}function b(t){return t.value}function k(t){t._trackId++,t._depsLength=0}function S(t){if(t.deps&&t.deps.length>t._depsLength){for(let e=t._depsLength;e<t.deps.length;e++)m(t.deps[e],t);t.deps.length=t._depsLength}}function m(t,e){const s=t.get(e);void 0!==s&&e._trackId!==s&&(t.delete(e),0===t.size&&t.cleanup())}let L=!0,x=0;const E=[];function O(){E.push(L),L=!1}function j(){const t=E.pop();L=void 0===t||t}function P(){x++}function M(){for(x--;!x&&I.length;)I.shift()()}function z(t,e,s){if(e.get(t)!==t._trackId){e.set(t,t._trackId);const s=t.deps[t._depsLength];s!==e?(s&&m(s,t),t.deps[t._depsLength++]=e):t._depsLength++}}const I=[];function V(t,e,s){P();for(const n of t.keys())if((n.allowRecurse||!n._runnings)&&n._dirtyLevel<e&&(!n._runnings||2!==e)){const t=n._dirtyLevel;n._dirtyLevel=e,0!==t||n._queryings&&2===e||(n.trigger(),n.scheduler&&I.push(n.scheduler))}M()}const W=(t,e)=>{const s=new Map;return s.cleanup=t,s.computed=e,s},A=new WeakMap,N=Symbol(""),T=Symbol("");function q(t,e,s){if(L&&g){let e=A.get(t);e||A.set(t,e=new Map);let n=e.get(s);n||e.set(s,n=W((()=>e.delete(s)))),z(g,n)}}function C(t,e,s,n,r,i){const u=A.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===s&&c(t)){const t=Number(n);u.forEach(((e,s)=>{("length"===s||!a(s)&&s>=t)&&h.push(e)}))}else switch(void 0!==s&&h.push(u.get(s)),e){case"add":c(t)?d(s)&&h.push(u.get("length")):(h.push(u.get(N)),o(t)&&h.push(u.get(T)));break;case"delete":c(t)||(h.push(u.get(N)),o(t)&&h.push(u.get(T)));break;case"set":o(t)&&h.push(u.get(N))}P();for(const c of h)c&&V(c,3);M()}const K=e("__proto__,__v_isRef,__isVue"),D=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(a)),Y=B();function B(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const s=Mt(this);for(let e=0,r=this.length;e<r;e++)q(s,0,e+"");const n=s[e](...t);return-1===n||!1===n?s[e](...t.map(Mt)):n}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){O(),P();const s=Mt(this)[e].apply(this,t);return M(),j(),s}})),t}function F(t){const e=Mt(this);return q(e,0,t),e.hasOwnProperty(t)}class G{constructor(t=!1,e=!1){this._isReadonly=t,this._shallow=e}get(t,e,s){const n=this._isReadonly,r=this._shallow;if("__v_isReactive"===e)return!n;if("__v_isReadonly"===e)return n;if("__v_isShallow"===e)return r;if("__v_raw"===e&&s===(n?r?mt:St:r?kt:bt).get(t))return t;const o=c(t);if(!n){if(o&&i(Y,e))return Reflect.get(Y,e,s);if("hasOwnProperty"===e)return F}const u=Reflect.get(t,e,s);return(a(e)?D.has(e):K(e))?u:(n||q(t,0,e),r?u:Tt(u)?o&&d(e)?u:u.value:h(u)?n?xt(u):Lt(u):u)}}class H extends G{constructor(t=!1){super(!1,t)}set(t,e,s,n){let r=t[e];if(jt(r)&&Tt(r)&&!Tt(s))return!1;if(!this._shallow&&(Pt(s)||jt(s)||(r=Mt(r),s=Mt(s)),!c(t)&&Tt(r)&&!Tt(s)))return r.value=s,!0;const o=c(t)&&d(e)?Number(e)<t.length:i(t,e),u=Reflect.set(t,e,s,n);return t===Mt(n)&&(o?p(s,r)&&C(t,"set",e,s):C(t,"add",e,s)),u}deleteProperty(t,e){const s=i(t,e),n=Reflect.deleteProperty(t,e);return n&&s&&C(t,"delete",e,void 0),n}has(t,e){const s=Reflect.has(t,e);return a(e)&&D.has(e)||q(t,0,e),s}ownKeys(t){return q(t,0,c(t)?"length":N),Reflect.ownKeys(t)}}class J extends G{constructor(t=!1){super(!0,t)}set(t,e){return!0}deleteProperty(t,e){return!0}}const Q=new H,U=new J,X=new H(!0),Z=new J(!0),$=t=>t,tt=t=>Reflect.getPrototypeOf(t);function et(t,e,s=!1,n=!1){const r=Mt(t=t.__v_raw),i=Mt(e);s||(p(e,i)&&q(r,0,e),q(r,0,i));const{has:c}=tt(r),o=n?$:s?It:zt;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 s=this.__v_raw,n=Mt(s),r=Mt(t);return e||(p(t,r)&&q(n,0,t),q(n,0,r)),t===r?s.has(t):s.has(t)||s.has(r)}function nt(t,e=!1){return t=t.__v_raw,!e&&q(Mt(t),0,N),Reflect.get(t,"size",t)}function rt(t){t=Mt(t);const e=Mt(this);return tt(e).has.call(e,t)||(e.add(t),C(e,"add",t,t)),this}function it(t,e){e=Mt(e);const s=Mt(this),{has:n,get:r}=tt(s);let i=n.call(s,t);i||(t=Mt(t),i=n.call(s,t));const c=r.call(s,t);return s.set(t,e),i?p(e,c)&&C(s,"set",t,e):C(s,"add",t,e),this}function ct(t){const e=Mt(this),{has:s,get:n}=tt(e);let r=s.call(e,t);r||(t=Mt(t),r=s.call(e,t)),n&&n.call(e,t);const i=e.delete(t);return r&&C(e,"delete",t,void 0),i}function ot(){const t=Mt(this),e=0!==t.size,s=t.clear();return e&&C(t,"clear",void 0,void 0),s}function ut(t,e){return function(s,n){const r=this,i=r.__v_raw,c=Mt(i),o=e?$:t?It:zt;return!t&&q(c,0,N),i.forEach(((t,e)=>s.call(n,o(t),o(e),r)))}}function at(t,e,s){return function(...n){const r=this.__v_raw,i=Mt(r),c=o(i),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,h=r[t](...n),l=s?$:e?It:zt;return!e&&q(i,0,a?T:N),{next(){const{value:t,done:e}=h.next();return e?{value:t,done:e}:{value:u?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function ht(t){return function(...e){return"delete"!==t&&("clear"===t?void 0:this)}}function lt(){const t={get(t){return et(this,t)},get size(){return nt(this)},has:st,add:rt,set:it,delete:ct,clear:ot,forEach:ut(!1,!1)},e={get(t){return et(this,t,!1,!0)},get size(){return nt(this)},has:st,add:rt,set:it,delete:ct,clear:ot,forEach:ut(!1,!0)},s={get(t){return et(this,t,!0)},get size(){return nt(this,!0)},has(t){return st.call(this,t,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:ut(!0,!1)},n={get(t){return et(this,t,!0,!0)},get size(){return nt(this,!0)},has(t){return st.call(this,t,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:ut(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((r=>{t[r]=at(r,!1,!1),s[r]=at(r,!0,!1),e[r]=at(r,!1,!0),n[r]=at(r,!0,!0)})),[t,s,e,n]}const[ft,_t,dt,pt]=lt();function vt(t,e){const s=e?t?pt:dt:t?_t:ft;return(e,n,r)=>"__v_isReactive"===n?!t:"__v_isReadonly"===n?t:"__v_raw"===n?e:Reflect.get(i(s,n)&&n in e?s:e,n,r)}const gt={get:vt(!1,!1)},yt={get:vt(!1,!0)},wt={get:vt(!0,!1)},Rt={get:vt(!0,!0)},bt=new WeakMap,kt=new WeakMap,St=new WeakMap,mt=new WeakMap;function Lt(t){return jt(t)?t:Et(t,!1,Q,gt,bt)}function xt(t){return Et(t,!0,U,wt,St)}function Et(t,e,s,n,r){if(!h(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=r.get(t);if(i)return i;const c=(o=t).__v_skip||!Object.isExtensible(o)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(_(o));var o;if(0===c)return t;const u=new Proxy(t,2===c?n:s);return r.set(t,u),u}function Ot(t){return jt(t)?Ot(t.__v_raw):!(!t||!t.__v_isReactive)}function jt(t){return!(!t||!t.__v_isReadonly)}function Pt(t){return!(!t||!t.__v_isShallow)}function Mt(t){const e=t&&t.__v_raw;return e?Mt(e):t}const zt=t=>h(t)?Lt(t):t,It=t=>h(t)?xt(t):t;class Vt{constructor(t,e,s,n){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new R((()=>t(this._value)),(()=>Nt(this,1))),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s}get value(){const t=Mt(this);return At(t),t._cacheable&&!t.effect.dirty||p(t._value,t._value=t.effect.run())&&Nt(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function Wt(t,e,n=!1){let r,i;const c=u(t);c?(r=t,i=s):(r=t.get,i=t.set);return new Vt(r,i,c||!i,n)}function At(t){L&&g&&(t=Mt(t),z(g,t.dep||(t.dep=W((()=>t.dep=void 0),t instanceof Vt?t:void 0))))}function Nt(t,e=3,s){const n=(t=Mt(t)).dep;n&&V(n,e)}function Tt(t){return!(!t||!0!==t.__v_isRef)}function qt(t){return Ct(t,!1)}function Ct(t,e){return Tt(t)?t:new Kt(t,e)}class Kt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Mt(t),this._value=e?t:zt(t)}get value(){return At(this),this._value}set value(t){const e=this.__v_isShallow||Pt(t)||jt(t);t=e?t:Mt(t),p(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:zt(t),Nt(this,3))}}function Dt(t){return Tt(t)?t.value:t}const Yt={get:(t,e,s)=>Dt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const r=t[e];return Tt(r)&&!Tt(s)?(r.value=s,!0):Reflect.set(t,e,s,n)}};class Bt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:s}=t((()=>At(this)),(()=>Nt(this)));this._get=e,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}class Ft{constructor(t,e,s){this._object=t,this._key=e,this._defaultValue=s,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}get dep(){return t=Mt(this._object),e=this._key,null==(s=A.get(t))?void 0:s.get(e);var t,e,s}}class Gt{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Ht(t,e,s){const n=t[e];return Tt(n)?n:new Ft(t,e,s)}const Jt=Wt;return t.EffectScope=y,t.ITERATE_KEY=N,t.ReactiveEffect=R,t.computed=Wt,t.customRef=function(t){return new Bt(t)},t.deferredComputed=Jt,t.effect=function(t,e){t.effect instanceof R&&(t=t.effect.fn);const r=new R(t,s,(()=>{r.dirty&&r.run()}));e&&(n(r,e),e.scope&&w(r,e.scope)),e&&e.lazy||r.run();const i=r.run.bind(r);return i.effect=r,i},t.effectScope=function(t){return new y(t)},t.enableTracking=function(){E.push(L),L=!0},t.getCurrentScope=function(){return v},t.isProxy=function(t){return Ot(t)||jt(t)},t.isReactive=Ot,t.isReadonly=jt,t.isRef=Tt,t.isShallow=Pt,t.markRaw=function(t){return((t,e,s)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:s})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){v&&v.cleanups.push(t)},t.pauseScheduling=P,t.pauseTracking=O,t.proxyRefs=function(t){return Ot(t)?t:new Proxy(t,Yt)},t.reactive=Lt,t.readonly=xt,t.ref=qt,t.resetScheduling=M,t.resetTracking=j,t.shallowReactive=function(t){return Et(t,!1,X,yt,kt)},t.shallowReadonly=function(t){return Et(t,!0,Z,Rt,mt)},t.shallowRef=function(t){return Ct(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Mt,t.toRef=function(t,e,s){return Tt(t)?t:u(t)?new Gt(t):h(t)&&arguments.length>1?Ht(t,e,s):qt(t)},t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const s in t)e[s]=Ht(t,s);return e},t.toValue=function(t){return u(t)?t():Dt(t)},t.track=q,t.trigger=C,t.triggerRef=function(t){Nt(t,3)},t.unref=Dt,t}({});
|
|
1
|
+
var VueReactivity=function(t){"use strict";function e(t,e){const s=new Set(t.split(","));return e?t=>s.has(t.toLowerCase()):t=>s.has(t)}const s=()=>{},n=Object.assign,i=Object.prototype.hasOwnProperty,r=(t,e)=>i.call(t,e),c=Array.isArray,o=t=>"[object Map]"===f(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,l=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,f=t=>h.call(t),_=t=>f(t).slice(8,-1),d=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,p=(t,e)=>!Object.is(t,e);let v,g;class y{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=v,!t&&v&&(this.index=(v.scopes||(v.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=v;try{return v=this,t()}finally{v=e}}}on(){v=this}off(){v=this.parent}stop(t){if(this._active){let e,s;for(e=0,s=this.effects.length;e<s;e++)this.effects[e].stop();for(e=0,s=this.cleanups.length;e<s;e++)this.cleanups[e]();if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function w(t,e=v){e&&e.active&&e.effects.push(t)}class R{constructor(t,e,s,n){this.fn=t,this.trigger=e,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=3,this._trackId=0,this._runnings=0,this._queryings=0,this._depsLength=0,w(this,n)}get dirty(){if(1===this._dirtyLevel){this._dirtyLevel=0,this._queryings++,j();for(const t of this.deps)if(t.computed&&(b(t.computed),this._dirtyLevel>=2))break;x(),this._queryings--}return this._dirtyLevel>=2}set dirty(t){this._dirtyLevel=t?3:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=L,e=g;try{return L=!0,g=this,this._runnings++,S(this),this.fn()}finally{k(this),this._runnings--,g=e,L=t}}stop(){var t;this.active&&(S(this),k(this),null==(t=this.onStop)||t.call(this),this.active=!1)}}function b(t){return t.value}function S(t){t._trackId++,t._depsLength=0}function k(t){if(t.deps&&t.deps.length>t._depsLength){for(let e=t._depsLength;e<t.deps.length;e++)E(t.deps[e],t);t.deps.length=t._depsLength}}function E(t,e){const s=t.get(e);void 0!==s&&e._trackId!==s&&(t.delete(e),0===t.size&&t.cleanup())}let L=!0,m=0;const O=[];function j(){O.push(L),L=!1}function x(){const t=O.pop();L=void 0===t||t}function P(){m++}function T(){for(m--;!m&&A.length;)A.shift()()}function I(t,e,s){if(e.get(t)!==t._trackId){e.set(t,t._trackId);const s=t.deps[t._depsLength];s!==e?(s&&E(s,t),t.deps[t._depsLength++]=e):t._depsLength++}}const A=[];function M(t,e,s){P();for(const n of t.keys())if((n.allowRecurse||!n._runnings)&&n._dirtyLevel<e&&(!n._runnings||2!==e)){const t=n._dirtyLevel;n._dirtyLevel=e,0!==t||n._queryings&&2===e||(n.trigger(),n.scheduler&&A.push(n.scheduler))}T()}const V=(t,e)=>{const s=new Map;return s.cleanup=t,s.computed=e,s},W=new WeakMap,z=Symbol(""),N=Symbol("");function C(t,e,s){if(L&&g){let e=W.get(t);e||W.set(t,e=new Map);let n=e.get(s);n||e.set(s,n=V((()=>e.delete(s)))),I(g,n)}}function D(t,e,s,n,i,r){const u=W.get(t);if(!u)return;let l=[];if("clear"===e)l=[...u.values()];else if("length"===s&&c(t)){const t=Number(n);u.forEach(((e,s)=>{("length"===s||!a(s)&&s>=t)&&l.push(e)}))}else switch(void 0!==s&&l.push(u.get(s)),e){case"add":c(t)?d(s)&&l.push(u.get("length")):(l.push(u.get(z)),o(t)&&l.push(u.get(N)));break;case"delete":c(t)||(l.push(u.get(z)),o(t)&&l.push(u.get(N)));break;case"set":o(t)&&l.push(u.get(z))}P();for(const c of l)c&&M(c,3);T()}const q=e("__proto__,__v_isRef,__isVue"),K=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(a)),H=Y();function Y(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const s=Tt(this);for(let e=0,i=this.length;e<i;e++)C(s,0,e+"");const n=s[e](...t);return-1===n||!1===n?s[e](...t.map(Tt)):n}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){j(),P();const s=Tt(this)[e].apply(this,t);return T(),x(),s}})),t}function F(t){const e=Tt(this);return C(e,0,t),e.hasOwnProperty(t)}class G{constructor(t=!1,e=!1){this._isReadonly=t,this._shallow=e}get(t,e,s){const n=this._isReadonly,i=this._shallow;if("__v_isReactive"===e)return!n;if("__v_isReadonly"===e)return n;if("__v_isShallow"===e)return i;if("__v_raw"===e)return s===(n?i?Et:kt:i?St:bt).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const o=c(t);if(!n){if(o&&r(H,e))return Reflect.get(H,e,s);if("hasOwnProperty"===e)return F}const u=Reflect.get(t,e,s);return(a(e)?K.has(e):q(e))?u:(n||C(t,0,e),i?u:Nt(u)?o&&d(e)?u:u.value:l(u)?n?mt(u):Lt(u):u)}}class B extends G{constructor(t=!1){super(!1,t)}set(t,e,s,n){let i=t[e];if(!this._shallow){const e=xt(i);if(Pt(s)||xt(s)||(i=Tt(i),s=Tt(s)),!c(t)&&Nt(i)&&!Nt(s))return!e&&(i.value=s,!0)}const o=c(t)&&d(e)?Number(e)<t.length:r(t,e),u=Reflect.set(t,e,s,n);return t===Tt(n)&&(o?p(s,i)&&D(t,"set",e,s):D(t,"add",e,s)),u}deleteProperty(t,e){const s=r(t,e),n=Reflect.deleteProperty(t,e);return n&&s&&D(t,"delete",e,void 0),n}has(t,e){const s=Reflect.has(t,e);return a(e)&&K.has(e)||C(t,0,e),s}ownKeys(t){return C(t,0,c(t)?"length":z),Reflect.ownKeys(t)}}class J extends G{constructor(t=!1){super(!0,t)}set(t,e){return!0}deleteProperty(t,e){return!0}}const Q=new B,U=new J,X=new B(!0),Z=new J(!0),$=t=>t,tt=t=>Reflect.getPrototypeOf(t);function et(t,e,s=!1,n=!1){const i=Tt(t=t.__v_raw),r=Tt(e);s||(p(e,r)&&C(i,0,e),C(i,0,r));const{has:c}=tt(i),o=n?$:s?At:It;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 s=this.__v_raw,n=Tt(s),i=Tt(t);return e||(p(t,i)&&C(n,0,t),C(n,0,i)),t===i?s.has(t):s.has(t)||s.has(i)}function nt(t,e=!1){return t=t.__v_raw,!e&&C(Tt(t),0,z),Reflect.get(t,"size",t)}function it(t){t=Tt(t);const e=Tt(this);return tt(e).has.call(e,t)||(e.add(t),D(e,"add",t,t)),this}function rt(t,e){e=Tt(e);const s=Tt(this),{has:n,get:i}=tt(s);let r=n.call(s,t);r||(t=Tt(t),r=n.call(s,t));const c=i.call(s,t);return s.set(t,e),r?p(e,c)&&D(s,"set",t,e):D(s,"add",t,e),this}function ct(t){const e=Tt(this),{has:s,get:n}=tt(e);let i=s.call(e,t);i||(t=Tt(t),i=s.call(e,t)),n&&n.call(e,t);const r=e.delete(t);return i&&D(e,"delete",t,void 0),r}function ot(){const t=Tt(this),e=0!==t.size,s=t.clear();return e&&D(t,"clear",void 0,void 0),s}function ut(t,e){return function(s,n){const i=this,r=i.__v_raw,c=Tt(r),o=e?$:t?At:It;return!t&&C(c,0,z),r.forEach(((t,e)=>s.call(n,o(t),o(e),i)))}}function at(t,e,s){return function(...n){const i=this.__v_raw,r=Tt(i),c=o(r),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,l=i[t](...n),h=s?$:e?At:It;return!e&&C(r,0,a?N:z),{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 lt(t){return function(...e){return"delete"!==t&&("clear"===t?void 0:this)}}function ht(){const t={get(t){return et(this,t)},get size(){return nt(this)},has:st,add:it,set:rt,delete:ct,clear:ot,forEach:ut(!1,!1)},e={get(t){return et(this,t,!1,!0)},get size(){return nt(this)},has:st,add:it,set:rt,delete:ct,clear:ot,forEach:ut(!1,!0)},s={get(t){return et(this,t,!0)},get size(){return nt(this,!0)},has(t){return st.call(this,t,!0)},add:lt("add"),set:lt("set"),delete:lt("delete"),clear:lt("clear"),forEach:ut(!0,!1)},n={get(t){return et(this,t,!0,!0)},get size(){return nt(this,!0)},has(t){return st.call(this,t,!0)},add:lt("add"),set:lt("set"),delete:lt("delete"),clear:lt("clear"),forEach:ut(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=at(i,!1,!1),s[i]=at(i,!0,!1),e[i]=at(i,!1,!0),n[i]=at(i,!0,!0)})),[t,s,e,n]}const[ft,_t,dt,pt]=ht();function vt(t,e){const s=e?t?pt:dt:t?_t:ft;return(e,n,i)=>"__v_isReactive"===n?!t:"__v_isReadonly"===n?t:"__v_raw"===n?e:Reflect.get(r(s,n)&&n in e?s:e,n,i)}const gt={get:vt(!1,!1)},yt={get:vt(!1,!0)},wt={get:vt(!0,!1)},Rt={get:vt(!0,!0)},bt=new WeakMap,St=new WeakMap,kt=new WeakMap,Et=new WeakMap;function Lt(t){return xt(t)?t:Ot(t,!1,Q,gt,bt)}function mt(t){return Ot(t,!0,U,wt,kt)}function Ot(t,e,s,n,i){if(!l(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=(o=t).__v_skip||!Object.isExtensible(o)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(_(o));var o;if(0===c)return t;const u=new Proxy(t,2===c?n:s);return i.set(t,u),u}function jt(t){return xt(t)?jt(t.__v_raw):!(!t||!t.__v_isReactive)}function xt(t){return!(!t||!t.__v_isReadonly)}function Pt(t){return!(!t||!t.__v_isShallow)}function Tt(t){const e=t&&t.__v_raw;return e?Tt(e):t}const It=t=>l(t)?Lt(t):t,At=t=>l(t)?mt(t):t;class Mt{constructor(t,e,s,n){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new R((()=>t(this._value)),(()=>zt(this,1))),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s}get value(){const t=Tt(this);return Wt(t),t._cacheable&&!t.effect.dirty||p(t._value,t._value=t.effect.run())&&zt(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function Vt(t,e,n=!1){let i,r;const c=u(t);c?(i=t,r=s):(i=t.get,r=t.set);return new Mt(i,r,c||!r,n)}function Wt(t){L&&g&&(t=Tt(t),I(g,t.dep||(t.dep=V((()=>t.dep=void 0),t instanceof Mt?t:void 0))))}function zt(t,e=3,s){const n=(t=Tt(t)).dep;n&&M(n,e)}function Nt(t){return!(!t||!0!==t.__v_isRef)}function Ct(t){return Dt(t,!1)}function Dt(t,e){return Nt(t)?t:new qt(t,e)}class qt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Tt(t),this._value=e?t:It(t)}get value(){return Wt(this),this._value}set value(t){const e=this.__v_isShallow||Pt(t)||xt(t);t=e?t:Tt(t),p(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:It(t),zt(this,3))}}function Kt(t){return Nt(t)?t.value:t}const Ht={get:(t,e,s)=>Kt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return Nt(i)&&!Nt(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};class Yt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:s}=t((()=>Wt(this)),(()=>zt(this)));this._get=e,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}class Ft{constructor(t,e,s){this._object=t,this._key=e,this._defaultValue=s,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}get dep(){return t=Tt(this._object),e=this._key,null==(s=W.get(t))?void 0:s.get(e);var t,e,s}}class Gt{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Bt(t,e,s){const n=t[e];return Nt(n)?n:new Ft(t,e,s)}const Jt=Vt;return t.EffectScope=y,t.ITERATE_KEY=z,t.ReactiveEffect=R,t.ReactiveFlags={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw"},t.TrackOpTypes={GET:"get",HAS:"has",ITERATE:"iterate"},t.TriggerOpTypes={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},t.computed=Vt,t.customRef=function(t){return new Yt(t)},t.deferredComputed=Jt,t.effect=function(t,e){t.effect instanceof R&&(t=t.effect.fn);const i=new R(t,s,(()=>{i.dirty&&i.run()}));e&&(n(i,e),e.scope&&w(i,e.scope)),e&&e.lazy||i.run();const r=i.run.bind(i);return r.effect=i,r},t.effectScope=function(t){return new y(t)},t.enableTracking=function(){O.push(L),L=!0},t.getCurrentScope=function(){return v},t.isProxy=function(t){return jt(t)||xt(t)},t.isReactive=jt,t.isReadonly=xt,t.isRef=Nt,t.isShallow=Pt,t.markRaw=function(t){return((t,e,s)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:s})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){v&&v.cleanups.push(t)},t.pauseScheduling=P,t.pauseTracking=j,t.proxyRefs=function(t){return jt(t)?t:new Proxy(t,Ht)},t.reactive=Lt,t.readonly=mt,t.ref=Ct,t.resetScheduling=T,t.resetTracking=x,t.shallowReactive=function(t){return Ot(t,!1,X,yt,St)},t.shallowReadonly=function(t){return Ot(t,!0,Z,Rt,Et)},t.shallowRef=function(t){return Dt(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Tt,t.toRef=function(t,e,s){return Nt(t)?t:u(t)?new Gt(t):l(t)&&arguments.length>1?Bt(t,e,s):Ct(t)},t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const s in t)e[s]=Bt(t,s);return e},t.toValue=function(t){return u(t)?t():Kt(t)},t.track=C,t.trigger=D,t.triggerRef=function(t){zt(t,3)},t.unref=Kt,t}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/reactivity",
|
|
3
|
-
"version": "3.4.0-
|
|
3
|
+
"version": "3.4.0-beta.1",
|
|
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/core/tree/main/packages/reactivity#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@vue/shared": "3.4.0-
|
|
39
|
+
"@vue/shared": "3.4.0-beta.1"
|
|
40
40
|
}
|
|
41
41
|
}
|