@vue/compat 3.3.6 → 3.4.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.
@@ -357,117 +357,120 @@ var Vue = (function () {
357
357
  }
358
358
  }
359
359
 
360
- const createDep = (effects) => {
361
- const dep = new Set(effects);
362
- dep.w = 0;
363
- dep.n = 0;
364
- return dep;
365
- };
366
- const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
367
- const newTracked = (dep) => (dep.n & trackOpBit) > 0;
368
- const initDepMarkers = ({ deps }) => {
369
- if (deps.length) {
370
- for (let i = 0; i < deps.length; i++) {
371
- deps[i].w |= trackOpBit;
372
- }
373
- }
374
- };
375
- const finalizeDepMarkers = (effect) => {
376
- const { deps } = effect;
377
- if (deps.length) {
378
- let ptr = 0;
379
- for (let i = 0; i < deps.length; i++) {
380
- const dep = deps[i];
381
- if (wasTracked(dep) && !newTracked(dep)) {
382
- dep.delete(effect);
383
- } else {
384
- deps[ptr++] = dep;
385
- }
386
- dep.w &= ~trackOpBit;
387
- dep.n &= ~trackOpBit;
388
- }
389
- deps.length = ptr;
390
- }
391
- };
392
-
393
- const targetMap = /* @__PURE__ */ new WeakMap();
394
- let effectTrackDepth = 0;
395
- let trackOpBit = 1;
396
- const maxMarkerBits = 30;
397
360
  let activeEffect;
398
- const ITERATE_KEY = Symbol("iterate" );
399
- const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
400
361
  class ReactiveEffect {
401
- constructor(fn, scheduler = null, scope) {
362
+ constructor(fn, trigger, scheduler, scope) {
402
363
  this.fn = fn;
364
+ this.trigger = trigger;
403
365
  this.scheduler = scheduler;
404
366
  this.active = true;
405
367
  this.deps = [];
406
- this.parent = void 0;
368
+ /**
369
+ * @internal
370
+ */
371
+ this._dirtyLevel = 3;
372
+ /**
373
+ * @internal
374
+ */
375
+ this._trackId = 0;
376
+ /**
377
+ * @internal
378
+ */
379
+ this._runnings = 0;
380
+ /**
381
+ * @internal
382
+ */
383
+ this._queryings = 0;
384
+ /**
385
+ * @internal
386
+ */
387
+ this._depsLength = 0;
407
388
  recordEffectScope(this, scope);
408
389
  }
390
+ get dirty() {
391
+ if (this._dirtyLevel === 1) {
392
+ this._dirtyLevel = 0;
393
+ this._queryings++;
394
+ pauseTracking();
395
+ for (const dep of this.deps) {
396
+ if (dep.computed) {
397
+ triggerComputed(dep.computed);
398
+ if (this._dirtyLevel >= 2) {
399
+ break;
400
+ }
401
+ }
402
+ }
403
+ resetTracking();
404
+ this._queryings--;
405
+ }
406
+ return this._dirtyLevel >= 2;
407
+ }
408
+ set dirty(v) {
409
+ this._dirtyLevel = v ? 3 : 0;
410
+ }
409
411
  run() {
412
+ this._dirtyLevel = 0;
410
413
  if (!this.active) {
411
414
  return this.fn();
412
415
  }
413
- let parent = activeEffect;
414
416
  let lastShouldTrack = shouldTrack;
415
- while (parent) {
416
- if (parent === this) {
417
- return;
418
- }
419
- parent = parent.parent;
420
- }
417
+ let lastEffect = activeEffect;
421
418
  try {
422
- this.parent = activeEffect;
423
- activeEffect = this;
424
419
  shouldTrack = true;
425
- trackOpBit = 1 << ++effectTrackDepth;
426
- if (effectTrackDepth <= maxMarkerBits) {
427
- initDepMarkers(this);
428
- } else {
429
- cleanupEffect(this);
430
- }
420
+ activeEffect = this;
421
+ this._runnings++;
422
+ preCleanupEffect(this);
431
423
  return this.fn();
432
424
  } finally {
433
- if (effectTrackDepth <= maxMarkerBits) {
434
- finalizeDepMarkers(this);
435
- }
436
- trackOpBit = 1 << --effectTrackDepth;
437
- activeEffect = this.parent;
425
+ postCleanupEffect(this);
426
+ this._runnings--;
427
+ activeEffect = lastEffect;
438
428
  shouldTrack = lastShouldTrack;
439
- this.parent = void 0;
440
- if (this.deferStop) {
441
- this.stop();
442
- }
443
429
  }
444
430
  }
445
431
  stop() {
446
- if (activeEffect === this) {
447
- this.deferStop = true;
448
- } else if (this.active) {
449
- cleanupEffect(this);
450
- if (this.onStop) {
451
- this.onStop();
452
- }
432
+ var _a;
433
+ if (this.active) {
434
+ preCleanupEffect(this);
435
+ postCleanupEffect(this);
436
+ (_a = this.onStop) == null ? void 0 : _a.call(this);
453
437
  this.active = false;
454
438
  }
455
439
  }
456
440
  }
457
- function cleanupEffect(effect2) {
458
- const { deps } = effect2;
459
- if (deps.length) {
460
- for (let i = 0; i < deps.length; i++) {
461
- deps[i].delete(effect2);
441
+ function triggerComputed(computed) {
442
+ return computed.value;
443
+ }
444
+ function preCleanupEffect(effect2) {
445
+ effect2._trackId++;
446
+ effect2._depsLength = 0;
447
+ }
448
+ function postCleanupEffect(effect2) {
449
+ if (effect2.deps && effect2.deps.length > effect2._depsLength) {
450
+ for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
451
+ cleanupDepEffect(effect2.deps[i], effect2);
452
+ }
453
+ effect2.deps.length = effect2._depsLength;
454
+ }
455
+ }
456
+ function cleanupDepEffect(dep, effect2) {
457
+ const trackId = dep.get(effect2);
458
+ if (trackId !== void 0 && effect2._trackId !== trackId) {
459
+ dep.delete(effect2);
460
+ if (dep.size === 0) {
461
+ dep.cleanup();
462
462
  }
463
- deps.length = 0;
464
463
  }
465
464
  }
466
465
  function effect(fn, options) {
467
466
  if (fn.effect instanceof ReactiveEffect) {
468
467
  fn = fn.effect.fn;
469
468
  }
470
- const _effect = new ReactiveEffect(fn);
469
+ const _effect = new ReactiveEffect(fn, NOOP, () => {
470
+ if (_effect.dirty) {
471
+ _effect.run();
472
+ }
473
+ });
471
474
  if (options) {
472
475
  extend(_effect, options);
473
476
  if (options.scope)
@@ -484,6 +487,7 @@ var Vue = (function () {
484
487
  runner.effect.stop();
485
488
  }
486
489
  let shouldTrack = true;
490
+ let pauseScheduleStack = 0;
487
491
  const trackStack = [];
488
492
  function pauseTracking() {
489
493
  trackStack.push(shouldTrack);
@@ -493,6 +497,68 @@ var Vue = (function () {
493
497
  const last = trackStack.pop();
494
498
  shouldTrack = last === void 0 ? true : last;
495
499
  }
500
+ function pauseScheduling() {
501
+ pauseScheduleStack++;
502
+ }
503
+ function resetScheduling() {
504
+ pauseScheduleStack--;
505
+ while (!pauseScheduleStack && queueEffectSchedulers.length) {
506
+ queueEffectSchedulers.shift()();
507
+ }
508
+ }
509
+ function trackEffect(effect2, dep, debuggerEventExtraInfo) {
510
+ var _a;
511
+ if (dep.get(effect2) !== effect2._trackId) {
512
+ dep.set(effect2, effect2._trackId);
513
+ const oldDep = effect2.deps[effect2._depsLength];
514
+ if (oldDep !== dep) {
515
+ if (oldDep) {
516
+ cleanupDepEffect(oldDep, effect2);
517
+ }
518
+ effect2.deps[effect2._depsLength++] = dep;
519
+ } else {
520
+ effect2._depsLength++;
521
+ }
522
+ {
523
+ (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
524
+ }
525
+ }
526
+ }
527
+ const queueEffectSchedulers = [];
528
+ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
529
+ var _a;
530
+ pauseScheduling();
531
+ for (const effect2 of dep.keys()) {
532
+ if (!effect2.allowRecurse && effect2._runnings) {
533
+ continue;
534
+ }
535
+ if (effect2._dirtyLevel < dirtyLevel && (!effect2._runnings || dirtyLevel !== 2)) {
536
+ const lastDirtyLevel = effect2._dirtyLevel;
537
+ effect2._dirtyLevel = dirtyLevel;
538
+ if (lastDirtyLevel === 0 && (!effect2._queryings || dirtyLevel !== 2)) {
539
+ {
540
+ (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
541
+ }
542
+ effect2.trigger();
543
+ if (effect2.scheduler) {
544
+ queueEffectSchedulers.push(effect2.scheduler);
545
+ }
546
+ }
547
+ }
548
+ }
549
+ resetScheduling();
550
+ }
551
+
552
+ const createDep = (cleanup, computed) => {
553
+ const dep = /* @__PURE__ */ new Map();
554
+ dep.cleanup = cleanup;
555
+ dep.computed = computed;
556
+ return dep;
557
+ };
558
+
559
+ const targetMap = /* @__PURE__ */ new WeakMap();
560
+ const ITERATE_KEY = Symbol("iterate" );
561
+ const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
496
562
  function track(target, type, key) {
497
563
  if (shouldTrack && activeEffect) {
498
564
  let depsMap = targetMap.get(target);
@@ -501,35 +567,17 @@ var Vue = (function () {
501
567
  }
502
568
  let dep = depsMap.get(key);
503
569
  if (!dep) {
504
- depsMap.set(key, dep = createDep());
505
- }
506
- const eventInfo = { effect: activeEffect, target, type, key } ;
507
- trackEffects(dep, eventInfo);
508
- }
509
- }
510
- function trackEffects(dep, debuggerEventExtraInfo) {
511
- let shouldTrack2 = false;
512
- if (effectTrackDepth <= maxMarkerBits) {
513
- if (!newTracked(dep)) {
514
- dep.n |= trackOpBit;
515
- shouldTrack2 = !wasTracked(dep);
516
- }
517
- } else {
518
- shouldTrack2 = !dep.has(activeEffect);
519
- }
520
- if (shouldTrack2) {
521
- dep.add(activeEffect);
522
- activeEffect.deps.push(dep);
523
- if (activeEffect.onTrack) {
524
- activeEffect.onTrack(
525
- extend(
526
- {
527
- effect: activeEffect
528
- },
529
- debuggerEventExtraInfo
530
- )
531
- );
570
+ depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
532
571
  }
572
+ trackEffect(
573
+ activeEffect,
574
+ dep,
575
+ {
576
+ target,
577
+ type,
578
+ key
579
+ }
580
+ );
533
581
  }
534
582
  }
535
583
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
@@ -543,7 +591,7 @@ var Vue = (function () {
543
591
  } else if (key === "length" && isArray(target)) {
544
592
  const newLength = Number(newValue);
545
593
  depsMap.forEach((dep, key2) => {
546
- if (key2 === "length" || key2 >= newLength) {
594
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
547
595
  deps.push(dep);
548
596
  }
549
597
  });
@@ -577,49 +625,24 @@ var Vue = (function () {
577
625
  break;
578
626
  }
579
627
  }
580
- const eventInfo = { target, type, key, newValue, oldValue, oldTarget } ;
581
- if (deps.length === 1) {
582
- if (deps[0]) {
583
- {
584
- triggerEffects(deps[0], eventInfo);
585
- }
586
- }
587
- } else {
588
- const effects = [];
589
- for (const dep of deps) {
590
- if (dep) {
591
- effects.push(...dep);
592
- }
593
- }
594
- {
595
- triggerEffects(createDep(effects), eventInfo);
596
- }
597
- }
598
- }
599
- function triggerEffects(dep, debuggerEventExtraInfo) {
600
- const effects = isArray(dep) ? dep : [...dep];
601
- for (const effect2 of effects) {
602
- if (effect2.computed) {
603
- triggerEffect(effect2, debuggerEventExtraInfo);
604
- }
605
- }
606
- for (const effect2 of effects) {
607
- if (!effect2.computed) {
608
- triggerEffect(effect2, debuggerEventExtraInfo);
609
- }
610
- }
611
- }
612
- function triggerEffect(effect2, debuggerEventExtraInfo) {
613
- if (effect2 !== activeEffect || effect2.allowRecurse) {
614
- if (effect2.onTrigger) {
615
- effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
616
- }
617
- if (effect2.scheduler) {
618
- effect2.scheduler();
619
- } else {
620
- effect2.run();
628
+ pauseScheduling();
629
+ for (const dep of deps) {
630
+ if (dep) {
631
+ triggerEffects(
632
+ dep,
633
+ 3,
634
+ {
635
+ target,
636
+ type,
637
+ key,
638
+ newValue,
639
+ oldValue,
640
+ oldTarget
641
+ }
642
+ );
621
643
  }
622
644
  }
645
+ resetScheduling();
623
646
  }
624
647
  function getDepFromReactive(object, key) {
625
648
  var _a;
@@ -650,7 +673,9 @@ var Vue = (function () {
650
673
  ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
651
674
  instrumentations[key] = function(...args) {
652
675
  pauseTracking();
676
+ pauseScheduling();
653
677
  const res = toRaw(this)[key].apply(this, args);
678
+ resetScheduling();
654
679
  resetTracking();
655
680
  return res;
656
681
  };
@@ -1189,30 +1214,93 @@ var Vue = (function () {
1189
1214
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1190
1215
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1191
1216
 
1217
+ class ComputedRefImpl {
1218
+ constructor(getter, _setter, isReadonly, isSSR) {
1219
+ this._setter = _setter;
1220
+ this.dep = void 0;
1221
+ this.__v_isRef = true;
1222
+ this["__v_isReadonly"] = false;
1223
+ this.effect = new ReactiveEffect(getter, () => {
1224
+ triggerRefValue(this, 1);
1225
+ });
1226
+ this.effect.computed = this;
1227
+ this.effect.active = this._cacheable = !isSSR;
1228
+ this["__v_isReadonly"] = isReadonly;
1229
+ }
1230
+ get value() {
1231
+ const self = toRaw(this);
1232
+ trackRefValue(self);
1233
+ if (!self._cacheable || self.effect.dirty) {
1234
+ if (hasChanged(self._value, self._value = self.effect.run())) {
1235
+ triggerRefValue(self, 2);
1236
+ }
1237
+ }
1238
+ return self._value;
1239
+ }
1240
+ set value(newValue) {
1241
+ this._setter(newValue);
1242
+ }
1243
+ // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1244
+ get _dirty() {
1245
+ return this.effect.dirty;
1246
+ }
1247
+ set _dirty(v) {
1248
+ this.effect.dirty = v;
1249
+ }
1250
+ // #endregion
1251
+ }
1252
+ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1253
+ let getter;
1254
+ let setter;
1255
+ const onlyGetter = isFunction(getterOrOptions);
1256
+ if (onlyGetter) {
1257
+ getter = getterOrOptions;
1258
+ setter = () => {
1259
+ console.warn("Write operation failed: computed value is readonly");
1260
+ } ;
1261
+ } else {
1262
+ getter = getterOrOptions.get;
1263
+ setter = getterOrOptions.set;
1264
+ }
1265
+ const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1266
+ if (debugOptions && !isSSR) {
1267
+ cRef.effect.onTrack = debugOptions.onTrack;
1268
+ cRef.effect.onTrigger = debugOptions.onTrigger;
1269
+ }
1270
+ return cRef;
1271
+ }
1272
+
1192
1273
  function trackRefValue(ref2) {
1193
1274
  if (shouldTrack && activeEffect) {
1194
1275
  ref2 = toRaw(ref2);
1195
- {
1196
- trackEffects(ref2.dep || (ref2.dep = createDep()), {
1276
+ trackEffect(
1277
+ activeEffect,
1278
+ ref2.dep || (ref2.dep = createDep(
1279
+ () => ref2.dep = void 0,
1280
+ ref2 instanceof ComputedRefImpl ? ref2 : void 0
1281
+ )),
1282
+ {
1197
1283
  target: ref2,
1198
1284
  type: "get",
1199
1285
  key: "value"
1200
- });
1201
- }
1286
+ }
1287
+ );
1202
1288
  }
1203
1289
  }
1204
- function triggerRefValue(ref2, newVal) {
1290
+ function triggerRefValue(ref2, dirtyLevel = 3, newVal) {
1205
1291
  ref2 = toRaw(ref2);
1206
1292
  const dep = ref2.dep;
1207
1293
  if (dep) {
1208
- {
1209
- triggerEffects(dep, {
1294
+ triggerEffects(
1295
+ dep,
1296
+ dirtyLevel,
1297
+ {
1210
1298
  target: ref2,
1211
1299
  type: "set",
1212
1300
  key: "value",
1213
1301
  newValue: newVal
1214
- });
1215
- }
1302
+ }
1303
+ );
1216
1304
  }
1217
1305
  }
1218
1306
  function isRef(r) {
@@ -1248,12 +1336,12 @@ var Vue = (function () {
1248
1336
  if (hasChanged(newVal, this._rawValue)) {
1249
1337
  this._rawValue = newVal;
1250
1338
  this._value = useDirectValue ? newVal : toReactive(newVal);
1251
- triggerRefValue(this, newVal);
1339
+ triggerRefValue(this, 3, newVal);
1252
1340
  }
1253
1341
  }
1254
1342
  }
1255
1343
  function triggerRef(ref2) {
1256
- triggerRefValue(ref2, ref2.value );
1344
+ triggerRefValue(ref2, 3, ref2.value );
1257
1345
  }
1258
1346
  function unref(ref2) {
1259
1347
  return isRef(ref2) ? ref2.value : ref2;
@@ -1351,57 +1439,6 @@ var Vue = (function () {
1351
1439
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1352
1440
  }
1353
1441
 
1354
- class ComputedRefImpl {
1355
- constructor(getter, _setter, isReadonly, isSSR) {
1356
- this._setter = _setter;
1357
- this.dep = void 0;
1358
- this.__v_isRef = true;
1359
- this["__v_isReadonly"] = false;
1360
- this._dirty = true;
1361
- this.effect = new ReactiveEffect(getter, () => {
1362
- if (!this._dirty) {
1363
- this._dirty = true;
1364
- triggerRefValue(this);
1365
- }
1366
- });
1367
- this.effect.computed = this;
1368
- this.effect.active = this._cacheable = !isSSR;
1369
- this["__v_isReadonly"] = isReadonly;
1370
- }
1371
- get value() {
1372
- const self = toRaw(this);
1373
- trackRefValue(self);
1374
- if (self._dirty || !self._cacheable) {
1375
- self._dirty = false;
1376
- self._value = self.effect.run();
1377
- }
1378
- return self._value;
1379
- }
1380
- set value(newValue) {
1381
- this._setter(newValue);
1382
- }
1383
- }
1384
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1385
- let getter;
1386
- let setter;
1387
- const onlyGetter = isFunction(getterOrOptions);
1388
- if (onlyGetter) {
1389
- getter = getterOrOptions;
1390
- setter = () => {
1391
- console.warn("Write operation failed: computed value is readonly");
1392
- } ;
1393
- } else {
1394
- getter = getterOrOptions.get;
1395
- setter = getterOrOptions.set;
1396
- }
1397
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1398
- if (debugOptions && !isSSR) {
1399
- cRef.effect.onTrack = debugOptions.onTrack;
1400
- cRef.effect.onTrigger = debugOptions.onTrigger;
1401
- }
1402
- return cRef;
1403
- }
1404
-
1405
1442
  const stack = [];
1406
1443
  function pushWarningContext(vnode) {
1407
1444
  stack.push(vnode);
@@ -1516,7 +1553,7 @@ var Vue = (function () {
1516
1553
  }
1517
1554
  }
1518
1555
 
1519
- const ErrorTypeStrings = {
1556
+ const ErrorTypeStrings$1 = {
1520
1557
  ["sp"]: "serverPrefetch hook",
1521
1558
  ["bc"]: "beforeCreate hook",
1522
1559
  ["c"]: "created hook",
@@ -1577,7 +1614,7 @@ var Vue = (function () {
1577
1614
  if (instance) {
1578
1615
  let cur = instance.parent;
1579
1616
  const exposedInstance = instance.proxy;
1580
- const errorInfo = ErrorTypeStrings[type] ;
1617
+ const errorInfo = ErrorTypeStrings$1[type] ;
1581
1618
  while (cur) {
1582
1619
  const errorCapturedHooks = cur.ec;
1583
1620
  if (errorCapturedHooks) {
@@ -1604,7 +1641,7 @@ var Vue = (function () {
1604
1641
  }
1605
1642
  function logError(err, type, contextVNode, throwInDev = true) {
1606
1643
  {
1607
- const info = ErrorTypeStrings[type];
1644
+ const info = ErrorTypeStrings$1[type];
1608
1645
  if (contextVNode) {
1609
1646
  pushWarningContext(contextVNode);
1610
1647
  }
@@ -1639,8 +1676,13 @@ var Vue = (function () {
1639
1676
  let end = queue.length;
1640
1677
  while (start < end) {
1641
1678
  const middle = start + end >>> 1;
1642
- const middleJobId = getId(queue[middle]);
1643
- middleJobId < id ? start = middle + 1 : end = middle;
1679
+ const middleJob = queue[middle];
1680
+ const middleJobId = getId(middleJob);
1681
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1682
+ start = middle + 1;
1683
+ } else {
1684
+ end = middle;
1685
+ }
1644
1686
  }
1645
1687
  return start;
1646
1688
  }
@@ -1827,6 +1869,7 @@ var Vue = (function () {
1827
1869
  }
1828
1870
  instance.renderCache = [];
1829
1871
  isHmrUpdating = true;
1872
+ instance.effect.dirty = true;
1830
1873
  instance.update();
1831
1874
  isHmrUpdating = false;
1832
1875
  });
@@ -1854,6 +1897,7 @@ var Vue = (function () {
1854
1897
  instance.ceReload(newComp.styles);
1855
1898
  hmrDirtyComponents.delete(oldComp);
1856
1899
  } else if (instance.parent) {
1900
+ instance.parent.effect.dirty = true;
1857
1901
  queueJob(instance.parent.update);
1858
1902
  } else if (instance.appContext.reload) {
1859
1903
  instance.appContext.reload();
@@ -3228,14 +3272,16 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3228
3272
  parentComponent: parentComponent2,
3229
3273
  container: container2
3230
3274
  } = suspense;
3275
+ let delayEnter = false;
3231
3276
  if (suspense.isHydrating) {
3232
3277
  suspense.isHydrating = false;
3233
3278
  } else if (!resume) {
3234
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3279
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3235
3280
  if (delayEnter) {
3236
3281
  activeBranch.transition.afterLeave = () => {
3237
3282
  if (pendingId === suspense.pendingId) {
3238
3283
  move(pendingBranch, container2, anchor2, 0);
3284
+ queuePostFlushCb(effects);
3239
3285
  }
3240
3286
  };
3241
3287
  }
@@ -3261,7 +3307,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3261
3307
  }
3262
3308
  parent = parent.parent;
3263
3309
  }
3264
- if (!hasUnresolvedAncestor) {
3310
+ if (!hasUnresolvedAncestor && !delayEnter) {
3265
3311
  queuePostFlushCb(effects);
3266
3312
  }
3267
3313
  suspense.effects = [];
@@ -3547,8 +3593,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3547
3593
  }
3548
3594
  return doWatch(source, cb, options);
3549
3595
  }
3550
- function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
3596
+ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
3551
3597
  var _a;
3598
+ if (cb && once) {
3599
+ const _cb = cb;
3600
+ cb = (...args) => {
3601
+ _cb(...args);
3602
+ unwatch();
3603
+ };
3604
+ }
3552
3605
  if (!cb) {
3553
3606
  if (immediate !== void 0) {
3554
3607
  warn(
@@ -3560,6 +3613,11 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3560
3613
  `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
3561
3614
  );
3562
3615
  }
3616
+ if (once !== void 0) {
3617
+ warn(
3618
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
3619
+ );
3620
+ }
3563
3621
  }
3564
3622
  const warnInvalidSource = (s) => {
3565
3623
  warn(
@@ -3637,7 +3695,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3637
3695
  };
3638
3696
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
3639
3697
  const job = () => {
3640
- if (!effect.active) {
3698
+ if (!effect.active || !effect.dirty) {
3641
3699
  return;
3642
3700
  }
3643
3701
  if (cb) {
@@ -3670,7 +3728,13 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3670
3728
  job.id = instance.uid;
3671
3729
  scheduler = () => queueJob(job);
3672
3730
  }
3673
- const effect = new ReactiveEffect(getter, scheduler);
3731
+ const effect = new ReactiveEffect(getter, NOOP, scheduler);
3732
+ const unwatch = () => {
3733
+ effect.stop();
3734
+ if (instance && instance.scope) {
3735
+ remove(instance.scope.effects, effect);
3736
+ }
3737
+ };
3674
3738
  {
3675
3739
  effect.onTrack = onTrack;
3676
3740
  effect.onTrigger = onTrigger;
@@ -3689,12 +3753,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3689
3753
  } else {
3690
3754
  effect.run();
3691
3755
  }
3692
- const unwatch = () => {
3693
- effect.stop();
3694
- if (instance && instance.scope) {
3695
- remove(instance.scope.effects, effect);
3696
- }
3697
- };
3698
3756
  return unwatch;
3699
3757
  }
3700
3758
  function instanceWatch(source, value, options) {
@@ -3927,6 +3985,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3927
3985
  leavingHooks.afterLeave = () => {
3928
3986
  state.isLeaving = false;
3929
3987
  if (instance.update.active !== false) {
3988
+ instance.effect.dirty = true;
3930
3989
  instance.update();
3931
3990
  }
3932
3991
  };
@@ -4265,6 +4324,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4265
4324
  load().then(() => {
4266
4325
  loaded.value = true;
4267
4326
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4327
+ instance.parent.effect.dirty = true;
4268
4328
  queueJob(instance.parent.update);
4269
4329
  }
4270
4330
  }).catch((err) => {
@@ -4562,7 +4622,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4562
4622
  }
4563
4623
  return wrappedHook;
4564
4624
  } else {
4565
- const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
4625
+ const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
4566
4626
  warn(
4567
4627
  `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
4568
4628
  );
@@ -5284,7 +5344,10 @@ If this is a native custom element, make sure to exclude it from component resol
5284
5344
  $root: (i) => getPublicInstance(i.root),
5285
5345
  $emit: (i) => i.emit,
5286
5346
  $options: (i) => resolveMergedOptions(i) ,
5287
- $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
5347
+ $forceUpdate: (i) => i.f || (i.f = () => {
5348
+ i.effect.dirty = true;
5349
+ queueJob(i.update);
5350
+ }),
5288
5351
  $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
5289
5352
  $watch: (i) => instanceWatch.bind(i)
5290
5353
  })
@@ -6185,7 +6248,7 @@ If this is a native custom element, make sure to exclude it from component resol
6185
6248
  return vm;
6186
6249
  }
6187
6250
  }
6188
- Vue.version = `2.6.14-compat:${"3.3.6"}`;
6251
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
6189
6252
  Vue.config = singletonApp.config;
6190
6253
  Vue.use = (p, ...options) => {
6191
6254
  if (p && isFunction(p.install)) {
@@ -7515,7 +7578,14 @@ If you want to remount the same app, move your app creation logic into a factory
7515
7578
  break;
7516
7579
  case Comment:
7517
7580
  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7518
- nextNode = onMismatch();
7581
+ if (node.tagName.toLowerCase() === "template") {
7582
+ const content = vnode.el.content.firstChild;
7583
+ replaceNode(content, node, parentComponent);
7584
+ vnode.el = node = content;
7585
+ nextNode = nextSibling(node);
7586
+ } else {
7587
+ nextNode = onMismatch();
7588
+ }
7519
7589
  } else {
7520
7590
  nextNode = nextSibling(node);
7521
7591
  }
@@ -7557,7 +7627,7 @@ If you want to remount the same app, move your app creation logic into a factory
7557
7627
  break;
7558
7628
  default:
7559
7629
  if (shapeFlag & 1) {
7560
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
7630
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
7561
7631
  nextNode = onMismatch();
7562
7632
  } else {
7563
7633
  nextNode = hydrateElement(
@@ -7572,6 +7642,13 @@ If you want to remount the same app, move your app creation logic into a factory
7572
7642
  } else if (shapeFlag & 6) {
7573
7643
  vnode.slotScopeIds = slotScopeIds;
7574
7644
  const container = parentNode(node);
7645
+ if (isFragmentStart) {
7646
+ nextNode = locateClosingAnchor(node);
7647
+ } else if (isComment(node) && node.data === "teleport start") {
7648
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
7649
+ } else {
7650
+ nextNode = nextSibling(node);
7651
+ }
7575
7652
  mountComponent(
7576
7653
  vnode,
7577
7654
  container,
@@ -7581,10 +7658,6 @@ If you want to remount the same app, move your app creation logic into a factory
7581
7658
  isSVGContainer(container),
7582
7659
  optimized
7583
7660
  );
7584
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
7585
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
7586
- nextNode = nextSibling(nextNode);
7587
- }
7588
7661
  if (isAsyncWrapper(vnode)) {
7589
7662
  let subTree;
7590
7663
  if (isFragmentStart) {
@@ -7634,7 +7707,7 @@ If you want to remount the same app, move your app creation logic into a factory
7634
7707
  };
7635
7708
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7636
7709
  optimized = optimized || !!vnode.dynamicChildren;
7637
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
7710
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7638
7711
  const forcePatchValue = type === "input" && dirs || type === "option";
7639
7712
  {
7640
7713
  if (dirs) {
@@ -7671,12 +7744,23 @@ If you want to remount the same app, move your app creation logic into a factory
7671
7744
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7672
7745
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7673
7746
  }
7747
+ let needCallTransitionHooks = false;
7748
+ if (isTemplateNode(el)) {
7749
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7750
+ const content = el.content.firstChild;
7751
+ if (needCallTransitionHooks) {
7752
+ transition.beforeEnter(content);
7753
+ }
7754
+ replaceNode(content, el, parentComponent);
7755
+ vnode.el = el = content;
7756
+ }
7674
7757
  if (dirs) {
7675
7758
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7676
7759
  }
7677
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
7760
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
7678
7761
  queueEffectWithSuspense(() => {
7679
7762
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7763
+ needCallTransitionHooks && transition.enter(el);
7680
7764
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7681
7765
  }, parentSuspense);
7682
7766
  }
@@ -7794,7 +7878,7 @@ If you want to remount the same app, move your app creation logic into a factory
7794
7878
  );
7795
7879
  vnode.el = null;
7796
7880
  if (isFragment) {
7797
- const end = locateClosingAsyncAnchor(node);
7881
+ const end = locateClosingAnchor(node);
7798
7882
  while (true) {
7799
7883
  const next2 = nextSibling(node);
7800
7884
  if (next2 && next2 !== end) {
@@ -7819,14 +7903,14 @@ If you want to remount the same app, move your app creation logic into a factory
7819
7903
  );
7820
7904
  return next;
7821
7905
  };
7822
- const locateClosingAsyncAnchor = (node) => {
7906
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
7823
7907
  let match = 0;
7824
7908
  while (node) {
7825
7909
  node = nextSibling(node);
7826
7910
  if (node && isComment(node)) {
7827
- if (node.data === "[")
7911
+ if (node.data === open)
7828
7912
  match++;
7829
- if (node.data === "]") {
7913
+ if (node.data === close) {
7830
7914
  if (match === 0) {
7831
7915
  return nextSibling(node);
7832
7916
  } else {
@@ -7837,6 +7921,23 @@ If you want to remount the same app, move your app creation logic into a factory
7837
7921
  }
7838
7922
  return node;
7839
7923
  };
7924
+ const replaceNode = (newNode, oldNode, parentComponent) => {
7925
+ const parentNode2 = oldNode.parentNode;
7926
+ if (parentNode2) {
7927
+ parentNode2.replaceChild(newNode, oldNode);
7928
+ }
7929
+ let parent = parentComponent;
7930
+ while (parent) {
7931
+ if (parent.vnode.el === oldNode) {
7932
+ parent.vnode.el = newNode;
7933
+ parent.subTree.el = newNode;
7934
+ }
7935
+ parent = parent.parent;
7936
+ }
7937
+ };
7938
+ const isTemplateNode = (node) => {
7939
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
7940
+ };
7840
7941
  return [hydrate, hydrateNode];
7841
7942
  }
7842
7943
 
@@ -8164,7 +8265,7 @@ If you want to remount the same app, move your app creation logic into a factory
8164
8265
  if (dirs) {
8165
8266
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8166
8267
  }
8167
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8268
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
8168
8269
  if (needCallTransitionHooks) {
8169
8270
  transition.beforeEnter(el);
8170
8271
  }
@@ -8553,6 +8654,7 @@ If you want to remount the same app, move your app creation logic into a factory
8553
8654
  } else {
8554
8655
  instance.next = n2;
8555
8656
  invalidateJob(instance.update);
8657
+ instance.effect.dirty = true;
8556
8658
  instance.update();
8557
8659
  }
8558
8660
  } else {
@@ -8746,11 +8848,16 @@ If you want to remount the same app, move your app creation logic into a factory
8746
8848
  };
8747
8849
  const effect = instance.effect = new ReactiveEffect(
8748
8850
  componentUpdateFn,
8851
+ NOOP,
8749
8852
  () => queueJob(update),
8750
8853
  instance.scope
8751
8854
  // track it in component's effect scope
8752
8855
  );
8753
- const update = instance.update = () => effect.run();
8856
+ const update = instance.update = () => {
8857
+ if (effect.dirty) {
8858
+ effect.run();
8859
+ }
8860
+ };
8754
8861
  update.id = instance.uid;
8755
8862
  toggleRecurse(instance, true);
8756
8863
  {
@@ -9081,8 +9188,8 @@ If you want to remount the same app, move your app creation logic into a factory
9081
9188
  moveStaticNode(vnode, container, anchor);
9082
9189
  return;
9083
9190
  }
9084
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
9085
- if (needTransition) {
9191
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9192
+ if (needTransition2) {
9086
9193
  if (moveType === 0) {
9087
9194
  transition.beforeEnter(el);
9088
9195
  hostInsert(el, container, anchor);
@@ -9311,6 +9418,9 @@ If you want to remount the same app, move your app creation logic into a factory
9311
9418
  function toggleRecurse({ effect, update }, allowed) {
9312
9419
  effect.allowRecurse = update.allowRecurse = allowed;
9313
9420
  }
9421
+ function needTransition(parentSuspense, transition) {
9422
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
9423
+ }
9314
9424
  function traverseStaticChildren(n1, n2, shallow = false) {
9315
9425
  const ch1 = n1.children;
9316
9426
  const ch2 = n2.children;
@@ -10713,7 +10823,8 @@ Component that was made reactive: `,
10713
10823
  return true;
10714
10824
  }
10715
10825
 
10716
- const version = "3.3.6";
10826
+ const version = "3.4.0-alpha.1";
10827
+ const ErrorTypeStrings = ErrorTypeStrings$1 ;
10717
10828
  const ssrUtils = null;
10718
10829
  const resolveFilter = resolveFilter$1 ;
10719
10830
  const _compatUtils = {
@@ -12337,6 +12448,7 @@ Component that was made reactive: `,
12337
12448
  BaseTransitionPropsValidators: BaseTransitionPropsValidators,
12338
12449
  Comment: Comment,
12339
12450
  EffectScope: EffectScope,
12451
+ ErrorTypeStrings: ErrorTypeStrings,
12340
12452
  Fragment: Fragment,
12341
12453
  KeepAlive: KeepAlive,
12342
12454
  ReactiveEffect: ReactiveEffect,