@vue/reactivity 3.6.0-alpha.7 → 3.6.0-beta.10
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 +1778 -1881
- package/dist/reactivity.cjs.prod.js +1667 -1686
- package/dist/reactivity.d.ts +633 -633
- package/dist/reactivity.esm-browser.js +1812 -1895
- package/dist/reactivity.esm-browser.prod.js +5 -4
- package/dist/reactivity.esm-bundler.js +1776 -1889
- package/dist/reactivity.global.js +2049 -2135
- package/dist/reactivity.global.prod.js +5 -4
- package/package.json +2 -2
package/dist/reactivity.cjs.js
CHANGED
|
@@ -1,28 +1,70 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-
|
|
3
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
-
* @license MIT
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @vue/reactivity v3.6.0-beta.10
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
let _vue_shared = require("@vue/shared");
|
|
11
|
+
//#region packages/reactivity/src/debug.ts
|
|
12
|
+
const triggerEventInfos = [];
|
|
13
|
+
function onTrack(sub, debugInfo) {
|
|
14
|
+
if (sub.onTrack) sub.onTrack((0, _vue_shared.extend)({ effect: sub }, debugInfo));
|
|
15
|
+
}
|
|
16
|
+
function onTrigger(sub) {
|
|
17
|
+
if (sub.onTrigger) {
|
|
18
|
+
const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
|
|
19
|
+
sub.onTrigger((0, _vue_shared.extend)({ effect: sub }, debugInfo));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function setupOnTrigger(target) {
|
|
23
|
+
Object.defineProperty(target.prototype, "onTrigger", {
|
|
24
|
+
get() {
|
|
25
|
+
return this._onTrigger;
|
|
26
|
+
},
|
|
27
|
+
set(val) {
|
|
28
|
+
if (val && !this._onTrigger) setupFlagsHandler(this);
|
|
29
|
+
this._onTrigger = val;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function setupFlagsHandler(target) {
|
|
34
|
+
target._flags = target.flags;
|
|
35
|
+
Object.defineProperty(target, "flags", {
|
|
36
|
+
get() {
|
|
37
|
+
return target._flags;
|
|
38
|
+
},
|
|
39
|
+
set(value) {
|
|
40
|
+
if (!(target._flags & 48) && !!(value & 48)) onTrigger(this);
|
|
41
|
+
target._flags = value;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region packages/reactivity/src/warning.ts
|
|
12
47
|
function warn(msg, ...args) {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region packages/reactivity/src/system.ts
|
|
52
|
+
const ReactiveFlags$1 = {
|
|
53
|
+
"None": 0,
|
|
54
|
+
"0": "None",
|
|
55
|
+
"Mutable": 1,
|
|
56
|
+
"1": "Mutable",
|
|
57
|
+
"Watching": 2,
|
|
58
|
+
"2": "Watching",
|
|
59
|
+
"RecursedCheck": 4,
|
|
60
|
+
"4": "RecursedCheck",
|
|
61
|
+
"Recursed": 8,
|
|
62
|
+
"8": "Recursed",
|
|
63
|
+
"Dirty": 16,
|
|
64
|
+
"16": "Dirty",
|
|
65
|
+
"Pending": 32,
|
|
66
|
+
"32": "Pending"
|
|
67
|
+
};
|
|
26
68
|
const notifyBuffer = [];
|
|
27
69
|
let batchDepth = 0;
|
|
28
70
|
let activeSub = void 0;
|
|
@@ -30,2010 +72,1865 @@ let globalVersion = 0;
|
|
|
30
72
|
let notifyIndex = 0;
|
|
31
73
|
let notifyBufferLength = 0;
|
|
32
74
|
function setActiveSub(sub) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
75
|
+
try {
|
|
76
|
+
return activeSub;
|
|
77
|
+
} finally {
|
|
78
|
+
activeSub = sub;
|
|
79
|
+
}
|
|
38
80
|
}
|
|
39
81
|
function startBatch() {
|
|
40
|
-
|
|
82
|
+
++batchDepth;
|
|
41
83
|
}
|
|
42
84
|
function endBatch() {
|
|
43
|
-
|
|
44
|
-
flush();
|
|
45
|
-
}
|
|
85
|
+
if (!--batchDepth && notifyBufferLength) flush();
|
|
46
86
|
}
|
|
47
87
|
function link(dep, sub) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (flags & 1 /* Mutable */) {
|
|
142
|
-
const subSubs = sub.subs;
|
|
143
|
-
if (subSubs !== void 0) {
|
|
144
|
-
link2 = subSubs;
|
|
145
|
-
if (subSubs.nextSub !== void 0) {
|
|
146
|
-
stack = { value: next, prev: stack };
|
|
147
|
-
next = link2.nextSub;
|
|
148
|
-
}
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if ((link2 = next) !== void 0) {
|
|
154
|
-
next = link2.nextSub;
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
while (stack !== void 0) {
|
|
158
|
-
link2 = stack.value;
|
|
159
|
-
stack = stack.prev;
|
|
160
|
-
if (link2 !== void 0) {
|
|
161
|
-
next = link2.nextSub;
|
|
162
|
-
continue top;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
break;
|
|
166
|
-
} while (true);
|
|
88
|
+
const prevDep = sub.depsTail;
|
|
89
|
+
if (prevDep !== void 0 && prevDep.dep === dep) return;
|
|
90
|
+
const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
|
|
91
|
+
if (nextDep !== void 0 && nextDep.dep === dep) {
|
|
92
|
+
nextDep.version = globalVersion;
|
|
93
|
+
sub.depsTail = nextDep;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const prevSub = dep.subsTail;
|
|
97
|
+
if (prevSub !== void 0 && prevSub.version === globalVersion && prevSub.sub === sub) return;
|
|
98
|
+
const newLink = sub.depsTail = dep.subsTail = {
|
|
99
|
+
version: globalVersion,
|
|
100
|
+
dep,
|
|
101
|
+
sub,
|
|
102
|
+
prevDep,
|
|
103
|
+
nextDep,
|
|
104
|
+
prevSub,
|
|
105
|
+
nextSub: void 0
|
|
106
|
+
};
|
|
107
|
+
if (nextDep !== void 0) nextDep.prevDep = newLink;
|
|
108
|
+
if (prevDep !== void 0) prevDep.nextDep = newLink;
|
|
109
|
+
else sub.deps = newLink;
|
|
110
|
+
if (prevSub !== void 0) prevSub.nextSub = newLink;
|
|
111
|
+
else dep.subs = newLink;
|
|
112
|
+
}
|
|
113
|
+
function unlink(link, sub = link.sub) {
|
|
114
|
+
const dep = link.dep;
|
|
115
|
+
const prevDep = link.prevDep;
|
|
116
|
+
const nextDep = link.nextDep;
|
|
117
|
+
const nextSub = link.nextSub;
|
|
118
|
+
const prevSub = link.prevSub;
|
|
119
|
+
if (nextDep !== void 0) nextDep.prevDep = prevDep;
|
|
120
|
+
else sub.depsTail = prevDep;
|
|
121
|
+
if (prevDep !== void 0) prevDep.nextDep = nextDep;
|
|
122
|
+
else sub.deps = nextDep;
|
|
123
|
+
if (nextSub !== void 0) nextSub.prevSub = prevSub;
|
|
124
|
+
else dep.subsTail = prevSub;
|
|
125
|
+
if (prevSub !== void 0) prevSub.nextSub = nextSub;
|
|
126
|
+
else if ((dep.subs = nextSub) === void 0) {
|
|
127
|
+
let toRemove = dep.deps;
|
|
128
|
+
if (toRemove !== void 0) {
|
|
129
|
+
do
|
|
130
|
+
toRemove = unlink(toRemove, dep);
|
|
131
|
+
while (toRemove !== void 0);
|
|
132
|
+
dep.flags |= 16;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return nextDep;
|
|
136
|
+
}
|
|
137
|
+
function propagate(link) {
|
|
138
|
+
let next = link.nextSub;
|
|
139
|
+
let stack;
|
|
140
|
+
top: do {
|
|
141
|
+
const sub = link.sub;
|
|
142
|
+
let flags = sub.flags;
|
|
143
|
+
if (flags & 3) {
|
|
144
|
+
if (!(flags & 60)) sub.flags = flags | 32;
|
|
145
|
+
else if (!(flags & 12)) flags = 0;
|
|
146
|
+
else if (!(flags & 4)) sub.flags = flags & -9 | 32;
|
|
147
|
+
else if (!(flags & 48) && isValidLink(link, sub)) {
|
|
148
|
+
sub.flags = flags | 40;
|
|
149
|
+
flags &= 1;
|
|
150
|
+
} else flags = 0;
|
|
151
|
+
if (flags & 2) notifyBuffer[notifyBufferLength++] = sub;
|
|
152
|
+
if (flags & 1) {
|
|
153
|
+
const subSubs = sub.subs;
|
|
154
|
+
if (subSubs !== void 0) {
|
|
155
|
+
link = subSubs;
|
|
156
|
+
if (subSubs.nextSub !== void 0) {
|
|
157
|
+
stack = {
|
|
158
|
+
value: next,
|
|
159
|
+
prev: stack
|
|
160
|
+
};
|
|
161
|
+
next = link.nextSub;
|
|
162
|
+
}
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if ((link = next) !== void 0) {
|
|
168
|
+
next = link.nextSub;
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
while (stack !== void 0) {
|
|
172
|
+
link = stack.value;
|
|
173
|
+
stack = stack.prev;
|
|
174
|
+
if (link !== void 0) {
|
|
175
|
+
next = link.nextSub;
|
|
176
|
+
continue top;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
} while (true);
|
|
167
181
|
}
|
|
168
182
|
function startTracking(sub) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
183
|
+
++globalVersion;
|
|
184
|
+
sub.depsTail = void 0;
|
|
185
|
+
sub.flags = sub.flags & -57 | 4;
|
|
186
|
+
return setActiveSub(sub);
|
|
173
187
|
}
|
|
174
188
|
function endTracking(sub, prevSub) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const depsTail = sub.depsTail;
|
|
182
|
-
let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
|
|
183
|
-
while (toRemove !== void 0) {
|
|
184
|
-
toRemove = unlink(toRemove, sub);
|
|
185
|
-
}
|
|
186
|
-
sub.flags &= -5 /* RecursedCheck */;
|
|
189
|
+
if (activeSub !== sub) warn("Active effect was not restored correctly - this is likely a Vue internal bug.");
|
|
190
|
+
activeSub = prevSub;
|
|
191
|
+
const depsTail = sub.depsTail;
|
|
192
|
+
let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
|
|
193
|
+
while (toRemove !== void 0) toRemove = unlink(toRemove, sub);
|
|
194
|
+
sub.flags &= -5;
|
|
187
195
|
}
|
|
188
196
|
function flush() {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
function checkDirty(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
function shallowPropagate(link2) {
|
|
259
|
-
do {
|
|
260
|
-
const sub = link2.sub;
|
|
261
|
-
const nextSub = link2.nextSub;
|
|
262
|
-
const subFlags = sub.flags;
|
|
263
|
-
if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
|
|
264
|
-
sub.flags = subFlags | 16 /* Dirty */;
|
|
265
|
-
}
|
|
266
|
-
link2 = nextSub;
|
|
267
|
-
} while (link2 !== void 0);
|
|
197
|
+
while (notifyIndex < notifyBufferLength) {
|
|
198
|
+
const effect = notifyBuffer[notifyIndex];
|
|
199
|
+
notifyBuffer[notifyIndex++] = void 0;
|
|
200
|
+
effect.notify();
|
|
201
|
+
}
|
|
202
|
+
notifyIndex = 0;
|
|
203
|
+
notifyBufferLength = 0;
|
|
204
|
+
}
|
|
205
|
+
function checkDirty(link, sub) {
|
|
206
|
+
let stack;
|
|
207
|
+
let checkDepth = 0;
|
|
208
|
+
top: do {
|
|
209
|
+
const dep = link.dep;
|
|
210
|
+
const depFlags = dep.flags;
|
|
211
|
+
let dirty = false;
|
|
212
|
+
if (sub.flags & 16) dirty = true;
|
|
213
|
+
else if ((depFlags & 17) === 17) {
|
|
214
|
+
if (dep.update()) {
|
|
215
|
+
const subs = dep.subs;
|
|
216
|
+
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
217
|
+
dirty = true;
|
|
218
|
+
}
|
|
219
|
+
} else if ((depFlags & 33) === 33) {
|
|
220
|
+
if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
|
|
221
|
+
value: link,
|
|
222
|
+
prev: stack
|
|
223
|
+
};
|
|
224
|
+
link = dep.deps;
|
|
225
|
+
sub = dep;
|
|
226
|
+
++checkDepth;
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (!dirty && link.nextDep !== void 0) {
|
|
230
|
+
link = link.nextDep;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
while (checkDepth) {
|
|
234
|
+
--checkDepth;
|
|
235
|
+
const firstSub = sub.subs;
|
|
236
|
+
const hasMultipleSubs = firstSub.nextSub !== void 0;
|
|
237
|
+
if (hasMultipleSubs) {
|
|
238
|
+
link = stack.value;
|
|
239
|
+
stack = stack.prev;
|
|
240
|
+
} else link = firstSub;
|
|
241
|
+
if (dirty) {
|
|
242
|
+
if (sub.update()) {
|
|
243
|
+
if (hasMultipleSubs) shallowPropagate(firstSub);
|
|
244
|
+
sub = link.sub;
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
} else sub.flags &= -33;
|
|
248
|
+
sub = link.sub;
|
|
249
|
+
if (link.nextDep !== void 0) {
|
|
250
|
+
link = link.nextDep;
|
|
251
|
+
continue top;
|
|
252
|
+
}
|
|
253
|
+
dirty = false;
|
|
254
|
+
}
|
|
255
|
+
return dirty;
|
|
256
|
+
} while (true);
|
|
257
|
+
}
|
|
258
|
+
function shallowPropagate(link) {
|
|
259
|
+
do {
|
|
260
|
+
const sub = link.sub;
|
|
261
|
+
const nextSub = link.nextSub;
|
|
262
|
+
const subFlags = sub.flags;
|
|
263
|
+
if ((subFlags & 48) === 32) sub.flags = subFlags | 16;
|
|
264
|
+
link = nextSub;
|
|
265
|
+
} while (link !== void 0);
|
|
268
266
|
}
|
|
269
267
|
function isValidLink(checkLink, sub) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
|
|
296
|
-
sub.onTrigger(
|
|
297
|
-
shared.extend(
|
|
298
|
-
{
|
|
299
|
-
effect: sub
|
|
300
|
-
},
|
|
301
|
-
debugInfo
|
|
302
|
-
)
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
function setupOnTrigger(target) {
|
|
307
|
-
Object.defineProperty(target.prototype, "onTrigger", {
|
|
308
|
-
get() {
|
|
309
|
-
return this._onTrigger;
|
|
310
|
-
},
|
|
311
|
-
set(val) {
|
|
312
|
-
if (val && !this._onTrigger) setupFlagsHandler(this);
|
|
313
|
-
this._onTrigger = val;
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
function setupFlagsHandler(target) {
|
|
318
|
-
target._flags = target.flags;
|
|
319
|
-
Object.defineProperty(target, "flags", {
|
|
320
|
-
get() {
|
|
321
|
-
return target._flags;
|
|
322
|
-
},
|
|
323
|
-
set(value) {
|
|
324
|
-
if (!(target._flags & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending)) && !!(value & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending))) {
|
|
325
|
-
onTrigger(this);
|
|
326
|
-
}
|
|
327
|
-
target._flags = value;
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
class Dep {
|
|
333
|
-
constructor(map, key) {
|
|
334
|
-
this.map = map;
|
|
335
|
-
this.key = key;
|
|
336
|
-
this._subs = void 0;
|
|
337
|
-
this.subsTail = void 0;
|
|
338
|
-
this.flags = ReactiveFlags$1.None;
|
|
339
|
-
}
|
|
340
|
-
get subs() {
|
|
341
|
-
return this._subs;
|
|
342
|
-
}
|
|
343
|
-
set subs(value) {
|
|
344
|
-
this._subs = value;
|
|
345
|
-
if (value === void 0) {
|
|
346
|
-
this.map.delete(this.key);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
268
|
+
let link = sub.depsTail;
|
|
269
|
+
while (link !== void 0) {
|
|
270
|
+
if (link === checkLink) return true;
|
|
271
|
+
link = link.prevDep;
|
|
272
|
+
}
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region packages/reactivity/src/dep.ts
|
|
277
|
+
var Dep = class {
|
|
278
|
+
constructor(map, key) {
|
|
279
|
+
this.map = map;
|
|
280
|
+
this.key = key;
|
|
281
|
+
this._subs = void 0;
|
|
282
|
+
this.subsTail = void 0;
|
|
283
|
+
this.flags = 0;
|
|
284
|
+
}
|
|
285
|
+
get subs() {
|
|
286
|
+
return this._subs;
|
|
287
|
+
}
|
|
288
|
+
set subs(value) {
|
|
289
|
+
this._subs = value;
|
|
290
|
+
if (value === void 0) this.map.delete(this.key);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
350
293
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
351
|
-
const ITERATE_KEY = Symbol(
|
|
352
|
-
|
|
353
|
-
);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
294
|
+
const ITERATE_KEY = Symbol("Object iterate");
|
|
295
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate");
|
|
296
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate");
|
|
297
|
+
/**
|
|
298
|
+
* Tracks access to a reactive property.
|
|
299
|
+
*
|
|
300
|
+
* This will check which effect is running at the moment and record it as dep
|
|
301
|
+
* which records all effects that depend on the reactive property.
|
|
302
|
+
*
|
|
303
|
+
* @param target - Object holding the reactive property.
|
|
304
|
+
* @param type - Defines the type of access to the reactive property.
|
|
305
|
+
* @param key - Identifier of the reactive property to track.
|
|
306
|
+
*/
|
|
360
307
|
function track(target, type, key) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
type,
|
|
374
|
-
key
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
link(dep, activeSub);
|
|
378
|
-
}
|
|
308
|
+
if (activeSub !== void 0) {
|
|
309
|
+
let depsMap = targetMap.get(target);
|
|
310
|
+
if (!depsMap) targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
311
|
+
let dep = depsMap.get(key);
|
|
312
|
+
if (!dep) depsMap.set(key, dep = new Dep(depsMap, key));
|
|
313
|
+
onTrack(activeSub, {
|
|
314
|
+
target,
|
|
315
|
+
type,
|
|
316
|
+
key
|
|
317
|
+
});
|
|
318
|
+
link(dep, activeSub);
|
|
319
|
+
}
|
|
379
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Finds all deps associated with the target (or a specific property) and
|
|
323
|
+
* triggers the effects stored within.
|
|
324
|
+
*
|
|
325
|
+
* @param target - The reactive object.
|
|
326
|
+
* @param type - Defines the type of the operation that needs to trigger effects.
|
|
327
|
+
* @param key - Can be used to target a specific reactive property in the target object.
|
|
328
|
+
*/
|
|
380
329
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
} else if (isArrayIndex) {
|
|
432
|
-
run(depsMap.get("length"));
|
|
433
|
-
}
|
|
434
|
-
break;
|
|
435
|
-
case "delete":
|
|
436
|
-
if (!targetIsArray) {
|
|
437
|
-
run(depsMap.get(ITERATE_KEY));
|
|
438
|
-
if (shared.isMap(target)) {
|
|
439
|
-
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
break;
|
|
443
|
-
case "set":
|
|
444
|
-
if (shared.isMap(target)) {
|
|
445
|
-
run(depsMap.get(ITERATE_KEY));
|
|
446
|
-
}
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
endBatch();
|
|
330
|
+
const depsMap = targetMap.get(target);
|
|
331
|
+
if (!depsMap) return;
|
|
332
|
+
const run = (dep) => {
|
|
333
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
334
|
+
triggerEventInfos.push({
|
|
335
|
+
target,
|
|
336
|
+
type,
|
|
337
|
+
key,
|
|
338
|
+
newValue,
|
|
339
|
+
oldValue,
|
|
340
|
+
oldTarget
|
|
341
|
+
});
|
|
342
|
+
propagate(dep.subs);
|
|
343
|
+
shallowPropagate(dep.subs);
|
|
344
|
+
triggerEventInfos.pop();
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
startBatch();
|
|
348
|
+
if (type === "clear") depsMap.forEach(run);
|
|
349
|
+
else {
|
|
350
|
+
const targetIsArray = (0, _vue_shared.isArray)(target);
|
|
351
|
+
const isArrayIndex = targetIsArray && (0, _vue_shared.isIntegerKey)(key);
|
|
352
|
+
if (targetIsArray && key === "length") {
|
|
353
|
+
const newLength = Number(newValue);
|
|
354
|
+
depsMap.forEach((dep, key) => {
|
|
355
|
+
if (key === "length" || key === ARRAY_ITERATE_KEY || !(0, _vue_shared.isSymbol)(key) && key >= newLength) run(dep);
|
|
356
|
+
});
|
|
357
|
+
} else {
|
|
358
|
+
if (key !== void 0 || depsMap.has(void 0)) run(depsMap.get(key));
|
|
359
|
+
if (isArrayIndex) run(depsMap.get(ARRAY_ITERATE_KEY));
|
|
360
|
+
switch (type) {
|
|
361
|
+
case "add":
|
|
362
|
+
if (!targetIsArray) {
|
|
363
|
+
run(depsMap.get(ITERATE_KEY));
|
|
364
|
+
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
365
|
+
} else if (isArrayIndex) run(depsMap.get("length"));
|
|
366
|
+
break;
|
|
367
|
+
case "delete":
|
|
368
|
+
if (!targetIsArray) {
|
|
369
|
+
run(depsMap.get(ITERATE_KEY));
|
|
370
|
+
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
371
|
+
}
|
|
372
|
+
break;
|
|
373
|
+
case "set":
|
|
374
|
+
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(ITERATE_KEY));
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
endBatch();
|
|
452
380
|
}
|
|
453
381
|
function getDepFromReactive(object, key) {
|
|
454
|
-
|
|
455
|
-
|
|
382
|
+
const depMap = targetMap.get(object);
|
|
383
|
+
return depMap && depMap.get(key);
|
|
456
384
|
}
|
|
457
|
-
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region packages/reactivity/src/arrayInstrumentations.ts
|
|
387
|
+
/**
|
|
388
|
+
* Track array iteration and return:
|
|
389
|
+
* - if input is reactive: a cloned raw array with reactive values
|
|
390
|
+
* - if input is non-reactive or shallowReactive: the original raw array
|
|
391
|
+
*/
|
|
458
392
|
function reactiveReadArray(array) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
393
|
+
const raw = /* @__PURE__ */ toRaw(array);
|
|
394
|
+
if (raw === array) return raw;
|
|
395
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
396
|
+
return /* @__PURE__ */ isShallow(array) ? raw : raw.map(toReactive);
|
|
463
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Track array iteration and return raw array
|
|
400
|
+
*/
|
|
464
401
|
function shallowReadArray(arr) {
|
|
465
|
-
|
|
466
|
-
|
|
402
|
+
track(arr = /* @__PURE__ */ toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
403
|
+
return arr;
|
|
467
404
|
}
|
|
468
405
|
function toWrapped(target, item) {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
return toReactive(item);
|
|
406
|
+
if (/* @__PURE__ */ isReadonly(target)) return /* @__PURE__ */ isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
|
|
407
|
+
return toReactive(item);
|
|
473
408
|
}
|
|
474
409
|
const arrayInstrumentations = {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
},
|
|
561
|
-
shift() {
|
|
562
|
-
return noTracking(this, "shift");
|
|
563
|
-
},
|
|
564
|
-
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
565
|
-
some(fn, thisArg) {
|
|
566
|
-
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
567
|
-
},
|
|
568
|
-
splice(...args) {
|
|
569
|
-
return noTracking(this, "splice", args);
|
|
570
|
-
},
|
|
571
|
-
toReversed() {
|
|
572
|
-
return reactiveReadArray(this).toReversed();
|
|
573
|
-
},
|
|
574
|
-
toSorted(comparer) {
|
|
575
|
-
return reactiveReadArray(this).toSorted(comparer);
|
|
576
|
-
},
|
|
577
|
-
toSpliced(...args) {
|
|
578
|
-
return reactiveReadArray(this).toSpliced(...args);
|
|
579
|
-
},
|
|
580
|
-
unshift(...args) {
|
|
581
|
-
return noTracking(this, "unshift", args);
|
|
582
|
-
},
|
|
583
|
-
values() {
|
|
584
|
-
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
585
|
-
}
|
|
410
|
+
__proto__: null,
|
|
411
|
+
[Symbol.iterator]() {
|
|
412
|
+
return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
|
|
413
|
+
},
|
|
414
|
+
concat(...args) {
|
|
415
|
+
return reactiveReadArray(this).concat(...args.map((x) => (0, _vue_shared.isArray)(x) ? reactiveReadArray(x) : x));
|
|
416
|
+
},
|
|
417
|
+
entries() {
|
|
418
|
+
return iterator(this, "entries", (value) => {
|
|
419
|
+
value[1] = toWrapped(this, value[1]);
|
|
420
|
+
return value;
|
|
421
|
+
});
|
|
422
|
+
},
|
|
423
|
+
every(fn, thisArg) {
|
|
424
|
+
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
425
|
+
},
|
|
426
|
+
filter(fn, thisArg) {
|
|
427
|
+
return apply(this, "filter", fn, thisArg, (v) => v.map((item) => toWrapped(this, item)), arguments);
|
|
428
|
+
},
|
|
429
|
+
find(fn, thisArg) {
|
|
430
|
+
return apply(this, "find", fn, thisArg, (item) => toWrapped(this, item), arguments);
|
|
431
|
+
},
|
|
432
|
+
findIndex(fn, thisArg) {
|
|
433
|
+
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
434
|
+
},
|
|
435
|
+
findLast(fn, thisArg) {
|
|
436
|
+
return apply(this, "findLast", fn, thisArg, (item) => toWrapped(this, item), arguments);
|
|
437
|
+
},
|
|
438
|
+
findLastIndex(fn, thisArg) {
|
|
439
|
+
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
440
|
+
},
|
|
441
|
+
forEach(fn, thisArg) {
|
|
442
|
+
return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
|
443
|
+
},
|
|
444
|
+
includes(...args) {
|
|
445
|
+
return searchProxy(this, "includes", args);
|
|
446
|
+
},
|
|
447
|
+
indexOf(...args) {
|
|
448
|
+
return searchProxy(this, "indexOf", args);
|
|
449
|
+
},
|
|
450
|
+
join(separator) {
|
|
451
|
+
return reactiveReadArray(this).join(separator);
|
|
452
|
+
},
|
|
453
|
+
lastIndexOf(...args) {
|
|
454
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
455
|
+
},
|
|
456
|
+
map(fn, thisArg) {
|
|
457
|
+
return apply(this, "map", fn, thisArg, void 0, arguments);
|
|
458
|
+
},
|
|
459
|
+
pop() {
|
|
460
|
+
return noTracking(this, "pop");
|
|
461
|
+
},
|
|
462
|
+
push(...args) {
|
|
463
|
+
return noTracking(this, "push", args);
|
|
464
|
+
},
|
|
465
|
+
reduce(fn, ...args) {
|
|
466
|
+
return reduce(this, "reduce", fn, args);
|
|
467
|
+
},
|
|
468
|
+
reduceRight(fn, ...args) {
|
|
469
|
+
return reduce(this, "reduceRight", fn, args);
|
|
470
|
+
},
|
|
471
|
+
shift() {
|
|
472
|
+
return noTracking(this, "shift");
|
|
473
|
+
},
|
|
474
|
+
some(fn, thisArg) {
|
|
475
|
+
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
476
|
+
},
|
|
477
|
+
splice(...args) {
|
|
478
|
+
return noTracking(this, "splice", args);
|
|
479
|
+
},
|
|
480
|
+
toReversed() {
|
|
481
|
+
return reactiveReadArray(this).toReversed();
|
|
482
|
+
},
|
|
483
|
+
toSorted(comparer) {
|
|
484
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
485
|
+
},
|
|
486
|
+
toSpliced(...args) {
|
|
487
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
488
|
+
},
|
|
489
|
+
unshift(...args) {
|
|
490
|
+
return noTracking(this, "unshift", args);
|
|
491
|
+
},
|
|
492
|
+
values() {
|
|
493
|
+
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
494
|
+
}
|
|
586
495
|
};
|
|
587
496
|
function iterator(self, method, wrapValue) {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
}
|
|
600
|
-
return iter;
|
|
497
|
+
const arr = shallowReadArray(self);
|
|
498
|
+
const iter = arr[method]();
|
|
499
|
+
if (arr !== self && !/* @__PURE__ */ isShallow(self)) {
|
|
500
|
+
iter._next = iter.next;
|
|
501
|
+
iter.next = () => {
|
|
502
|
+
const result = iter._next();
|
|
503
|
+
if (!result.done) result.value = wrapValue(result.value);
|
|
504
|
+
return result;
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return iter;
|
|
601
508
|
}
|
|
602
509
|
const arrayProto = Array.prototype;
|
|
603
510
|
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
624
|
-
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
511
|
+
const arr = shallowReadArray(self);
|
|
512
|
+
const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);
|
|
513
|
+
const methodFn = arr[method];
|
|
514
|
+
if (methodFn !== arrayProto[method]) {
|
|
515
|
+
const result = methodFn.apply(self, args);
|
|
516
|
+
return needsWrap ? toReactive(result) : result;
|
|
517
|
+
}
|
|
518
|
+
let wrappedFn = fn;
|
|
519
|
+
if (arr !== self) {
|
|
520
|
+
if (needsWrap) wrappedFn = function(item, index) {
|
|
521
|
+
return fn.call(this, toWrapped(self, item), index, self);
|
|
522
|
+
};
|
|
523
|
+
else if (fn.length > 2) wrappedFn = function(item, index) {
|
|
524
|
+
return fn.call(this, item, index, self);
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
528
|
+
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
625
529
|
}
|
|
626
530
|
function reduce(self, method, fn, args) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
531
|
+
const arr = shallowReadArray(self);
|
|
532
|
+
const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);
|
|
533
|
+
let wrappedFn = fn;
|
|
534
|
+
let wrapInitialAccumulator = false;
|
|
535
|
+
if (arr !== self) {
|
|
536
|
+
if (needsWrap) {
|
|
537
|
+
wrapInitialAccumulator = args.length === 0;
|
|
538
|
+
wrappedFn = function(acc, item, index) {
|
|
539
|
+
if (wrapInitialAccumulator) {
|
|
540
|
+
wrapInitialAccumulator = false;
|
|
541
|
+
acc = toWrapped(self, acc);
|
|
542
|
+
}
|
|
543
|
+
return fn.call(this, acc, toWrapped(self, item), index, self);
|
|
544
|
+
};
|
|
545
|
+
} else if (fn.length > 3) wrappedFn = function(acc, item, index) {
|
|
546
|
+
return fn.call(this, acc, item, index, self);
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
const result = arr[method](wrappedFn, ...args);
|
|
550
|
+
return wrapInitialAccumulator ? toWrapped(self, result) : result;
|
|
641
551
|
}
|
|
642
552
|
function searchProxy(self, method, args) {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
553
|
+
const arr = /* @__PURE__ */ toRaw(self);
|
|
554
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
555
|
+
const res = arr[method](...args);
|
|
556
|
+
if ((res === -1 || res === false) && /* @__PURE__ */ isProxy(args[0])) {
|
|
557
|
+
args[0] = /* @__PURE__ */ toRaw(args[0]);
|
|
558
|
+
return arr[method](...args);
|
|
559
|
+
}
|
|
560
|
+
return res;
|
|
651
561
|
}
|
|
652
562
|
function noTracking(self, method, args = []) {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
);
|
|
563
|
+
startBatch();
|
|
564
|
+
const prevSub = setActiveSub();
|
|
565
|
+
const res = (/* @__PURE__ */ toRaw(self))[method].apply(self, args);
|
|
566
|
+
setActiveSub(prevSub);
|
|
567
|
+
endBatch();
|
|
568
|
+
return res;
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region packages/reactivity/src/baseHandlers.ts
|
|
572
|
+
const isNonTrackableKeys = /* @__PURE__ */ (0, _vue_shared.makeMap)(`__proto__,__v_isRef,__isVue`);
|
|
573
|
+
const builtInSymbols = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(_vue_shared.isSymbol));
|
|
665
574
|
function hasOwnProperty(key) {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
key,
|
|
766
|
-
value,
|
|
767
|
-
isRef(target) ? target : receiver
|
|
768
|
-
);
|
|
769
|
-
if (target === toRaw(receiver)) {
|
|
770
|
-
if (!hadKey) {
|
|
771
|
-
trigger(target, "add", key, value);
|
|
772
|
-
} else if (shared.hasChanged(value, oldValue)) {
|
|
773
|
-
trigger(target, "set", key, value, oldValue);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
return result;
|
|
777
|
-
}
|
|
778
|
-
deleteProperty(target, key) {
|
|
779
|
-
const hadKey = shared.hasOwn(target, key);
|
|
780
|
-
const oldValue = target[key];
|
|
781
|
-
const result = Reflect.deleteProperty(target, key);
|
|
782
|
-
if (result && hadKey) {
|
|
783
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
784
|
-
}
|
|
785
|
-
return result;
|
|
786
|
-
}
|
|
787
|
-
has(target, key) {
|
|
788
|
-
const result = Reflect.has(target, key);
|
|
789
|
-
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
|
|
790
|
-
track(target, "has", key);
|
|
791
|
-
}
|
|
792
|
-
return result;
|
|
793
|
-
}
|
|
794
|
-
ownKeys(target) {
|
|
795
|
-
track(
|
|
796
|
-
target,
|
|
797
|
-
"iterate",
|
|
798
|
-
shared.isArray(target) ? "length" : ITERATE_KEY
|
|
799
|
-
);
|
|
800
|
-
return Reflect.ownKeys(target);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
804
|
-
constructor(isShallow2 = false) {
|
|
805
|
-
super(true, isShallow2);
|
|
806
|
-
}
|
|
807
|
-
set(target, key) {
|
|
808
|
-
{
|
|
809
|
-
warn(
|
|
810
|
-
`Set operation on key "${String(key)}" failed: target is readonly.`,
|
|
811
|
-
target
|
|
812
|
-
);
|
|
813
|
-
}
|
|
814
|
-
return true;
|
|
815
|
-
}
|
|
816
|
-
deleteProperty(target, key) {
|
|
817
|
-
{
|
|
818
|
-
warn(
|
|
819
|
-
`Delete operation on key "${String(key)}" failed: target is readonly.`,
|
|
820
|
-
target
|
|
821
|
-
);
|
|
822
|
-
}
|
|
823
|
-
return true;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
575
|
+
if (!(0, _vue_shared.isSymbol)(key)) key = String(key);
|
|
576
|
+
const obj = /* @__PURE__ */ toRaw(this);
|
|
577
|
+
track(obj, "has", key);
|
|
578
|
+
return obj.hasOwnProperty(key);
|
|
579
|
+
}
|
|
580
|
+
var BaseReactiveHandler = class {
|
|
581
|
+
constructor(_isReadonly = false, _isShallow = false) {
|
|
582
|
+
this._isReadonly = _isReadonly;
|
|
583
|
+
this._isShallow = _isShallow;
|
|
584
|
+
}
|
|
585
|
+
get(target, key, receiver) {
|
|
586
|
+
if (key === "__v_skip") return target["__v_skip"];
|
|
587
|
+
const isReadonly = this._isReadonly, isShallow = this._isShallow;
|
|
588
|
+
if (key === "__v_isReactive") return !isReadonly;
|
|
589
|
+
else if (key === "__v_isReadonly") return isReadonly;
|
|
590
|
+
else if (key === "__v_isShallow") return isShallow;
|
|
591
|
+
else if (key === "__v_raw") {
|
|
592
|
+
if (receiver === (isReadonly ? isShallow ? shallowReadonlyMap : readonlyMap : isShallow ? shallowReactiveMap : reactiveMap).get(target) || Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) return target;
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
const targetIsArray = (0, _vue_shared.isArray)(target);
|
|
596
|
+
if (!isReadonly) {
|
|
597
|
+
let fn;
|
|
598
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) return fn;
|
|
599
|
+
if (key === "hasOwnProperty") return hasOwnProperty;
|
|
600
|
+
}
|
|
601
|
+
const wasRef = /* @__PURE__ */ isRef(target);
|
|
602
|
+
const res = Reflect.get(target, key, wasRef ? target : receiver);
|
|
603
|
+
if (wasRef && key !== "value") return res;
|
|
604
|
+
if ((0, _vue_shared.isSymbol)(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) return res;
|
|
605
|
+
if (!isReadonly) track(target, "get", key);
|
|
606
|
+
if (isShallow) return res;
|
|
607
|
+
if (/* @__PURE__ */ isRef(res)) {
|
|
608
|
+
const value = targetIsArray && (0, _vue_shared.isIntegerKey)(key) ? res : res.value;
|
|
609
|
+
return isReadonly && (0, _vue_shared.isObject)(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
610
|
+
}
|
|
611
|
+
if ((0, _vue_shared.isObject)(res)) return isReadonly ? /* @__PURE__ */ readonly(res) : /* @__PURE__ */ reactive(res);
|
|
612
|
+
return res;
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
616
|
+
constructor(isShallow = false) {
|
|
617
|
+
super(false, isShallow);
|
|
618
|
+
}
|
|
619
|
+
set(target, key, value, receiver) {
|
|
620
|
+
let oldValue = target[key];
|
|
621
|
+
const isArrayWithIntegerKey = (0, _vue_shared.isArray)(target) && (0, _vue_shared.isIntegerKey)(key);
|
|
622
|
+
if (!this._isShallow) {
|
|
623
|
+
const isOldValueReadonly = /* @__PURE__ */ isReadonly(oldValue);
|
|
624
|
+
if (!/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) {
|
|
625
|
+
oldValue = /* @__PURE__ */ toRaw(oldValue);
|
|
626
|
+
value = /* @__PURE__ */ toRaw(value);
|
|
627
|
+
}
|
|
628
|
+
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) if (isOldValueReadonly) {
|
|
629
|
+
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target[key]);
|
|
630
|
+
return true;
|
|
631
|
+
} else {
|
|
632
|
+
oldValue.value = value;
|
|
633
|
+
return true;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : (0, _vue_shared.hasOwn)(target, key);
|
|
637
|
+
const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
|
|
638
|
+
if (target === /* @__PURE__ */ toRaw(receiver)) {
|
|
639
|
+
if (!hadKey) trigger(target, "add", key, value);
|
|
640
|
+
else if ((0, _vue_shared.hasChanged)(value, oldValue)) trigger(target, "set", key, value, oldValue);
|
|
641
|
+
}
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
deleteProperty(target, key) {
|
|
645
|
+
const hadKey = (0, _vue_shared.hasOwn)(target, key);
|
|
646
|
+
const oldValue = target[key];
|
|
647
|
+
const result = Reflect.deleteProperty(target, key);
|
|
648
|
+
if (result && hadKey) trigger(target, "delete", key, void 0, oldValue);
|
|
649
|
+
return result;
|
|
650
|
+
}
|
|
651
|
+
has(target, key) {
|
|
652
|
+
const result = Reflect.has(target, key);
|
|
653
|
+
if (!(0, _vue_shared.isSymbol)(key) || !builtInSymbols.has(key)) track(target, "has", key);
|
|
654
|
+
return result;
|
|
655
|
+
}
|
|
656
|
+
ownKeys(target) {
|
|
657
|
+
track(target, "iterate", (0, _vue_shared.isArray)(target) ? "length" : ITERATE_KEY);
|
|
658
|
+
return Reflect.ownKeys(target);
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
var ReadonlyReactiveHandler = class extends BaseReactiveHandler {
|
|
662
|
+
constructor(isShallow = false) {
|
|
663
|
+
super(true, isShallow);
|
|
664
|
+
}
|
|
665
|
+
set(target, key) {
|
|
666
|
+
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
667
|
+
return true;
|
|
668
|
+
}
|
|
669
|
+
deleteProperty(target, key) {
|
|
670
|
+
warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
};
|
|
826
674
|
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
827
675
|
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
828
676
|
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
|
|
829
677
|
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
830
|
-
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region packages/reactivity/src/collectionHandlers.ts
|
|
831
680
|
const toShallow = (value) => value;
|
|
832
681
|
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
833
|
-
function createIterableMethod(method,
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
};
|
|
855
|
-
},
|
|
856
|
-
// iterable protocol
|
|
857
|
-
[Symbol.iterator]() {
|
|
858
|
-
return this;
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
|
-
};
|
|
682
|
+
function createIterableMethod(method, isReadonly, isShallow) {
|
|
683
|
+
return function(...args) {
|
|
684
|
+
const target = this["__v_raw"];
|
|
685
|
+
const rawTarget = /* @__PURE__ */ toRaw(target);
|
|
686
|
+
const targetIsMap = (0, _vue_shared.isMap)(rawTarget);
|
|
687
|
+
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
688
|
+
const isKeyOnly = method === "keys" && targetIsMap;
|
|
689
|
+
const innerIterator = target[method](...args);
|
|
690
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
691
|
+
!isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
692
|
+
return (0, _vue_shared.extend)(Object.create(innerIterator), { next() {
|
|
693
|
+
const { value, done } = innerIterator.next();
|
|
694
|
+
return done ? {
|
|
695
|
+
value,
|
|
696
|
+
done
|
|
697
|
+
} : {
|
|
698
|
+
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
699
|
+
done
|
|
700
|
+
};
|
|
701
|
+
} });
|
|
702
|
+
};
|
|
862
703
|
}
|
|
863
704
|
function createReadonlyMethod(type) {
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
}
|
|
872
|
-
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
873
|
-
};
|
|
705
|
+
return function(...args) {
|
|
706
|
+
{
|
|
707
|
+
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
708
|
+
warn(`${(0, _vue_shared.capitalize)(type)} operation ${key}failed: target is readonly.`, /* @__PURE__ */ toRaw(this));
|
|
709
|
+
}
|
|
710
|
+
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
711
|
+
};
|
|
874
712
|
}
|
|
875
713
|
function createInstrumentations(readonly, shallow) {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
void 0,
|
|
995
|
-
void 0,
|
|
996
|
-
oldTarget
|
|
997
|
-
);
|
|
998
|
-
}
|
|
999
|
-
return result;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
);
|
|
1003
|
-
const iteratorMethods = [
|
|
1004
|
-
"keys",
|
|
1005
|
-
"values",
|
|
1006
|
-
"entries",
|
|
1007
|
-
Symbol.iterator
|
|
1008
|
-
];
|
|
1009
|
-
iteratorMethods.forEach((method) => {
|
|
1010
|
-
instrumentations[method] = createIterableMethod(method, readonly, shallow);
|
|
1011
|
-
});
|
|
1012
|
-
return instrumentations;
|
|
1013
|
-
}
|
|
1014
|
-
function createInstrumentationGetter(isReadonly2, shallow) {
|
|
1015
|
-
const instrumentations = createInstrumentations(isReadonly2, shallow);
|
|
1016
|
-
return (target, key, receiver) => {
|
|
1017
|
-
if (key === "__v_isReactive") {
|
|
1018
|
-
return !isReadonly2;
|
|
1019
|
-
} else if (key === "__v_isReadonly") {
|
|
1020
|
-
return isReadonly2;
|
|
1021
|
-
} else if (key === "__v_raw") {
|
|
1022
|
-
return target;
|
|
1023
|
-
}
|
|
1024
|
-
return Reflect.get(
|
|
1025
|
-
shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
|
1026
|
-
key,
|
|
1027
|
-
receiver
|
|
1028
|
-
);
|
|
1029
|
-
};
|
|
1030
|
-
}
|
|
1031
|
-
const mutableCollectionHandlers = {
|
|
1032
|
-
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
1033
|
-
};
|
|
1034
|
-
const shallowCollectionHandlers = {
|
|
1035
|
-
get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
|
1036
|
-
};
|
|
1037
|
-
const readonlyCollectionHandlers = {
|
|
1038
|
-
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
1039
|
-
};
|
|
1040
|
-
const shallowReadonlyCollectionHandlers = {
|
|
1041
|
-
get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
|
1042
|
-
};
|
|
714
|
+
const instrumentations = {
|
|
715
|
+
get(key) {
|
|
716
|
+
const target = this["__v_raw"];
|
|
717
|
+
const rawTarget = /* @__PURE__ */ toRaw(target);
|
|
718
|
+
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
719
|
+
if (!readonly) {
|
|
720
|
+
if ((0, _vue_shared.hasChanged)(key, rawKey)) track(rawTarget, "get", key);
|
|
721
|
+
track(rawTarget, "get", rawKey);
|
|
722
|
+
}
|
|
723
|
+
const { has } = getProto(rawTarget);
|
|
724
|
+
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
725
|
+
if (has.call(rawTarget, key)) return wrap(target.get(key));
|
|
726
|
+
else if (has.call(rawTarget, rawKey)) return wrap(target.get(rawKey));
|
|
727
|
+
else if (target !== rawTarget) target.get(key);
|
|
728
|
+
},
|
|
729
|
+
get size() {
|
|
730
|
+
const target = this["__v_raw"];
|
|
731
|
+
!readonly && track(/* @__PURE__ */ toRaw(target), "iterate", ITERATE_KEY);
|
|
732
|
+
return target.size;
|
|
733
|
+
},
|
|
734
|
+
has(key) {
|
|
735
|
+
const target = this["__v_raw"];
|
|
736
|
+
const rawTarget = /* @__PURE__ */ toRaw(target);
|
|
737
|
+
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
738
|
+
if (!readonly) {
|
|
739
|
+
if ((0, _vue_shared.hasChanged)(key, rawKey)) track(rawTarget, "has", key);
|
|
740
|
+
track(rawTarget, "has", rawKey);
|
|
741
|
+
}
|
|
742
|
+
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
743
|
+
},
|
|
744
|
+
forEach(callback, thisArg) {
|
|
745
|
+
const observed = this;
|
|
746
|
+
const target = observed["__v_raw"];
|
|
747
|
+
const rawTarget = /* @__PURE__ */ toRaw(target);
|
|
748
|
+
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
749
|
+
!readonly && track(rawTarget, "iterate", ITERATE_KEY);
|
|
750
|
+
return target.forEach((value, key) => {
|
|
751
|
+
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
(0, _vue_shared.extend)(instrumentations, readonly ? {
|
|
756
|
+
add: createReadonlyMethod("add"),
|
|
757
|
+
set: createReadonlyMethod("set"),
|
|
758
|
+
delete: createReadonlyMethod("delete"),
|
|
759
|
+
clear: createReadonlyMethod("clear")
|
|
760
|
+
} : {
|
|
761
|
+
add(value) {
|
|
762
|
+
const target = /* @__PURE__ */ toRaw(this);
|
|
763
|
+
const proto = getProto(target);
|
|
764
|
+
const rawValue = /* @__PURE__ */ toRaw(value);
|
|
765
|
+
const valueToAdd = !shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value) ? rawValue : value;
|
|
766
|
+
if (!(proto.has.call(target, valueToAdd) || (0, _vue_shared.hasChanged)(value, valueToAdd) && proto.has.call(target, value) || (0, _vue_shared.hasChanged)(rawValue, valueToAdd) && proto.has.call(target, rawValue))) {
|
|
767
|
+
target.add(valueToAdd);
|
|
768
|
+
trigger(target, "add", valueToAdd, valueToAdd);
|
|
769
|
+
}
|
|
770
|
+
return this;
|
|
771
|
+
},
|
|
772
|
+
set(key, value) {
|
|
773
|
+
if (!shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) value = /* @__PURE__ */ toRaw(value);
|
|
774
|
+
const target = /* @__PURE__ */ toRaw(this);
|
|
775
|
+
const { has, get } = getProto(target);
|
|
776
|
+
let hadKey = has.call(target, key);
|
|
777
|
+
if (!hadKey) {
|
|
778
|
+
key = /* @__PURE__ */ toRaw(key);
|
|
779
|
+
hadKey = has.call(target, key);
|
|
780
|
+
} else checkIdentityKeys(target, has, key);
|
|
781
|
+
const oldValue = get.call(target, key);
|
|
782
|
+
target.set(key, value);
|
|
783
|
+
if (!hadKey) trigger(target, "add", key, value);
|
|
784
|
+
else if ((0, _vue_shared.hasChanged)(value, oldValue)) trigger(target, "set", key, value, oldValue);
|
|
785
|
+
return this;
|
|
786
|
+
},
|
|
787
|
+
delete(key) {
|
|
788
|
+
const target = /* @__PURE__ */ toRaw(this);
|
|
789
|
+
const { has, get } = getProto(target);
|
|
790
|
+
let hadKey = has.call(target, key);
|
|
791
|
+
if (!hadKey) {
|
|
792
|
+
key = /* @__PURE__ */ toRaw(key);
|
|
793
|
+
hadKey = has.call(target, key);
|
|
794
|
+
} else checkIdentityKeys(target, has, key);
|
|
795
|
+
const oldValue = get ? get.call(target, key) : void 0;
|
|
796
|
+
const result = target.delete(key);
|
|
797
|
+
if (hadKey) trigger(target, "delete", key, void 0, oldValue);
|
|
798
|
+
return result;
|
|
799
|
+
},
|
|
800
|
+
clear() {
|
|
801
|
+
const target = /* @__PURE__ */ toRaw(this);
|
|
802
|
+
const hadItems = target.size !== 0;
|
|
803
|
+
const oldTarget = (0, _vue_shared.isMap)(target) ? new Map(target) : new Set(target);
|
|
804
|
+
const result = target.clear();
|
|
805
|
+
if (hadItems) trigger(target, "clear", void 0, void 0, oldTarget);
|
|
806
|
+
return result;
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
[
|
|
810
|
+
"keys",
|
|
811
|
+
"values",
|
|
812
|
+
"entries",
|
|
813
|
+
Symbol.iterator
|
|
814
|
+
].forEach((method) => {
|
|
815
|
+
instrumentations[method] = createIterableMethod(method, readonly, shallow);
|
|
816
|
+
});
|
|
817
|
+
return instrumentations;
|
|
818
|
+
}
|
|
819
|
+
function createInstrumentationGetter(isReadonly, shallow) {
|
|
820
|
+
const instrumentations = createInstrumentations(isReadonly, shallow);
|
|
821
|
+
return (target, key, receiver) => {
|
|
822
|
+
if (key === "__v_isReactive") return !isReadonly;
|
|
823
|
+
else if (key === "__v_isReadonly") return isReadonly;
|
|
824
|
+
else if (key === "__v_raw") return target;
|
|
825
|
+
return Reflect.get((0, _vue_shared.hasOwn)(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
const mutableCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(false, false) };
|
|
829
|
+
const shallowCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(false, true) };
|
|
830
|
+
const readonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, false) };
|
|
831
|
+
const shallowReadonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, true) };
|
|
1043
832
|
function checkIdentityKeys(target, has, key) {
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
833
|
+
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
834
|
+
if (rawKey !== key && has.call(target, rawKey)) {
|
|
835
|
+
const type = (0, _vue_shared.toRawType)(target);
|
|
836
|
+
warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region packages/reactivity/src/reactive.ts
|
|
1053
841
|
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
1054
842
|
const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
1055
843
|
const readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1056
844
|
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1057
845
|
function targetTypeMap(rawType) {
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
default:
|
|
1068
|
-
return 0 /* INVALID */;
|
|
1069
|
-
}
|
|
846
|
+
switch (rawType) {
|
|
847
|
+
case "Object":
|
|
848
|
+
case "Array": return 1;
|
|
849
|
+
case "Map":
|
|
850
|
+
case "Set":
|
|
851
|
+
case "WeakMap":
|
|
852
|
+
case "WeakSet": return 2;
|
|
853
|
+
default: return 0;
|
|
854
|
+
}
|
|
1070
855
|
}
|
|
1071
856
|
function getTargetType(value) {
|
|
1072
|
-
|
|
857
|
+
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap((0, _vue_shared.toRawType)(value));
|
|
1073
858
|
}
|
|
859
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1074
860
|
function reactive(target) {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
}
|
|
1078
|
-
return createReactiveObject(
|
|
1079
|
-
target,
|
|
1080
|
-
false,
|
|
1081
|
-
mutableHandlers,
|
|
1082
|
-
mutableCollectionHandlers,
|
|
1083
|
-
reactiveMap
|
|
1084
|
-
);
|
|
861
|
+
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
862
|
+
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
1085
863
|
}
|
|
864
|
+
/**
|
|
865
|
+
* Shallow version of {@link reactive}.
|
|
866
|
+
*
|
|
867
|
+
* Unlike {@link reactive}, there is no deep conversion: only root-level
|
|
868
|
+
* properties are reactive for a shallow reactive object. Property values are
|
|
869
|
+
* stored and exposed as-is - this also means properties with ref values will
|
|
870
|
+
* not be automatically unwrapped.
|
|
871
|
+
*
|
|
872
|
+
* @example
|
|
873
|
+
* ```js
|
|
874
|
+
* const state = shallowReactive({
|
|
875
|
+
* foo: 1,
|
|
876
|
+
* nested: {
|
|
877
|
+
* bar: 2
|
|
878
|
+
* }
|
|
879
|
+
* })
|
|
880
|
+
*
|
|
881
|
+
* // mutating state's own properties is reactive
|
|
882
|
+
* state.foo++
|
|
883
|
+
*
|
|
884
|
+
* // ...but does not convert nested objects
|
|
885
|
+
* isReactive(state.nested) // false
|
|
886
|
+
*
|
|
887
|
+
* // NOT reactive
|
|
888
|
+
* state.nested.bar++
|
|
889
|
+
* ```
|
|
890
|
+
*
|
|
891
|
+
* @param target - The source object.
|
|
892
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
|
893
|
+
*/
|
|
894
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1086
895
|
function shallowReactive(target) {
|
|
1087
|
-
|
|
1088
|
-
target,
|
|
1089
|
-
false,
|
|
1090
|
-
shallowReactiveHandlers,
|
|
1091
|
-
shallowCollectionHandlers,
|
|
1092
|
-
shallowReactiveMap
|
|
1093
|
-
);
|
|
896
|
+
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
1094
897
|
}
|
|
898
|
+
/**
|
|
899
|
+
* Takes an object (reactive or plain) or a ref and returns a readonly proxy to
|
|
900
|
+
* the original.
|
|
901
|
+
*
|
|
902
|
+
* A readonly proxy is deep: any nested property accessed will be readonly as
|
|
903
|
+
* well. It also has the same ref-unwrapping behavior as {@link reactive},
|
|
904
|
+
* except the unwrapped values will also be made readonly.
|
|
905
|
+
*
|
|
906
|
+
* @example
|
|
907
|
+
* ```js
|
|
908
|
+
* const original = reactive({ count: 0 })
|
|
909
|
+
*
|
|
910
|
+
* const copy = readonly(original)
|
|
911
|
+
*
|
|
912
|
+
* watchEffect(() => {
|
|
913
|
+
* // works for reactivity tracking
|
|
914
|
+
* console.log(copy.count)
|
|
915
|
+
* })
|
|
916
|
+
*
|
|
917
|
+
* // mutating original will trigger watchers relying on the copy
|
|
918
|
+
* original.count++
|
|
919
|
+
*
|
|
920
|
+
* // mutating the copy will fail and result in a warning
|
|
921
|
+
* copy.count++ // warning!
|
|
922
|
+
* ```
|
|
923
|
+
*
|
|
924
|
+
* @param target - The source object.
|
|
925
|
+
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
|
926
|
+
*/
|
|
927
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1095
928
|
function readonly(target) {
|
|
1096
|
-
|
|
1097
|
-
target,
|
|
1098
|
-
true,
|
|
1099
|
-
readonlyHandlers,
|
|
1100
|
-
readonlyCollectionHandlers,
|
|
1101
|
-
readonlyMap
|
|
1102
|
-
);
|
|
929
|
+
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
1103
930
|
}
|
|
931
|
+
/**
|
|
932
|
+
* Shallow version of {@link readonly}.
|
|
933
|
+
*
|
|
934
|
+
* Unlike {@link readonly}, there is no deep conversion: only root-level
|
|
935
|
+
* properties are made readonly. Property values are stored and exposed as-is -
|
|
936
|
+
* this also means properties with ref values will not be automatically
|
|
937
|
+
* unwrapped.
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```js
|
|
941
|
+
* const state = shallowReadonly({
|
|
942
|
+
* foo: 1,
|
|
943
|
+
* nested: {
|
|
944
|
+
* bar: 2
|
|
945
|
+
* }
|
|
946
|
+
* })
|
|
947
|
+
*
|
|
948
|
+
* // mutating state's own properties will fail
|
|
949
|
+
* state.foo++
|
|
950
|
+
*
|
|
951
|
+
* // ...but works on nested objects
|
|
952
|
+
* isReadonly(state.nested) // false
|
|
953
|
+
*
|
|
954
|
+
* // works
|
|
955
|
+
* state.nested.bar++
|
|
956
|
+
* ```
|
|
957
|
+
*
|
|
958
|
+
* @param target - The source object.
|
|
959
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
|
960
|
+
*/
|
|
961
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1104
962
|
function shallowReadonly(target) {
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
);
|
|
1121
|
-
}
|
|
1122
|
-
return target;
|
|
1123
|
-
}
|
|
1124
|
-
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
1125
|
-
return target;
|
|
1126
|
-
}
|
|
1127
|
-
const targetType = getTargetType(target);
|
|
1128
|
-
if (targetType === 0 /* INVALID */) {
|
|
1129
|
-
return target;
|
|
1130
|
-
}
|
|
1131
|
-
const existingProxy = proxyMap.get(target);
|
|
1132
|
-
if (existingProxy) {
|
|
1133
|
-
return existingProxy;
|
|
1134
|
-
}
|
|
1135
|
-
const proxy = new Proxy(
|
|
1136
|
-
target,
|
|
1137
|
-
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
|
|
1138
|
-
);
|
|
1139
|
-
proxyMap.set(target, proxy);
|
|
1140
|
-
return proxy;
|
|
963
|
+
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
964
|
+
}
|
|
965
|
+
function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
|
|
966
|
+
if (!(0, _vue_shared.isObject)(target)) {
|
|
967
|
+
warn(`value cannot be made ${isReadonly ? "readonly" : "reactive"}: ${String(target)}`);
|
|
968
|
+
return target;
|
|
969
|
+
}
|
|
970
|
+
if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
|
|
971
|
+
const targetType = getTargetType(target);
|
|
972
|
+
if (targetType === 0) return target;
|
|
973
|
+
const existingProxy = proxyMap.get(target);
|
|
974
|
+
if (existingProxy) return existingProxy;
|
|
975
|
+
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
976
|
+
proxyMap.set(target, proxy);
|
|
977
|
+
return proxy;
|
|
1141
978
|
}
|
|
979
|
+
/**
|
|
980
|
+
* Checks if an object is a proxy created by {@link reactive} or
|
|
981
|
+
* {@link shallowReactive} (or {@link ref} in some cases).
|
|
982
|
+
*
|
|
983
|
+
* @example
|
|
984
|
+
* ```js
|
|
985
|
+
* isReactive(reactive({})) // => true
|
|
986
|
+
* isReactive(readonly(reactive({}))) // => true
|
|
987
|
+
* isReactive(ref({}).value) // => true
|
|
988
|
+
* isReactive(readonly(ref({})).value) // => true
|
|
989
|
+
* isReactive(ref(true)) // => false
|
|
990
|
+
* isReactive(shallowRef({}).value) // => false
|
|
991
|
+
* isReactive(shallowReactive({})) // => true
|
|
992
|
+
* ```
|
|
993
|
+
*
|
|
994
|
+
* @param value - The value to check.
|
|
995
|
+
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
|
996
|
+
*/
|
|
997
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1142
998
|
function isReactive(value) {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
}
|
|
1146
|
-
return !!(value && value["__v_isReactive"]);
|
|
999
|
+
if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
1000
|
+
return !!(value && value["__v_isReactive"]);
|
|
1147
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Checks whether the passed value is a readonly object. The properties of a
|
|
1004
|
+
* readonly object can change, but they can't be assigned directly via the
|
|
1005
|
+
* passed object.
|
|
1006
|
+
*
|
|
1007
|
+
* The proxies created by {@link readonly} and {@link shallowReadonly} are
|
|
1008
|
+
* both considered readonly, as is a computed ref without a set function.
|
|
1009
|
+
*
|
|
1010
|
+
* @param value - The value to check.
|
|
1011
|
+
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
|
1012
|
+
*/
|
|
1013
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1148
1014
|
function isReadonly(value) {
|
|
1149
|
-
|
|
1015
|
+
return !!(value && value["__v_isReadonly"]);
|
|
1150
1016
|
}
|
|
1017
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1151
1018
|
function isShallow(value) {
|
|
1152
|
-
|
|
1019
|
+
return !!(value && value["__v_isShallow"]);
|
|
1153
1020
|
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Checks if an object is a proxy created by {@link reactive},
|
|
1023
|
+
* {@link readonly}, {@link shallowReactive} or {@link shallowReadonly}.
|
|
1024
|
+
*
|
|
1025
|
+
* @param value - The value to check.
|
|
1026
|
+
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
|
1027
|
+
*/
|
|
1028
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1154
1029
|
function isProxy(value) {
|
|
1155
|
-
|
|
1030
|
+
return value ? !!value["__v_raw"] : false;
|
|
1156
1031
|
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Returns the raw, original object of a Vue-created proxy.
|
|
1034
|
+
*
|
|
1035
|
+
* `toRaw()` can return the original object from proxies created by
|
|
1036
|
+
* {@link reactive}, {@link readonly}, {@link shallowReactive} or
|
|
1037
|
+
* {@link shallowReadonly}.
|
|
1038
|
+
*
|
|
1039
|
+
* This is an escape hatch that can be used to temporarily read without
|
|
1040
|
+
* incurring proxy access / tracking overhead or write without triggering
|
|
1041
|
+
* changes. It is **not** recommended to hold a persistent reference to the
|
|
1042
|
+
* original object. Use with caution.
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```js
|
|
1046
|
+
* const foo = {}
|
|
1047
|
+
* const reactiveFoo = reactive(foo)
|
|
1048
|
+
*
|
|
1049
|
+
* console.log(toRaw(reactiveFoo) === foo) // true
|
|
1050
|
+
* ```
|
|
1051
|
+
*
|
|
1052
|
+
* @param observed - The object for which the "raw" value is requested.
|
|
1053
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
|
1054
|
+
*/
|
|
1055
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1157
1056
|
function toRaw(observed) {
|
|
1158
|
-
|
|
1159
|
-
|
|
1057
|
+
const raw = observed && observed["__v_raw"];
|
|
1058
|
+
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
1160
1059
|
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Marks an object so that it will never be converted to a proxy. Returns the
|
|
1062
|
+
* object itself.
|
|
1063
|
+
*
|
|
1064
|
+
* @example
|
|
1065
|
+
* ```js
|
|
1066
|
+
* const foo = markRaw({})
|
|
1067
|
+
* console.log(isReactive(reactive(foo))) // false
|
|
1068
|
+
*
|
|
1069
|
+
* // also works when nested inside other reactive objects
|
|
1070
|
+
* const bar = reactive({ foo })
|
|
1071
|
+
* console.log(isReactive(bar.foo)) // false
|
|
1072
|
+
* ```
|
|
1073
|
+
*
|
|
1074
|
+
* **Warning:** `markRaw()` together with the shallow APIs such as
|
|
1075
|
+
* {@link shallowReactive} allow you to selectively opt-out of the default
|
|
1076
|
+
* deep reactive/readonly conversion and embed raw, non-proxied objects in your
|
|
1077
|
+
* state graph.
|
|
1078
|
+
*
|
|
1079
|
+
* @param value - The object to be marked as "raw".
|
|
1080
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#markraw}
|
|
1081
|
+
*/
|
|
1161
1082
|
function markRaw(value) {
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1083
|
+
if (!(0, _vue_shared.hasOwn)(value, "__v_skip") && Object.isExtensible(value)) (0, _vue_shared.def)(value, "__v_skip", true);
|
|
1084
|
+
return value;
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Returns a reactive proxy of the given value (if possible).
|
|
1088
|
+
*
|
|
1089
|
+
* If the given value is not an object, the original value itself is returned.
|
|
1090
|
+
*
|
|
1091
|
+
* @param value - The value for which a reactive proxy shall be created.
|
|
1092
|
+
*/
|
|
1093
|
+
const toReactive = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */ reactive(value) : value;
|
|
1094
|
+
/**
|
|
1095
|
+
* Returns a readonly proxy of the given value (if possible).
|
|
1096
|
+
*
|
|
1097
|
+
* If the given value is not an object, the original value itself is returned.
|
|
1098
|
+
*
|
|
1099
|
+
* @param value - The value for which a readonly proxy shall be created.
|
|
1100
|
+
*/
|
|
1101
|
+
const toReadonly = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1102
|
+
//#endregion
|
|
1103
|
+
//#region packages/reactivity/src/ref.ts
|
|
1104
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1170
1105
|
function isRef(r) {
|
|
1171
|
-
|
|
1106
|
+
return r ? r["__v_isRef"] === true : false;
|
|
1172
1107
|
}
|
|
1108
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1173
1109
|
function ref(value) {
|
|
1174
|
-
|
|
1110
|
+
return createRef(value, toReactive);
|
|
1175
1111
|
}
|
|
1112
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1176
1113
|
function shallowRef(value) {
|
|
1177
|
-
|
|
1114
|
+
return createRef(value);
|
|
1178
1115
|
}
|
|
1179
1116
|
function createRef(rawValue, wrap) {
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1117
|
+
if (/* @__PURE__ */ isRef(rawValue)) return rawValue;
|
|
1118
|
+
return new RefImpl(rawValue, wrap);
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* @internal
|
|
1122
|
+
*/
|
|
1123
|
+
var RefImpl = class {
|
|
1124
|
+
constructor(value, wrap) {
|
|
1125
|
+
this.subs = void 0;
|
|
1126
|
+
this.subsTail = void 0;
|
|
1127
|
+
this.flags = ReactiveFlags$1.Mutable;
|
|
1128
|
+
this.__v_isRef = true;
|
|
1129
|
+
this.__v_isShallow = false;
|
|
1130
|
+
this._oldValue = this._rawValue = wrap ? /* @__PURE__ */ toRaw(value) : value;
|
|
1131
|
+
this._value = wrap ? wrap(value) : value;
|
|
1132
|
+
this._wrap = wrap;
|
|
1133
|
+
this["__v_isShallow"] = !wrap;
|
|
1134
|
+
}
|
|
1135
|
+
get dep() {
|
|
1136
|
+
return this;
|
|
1137
|
+
}
|
|
1138
|
+
get value() {
|
|
1139
|
+
trackRef(this);
|
|
1140
|
+
if (this.flags & ReactiveFlags$1.Dirty && this.update()) {
|
|
1141
|
+
const subs = this.subs;
|
|
1142
|
+
if (subs !== void 0) shallowPropagate(subs);
|
|
1143
|
+
}
|
|
1144
|
+
return this._value;
|
|
1145
|
+
}
|
|
1146
|
+
set value(newValue) {
|
|
1147
|
+
const oldValue = this._rawValue;
|
|
1148
|
+
const useDirectValue = this["__v_isShallow"] || /* @__PURE__ */ isShallow(newValue) || /* @__PURE__ */ isReadonly(newValue);
|
|
1149
|
+
newValue = useDirectValue ? newValue : /* @__PURE__ */ toRaw(newValue);
|
|
1150
|
+
if ((0, _vue_shared.hasChanged)(newValue, oldValue)) {
|
|
1151
|
+
this.flags |= ReactiveFlags$1.Dirty;
|
|
1152
|
+
this._rawValue = newValue;
|
|
1153
|
+
this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
|
|
1154
|
+
const subs = this.subs;
|
|
1155
|
+
if (subs !== void 0) {
|
|
1156
|
+
triggerEventInfos.push({
|
|
1157
|
+
target: this,
|
|
1158
|
+
type: "set",
|
|
1159
|
+
key: "value",
|
|
1160
|
+
newValue,
|
|
1161
|
+
oldValue
|
|
1162
|
+
});
|
|
1163
|
+
propagate(subs);
|
|
1164
|
+
if (!batchDepth) flush();
|
|
1165
|
+
triggerEventInfos.pop();
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
update() {
|
|
1170
|
+
this.flags &= ~ReactiveFlags$1.Dirty;
|
|
1171
|
+
return (0, _vue_shared.hasChanged)(this._oldValue, this._oldValue = this._rawValue);
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
/**
|
|
1175
|
+
* Force trigger effects that depends on a shallow ref. This is typically used
|
|
1176
|
+
* after making deep mutations to the inner value of a shallow ref.
|
|
1177
|
+
*
|
|
1178
|
+
* @example
|
|
1179
|
+
* ```js
|
|
1180
|
+
* const shallow = shallowRef({
|
|
1181
|
+
* greet: 'Hello, world'
|
|
1182
|
+
* })
|
|
1183
|
+
*
|
|
1184
|
+
* // Logs "Hello, world" once for the first run-through
|
|
1185
|
+
* watchEffect(() => {
|
|
1186
|
+
* console.log(shallow.value.greet)
|
|
1187
|
+
* })
|
|
1188
|
+
*
|
|
1189
|
+
* // This won't trigger the effect because the ref is shallow
|
|
1190
|
+
* shallow.value.greet = 'Hello, universe'
|
|
1191
|
+
*
|
|
1192
|
+
* // Logs "Hello, universe"
|
|
1193
|
+
* triggerRef(shallow)
|
|
1194
|
+
* ```
|
|
1195
|
+
*
|
|
1196
|
+
* @param ref - The ref whose tied effects shall be executed.
|
|
1197
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#triggerref}
|
|
1198
|
+
*/
|
|
1199
|
+
function triggerRef(ref) {
|
|
1200
|
+
const dep = ref.dep;
|
|
1201
|
+
if (dep !== void 0 && dep.subs !== void 0) {
|
|
1202
|
+
propagate(dep.subs);
|
|
1203
|
+
shallowPropagate(dep.subs);
|
|
1204
|
+
if (!batchDepth) flush();
|
|
1205
|
+
}
|
|
1261
1206
|
}
|
|
1262
1207
|
function trackRef(dep) {
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
function
|
|
1275
|
-
|
|
1208
|
+
if (activeSub !== void 0) {
|
|
1209
|
+
onTrack(activeSub, {
|
|
1210
|
+
target: dep,
|
|
1211
|
+
type: "get",
|
|
1212
|
+
key: "value"
|
|
1213
|
+
});
|
|
1214
|
+
link(dep, activeSub);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Returns the inner value if the argument is a ref, otherwise return the
|
|
1219
|
+
* argument itself. This is a sugar function for
|
|
1220
|
+
* `val = isRef(val) ? val.value : val`.
|
|
1221
|
+
*
|
|
1222
|
+
* @example
|
|
1223
|
+
* ```js
|
|
1224
|
+
* function useFoo(x: number | Ref<number>) {
|
|
1225
|
+
* const unwrapped = unref(x)
|
|
1226
|
+
* // unwrapped is guaranteed to be number now
|
|
1227
|
+
* }
|
|
1228
|
+
* ```
|
|
1229
|
+
*
|
|
1230
|
+
* @param ref - Ref or plain value to be converted into the plain value.
|
|
1231
|
+
* @see {@link https://vuejs.org/api/reactivity-utilities.html#unref}
|
|
1232
|
+
*/
|
|
1233
|
+
function unref(ref) {
|
|
1234
|
+
return /* @__PURE__ */ isRef(ref) ? ref.value : ref;
|
|
1276
1235
|
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Normalizes values / refs / getters to values.
|
|
1238
|
+
* This is similar to {@link unref}, except that it also normalizes getters.
|
|
1239
|
+
* If the argument is a getter, it will be invoked and its return value will
|
|
1240
|
+
* be returned.
|
|
1241
|
+
*
|
|
1242
|
+
* @example
|
|
1243
|
+
* ```js
|
|
1244
|
+
* toValue(1) // 1
|
|
1245
|
+
* toValue(ref(1)) // 1
|
|
1246
|
+
* toValue(() => 1) // 1
|
|
1247
|
+
* ```
|
|
1248
|
+
*
|
|
1249
|
+
* @param source - A getter, an existing ref, or a non-function value.
|
|
1250
|
+
* @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue}
|
|
1251
|
+
*/
|
|
1277
1252
|
function toValue(source) {
|
|
1278
|
-
|
|
1253
|
+
return (0, _vue_shared.isFunction)(source) ? source() : unref(source);
|
|
1279
1254
|
}
|
|
1280
1255
|
const shallowUnwrapHandlers = {
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1256
|
+
get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
|
|
1257
|
+
set: (target, key, value, receiver) => {
|
|
1258
|
+
const oldValue = target[key];
|
|
1259
|
+
if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
|
|
1260
|
+
oldValue.value = value;
|
|
1261
|
+
return true;
|
|
1262
|
+
} else return Reflect.set(target, key, value, receiver);
|
|
1263
|
+
}
|
|
1291
1264
|
};
|
|
1265
|
+
/**
|
|
1266
|
+
* Returns a proxy for the given object that shallowly unwraps properties that
|
|
1267
|
+
* are refs. If the object already is reactive, it's returned as-is. If not, a
|
|
1268
|
+
* new reactive proxy is created.
|
|
1269
|
+
*
|
|
1270
|
+
* @param objectWithRefs - Either an already-reactive object or a simple object
|
|
1271
|
+
* that contains refs.
|
|
1272
|
+
*/
|
|
1292
1273
|
function proxyRefs(objectWithRefs) {
|
|
1293
|
-
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1274
|
+
return /* @__PURE__ */ isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1275
|
+
}
|
|
1276
|
+
var CustomRefImpl = class {
|
|
1277
|
+
constructor(factory) {
|
|
1278
|
+
this.subs = void 0;
|
|
1279
|
+
this.subsTail = void 0;
|
|
1280
|
+
this.flags = ReactiveFlags$1.None;
|
|
1281
|
+
this["__v_isRef"] = true;
|
|
1282
|
+
this._value = void 0;
|
|
1283
|
+
const { get, set } = factory(() => trackRef(this), () => triggerRef(this));
|
|
1284
|
+
this._get = get;
|
|
1285
|
+
this._set = set;
|
|
1286
|
+
}
|
|
1287
|
+
get dep() {
|
|
1288
|
+
return this;
|
|
1289
|
+
}
|
|
1290
|
+
get value() {
|
|
1291
|
+
return this._value = this._get();
|
|
1292
|
+
}
|
|
1293
|
+
set value(newVal) {
|
|
1294
|
+
this._set(newVal);
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
/**
|
|
1298
|
+
* Creates a customized ref with explicit control over its dependency tracking
|
|
1299
|
+
* and updates triggering.
|
|
1300
|
+
*
|
|
1301
|
+
* @param factory - The function that receives the `track` and `trigger` callbacks.
|
|
1302
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#customref}
|
|
1303
|
+
*/
|
|
1319
1304
|
function customRef(factory) {
|
|
1320
|
-
|
|
1305
|
+
return new CustomRefImpl(factory);
|
|
1321
1306
|
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Converts a reactive object to a plain object where each property of the
|
|
1309
|
+
* resulting object is a ref pointing to the corresponding property of the
|
|
1310
|
+
* original object. Each individual ref is created using {@link toRef}.
|
|
1311
|
+
*
|
|
1312
|
+
* @param object - Reactive object to be made into an object of linked refs.
|
|
1313
|
+
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
|
1314
|
+
*/
|
|
1315
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1322
1316
|
function toRefs(object) {
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
}
|
|
1374
|
-
get value() {
|
|
1375
|
-
return this._value = this._getter();
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1317
|
+
const ret = (0, _vue_shared.isArray)(object) ? new Array(object.length) : {};
|
|
1318
|
+
for (const key in object) ret[key] = propertyToRef(object, key);
|
|
1319
|
+
return ret;
|
|
1320
|
+
}
|
|
1321
|
+
var ObjectRefImpl = class {
|
|
1322
|
+
constructor(_object, key, _defaultValue) {
|
|
1323
|
+
this._object = _object;
|
|
1324
|
+
this._defaultValue = _defaultValue;
|
|
1325
|
+
this["__v_isRef"] = true;
|
|
1326
|
+
this._value = void 0;
|
|
1327
|
+
this._key = (0, _vue_shared.isSymbol)(key) ? key : String(key);
|
|
1328
|
+
this._raw = /* @__PURE__ */ toRaw(_object);
|
|
1329
|
+
let shallow = true;
|
|
1330
|
+
let obj = _object;
|
|
1331
|
+
if (!(0, _vue_shared.isArray)(_object) || (0, _vue_shared.isSymbol)(this._key) || !(0, _vue_shared.isIntegerKey)(this._key)) do
|
|
1332
|
+
shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
|
|
1333
|
+
while (shallow && (obj = obj["__v_raw"]));
|
|
1334
|
+
this._shallow = shallow;
|
|
1335
|
+
}
|
|
1336
|
+
get value() {
|
|
1337
|
+
let val = this._object[this._key];
|
|
1338
|
+
if (this._shallow) val = unref(val);
|
|
1339
|
+
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1340
|
+
}
|
|
1341
|
+
set value(newVal) {
|
|
1342
|
+
if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {
|
|
1343
|
+
const nestedRef = this._object[this._key];
|
|
1344
|
+
if (/* @__PURE__ */ isRef(nestedRef)) {
|
|
1345
|
+
nestedRef.value = newVal;
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
this._object[this._key] = newVal;
|
|
1350
|
+
}
|
|
1351
|
+
get dep() {
|
|
1352
|
+
return getDepFromReactive(this._raw, this._key);
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
var GetterRefImpl = class {
|
|
1356
|
+
constructor(_getter) {
|
|
1357
|
+
this._getter = _getter;
|
|
1358
|
+
this["__v_isRef"] = true;
|
|
1359
|
+
this["__v_isReadonly"] = true;
|
|
1360
|
+
this._value = void 0;
|
|
1361
|
+
}
|
|
1362
|
+
get value() {
|
|
1363
|
+
return this._value = this._getter();
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1378
1367
|
function toRef(source, key, defaultValue) {
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
} else if (shared.isObject(source) && arguments.length > 1) {
|
|
1384
|
-
return propertyToRef(source, key, defaultValue);
|
|
1385
|
-
} else {
|
|
1386
|
-
return ref(source);
|
|
1387
|
-
}
|
|
1368
|
+
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1369
|
+
else if ((0, _vue_shared.isFunction)(source)) return new GetterRefImpl(source);
|
|
1370
|
+
else if ((0, _vue_shared.isObject)(source) && arguments.length > 1) return propertyToRef(source, key, defaultValue);
|
|
1371
|
+
else return /* @__PURE__ */ ref(source);
|
|
1388
1372
|
}
|
|
1389
1373
|
function propertyToRef(source, key, defaultValue) {
|
|
1390
|
-
|
|
1374
|
+
return new ObjectRefImpl(source, key, defaultValue);
|
|
1391
1375
|
}
|
|
1392
|
-
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region packages/reactivity/src/effect.ts
|
|
1393
1378
|
const EffectFlags = {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1379
|
+
"ALLOW_RECURSE": 128,
|
|
1380
|
+
"128": "ALLOW_RECURSE",
|
|
1381
|
+
"PAUSED": 256,
|
|
1382
|
+
"256": "PAUSED",
|
|
1383
|
+
"STOP": 1024,
|
|
1384
|
+
"1024": "STOP"
|
|
1400
1385
|
};
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
if (!this.active) {
|
|
1462
|
-
return;
|
|
1463
|
-
}
|
|
1464
|
-
this.flags = 1024;
|
|
1465
|
-
let dep = this.deps;
|
|
1466
|
-
while (dep !== void 0) {
|
|
1467
|
-
dep = unlink(dep, this);
|
|
1468
|
-
}
|
|
1469
|
-
const sub = this.subs;
|
|
1470
|
-
if (sub !== void 0) {
|
|
1471
|
-
unlink(sub);
|
|
1472
|
-
}
|
|
1473
|
-
cleanup(this);
|
|
1474
|
-
}
|
|
1475
|
-
get dirty() {
|
|
1476
|
-
const flags = this.flags;
|
|
1477
|
-
if (flags & ReactiveFlags$1.Dirty) {
|
|
1478
|
-
return true;
|
|
1479
|
-
}
|
|
1480
|
-
if (flags & ReactiveFlags$1.Pending) {
|
|
1481
|
-
if (checkDirty(this.deps, this)) {
|
|
1482
|
-
this.flags = flags | ReactiveFlags$1.Dirty;
|
|
1483
|
-
return true;
|
|
1484
|
-
} else {
|
|
1485
|
-
this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
return false;
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
{
|
|
1492
|
-
setupOnTrigger(ReactiveEffect);
|
|
1493
|
-
}
|
|
1386
|
+
var ReactiveEffect = class {
|
|
1387
|
+
fn() {}
|
|
1388
|
+
constructor(fn) {
|
|
1389
|
+
this.deps = void 0;
|
|
1390
|
+
this.depsTail = void 0;
|
|
1391
|
+
this.subs = void 0;
|
|
1392
|
+
this.subsTail = void 0;
|
|
1393
|
+
this.flags = 18;
|
|
1394
|
+
this.cleanups = [];
|
|
1395
|
+
this.cleanupsLength = 0;
|
|
1396
|
+
if (fn !== void 0) this.fn = fn;
|
|
1397
|
+
if (activeEffectScope) link(this, activeEffectScope);
|
|
1398
|
+
}
|
|
1399
|
+
get active() {
|
|
1400
|
+
return !(this.flags & 1024);
|
|
1401
|
+
}
|
|
1402
|
+
pause() {
|
|
1403
|
+
this.flags |= 256;
|
|
1404
|
+
}
|
|
1405
|
+
resume() {
|
|
1406
|
+
if ((this.flags &= -257) & 48) this.notify();
|
|
1407
|
+
}
|
|
1408
|
+
notify() {
|
|
1409
|
+
if (!(this.flags & 256) && this.dirty) this.run();
|
|
1410
|
+
}
|
|
1411
|
+
run() {
|
|
1412
|
+
if (!this.active) return this.fn();
|
|
1413
|
+
cleanup(this);
|
|
1414
|
+
const prevSub = startTracking(this);
|
|
1415
|
+
try {
|
|
1416
|
+
return this.fn();
|
|
1417
|
+
} finally {
|
|
1418
|
+
endTracking(this, prevSub);
|
|
1419
|
+
const flags = this.flags;
|
|
1420
|
+
if ((flags & 136) === 136) {
|
|
1421
|
+
this.flags = flags & -9;
|
|
1422
|
+
this.notify();
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
stop() {
|
|
1427
|
+
if (!this.active) return;
|
|
1428
|
+
this.flags = 1024;
|
|
1429
|
+
let dep = this.deps;
|
|
1430
|
+
while (dep !== void 0) dep = unlink(dep, this);
|
|
1431
|
+
const sub = this.subs;
|
|
1432
|
+
if (sub !== void 0) unlink(sub);
|
|
1433
|
+
cleanup(this);
|
|
1434
|
+
}
|
|
1435
|
+
get dirty() {
|
|
1436
|
+
const flags = this.flags;
|
|
1437
|
+
if (flags & 16) return true;
|
|
1438
|
+
if (flags & 32) if (checkDirty(this.deps, this)) {
|
|
1439
|
+
this.flags = flags | 16;
|
|
1440
|
+
return true;
|
|
1441
|
+
} else this.flags = flags & -33;
|
|
1442
|
+
return false;
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1445
|
+
setupOnTrigger(ReactiveEffect);
|
|
1494
1446
|
function effect(fn, options) {
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
}
|
|
1525
|
-
const runner = e.run.bind(e);
|
|
1526
|
-
runner.effect = e;
|
|
1527
|
-
return runner;
|
|
1447
|
+
if (fn.effect instanceof ReactiveEffect) fn = fn.effect.fn;
|
|
1448
|
+
const e = new ReactiveEffect(fn);
|
|
1449
|
+
if (options) {
|
|
1450
|
+
const { onStop, scheduler } = options;
|
|
1451
|
+
if (onStop) {
|
|
1452
|
+
options.onStop = void 0;
|
|
1453
|
+
const stop = e.stop.bind(e);
|
|
1454
|
+
e.stop = () => {
|
|
1455
|
+
stop();
|
|
1456
|
+
onStop();
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
if (scheduler) {
|
|
1460
|
+
options.scheduler = void 0;
|
|
1461
|
+
e.notify = () => {
|
|
1462
|
+
if (!(e.flags & 256)) scheduler();
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
(0, _vue_shared.extend)(e, options);
|
|
1466
|
+
}
|
|
1467
|
+
try {
|
|
1468
|
+
e.run();
|
|
1469
|
+
} catch (err) {
|
|
1470
|
+
e.stop();
|
|
1471
|
+
throw err;
|
|
1472
|
+
}
|
|
1473
|
+
const runner = e.run.bind(e);
|
|
1474
|
+
runner.effect = e;
|
|
1475
|
+
return runner;
|
|
1528
1476
|
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Stops the effect associated with the given runner.
|
|
1479
|
+
*
|
|
1480
|
+
* @param runner - Association with the effect to stop tracking.
|
|
1481
|
+
*/
|
|
1529
1482
|
function stop(runner) {
|
|
1530
|
-
|
|
1483
|
+
runner.effect.stop();
|
|
1531
1484
|
}
|
|
1532
1485
|
const resetTrackingStack = [];
|
|
1486
|
+
/**
|
|
1487
|
+
* Temporarily pauses tracking.
|
|
1488
|
+
*/
|
|
1533
1489
|
function pauseTracking() {
|
|
1534
|
-
|
|
1535
|
-
|
|
1490
|
+
resetTrackingStack.push(activeSub);
|
|
1491
|
+
setActiveSub();
|
|
1536
1492
|
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Re-enables effect tracking (if it was paused).
|
|
1495
|
+
*/
|
|
1537
1496
|
function enableTracking() {
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
break;
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1497
|
+
if (!(activeSub === void 0)) resetTrackingStack.push(activeSub);
|
|
1498
|
+
else {
|
|
1499
|
+
resetTrackingStack.push(void 0);
|
|
1500
|
+
for (let i = resetTrackingStack.length - 1; i >= 0; i--) if (resetTrackingStack[i] !== void 0) {
|
|
1501
|
+
setActiveSub(resetTrackingStack[i]);
|
|
1502
|
+
break;
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1550
1505
|
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Resets the previous global effect tracking state.
|
|
1508
|
+
*/
|
|
1551
1509
|
function resetTracking() {
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
);
|
|
1556
|
-
}
|
|
1557
|
-
if (resetTrackingStack.length) {
|
|
1558
|
-
setActiveSub(resetTrackingStack.pop());
|
|
1559
|
-
} else {
|
|
1560
|
-
setActiveSub();
|
|
1561
|
-
}
|
|
1510
|
+
if (resetTrackingStack.length === 0) warn("resetTracking() was called when there was no active tracking to reset.");
|
|
1511
|
+
if (resetTrackingStack.length) setActiveSub(resetTrackingStack.pop());
|
|
1512
|
+
else setActiveSub();
|
|
1562
1513
|
}
|
|
1563
1514
|
function cleanup(sub) {
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
sub.cleanupsLength = 0;
|
|
1570
|
-
}
|
|
1515
|
+
const l = sub.cleanupsLength;
|
|
1516
|
+
if (l) {
|
|
1517
|
+
for (let i = 0; i < l; i++) sub.cleanups[i]();
|
|
1518
|
+
sub.cleanupsLength = 0;
|
|
1519
|
+
}
|
|
1571
1520
|
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Registers a cleanup function for the current active effect.
|
|
1523
|
+
* The cleanup function is called right before the next effect run, or when the
|
|
1524
|
+
* effect is stopped.
|
|
1525
|
+
*
|
|
1526
|
+
* Throws a warning if there is no current active effect. The warning can be
|
|
1527
|
+
* suppressed by passing `true` to the second argument.
|
|
1528
|
+
*
|
|
1529
|
+
* @param fn - the cleanup function to be registered
|
|
1530
|
+
* @param failSilently - if `true`, will not throw warning when called without
|
|
1531
|
+
* an active effect.
|
|
1532
|
+
*/
|
|
1572
1533
|
function onEffectCleanup(fn, failSilently = false) {
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
} else if (!failSilently) {
|
|
1576
|
-
warn(
|
|
1577
|
-
`onEffectCleanup() was called when there was no active effect to associate with.`
|
|
1578
|
-
);
|
|
1579
|
-
}
|
|
1534
|
+
if (activeSub instanceof ReactiveEffect) activeSub.cleanups[activeSub.cleanupsLength++] = () => cleanupEffect(fn);
|
|
1535
|
+
else if (!failSilently) warn("onEffectCleanup() was called when there was no active effect to associate with.");
|
|
1580
1536
|
}
|
|
1581
1537
|
function cleanupEffect(fn) {
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1538
|
+
const prevSub = setActiveSub();
|
|
1539
|
+
try {
|
|
1540
|
+
fn();
|
|
1541
|
+
} finally {
|
|
1542
|
+
setActiveSub(prevSub);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
//#endregion
|
|
1546
|
+
//#region packages/reactivity/src/effectScope.ts
|
|
1590
1547
|
let activeEffectScope;
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
dep = dep.nextDep;
|
|
1668
|
-
node.stop();
|
|
1669
|
-
} else {
|
|
1670
|
-
dep = unlink(dep, this);
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
1673
|
-
cleanup(this);
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1548
|
+
var EffectScope = class {
|
|
1549
|
+
constructor(detached = false) {
|
|
1550
|
+
this.deps = void 0;
|
|
1551
|
+
this.depsTail = void 0;
|
|
1552
|
+
this.subs = void 0;
|
|
1553
|
+
this.subsTail = void 0;
|
|
1554
|
+
this.flags = 0;
|
|
1555
|
+
this.cleanups = [];
|
|
1556
|
+
this.cleanupsLength = 0;
|
|
1557
|
+
if (!detached && activeEffectScope) link(this, activeEffectScope);
|
|
1558
|
+
}
|
|
1559
|
+
get active() {
|
|
1560
|
+
return !(this.flags & 1024);
|
|
1561
|
+
}
|
|
1562
|
+
pause() {
|
|
1563
|
+
if (!(this.flags & 256)) {
|
|
1564
|
+
this.flags |= 256;
|
|
1565
|
+
for (let link = this.deps; link !== void 0; link = link.nextDep) {
|
|
1566
|
+
const dep = link.dep;
|
|
1567
|
+
if ("pause" in dep) dep.pause();
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Resumes the effect scope, including all child scopes and effects.
|
|
1573
|
+
*/
|
|
1574
|
+
resume() {
|
|
1575
|
+
const flags = this.flags;
|
|
1576
|
+
if (flags & 256) {
|
|
1577
|
+
this.flags = flags & -257;
|
|
1578
|
+
for (let link = this.deps; link !== void 0; link = link.nextDep) {
|
|
1579
|
+
const dep = link.dep;
|
|
1580
|
+
if ("resume" in dep) dep.resume();
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
run(fn) {
|
|
1585
|
+
const prevScope = activeEffectScope;
|
|
1586
|
+
try {
|
|
1587
|
+
activeEffectScope = this;
|
|
1588
|
+
return fn();
|
|
1589
|
+
} finally {
|
|
1590
|
+
activeEffectScope = prevScope;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
stop() {
|
|
1594
|
+
if (!this.active) return;
|
|
1595
|
+
this.flags = 1024;
|
|
1596
|
+
this.reset();
|
|
1597
|
+
const sub = this.subs;
|
|
1598
|
+
if (sub !== void 0) unlink(sub);
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* @internal
|
|
1602
|
+
*/
|
|
1603
|
+
reset() {
|
|
1604
|
+
let dep = this.deps;
|
|
1605
|
+
while (dep !== void 0) {
|
|
1606
|
+
const node = dep.dep;
|
|
1607
|
+
if ("stop" in node) {
|
|
1608
|
+
dep = dep.nextDep;
|
|
1609
|
+
node.stop();
|
|
1610
|
+
} else dep = unlink(dep, this);
|
|
1611
|
+
}
|
|
1612
|
+
cleanup(this);
|
|
1613
|
+
}
|
|
1614
|
+
};
|
|
1615
|
+
/**
|
|
1616
|
+
* Creates an effect scope object which can capture the reactive effects (i.e.
|
|
1617
|
+
* computed and watchers) created within it so that these effects can be
|
|
1618
|
+
* disposed together. For detailed use cases of this API, please consult its
|
|
1619
|
+
* corresponding {@link https://github.com/vuejs/rfcs/blob/master/active-rfcs/0041-reactivity-effect-scope.md | RFC}.
|
|
1620
|
+
*
|
|
1621
|
+
* @param detached - Can be used to create a "detached" effect scope.
|
|
1622
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#effectscope}
|
|
1623
|
+
*/
|
|
1676
1624
|
function effectScope(detached) {
|
|
1677
|
-
|
|
1625
|
+
return new EffectScope(detached);
|
|
1678
1626
|
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Returns the current active effect scope if there is one.
|
|
1629
|
+
*
|
|
1630
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#getcurrentscope}
|
|
1631
|
+
*/
|
|
1679
1632
|
function getCurrentScope() {
|
|
1680
|
-
|
|
1633
|
+
return activeEffectScope;
|
|
1681
1634
|
}
|
|
1682
1635
|
function setCurrentScope(scope) {
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1636
|
+
try {
|
|
1637
|
+
return activeEffectScope;
|
|
1638
|
+
} finally {
|
|
1639
|
+
activeEffectScope = scope;
|
|
1640
|
+
}
|
|
1688
1641
|
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Registers a dispose callback on the current active effect scope. The
|
|
1644
|
+
* callback will be invoked when the associated effect scope is stopped.
|
|
1645
|
+
*
|
|
1646
|
+
* @param fn - The callback function to attach to the scope's cleanup.
|
|
1647
|
+
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
|
|
1648
|
+
*/
|
|
1689
1649
|
function onScopeDispose(fn, failSilently = false) {
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
} else if (!failSilently) {
|
|
1693
|
-
warn(
|
|
1694
|
-
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
1695
|
-
);
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
class ComputedRefImpl {
|
|
1700
|
-
constructor(fn, setter) {
|
|
1701
|
-
this.fn = fn;
|
|
1702
|
-
this.setter = setter;
|
|
1703
|
-
/**
|
|
1704
|
-
* @internal
|
|
1705
|
-
*/
|
|
1706
|
-
this._value = void 0;
|
|
1707
|
-
this.subs = void 0;
|
|
1708
|
-
this.subsTail = void 0;
|
|
1709
|
-
this.deps = void 0;
|
|
1710
|
-
this.depsTail = void 0;
|
|
1711
|
-
this.flags = ReactiveFlags$1.Mutable | ReactiveFlags$1.Dirty;
|
|
1712
|
-
/**
|
|
1713
|
-
* @internal
|
|
1714
|
-
*/
|
|
1715
|
-
this.__v_isRef = true;
|
|
1716
|
-
this["__v_isReadonly"] = !setter;
|
|
1717
|
-
}
|
|
1718
|
-
// TODO isolatedDeclarations "__v_isReadonly"
|
|
1719
|
-
// for backwards compat
|
|
1720
|
-
get effect() {
|
|
1721
|
-
return this;
|
|
1722
|
-
}
|
|
1723
|
-
// for backwards compat
|
|
1724
|
-
get dep() {
|
|
1725
|
-
return this;
|
|
1726
|
-
}
|
|
1727
|
-
/**
|
|
1728
|
-
* @internal
|
|
1729
|
-
* for backwards compat
|
|
1730
|
-
*/
|
|
1731
|
-
get _dirty() {
|
|
1732
|
-
const flags = this.flags;
|
|
1733
|
-
if (flags & ReactiveFlags$1.Dirty) {
|
|
1734
|
-
return true;
|
|
1735
|
-
}
|
|
1736
|
-
if (flags & ReactiveFlags$1.Pending) {
|
|
1737
|
-
if (checkDirty(this.deps, this)) {
|
|
1738
|
-
this.flags = flags | ReactiveFlags$1.Dirty;
|
|
1739
|
-
return true;
|
|
1740
|
-
} else {
|
|
1741
|
-
this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
return false;
|
|
1745
|
-
}
|
|
1746
|
-
/**
|
|
1747
|
-
* @internal
|
|
1748
|
-
* for backwards compat
|
|
1749
|
-
*/
|
|
1750
|
-
set _dirty(v) {
|
|
1751
|
-
if (v) {
|
|
1752
|
-
this.flags |= ReactiveFlags$1.Dirty;
|
|
1753
|
-
} else {
|
|
1754
|
-
this.flags &= ~(ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending);
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
get value() {
|
|
1758
|
-
const flags = this.flags;
|
|
1759
|
-
if (flags & ReactiveFlags$1.Dirty || flags & ReactiveFlags$1.Pending && checkDirty(this.deps, this)) {
|
|
1760
|
-
if (this.update()) {
|
|
1761
|
-
const subs = this.subs;
|
|
1762
|
-
if (subs !== void 0) {
|
|
1763
|
-
shallowPropagate(subs);
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
} else if (flags & ReactiveFlags$1.Pending) {
|
|
1767
|
-
this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1768
|
-
}
|
|
1769
|
-
if (activeSub !== void 0) {
|
|
1770
|
-
{
|
|
1771
|
-
onTrack(activeSub, {
|
|
1772
|
-
target: this,
|
|
1773
|
-
type: "get",
|
|
1774
|
-
key: "value"
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
link(this, activeSub);
|
|
1778
|
-
} else if (activeEffectScope !== void 0) {
|
|
1779
|
-
link(this, activeEffectScope);
|
|
1780
|
-
}
|
|
1781
|
-
return this._value;
|
|
1782
|
-
}
|
|
1783
|
-
set value(newValue) {
|
|
1784
|
-
if (this.setter) {
|
|
1785
|
-
this.setter(newValue);
|
|
1786
|
-
} else {
|
|
1787
|
-
warn("Write operation failed: computed value is readonly");
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
update() {
|
|
1791
|
-
const prevSub = startTracking(this);
|
|
1792
|
-
try {
|
|
1793
|
-
const oldValue = this._value;
|
|
1794
|
-
const newValue = this.fn(oldValue);
|
|
1795
|
-
if (shared.hasChanged(oldValue, newValue)) {
|
|
1796
|
-
this._value = newValue;
|
|
1797
|
-
return true;
|
|
1798
|
-
}
|
|
1799
|
-
return false;
|
|
1800
|
-
} finally {
|
|
1801
|
-
endTracking(this, prevSub);
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
{
|
|
1806
|
-
setupOnTrigger(ComputedRefImpl);
|
|
1650
|
+
if (activeEffectScope !== void 0) activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
|
|
1651
|
+
else if (!failSilently) warn("onScopeDispose() is called when there is no active effect scope to be associated with.");
|
|
1807
1652
|
}
|
|
1653
|
+
//#endregion
|
|
1654
|
+
//#region packages/reactivity/src/computed.ts
|
|
1655
|
+
/**
|
|
1656
|
+
* @private exported by @vue/reactivity for Vue core use, but not exported from
|
|
1657
|
+
* the main vue package
|
|
1658
|
+
*/
|
|
1659
|
+
var ComputedRefImpl = class {
|
|
1660
|
+
get effect() {
|
|
1661
|
+
return this;
|
|
1662
|
+
}
|
|
1663
|
+
get dep() {
|
|
1664
|
+
return this;
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* @internal
|
|
1668
|
+
* for backwards compat
|
|
1669
|
+
*/
|
|
1670
|
+
get _dirty() {
|
|
1671
|
+
const flags = this.flags;
|
|
1672
|
+
if (flags & ReactiveFlags$1.Dirty) return true;
|
|
1673
|
+
if (flags & ReactiveFlags$1.Pending) if (checkDirty(this.deps, this)) {
|
|
1674
|
+
this.flags = flags | ReactiveFlags$1.Dirty;
|
|
1675
|
+
return true;
|
|
1676
|
+
} else this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1677
|
+
return false;
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* @internal
|
|
1681
|
+
* for backwards compat
|
|
1682
|
+
*/
|
|
1683
|
+
set _dirty(v) {
|
|
1684
|
+
if (v) this.flags |= ReactiveFlags$1.Dirty;
|
|
1685
|
+
else this.flags &= ~(ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending);
|
|
1686
|
+
}
|
|
1687
|
+
constructor(fn, setter) {
|
|
1688
|
+
this.fn = fn;
|
|
1689
|
+
this.setter = setter;
|
|
1690
|
+
this._value = void 0;
|
|
1691
|
+
this.subs = void 0;
|
|
1692
|
+
this.subsTail = void 0;
|
|
1693
|
+
this.deps = void 0;
|
|
1694
|
+
this.depsTail = void 0;
|
|
1695
|
+
this.flags = ReactiveFlags$1.Mutable | ReactiveFlags$1.Dirty;
|
|
1696
|
+
this.__v_isRef = true;
|
|
1697
|
+
this["__v_isReadonly"] = !setter;
|
|
1698
|
+
}
|
|
1699
|
+
get value() {
|
|
1700
|
+
const flags = this.flags;
|
|
1701
|
+
if (flags & ReactiveFlags$1.Dirty || flags & ReactiveFlags$1.Pending && checkDirty(this.deps, this)) {
|
|
1702
|
+
if (this.update()) {
|
|
1703
|
+
const subs = this.subs;
|
|
1704
|
+
if (subs !== void 0) shallowPropagate(subs);
|
|
1705
|
+
}
|
|
1706
|
+
} else if (flags & ReactiveFlags$1.Pending) this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1707
|
+
if (activeSub !== void 0) {
|
|
1708
|
+
onTrack(activeSub, {
|
|
1709
|
+
target: this,
|
|
1710
|
+
type: "get",
|
|
1711
|
+
key: "value"
|
|
1712
|
+
});
|
|
1713
|
+
link(this, activeSub);
|
|
1714
|
+
} else if (activeEffectScope !== void 0) link(this, activeEffectScope);
|
|
1715
|
+
return this._value;
|
|
1716
|
+
}
|
|
1717
|
+
set value(newValue) {
|
|
1718
|
+
if (this.setter) this.setter(newValue);
|
|
1719
|
+
else warn("Write operation failed: computed value is readonly");
|
|
1720
|
+
}
|
|
1721
|
+
update() {
|
|
1722
|
+
const prevSub = startTracking(this);
|
|
1723
|
+
try {
|
|
1724
|
+
const oldValue = this._value;
|
|
1725
|
+
const newValue = this.fn(oldValue);
|
|
1726
|
+
if ((0, _vue_shared.hasChanged)(oldValue, newValue)) {
|
|
1727
|
+
this._value = newValue;
|
|
1728
|
+
return true;
|
|
1729
|
+
}
|
|
1730
|
+
return false;
|
|
1731
|
+
} finally {
|
|
1732
|
+
endTracking(this, prevSub);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
setupOnTrigger(ComputedRefImpl);
|
|
1737
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1808
1738
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1739
|
+
let getter;
|
|
1740
|
+
let setter;
|
|
1741
|
+
if ((0, _vue_shared.isFunction)(getterOrOptions)) getter = getterOrOptions;
|
|
1742
|
+
else {
|
|
1743
|
+
getter = getterOrOptions.get;
|
|
1744
|
+
setter = getterOrOptions.set;
|
|
1745
|
+
}
|
|
1746
|
+
const cRef = new ComputedRefImpl(getter, setter);
|
|
1747
|
+
if (debugOptions && !isSSR) {
|
|
1748
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1749
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1750
|
+
}
|
|
1751
|
+
return cRef;
|
|
1752
|
+
}
|
|
1753
|
+
//#endregion
|
|
1754
|
+
//#region packages/reactivity/src/constants.ts
|
|
1825
1755
|
const TrackOpTypes = {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1756
|
+
"GET": "get",
|
|
1757
|
+
"HAS": "has",
|
|
1758
|
+
"ITERATE": "iterate"
|
|
1829
1759
|
};
|
|
1830
1760
|
const TriggerOpTypes = {
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1761
|
+
"SET": "set",
|
|
1762
|
+
"ADD": "add",
|
|
1763
|
+
"DELETE": "delete",
|
|
1764
|
+
"CLEAR": "clear"
|
|
1835
1765
|
};
|
|
1836
1766
|
const ReactiveFlags = {
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1767
|
+
"SKIP": "__v_skip",
|
|
1768
|
+
"IS_REACTIVE": "__v_isReactive",
|
|
1769
|
+
"IS_READONLY": "__v_isReadonly",
|
|
1770
|
+
"IS_SHALLOW": "__v_isShallow",
|
|
1771
|
+
"RAW": "__v_raw",
|
|
1772
|
+
"IS_REF": "__v_isRef"
|
|
1843
1773
|
};
|
|
1844
|
-
|
|
1774
|
+
//#endregion
|
|
1775
|
+
//#region packages/reactivity/src/watch.ts
|
|
1845
1776
|
const WatchErrorCodes = {
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1777
|
+
"WATCH_GETTER": 2,
|
|
1778
|
+
"2": "WATCH_GETTER",
|
|
1779
|
+
"WATCH_CALLBACK": 3,
|
|
1780
|
+
"3": "WATCH_CALLBACK",
|
|
1781
|
+
"WATCH_CLEANUP": 4,
|
|
1782
|
+
"4": "WATCH_CLEANUP"
|
|
1852
1783
|
};
|
|
1853
1784
|
const INITIAL_WATCHER_VALUE = {};
|
|
1854
1785
|
let activeWatcher = void 0;
|
|
1786
|
+
/**
|
|
1787
|
+
* Returns the current active effect if there is one.
|
|
1788
|
+
*/
|
|
1855
1789
|
function getCurrentWatcher() {
|
|
1856
|
-
|
|
1790
|
+
return activeWatcher;
|
|
1857
1791
|
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Registers a cleanup callback on the current active effect. This
|
|
1794
|
+
* registered cleanup callback will be invoked right before the
|
|
1795
|
+
* associated effect re-runs.
|
|
1796
|
+
*
|
|
1797
|
+
* @param cleanupFn - The callback function to attach to the effect's cleanup.
|
|
1798
|
+
* @param failSilently - if `true`, will not throw warning when called without
|
|
1799
|
+
* an active effect.
|
|
1800
|
+
* @param owner - The effect that this cleanup function should be attached to.
|
|
1801
|
+
* By default, the current active effect.
|
|
1802
|
+
*/
|
|
1858
1803
|
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
if (!this.cb) {
|
|
1955
|
-
return;
|
|
1956
|
-
}
|
|
1957
|
-
const { immediate, deep, call } = this.options;
|
|
1958
|
-
if (initialRun && !immediate) {
|
|
1959
|
-
return;
|
|
1960
|
-
}
|
|
1961
|
-
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue))) {
|
|
1962
|
-
cleanup(this);
|
|
1963
|
-
const currentWatcher = activeWatcher;
|
|
1964
|
-
activeWatcher = this;
|
|
1965
|
-
try {
|
|
1966
|
-
const args = [
|
|
1967
|
-
newValue,
|
|
1968
|
-
// pass undefined as the old value when it's changed for the first time
|
|
1969
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
1970
|
-
this.boundCleanup
|
|
1971
|
-
];
|
|
1972
|
-
call ? call(this.cb, 3, args) : (
|
|
1973
|
-
// @ts-expect-error
|
|
1974
|
-
this.cb(...args)
|
|
1975
|
-
);
|
|
1976
|
-
} finally {
|
|
1977
|
-
activeWatcher = currentWatcher;
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1804
|
+
if (owner) {
|
|
1805
|
+
const { call } = owner.options;
|
|
1806
|
+
if (call) owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
|
|
1807
|
+
else owner.cleanups[owner.cleanupsLength++] = cleanupFn;
|
|
1808
|
+
} else if (!failSilently) warn("onWatcherCleanup() was called when there was no active watcher to associate with.");
|
|
1809
|
+
}
|
|
1810
|
+
var WatcherEffect = class extends ReactiveEffect {
|
|
1811
|
+
constructor(source, cb, options = _vue_shared.EMPTY_OBJ) {
|
|
1812
|
+
const { deep, once, call, onWarn } = options;
|
|
1813
|
+
let getter;
|
|
1814
|
+
let forceTrigger = false;
|
|
1815
|
+
let isMultiSource = false;
|
|
1816
|
+
if (/* @__PURE__ */ isRef(source)) {
|
|
1817
|
+
getter = () => source.value;
|
|
1818
|
+
forceTrigger = /* @__PURE__ */ isShallow(source);
|
|
1819
|
+
} else if (/* @__PURE__ */ isReactive(source)) {
|
|
1820
|
+
getter = () => reactiveGetter(source, deep);
|
|
1821
|
+
forceTrigger = true;
|
|
1822
|
+
} else if ((0, _vue_shared.isArray)(source)) {
|
|
1823
|
+
isMultiSource = true;
|
|
1824
|
+
forceTrigger = source.some((s) => /* @__PURE__ */ isReactive(s) || /* @__PURE__ */ isShallow(s));
|
|
1825
|
+
getter = () => source.map((s) => {
|
|
1826
|
+
if (/* @__PURE__ */ isRef(s)) return s.value;
|
|
1827
|
+
else if (/* @__PURE__ */ isReactive(s)) return reactiveGetter(s, deep);
|
|
1828
|
+
else if ((0, _vue_shared.isFunction)(s)) return call ? call(s, 2) : s();
|
|
1829
|
+
else warnInvalidSource(s, onWarn);
|
|
1830
|
+
});
|
|
1831
|
+
} else if ((0, _vue_shared.isFunction)(source)) if (cb) getter = call ? () => call(source, 2) : source;
|
|
1832
|
+
else getter = () => {
|
|
1833
|
+
if (this.cleanupsLength) {
|
|
1834
|
+
const prevSub = setActiveSub();
|
|
1835
|
+
try {
|
|
1836
|
+
cleanup(this);
|
|
1837
|
+
} finally {
|
|
1838
|
+
setActiveSub(prevSub);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
const currentEffect = activeWatcher;
|
|
1842
|
+
activeWatcher = this;
|
|
1843
|
+
try {
|
|
1844
|
+
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1845
|
+
} finally {
|
|
1846
|
+
activeWatcher = currentEffect;
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
else {
|
|
1850
|
+
getter = _vue_shared.NOOP;
|
|
1851
|
+
warnInvalidSource(source, onWarn);
|
|
1852
|
+
}
|
|
1853
|
+
if (cb && deep) {
|
|
1854
|
+
const baseGetter = getter;
|
|
1855
|
+
const depth = deep === true ? Infinity : deep;
|
|
1856
|
+
getter = () => traverse(baseGetter(), depth);
|
|
1857
|
+
}
|
|
1858
|
+
super(getter);
|
|
1859
|
+
this.cb = cb;
|
|
1860
|
+
this.options = options;
|
|
1861
|
+
this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
|
|
1862
|
+
this.forceTrigger = forceTrigger;
|
|
1863
|
+
this.isMultiSource = isMultiSource;
|
|
1864
|
+
if (once && cb) {
|
|
1865
|
+
const _cb = cb;
|
|
1866
|
+
cb = (...args) => {
|
|
1867
|
+
_cb(...args);
|
|
1868
|
+
this.stop();
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
this.cb = cb;
|
|
1872
|
+
this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1873
|
+
this.onTrack = options.onTrack;
|
|
1874
|
+
this.onTrigger = options.onTrigger;
|
|
1875
|
+
}
|
|
1876
|
+
run(initialRun = false) {
|
|
1877
|
+
const oldValue = this.oldValue;
|
|
1878
|
+
const newValue = this.oldValue = super.run();
|
|
1879
|
+
if (!this.cb) return;
|
|
1880
|
+
const { immediate, deep, call } = this.options;
|
|
1881
|
+
if (initialRun && !immediate) return;
|
|
1882
|
+
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => (0, _vue_shared.hasChanged)(v, oldValue[i])) : (0, _vue_shared.hasChanged)(newValue, oldValue))) {
|
|
1883
|
+
cleanup(this);
|
|
1884
|
+
const currentWatcher = activeWatcher;
|
|
1885
|
+
activeWatcher = this;
|
|
1886
|
+
try {
|
|
1887
|
+
const args = [
|
|
1888
|
+
newValue,
|
|
1889
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
1890
|
+
this.boundCleanup
|
|
1891
|
+
];
|
|
1892
|
+
call ? call(this.cb, 3, args) : this.cb(...args);
|
|
1893
|
+
} finally {
|
|
1894
|
+
activeWatcher = currentWatcher;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
};
|
|
1982
1899
|
function reactiveGetter(source, deep) {
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
return traverse(source);
|
|
1900
|
+
if (deep) return source;
|
|
1901
|
+
if (/* @__PURE__ */ isShallow(source) || deep === false || deep === 0) return traverse(source, 1);
|
|
1902
|
+
return traverse(source);
|
|
1987
1903
|
}
|
|
1988
1904
|
function warnInvalidSource(s, onWarn) {
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
stop.pause = effect.pause.bind(effect);
|
|
2000
|
-
stop.resume = effect.resume.bind(effect);
|
|
2001
|
-
stop.stop = stop;
|
|
2002
|
-
return stop;
|
|
1905
|
+
(onWarn || warn)(`Invalid watch source: `, s, "A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.");
|
|
1906
|
+
}
|
|
1907
|
+
function watch(source, cb, options = _vue_shared.EMPTY_OBJ) {
|
|
1908
|
+
const effect = new WatcherEffect(source, cb, options);
|
|
1909
|
+
effect.run(true);
|
|
1910
|
+
const stop = effect.stop.bind(effect);
|
|
1911
|
+
stop.pause = effect.pause.bind(effect);
|
|
1912
|
+
stop.resume = effect.resume.bind(effect);
|
|
1913
|
+
stop.stop = stop;
|
|
1914
|
+
return stop;
|
|
2003
1915
|
}
|
|
2004
1916
|
function traverse(value, depth = Infinity, seen) {
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
traverse(v, depth, seen);
|
|
2023
|
-
});
|
|
2024
|
-
} else if (shared.isPlainObject(value)) {
|
|
2025
|
-
for (const key in value) {
|
|
2026
|
-
traverse(value[key], depth, seen);
|
|
2027
|
-
}
|
|
2028
|
-
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
2029
|
-
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
2030
|
-
traverse(value[key], depth, seen);
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
return value;
|
|
2035
|
-
}
|
|
2036
|
-
|
|
1917
|
+
if (depth <= 0 || !(0, _vue_shared.isObject)(value) || value["__v_skip"]) return value;
|
|
1918
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
1919
|
+
if ((seen.get(value) || 0) >= depth) return value;
|
|
1920
|
+
seen.set(value, depth);
|
|
1921
|
+
depth--;
|
|
1922
|
+
if (/* @__PURE__ */ isRef(value)) traverse(value.value, depth, seen);
|
|
1923
|
+
else if ((0, _vue_shared.isArray)(value)) for (let i = 0; i < value.length; i++) traverse(value[i], depth, seen);
|
|
1924
|
+
else if ((0, _vue_shared.isSet)(value) || (0, _vue_shared.isMap)(value)) value.forEach((v) => {
|
|
1925
|
+
traverse(v, depth, seen);
|
|
1926
|
+
});
|
|
1927
|
+
else if ((0, _vue_shared.isPlainObject)(value)) {
|
|
1928
|
+
for (const key in value) traverse(value[key], depth, seen);
|
|
1929
|
+
for (const key of Object.getOwnPropertySymbols(value)) if (Object.prototype.propertyIsEnumerable.call(value, key)) traverse(value[key], depth, seen);
|
|
1930
|
+
}
|
|
1931
|
+
return value;
|
|
1932
|
+
}
|
|
1933
|
+
//#endregion
|
|
2037
1934
|
exports.ARRAY_ITERATE_KEY = ARRAY_ITERATE_KEY;
|
|
2038
1935
|
exports.EffectFlags = EffectFlags;
|
|
2039
1936
|
exports.EffectScope = EffectScope;
|