@vue/reactivity 3.5.17 → 3.6.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/reactivity v3.5.17
2
+ * @vue/reactivity v3.6.0-alpha.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -18,12 +18,6 @@ var VueReactivity = (function (exports) {
18
18
  const NOOP = () => {
19
19
  };
20
20
  const extend = Object.assign;
21
- const remove = (arr, el) => {
22
- const i = arr.indexOf(el);
23
- if (i > -1) {
24
- arr.splice(i, 1);
25
- }
26
- };
27
21
  const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
28
22
  const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
29
23
  const isArray = Array.isArray;
@@ -64,633 +58,343 @@ var VueReactivity = (function (exports) {
64
58
  console.warn(`[Vue warn] ${msg}`, ...args);
65
59
  }
66
60
 
67
- let activeEffectScope;
68
- class EffectScope {
69
- constructor(detached = false) {
70
- this.detached = detached;
71
- /**
72
- * @internal
73
- */
74
- this._active = true;
75
- /**
76
- * @internal track `on` calls, allow `on` call multiple times
77
- */
78
- this._on = 0;
79
- /**
80
- * @internal
81
- */
82
- this.effects = [];
83
- /**
84
- * @internal
85
- */
86
- this.cleanups = [];
87
- this._isPaused = false;
88
- this.parent = activeEffectScope;
89
- if (!detached && activeEffectScope) {
90
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
91
- this
92
- ) - 1;
93
- }
61
+ var ReactiveFlags$1 = /* @__PURE__ */ ((ReactiveFlags2) => {
62
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
63
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
64
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
65
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
66
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
67
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
68
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
69
+ return ReactiveFlags2;
70
+ })(ReactiveFlags$1 || {});
71
+ const notifyBuffer = [];
72
+ let batchDepth = 0;
73
+ let activeSub = void 0;
74
+ let notifyIndex = 0;
75
+ let notifyBufferLength = 0;
76
+ function setActiveSub(sub) {
77
+ try {
78
+ return activeSub;
79
+ } finally {
80
+ activeSub = sub;
94
81
  }
95
- get active() {
96
- return this._active;
82
+ }
83
+ function startBatch() {
84
+ ++batchDepth;
85
+ }
86
+ function endBatch() {
87
+ if (!--batchDepth && notifyBufferLength) {
88
+ flush();
97
89
  }
98
- pause() {
99
- if (this._active) {
100
- this._isPaused = true;
101
- let i, l;
102
- if (this.scopes) {
103
- for (i = 0, l = this.scopes.length; i < l; i++) {
104
- this.scopes[i].pause();
105
- }
106
- }
107
- for (i = 0, l = this.effects.length; i < l; i++) {
108
- this.effects[i].pause();
109
- }
110
- }
90
+ }
91
+ function link(dep, sub) {
92
+ const prevDep = sub.depsTail;
93
+ if (prevDep !== void 0 && prevDep.dep === dep) {
94
+ return;
111
95
  }
112
- /**
113
- * Resumes the effect scope, including all child scopes and effects.
114
- */
115
- resume() {
116
- if (this._active) {
117
- if (this._isPaused) {
118
- this._isPaused = false;
119
- let i, l;
120
- if (this.scopes) {
121
- for (i = 0, l = this.scopes.length; i < l; i++) {
122
- this.scopes[i].resume();
123
- }
124
- }
125
- for (i = 0, l = this.effects.length; i < l; i++) {
126
- this.effects[i].resume();
127
- }
128
- }
96
+ let nextDep = void 0;
97
+ const recursedCheck = sub.flags & 4 /* RecursedCheck */;
98
+ if (recursedCheck) {
99
+ nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
100
+ if (nextDep !== void 0 && nextDep.dep === dep) {
101
+ sub.depsTail = nextDep;
102
+ return;
129
103
  }
130
104
  }
131
- run(fn) {
132
- if (this._active) {
133
- const currentEffectScope = activeEffectScope;
134
- try {
135
- activeEffectScope = this;
136
- return fn();
137
- } finally {
138
- activeEffectScope = currentEffectScope;
139
- }
140
- } else {
141
- warn(`cannot run an inactive effect scope.`);
142
- }
105
+ const prevSub = dep.subsTail;
106
+ const newLink = sub.depsTail = dep.subsTail = {
107
+ dep,
108
+ sub,
109
+ prevDep,
110
+ nextDep,
111
+ prevSub,
112
+ nextSub: void 0
113
+ };
114
+ if (nextDep !== void 0) {
115
+ nextDep.prevDep = newLink;
143
116
  }
144
- /**
145
- * This should only be called on non-detached scopes
146
- * @internal
147
- */
148
- on() {
149
- if (++this._on === 1) {
150
- this.prevScope = activeEffectScope;
151
- activeEffectScope = this;
152
- }
117
+ if (prevDep !== void 0) {
118
+ prevDep.nextDep = newLink;
119
+ } else {
120
+ sub.deps = newLink;
153
121
  }
154
- /**
155
- * This should only be called on non-detached scopes
156
- * @internal
157
- */
158
- off() {
159
- if (this._on > 0 && --this._on === 0) {
160
- activeEffectScope = this.prevScope;
161
- this.prevScope = void 0;
162
- }
163
- }
164
- stop(fromParent) {
165
- if (this._active) {
166
- this._active = false;
167
- let i, l;
168
- for (i = 0, l = this.effects.length; i < l; i++) {
169
- this.effects[i].stop();
170
- }
171
- this.effects.length = 0;
172
- for (i = 0, l = this.cleanups.length; i < l; i++) {
173
- this.cleanups[i]();
174
- }
175
- this.cleanups.length = 0;
176
- if (this.scopes) {
177
- for (i = 0, l = this.scopes.length; i < l; i++) {
178
- this.scopes[i].stop(true);
179
- }
180
- this.scopes.length = 0;
181
- }
182
- if (!this.detached && this.parent && !fromParent) {
183
- const last = this.parent.scopes.pop();
184
- if (last && last !== this) {
185
- this.parent.scopes[this.index] = last;
186
- last.index = this.index;
187
- }
188
- }
189
- this.parent = void 0;
190
- }
122
+ if (prevSub !== void 0) {
123
+ prevSub.nextSub = newLink;
124
+ } else {
125
+ dep.subs = newLink;
191
126
  }
192
127
  }
193
- function effectScope(detached) {
194
- return new EffectScope(detached);
195
- }
196
- function getCurrentScope() {
197
- return activeEffectScope;
198
- }
199
- function onScopeDispose(fn, failSilently = false) {
200
- if (activeEffectScope) {
201
- activeEffectScope.cleanups.push(fn);
202
- } else if (!failSilently) {
203
- warn(
204
- `onScopeDispose() is called when there is no active effect scope to be associated with.`
205
- );
128
+ function unlink(link2, sub = link2.sub) {
129
+ const dep = link2.dep;
130
+ const prevDep = link2.prevDep;
131
+ const nextDep = link2.nextDep;
132
+ const nextSub = link2.nextSub;
133
+ const prevSub = link2.prevSub;
134
+ if (nextDep !== void 0) {
135
+ nextDep.prevDep = prevDep;
136
+ } else {
137
+ sub.depsTail = prevDep;
206
138
  }
207
- }
208
-
209
- let activeSub;
210
- const EffectFlags = {
211
- "ACTIVE": 1,
212
- "1": "ACTIVE",
213
- "RUNNING": 2,
214
- "2": "RUNNING",
215
- "TRACKING": 4,
216
- "4": "TRACKING",
217
- "NOTIFIED": 8,
218
- "8": "NOTIFIED",
219
- "DIRTY": 16,
220
- "16": "DIRTY",
221
- "ALLOW_RECURSE": 32,
222
- "32": "ALLOW_RECURSE",
223
- "PAUSED": 64,
224
- "64": "PAUSED",
225
- "EVALUATED": 128,
226
- "128": "EVALUATED"
227
- };
228
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
229
- class ReactiveEffect {
230
- constructor(fn) {
231
- this.fn = fn;
232
- /**
233
- * @internal
234
- */
235
- this.deps = void 0;
236
- /**
237
- * @internal
238
- */
239
- this.depsTail = void 0;
240
- /**
241
- * @internal
242
- */
243
- this.flags = 1 | 4;
244
- /**
245
- * @internal
246
- */
247
- this.next = void 0;
248
- /**
249
- * @internal
250
- */
251
- this.cleanup = void 0;
252
- this.scheduler = void 0;
253
- if (activeEffectScope && activeEffectScope.active) {
254
- activeEffectScope.effects.push(this);
255
- }
139
+ if (prevDep !== void 0) {
140
+ prevDep.nextDep = nextDep;
141
+ } else {
142
+ sub.deps = nextDep;
256
143
  }
257
- pause() {
258
- this.flags |= 64;
144
+ if (nextSub !== void 0) {
145
+ nextSub.prevSub = prevSub;
146
+ } else {
147
+ dep.subsTail = prevSub;
259
148
  }
260
- resume() {
261
- if (this.flags & 64) {
262
- this.flags &= -65;
263
- if (pausedQueueEffects.has(this)) {
264
- pausedQueueEffects.delete(this);
265
- this.trigger();
149
+ if (prevSub !== void 0) {
150
+ prevSub.nextSub = nextSub;
151
+ } else if ((dep.subs = nextSub) === void 0) {
152
+ let toRemove = dep.deps;
153
+ if (toRemove !== void 0) {
154
+ do {
155
+ toRemove = unlink(toRemove, dep);
156
+ } while (toRemove !== void 0);
157
+ dep.flags |= 16 /* Dirty */;
158
+ }
159
+ }
160
+ return nextDep;
161
+ }
162
+ function propagate(link2) {
163
+ let next = link2.nextSub;
164
+ let stack;
165
+ top: do {
166
+ const sub = link2.sub;
167
+ let flags = sub.flags;
168
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
169
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
170
+ sub.flags = flags | 32 /* Pending */;
171
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
172
+ flags = 0 /* None */;
173
+ } else if (!(flags & 4 /* RecursedCheck */)) {
174
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
175
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
176
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
177
+ flags &= 1 /* Mutable */;
178
+ } else {
179
+ flags = 0 /* None */;
266
180
  }
267
- }
268
- }
269
- /**
270
- * @internal
271
- */
272
- notify() {
273
- if (this.flags & 2 && !(this.flags & 32)) {
274
- return;
275
- }
276
- if (!(this.flags & 8)) {
277
- batch(this);
278
- }
279
- }
280
- run() {
281
- if (!(this.flags & 1)) {
282
- return this.fn();
283
- }
284
- this.flags |= 2;
285
- cleanupEffect(this);
286
- prepareDeps(this);
287
- const prevEffect = activeSub;
288
- const prevShouldTrack = shouldTrack;
289
- activeSub = this;
290
- shouldTrack = true;
291
- try {
292
- return this.fn();
293
- } finally {
294
- if (activeSub !== this) {
295
- warn(
296
- "Active effect was not restored correctly - this is likely a Vue internal bug."
297
- );
181
+ if (flags & 2 /* Watching */) {
182
+ notifyBuffer[notifyBufferLength++] = sub;
298
183
  }
299
- cleanupDeps(this);
300
- activeSub = prevEffect;
301
- shouldTrack = prevShouldTrack;
302
- this.flags &= -3;
303
- }
304
- }
305
- stop() {
306
- if (this.flags & 1) {
307
- for (let link = this.deps; link; link = link.nextDep) {
308
- removeSub(link);
184
+ if (flags & 1 /* Mutable */) {
185
+ const subSubs = sub.subs;
186
+ if (subSubs !== void 0) {
187
+ link2 = subSubs;
188
+ if (subSubs.nextSub !== void 0) {
189
+ stack = { value: next, prev: stack };
190
+ next = link2.nextSub;
191
+ }
192
+ continue;
193
+ }
309
194
  }
310
- this.deps = this.depsTail = void 0;
311
- cleanupEffect(this);
312
- this.onStop && this.onStop();
313
- this.flags &= -2;
314
195
  }
315
- }
316
- trigger() {
317
- if (this.flags & 64) {
318
- pausedQueueEffects.add(this);
319
- } else if (this.scheduler) {
320
- this.scheduler();
321
- } else {
322
- this.runIfDirty();
196
+ if ((link2 = next) !== void 0) {
197
+ next = link2.nextSub;
198
+ continue;
323
199
  }
324
- }
325
- /**
326
- * @internal
327
- */
328
- runIfDirty() {
329
- if (isDirty(this)) {
330
- this.run();
200
+ while (stack !== void 0) {
201
+ link2 = stack.value;
202
+ stack = stack.prev;
203
+ if (link2 !== void 0) {
204
+ next = link2.nextSub;
205
+ continue top;
206
+ }
331
207
  }
332
- }
333
- get dirty() {
334
- return isDirty(this);
335
- }
208
+ break;
209
+ } while (true);
336
210
  }
337
- let batchDepth = 0;
338
- let batchedSub;
339
- let batchedComputed;
340
- function batch(sub, isComputed = false) {
341
- sub.flags |= 8;
342
- if (isComputed) {
343
- sub.next = batchedComputed;
344
- batchedComputed = sub;
345
- return;
346
- }
347
- sub.next = batchedSub;
348
- batchedSub = sub;
211
+ function startTracking(sub) {
212
+ sub.depsTail = void 0;
213
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
214
+ return setActiveSub(sub);
349
215
  }
350
- function startBatch() {
351
- batchDepth++;
352
- }
353
- function endBatch() {
354
- if (--batchDepth > 0) {
355
- return;
216
+ function endTracking(sub, prevSub) {
217
+ if (activeSub !== sub) {
218
+ warn(
219
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
220
+ );
356
221
  }
357
- if (batchedComputed) {
358
- let e = batchedComputed;
359
- batchedComputed = void 0;
360
- while (e) {
361
- const next = e.next;
362
- e.next = void 0;
363
- e.flags &= -9;
364
- e = next;
365
- }
366
- }
367
- let error;
368
- while (batchedSub) {
369
- let e = batchedSub;
370
- batchedSub = void 0;
371
- while (e) {
372
- const next = e.next;
373
- e.next = void 0;
374
- e.flags &= -9;
375
- if (e.flags & 1) {
376
- try {
377
- ;
378
- e.trigger();
379
- } catch (err) {
380
- if (!error) error = err;
222
+ activeSub = prevSub;
223
+ const depsTail = sub.depsTail;
224
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
225
+ while (toRemove !== void 0) {
226
+ toRemove = unlink(toRemove, sub);
227
+ }
228
+ sub.flags &= -5 /* RecursedCheck */;
229
+ }
230
+ function flush() {
231
+ while (notifyIndex < notifyBufferLength) {
232
+ const effect = notifyBuffer[notifyIndex];
233
+ notifyBuffer[notifyIndex++] = void 0;
234
+ effect.notify();
235
+ }
236
+ notifyIndex = 0;
237
+ notifyBufferLength = 0;
238
+ }
239
+ function checkDirty(link2, sub) {
240
+ let stack;
241
+ let checkDepth = 0;
242
+ top: do {
243
+ const dep = link2.dep;
244
+ const depFlags = dep.flags;
245
+ let dirty = false;
246
+ if (sub.flags & 16 /* Dirty */) {
247
+ dirty = true;
248
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
249
+ if (dep.update()) {
250
+ const subs = dep.subs;
251
+ if (subs.nextSub !== void 0) {
252
+ shallowPropagate(subs);
381
253
  }
254
+ dirty = true;
382
255
  }
383
- e = next;
384
- }
385
- }
386
- if (error) throw error;
387
- }
388
- function prepareDeps(sub) {
389
- for (let link = sub.deps; link; link = link.nextDep) {
390
- link.version = -1;
391
- link.prevActiveLink = link.dep.activeLink;
392
- link.dep.activeLink = link;
256
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
257
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
258
+ stack = { value: link2, prev: stack };
259
+ }
260
+ link2 = dep.deps;
261
+ sub = dep;
262
+ ++checkDepth;
263
+ continue;
264
+ }
265
+ if (!dirty && link2.nextDep !== void 0) {
266
+ link2 = link2.nextDep;
267
+ continue;
268
+ }
269
+ while (checkDepth) {
270
+ --checkDepth;
271
+ const firstSub = sub.subs;
272
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
273
+ if (hasMultipleSubs) {
274
+ link2 = stack.value;
275
+ stack = stack.prev;
276
+ } else {
277
+ link2 = firstSub;
278
+ }
279
+ if (dirty) {
280
+ if (sub.update()) {
281
+ if (hasMultipleSubs) {
282
+ shallowPropagate(firstSub);
283
+ }
284
+ sub = link2.sub;
285
+ continue;
286
+ }
287
+ } else {
288
+ sub.flags &= -33 /* Pending */;
289
+ }
290
+ sub = link2.sub;
291
+ if (link2.nextDep !== void 0) {
292
+ link2 = link2.nextDep;
293
+ continue top;
294
+ }
295
+ dirty = false;
296
+ }
297
+ return dirty;
298
+ } while (true);
299
+ }
300
+ function shallowPropagate(link2) {
301
+ do {
302
+ const sub = link2.sub;
303
+ const nextSub = link2.nextSub;
304
+ const subFlags = sub.flags;
305
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
306
+ sub.flags = subFlags | 16 /* Dirty */;
307
+ }
308
+ link2 = nextSub;
309
+ } while (link2 !== void 0);
310
+ }
311
+ function isValidLink(checkLink, sub) {
312
+ const depsTail = sub.depsTail;
313
+ if (depsTail !== void 0) {
314
+ let link2 = sub.deps;
315
+ do {
316
+ if (link2 === checkLink) {
317
+ return true;
318
+ }
319
+ if (link2 === depsTail) {
320
+ break;
321
+ }
322
+ link2 = link2.nextDep;
323
+ } while (link2 !== void 0);
393
324
  }
325
+ return false;
394
326
  }
395
- function cleanupDeps(sub) {
396
- let head;
397
- let tail = sub.depsTail;
398
- let link = tail;
399
- while (link) {
400
- const prev = link.prevDep;
401
- if (link.version === -1) {
402
- if (link === tail) tail = prev;
403
- removeSub(link);
404
- removeDep(link);
405
- } else {
406
- head = link;
407
- }
408
- link.dep.activeLink = link.prevActiveLink;
409
- link.prevActiveLink = void 0;
410
- link = prev;
327
+
328
+ const triggerEventInfos = [];
329
+ function onTrack(sub, debugInfo) {
330
+ if (sub.onTrack) {
331
+ sub.onTrack(
332
+ extend(
333
+ {
334
+ effect: sub
335
+ },
336
+ debugInfo
337
+ )
338
+ );
411
339
  }
412
- sub.deps = head;
413
- sub.depsTail = tail;
414
340
  }
415
- function isDirty(sub) {
416
- for (let link = sub.deps; link; link = link.nextDep) {
417
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
418
- return true;
419
- }
420
- }
421
- if (sub._dirty) {
422
- return true;
341
+ function onTrigger(sub) {
342
+ if (sub.onTrigger) {
343
+ const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
344
+ sub.onTrigger(
345
+ extend(
346
+ {
347
+ effect: sub
348
+ },
349
+ debugInfo
350
+ )
351
+ );
423
352
  }
424
- return false;
425
353
  }
426
- function refreshComputed(computed) {
427
- if (computed.flags & 4 && !(computed.flags & 16)) {
428
- return;
429
- }
430
- computed.flags &= -17;
431
- if (computed.globalVersion === globalVersion) {
432
- return;
433
- }
434
- computed.globalVersion = globalVersion;
435
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
436
- return;
437
- }
438
- computed.flags |= 2;
439
- const dep = computed.dep;
440
- const prevSub = activeSub;
441
- const prevShouldTrack = shouldTrack;
442
- activeSub = computed;
443
- shouldTrack = true;
444
- try {
445
- prepareDeps(computed);
446
- const value = computed.fn(computed._value);
447
- if (dep.version === 0 || hasChanged(value, computed._value)) {
448
- computed.flags |= 128;
449
- computed._value = value;
450
- dep.version++;
354
+ function setupOnTrigger(target) {
355
+ Object.defineProperty(target.prototype, "onTrigger", {
356
+ get() {
357
+ return this._onTrigger;
358
+ },
359
+ set(val) {
360
+ if (val && !this._onTrigger) setupFlagsHandler(this);
361
+ this._onTrigger = val;
451
362
  }
452
- } catch (err) {
453
- dep.version++;
454
- throw err;
455
- } finally {
456
- activeSub = prevSub;
457
- shouldTrack = prevShouldTrack;
458
- cleanupDeps(computed);
459
- computed.flags &= -3;
460
- }
363
+ });
461
364
  }
462
- function removeSub(link, soft = false) {
463
- const { dep, prevSub, nextSub } = link;
464
- if (prevSub) {
465
- prevSub.nextSub = nextSub;
466
- link.prevSub = void 0;
467
- }
468
- if (nextSub) {
469
- nextSub.prevSub = prevSub;
470
- link.nextSub = void 0;
471
- }
472
- if (dep.subsHead === link) {
473
- dep.subsHead = nextSub;
474
- }
475
- if (dep.subs === link) {
476
- dep.subs = prevSub;
477
- if (!prevSub && dep.computed) {
478
- dep.computed.flags &= -5;
479
- for (let l = dep.computed.deps; l; l = l.nextDep) {
480
- removeSub(l, true);
365
+ function setupFlagsHandler(target) {
366
+ target._flags = target.flags;
367
+ Object.defineProperty(target, "flags", {
368
+ get() {
369
+ return target._flags;
370
+ },
371
+ set(value) {
372
+ if (!(target._flags & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending)) && !!(value & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending))) {
373
+ onTrigger(this);
481
374
  }
375
+ target._flags = value;
482
376
  }
483
- }
484
- if (!soft && !--dep.sc && dep.map) {
485
- dep.map.delete(dep.key);
486
- }
487
- }
488
- function removeDep(link) {
489
- const { prevDep, nextDep } = link;
490
- if (prevDep) {
491
- prevDep.nextDep = nextDep;
492
- link.prevDep = void 0;
493
- }
494
- if (nextDep) {
495
- nextDep.prevDep = prevDep;
496
- link.nextDep = void 0;
497
- }
498
- }
499
- function effect(fn, options) {
500
- if (fn.effect instanceof ReactiveEffect) {
501
- fn = fn.effect.fn;
502
- }
503
- const e = new ReactiveEffect(fn);
504
- if (options) {
505
- extend(e, options);
506
- }
507
- try {
508
- e.run();
509
- } catch (err) {
510
- e.stop();
511
- throw err;
512
- }
513
- const runner = e.run.bind(e);
514
- runner.effect = e;
515
- return runner;
516
- }
517
- function stop(runner) {
518
- runner.effect.stop();
519
- }
520
- let shouldTrack = true;
521
- const trackStack = [];
522
- function pauseTracking() {
523
- trackStack.push(shouldTrack);
524
- shouldTrack = false;
525
- }
526
- function enableTracking() {
527
- trackStack.push(shouldTrack);
528
- shouldTrack = true;
529
- }
530
- function resetTracking() {
531
- const last = trackStack.pop();
532
- shouldTrack = last === void 0 ? true : last;
533
- }
534
- function onEffectCleanup(fn, failSilently = false) {
535
- if (activeSub instanceof ReactiveEffect) {
536
- activeSub.cleanup = fn;
537
- } else if (!failSilently) {
538
- warn(
539
- `onEffectCleanup() was called when there was no active effect to associate with.`
540
- );
541
- }
542
- }
543
- function cleanupEffect(e) {
544
- const { cleanup } = e;
545
- e.cleanup = void 0;
546
- if (cleanup) {
547
- const prevSub = activeSub;
548
- activeSub = void 0;
549
- try {
550
- cleanup();
551
- } finally {
552
- activeSub = prevSub;
553
- }
554
- }
377
+ });
555
378
  }
556
379
 
557
- let globalVersion = 0;
558
- class Link {
559
- constructor(sub, dep) {
560
- this.sub = sub;
561
- this.dep = dep;
562
- this.version = dep.version;
563
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
564
- }
565
- }
566
380
  class Dep {
567
- // TODO isolatedDeclarations "__v_skip"
568
- constructor(computed) {
569
- this.computed = computed;
570
- this.version = 0;
571
- /**
572
- * Link between this dep and the current active effect
573
- */
574
- this.activeLink = void 0;
575
- /**
576
- * Doubly linked list representing the subscribing effects (tail)
577
- */
578
- this.subs = void 0;
579
- /**
580
- * For object property deps cleanup
581
- */
582
- this.map = void 0;
583
- this.key = void 0;
584
- /**
585
- * Subscriber counter
586
- */
587
- this.sc = 0;
588
- /**
589
- * @internal
590
- */
591
- this.__v_skip = true;
592
- {
593
- this.subsHead = void 0;
594
- }
381
+ constructor(map, key) {
382
+ this.map = map;
383
+ this.key = key;
384
+ this._subs = void 0;
385
+ this.subsTail = void 0;
386
+ this.flags = ReactiveFlags$1.None;
595
387
  }
596
- track(debugInfo) {
597
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
598
- return;
599
- }
600
- let link = this.activeLink;
601
- if (link === void 0 || link.sub !== activeSub) {
602
- link = this.activeLink = new Link(activeSub, this);
603
- if (!activeSub.deps) {
604
- activeSub.deps = activeSub.depsTail = link;
605
- } else {
606
- link.prevDep = activeSub.depsTail;
607
- activeSub.depsTail.nextDep = link;
608
- activeSub.depsTail = link;
609
- }
610
- addSub(link);
611
- } else if (link.version === -1) {
612
- link.version = this.version;
613
- if (link.nextDep) {
614
- const next = link.nextDep;
615
- next.prevDep = link.prevDep;
616
- if (link.prevDep) {
617
- link.prevDep.nextDep = next;
618
- }
619
- link.prevDep = activeSub.depsTail;
620
- link.nextDep = void 0;
621
- activeSub.depsTail.nextDep = link;
622
- activeSub.depsTail = link;
623
- if (activeSub.deps === link) {
624
- activeSub.deps = next;
625
- }
626
- }
627
- }
628
- if (activeSub.onTrack) {
629
- activeSub.onTrack(
630
- extend(
631
- {
632
- effect: activeSub
633
- },
634
- debugInfo
635
- )
636
- );
637
- }
638
- return link;
388
+ get subs() {
389
+ return this._subs;
639
390
  }
640
- trigger(debugInfo) {
641
- this.version++;
642
- globalVersion++;
643
- this.notify(debugInfo);
644
- }
645
- notify(debugInfo) {
646
- startBatch();
647
- try {
648
- if (true) {
649
- for (let head = this.subsHead; head; head = head.nextSub) {
650
- if (head.sub.onTrigger && !(head.sub.flags & 8)) {
651
- head.sub.onTrigger(
652
- extend(
653
- {
654
- effect: head.sub
655
- },
656
- debugInfo
657
- )
658
- );
659
- }
660
- }
661
- }
662
- for (let link = this.subs; link; link = link.prevSub) {
663
- if (link.sub.notify()) {
664
- ;
665
- link.sub.dep.notify();
666
- }
667
- }
668
- } finally {
669
- endBatch();
391
+ set subs(value) {
392
+ this._subs = value;
393
+ if (value === void 0) {
394
+ this.map.delete(this.key);
670
395
  }
671
396
  }
672
397
  }
673
- function addSub(link) {
674
- link.dep.sc++;
675
- if (link.sub.flags & 4) {
676
- const computed = link.dep.computed;
677
- if (computed && !link.dep.subs) {
678
- computed.flags |= 4 | 16;
679
- for (let l = computed.deps; l; l = l.nextDep) {
680
- addSub(l);
681
- }
682
- }
683
- const currentTail = link.dep.subs;
684
- if (currentTail !== link) {
685
- link.prevSub = currentTail;
686
- if (currentTail) currentTail.nextSub = link;
687
- }
688
- if (link.dep.subsHead === void 0) {
689
- link.dep.subsHead = link;
690
- }
691
- link.dep.subs = link;
692
- }
693
- }
694
398
  const targetMap = /* @__PURE__ */ new WeakMap();
695
399
  const ITERATE_KEY = Symbol(
696
400
  "Object iterate"
@@ -702,36 +406,34 @@ var VueReactivity = (function (exports) {
702
406
  "Array iterate"
703
407
  );
704
408
  function track(target, type, key) {
705
- if (shouldTrack && activeSub) {
409
+ if (activeSub !== void 0) {
706
410
  let depsMap = targetMap.get(target);
707
411
  if (!depsMap) {
708
412
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
709
413
  }
710
414
  let dep = depsMap.get(key);
711
415
  if (!dep) {
712
- depsMap.set(key, dep = new Dep());
713
- dep.map = depsMap;
714
- dep.key = key;
416
+ depsMap.set(key, dep = new Dep(depsMap, key));
715
417
  }
716
418
  {
717
- dep.track({
419
+ onTrack(activeSub, {
718
420
  target,
719
421
  type,
720
422
  key
721
423
  });
722
424
  }
425
+ link(dep, activeSub);
723
426
  }
724
427
  }
725
428
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
726
429
  const depsMap = targetMap.get(target);
727
430
  if (!depsMap) {
728
- globalVersion++;
729
431
  return;
730
432
  }
731
433
  const run = (dep) => {
732
- if (dep) {
434
+ if (dep !== void 0 && dep.subs !== void 0) {
733
435
  {
734
- dep.trigger({
436
+ triggerEventInfos.push({
735
437
  target,
736
438
  type,
737
439
  key,
@@ -740,6 +442,11 @@ var VueReactivity = (function (exports) {
740
442
  oldTarget
741
443
  });
742
444
  }
445
+ propagate(dep.subs);
446
+ shallowPropagate(dep.subs);
447
+ {
448
+ triggerEventInfos.pop();
449
+ }
743
450
  }
744
451
  };
745
452
  startBatch();
@@ -964,11 +671,11 @@ var VueReactivity = (function (exports) {
964
671
  return res;
965
672
  }
966
673
  function noTracking(self, method, args = []) {
967
- pauseTracking();
968
674
  startBatch();
675
+ const prevSub = setActiveSub();
969
676
  const res = toRaw(self)[method].apply(self, args);
677
+ setActiveSub(prevSub);
970
678
  endBatch();
971
- resetTracking();
972
679
  return res;
973
680
  }
974
681
 
@@ -1014,14 +721,18 @@ var VueReactivity = (function (exports) {
1014
721
  return hasOwnProperty;
1015
722
  }
1016
723
  }
724
+ const wasRef = isRef(target);
1017
725
  const res = Reflect.get(
1018
726
  target,
1019
727
  key,
1020
728
  // if this is a proxy wrapping a ref, return methods using the raw ref
1021
729
  // as receiver so that we don't have to call `toRaw` on the ref in all
1022
730
  // its class methods
1023
- isRef(target) ? target : receiver
731
+ wasRef ? target : receiver
1024
732
  );
733
+ if (wasRef && key !== "value") {
734
+ return res;
735
+ }
1025
736
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1026
737
  return res;
1027
738
  }
@@ -1473,33 +1184,47 @@ var VueReactivity = (function (exports) {
1473
1184
  return r ? r["__v_isRef"] === true : false;
1474
1185
  }
1475
1186
  function ref(value) {
1476
- return createRef(value, false);
1187
+ return createRef(value, toReactive);
1477
1188
  }
1478
1189
  function shallowRef(value) {
1479
- return createRef(value, true);
1190
+ return createRef(value);
1480
1191
  }
1481
- function createRef(rawValue, shallow) {
1192
+ function createRef(rawValue, wrap) {
1482
1193
  if (isRef(rawValue)) {
1483
1194
  return rawValue;
1484
1195
  }
1485
- return new RefImpl(rawValue, shallow);
1196
+ return new RefImpl(rawValue, wrap);
1486
1197
  }
1487
1198
  class RefImpl {
1488
- constructor(value, isShallow2) {
1489
- this.dep = new Dep();
1490
- this["__v_isRef"] = true;
1491
- this["__v_isShallow"] = false;
1492
- this._rawValue = isShallow2 ? value : toRaw(value);
1493
- this._value = isShallow2 ? value : toReactive(value);
1494
- this["__v_isShallow"] = isShallow2;
1199
+ // TODO isolatedDeclarations "__v_isShallow"
1200
+ constructor(value, wrap) {
1201
+ this.subs = void 0;
1202
+ this.subsTail = void 0;
1203
+ this.flags = ReactiveFlags$1.Mutable;
1204
+ /**
1205
+ * @internal
1206
+ */
1207
+ this.__v_isRef = true;
1208
+ // TODO isolatedDeclarations "__v_isRef"
1209
+ /**
1210
+ * @internal
1211
+ */
1212
+ this.__v_isShallow = false;
1213
+ this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
1214
+ this._value = wrap ? wrap(value) : value;
1215
+ this._wrap = wrap;
1216
+ this["__v_isShallow"] = !wrap;
1217
+ }
1218
+ get dep() {
1219
+ return this;
1495
1220
  }
1496
1221
  get value() {
1497
- {
1498
- this.dep.track({
1499
- target: this,
1500
- type: "get",
1501
- key: "value"
1502
- });
1222
+ trackRef(this);
1223
+ if (this.flags & ReactiveFlags$1.Dirty && this.update()) {
1224
+ const subs = this.subs;
1225
+ if (subs !== void 0) {
1226
+ shallowPropagate(subs);
1227
+ }
1503
1228
  }
1504
1229
  return this._value;
1505
1230
  }
@@ -1508,191 +1233,539 @@ var VueReactivity = (function (exports) {
1508
1233
  const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1509
1234
  newValue = useDirectValue ? newValue : toRaw(newValue);
1510
1235
  if (hasChanged(newValue, oldValue)) {
1236
+ this.flags |= ReactiveFlags$1.Dirty;
1511
1237
  this._rawValue = newValue;
1512
- this._value = useDirectValue ? newValue : toReactive(newValue);
1513
- {
1514
- this.dep.trigger({
1515
- target: this,
1516
- type: "set",
1517
- key: "value",
1518
- newValue,
1519
- oldValue
1520
- });
1238
+ this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
1239
+ const subs = this.subs;
1240
+ if (subs !== void 0) {
1241
+ {
1242
+ triggerEventInfos.push({
1243
+ target: this,
1244
+ type: "set",
1245
+ key: "value",
1246
+ newValue,
1247
+ oldValue
1248
+ });
1249
+ }
1250
+ propagate(subs);
1251
+ if (!batchDepth) {
1252
+ flush();
1253
+ }
1254
+ {
1255
+ triggerEventInfos.pop();
1256
+ }
1257
+ }
1258
+ }
1259
+ }
1260
+ update() {
1261
+ this.flags &= ~ReactiveFlags$1.Dirty;
1262
+ return hasChanged(this._oldValue, this._oldValue = this._rawValue);
1263
+ }
1264
+ }
1265
+ function triggerRef(ref2) {
1266
+ const dep = ref2.dep;
1267
+ if (dep !== void 0 && dep.subs !== void 0) {
1268
+ propagate(dep.subs);
1269
+ shallowPropagate(dep.subs);
1270
+ if (!batchDepth) {
1271
+ flush();
1272
+ }
1273
+ }
1274
+ }
1275
+ function trackRef(dep) {
1276
+ if (activeSub !== void 0) {
1277
+ {
1278
+ onTrack(activeSub, {
1279
+ target: dep,
1280
+ type: "get",
1281
+ key: "value"
1282
+ });
1283
+ }
1284
+ link(dep, activeSub);
1285
+ }
1286
+ }
1287
+ function unref(ref2) {
1288
+ return isRef(ref2) ? ref2.value : ref2;
1289
+ }
1290
+ function toValue(source) {
1291
+ return isFunction(source) ? source() : unref(source);
1292
+ }
1293
+ const shallowUnwrapHandlers = {
1294
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1295
+ set: (target, key, value, receiver) => {
1296
+ const oldValue = target[key];
1297
+ if (isRef(oldValue) && !isRef(value)) {
1298
+ oldValue.value = value;
1299
+ return true;
1300
+ } else {
1301
+ return Reflect.set(target, key, value, receiver);
1302
+ }
1303
+ }
1304
+ };
1305
+ function proxyRefs(objectWithRefs) {
1306
+ return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1307
+ }
1308
+ class CustomRefImpl {
1309
+ constructor(factory) {
1310
+ this.subs = void 0;
1311
+ this.subsTail = void 0;
1312
+ this.flags = ReactiveFlags$1.None;
1313
+ this["__v_isRef"] = true;
1314
+ this._value = void 0;
1315
+ const { get, set } = factory(
1316
+ () => trackRef(this),
1317
+ () => triggerRef(this)
1318
+ );
1319
+ this._get = get;
1320
+ this._set = set;
1321
+ }
1322
+ get dep() {
1323
+ return this;
1324
+ }
1325
+ get value() {
1326
+ return this._value = this._get();
1327
+ }
1328
+ set value(newVal) {
1329
+ this._set(newVal);
1330
+ }
1331
+ }
1332
+ function customRef(factory) {
1333
+ return new CustomRefImpl(factory);
1334
+ }
1335
+ function toRefs(object) {
1336
+ const ret = isArray(object) ? new Array(object.length) : {};
1337
+ for (const key in object) {
1338
+ ret[key] = propertyToRef(object, key);
1339
+ }
1340
+ return ret;
1341
+ }
1342
+ class ObjectRefImpl {
1343
+ constructor(_object, _key, _defaultValue) {
1344
+ this._object = _object;
1345
+ this._key = _key;
1346
+ this._defaultValue = _defaultValue;
1347
+ this["__v_isRef"] = true;
1348
+ this._value = void 0;
1349
+ }
1350
+ get value() {
1351
+ const val = this._object[this._key];
1352
+ return this._value = val === void 0 ? this._defaultValue : val;
1353
+ }
1354
+ set value(newVal) {
1355
+ this._object[this._key] = newVal;
1356
+ }
1357
+ get dep() {
1358
+ return getDepFromReactive(toRaw(this._object), this._key);
1359
+ }
1360
+ }
1361
+ class GetterRefImpl {
1362
+ constructor(_getter) {
1363
+ this._getter = _getter;
1364
+ this["__v_isRef"] = true;
1365
+ this["__v_isReadonly"] = true;
1366
+ this._value = void 0;
1367
+ }
1368
+ get value() {
1369
+ return this._value = this._getter();
1370
+ }
1371
+ }
1372
+ function toRef(source, key, defaultValue) {
1373
+ if (isRef(source)) {
1374
+ return source;
1375
+ } else if (isFunction(source)) {
1376
+ return new GetterRefImpl(source);
1377
+ } else if (isObject(source) && arguments.length > 1) {
1378
+ return propertyToRef(source, key, defaultValue);
1379
+ } else {
1380
+ return ref(source);
1381
+ }
1382
+ }
1383
+ function propertyToRef(source, key, defaultValue) {
1384
+ const val = source[key];
1385
+ return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1386
+ }
1387
+
1388
+ const EffectFlags = {
1389
+ "ALLOW_RECURSE": 128,
1390
+ "128": "ALLOW_RECURSE",
1391
+ "PAUSED": 256,
1392
+ "256": "PAUSED",
1393
+ "STOP": 1024,
1394
+ "1024": "STOP"
1395
+ };
1396
+ class ReactiveEffect {
1397
+ constructor(fn) {
1398
+ this.deps = void 0;
1399
+ this.depsTail = void 0;
1400
+ this.subs = void 0;
1401
+ this.subsTail = void 0;
1402
+ this.flags = ReactiveFlags$1.Watching | ReactiveFlags$1.Dirty;
1403
+ /**
1404
+ * @internal
1405
+ */
1406
+ this.cleanups = [];
1407
+ /**
1408
+ * @internal
1409
+ */
1410
+ this.cleanupsLength = 0;
1411
+ if (fn !== void 0) {
1412
+ this.fn = fn;
1413
+ }
1414
+ if (activeEffectScope) {
1415
+ link(this, activeEffectScope);
1416
+ }
1417
+ }
1418
+ // @ts-expect-error
1419
+ fn() {
1420
+ }
1421
+ get active() {
1422
+ return !(this.flags & 1024);
1423
+ }
1424
+ pause() {
1425
+ this.flags |= 256;
1426
+ }
1427
+ resume() {
1428
+ const flags = this.flags &= -257;
1429
+ if (flags & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending)) {
1430
+ this.notify();
1431
+ }
1432
+ }
1433
+ notify() {
1434
+ if (!(this.flags & 256) && this.dirty) {
1435
+ this.run();
1436
+ }
1437
+ }
1438
+ run() {
1439
+ if (!this.active) {
1440
+ return this.fn();
1441
+ }
1442
+ cleanup(this);
1443
+ const prevSub = startTracking(this);
1444
+ try {
1445
+ return this.fn();
1446
+ } finally {
1447
+ endTracking(this, prevSub);
1448
+ const flags = this.flags;
1449
+ if ((flags & (ReactiveFlags$1.Recursed | 128)) === (ReactiveFlags$1.Recursed | 128)) {
1450
+ this.flags = flags & ~ReactiveFlags$1.Recursed;
1451
+ this.notify();
1452
+ }
1453
+ }
1454
+ }
1455
+ stop() {
1456
+ if (!this.active) {
1457
+ return;
1458
+ }
1459
+ this.flags = 1024;
1460
+ let dep = this.deps;
1461
+ while (dep !== void 0) {
1462
+ dep = unlink(dep, this);
1463
+ }
1464
+ const sub = this.subs;
1465
+ if (sub !== void 0) {
1466
+ unlink(sub);
1467
+ }
1468
+ cleanup(this);
1469
+ }
1470
+ get dirty() {
1471
+ const flags = this.flags;
1472
+ if (flags & ReactiveFlags$1.Dirty) {
1473
+ return true;
1474
+ }
1475
+ if (flags & ReactiveFlags$1.Pending) {
1476
+ if (checkDirty(this.deps, this)) {
1477
+ this.flags = flags | ReactiveFlags$1.Dirty;
1478
+ return true;
1479
+ } else {
1480
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1521
1481
  }
1522
1482
  }
1483
+ return false;
1484
+ }
1485
+ }
1486
+ {
1487
+ setupOnTrigger(ReactiveEffect);
1488
+ }
1489
+ function effect(fn, options) {
1490
+ if (fn.effect instanceof ReactiveEffect) {
1491
+ fn = fn.effect.fn;
1492
+ }
1493
+ const e = new ReactiveEffect(fn);
1494
+ if (options) {
1495
+ const { onStop, scheduler } = options;
1496
+ if (onStop) {
1497
+ options.onStop = void 0;
1498
+ const stop2 = e.stop.bind(e);
1499
+ e.stop = () => {
1500
+ stop2();
1501
+ onStop();
1502
+ };
1503
+ }
1504
+ if (scheduler) {
1505
+ options.scheduler = void 0;
1506
+ e.notify = () => {
1507
+ if (!(e.flags & 256)) {
1508
+ scheduler();
1509
+ }
1510
+ };
1511
+ }
1512
+ extend(e, options);
1523
1513
  }
1524
- }
1525
- function triggerRef(ref2) {
1526
- if (ref2.dep) {
1527
- {
1528
- ref2.dep.trigger({
1529
- target: ref2,
1530
- type: "set",
1531
- key: "value",
1532
- newValue: ref2._value
1533
- });
1534
- }
1514
+ try {
1515
+ e.run();
1516
+ } catch (err) {
1517
+ e.stop();
1518
+ throw err;
1535
1519
  }
1520
+ const runner = e.run.bind(e);
1521
+ runner.effect = e;
1522
+ return runner;
1536
1523
  }
1537
- function unref(ref2) {
1538
- return isRef(ref2) ? ref2.value : ref2;
1524
+ function stop(runner) {
1525
+ runner.effect.stop();
1539
1526
  }
1540
- function toValue(source) {
1541
- return isFunction(source) ? source() : unref(source);
1527
+ const resetTrackingStack = [];
1528
+ function pauseTracking() {
1529
+ resetTrackingStack.push(activeSub);
1530
+ setActiveSub();
1542
1531
  }
1543
- const shallowUnwrapHandlers = {
1544
- get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1545
- set: (target, key, value, receiver) => {
1546
- const oldValue = target[key];
1547
- if (isRef(oldValue) && !isRef(value)) {
1548
- oldValue.value = value;
1549
- return true;
1550
- } else {
1551
- return Reflect.set(target, key, value, receiver);
1532
+ function enableTracking() {
1533
+ const isPaused = activeSub === void 0;
1534
+ if (!isPaused) {
1535
+ resetTrackingStack.push(activeSub);
1536
+ } else {
1537
+ resetTrackingStack.push(void 0);
1538
+ for (let i = resetTrackingStack.length - 1; i >= 0; i--) {
1539
+ if (resetTrackingStack[i] !== void 0) {
1540
+ setActiveSub(resetTrackingStack[i]);
1541
+ break;
1542
+ }
1552
1543
  }
1553
1544
  }
1554
- };
1555
- function proxyRefs(objectWithRefs) {
1556
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1557
1545
  }
1558
- class CustomRefImpl {
1559
- constructor(factory) {
1560
- this["__v_isRef"] = true;
1561
- this._value = void 0;
1562
- const dep = this.dep = new Dep();
1563
- const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1564
- this._get = get;
1565
- this._set = set;
1566
- }
1567
- get value() {
1568
- return this._value = this._get();
1546
+ function resetTracking() {
1547
+ if (resetTrackingStack.length === 0) {
1548
+ warn(
1549
+ `resetTracking() was called when there was no active tracking to reset.`
1550
+ );
1569
1551
  }
1570
- set value(newVal) {
1571
- this._set(newVal);
1552
+ if (resetTrackingStack.length) {
1553
+ setActiveSub(resetTrackingStack.pop());
1554
+ } else {
1555
+ setActiveSub();
1572
1556
  }
1573
1557
  }
1574
- function customRef(factory) {
1575
- return new CustomRefImpl(factory);
1558
+ function cleanup(sub) {
1559
+ const l = sub.cleanupsLength;
1560
+ if (l) {
1561
+ for (let i = 0; i < l; i++) {
1562
+ sub.cleanups[i]();
1563
+ }
1564
+ sub.cleanupsLength = 0;
1565
+ }
1576
1566
  }
1577
- function toRefs(object) {
1578
- if (!isProxy(object)) {
1579
- warn(`toRefs() expects a reactive object but received a plain one.`);
1567
+ function onEffectCleanup(fn, failSilently = false) {
1568
+ if (activeSub instanceof ReactiveEffect) {
1569
+ activeSub.cleanups[activeSub.cleanupsLength++] = () => cleanupEffect(fn);
1570
+ } else if (!failSilently) {
1571
+ warn(
1572
+ `onEffectCleanup() was called when there was no active effect to associate with.`
1573
+ );
1580
1574
  }
1581
- const ret = isArray(object) ? new Array(object.length) : {};
1582
- for (const key in object) {
1583
- ret[key] = propertyToRef(object, key);
1575
+ }
1576
+ function cleanupEffect(fn) {
1577
+ const prevSub = setActiveSub();
1578
+ try {
1579
+ fn();
1580
+ } finally {
1581
+ setActiveSub(prevSub);
1584
1582
  }
1585
- return ret;
1586
1583
  }
1587
- class ObjectRefImpl {
1588
- constructor(_object, _key, _defaultValue) {
1589
- this._object = _object;
1590
- this._key = _key;
1591
- this._defaultValue = _defaultValue;
1592
- this["__v_isRef"] = true;
1593
- this._value = void 0;
1584
+
1585
+ let activeEffectScope;
1586
+ class EffectScope {
1587
+ constructor(detached = false) {
1588
+ this.deps = void 0;
1589
+ this.depsTail = void 0;
1590
+ this.subs = void 0;
1591
+ this.subsTail = void 0;
1592
+ this.flags = 0;
1593
+ /**
1594
+ * @internal
1595
+ */
1596
+ this.cleanups = [];
1597
+ /**
1598
+ * @internal
1599
+ */
1600
+ this.cleanupsLength = 0;
1601
+ if (!detached && activeEffectScope) {
1602
+ link(this, activeEffectScope);
1603
+ }
1594
1604
  }
1595
- get value() {
1596
- const val = this._object[this._key];
1597
- return this._value = val === void 0 ? this._defaultValue : val;
1605
+ get active() {
1606
+ return !(this.flags & 1024);
1598
1607
  }
1599
- set value(newVal) {
1600
- this._object[this._key] = newVal;
1608
+ pause() {
1609
+ if (!(this.flags & 256)) {
1610
+ this.flags |= 256;
1611
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1612
+ const dep = link2.dep;
1613
+ if ("pause" in dep) {
1614
+ dep.pause();
1615
+ }
1616
+ }
1617
+ }
1601
1618
  }
1602
- get dep() {
1603
- return getDepFromReactive(toRaw(this._object), this._key);
1619
+ /**
1620
+ * Resumes the effect scope, including all child scopes and effects.
1621
+ */
1622
+ resume() {
1623
+ const flags = this.flags;
1624
+ if (flags & 256) {
1625
+ this.flags = flags & -257;
1626
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1627
+ const dep = link2.dep;
1628
+ if ("resume" in dep) {
1629
+ dep.resume();
1630
+ }
1631
+ }
1632
+ }
1604
1633
  }
1605
- }
1606
- class GetterRefImpl {
1607
- constructor(_getter) {
1608
- this._getter = _getter;
1609
- this["__v_isRef"] = true;
1610
- this["__v_isReadonly"] = true;
1611
- this._value = void 0;
1634
+ run(fn) {
1635
+ const prevScope = activeEffectScope;
1636
+ try {
1637
+ activeEffectScope = this;
1638
+ return fn();
1639
+ } finally {
1640
+ activeEffectScope = prevScope;
1641
+ }
1612
1642
  }
1613
- get value() {
1614
- return this._value = this._getter();
1643
+ stop() {
1644
+ if (!this.active) {
1645
+ return;
1646
+ }
1647
+ this.flags = 1024;
1648
+ let dep = this.deps;
1649
+ while (dep !== void 0) {
1650
+ const node = dep.dep;
1651
+ if ("stop" in node) {
1652
+ dep = dep.nextDep;
1653
+ node.stop();
1654
+ } else {
1655
+ dep = unlink(dep, this);
1656
+ }
1657
+ }
1658
+ const sub = this.subs;
1659
+ if (sub !== void 0) {
1660
+ unlink(sub);
1661
+ }
1662
+ cleanup(this);
1615
1663
  }
1616
1664
  }
1617
- function toRef(source, key, defaultValue) {
1618
- if (isRef(source)) {
1619
- return source;
1620
- } else if (isFunction(source)) {
1621
- return new GetterRefImpl(source);
1622
- } else if (isObject(source) && arguments.length > 1) {
1623
- return propertyToRef(source, key, defaultValue);
1624
- } else {
1625
- return ref(source);
1665
+ function effectScope(detached) {
1666
+ return new EffectScope(detached);
1667
+ }
1668
+ function getCurrentScope() {
1669
+ return activeEffectScope;
1670
+ }
1671
+ function setCurrentScope(scope) {
1672
+ try {
1673
+ return activeEffectScope;
1674
+ } finally {
1675
+ activeEffectScope = scope;
1626
1676
  }
1627
1677
  }
1628
- function propertyToRef(source, key, defaultValue) {
1629
- const val = source[key];
1630
- return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1678
+ function onScopeDispose(fn, failSilently = false) {
1679
+ if (activeEffectScope !== void 0) {
1680
+ activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1681
+ } else if (!failSilently) {
1682
+ warn(
1683
+ `onScopeDispose() is called when there is no active effect scope to be associated with.`
1684
+ );
1685
+ }
1631
1686
  }
1632
1687
 
1633
1688
  class ComputedRefImpl {
1634
- constructor(fn, setter, isSSR) {
1689
+ constructor(fn, setter) {
1635
1690
  this.fn = fn;
1636
1691
  this.setter = setter;
1637
1692
  /**
1638
1693
  * @internal
1639
1694
  */
1640
1695
  this._value = void 0;
1641
- /**
1642
- * @internal
1643
- */
1644
- this.dep = new Dep(this);
1645
- /**
1646
- * @internal
1647
- */
1648
- this.__v_isRef = true;
1649
- // TODO isolatedDeclarations "__v_isReadonly"
1650
- // A computed is also a subscriber that tracks other deps
1651
- /**
1652
- * @internal
1653
- */
1696
+ this.subs = void 0;
1697
+ this.subsTail = void 0;
1654
1698
  this.deps = void 0;
1655
- /**
1656
- * @internal
1657
- */
1658
1699
  this.depsTail = void 0;
1700
+ this.flags = ReactiveFlags$1.Mutable | ReactiveFlags$1.Dirty;
1659
1701
  /**
1660
1702
  * @internal
1661
1703
  */
1662
- this.flags = 16;
1663
- /**
1664
- * @internal
1665
- */
1666
- this.globalVersion = globalVersion - 1;
1667
- /**
1668
- * @internal
1669
- */
1670
- this.next = void 0;
1671
- // for backwards compat
1672
- this.effect = this;
1704
+ this.__v_isRef = true;
1673
1705
  this["__v_isReadonly"] = !setter;
1674
- this.isSSR = isSSR;
1706
+ }
1707
+ // TODO isolatedDeclarations "__v_isReadonly"
1708
+ // for backwards compat
1709
+ get effect() {
1710
+ return this;
1711
+ }
1712
+ // for backwards compat
1713
+ get dep() {
1714
+ return this;
1675
1715
  }
1676
1716
  /**
1677
1717
  * @internal
1718
+ * for backwards compat
1678
1719
  */
1679
- notify() {
1680
- this.flags |= 16;
1681
- if (!(this.flags & 8) && // avoid infinite self recursion
1682
- activeSub !== this) {
1683
- batch(this, true);
1720
+ get _dirty() {
1721
+ const flags = this.flags;
1722
+ if (flags & ReactiveFlags$1.Dirty) {
1684
1723
  return true;
1685
1724
  }
1725
+ if (flags & ReactiveFlags$1.Pending) {
1726
+ if (checkDirty(this.deps, this)) {
1727
+ this.flags = flags | ReactiveFlags$1.Dirty;
1728
+ return true;
1729
+ } else {
1730
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1731
+ }
1732
+ }
1733
+ return false;
1734
+ }
1735
+ /**
1736
+ * @internal
1737
+ * for backwards compat
1738
+ */
1739
+ set _dirty(v) {
1740
+ if (v) {
1741
+ this.flags |= ReactiveFlags$1.Dirty;
1742
+ } else {
1743
+ this.flags &= ~(ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending);
1744
+ }
1686
1745
  }
1687
1746
  get value() {
1688
- const link = this.dep.track({
1689
- target: this,
1690
- type: "get",
1691
- key: "value"
1692
- }) ;
1693
- refreshComputed(this);
1694
- if (link) {
1695
- link.version = this.dep.version;
1747
+ const flags = this.flags;
1748
+ if (flags & ReactiveFlags$1.Dirty || flags & ReactiveFlags$1.Pending && checkDirty(this.deps, this)) {
1749
+ if (this.update()) {
1750
+ const subs = this.subs;
1751
+ if (subs !== void 0) {
1752
+ shallowPropagate(subs);
1753
+ }
1754
+ }
1755
+ } else if (flags & ReactiveFlags$1.Pending) {
1756
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1757
+ }
1758
+ if (activeSub !== void 0) {
1759
+ {
1760
+ onTrack(activeSub, {
1761
+ target: this,
1762
+ type: "get",
1763
+ key: "value"
1764
+ });
1765
+ }
1766
+ link(this, activeSub);
1767
+ } else if (activeEffectScope !== void 0) {
1768
+ link(this, activeEffectScope);
1696
1769
  }
1697
1770
  return this._value;
1698
1771
  }
@@ -1703,6 +1776,23 @@ var VueReactivity = (function (exports) {
1703
1776
  warn("Write operation failed: computed value is readonly");
1704
1777
  }
1705
1778
  }
1779
+ update() {
1780
+ const prevSub = startTracking(this);
1781
+ try {
1782
+ const oldValue = this._value;
1783
+ const newValue = this.fn(oldValue);
1784
+ if (hasChanged(oldValue, newValue)) {
1785
+ this._value = newValue;
1786
+ return true;
1787
+ }
1788
+ return false;
1789
+ } finally {
1790
+ endTracking(this, prevSub);
1791
+ }
1792
+ }
1793
+ }
1794
+ {
1795
+ setupOnTrigger(ComputedRefImpl);
1706
1796
  }
1707
1797
  function computed(getterOrOptions, debugOptions, isSSR = false) {
1708
1798
  let getter;
@@ -1713,7 +1803,7 @@ var VueReactivity = (function (exports) {
1713
1803
  getter = getterOrOptions.get;
1714
1804
  setter = getterOrOptions.set;
1715
1805
  }
1716
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1806
+ const cRef = new ComputedRefImpl(getter, setter);
1717
1807
  if (debugOptions && !isSSR) {
1718
1808
  cRef.onTrack = debugOptions.onTrack;
1719
1809
  cRef.onTrigger = debugOptions.onTrigger;
@@ -1750,177 +1840,155 @@ var VueReactivity = (function (exports) {
1750
1840
  "4": "WATCH_CLEANUP"
1751
1841
  };
1752
1842
  const INITIAL_WATCHER_VALUE = {};
1753
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1754
1843
  let activeWatcher = void 0;
1755
1844
  function getCurrentWatcher() {
1756
1845
  return activeWatcher;
1757
1846
  }
1758
1847
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1759
1848
  if (owner) {
1760
- let cleanups = cleanupMap.get(owner);
1761
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1762
- cleanups.push(cleanupFn);
1849
+ const { call } = owner.options;
1850
+ if (call) {
1851
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1852
+ } else {
1853
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1854
+ }
1763
1855
  } else if (!failSilently) {
1764
1856
  warn(
1765
1857
  `onWatcherCleanup() was called when there was no active watcher to associate with.`
1766
1858
  );
1767
1859
  }
1768
1860
  }
1769
- function watch(source, cb, options = EMPTY_OBJ) {
1770
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1771
- const warnInvalidSource = (s) => {
1772
- (options.onWarn || warn)(
1773
- `Invalid watch source: `,
1774
- s,
1775
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1776
- );
1777
- };
1778
- const reactiveGetter = (source2) => {
1779
- if (deep) return source2;
1780
- if (isShallow(source2) || deep === false || deep === 0)
1781
- return traverse(source2, 1);
1782
- return traverse(source2);
1783
- };
1784
- let effect;
1785
- let getter;
1786
- let cleanup;
1787
- let boundCleanup;
1788
- let forceTrigger = false;
1789
- let isMultiSource = false;
1790
- if (isRef(source)) {
1791
- getter = () => source.value;
1792
- forceTrigger = isShallow(source);
1793
- } else if (isReactive(source)) {
1794
- getter = () => reactiveGetter(source);
1795
- forceTrigger = true;
1796
- } else if (isArray(source)) {
1797
- isMultiSource = true;
1798
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1799
- getter = () => source.map((s) => {
1800
- if (isRef(s)) {
1801
- return s.value;
1802
- } else if (isReactive(s)) {
1803
- return reactiveGetter(s);
1804
- } else if (isFunction(s)) {
1805
- return call ? call(s, 2) : s();
1861
+ class WatcherEffect extends ReactiveEffect {
1862
+ constructor(source, cb, options = EMPTY_OBJ) {
1863
+ const { deep, once, call, onWarn } = options;
1864
+ let getter;
1865
+ let forceTrigger = false;
1866
+ let isMultiSource = false;
1867
+ if (isRef(source)) {
1868
+ getter = () => source.value;
1869
+ forceTrigger = isShallow(source);
1870
+ } else if (isReactive(source)) {
1871
+ getter = () => reactiveGetter(source, deep);
1872
+ forceTrigger = true;
1873
+ } else if (isArray(source)) {
1874
+ isMultiSource = true;
1875
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1876
+ getter = () => source.map((s) => {
1877
+ if (isRef(s)) {
1878
+ return s.value;
1879
+ } else if (isReactive(s)) {
1880
+ return reactiveGetter(s, deep);
1881
+ } else if (isFunction(s)) {
1882
+ return call ? call(s, 2) : s();
1883
+ } else {
1884
+ warnInvalidSource(s, onWarn);
1885
+ }
1886
+ });
1887
+ } else if (isFunction(source)) {
1888
+ if (cb) {
1889
+ getter = call ? () => call(source, 2) : source;
1806
1890
  } else {
1807
- warnInvalidSource(s);
1808
- }
1809
- });
1810
- } else if (isFunction(source)) {
1811
- if (cb) {
1812
- getter = call ? () => call(source, 2) : source;
1813
- } else {
1814
- getter = () => {
1815
- if (cleanup) {
1816
- pauseTracking();
1891
+ getter = () => {
1892
+ if (this.cleanupsLength) {
1893
+ const prevSub = setActiveSub();
1894
+ try {
1895
+ cleanup(this);
1896
+ } finally {
1897
+ setActiveSub(prevSub);
1898
+ }
1899
+ }
1900
+ const currentEffect = activeWatcher;
1901
+ activeWatcher = this;
1817
1902
  try {
1818
- cleanup();
1903
+ return call ? call(source, 3, [
1904
+ this.boundCleanup
1905
+ ]) : source(this.boundCleanup);
1819
1906
  } finally {
1820
- resetTracking();
1907
+ activeWatcher = currentEffect;
1821
1908
  }
1822
- }
1823
- const currentEffect = activeWatcher;
1824
- activeWatcher = effect;
1825
- try {
1826
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1827
- } finally {
1828
- activeWatcher = currentEffect;
1829
- }
1909
+ };
1910
+ }
1911
+ } else {
1912
+ getter = NOOP;
1913
+ warnInvalidSource(source, onWarn);
1914
+ }
1915
+ if (cb && deep) {
1916
+ const baseGetter = getter;
1917
+ const depth = deep === true ? Infinity : deep;
1918
+ getter = () => traverse(baseGetter(), depth);
1919
+ }
1920
+ super(getter);
1921
+ this.cb = cb;
1922
+ this.options = options;
1923
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
1924
+ this.forceTrigger = forceTrigger;
1925
+ this.isMultiSource = isMultiSource;
1926
+ if (once && cb) {
1927
+ const _cb = cb;
1928
+ cb = (...args) => {
1929
+ _cb(...args);
1930
+ this.stop();
1830
1931
  };
1831
1932
  }
1832
- } else {
1833
- getter = NOOP;
1834
- warnInvalidSource(source);
1835
- }
1836
- if (cb && deep) {
1837
- const baseGetter = getter;
1838
- const depth = deep === true ? Infinity : deep;
1839
- getter = () => traverse(baseGetter(), depth);
1840
- }
1841
- const scope = getCurrentScope();
1842
- const watchHandle = () => {
1843
- effect.stop();
1844
- if (scope && scope.active) {
1845
- remove(scope.effects, effect);
1933
+ this.cb = cb;
1934
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1935
+ {
1936
+ this.onTrack = options.onTrack;
1937
+ this.onTrigger = options.onTrigger;
1846
1938
  }
1847
- };
1848
- if (once && cb) {
1849
- const _cb = cb;
1850
- cb = (...args) => {
1851
- _cb(...args);
1852
- watchHandle();
1853
- };
1854
1939
  }
1855
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1856
- const job = (immediateFirstRun) => {
1857
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
1940
+ run(initialRun = false) {
1941
+ const oldValue = this.oldValue;
1942
+ const newValue = this.oldValue = super.run();
1943
+ if (!this.cb) {
1858
1944
  return;
1859
1945
  }
1860
- if (cb) {
1861
- const newValue = effect.run();
1862
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1863
- if (cleanup) {
1864
- cleanup();
1865
- }
1866
- const currentWatcher = activeWatcher;
1867
- activeWatcher = effect;
1868
- try {
1869
- const args = [
1870
- newValue,
1871
- // pass undefined as the old value when it's changed for the first time
1872
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1873
- boundCleanup
1874
- ];
1875
- oldValue = newValue;
1876
- call ? call(cb, 3, args) : (
1877
- // @ts-expect-error
1878
- cb(...args)
1879
- );
1880
- } finally {
1881
- activeWatcher = currentWatcher;
1882
- }
1883
- }
1884
- } else {
1885
- effect.run();
1946
+ const { immediate, deep, call } = this.options;
1947
+ if (initialRun && !immediate) {
1948
+ return;
1886
1949
  }
1887
- };
1888
- if (augmentJob) {
1889
- augmentJob(job);
1890
- }
1891
- effect = new ReactiveEffect(getter);
1892
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1893
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1894
- cleanup = effect.onStop = () => {
1895
- const cleanups = cleanupMap.get(effect);
1896
- if (cleanups) {
1897
- if (call) {
1898
- call(cleanups, 4);
1899
- } else {
1900
- for (const cleanup2 of cleanups) cleanup2();
1950
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1951
+ cleanup(this);
1952
+ const currentWatcher = activeWatcher;
1953
+ activeWatcher = this;
1954
+ try {
1955
+ const args = [
1956
+ newValue,
1957
+ // pass undefined as the old value when it's changed for the first time
1958
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1959
+ this.boundCleanup
1960
+ ];
1961
+ call ? call(this.cb, 3, args) : (
1962
+ // @ts-expect-error
1963
+ this.cb(...args)
1964
+ );
1965
+ } finally {
1966
+ activeWatcher = currentWatcher;
1901
1967
  }
1902
- cleanupMap.delete(effect);
1903
- }
1904
- };
1905
- {
1906
- effect.onTrack = options.onTrack;
1907
- effect.onTrigger = options.onTrigger;
1908
- }
1909
- if (cb) {
1910
- if (immediate) {
1911
- job(true);
1912
- } else {
1913
- oldValue = effect.run();
1914
1968
  }
1915
- } else if (scheduler) {
1916
- scheduler(job.bind(null, true), true);
1917
- } else {
1918
- effect.run();
1919
1969
  }
1920
- watchHandle.pause = effect.pause.bind(effect);
1921
- watchHandle.resume = effect.resume.bind(effect);
1922
- watchHandle.stop = watchHandle;
1923
- return watchHandle;
1970
+ }
1971
+ function reactiveGetter(source, deep) {
1972
+ if (deep) return source;
1973
+ if (isShallow(source) || deep === false || deep === 0)
1974
+ return traverse(source, 1);
1975
+ return traverse(source);
1976
+ }
1977
+ function warnInvalidSource(s, onWarn) {
1978
+ (onWarn || warn)(
1979
+ `Invalid watch source: `,
1980
+ s,
1981
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1982
+ );
1983
+ }
1984
+ function watch(source, cb, options = EMPTY_OBJ) {
1985
+ const effect = new WatcherEffect(source, cb, options);
1986
+ effect.run(true);
1987
+ const stop = effect.stop.bind(effect);
1988
+ stop.pause = effect.pause.bind(effect);
1989
+ stop.resume = effect.resume.bind(effect);
1990
+ stop.stop = stop;
1991
+ return stop;
1924
1992
  }
1925
1993
  function traverse(value, depth = Infinity, seen) {
1926
1994
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -1965,6 +2033,7 @@ var VueReactivity = (function (exports) {
1965
2033
  exports.TrackOpTypes = TrackOpTypes;
1966
2034
  exports.TriggerOpTypes = TriggerOpTypes;
1967
2035
  exports.WatchErrorCodes = WatchErrorCodes;
2036
+ exports.WatcherEffect = WatcherEffect;
1968
2037
  exports.computed = computed;
1969
2038
  exports.customRef = customRef;
1970
2039
  exports.effect = effect;
@@ -1988,6 +2057,8 @@ var VueReactivity = (function (exports) {
1988
2057
  exports.readonly = readonly;
1989
2058
  exports.ref = ref;
1990
2059
  exports.resetTracking = resetTracking;
2060
+ exports.setActiveSub = setActiveSub;
2061
+ exports.setCurrentScope = setCurrentScope;
1991
2062
  exports.shallowReactive = shallowReactive;
1992
2063
  exports.shallowReadArray = shallowReadArray;
1993
2064
  exports.shallowReadonly = shallowReadonly;