@vue/reactivity 3.5.0-alpha.5 → 3.5.0-beta.2
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 +87 -30
- package/dist/reactivity.cjs.prod.js +87 -30
- package/dist/reactivity.d.ts +29 -17
- package/dist/reactivity.esm-browser.js +87 -30
- package/dist/reactivity.esm-browser.prod.js +2 -2
- package/dist/reactivity.esm-bundler.js +87 -30
- package/dist/reactivity.global.js +87 -30
- package/dist/reactivity.global.prod.js +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.5.0-
|
|
2
|
+
* @vue/reactivity v3.5.0-beta.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -65,6 +65,7 @@ class EffectScope {
|
|
|
65
65
|
* @internal
|
|
66
66
|
*/
|
|
67
67
|
this.cleanups = [];
|
|
68
|
+
this._isPaused = false;
|
|
68
69
|
this.parent = activeEffectScope;
|
|
69
70
|
if (!detached && activeEffectScope) {
|
|
70
71
|
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
|
@@ -75,6 +76,37 @@ class EffectScope {
|
|
|
75
76
|
get active() {
|
|
76
77
|
return this._active;
|
|
77
78
|
}
|
|
79
|
+
pause() {
|
|
80
|
+
if (this._active) {
|
|
81
|
+
this._isPaused = true;
|
|
82
|
+
if (this.scopes) {
|
|
83
|
+
for (let i = 0, l = this.scopes.length; i < l; i++) {
|
|
84
|
+
this.scopes[i].pause();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
for (let i = 0, l = this.effects.length; i < l; i++) {
|
|
88
|
+
this.effects[i].pause();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resumes the effect scope, including all child scopes and effects.
|
|
94
|
+
*/
|
|
95
|
+
resume() {
|
|
96
|
+
if (this._active) {
|
|
97
|
+
if (this._isPaused) {
|
|
98
|
+
this._isPaused = false;
|
|
99
|
+
if (this.scopes) {
|
|
100
|
+
for (let i = 0, l = this.scopes.length; i < l; i++) {
|
|
101
|
+
this.scopes[i].resume();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
for (let i = 0, l = this.effects.length; i < l; i++) {
|
|
105
|
+
this.effects[i].resume();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
78
110
|
run(fn) {
|
|
79
111
|
if (this._active) {
|
|
80
112
|
const currentEffectScope = activeEffectScope;
|
|
@@ -158,9 +190,10 @@ const EffectFlags = {
|
|
|
158
190
|
"16": "DIRTY",
|
|
159
191
|
"ALLOW_RECURSE": 32,
|
|
160
192
|
"32": "ALLOW_RECURSE",
|
|
161
|
-
"
|
|
162
|
-
"64": "
|
|
193
|
+
"PAUSED": 64,
|
|
194
|
+
"64": "PAUSED"
|
|
163
195
|
};
|
|
196
|
+
const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
|
|
164
197
|
class ReactiveEffect {
|
|
165
198
|
constructor(fn) {
|
|
166
199
|
this.fn = fn;
|
|
@@ -189,6 +222,18 @@ class ReactiveEffect {
|
|
|
189
222
|
activeEffectScope.effects.push(this);
|
|
190
223
|
}
|
|
191
224
|
}
|
|
225
|
+
pause() {
|
|
226
|
+
this.flags |= 64;
|
|
227
|
+
}
|
|
228
|
+
resume() {
|
|
229
|
+
if (this.flags & 64) {
|
|
230
|
+
this.flags &= ~64;
|
|
231
|
+
if (pausedQueueEffects.has(this)) {
|
|
232
|
+
pausedQueueEffects.delete(this);
|
|
233
|
+
this.trigger();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
192
237
|
/**
|
|
193
238
|
* @internal
|
|
194
239
|
*/
|
|
@@ -196,9 +241,6 @@ class ReactiveEffect {
|
|
|
196
241
|
if (this.flags & 2 && !(this.flags & 32)) {
|
|
197
242
|
return;
|
|
198
243
|
}
|
|
199
|
-
if (this.flags & 64) {
|
|
200
|
-
return this.trigger();
|
|
201
|
-
}
|
|
202
244
|
if (!(this.flags & 8)) {
|
|
203
245
|
this.flags |= 8;
|
|
204
246
|
this.nextEffect = batchedEffect;
|
|
@@ -242,7 +284,9 @@ class ReactiveEffect {
|
|
|
242
284
|
}
|
|
243
285
|
}
|
|
244
286
|
trigger() {
|
|
245
|
-
if (this.
|
|
287
|
+
if (this.flags & 64) {
|
|
288
|
+
pausedQueueEffects.add(this);
|
|
289
|
+
} else if (this.scheduler) {
|
|
246
290
|
this.scheduler();
|
|
247
291
|
} else {
|
|
248
292
|
this.runIfDirty();
|
|
@@ -270,6 +314,7 @@ function endBatch() {
|
|
|
270
314
|
batchDepth--;
|
|
271
315
|
return;
|
|
272
316
|
}
|
|
317
|
+
batchDepth--;
|
|
273
318
|
let error;
|
|
274
319
|
while (batchedEffect) {
|
|
275
320
|
let e = batchedEffect;
|
|
@@ -288,7 +333,6 @@ function endBatch() {
|
|
|
288
333
|
e = next;
|
|
289
334
|
}
|
|
290
335
|
}
|
|
291
|
-
batchDepth--;
|
|
292
336
|
if (error) throw error;
|
|
293
337
|
}
|
|
294
338
|
function prepareDeps(sub) {
|
|
@@ -575,9 +619,15 @@ function addSub(link) {
|
|
|
575
619
|
link.dep.subs = link;
|
|
576
620
|
}
|
|
577
621
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
578
|
-
const ITERATE_KEY = Symbol(
|
|
579
|
-
|
|
580
|
-
|
|
622
|
+
const ITERATE_KEY = Symbol(
|
|
623
|
+
"Object iterate"
|
|
624
|
+
);
|
|
625
|
+
const MAP_KEY_ITERATE_KEY = Symbol(
|
|
626
|
+
"Map keys iterate"
|
|
627
|
+
);
|
|
628
|
+
const ARRAY_ITERATE_KEY = Symbol(
|
|
629
|
+
"Array iterate"
|
|
630
|
+
);
|
|
581
631
|
function track(target, type, key) {
|
|
582
632
|
if (shouldTrack && activeSub) {
|
|
583
633
|
let depsMap = targetMap.get(target);
|
|
@@ -698,26 +748,26 @@ const arrayInstrumentations = {
|
|
|
698
748
|
});
|
|
699
749
|
},
|
|
700
750
|
every(fn, thisArg) {
|
|
701
|
-
return apply(this, "every", fn, thisArg);
|
|
751
|
+
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
702
752
|
},
|
|
703
753
|
filter(fn, thisArg) {
|
|
704
|
-
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
|
|
754
|
+
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
|
|
705
755
|
},
|
|
706
756
|
find(fn, thisArg) {
|
|
707
|
-
return apply(this, "find", fn, thisArg, toReactive);
|
|
757
|
+
return apply(this, "find", fn, thisArg, toReactive, arguments);
|
|
708
758
|
},
|
|
709
759
|
findIndex(fn, thisArg) {
|
|
710
|
-
return apply(this, "findIndex", fn, thisArg);
|
|
760
|
+
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
711
761
|
},
|
|
712
762
|
findLast(fn, thisArg) {
|
|
713
|
-
return apply(this, "findLast", fn, thisArg, toReactive);
|
|
763
|
+
return apply(this, "findLast", fn, thisArg, toReactive, arguments);
|
|
714
764
|
},
|
|
715
765
|
findLastIndex(fn, thisArg) {
|
|
716
|
-
return apply(this, "findLastIndex", fn, thisArg);
|
|
766
|
+
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
717
767
|
},
|
|
718
768
|
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
719
769
|
forEach(fn, thisArg) {
|
|
720
|
-
return apply(this, "forEach", fn, thisArg);
|
|
770
|
+
return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
|
721
771
|
},
|
|
722
772
|
includes(...args) {
|
|
723
773
|
return searchProxy(this, "includes", args);
|
|
@@ -733,7 +783,7 @@ const arrayInstrumentations = {
|
|
|
733
783
|
return searchProxy(this, "lastIndexOf", args);
|
|
734
784
|
},
|
|
735
785
|
map(fn, thisArg) {
|
|
736
|
-
return apply(this, "map", fn, thisArg);
|
|
786
|
+
return apply(this, "map", fn, thisArg, void 0, arguments);
|
|
737
787
|
},
|
|
738
788
|
pop() {
|
|
739
789
|
return noTracking(this, "pop");
|
|
@@ -752,7 +802,7 @@ const arrayInstrumentations = {
|
|
|
752
802
|
},
|
|
753
803
|
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
754
804
|
some(fn, thisArg) {
|
|
755
|
-
return apply(this, "some", fn, thisArg);
|
|
805
|
+
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
756
806
|
},
|
|
757
807
|
splice(...args) {
|
|
758
808
|
return noTracking(this, "splice", args);
|
|
@@ -788,8 +838,13 @@ function iterator(self, method, wrapValue) {
|
|
|
788
838
|
}
|
|
789
839
|
return iter;
|
|
790
840
|
}
|
|
791
|
-
|
|
841
|
+
const arrayProto = Array.prototype;
|
|
842
|
+
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
792
843
|
const arr = shallowReadArray(self);
|
|
844
|
+
let methodFn;
|
|
845
|
+
if ((methodFn = arr[method]) !== arrayProto[method]) {
|
|
846
|
+
return methodFn.apply(arr, args);
|
|
847
|
+
}
|
|
793
848
|
let needsWrap = false;
|
|
794
849
|
let wrappedFn = fn;
|
|
795
850
|
if (arr !== self) {
|
|
@@ -804,7 +859,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn) {
|
|
|
804
859
|
};
|
|
805
860
|
}
|
|
806
861
|
}
|
|
807
|
-
const result = arr
|
|
862
|
+
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
808
863
|
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
809
864
|
}
|
|
810
865
|
function reduce(self, method, fn, args) {
|
|
@@ -867,7 +922,7 @@ class BaseReactiveHandler {
|
|
|
867
922
|
return isShallow2;
|
|
868
923
|
} else if (key === "__v_raw") {
|
|
869
924
|
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
870
|
-
// this means the
|
|
925
|
+
// this means the receiver is a user proxy of the reactive proxy
|
|
871
926
|
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
872
927
|
return target;
|
|
873
928
|
}
|
|
@@ -991,9 +1046,7 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
|
991
1046
|
}
|
|
992
1047
|
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
993
1048
|
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
994
|
-
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
995
|
-
true
|
|
996
|
-
);
|
|
1049
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
|
|
997
1050
|
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
998
1051
|
|
|
999
1052
|
const toShallow = (value) => value;
|
|
@@ -1488,13 +1541,14 @@ function proxyRefs(objectWithRefs) {
|
|
|
1488
1541
|
class CustomRefImpl {
|
|
1489
1542
|
constructor(factory) {
|
|
1490
1543
|
this["__v_isRef"] = true;
|
|
1544
|
+
this._value = void 0;
|
|
1491
1545
|
const dep = this.dep = new Dep();
|
|
1492
1546
|
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1493
1547
|
this._get = get;
|
|
1494
1548
|
this._set = set;
|
|
1495
1549
|
}
|
|
1496
1550
|
get value() {
|
|
1497
|
-
return this._get();
|
|
1551
|
+
return this._value = this._get();
|
|
1498
1552
|
}
|
|
1499
1553
|
set value(newVal) {
|
|
1500
1554
|
this._set(newVal);
|
|
@@ -1519,10 +1573,11 @@ class ObjectRefImpl {
|
|
|
1519
1573
|
this._key = _key;
|
|
1520
1574
|
this._defaultValue = _defaultValue;
|
|
1521
1575
|
this["__v_isRef"] = true;
|
|
1576
|
+
this._value = void 0;
|
|
1522
1577
|
}
|
|
1523
1578
|
get value() {
|
|
1524
1579
|
const val = this._object[this._key];
|
|
1525
|
-
return val === void 0 ? this._defaultValue : val;
|
|
1580
|
+
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1526
1581
|
}
|
|
1527
1582
|
set value(newVal) {
|
|
1528
1583
|
this._object[this._key] = newVal;
|
|
@@ -1536,9 +1591,10 @@ class GetterRefImpl {
|
|
|
1536
1591
|
this._getter = _getter;
|
|
1537
1592
|
this["__v_isRef"] = true;
|
|
1538
1593
|
this["__v_isReadonly"] = true;
|
|
1594
|
+
this._value = void 0;
|
|
1539
1595
|
}
|
|
1540
1596
|
get value() {
|
|
1541
|
-
return this._getter();
|
|
1597
|
+
return this._value = this._getter();
|
|
1542
1598
|
}
|
|
1543
1599
|
}
|
|
1544
1600
|
function toRef(source, key, defaultValue) {
|
|
@@ -1572,7 +1628,8 @@ class ComputedRefImpl {
|
|
|
1572
1628
|
/**
|
|
1573
1629
|
* @internal
|
|
1574
1630
|
*/
|
|
1575
|
-
this
|
|
1631
|
+
this.__v_isRef = true;
|
|
1632
|
+
// TODO isolatedDeclarations "__v_isReadonly"
|
|
1576
1633
|
// A computed is also a subscriber that tracks other deps
|
|
1577
1634
|
/**
|
|
1578
1635
|
* @internal
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.5.0-
|
|
2
|
+
* @vue/reactivity v3.5.0-beta.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
|
-
**//*! #__NO_SIDE_EFFECTS__ */let e,t,i;let r=Object.assign,s=Object.prototype.hasOwnProperty,n=(e,t)=>s.call(e,t),l=Array.isArray,a=e=>"[object Map]"===p(e),o=e=>"function"==typeof e,u=e=>"string"==typeof e,c=e=>"symbol"==typeof e,h=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,p=e=>f.call(e),d=e=>p(e).slice(8,-1),_=e=>u(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,v=(e,t)=>!Object.is(e,t),g=(e,t,i,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:i})};class y{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=e,!t&&e&&(this.index=(e.scopes||(e.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){let i=e;try{return e=this,t()}finally{e=i}}}on(){e=this}off(){e=this.parent}stop(e){if(this._active){let t,i;for(t=0,i=this.effects.length;t<i;t++)this.effects[t].stop();for(t=0,i=this.cleanups.length;t<i;t++)this.cleanups[t]();if(this.scopes)for(t=0,i=this.scopes.length;t<i;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0,this._active=!1}}}function R(e){return new y(e)}function w(){return e}function b(t,i=!1){e&&e.cleanups.push(t)}let S={ACTIVE:1,1:"ACTIVE",RUNNING:2,2:"RUNNING",TRACKING:4,4:"TRACKING",NOTIFIED:8,8:"NOTIFIED",DIRTY:16,16:"DIRTY",ALLOW_RECURSE:32,32:"ALLOW_RECURSE",NO_BATCH:64,64:"NO_BATCH"};class x{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.nextEffect=void 0,this.cleanup=void 0,this.scheduler=void 0,e&&e.active&&e.effects.push(this)}notify(){if(!(2&this.flags)||32&this.flags){if(64&this.flags)return this.trigger();8&this.flags||(this.flags|=8,this.nextEffect=i,i=this)}}run(){if(!(1&this.flags))return this.fn();this.flags|=2,M(this),k(this);let e=t,i=j;t=this,j=!0;try{return this.fn()}finally{D(this),t=e,j=i,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)O(e);this.deps=this.depsTail=void 0,M(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){m(this)&&this.run()}get dirty(){return m(this)}}let E=0;function T(){let e;if(E>1){E--;return}for(;i;){let t=i;for(i=void 0;t;){let i=t.nextEffect;if(t.nextEffect=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=i}}if(E--,e)throw e}function k(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function D(e){let t;let i=e.depsTail;for(let e=i;e;e=e.prevDep)-1===e.version?(e===i&&(i=e.prevDep),O(e),function(e){let{prevDep:t,nextDep:i}=e;t&&(t.nextDep=i,e.prevDep=void 0),i&&(i.prevDep=t,e.nextDep=void 0)}(e)):t=e,e.dep.activeLink=e.prevActiveLink,e.prevActiveLink=void 0;e.deps=t,e.depsTail=i}function m(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&!1===A(t.dep.computed)||t.dep.version!==t.version)return!0;return!!e._dirty}function A(e){if(2&e.flags)return!1;if(4&e.flags&&!(16&e.flags)||(e.flags&=-17,e.globalVersion===K))return;e.globalVersion=K;let i=e.dep;if(e.flags|=2,i.version>0&&!e.isSSR&&!m(e)){e.flags&=-3;return}let r=t,s=j;t=e,j=!0;try{k(e);let t=e.fn();(0===i.version||v(t,e._value))&&(e._value=t,i.version++)}catch(e){throw i.version++,e}finally{t=r,j=s,D(e),e.flags&=-3}}function O(e){let{dep:t,prevSub:i,nextSub:r}=e;if(i&&(i.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=i,e.nextSub=void 0),t.subs===e&&(t.subs=i),!t.subs&&t.computed){t.computed.flags&=-5;for(let e=t.computed.deps;e;e=e.nextDep)O(e)}}function I(e,t){e.effect instanceof x&&(e=e.effect.fn);let i=new x(e);t&&r(i,t);try{i.run()}catch(e){throw i.stop(),e}let s=i.run.bind(i);return s.effect=i,s}function L(e){e.effect.stop()}let j=!0,N=[];function P(){N.push(j),j=!1}function V(){N.push(j),j=!0}function C(){let e=N.pop();j=void 0===e||e}function W(e,i=!1){t instanceof x&&(t.cleanup=e)}function M(e){let{cleanup:i}=e;if(e.cleanup=void 0,i){let e=t;t=void 0;try{i()}finally{t=e}}}let K=0;class Y{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0}track(e){if(!t||!j)return;let i=this.activeLink;if(void 0===i||i.sub!==t)i=this.activeLink={dep:this,sub:t,version:this.version,nextDep:void 0,prevDep:void 0,nextSub:void 0,prevSub:void 0,prevActiveLink:void 0},t.deps?(i.prevDep=t.depsTail,t.depsTail.nextDep=i,t.depsTail=i):t.deps=t.depsTail=i,4&t.flags&&function e(t){let i=t.dep.computed;if(i&&!t.dep.subs){i.flags|=20;for(let t=i.deps;t;t=t.nextDep)e(t)}let r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}(i);else if(-1===i.version&&(i.version=this.version,i.nextDep)){let e=i.nextDep;e.prevDep=i.prevDep,i.prevDep&&(i.prevDep.nextDep=e),i.prevDep=t.depsTail,i.nextDep=void 0,t.depsTail.nextDep=i,t.depsTail=i,t.deps===i&&(t.deps=e)}return i}trigger(e){this.version++,K++,this.notify(e)}notify(e){E++;try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()}finally{T()}}}let z=new WeakMap,F=Symbol(""),G=Symbol(""),H=Symbol("");function U(e,i,r){if(j&&t){let t=z.get(e);t||z.set(e,t=new Map);let i=t.get(r);i||t.set(r,i=new Y),i.track()}}function B(e,t,i,r,s,n){let o=z.get(e);if(!o){K++;return}let u=[];if("clear"===t)u=[...o.values()];else{let s=l(e),n=s&&_(i);if(s&&"length"===i){let e=Number(r);o.forEach((t,i)=>{("length"===i||i===H||!c(i)&&i>=e)&&u.push(t)})}else{let r=e=>e&&u.push(e);switch(void 0!==i&&r(o.get(i)),n&&r(o.get(H)),t){case"add":s?n&&r(o.get("length")):(r(o.get(F)),a(e)&&r(o.get(G)));break;case"delete":!s&&(r(o.get(F)),a(e)&&r(o.get(G)));break;case"set":a(e)&&r(o.get(F))}}}for(let e of(E++,u))e.trigger();T()}function q(e){let t=eU(e);return t===e?t:(U(t,"iterate",H),eG(e)?t:t.map(eq))}function J(e){return U(e=eU(e),"iterate",H),e}let Q={__proto__:null,[Symbol.iterator](){return X(this,Symbol.iterator,eq)},concat(...e){return q(this).concat(...e.map(e=>q(e)))},entries(){return X(this,"entries",e=>(e[1]=eq(e[1]),e))},every(e,t){return Z(this,"every",e,t)},filter(e,t){return Z(this,"filter",e,t,e=>e.map(eq))},find(e,t){return Z(this,"find",e,t,eq)},findIndex(e,t){return Z(this,"findIndex",e,t)},findLast(e,t){return Z(this,"findLast",e,t,eq)},findLastIndex(e,t){return Z(this,"findLastIndex",e,t)},forEach(e,t){return Z(this,"forEach",e,t)},includes(...e){return ee(this,"includes",e)},indexOf(...e){return ee(this,"indexOf",e)},join(e){return q(this).join(e)},lastIndexOf(...e){return ee(this,"lastIndexOf",e)},map(e,t){return Z(this,"map",e,t)},pop(){return et(this,"pop")},push(...e){return et(this,"push",e)},reduce(e,...t){return $(this,"reduce",e,t)},reduceRight(e,...t){return $(this,"reduceRight",e,t)},shift(){return et(this,"shift")},some(e,t){return Z(this,"some",e,t)},splice(...e){return et(this,"splice",e)},toReversed(){return q(this).toReversed()},toSorted(e){return q(this).toSorted(e)},toSpliced(...e){return q(this).toSpliced(...e)},unshift(...e){return et(this,"unshift",e)},values(){return X(this,"values",eq)}};function X(e,t,i){let r=J(e),s=r[t]();return r===e||eG(e)||(s._next=s.next,s.next=()=>{let e=s._next();return e.value&&(e.value=i(e.value)),e}),s}function Z(e,t,i,r,s){let n=J(e),l=!1,a=i;n!==e&&((l=!eG(e))?a=function(t,r){return i.call(this,eq(t),r,e)}:i.length>2&&(a=function(t,r){return i.call(this,t,r,e)}));let o=n[t](a,r);return l&&s?s(o):o}function $(e,t,i,r){let s=J(e),n=i;return s!==e&&(eG(e)?i.length>3&&(n=function(t,r,s){return i.call(this,t,r,s,e)}):n=function(t,r,s){return i.call(this,t,eq(r),s,e)}),s[t](n,...r)}function ee(e,t,i){let r=eU(e);U(r,"iterate",H);let s=r[t](...i);return(-1===s||!1===s)&&eH(i[0])?(i[0]=eU(i[0]),r[t](...i)):s}function et(e,t,i=[]){P(),E++;let r=eU(e)[t].apply(e,i);return T(),C(),r}let ei=function(e,t){let i=new Set(e.split(","));return e=>i.has(e)}("__proto__,__v_isRef,__isVue"),er=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(c));function es(e){c(e)||(e=String(e));let t=eU(this);return U(t,"has",e),t.hasOwnProperty(e)}class en{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){let r=this._isReadonly,s=this._isShallow;if("__v_isReactive"===t)return!r;if("__v_isReadonly"===t)return r;if("__v_isShallow"===t)return s;if("__v_raw"===t)return i===(r?s?eV:eP:s?eN:ej).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;let n=l(e);if(!r){let e;if(n&&(e=Q[t]))return e;if("hasOwnProperty"===t)return es}let a=Reflect.get(e,t,eQ(e)?e:i);return(c(t)?er.has(t):ei(t))?a:(r||U(e,"get",t),s)?a:eQ(a)?n&&_(t)?a:a.value:h(a)?r?eM(a):eC(a):a}}class el extends en{constructor(e=!1){super(!1,e)}set(e,t,i,r){let s=e[t];if(!this._isShallow){let t=eF(s);if(eG(i)||eF(i)||(s=eU(s),i=eU(i)),!l(e)&&eQ(s)&&!eQ(i))return!t&&(s.value=i,!0)}let a=l(e)&&_(t)?Number(t)<e.length:n(e,t),o=Reflect.set(e,t,i,r);return e===eU(r)&&(a?v(i,s)&&B(e,"set",t,i):B(e,"add",t,i)),o}deleteProperty(e,t){let i=n(e,t);e[t];let r=Reflect.deleteProperty(e,t);return r&&i&&B(e,"delete",t,void 0),r}has(e,t){let i=Reflect.has(e,t);return c(t)&&er.has(t)||U(e,"has",t),i}ownKeys(e){return U(e,"iterate",l(e)?"length":F),Reflect.ownKeys(e)}}class ea extends en{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}let eo=new el,eu=new ea,ec=new el(!0),eh=new ea(!0),ef=e=>e,ep=e=>Reflect.getPrototypeOf(e);function ed(e,t,i=!1,r=!1){let s=eU(e=e.__v_raw),n=eU(t);i||(v(t,n)&&U(s,"get",t),U(s,"get",n));let{has:l}=ep(s),a=r?ef:i?eJ:eq;return l.call(s,t)?a(e.get(t)):l.call(s,n)?a(e.get(n)):void(e!==s&&e.get(t))}function e_(e,t=!1){let i=this.__v_raw,r=eU(i),s=eU(e);return t||(v(e,s)&&U(r,"has",e),U(r,"has",s)),e===s?i.has(e):i.has(e)||i.has(s)}function ev(e,t=!1){return e=e.__v_raw,t||U(eU(e),"iterate",F),Reflect.get(e,"size",e)}function eg(e,t=!1){t||eG(e)||eF(e)||(e=eU(e));let i=eU(this);return ep(i).has.call(i,e)||(i.add(e),B(i,"add",e,e)),this}function ey(e,t,i=!1){i||eG(t)||eF(t)||(t=eU(t));let r=eU(this),{has:s,get:n}=ep(r),l=s.call(r,e);l||(e=eU(e),l=s.call(r,e));let a=n.call(r,e);return r.set(e,t),l?v(t,a)&&B(r,"set",e,t):B(r,"add",e,t),this}function eR(e){let t=eU(this),{has:i,get:r}=ep(t),s=i.call(t,e);s||(e=eU(e),s=i.call(t,e)),r&&r.call(t,e);let n=t.delete(e);return s&&B(t,"delete",e,void 0),n}function ew(){let e=eU(this),t=0!==e.size,i=e.clear();return t&&B(e,"clear",void 0,void 0),i}function eb(e,t){return function(i,r){let s=this,n=s.__v_raw,l=eU(n),a=t?ef:e?eJ:eq;return e||U(l,"iterate",F),n.forEach((e,t)=>i.call(r,a(e),a(t),s))}}function eS(e,t,i){return function(...r){let s=this.__v_raw,n=eU(s),l=a(n),o="entries"===e||e===Symbol.iterator&&l,u=s[e](...r),c=i?ef:t?eJ:eq;return t||U(n,"iterate","keys"===e&&l?G:F),{next(){let{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:o?[c(e[0]),c(e[1])]:c(e),done:t}},[Symbol.iterator](){return this}}}}function ex(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}let[eE,eT,ek,eD]=function(){let e={get(e){return ed(this,e)},get size(){return ev(this)},has:e_,add:eg,set:ey,delete:eR,clear:ew,forEach:eb(!1,!1)},t={get(e){return ed(this,e,!1,!0)},get size(){return ev(this)},has:e_,add(e){return eg.call(this,e,!0)},set(e,t){return ey.call(this,e,t,!0)},delete:eR,clear:ew,forEach:eb(!1,!0)},i={get(e){return ed(this,e,!0)},get size(){return ev(this,!0)},has(e){return e_.call(this,e,!0)},add:ex("add"),set:ex("set"),delete:ex("delete"),clear:ex("clear"),forEach:eb(!0,!1)},r={get(e){return ed(this,e,!0,!0)},get size(){return ev(this,!0)},has(e){return e_.call(this,e,!0)},add:ex("add"),set:ex("set"),delete:ex("delete"),clear:ex("clear"),forEach:eb(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{e[s]=eS(s,!1,!1),i[s]=eS(s,!0,!1),t[s]=eS(s,!1,!0),r[s]=eS(s,!0,!0)}),[e,i,t,r]}();function em(e,t){let i=t?e?eD:ek:e?eT:eE;return(t,r,s)=>"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(n(i,r)&&r in t?i:t,r,s)}let eA={get:em(!1,!1)},eO={get:em(!1,!0)},eI={get:em(!0,!1)},eL={get:em(!0,!0)},ej=new WeakMap,eN=new WeakMap,eP=new WeakMap,eV=new WeakMap;function eC(e){return eF(e)?e:eY(e,!1,eo,eA,ej)}function eW(e){return eY(e,!1,ec,eO,eN)}function eM(e){return eY(e,!0,eu,eI,eP)}function eK(e){return eY(e,!0,eh,eL,eV)}function eY(e,t,i,r,s){if(!h(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let n=s.get(e);if(n)return n;let l=e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(d(e));if(0===l)return e;let a=new Proxy(e,2===l?r:i);return s.set(e,a),a}function ez(e){return eF(e)?ez(e.__v_raw):!!(e&&e.__v_isReactive)}function eF(e){return!!(e&&e.__v_isReadonly)}function eG(e){return!!(e&&e.__v_isShallow)}function eH(e){return!!e&&!!e.__v_raw}function eU(e){let t=e&&e.__v_raw;return t?eU(t):e}function eB(e){return Object.isExtensible(e)&&g(e,"__v_skip",!0),e}let eq=e=>h(e)?eC(e):e,eJ=e=>h(e)?eM(e):e;function eQ(e){return!!e&&!0===e.__v_isRef}function eX(e){return e$(e,!1)}function eZ(e){return e$(e,!0)}function e$(e,t){return eQ(e)?e:new e0(e,t)}class e0{constructor(e,t){this.dep=new Y,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:eU(e),this._value=t?e:eq(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,i=this.__v_isShallow||eG(e)||eF(e);v(e=i?e:eU(e),t)&&(this._rawValue=e,this._value=i?e:eq(e),this.dep.trigger())}}function e1(e){e.dep.trigger()}function e2(e){return eQ(e)?e.value:e}function e6(e){return o(e)?e():e2(e)}let e3={get:(e,t,i)=>e2(Reflect.get(e,t,i)),set:(e,t,i,r)=>{let s=e[t];return eQ(s)&&!eQ(i)?(s.value=i,!0):Reflect.set(e,t,i,r)}};function e4(e){return ez(e)?e:new Proxy(e,e3)}class e8{constructor(e){this.__v_isRef=!0;let t=this.dep=new Y,{get:i,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=i,this._set=r}get value(){return this._get()}set value(e){this._set(e)}}function e5(e){return new e8(e)}function e7(e){let t=l(e)?Array(e.length):{};for(let i in e)t[i]=ti(e,i);return t}class e9{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0}get value(){let e=this._object[this._key];return void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){var e,t,i;return e=eU(this._object),t=this._key,null==(i=z.get(e))?void 0:i.get(t)}}class te{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function tt(e,t,i){return eQ(e)?e:o(e)?new te(e):h(e)&&arguments.length>1?ti(e,t,i):eX(e)}function ti(e,t,i){let r=e[t];return eQ(r)?r:new e9(e,t,i)}class tr{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Y(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=K-1,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){t!==this&&(this.flags|=16,this.dep.notify())}get value(){let e=this.dep.track();return A(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function ts(e,t,i=!1){let r,s;return o(e)?r=e:(r=e.get,s=e.set),new tr(r,s,i)}let tn={GET:"get",HAS:"has",ITERATE:"iterate"},tl={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},ta={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw",IS_REF:"__v_isRef"};export{H as ARRAY_ITERATE_KEY,S as EffectFlags,y as EffectScope,F as ITERATE_KEY,G as MAP_KEY_ITERATE_KEY,x as ReactiveEffect,ta as ReactiveFlags,tn as TrackOpTypes,tl as TriggerOpTypes,ts as computed,e5 as customRef,I as effect,R as effectScope,V as enableTracking,w as getCurrentScope,eH as isProxy,ez as isReactive,eF as isReadonly,eQ as isRef,eG as isShallow,eB as markRaw,W as onEffectCleanup,b as onScopeDispose,P as pauseTracking,e4 as proxyRefs,eC as reactive,q as reactiveReadArray,eM as readonly,eX as ref,C as resetTracking,eW as shallowReactive,J as shallowReadArray,eK as shallowReadonly,eZ as shallowRef,L as stop,eU as toRaw,eq as toReactive,eJ as toReadonly,tt as toRef,e7 as toRefs,e6 as toValue,U as track,B as trigger,e1 as triggerRef,e2 as unref};
|
|
5
|
+
**//*! #__NO_SIDE_EFFECTS__ */let e,t,i;let s=Object.assign,r=Object.prototype.hasOwnProperty,n=(e,t)=>r.call(e,t),l=Array.isArray,a=e=>"[object Map]"===p(e),o=e=>"function"==typeof e,u=e=>"string"==typeof e,h=e=>"symbol"==typeof e,c=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,p=e=>f.call(e),d=e=>p(e).slice(8,-1),v=e=>u(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,_=(e,t)=>!Object.is(e,t),g=(e,t,i,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:i})};class y{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=e,!t&&e&&(this.index=(e.scopes||(e.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){if(this._isPaused=!0,this.scopes)for(let e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(let e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){if(this._isPaused=!1,this.scopes)for(let e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(let e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(t){if(this._active){let i=e;try{return e=this,t()}finally{e=i}}}on(){e=this}off(){e=this.parent}stop(e){if(this._active){let t,i;for(t=0,i=this.effects.length;t<i;t++)this.effects[t].stop();for(t=0,i=this.cleanups.length;t<i;t++)this.cleanups[t]();if(this.scopes)for(t=0,i=this.scopes.length;t<i;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0,this._active=!1}}}function R(e){return new y(e)}function w(){return e}function b(t,i=!1){e&&e.cleanups.push(t)}let S={ACTIVE:1,1:"ACTIVE",RUNNING:2,2:"RUNNING",TRACKING:4,4:"TRACKING",NOTIFIED:8,8:"NOTIFIED",DIRTY:16,16:"DIRTY",ALLOW_RECURSE:32,32:"ALLOW_RECURSE",PAUSED:64,64:"PAUSED"},E=new WeakSet;class x{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.nextEffect=void 0,this.cleanup=void 0,this.scheduler=void 0,e&&e.active&&e.effects.push(this)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,E.has(this)&&(E.delete(this),this.trigger()))}notify(){(!(2&this.flags)||32&this.flags)&&(8&this.flags||(this.flags|=8,this.nextEffect=i,i=this))}run(){if(!(1&this.flags))return this.fn();this.flags|=2,K(this),m(this);let e=t,i=j;t=this,j=!0;try{return this.fn()}finally{D(this),t=e,j=i,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)O(e);this.deps=this.depsTail=void 0,K(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?E.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){A(this)&&this.run()}get dirty(){return A(this)}}let k=0;function T(){let e;if(k>1){k--;return}for(k--;i;){let t=i;for(i=void 0;t;){let i=t.nextEffect;if(t.nextEffect=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=i}}if(e)throw e}function m(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function D(e){let t;let i=e.depsTail;for(let e=i;e;e=e.prevDep)-1===e.version?(e===i&&(i=e.prevDep),O(e),function(e){let{prevDep:t,nextDep:i}=e;t&&(t.nextDep=i,e.prevDep=void 0),i&&(i.prevDep=t,e.nextDep=void 0)}(e)):t=e,e.dep.activeLink=e.prevActiveLink,e.prevActiveLink=void 0;e.deps=t,e.depsTail=i}function A(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&!1===I(t.dep.computed)||t.dep.version!==t.version)return!0;return!!e._dirty}function I(e){if(2&e.flags)return!1;if(4&e.flags&&!(16&e.flags)||(e.flags&=-17,e.globalVersion===Y))return;e.globalVersion=Y;let i=e.dep;if(e.flags|=2,i.version>0&&!e.isSSR&&!A(e)){e.flags&=-3;return}let s=t,r=j;t=e,j=!0;try{m(e);let t=e.fn();(0===i.version||_(t,e._value))&&(e._value=t,i.version++)}catch(e){throw i.version++,e}finally{t=s,j=r,D(e),e.flags&=-3}}function O(e){let{dep:t,prevSub:i,nextSub:s}=e;if(i&&(i.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=i,e.nextSub=void 0),t.subs===e&&(t.subs=i),!t.subs&&t.computed){t.computed.flags&=-5;for(let e=t.computed.deps;e;e=e.nextDep)O(e)}}function L(e,t){e.effect instanceof x&&(e=e.effect.fn);let i=new x(e);t&&s(i,t);try{i.run()}catch(e){throw i.stop(),e}let r=i.run.bind(i);return r.effect=i,r}function P(e){e.effect.stop()}let j=!0,N=[];function V(){N.push(j),j=!1}function W(){N.push(j),j=!0}function C(){let e=N.pop();j=void 0===e||e}function M(e,i=!1){t instanceof x&&(t.cleanup=e)}function K(e){let{cleanup:i}=e;if(e.cleanup=void 0,i){let e=t;t=void 0;try{i()}finally{t=e}}}let Y=0;class z{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0}track(e){if(!t||!j)return;let i=this.activeLink;if(void 0===i||i.sub!==t)i=this.activeLink={dep:this,sub:t,version:this.version,nextDep:void 0,prevDep:void 0,nextSub:void 0,prevSub:void 0,prevActiveLink:void 0},t.deps?(i.prevDep=t.depsTail,t.depsTail.nextDep=i,t.depsTail=i):t.deps=t.depsTail=i,4&t.flags&&function e(t){let i=t.dep.computed;if(i&&!t.dep.subs){i.flags|=20;for(let t=i.deps;t;t=t.nextDep)e(t)}let s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}(i);else if(-1===i.version&&(i.version=this.version,i.nextDep)){let e=i.nextDep;e.prevDep=i.prevDep,i.prevDep&&(i.prevDep.nextDep=e),i.prevDep=t.depsTail,i.nextDep=void 0,t.depsTail.nextDep=i,t.depsTail=i,t.deps===i&&(t.deps=e)}return i}trigger(e){this.version++,Y++,this.notify(e)}notify(e){k++;try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()}finally{T()}}}let U=new WeakMap,F=Symbol(""),G=Symbol(""),H=Symbol("");function q(e,i,s){if(j&&t){let t=U.get(e);t||U.set(e,t=new Map);let i=t.get(s);i||t.set(s,i=new z),i.track()}}function B(e,t,i,s,r,n){let o=U.get(e);if(!o){Y++;return}let u=[];if("clear"===t)u=[...o.values()];else{let r=l(e),n=r&&v(i);if(r&&"length"===i){let e=Number(s);o.forEach((t,i)=>{("length"===i||i===H||!h(i)&&i>=e)&&u.push(t)})}else{let s=e=>e&&u.push(e);switch(void 0!==i&&s(o.get(i)),n&&s(o.get(H)),t){case"add":r?n&&s(o.get("length")):(s(o.get(F)),a(e)&&s(o.get(G)));break;case"delete":!r&&(s(o.get(F)),a(e)&&s(o.get(G)));break;case"set":a(e)&&s(o.get(F))}}}for(let e of(k++,u))e.trigger();T()}function J(e){let t=eB(e);return t===e?t:(q(t,"iterate",H),eH(e)?t:t.map(eQ))}function Q(e){return q(e=eB(e),"iterate",H),e}let X={__proto__:null,[Symbol.iterator](){return Z(this,Symbol.iterator,eQ)},concat(...e){return J(this).concat(...e.map(e=>J(e)))},entries(){return Z(this,"entries",e=>(e[1]=eQ(e[1]),e))},every(e,t){return ee(this,"every",e,t,void 0,arguments)},filter(e,t){return ee(this,"filter",e,t,e=>e.map(eQ),arguments)},find(e,t){return ee(this,"find",e,t,eQ,arguments)},findIndex(e,t){return ee(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ee(this,"findLast",e,t,eQ,arguments)},findLastIndex(e,t){return ee(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ee(this,"forEach",e,t,void 0,arguments)},includes(...e){return ei(this,"includes",e)},indexOf(...e){return ei(this,"indexOf",e)},join(e){return J(this).join(e)},lastIndexOf(...e){return ei(this,"lastIndexOf",e)},map(e,t){return ee(this,"map",e,t,void 0,arguments)},pop(){return es(this,"pop")},push(...e){return es(this,"push",e)},reduce(e,...t){return et(this,"reduce",e,t)},reduceRight(e,...t){return et(this,"reduceRight",e,t)},shift(){return es(this,"shift")},some(e,t){return ee(this,"some",e,t,void 0,arguments)},splice(...e){return es(this,"splice",e)},toReversed(){return J(this).toReversed()},toSorted(e){return J(this).toSorted(e)},toSpliced(...e){return J(this).toSpliced(...e)},unshift(...e){return es(this,"unshift",e)},values(){return Z(this,"values",eQ)}};function Z(e,t,i){let s=Q(e),r=s[t]();return s===e||eH(e)||(r._next=r.next,r.next=()=>{let e=r._next();return e.value&&(e.value=i(e.value)),e}),r}let $=Array.prototype;function ee(e,t,i,s,r,n){let l;let a=Q(e);if((l=a[t])!==$[t])return l.apply(a,n);let o=!1,u=i;a!==e&&((o=!eH(e))?u=function(t,s){return i.call(this,eQ(t),s,e)}:i.length>2&&(u=function(t,s){return i.call(this,t,s,e)}));let h=l.call(a,u,s);return o&&r?r(h):h}function et(e,t,i,s){let r=Q(e),n=i;return r!==e&&(eH(e)?i.length>3&&(n=function(t,s,r){return i.call(this,t,s,r,e)}):n=function(t,s,r){return i.call(this,t,eQ(s),r,e)}),r[t](n,...s)}function ei(e,t,i){let s=eB(e);q(s,"iterate",H);let r=s[t](...i);return(-1===r||!1===r)&&eq(i[0])?(i[0]=eB(i[0]),s[t](...i)):r}function es(e,t,i=[]){V(),k++;let s=eB(e)[t].apply(e,i);return T(),C(),s}let er=function(e,t){let i=new Set(e.split(","));return e=>i.has(e)}("__proto__,__v_isRef,__isVue"),en=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(h));function el(e){h(e)||(e=String(e));let t=eB(this);return q(t,"has",e),t.hasOwnProperty(e)}class ea{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){let s=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!s;if("__v_isReadonly"===t)return s;if("__v_isShallow"===t)return r;if("__v_raw"===t)return i===(s?r?eC:eW:r?eV:eN).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;let n=l(e);if(!s){let e;if(n&&(e=X[t]))return e;if("hasOwnProperty"===t)return el}let a=Reflect.get(e,t,eZ(e)?e:i);return(h(t)?en.has(t):er(t))?a:(s||q(e,"get",t),r)?a:eZ(a)?n&&v(t)?a:a.value:c(a)?s?eY(a):eM(a):a}}class eo extends ea{constructor(e=!1){super(!1,e)}set(e,t,i,s){let r=e[t];if(!this._isShallow){let t=eG(r);if(eH(i)||eG(i)||(r=eB(r),i=eB(i)),!l(e)&&eZ(r)&&!eZ(i))return!t&&(r.value=i,!0)}let a=l(e)&&v(t)?Number(t)<e.length:n(e,t),o=Reflect.set(e,t,i,s);return e===eB(s)&&(a?_(i,r)&&B(e,"set",t,i):B(e,"add",t,i)),o}deleteProperty(e,t){let i=n(e,t);e[t];let s=Reflect.deleteProperty(e,t);return s&&i&&B(e,"delete",t,void 0),s}has(e,t){let i=Reflect.has(e,t);return h(t)&&en.has(t)||q(e,"has",t),i}ownKeys(e){return q(e,"iterate",l(e)?"length":F),Reflect.ownKeys(e)}}class eu extends ea{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}let eh=new eo,ec=new eu,ef=new eo(!0),ep=new eu(!0),ed=e=>e,ev=e=>Reflect.getPrototypeOf(e);function e_(e,t,i=!1,s=!1){let r=eB(e=e.__v_raw),n=eB(t);i||(_(t,n)&&q(r,"get",t),q(r,"get",n));let{has:l}=ev(r),a=s?ed:i?eX:eQ;return l.call(r,t)?a(e.get(t)):l.call(r,n)?a(e.get(n)):void(e!==r&&e.get(t))}function eg(e,t=!1){let i=this.__v_raw,s=eB(i),r=eB(e);return t||(_(e,r)&&q(s,"has",e),q(s,"has",r)),e===r?i.has(e):i.has(e)||i.has(r)}function ey(e,t=!1){return e=e.__v_raw,t||q(eB(e),"iterate",F),Reflect.get(e,"size",e)}function eR(e,t=!1){t||eH(e)||eG(e)||(e=eB(e));let i=eB(this);return ev(i).has.call(i,e)||(i.add(e),B(i,"add",e,e)),this}function ew(e,t,i=!1){i||eH(t)||eG(t)||(t=eB(t));let s=eB(this),{has:r,get:n}=ev(s),l=r.call(s,e);l||(e=eB(e),l=r.call(s,e));let a=n.call(s,e);return s.set(e,t),l?_(t,a)&&B(s,"set",e,t):B(s,"add",e,t),this}function eb(e){let t=eB(this),{has:i,get:s}=ev(t),r=i.call(t,e);r||(e=eB(e),r=i.call(t,e)),s&&s.call(t,e);let n=t.delete(e);return r&&B(t,"delete",e,void 0),n}function eS(){let e=eB(this),t=0!==e.size,i=e.clear();return t&&B(e,"clear",void 0,void 0),i}function eE(e,t){return function(i,s){let r=this,n=r.__v_raw,l=eB(n),a=t?ed:e?eX:eQ;return e||q(l,"iterate",F),n.forEach((e,t)=>i.call(s,a(e),a(t),r))}}function ex(e,t,i){return function(...s){let r=this.__v_raw,n=eB(r),l=a(n),o="entries"===e||e===Symbol.iterator&&l,u=r[e](...s),h=i?ed:t?eX:eQ;return t||q(n,"iterate","keys"===e&&l?G:F),{next(){let{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:o?[h(e[0]),h(e[1])]:h(e),done:t}},[Symbol.iterator](){return this}}}}function ek(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}let[eT,em,eD,eA]=function(){let e={get(e){return e_(this,e)},get size(){return ey(this)},has:eg,add:eR,set:ew,delete:eb,clear:eS,forEach:eE(!1,!1)},t={get(e){return e_(this,e,!1,!0)},get size(){return ey(this)},has:eg,add(e){return eR.call(this,e,!0)},set(e,t){return ew.call(this,e,t,!0)},delete:eb,clear:eS,forEach:eE(!1,!0)},i={get(e){return e_(this,e,!0)},get size(){return ey(this,!0)},has(e){return eg.call(this,e,!0)},add:ek("add"),set:ek("set"),delete:ek("delete"),clear:ek("clear"),forEach:eE(!0,!1)},s={get(e){return e_(this,e,!0,!0)},get size(){return ey(this,!0)},has(e){return eg.call(this,e,!0)},add:ek("add"),set:ek("set"),delete:ek("delete"),clear:ek("clear"),forEach:eE(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=ex(r,!1,!1),i[r]=ex(r,!0,!1),t[r]=ex(r,!1,!0),s[r]=ex(r,!0,!0)}),[e,i,t,s]}();function eI(e,t){let i=t?e?eA:eD:e?em:eT;return(t,s,r)=>"__v_isReactive"===s?!e:"__v_isReadonly"===s?e:"__v_raw"===s?t:Reflect.get(n(i,s)&&s in t?i:t,s,r)}let eO={get:eI(!1,!1)},eL={get:eI(!1,!0)},eP={get:eI(!0,!1)},ej={get:eI(!0,!0)},eN=new WeakMap,eV=new WeakMap,eW=new WeakMap,eC=new WeakMap;function eM(e){return eG(e)?e:eU(e,!1,eh,eO,eN)}function eK(e){return eU(e,!1,ef,eL,eV)}function eY(e){return eU(e,!0,ec,eP,eW)}function ez(e){return eU(e,!0,ep,ej,eC)}function eU(e,t,i,s,r){if(!c(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let n=r.get(e);if(n)return n;let l=e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(d(e));if(0===l)return e;let a=new Proxy(e,2===l?s:i);return r.set(e,a),a}function eF(e){return eG(e)?eF(e.__v_raw):!!(e&&e.__v_isReactive)}function eG(e){return!!(e&&e.__v_isReadonly)}function eH(e){return!!(e&&e.__v_isShallow)}function eq(e){return!!e&&!!e.__v_raw}function eB(e){let t=e&&e.__v_raw;return t?eB(t):e}function eJ(e){return Object.isExtensible(e)&&g(e,"__v_skip",!0),e}let eQ=e=>c(e)?eM(e):e,eX=e=>c(e)?eY(e):e;function eZ(e){return!!e&&!0===e.__v_isRef}function e$(e){return e1(e,!1)}function e0(e){return e1(e,!0)}function e1(e,t){return eZ(e)?e:new e2(e,t)}class e2{constructor(e,t){this.dep=new z,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:eB(e),this._value=t?e:eQ(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,i=this.__v_isShallow||eH(e)||eG(e);_(e=i?e:eB(e),t)&&(this._rawValue=e,this._value=i?e:eQ(e),this.dep.trigger())}}function e6(e){e.dep.trigger()}function e4(e){return eZ(e)?e.value:e}function e3(e){return o(e)?e():e4(e)}let e8={get:(e,t,i)=>e4(Reflect.get(e,t,i)),set:(e,t,i,s)=>{let r=e[t];return eZ(r)&&!eZ(i)?(r.value=i,!0):Reflect.set(e,t,i,s)}};function e5(e){return eF(e)?e:new Proxy(e,e8)}class e7{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new z,{get:i,set:s}=e(t.track.bind(t),t.trigger.bind(t));this._get=i,this._set=s}get value(){return this._value=this._get()}set value(e){this._set(e)}}function e9(e){return new e7(e)}function te(e){let t=l(e)?Array(e.length):{};for(let i in e)t[i]=tr(e,i);return t}class tt{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0}get value(){let e=this._object[this._key];return this._value=void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){var e,t,i;return e=eB(this._object),t=this._key,null==(i=U.get(e))?void 0:i.get(t)}}class ti{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function ts(e,t,i){return eZ(e)?e:o(e)?new ti(e):c(e)&&arguments.length>1?tr(e,t,i):e$(e)}function tr(e,t,i){let s=e[t];return eZ(s)?s:new tt(e,t,i)}class tn{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new z(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Y-1,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){t!==this&&(this.flags|=16,this.dep.notify())}get value(){let e=this.dep.track();return I(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function tl(e,t,i=!1){let s,r;return o(e)?s=e:(s=e.get,r=e.set),new tn(s,r,i)}let ta={GET:"get",HAS:"has",ITERATE:"iterate"},to={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},tu={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw",IS_REF:"__v_isRef"};export{H as ARRAY_ITERATE_KEY,S as EffectFlags,y as EffectScope,F as ITERATE_KEY,G as MAP_KEY_ITERATE_KEY,x as ReactiveEffect,tu as ReactiveFlags,ta as TrackOpTypes,to as TriggerOpTypes,tl as computed,e9 as customRef,L as effect,R as effectScope,W as enableTracking,w as getCurrentScope,eq as isProxy,eF as isReactive,eG as isReadonly,eZ as isRef,eH as isShallow,eJ as markRaw,M as onEffectCleanup,b as onScopeDispose,V as pauseTracking,e5 as proxyRefs,eM as reactive,J as reactiveReadArray,eY as readonly,e$ as ref,C as resetTracking,eK as shallowReactive,Q as shallowReadArray,ez as shallowReadonly,e0 as shallowRef,P as stop,eB as toRaw,eQ as toReactive,eX as toReadonly,ts as toRef,te as toRefs,e3 as toValue,q as track,B as trigger,e6 as triggerRef,e4 as unref};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.5.0-
|
|
2
|
+
* @vue/reactivity v3.5.0-beta.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -25,6 +25,7 @@ class EffectScope {
|
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
this.cleanups = [];
|
|
28
|
+
this._isPaused = false;
|
|
28
29
|
this.parent = activeEffectScope;
|
|
29
30
|
if (!detached && activeEffectScope) {
|
|
30
31
|
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
|
@@ -35,6 +36,37 @@ class EffectScope {
|
|
|
35
36
|
get active() {
|
|
36
37
|
return this._active;
|
|
37
38
|
}
|
|
39
|
+
pause() {
|
|
40
|
+
if (this._active) {
|
|
41
|
+
this._isPaused = true;
|
|
42
|
+
if (this.scopes) {
|
|
43
|
+
for (let i = 0, l = this.scopes.length; i < l; i++) {
|
|
44
|
+
this.scopes[i].pause();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
for (let i = 0, l = this.effects.length; i < l; i++) {
|
|
48
|
+
this.effects[i].pause();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resumes the effect scope, including all child scopes and effects.
|
|
54
|
+
*/
|
|
55
|
+
resume() {
|
|
56
|
+
if (this._active) {
|
|
57
|
+
if (this._isPaused) {
|
|
58
|
+
this._isPaused = false;
|
|
59
|
+
if (this.scopes) {
|
|
60
|
+
for (let i = 0, l = this.scopes.length; i < l; i++) {
|
|
61
|
+
this.scopes[i].resume();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (let i = 0, l = this.effects.length; i < l; i++) {
|
|
65
|
+
this.effects[i].resume();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
38
70
|
run(fn) {
|
|
39
71
|
if (this._active) {
|
|
40
72
|
const currentEffectScope = activeEffectScope;
|
|
@@ -118,9 +150,10 @@ const EffectFlags = {
|
|
|
118
150
|
"16": "DIRTY",
|
|
119
151
|
"ALLOW_RECURSE": 32,
|
|
120
152
|
"32": "ALLOW_RECURSE",
|
|
121
|
-
"
|
|
122
|
-
"64": "
|
|
153
|
+
"PAUSED": 64,
|
|
154
|
+
"64": "PAUSED"
|
|
123
155
|
};
|
|
156
|
+
const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
|
|
124
157
|
class ReactiveEffect {
|
|
125
158
|
constructor(fn) {
|
|
126
159
|
this.fn = fn;
|
|
@@ -149,6 +182,18 @@ class ReactiveEffect {
|
|
|
149
182
|
activeEffectScope.effects.push(this);
|
|
150
183
|
}
|
|
151
184
|
}
|
|
185
|
+
pause() {
|
|
186
|
+
this.flags |= 64;
|
|
187
|
+
}
|
|
188
|
+
resume() {
|
|
189
|
+
if (this.flags & 64) {
|
|
190
|
+
this.flags &= ~64;
|
|
191
|
+
if (pausedQueueEffects.has(this)) {
|
|
192
|
+
pausedQueueEffects.delete(this);
|
|
193
|
+
this.trigger();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
152
197
|
/**
|
|
153
198
|
* @internal
|
|
154
199
|
*/
|
|
@@ -156,9 +201,6 @@ class ReactiveEffect {
|
|
|
156
201
|
if (this.flags & 2 && !(this.flags & 32)) {
|
|
157
202
|
return;
|
|
158
203
|
}
|
|
159
|
-
if (this.flags & 64) {
|
|
160
|
-
return this.trigger();
|
|
161
|
-
}
|
|
162
204
|
if (!(this.flags & 8)) {
|
|
163
205
|
this.flags |= 8;
|
|
164
206
|
this.nextEffect = batchedEffect;
|
|
@@ -202,7 +244,9 @@ class ReactiveEffect {
|
|
|
202
244
|
}
|
|
203
245
|
}
|
|
204
246
|
trigger() {
|
|
205
|
-
if (this.
|
|
247
|
+
if (this.flags & 64) {
|
|
248
|
+
pausedQueueEffects.add(this);
|
|
249
|
+
} else if (this.scheduler) {
|
|
206
250
|
this.scheduler();
|
|
207
251
|
} else {
|
|
208
252
|
this.runIfDirty();
|
|
@@ -230,6 +274,7 @@ function endBatch() {
|
|
|
230
274
|
batchDepth--;
|
|
231
275
|
return;
|
|
232
276
|
}
|
|
277
|
+
batchDepth--;
|
|
233
278
|
let error;
|
|
234
279
|
while (batchedEffect) {
|
|
235
280
|
let e = batchedEffect;
|
|
@@ -248,7 +293,6 @@ function endBatch() {
|
|
|
248
293
|
e = next;
|
|
249
294
|
}
|
|
250
295
|
}
|
|
251
|
-
batchDepth--;
|
|
252
296
|
if (error) throw error;
|
|
253
297
|
}
|
|
254
298
|
function prepareDeps(sub) {
|
|
@@ -535,9 +579,15 @@ function addSub(link) {
|
|
|
535
579
|
link.dep.subs = link;
|
|
536
580
|
}
|
|
537
581
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
538
|
-
const ITERATE_KEY = Symbol(
|
|
539
|
-
|
|
540
|
-
|
|
582
|
+
const ITERATE_KEY = Symbol(
|
|
583
|
+
!!(process.env.NODE_ENV !== "production") ? "Object iterate" : ""
|
|
584
|
+
);
|
|
585
|
+
const MAP_KEY_ITERATE_KEY = Symbol(
|
|
586
|
+
!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : ""
|
|
587
|
+
);
|
|
588
|
+
const ARRAY_ITERATE_KEY = Symbol(
|
|
589
|
+
!!(process.env.NODE_ENV !== "production") ? "Array iterate" : ""
|
|
590
|
+
);
|
|
541
591
|
function track(target, type, key) {
|
|
542
592
|
if (shouldTrack && activeSub) {
|
|
543
593
|
let depsMap = targetMap.get(target);
|
|
@@ -662,26 +712,26 @@ const arrayInstrumentations = {
|
|
|
662
712
|
});
|
|
663
713
|
},
|
|
664
714
|
every(fn, thisArg) {
|
|
665
|
-
return apply(this, "every", fn, thisArg);
|
|
715
|
+
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
666
716
|
},
|
|
667
717
|
filter(fn, thisArg) {
|
|
668
|
-
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
|
|
718
|
+
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
|
|
669
719
|
},
|
|
670
720
|
find(fn, thisArg) {
|
|
671
|
-
return apply(this, "find", fn, thisArg, toReactive);
|
|
721
|
+
return apply(this, "find", fn, thisArg, toReactive, arguments);
|
|
672
722
|
},
|
|
673
723
|
findIndex(fn, thisArg) {
|
|
674
|
-
return apply(this, "findIndex", fn, thisArg);
|
|
724
|
+
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
675
725
|
},
|
|
676
726
|
findLast(fn, thisArg) {
|
|
677
|
-
return apply(this, "findLast", fn, thisArg, toReactive);
|
|
727
|
+
return apply(this, "findLast", fn, thisArg, toReactive, arguments);
|
|
678
728
|
},
|
|
679
729
|
findLastIndex(fn, thisArg) {
|
|
680
|
-
return apply(this, "findLastIndex", fn, thisArg);
|
|
730
|
+
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
681
731
|
},
|
|
682
732
|
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
683
733
|
forEach(fn, thisArg) {
|
|
684
|
-
return apply(this, "forEach", fn, thisArg);
|
|
734
|
+
return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
|
685
735
|
},
|
|
686
736
|
includes(...args) {
|
|
687
737
|
return searchProxy(this, "includes", args);
|
|
@@ -697,7 +747,7 @@ const arrayInstrumentations = {
|
|
|
697
747
|
return searchProxy(this, "lastIndexOf", args);
|
|
698
748
|
},
|
|
699
749
|
map(fn, thisArg) {
|
|
700
|
-
return apply(this, "map", fn, thisArg);
|
|
750
|
+
return apply(this, "map", fn, thisArg, void 0, arguments);
|
|
701
751
|
},
|
|
702
752
|
pop() {
|
|
703
753
|
return noTracking(this, "pop");
|
|
@@ -716,7 +766,7 @@ const arrayInstrumentations = {
|
|
|
716
766
|
},
|
|
717
767
|
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
718
768
|
some(fn, thisArg) {
|
|
719
|
-
return apply(this, "some", fn, thisArg);
|
|
769
|
+
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
720
770
|
},
|
|
721
771
|
splice(...args) {
|
|
722
772
|
return noTracking(this, "splice", args);
|
|
@@ -752,8 +802,13 @@ function iterator(self, method, wrapValue) {
|
|
|
752
802
|
}
|
|
753
803
|
return iter;
|
|
754
804
|
}
|
|
755
|
-
|
|
805
|
+
const arrayProto = Array.prototype;
|
|
806
|
+
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
756
807
|
const arr = shallowReadArray(self);
|
|
808
|
+
let methodFn;
|
|
809
|
+
if ((methodFn = arr[method]) !== arrayProto[method]) {
|
|
810
|
+
return methodFn.apply(arr, args);
|
|
811
|
+
}
|
|
757
812
|
let needsWrap = false;
|
|
758
813
|
let wrappedFn = fn;
|
|
759
814
|
if (arr !== self) {
|
|
@@ -768,7 +823,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn) {
|
|
|
768
823
|
};
|
|
769
824
|
}
|
|
770
825
|
}
|
|
771
|
-
const result = arr
|
|
826
|
+
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
772
827
|
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
773
828
|
}
|
|
774
829
|
function reduce(self, method, fn, args) {
|
|
@@ -831,7 +886,7 @@ class BaseReactiveHandler {
|
|
|
831
886
|
return isShallow2;
|
|
832
887
|
} else if (key === "__v_raw") {
|
|
833
888
|
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
834
|
-
// this means the
|
|
889
|
+
// this means the receiver is a user proxy of the reactive proxy
|
|
835
890
|
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
836
891
|
return target;
|
|
837
892
|
}
|
|
@@ -955,9 +1010,7 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
|
955
1010
|
}
|
|
956
1011
|
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
957
1012
|
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
958
|
-
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
959
|
-
true
|
|
960
|
-
);
|
|
1013
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
|
|
961
1014
|
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
962
1015
|
|
|
963
1016
|
const toShallow = (value) => value;
|
|
@@ -1458,13 +1511,14 @@ function proxyRefs(objectWithRefs) {
|
|
|
1458
1511
|
class CustomRefImpl {
|
|
1459
1512
|
constructor(factory) {
|
|
1460
1513
|
this["__v_isRef"] = true;
|
|
1514
|
+
this._value = void 0;
|
|
1461
1515
|
const dep = this.dep = new Dep();
|
|
1462
1516
|
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1463
1517
|
this._get = get;
|
|
1464
1518
|
this._set = set;
|
|
1465
1519
|
}
|
|
1466
1520
|
get value() {
|
|
1467
|
-
return this._get();
|
|
1521
|
+
return this._value = this._get();
|
|
1468
1522
|
}
|
|
1469
1523
|
set value(newVal) {
|
|
1470
1524
|
this._set(newVal);
|
|
@@ -1489,10 +1543,11 @@ class ObjectRefImpl {
|
|
|
1489
1543
|
this._key = _key;
|
|
1490
1544
|
this._defaultValue = _defaultValue;
|
|
1491
1545
|
this["__v_isRef"] = true;
|
|
1546
|
+
this._value = void 0;
|
|
1492
1547
|
}
|
|
1493
1548
|
get value() {
|
|
1494
1549
|
const val = this._object[this._key];
|
|
1495
|
-
return val === void 0 ? this._defaultValue : val;
|
|
1550
|
+
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1496
1551
|
}
|
|
1497
1552
|
set value(newVal) {
|
|
1498
1553
|
this._object[this._key] = newVal;
|
|
@@ -1506,9 +1561,10 @@ class GetterRefImpl {
|
|
|
1506
1561
|
this._getter = _getter;
|
|
1507
1562
|
this["__v_isRef"] = true;
|
|
1508
1563
|
this["__v_isReadonly"] = true;
|
|
1564
|
+
this._value = void 0;
|
|
1509
1565
|
}
|
|
1510
1566
|
get value() {
|
|
1511
|
-
return this._getter();
|
|
1567
|
+
return this._value = this._getter();
|
|
1512
1568
|
}
|
|
1513
1569
|
}
|
|
1514
1570
|
function toRef(source, key, defaultValue) {
|
|
@@ -1542,7 +1598,8 @@ class ComputedRefImpl {
|
|
|
1542
1598
|
/**
|
|
1543
1599
|
* @internal
|
|
1544
1600
|
*/
|
|
1545
|
-
this
|
|
1601
|
+
this.__v_isRef = true;
|
|
1602
|
+
// TODO isolatedDeclarations "__v_isReadonly"
|
|
1546
1603
|
// A computed is also a subscriber that tracks other deps
|
|
1547
1604
|
/**
|
|
1548
1605
|
* @internal
|