@vue/reactivity 3.2.46 → 3.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/reactivity.cjs.js +1007 -1060
- package/dist/reactivity.cjs.prod.js +930 -985
- package/dist/reactivity.d.ts +314 -351
- package/dist/reactivity.esm-browser.js +1031 -1096
- package/dist/reactivity.esm-browser.prod.js +1 -1
- package/dist/reactivity.esm-bundler.js +1015 -1075
- package/dist/reactivity.global.js +1031 -1096
- package/dist/reactivity.global.prod.js +1 -1
- package/package.json +2 -2
|
@@ -1,1320 +1,1255 @@
|
|
|
1
1
|
var VueReactivity = (function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Make a map and return a function for checking if a key
|
|
6
|
-
* is in that map.
|
|
7
|
-
* IMPORTANT: all calls of this function must be prefixed with
|
|
8
|
-
* \/\*#\_\_PURE\_\_\*\/
|
|
9
|
-
* So that rollup can tree-shake them if necessary.
|
|
10
|
-
*/
|
|
11
4
|
function makeMap(str, expectsLowerCase) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
const map = /* @__PURE__ */ Object.create(null);
|
|
6
|
+
const list = str.split(",");
|
|
7
|
+
for (let i = 0; i < list.length; i++) {
|
|
8
|
+
map[list[i]] = true;
|
|
9
|
+
}
|
|
10
|
+
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
18
11
|
}
|
|
19
12
|
|
|
20
13
|
const extend = Object.assign;
|
|
21
14
|
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
22
15
|
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
23
16
|
const isArray = Array.isArray;
|
|
24
|
-
const isMap = (val) => toTypeString(val) ===
|
|
25
|
-
const isFunction = (val) => typeof val ===
|
|
26
|
-
const isString = (val) => typeof val ===
|
|
27
|
-
const isSymbol = (val) => typeof val ===
|
|
28
|
-
const isObject = (val) => val !== null && typeof val ===
|
|
17
|
+
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
18
|
+
const isFunction = (val) => typeof val === "function";
|
|
19
|
+
const isString = (val) => typeof val === "string";
|
|
20
|
+
const isSymbol = (val) => typeof val === "symbol";
|
|
21
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
29
22
|
const objectToString = Object.prototype.toString;
|
|
30
23
|
const toTypeString = (value) => objectToString.call(value);
|
|
31
24
|
const toRawType = (value) => {
|
|
32
|
-
|
|
33
|
-
return toTypeString(value).slice(8, -1);
|
|
25
|
+
return toTypeString(value).slice(8, -1);
|
|
34
26
|
};
|
|
35
|
-
const isIntegerKey = (key) => isString(key) &&
|
|
36
|
-
key !== 'NaN' &&
|
|
37
|
-
key[0] !== '-' &&
|
|
38
|
-
'' + parseInt(key, 10) === key;
|
|
27
|
+
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
39
28
|
const cacheStringFunction = (fn) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
30
|
+
return (str) => {
|
|
31
|
+
const hit = cache[str];
|
|
32
|
+
return hit || (cache[str] = fn(str));
|
|
33
|
+
};
|
|
45
34
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
50
|
-
// compare whether a value has changed, accounting for NaN.
|
|
35
|
+
const capitalize = cacheStringFunction(
|
|
36
|
+
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
37
|
+
);
|
|
51
38
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
52
39
|
const def = (obj, key, value) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
Object.defineProperty(obj, key, {
|
|
41
|
+
configurable: true,
|
|
42
|
+
enumerable: false,
|
|
43
|
+
value
|
|
44
|
+
});
|
|
58
45
|
};
|
|
59
46
|
|
|
60
47
|
function warn(msg, ...args) {
|
|
61
|
-
|
|
48
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
62
49
|
}
|
|
63
50
|
|
|
64
51
|
let activeEffectScope;
|
|
65
52
|
class EffectScope {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
this._active = true;
|
|
72
|
-
/**
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
this.effects = [];
|
|
76
|
-
/**
|
|
77
|
-
* @internal
|
|
78
|
-
*/
|
|
79
|
-
this.cleanups = [];
|
|
80
|
-
this.parent = activeEffectScope;
|
|
81
|
-
if (!detached && activeEffectScope) {
|
|
82
|
-
this.index =
|
|
83
|
-
(activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
get active() {
|
|
87
|
-
return this._active;
|
|
88
|
-
}
|
|
89
|
-
run(fn) {
|
|
90
|
-
if (this._active) {
|
|
91
|
-
const currentEffectScope = activeEffectScope;
|
|
92
|
-
try {
|
|
93
|
-
activeEffectScope = this;
|
|
94
|
-
return fn();
|
|
95
|
-
}
|
|
96
|
-
finally {
|
|
97
|
-
activeEffectScope = currentEffectScope;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
warn(`cannot run an inactive effect scope.`);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
53
|
+
constructor(detached = false) {
|
|
54
|
+
this.detached = detached;
|
|
104
55
|
/**
|
|
105
|
-
* This should only be called on non-detached scopes
|
|
106
56
|
* @internal
|
|
107
57
|
*/
|
|
108
|
-
|
|
109
|
-
activeEffectScope = this;
|
|
110
|
-
}
|
|
58
|
+
this._active = true;
|
|
111
59
|
/**
|
|
112
|
-
* This should only be called on non-detached scopes
|
|
113
60
|
* @internal
|
|
114
61
|
*/
|
|
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
|
-
|
|
142
|
-
|
|
62
|
+
this.effects = [];
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
this.cleanups = [];
|
|
67
|
+
this.parent = activeEffectScope;
|
|
68
|
+
if (!detached && activeEffectScope) {
|
|
69
|
+
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
|
70
|
+
this
|
|
71
|
+
) - 1;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
get active() {
|
|
75
|
+
return this._active;
|
|
76
|
+
}
|
|
77
|
+
run(fn) {
|
|
78
|
+
if (this._active) {
|
|
79
|
+
const currentEffectScope = activeEffectScope;
|
|
80
|
+
try {
|
|
81
|
+
activeEffectScope = this;
|
|
82
|
+
return fn();
|
|
83
|
+
} finally {
|
|
84
|
+
activeEffectScope = currentEffectScope;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
warn(`cannot run an inactive effect scope.`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This should only be called on non-detached scopes
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
on() {
|
|
95
|
+
activeEffectScope = this;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* This should only be called on non-detached scopes
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
off() {
|
|
102
|
+
activeEffectScope = this.parent;
|
|
103
|
+
}
|
|
104
|
+
stop(fromParent) {
|
|
105
|
+
if (this._active) {
|
|
106
|
+
let i, l;
|
|
107
|
+
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
108
|
+
this.effects[i].stop();
|
|
109
|
+
}
|
|
110
|
+
for (i = 0, l = this.cleanups.length; i < l; i++) {
|
|
111
|
+
this.cleanups[i]();
|
|
112
|
+
}
|
|
113
|
+
if (this.scopes) {
|
|
114
|
+
for (i = 0, l = this.scopes.length; i < l; i++) {
|
|
115
|
+
this.scopes[i].stop(true);
|
|
143
116
|
}
|
|
117
|
+
}
|
|
118
|
+
if (!this.detached && this.parent && !fromParent) {
|
|
119
|
+
const last = this.parent.scopes.pop();
|
|
120
|
+
if (last && last !== this) {
|
|
121
|
+
this.parent.scopes[this.index] = last;
|
|
122
|
+
last.index = this.index;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this.parent = void 0;
|
|
126
|
+
this._active = false;
|
|
144
127
|
}
|
|
128
|
+
}
|
|
145
129
|
}
|
|
146
130
|
function effectScope(detached) {
|
|
147
|
-
|
|
131
|
+
return new EffectScope(detached);
|
|
148
132
|
}
|
|
149
133
|
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
134
|
+
if (scope && scope.active) {
|
|
135
|
+
scope.effects.push(effect);
|
|
136
|
+
}
|
|
153
137
|
}
|
|
154
138
|
function getCurrentScope() {
|
|
155
|
-
|
|
139
|
+
return activeEffectScope;
|
|
156
140
|
}
|
|
157
141
|
function onScopeDispose(fn) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
142
|
+
if (activeEffectScope) {
|
|
143
|
+
activeEffectScope.cleanups.push(fn);
|
|
144
|
+
} else {
|
|
145
|
+
warn(
|
|
146
|
+
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
147
|
+
);
|
|
148
|
+
}
|
|
165
149
|
}
|
|
166
150
|
|
|
167
151
|
const createDep = (effects) => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
152
|
+
const dep = new Set(effects);
|
|
153
|
+
dep.w = 0;
|
|
154
|
+
dep.n = 0;
|
|
155
|
+
return dep;
|
|
172
156
|
};
|
|
173
157
|
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
|
|
174
158
|
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
|
|
175
159
|
const initDepMarkers = ({ deps }) => {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
160
|
+
if (deps.length) {
|
|
161
|
+
for (let i = 0; i < deps.length; i++) {
|
|
162
|
+
deps[i].w |= trackOpBit;
|
|
180
163
|
}
|
|
164
|
+
}
|
|
181
165
|
};
|
|
182
166
|
const finalizeDepMarkers = (effect) => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
deps.length = ptr;
|
|
199
|
-
}
|
|
167
|
+
const { deps } = effect;
|
|
168
|
+
if (deps.length) {
|
|
169
|
+
let ptr = 0;
|
|
170
|
+
for (let i = 0; i < deps.length; i++) {
|
|
171
|
+
const dep = deps[i];
|
|
172
|
+
if (wasTracked(dep) && !newTracked(dep)) {
|
|
173
|
+
dep.delete(effect);
|
|
174
|
+
} else {
|
|
175
|
+
deps[ptr++] = dep;
|
|
176
|
+
}
|
|
177
|
+
dep.w &= ~trackOpBit;
|
|
178
|
+
dep.n &= ~trackOpBit;
|
|
179
|
+
}
|
|
180
|
+
deps.length = ptr;
|
|
181
|
+
}
|
|
200
182
|
};
|
|
201
183
|
|
|
202
|
-
const targetMap = new WeakMap();
|
|
203
|
-
// The number of effects currently being tracked recursively.
|
|
184
|
+
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
204
185
|
let effectTrackDepth = 0;
|
|
205
186
|
let trackOpBit = 1;
|
|
206
|
-
/**
|
|
207
|
-
* The bitwise track markers support at most 30 levels of recursion.
|
|
208
|
-
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
209
|
-
* When recursion depth is greater, fall back to using a full cleanup.
|
|
210
|
-
*/
|
|
211
187
|
const maxMarkerBits = 30;
|
|
212
188
|
let activeEffect;
|
|
213
|
-
const ITERATE_KEY = Symbol(
|
|
214
|
-
const MAP_KEY_ITERATE_KEY = Symbol(
|
|
189
|
+
const ITERATE_KEY = Symbol("iterate" );
|
|
190
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
|
|
215
191
|
class ReactiveEffect {
|
|
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
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
deps[i].delete(effect);
|
|
281
|
-
}
|
|
282
|
-
deps.length = 0;
|
|
283
|
-
}
|
|
192
|
+
constructor(fn, scheduler = null, scope) {
|
|
193
|
+
this.fn = fn;
|
|
194
|
+
this.scheduler = scheduler;
|
|
195
|
+
this.active = true;
|
|
196
|
+
this.deps = [];
|
|
197
|
+
this.parent = void 0;
|
|
198
|
+
recordEffectScope(this, scope);
|
|
199
|
+
}
|
|
200
|
+
run() {
|
|
201
|
+
if (!this.active) {
|
|
202
|
+
return this.fn();
|
|
203
|
+
}
|
|
204
|
+
let parent = activeEffect;
|
|
205
|
+
let lastShouldTrack = shouldTrack;
|
|
206
|
+
while (parent) {
|
|
207
|
+
if (parent === this) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
parent = parent.parent;
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
this.parent = activeEffect;
|
|
214
|
+
activeEffect = this;
|
|
215
|
+
shouldTrack = true;
|
|
216
|
+
trackOpBit = 1 << ++effectTrackDepth;
|
|
217
|
+
if (effectTrackDepth <= maxMarkerBits) {
|
|
218
|
+
initDepMarkers(this);
|
|
219
|
+
} else {
|
|
220
|
+
cleanupEffect(this);
|
|
221
|
+
}
|
|
222
|
+
return this.fn();
|
|
223
|
+
} finally {
|
|
224
|
+
if (effectTrackDepth <= maxMarkerBits) {
|
|
225
|
+
finalizeDepMarkers(this);
|
|
226
|
+
}
|
|
227
|
+
trackOpBit = 1 << --effectTrackDepth;
|
|
228
|
+
activeEffect = this.parent;
|
|
229
|
+
shouldTrack = lastShouldTrack;
|
|
230
|
+
this.parent = void 0;
|
|
231
|
+
if (this.deferStop) {
|
|
232
|
+
this.stop();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
stop() {
|
|
237
|
+
if (activeEffect === this) {
|
|
238
|
+
this.deferStop = true;
|
|
239
|
+
} else if (this.active) {
|
|
240
|
+
cleanupEffect(this);
|
|
241
|
+
if (this.onStop) {
|
|
242
|
+
this.onStop();
|
|
243
|
+
}
|
|
244
|
+
this.active = false;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function cleanupEffect(effect2) {
|
|
249
|
+
const { deps } = effect2;
|
|
250
|
+
if (deps.length) {
|
|
251
|
+
for (let i = 0; i < deps.length; i++) {
|
|
252
|
+
deps[i].delete(effect2);
|
|
253
|
+
}
|
|
254
|
+
deps.length = 0;
|
|
255
|
+
}
|
|
284
256
|
}
|
|
285
257
|
function effect(fn, options) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
258
|
+
if (fn.effect) {
|
|
259
|
+
fn = fn.effect.fn;
|
|
260
|
+
}
|
|
261
|
+
const _effect = new ReactiveEffect(fn);
|
|
262
|
+
if (options) {
|
|
263
|
+
extend(_effect, options);
|
|
264
|
+
if (options.scope)
|
|
265
|
+
recordEffectScope(_effect, options.scope);
|
|
266
|
+
}
|
|
267
|
+
if (!options || !options.lazy) {
|
|
268
|
+
_effect.run();
|
|
269
|
+
}
|
|
270
|
+
const runner = _effect.run.bind(_effect);
|
|
271
|
+
runner.effect = _effect;
|
|
272
|
+
return runner;
|
|
301
273
|
}
|
|
302
274
|
function stop(runner) {
|
|
303
|
-
|
|
275
|
+
runner.effect.stop();
|
|
304
276
|
}
|
|
305
277
|
let shouldTrack = true;
|
|
306
278
|
const trackStack = [];
|
|
307
279
|
function pauseTracking() {
|
|
308
|
-
|
|
309
|
-
|
|
280
|
+
trackStack.push(shouldTrack);
|
|
281
|
+
shouldTrack = false;
|
|
310
282
|
}
|
|
311
283
|
function enableTracking() {
|
|
312
|
-
|
|
313
|
-
|
|
284
|
+
trackStack.push(shouldTrack);
|
|
285
|
+
shouldTrack = true;
|
|
314
286
|
}
|
|
315
287
|
function resetTracking() {
|
|
316
|
-
|
|
317
|
-
|
|
288
|
+
const last = trackStack.pop();
|
|
289
|
+
shouldTrack = last === void 0 ? true : last;
|
|
318
290
|
}
|
|
319
291
|
function track(target, type, key) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
const eventInfo = { effect: activeEffect, target, type, key }
|
|
330
|
-
;
|
|
331
|
-
trackEffects(dep, eventInfo);
|
|
292
|
+
if (shouldTrack && activeEffect) {
|
|
293
|
+
let depsMap = targetMap.get(target);
|
|
294
|
+
if (!depsMap) {
|
|
295
|
+
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
296
|
+
}
|
|
297
|
+
let dep = depsMap.get(key);
|
|
298
|
+
if (!dep) {
|
|
299
|
+
depsMap.set(key, dep = createDep());
|
|
332
300
|
}
|
|
301
|
+
const eventInfo = { effect: activeEffect, target, type, key } ;
|
|
302
|
+
trackEffects(dep, eventInfo);
|
|
303
|
+
}
|
|
333
304
|
}
|
|
334
305
|
function trackEffects(dep, debuggerEventExtraInfo) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
306
|
+
let shouldTrack2 = false;
|
|
307
|
+
if (effectTrackDepth <= maxMarkerBits) {
|
|
308
|
+
if (!newTracked(dep)) {
|
|
309
|
+
dep.n |= trackOpBit;
|
|
310
|
+
shouldTrack2 = !wasTracked(dep);
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
313
|
+
shouldTrack2 = !dep.has(activeEffect);
|
|
314
|
+
}
|
|
315
|
+
if (shouldTrack2) {
|
|
316
|
+
dep.add(activeEffect);
|
|
317
|
+
activeEffect.deps.push(dep);
|
|
318
|
+
if (activeEffect.onTrack) {
|
|
319
|
+
activeEffect.onTrack(
|
|
320
|
+
extend(
|
|
321
|
+
{
|
|
322
|
+
effect: activeEffect
|
|
323
|
+
},
|
|
324
|
+
debuggerEventExtraInfo
|
|
325
|
+
)
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
353
329
|
}
|
|
354
330
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
331
|
+
const depsMap = targetMap.get(target);
|
|
332
|
+
if (!depsMap) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
let deps = [];
|
|
336
|
+
if (type === "clear") {
|
|
337
|
+
deps = [...depsMap.values()];
|
|
338
|
+
} else if (key === "length" && isArray(target)) {
|
|
339
|
+
const newLength = Number(newValue);
|
|
340
|
+
depsMap.forEach((dep, key2) => {
|
|
341
|
+
if (key2 === "length" || key2 >= newLength) {
|
|
342
|
+
deps.push(dep);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
} else {
|
|
346
|
+
if (key !== void 0) {
|
|
347
|
+
deps.push(depsMap.get(key));
|
|
348
|
+
}
|
|
349
|
+
switch (type) {
|
|
350
|
+
case "add":
|
|
351
|
+
if (!isArray(target)) {
|
|
352
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
353
|
+
if (isMap(target)) {
|
|
354
|
+
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
355
|
+
}
|
|
356
|
+
} else if (isIntegerKey(key)) {
|
|
357
|
+
deps.push(depsMap.get("length"));
|
|
378
358
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
else if (isIntegerKey(key)) {
|
|
389
|
-
// new index added to array -> length changes
|
|
390
|
-
deps.push(depsMap.get('length'));
|
|
391
|
-
}
|
|
392
|
-
break;
|
|
393
|
-
case "delete" /* TriggerOpTypes.DELETE */:
|
|
394
|
-
if (!isArray(target)) {
|
|
395
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
396
|
-
if (isMap(target)) {
|
|
397
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
break;
|
|
401
|
-
case "set" /* TriggerOpTypes.SET */:
|
|
402
|
-
if (isMap(target)) {
|
|
403
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
404
|
-
}
|
|
405
|
-
break;
|
|
359
|
+
break;
|
|
360
|
+
case "delete":
|
|
361
|
+
if (!isArray(target)) {
|
|
362
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
363
|
+
if (isMap(target)) {
|
|
364
|
+
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
365
|
+
}
|
|
406
366
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (deps[0]) {
|
|
412
|
-
{
|
|
413
|
-
triggerEffects(deps[0], eventInfo);
|
|
414
|
-
}
|
|
367
|
+
break;
|
|
368
|
+
case "set":
|
|
369
|
+
if (isMap(target)) {
|
|
370
|
+
deps.push(depsMap.get(ITERATE_KEY));
|
|
415
371
|
}
|
|
372
|
+
break;
|
|
416
373
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
374
|
+
}
|
|
375
|
+
const eventInfo = { target, type, key, newValue, oldValue, oldTarget } ;
|
|
376
|
+
if (deps.length === 1) {
|
|
377
|
+
if (deps[0]) {
|
|
378
|
+
{
|
|
379
|
+
triggerEffects(deps[0], eventInfo);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
} else {
|
|
383
|
+
const effects = [];
|
|
384
|
+
for (const dep of deps) {
|
|
385
|
+
if (dep) {
|
|
386
|
+
effects.push(...dep);
|
|
387
|
+
}
|
|
427
388
|
}
|
|
389
|
+
{
|
|
390
|
+
triggerEffects(createDep(effects), eventInfo);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
428
393
|
}
|
|
429
394
|
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
triggerEffect(effect, debuggerEventExtraInfo);
|
|
435
|
-
}
|
|
395
|
+
const effects = isArray(dep) ? dep : [...dep];
|
|
396
|
+
for (const effect2 of effects) {
|
|
397
|
+
if (effect2.computed) {
|
|
398
|
+
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
436
399
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
400
|
+
}
|
|
401
|
+
for (const effect2 of effects) {
|
|
402
|
+
if (!effect2.computed) {
|
|
403
|
+
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
441
404
|
}
|
|
405
|
+
}
|
|
442
406
|
}
|
|
443
|
-
function triggerEffect(
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
effect.run();
|
|
453
|
-
}
|
|
407
|
+
function triggerEffect(effect2, debuggerEventExtraInfo) {
|
|
408
|
+
if (effect2 !== activeEffect || effect2.allowRecurse) {
|
|
409
|
+
if (effect2.onTrigger) {
|
|
410
|
+
effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
411
|
+
}
|
|
412
|
+
if (effect2.scheduler) {
|
|
413
|
+
effect2.scheduler();
|
|
414
|
+
} else {
|
|
415
|
+
effect2.run();
|
|
454
416
|
}
|
|
417
|
+
}
|
|
455
418
|
}
|
|
456
419
|
function getDepFromReactive(object, key) {
|
|
457
|
-
|
|
458
|
-
|
|
420
|
+
var _a;
|
|
421
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
459
422
|
}
|
|
460
423
|
|
|
461
|
-
const isNonTrackableKeys =
|
|
424
|
+
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
462
425
|
const builtInSymbols = new Set(
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
.filter(isSymbol));
|
|
471
|
-
const get$1 = /*#__PURE__*/ createGetter();
|
|
472
|
-
const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
|
473
|
-
const readonlyGet = /*#__PURE__*/ createGetter(true);
|
|
474
|
-
const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
|
475
|
-
const arrayInstrumentations = /*#__PURE__*/ createArrayInstrumentations();
|
|
426
|
+
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
427
|
+
);
|
|
428
|
+
const get$1 = /* @__PURE__ */ createGetter();
|
|
429
|
+
const shallowGet = /* @__PURE__ */ createGetter(false, true);
|
|
430
|
+
const readonlyGet = /* @__PURE__ */ createGetter(true);
|
|
431
|
+
const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
|
|
432
|
+
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
476
433
|
function createArrayInstrumentations() {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
return arr[key](...args.map(toRaw));
|
|
489
|
-
}
|
|
490
|
-
else {
|
|
491
|
-
return res;
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
});
|
|
495
|
-
['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
|
|
496
|
-
instrumentations[key] = function (...args) {
|
|
497
|
-
pauseTracking();
|
|
498
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
499
|
-
resetTracking();
|
|
500
|
-
return res;
|
|
501
|
-
};
|
|
502
|
-
});
|
|
503
|
-
return instrumentations;
|
|
504
|
-
}
|
|
505
|
-
function hasOwnProperty(key) {
|
|
506
|
-
const obj = toRaw(this);
|
|
507
|
-
track(obj, "has" /* TrackOpTypes.HAS */, key);
|
|
508
|
-
return obj.hasOwnProperty(key);
|
|
509
|
-
}
|
|
510
|
-
function createGetter(isReadonly = false, shallow = false) {
|
|
511
|
-
return function get(target, key, receiver) {
|
|
512
|
-
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
513
|
-
return !isReadonly;
|
|
514
|
-
}
|
|
515
|
-
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
516
|
-
return isReadonly;
|
|
517
|
-
}
|
|
518
|
-
else if (key === "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */) {
|
|
519
|
-
return shallow;
|
|
520
|
-
}
|
|
521
|
-
else if (key === "__v_raw" /* ReactiveFlags.RAW */ &&
|
|
522
|
-
receiver ===
|
|
523
|
-
(isReadonly
|
|
524
|
-
? shallow
|
|
525
|
-
? shallowReadonlyMap
|
|
526
|
-
: readonlyMap
|
|
527
|
-
: shallow
|
|
528
|
-
? shallowReactiveMap
|
|
529
|
-
: reactiveMap).get(target)) {
|
|
530
|
-
return target;
|
|
531
|
-
}
|
|
532
|
-
const targetIsArray = isArray(target);
|
|
533
|
-
if (!isReadonly) {
|
|
534
|
-
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
|
535
|
-
return Reflect.get(arrayInstrumentations, key, receiver);
|
|
536
|
-
}
|
|
537
|
-
if (key === 'hasOwnProperty') {
|
|
538
|
-
return hasOwnProperty;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
const res = Reflect.get(target, key, receiver);
|
|
542
|
-
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
543
|
-
return res;
|
|
544
|
-
}
|
|
545
|
-
if (!isReadonly) {
|
|
546
|
-
track(target, "get" /* TrackOpTypes.GET */, key);
|
|
547
|
-
}
|
|
548
|
-
if (shallow) {
|
|
549
|
-
return res;
|
|
550
|
-
}
|
|
551
|
-
if (isRef(res)) {
|
|
552
|
-
// ref unwrapping - skip unwrap for Array + integer key.
|
|
553
|
-
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
554
|
-
}
|
|
555
|
-
if (isObject(res)) {
|
|
556
|
-
// Convert returned value into a proxy as well. we do the isObject check
|
|
557
|
-
// here to avoid invalid value warning. Also need to lazy access readonly
|
|
558
|
-
// and reactive here to avoid circular dependency.
|
|
559
|
-
return isReadonly ? readonly(res) : reactive(res);
|
|
560
|
-
}
|
|
434
|
+
const instrumentations = {};
|
|
435
|
+
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
436
|
+
instrumentations[key] = function(...args) {
|
|
437
|
+
const arr = toRaw(this);
|
|
438
|
+
for (let i = 0, l = this.length; i < l; i++) {
|
|
439
|
+
track(arr, "get", i + "");
|
|
440
|
+
}
|
|
441
|
+
const res = arr[key](...args);
|
|
442
|
+
if (res === -1 || res === false) {
|
|
443
|
+
return arr[key](...args.map(toRaw));
|
|
444
|
+
} else {
|
|
561
445
|
return res;
|
|
446
|
+
}
|
|
562
447
|
};
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
return false;
|
|
571
|
-
}
|
|
572
|
-
if (!shallow) {
|
|
573
|
-
if (!isShallow(value) && !isReadonly(value)) {
|
|
574
|
-
oldValue = toRaw(oldValue);
|
|
575
|
-
value = toRaw(value);
|
|
576
|
-
}
|
|
577
|
-
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
578
|
-
oldValue.value = value;
|
|
579
|
-
return true;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
const hadKey = isArray(target) && isIntegerKey(key)
|
|
583
|
-
? Number(key) < target.length
|
|
584
|
-
: hasOwn(target, key);
|
|
585
|
-
const result = Reflect.set(target, key, value, receiver);
|
|
586
|
-
// don't trigger if target is something up in the prototype chain of original
|
|
587
|
-
if (target === toRaw(receiver)) {
|
|
588
|
-
if (!hadKey) {
|
|
589
|
-
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
590
|
-
}
|
|
591
|
-
else if (hasChanged(value, oldValue)) {
|
|
592
|
-
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
return result;
|
|
448
|
+
});
|
|
449
|
+
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
450
|
+
instrumentations[key] = function(...args) {
|
|
451
|
+
pauseTracking();
|
|
452
|
+
const res = toRaw(this)[key].apply(this, args);
|
|
453
|
+
resetTracking();
|
|
454
|
+
return res;
|
|
596
455
|
};
|
|
456
|
+
});
|
|
457
|
+
return instrumentations;
|
|
597
458
|
}
|
|
598
|
-
function
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
459
|
+
function hasOwnProperty(key) {
|
|
460
|
+
const obj = toRaw(this);
|
|
461
|
+
track(obj, "has", key);
|
|
462
|
+
return obj.hasOwnProperty(key);
|
|
463
|
+
}
|
|
464
|
+
function createGetter(isReadonly2 = false, shallow = false) {
|
|
465
|
+
return function get2(target, key, receiver) {
|
|
466
|
+
if (key === "__v_isReactive") {
|
|
467
|
+
return !isReadonly2;
|
|
468
|
+
} else if (key === "__v_isReadonly") {
|
|
469
|
+
return isReadonly2;
|
|
470
|
+
} else if (key === "__v_isShallow") {
|
|
471
|
+
return shallow;
|
|
472
|
+
} else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
|
|
473
|
+
return target;
|
|
474
|
+
}
|
|
475
|
+
const targetIsArray = isArray(target);
|
|
476
|
+
if (!isReadonly2) {
|
|
477
|
+
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
|
478
|
+
return Reflect.get(arrayInstrumentations, key, receiver);
|
|
479
|
+
}
|
|
480
|
+
if (key === "hasOwnProperty") {
|
|
481
|
+
return hasOwnProperty;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
const res = Reflect.get(target, key, receiver);
|
|
485
|
+
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
486
|
+
return res;
|
|
487
|
+
}
|
|
488
|
+
if (!isReadonly2) {
|
|
489
|
+
track(target, "get", key);
|
|
490
|
+
}
|
|
491
|
+
if (shallow) {
|
|
492
|
+
return res;
|
|
493
|
+
}
|
|
494
|
+
if (isRef(res)) {
|
|
495
|
+
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
496
|
+
}
|
|
497
|
+
if (isObject(res)) {
|
|
498
|
+
return isReadonly2 ? readonly(res) : reactive(res);
|
|
499
|
+
}
|
|
500
|
+
return res;
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
const set$1 = /* @__PURE__ */ createSetter();
|
|
504
|
+
const shallowSet = /* @__PURE__ */ createSetter(true);
|
|
505
|
+
function createSetter(shallow = false) {
|
|
506
|
+
return function set2(target, key, value, receiver) {
|
|
507
|
+
let oldValue = target[key];
|
|
508
|
+
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
if (!shallow) {
|
|
512
|
+
if (!isShallow(value) && !isReadonly(value)) {
|
|
513
|
+
oldValue = toRaw(oldValue);
|
|
514
|
+
value = toRaw(value);
|
|
515
|
+
}
|
|
516
|
+
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
517
|
+
oldValue.value = value;
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
|
522
|
+
const result = Reflect.set(target, key, value, receiver);
|
|
523
|
+
if (target === toRaw(receiver)) {
|
|
524
|
+
if (!hadKey) {
|
|
525
|
+
trigger(target, "add", key, value);
|
|
526
|
+
} else if (hasChanged(value, oldValue)) {
|
|
527
|
+
trigger(target, "set", key, value, oldValue);
|
|
528
|
+
}
|
|
604
529
|
}
|
|
605
530
|
return result;
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
function deleteProperty(target, key) {
|
|
534
|
+
const hadKey = hasOwn(target, key);
|
|
535
|
+
const oldValue = target[key];
|
|
536
|
+
const result = Reflect.deleteProperty(target, key);
|
|
537
|
+
if (result && hadKey) {
|
|
538
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
539
|
+
}
|
|
540
|
+
return result;
|
|
606
541
|
}
|
|
607
542
|
function has$1(target, key) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
543
|
+
const result = Reflect.has(target, key);
|
|
544
|
+
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
545
|
+
track(target, "has", key);
|
|
546
|
+
}
|
|
547
|
+
return result;
|
|
613
548
|
}
|
|
614
549
|
function ownKeys(target) {
|
|
615
|
-
|
|
616
|
-
|
|
550
|
+
track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
|
|
551
|
+
return Reflect.ownKeys(target);
|
|
617
552
|
}
|
|
618
553
|
const mutableHandlers = {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
554
|
+
get: get$1,
|
|
555
|
+
set: set$1,
|
|
556
|
+
deleteProperty,
|
|
557
|
+
has: has$1,
|
|
558
|
+
ownKeys
|
|
624
559
|
};
|
|
625
560
|
const readonlyHandlers = {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
561
|
+
get: readonlyGet,
|
|
562
|
+
set(target, key) {
|
|
563
|
+
{
|
|
564
|
+
warn(
|
|
565
|
+
`Set operation on key "${String(key)}" failed: target is readonly.`,
|
|
566
|
+
target
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
return true;
|
|
570
|
+
},
|
|
571
|
+
deleteProperty(target, key) {
|
|
572
|
+
{
|
|
573
|
+
warn(
|
|
574
|
+
`Delete operation on key "${String(key)}" failed: target is readonly.`,
|
|
575
|
+
target
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
639
580
|
};
|
|
640
|
-
const shallowReactiveHandlers =
|
|
581
|
+
const shallowReactiveHandlers = /* @__PURE__ */ extend(
|
|
582
|
+
{},
|
|
583
|
+
mutableHandlers,
|
|
584
|
+
{
|
|
641
585
|
get: shallowGet,
|
|
642
586
|
set: shallowSet
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
const shallowReadonlyHandlers = /* @__PURE__ */ extend(
|
|
590
|
+
{},
|
|
591
|
+
readonlyHandlers,
|
|
592
|
+
{
|
|
648
593
|
get: shallowReadonlyGet
|
|
649
|
-
|
|
594
|
+
}
|
|
595
|
+
);
|
|
650
596
|
|
|
651
597
|
const toShallow = (value) => value;
|
|
652
598
|
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
653
599
|
function get(target, key, isReadonly = false, isShallow = false) {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
else if (target !== rawTarget) {
|
|
674
|
-
// #3602 readonly(reactive(Map))
|
|
675
|
-
// ensure that the nested reactive `Map` can do tracking for itself
|
|
676
|
-
target.get(key);
|
|
677
|
-
}
|
|
600
|
+
target = target["__v_raw"];
|
|
601
|
+
const rawTarget = toRaw(target);
|
|
602
|
+
const rawKey = toRaw(key);
|
|
603
|
+
if (!isReadonly) {
|
|
604
|
+
if (key !== rawKey) {
|
|
605
|
+
track(rawTarget, "get", key);
|
|
606
|
+
}
|
|
607
|
+
track(rawTarget, "get", rawKey);
|
|
608
|
+
}
|
|
609
|
+
const { has: has2 } = getProto(rawTarget);
|
|
610
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
611
|
+
if (has2.call(rawTarget, key)) {
|
|
612
|
+
return wrap(target.get(key));
|
|
613
|
+
} else if (has2.call(rawTarget, rawKey)) {
|
|
614
|
+
return wrap(target.get(rawKey));
|
|
615
|
+
} else if (target !== rawTarget) {
|
|
616
|
+
target.get(key);
|
|
617
|
+
}
|
|
678
618
|
}
|
|
679
619
|
function has(key, isReadonly = false) {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}
|
|
687
|
-
track(rawTarget, "has" /* TrackOpTypes.HAS */, rawKey);
|
|
620
|
+
const target = this["__v_raw"];
|
|
621
|
+
const rawTarget = toRaw(target);
|
|
622
|
+
const rawKey = toRaw(key);
|
|
623
|
+
if (!isReadonly) {
|
|
624
|
+
if (key !== rawKey) {
|
|
625
|
+
track(rawTarget, "has", key);
|
|
688
626
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
627
|
+
track(rawTarget, "has", rawKey);
|
|
628
|
+
}
|
|
629
|
+
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
692
630
|
}
|
|
693
631
|
function size(target, isReadonly = false) {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
632
|
+
target = target["__v_raw"];
|
|
633
|
+
!isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
|
|
634
|
+
return Reflect.get(target, "size", target);
|
|
697
635
|
}
|
|
698
636
|
function add(value) {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
637
|
+
value = toRaw(value);
|
|
638
|
+
const target = toRaw(this);
|
|
639
|
+
const proto = getProto(target);
|
|
640
|
+
const hadKey = proto.has.call(target, value);
|
|
641
|
+
if (!hadKey) {
|
|
642
|
+
target.add(value);
|
|
643
|
+
trigger(target, "add", value, value);
|
|
644
|
+
}
|
|
645
|
+
return this;
|
|
708
646
|
}
|
|
709
647
|
function set(key, value) {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
729
|
-
return this;
|
|
648
|
+
value = toRaw(value);
|
|
649
|
+
const target = toRaw(this);
|
|
650
|
+
const { has: has2, get: get2 } = getProto(target);
|
|
651
|
+
let hadKey = has2.call(target, key);
|
|
652
|
+
if (!hadKey) {
|
|
653
|
+
key = toRaw(key);
|
|
654
|
+
hadKey = has2.call(target, key);
|
|
655
|
+
} else {
|
|
656
|
+
checkIdentityKeys(target, has2, key);
|
|
657
|
+
}
|
|
658
|
+
const oldValue = get2.call(target, key);
|
|
659
|
+
target.set(key, value);
|
|
660
|
+
if (!hadKey) {
|
|
661
|
+
trigger(target, "add", key, value);
|
|
662
|
+
} else if (hasChanged(value, oldValue)) {
|
|
663
|
+
trigger(target, "set", key, value, oldValue);
|
|
664
|
+
}
|
|
665
|
+
return this;
|
|
730
666
|
}
|
|
731
667
|
function deleteEntry(key) {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
}
|
|
748
|
-
return result;
|
|
668
|
+
const target = toRaw(this);
|
|
669
|
+
const { has: has2, get: get2 } = getProto(target);
|
|
670
|
+
let hadKey = has2.call(target, key);
|
|
671
|
+
if (!hadKey) {
|
|
672
|
+
key = toRaw(key);
|
|
673
|
+
hadKey = has2.call(target, key);
|
|
674
|
+
} else {
|
|
675
|
+
checkIdentityKeys(target, has2, key);
|
|
676
|
+
}
|
|
677
|
+
const oldValue = get2 ? get2.call(target, key) : void 0;
|
|
678
|
+
const result = target.delete(key);
|
|
679
|
+
if (hadKey) {
|
|
680
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
681
|
+
}
|
|
682
|
+
return result;
|
|
749
683
|
}
|
|
750
684
|
function clear() {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
if (hadItems) {
|
|
760
|
-
trigger(target, "clear" /* TriggerOpTypes.CLEAR */, undefined, undefined, oldTarget);
|
|
761
|
-
}
|
|
762
|
-
return result;
|
|
685
|
+
const target = toRaw(this);
|
|
686
|
+
const hadItems = target.size !== 0;
|
|
687
|
+
const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
|
|
688
|
+
const result = target.clear();
|
|
689
|
+
if (hadItems) {
|
|
690
|
+
trigger(target, "clear", void 0, void 0, oldTarget);
|
|
691
|
+
}
|
|
692
|
+
return result;
|
|
763
693
|
}
|
|
764
694
|
function createForEach(isReadonly, isShallow) {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
776
|
-
});
|
|
777
|
-
};
|
|
695
|
+
return function forEach(callback, thisArg) {
|
|
696
|
+
const observed = this;
|
|
697
|
+
const target = observed["__v_raw"];
|
|
698
|
+
const rawTarget = toRaw(target);
|
|
699
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
700
|
+
!isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
|
|
701
|
+
return target.forEach((value, key) => {
|
|
702
|
+
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
703
|
+
});
|
|
704
|
+
};
|
|
778
705
|
}
|
|
779
706
|
function createIterableMethod(method, isReadonly, isShallow) {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
done
|
|
801
|
-
};
|
|
802
|
-
},
|
|
803
|
-
// iterable protocol
|
|
804
|
-
[Symbol.iterator]() {
|
|
805
|
-
return this;
|
|
806
|
-
}
|
|
707
|
+
return function(...args) {
|
|
708
|
+
const target = this["__v_raw"];
|
|
709
|
+
const rawTarget = toRaw(target);
|
|
710
|
+
const targetIsMap = isMap(rawTarget);
|
|
711
|
+
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
712
|
+
const isKeyOnly = method === "keys" && targetIsMap;
|
|
713
|
+
const innerIterator = target[method](...args);
|
|
714
|
+
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
715
|
+
!isReadonly && track(
|
|
716
|
+
rawTarget,
|
|
717
|
+
"iterate",
|
|
718
|
+
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
|
|
719
|
+
);
|
|
720
|
+
return {
|
|
721
|
+
// iterator protocol
|
|
722
|
+
next() {
|
|
723
|
+
const { value, done } = innerIterator.next();
|
|
724
|
+
return done ? { value, done } : {
|
|
725
|
+
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
726
|
+
done
|
|
807
727
|
};
|
|
728
|
+
},
|
|
729
|
+
// iterable protocol
|
|
730
|
+
[Symbol.iterator]() {
|
|
731
|
+
return this;
|
|
732
|
+
}
|
|
808
733
|
};
|
|
734
|
+
};
|
|
809
735
|
}
|
|
810
736
|
function createReadonlyMethod(type) {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
|
|
737
|
+
return function(...args) {
|
|
738
|
+
{
|
|
739
|
+
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
740
|
+
console.warn(
|
|
741
|
+
`${capitalize(type)} operation ${key}failed: target is readonly.`,
|
|
742
|
+
toRaw(this)
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
return type === "delete" ? false : this;
|
|
746
|
+
};
|
|
818
747
|
}
|
|
819
748
|
function createInstrumentations() {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
]
|
|
893
|
-
|
|
894
|
-
|
|
749
|
+
const mutableInstrumentations2 = {
|
|
750
|
+
get(key) {
|
|
751
|
+
return get(this, key);
|
|
752
|
+
},
|
|
753
|
+
get size() {
|
|
754
|
+
return size(this);
|
|
755
|
+
},
|
|
756
|
+
has,
|
|
757
|
+
add,
|
|
758
|
+
set,
|
|
759
|
+
delete: deleteEntry,
|
|
760
|
+
clear,
|
|
761
|
+
forEach: createForEach(false, false)
|
|
762
|
+
};
|
|
763
|
+
const shallowInstrumentations2 = {
|
|
764
|
+
get(key) {
|
|
765
|
+
return get(this, key, false, true);
|
|
766
|
+
},
|
|
767
|
+
get size() {
|
|
768
|
+
return size(this);
|
|
769
|
+
},
|
|
770
|
+
has,
|
|
771
|
+
add,
|
|
772
|
+
set,
|
|
773
|
+
delete: deleteEntry,
|
|
774
|
+
clear,
|
|
775
|
+
forEach: createForEach(false, true)
|
|
776
|
+
};
|
|
777
|
+
const readonlyInstrumentations2 = {
|
|
778
|
+
get(key) {
|
|
779
|
+
return get(this, key, true);
|
|
780
|
+
},
|
|
781
|
+
get size() {
|
|
782
|
+
return size(this, true);
|
|
783
|
+
},
|
|
784
|
+
has(key) {
|
|
785
|
+
return has.call(this, key, true);
|
|
786
|
+
},
|
|
787
|
+
add: createReadonlyMethod("add"),
|
|
788
|
+
set: createReadonlyMethod("set"),
|
|
789
|
+
delete: createReadonlyMethod("delete"),
|
|
790
|
+
clear: createReadonlyMethod("clear"),
|
|
791
|
+
forEach: createForEach(true, false)
|
|
792
|
+
};
|
|
793
|
+
const shallowReadonlyInstrumentations2 = {
|
|
794
|
+
get(key) {
|
|
795
|
+
return get(this, key, true, true);
|
|
796
|
+
},
|
|
797
|
+
get size() {
|
|
798
|
+
return size(this, true);
|
|
799
|
+
},
|
|
800
|
+
has(key) {
|
|
801
|
+
return has.call(this, key, true);
|
|
802
|
+
},
|
|
803
|
+
add: createReadonlyMethod("add"),
|
|
804
|
+
set: createReadonlyMethod("set"),
|
|
805
|
+
delete: createReadonlyMethod("delete"),
|
|
806
|
+
clear: createReadonlyMethod("clear"),
|
|
807
|
+
forEach: createForEach(true, true)
|
|
808
|
+
};
|
|
809
|
+
const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
|
|
810
|
+
iteratorMethods.forEach((method) => {
|
|
811
|
+
mutableInstrumentations2[method] = createIterableMethod(
|
|
812
|
+
method,
|
|
813
|
+
false,
|
|
814
|
+
false
|
|
815
|
+
);
|
|
816
|
+
readonlyInstrumentations2[method] = createIterableMethod(
|
|
817
|
+
method,
|
|
818
|
+
true,
|
|
819
|
+
false
|
|
820
|
+
);
|
|
821
|
+
shallowInstrumentations2[method] = createIterableMethod(
|
|
822
|
+
method,
|
|
823
|
+
false,
|
|
824
|
+
true
|
|
825
|
+
);
|
|
826
|
+
shallowReadonlyInstrumentations2[method] = createIterableMethod(
|
|
827
|
+
method,
|
|
828
|
+
true,
|
|
829
|
+
true
|
|
830
|
+
);
|
|
831
|
+
});
|
|
832
|
+
return [
|
|
833
|
+
mutableInstrumentations2,
|
|
834
|
+
readonlyInstrumentations2,
|
|
835
|
+
shallowInstrumentations2,
|
|
836
|
+
shallowReadonlyInstrumentations2
|
|
837
|
+
];
|
|
838
|
+
}
|
|
839
|
+
const [
|
|
840
|
+
mutableInstrumentations,
|
|
841
|
+
readonlyInstrumentations,
|
|
842
|
+
shallowInstrumentations,
|
|
843
|
+
shallowReadonlyInstrumentations
|
|
844
|
+
] = /* @__PURE__ */ createInstrumentations();
|
|
895
845
|
function createInstrumentationGetter(isReadonly, shallow) {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
return target;
|
|
912
|
-
}
|
|
913
|
-
return Reflect.get(hasOwn(instrumentations, key) && key in target
|
|
914
|
-
? instrumentations
|
|
915
|
-
: target, key, receiver);
|
|
916
|
-
};
|
|
846
|
+
const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
|
|
847
|
+
return (target, key, receiver) => {
|
|
848
|
+
if (key === "__v_isReactive") {
|
|
849
|
+
return !isReadonly;
|
|
850
|
+
} else if (key === "__v_isReadonly") {
|
|
851
|
+
return isReadonly;
|
|
852
|
+
} else if (key === "__v_raw") {
|
|
853
|
+
return target;
|
|
854
|
+
}
|
|
855
|
+
return Reflect.get(
|
|
856
|
+
hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
|
857
|
+
key,
|
|
858
|
+
receiver
|
|
859
|
+
);
|
|
860
|
+
};
|
|
917
861
|
}
|
|
918
862
|
const mutableCollectionHandlers = {
|
|
919
|
-
|
|
863
|
+
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
920
864
|
};
|
|
921
865
|
const shallowCollectionHandlers = {
|
|
922
|
-
|
|
866
|
+
get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
|
923
867
|
};
|
|
924
868
|
const readonlyCollectionHandlers = {
|
|
925
|
-
|
|
869
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
926
870
|
};
|
|
927
871
|
const shallowReadonlyCollectionHandlers = {
|
|
928
|
-
|
|
872
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
|
929
873
|
};
|
|
930
|
-
function checkIdentityKeys(target,
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
`of an object and only use the reactive version if possible.`);
|
|
939
|
-
}
|
|
874
|
+
function checkIdentityKeys(target, has2, key) {
|
|
875
|
+
const rawKey = toRaw(key);
|
|
876
|
+
if (rawKey !== key && has2.call(target, rawKey)) {
|
|
877
|
+
const type = toRawType(target);
|
|
878
|
+
console.warn(
|
|
879
|
+
`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.`
|
|
880
|
+
);
|
|
881
|
+
}
|
|
940
882
|
}
|
|
941
883
|
|
|
942
|
-
const reactiveMap = new WeakMap();
|
|
943
|
-
const shallowReactiveMap = new WeakMap();
|
|
944
|
-
const readonlyMap = new WeakMap();
|
|
945
|
-
const shallowReadonlyMap = new WeakMap();
|
|
884
|
+
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
885
|
+
const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
886
|
+
const readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
887
|
+
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
946
888
|
function targetTypeMap(rawType) {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
889
|
+
switch (rawType) {
|
|
890
|
+
case "Object":
|
|
891
|
+
case "Array":
|
|
892
|
+
return 1 /* COMMON */;
|
|
893
|
+
case "Map":
|
|
894
|
+
case "Set":
|
|
895
|
+
case "WeakMap":
|
|
896
|
+
case "WeakSet":
|
|
897
|
+
return 2 /* COLLECTION */;
|
|
898
|
+
default:
|
|
899
|
+
return 0 /* INVALID */;
|
|
900
|
+
}
|
|
959
901
|
}
|
|
960
902
|
function getTargetType(value) {
|
|
961
|
-
|
|
962
|
-
? 0 /* TargetType.INVALID */
|
|
963
|
-
: targetTypeMap(toRawType(value));
|
|
903
|
+
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
|
|
964
904
|
}
|
|
965
905
|
function reactive(target) {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
906
|
+
if (isReadonly(target)) {
|
|
907
|
+
return target;
|
|
908
|
+
}
|
|
909
|
+
return createReactiveObject(
|
|
910
|
+
target,
|
|
911
|
+
false,
|
|
912
|
+
mutableHandlers,
|
|
913
|
+
mutableCollectionHandlers,
|
|
914
|
+
reactiveMap
|
|
915
|
+
);
|
|
971
916
|
}
|
|
972
|
-
/**
|
|
973
|
-
* Return a shallowly-reactive copy of the original object, where only the root
|
|
974
|
-
* level properties are reactive. It also does not auto-unwrap refs (even at the
|
|
975
|
-
* root level).
|
|
976
|
-
*/
|
|
977
917
|
function shallowReactive(target) {
|
|
978
|
-
|
|
918
|
+
return createReactiveObject(
|
|
919
|
+
target,
|
|
920
|
+
false,
|
|
921
|
+
shallowReactiveHandlers,
|
|
922
|
+
shallowCollectionHandlers,
|
|
923
|
+
shallowReactiveMap
|
|
924
|
+
);
|
|
979
925
|
}
|
|
980
|
-
/**
|
|
981
|
-
* Creates a readonly copy of the original object. Note the returned copy is not
|
|
982
|
-
* made reactive, but `readonly` can be called on an already reactive object.
|
|
983
|
-
*/
|
|
984
926
|
function readonly(target) {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
*/
|
|
993
|
-
function shallowReadonly(target) {
|
|
994
|
-
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
927
|
+
return createReactiveObject(
|
|
928
|
+
target,
|
|
929
|
+
true,
|
|
930
|
+
readonlyHandlers,
|
|
931
|
+
readonlyCollectionHandlers,
|
|
932
|
+
readonlyMap
|
|
933
|
+
);
|
|
995
934
|
}
|
|
996
|
-
function
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
return
|
|
935
|
+
function shallowReadonly(target) {
|
|
936
|
+
return createReactiveObject(
|
|
937
|
+
target,
|
|
938
|
+
true,
|
|
939
|
+
shallowReadonlyHandlers,
|
|
940
|
+
shallowReadonlyCollectionHandlers,
|
|
941
|
+
shallowReadonlyMap
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
945
|
+
if (!isObject(target)) {
|
|
946
|
+
{
|
|
947
|
+
console.warn(`value cannot be made reactive: ${String(target)}`);
|
|
948
|
+
}
|
|
949
|
+
return target;
|
|
950
|
+
}
|
|
951
|
+
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
952
|
+
return target;
|
|
953
|
+
}
|
|
954
|
+
const existingProxy = proxyMap.get(target);
|
|
955
|
+
if (existingProxy) {
|
|
956
|
+
return existingProxy;
|
|
957
|
+
}
|
|
958
|
+
const targetType = getTargetType(target);
|
|
959
|
+
if (targetType === 0 /* INVALID */) {
|
|
960
|
+
return target;
|
|
961
|
+
}
|
|
962
|
+
const proxy = new Proxy(
|
|
963
|
+
target,
|
|
964
|
+
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
|
|
965
|
+
);
|
|
966
|
+
proxyMap.set(target, proxy);
|
|
967
|
+
return proxy;
|
|
1022
968
|
}
|
|
1023
969
|
function isReactive(value) {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
970
|
+
if (isReadonly(value)) {
|
|
971
|
+
return isReactive(value["__v_raw"]);
|
|
972
|
+
}
|
|
973
|
+
return !!(value && value["__v_isReactive"]);
|
|
1028
974
|
}
|
|
1029
975
|
function isReadonly(value) {
|
|
1030
|
-
|
|
976
|
+
return !!(value && value["__v_isReadonly"]);
|
|
1031
977
|
}
|
|
1032
978
|
function isShallow(value) {
|
|
1033
|
-
|
|
979
|
+
return !!(value && value["__v_isShallow"]);
|
|
1034
980
|
}
|
|
1035
981
|
function isProxy(value) {
|
|
1036
|
-
|
|
982
|
+
return isReactive(value) || isReadonly(value);
|
|
1037
983
|
}
|
|
1038
984
|
function toRaw(observed) {
|
|
1039
|
-
|
|
1040
|
-
|
|
985
|
+
const raw = observed && observed["__v_raw"];
|
|
986
|
+
return raw ? toRaw(raw) : observed;
|
|
1041
987
|
}
|
|
1042
988
|
function markRaw(value) {
|
|
1043
|
-
|
|
1044
|
-
|
|
989
|
+
def(value, "__v_skip", true);
|
|
990
|
+
return value;
|
|
1045
991
|
}
|
|
1046
992
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1047
993
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1048
994
|
|
|
1049
|
-
function trackRefValue(
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
}
|
|
1061
|
-
function triggerRefValue(
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
995
|
+
function trackRefValue(ref2) {
|
|
996
|
+
if (shouldTrack && activeEffect) {
|
|
997
|
+
ref2 = toRaw(ref2);
|
|
998
|
+
{
|
|
999
|
+
trackEffects(ref2.dep || (ref2.dep = createDep()), {
|
|
1000
|
+
target: ref2,
|
|
1001
|
+
type: "get",
|
|
1002
|
+
key: "value"
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
function triggerRefValue(ref2, newVal) {
|
|
1008
|
+
ref2 = toRaw(ref2);
|
|
1009
|
+
const dep = ref2.dep;
|
|
1010
|
+
if (dep) {
|
|
1011
|
+
{
|
|
1012
|
+
triggerEffects(dep, {
|
|
1013
|
+
target: ref2,
|
|
1014
|
+
type: "set",
|
|
1015
|
+
key: "value",
|
|
1016
|
+
newValue: newVal
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1074
1020
|
}
|
|
1075
1021
|
function isRef(r) {
|
|
1076
|
-
|
|
1022
|
+
return !!(r && r.__v_isRef === true);
|
|
1077
1023
|
}
|
|
1078
1024
|
function ref(value) {
|
|
1079
|
-
|
|
1025
|
+
return createRef(value, false);
|
|
1080
1026
|
}
|
|
1081
1027
|
function shallowRef(value) {
|
|
1082
|
-
|
|
1028
|
+
return createRef(value, true);
|
|
1083
1029
|
}
|
|
1084
1030
|
function createRef(rawValue, shallow) {
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1031
|
+
if (isRef(rawValue)) {
|
|
1032
|
+
return rawValue;
|
|
1033
|
+
}
|
|
1034
|
+
return new RefImpl(rawValue, shallow);
|
|
1089
1035
|
}
|
|
1090
1036
|
class RefImpl {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
}
|
|
1112
|
-
function triggerRef(
|
|
1113
|
-
|
|
1114
|
-
}
|
|
1115
|
-
function unref(
|
|
1116
|
-
|
|
1037
|
+
constructor(value, __v_isShallow) {
|
|
1038
|
+
this.__v_isShallow = __v_isShallow;
|
|
1039
|
+
this.dep = void 0;
|
|
1040
|
+
this.__v_isRef = true;
|
|
1041
|
+
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1042
|
+
this._value = __v_isShallow ? value : toReactive(value);
|
|
1043
|
+
}
|
|
1044
|
+
get value() {
|
|
1045
|
+
trackRefValue(this);
|
|
1046
|
+
return this._value;
|
|
1047
|
+
}
|
|
1048
|
+
set value(newVal) {
|
|
1049
|
+
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
|
|
1050
|
+
newVal = useDirectValue ? newVal : toRaw(newVal);
|
|
1051
|
+
if (hasChanged(newVal, this._rawValue)) {
|
|
1052
|
+
this._rawValue = newVal;
|
|
1053
|
+
this._value = useDirectValue ? newVal : toReactive(newVal);
|
|
1054
|
+
triggerRefValue(this, newVal);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function triggerRef(ref2) {
|
|
1059
|
+
triggerRefValue(ref2, ref2.value );
|
|
1060
|
+
}
|
|
1061
|
+
function unref(ref2) {
|
|
1062
|
+
return isRef(ref2) ? ref2.value : ref2;
|
|
1117
1063
|
}
|
|
1118
1064
|
const shallowUnwrapHandlers = {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
return Reflect.set(target, key, value, receiver);
|
|
1128
|
-
}
|
|
1065
|
+
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
|
1066
|
+
set: (target, key, value, receiver) => {
|
|
1067
|
+
const oldValue = target[key];
|
|
1068
|
+
if (isRef(oldValue) && !isRef(value)) {
|
|
1069
|
+
oldValue.value = value;
|
|
1070
|
+
return true;
|
|
1071
|
+
} else {
|
|
1072
|
+
return Reflect.set(target, key, value, receiver);
|
|
1129
1073
|
}
|
|
1074
|
+
}
|
|
1130
1075
|
};
|
|
1131
1076
|
function proxyRefs(objectWithRefs) {
|
|
1132
|
-
|
|
1133
|
-
? objectWithRefs
|
|
1134
|
-
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1077
|
+
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1135
1078
|
}
|
|
1136
1079
|
class CustomRefImpl {
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1080
|
+
constructor(factory) {
|
|
1081
|
+
this.dep = void 0;
|
|
1082
|
+
this.__v_isRef = true;
|
|
1083
|
+
const { get, set } = factory(
|
|
1084
|
+
() => trackRefValue(this),
|
|
1085
|
+
() => triggerRefValue(this)
|
|
1086
|
+
);
|
|
1087
|
+
this._get = get;
|
|
1088
|
+
this._set = set;
|
|
1089
|
+
}
|
|
1090
|
+
get value() {
|
|
1091
|
+
return this._get();
|
|
1092
|
+
}
|
|
1093
|
+
set value(newVal) {
|
|
1094
|
+
this._set(newVal);
|
|
1095
|
+
}
|
|
1150
1096
|
}
|
|
1151
1097
|
function customRef(factory) {
|
|
1152
|
-
|
|
1098
|
+
return new CustomRefImpl(factory);
|
|
1153
1099
|
}
|
|
1154
1100
|
function toRefs(object) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1101
|
+
if (!isProxy(object)) {
|
|
1102
|
+
console.warn(`toRefs() expects a reactive object but received a plain one.`);
|
|
1103
|
+
}
|
|
1104
|
+
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1105
|
+
for (const key in object) {
|
|
1106
|
+
ret[key] = toRef(object, key);
|
|
1107
|
+
}
|
|
1108
|
+
return ret;
|
|
1163
1109
|
}
|
|
1164
1110
|
class ObjectRefImpl {
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1111
|
+
constructor(_object, _key, _defaultValue) {
|
|
1112
|
+
this._object = _object;
|
|
1113
|
+
this._key = _key;
|
|
1114
|
+
this._defaultValue = _defaultValue;
|
|
1115
|
+
this.__v_isRef = true;
|
|
1116
|
+
}
|
|
1117
|
+
get value() {
|
|
1118
|
+
const val = this._object[this._key];
|
|
1119
|
+
return val === void 0 ? this._defaultValue : val;
|
|
1120
|
+
}
|
|
1121
|
+
set value(newVal) {
|
|
1122
|
+
this._object[this._key] = newVal;
|
|
1123
|
+
}
|
|
1124
|
+
get dep() {
|
|
1125
|
+
return getDepFromReactive(toRaw(this._object), this._key);
|
|
1126
|
+
}
|
|
1181
1127
|
}
|
|
1182
1128
|
function toRef(object, key, defaultValue) {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
? val
|
|
1186
|
-
: new ObjectRefImpl(object, key, defaultValue);
|
|
1129
|
+
const val = object[key];
|
|
1130
|
+
return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
|
|
1187
1131
|
}
|
|
1188
1132
|
|
|
1189
|
-
var _a$1;
|
|
1190
1133
|
class ComputedRefImpl {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1134
|
+
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1135
|
+
this._setter = _setter;
|
|
1136
|
+
this.dep = void 0;
|
|
1137
|
+
this.__v_isRef = true;
|
|
1138
|
+
this["__v_isReadonly"] = false;
|
|
1139
|
+
this._dirty = true;
|
|
1140
|
+
this.effect = new ReactiveEffect(getter, () => {
|
|
1141
|
+
if (!this._dirty) {
|
|
1196
1142
|
this._dirty = true;
|
|
1197
|
-
this
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
}
|
|
1217
|
-
set value(newValue) {
|
|
1218
|
-
this._setter(newValue);
|
|
1219
|
-
}
|
|
1143
|
+
triggerRefValue(this);
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
this.effect.computed = this;
|
|
1147
|
+
this.effect.active = this._cacheable = !isSSR;
|
|
1148
|
+
this["__v_isReadonly"] = isReadonly;
|
|
1149
|
+
}
|
|
1150
|
+
get value() {
|
|
1151
|
+
const self = toRaw(this);
|
|
1152
|
+
trackRefValue(self);
|
|
1153
|
+
if (self._dirty || !self._cacheable) {
|
|
1154
|
+
self._dirty = false;
|
|
1155
|
+
self._value = self.effect.run();
|
|
1156
|
+
}
|
|
1157
|
+
return self._value;
|
|
1158
|
+
}
|
|
1159
|
+
set value(newValue) {
|
|
1160
|
+
this._setter(newValue);
|
|
1161
|
+
}
|
|
1220
1162
|
}
|
|
1221
|
-
_a$1 = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
|
|
1222
1163
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
}
|
|
1242
|
-
return cRef;
|
|
1164
|
+
let getter;
|
|
1165
|
+
let setter;
|
|
1166
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1167
|
+
if (onlyGetter) {
|
|
1168
|
+
getter = getterOrOptions;
|
|
1169
|
+
setter = () => {
|
|
1170
|
+
console.warn("Write operation failed: computed value is readonly");
|
|
1171
|
+
} ;
|
|
1172
|
+
} else {
|
|
1173
|
+
getter = getterOrOptions.get;
|
|
1174
|
+
setter = getterOrOptions.set;
|
|
1175
|
+
}
|
|
1176
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1177
|
+
if (debugOptions && !isSSR) {
|
|
1178
|
+
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1179
|
+
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1180
|
+
}
|
|
1181
|
+
return cRef;
|
|
1243
1182
|
}
|
|
1244
1183
|
|
|
1245
|
-
|
|
1246
|
-
const tick = /*#__PURE__*/ Promise.resolve();
|
|
1184
|
+
const tick = /* @__PURE__ */ Promise.resolve();
|
|
1247
1185
|
const queue = [];
|
|
1248
1186
|
let queued = false;
|
|
1249
1187
|
const scheduler = (fn) => {
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1188
|
+
queue.push(fn);
|
|
1189
|
+
if (!queued) {
|
|
1190
|
+
queued = true;
|
|
1191
|
+
tick.then(flush);
|
|
1192
|
+
}
|
|
1255
1193
|
};
|
|
1256
1194
|
const flush = () => {
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1195
|
+
for (let i = 0; i < queue.length; i++) {
|
|
1196
|
+
queue[i]();
|
|
1197
|
+
}
|
|
1198
|
+
queue.length = 0;
|
|
1199
|
+
queued = false;
|
|
1262
1200
|
};
|
|
1263
1201
|
class DeferredComputedRefImpl {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
triggerRefValue(this);
|
|
1285
|
-
}
|
|
1286
|
-
scheduled = false;
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1289
|
-
// chained upstream computeds are notified synchronously to ensure
|
|
1290
|
-
// value invalidation in case of sync access; normal effects are
|
|
1291
|
-
// deferred to be triggered in scheduler.
|
|
1292
|
-
for (const e of this.dep) {
|
|
1293
|
-
if (e.computed instanceof DeferredComputedRefImpl) {
|
|
1294
|
-
e.scheduler(true /* computedTrigger */);
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1202
|
+
constructor(getter) {
|
|
1203
|
+
this.dep = void 0;
|
|
1204
|
+
this._dirty = true;
|
|
1205
|
+
this.__v_isRef = true;
|
|
1206
|
+
this["__v_isReadonly"] = true;
|
|
1207
|
+
let compareTarget;
|
|
1208
|
+
let hasCompareTarget = false;
|
|
1209
|
+
let scheduled = false;
|
|
1210
|
+
this.effect = new ReactiveEffect(getter, (computedTrigger) => {
|
|
1211
|
+
if (this.dep) {
|
|
1212
|
+
if (computedTrigger) {
|
|
1213
|
+
compareTarget = this._value;
|
|
1214
|
+
hasCompareTarget = true;
|
|
1215
|
+
} else if (!scheduled) {
|
|
1216
|
+
const valueToCompare = hasCompareTarget ? compareTarget : this._value;
|
|
1217
|
+
scheduled = true;
|
|
1218
|
+
hasCompareTarget = false;
|
|
1219
|
+
scheduler(() => {
|
|
1220
|
+
if (this.effect.active && this._get() !== valueToCompare) {
|
|
1221
|
+
triggerRefValue(this);
|
|
1297
1222
|
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
this.effect.computed = this;
|
|
1301
|
-
}
|
|
1302
|
-
_get() {
|
|
1303
|
-
if (this._dirty) {
|
|
1304
|
-
this._dirty = false;
|
|
1305
|
-
return (this._value = this.effect.run());
|
|
1223
|
+
scheduled = false;
|
|
1224
|
+
});
|
|
1306
1225
|
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1226
|
+
for (const e of this.dep) {
|
|
1227
|
+
if (e.computed instanceof DeferredComputedRefImpl) {
|
|
1228
|
+
e.scheduler(
|
|
1229
|
+
true
|
|
1230
|
+
/* computedTrigger */
|
|
1231
|
+
);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
this._dirty = true;
|
|
1236
|
+
});
|
|
1237
|
+
this.effect.computed = this;
|
|
1238
|
+
}
|
|
1239
|
+
_get() {
|
|
1240
|
+
if (this._dirty) {
|
|
1241
|
+
this._dirty = false;
|
|
1242
|
+
return this._value = this.effect.run();
|
|
1243
|
+
}
|
|
1244
|
+
return this._value;
|
|
1245
|
+
}
|
|
1246
|
+
get value() {
|
|
1247
|
+
trackRefValue(this);
|
|
1248
|
+
return toRaw(this)._get();
|
|
1249
|
+
}
|
|
1314
1250
|
}
|
|
1315
|
-
_a = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
|
|
1316
1251
|
function deferredComputed(getter) {
|
|
1317
|
-
|
|
1252
|
+
return new DeferredComputedRefImpl(getter);
|
|
1318
1253
|
}
|
|
1319
1254
|
|
|
1320
1255
|
exports.EffectScope = EffectScope;
|