@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.
@@ -422,117 +422,120 @@ var Vue = (function () {
422
422
  }
423
423
  }
424
424
 
425
- const createDep = (effects) => {
426
- const dep = new Set(effects);
427
- dep.w = 0;
428
- dep.n = 0;
429
- return dep;
430
- };
431
- const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
432
- const newTracked = (dep) => (dep.n & trackOpBit) > 0;
433
- const initDepMarkers = ({ deps }) => {
434
- if (deps.length) {
435
- for (let i = 0; i < deps.length; i++) {
436
- deps[i].w |= trackOpBit;
437
- }
438
- }
439
- };
440
- const finalizeDepMarkers = (effect) => {
441
- const { deps } = effect;
442
- if (deps.length) {
443
- let ptr = 0;
444
- for (let i = 0; i < deps.length; i++) {
445
- const dep = deps[i];
446
- if (wasTracked(dep) && !newTracked(dep)) {
447
- dep.delete(effect);
448
- } else {
449
- deps[ptr++] = dep;
450
- }
451
- dep.w &= ~trackOpBit;
452
- dep.n &= ~trackOpBit;
453
- }
454
- deps.length = ptr;
455
- }
456
- };
457
-
458
- const targetMap = /* @__PURE__ */ new WeakMap();
459
- let effectTrackDepth = 0;
460
- let trackOpBit = 1;
461
- const maxMarkerBits = 30;
462
425
  let activeEffect;
463
- const ITERATE_KEY = Symbol("iterate" );
464
- const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
465
426
  class ReactiveEffect {
466
- constructor(fn, scheduler = null, scope) {
427
+ constructor(fn, trigger, scheduler, scope) {
467
428
  this.fn = fn;
429
+ this.trigger = trigger;
468
430
  this.scheduler = scheduler;
469
431
  this.active = true;
470
432
  this.deps = [];
471
- this.parent = void 0;
433
+ /**
434
+ * @internal
435
+ */
436
+ this._dirtyLevel = 3;
437
+ /**
438
+ * @internal
439
+ */
440
+ this._trackId = 0;
441
+ /**
442
+ * @internal
443
+ */
444
+ this._runnings = 0;
445
+ /**
446
+ * @internal
447
+ */
448
+ this._queryings = 0;
449
+ /**
450
+ * @internal
451
+ */
452
+ this._depsLength = 0;
472
453
  recordEffectScope(this, scope);
473
454
  }
455
+ get dirty() {
456
+ if (this._dirtyLevel === 1) {
457
+ this._dirtyLevel = 0;
458
+ this._queryings++;
459
+ pauseTracking();
460
+ for (const dep of this.deps) {
461
+ if (dep.computed) {
462
+ triggerComputed(dep.computed);
463
+ if (this._dirtyLevel >= 2) {
464
+ break;
465
+ }
466
+ }
467
+ }
468
+ resetTracking();
469
+ this._queryings--;
470
+ }
471
+ return this._dirtyLevel >= 2;
472
+ }
473
+ set dirty(v) {
474
+ this._dirtyLevel = v ? 3 : 0;
475
+ }
474
476
  run() {
477
+ this._dirtyLevel = 0;
475
478
  if (!this.active) {
476
479
  return this.fn();
477
480
  }
478
- let parent = activeEffect;
479
481
  let lastShouldTrack = shouldTrack;
480
- while (parent) {
481
- if (parent === this) {
482
- return;
483
- }
484
- parent = parent.parent;
485
- }
482
+ let lastEffect = activeEffect;
486
483
  try {
487
- this.parent = activeEffect;
488
- activeEffect = this;
489
484
  shouldTrack = true;
490
- trackOpBit = 1 << ++effectTrackDepth;
491
- if (effectTrackDepth <= maxMarkerBits) {
492
- initDepMarkers(this);
493
- } else {
494
- cleanupEffect(this);
495
- }
485
+ activeEffect = this;
486
+ this._runnings++;
487
+ preCleanupEffect(this);
496
488
  return this.fn();
497
489
  } finally {
498
- if (effectTrackDepth <= maxMarkerBits) {
499
- finalizeDepMarkers(this);
500
- }
501
- trackOpBit = 1 << --effectTrackDepth;
502
- activeEffect = this.parent;
490
+ postCleanupEffect(this);
491
+ this._runnings--;
492
+ activeEffect = lastEffect;
503
493
  shouldTrack = lastShouldTrack;
504
- this.parent = void 0;
505
- if (this.deferStop) {
506
- this.stop();
507
- }
508
494
  }
509
495
  }
510
496
  stop() {
511
- if (activeEffect === this) {
512
- this.deferStop = true;
513
- } else if (this.active) {
514
- cleanupEffect(this);
515
- if (this.onStop) {
516
- this.onStop();
517
- }
497
+ var _a;
498
+ if (this.active) {
499
+ preCleanupEffect(this);
500
+ postCleanupEffect(this);
501
+ (_a = this.onStop) == null ? void 0 : _a.call(this);
518
502
  this.active = false;
519
503
  }
520
504
  }
521
505
  }
522
- function cleanupEffect(effect2) {
523
- const { deps } = effect2;
524
- if (deps.length) {
525
- for (let i = 0; i < deps.length; i++) {
526
- deps[i].delete(effect2);
506
+ function triggerComputed(computed) {
507
+ return computed.value;
508
+ }
509
+ function preCleanupEffect(effect2) {
510
+ effect2._trackId++;
511
+ effect2._depsLength = 0;
512
+ }
513
+ function postCleanupEffect(effect2) {
514
+ if (effect2.deps && effect2.deps.length > effect2._depsLength) {
515
+ for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
516
+ cleanupDepEffect(effect2.deps[i], effect2);
517
+ }
518
+ effect2.deps.length = effect2._depsLength;
519
+ }
520
+ }
521
+ function cleanupDepEffect(dep, effect2) {
522
+ const trackId = dep.get(effect2);
523
+ if (trackId !== void 0 && effect2._trackId !== trackId) {
524
+ dep.delete(effect2);
525
+ if (dep.size === 0) {
526
+ dep.cleanup();
527
527
  }
528
- deps.length = 0;
529
528
  }
530
529
  }
531
530
  function effect(fn, options) {
532
531
  if (fn.effect instanceof ReactiveEffect) {
533
532
  fn = fn.effect.fn;
534
533
  }
535
- const _effect = new ReactiveEffect(fn);
534
+ const _effect = new ReactiveEffect(fn, NOOP, () => {
535
+ if (_effect.dirty) {
536
+ _effect.run();
537
+ }
538
+ });
536
539
  if (options) {
537
540
  extend(_effect, options);
538
541
  if (options.scope)
@@ -549,6 +552,7 @@ var Vue = (function () {
549
552
  runner.effect.stop();
550
553
  }
551
554
  let shouldTrack = true;
555
+ let pauseScheduleStack = 0;
552
556
  const trackStack = [];
553
557
  function pauseTracking() {
554
558
  trackStack.push(shouldTrack);
@@ -558,6 +562,68 @@ var Vue = (function () {
558
562
  const last = trackStack.pop();
559
563
  shouldTrack = last === void 0 ? true : last;
560
564
  }
565
+ function pauseScheduling() {
566
+ pauseScheduleStack++;
567
+ }
568
+ function resetScheduling() {
569
+ pauseScheduleStack--;
570
+ while (!pauseScheduleStack && queueEffectSchedulers.length) {
571
+ queueEffectSchedulers.shift()();
572
+ }
573
+ }
574
+ function trackEffect(effect2, dep, debuggerEventExtraInfo) {
575
+ var _a;
576
+ if (dep.get(effect2) !== effect2._trackId) {
577
+ dep.set(effect2, effect2._trackId);
578
+ const oldDep = effect2.deps[effect2._depsLength];
579
+ if (oldDep !== dep) {
580
+ if (oldDep) {
581
+ cleanupDepEffect(oldDep, effect2);
582
+ }
583
+ effect2.deps[effect2._depsLength++] = dep;
584
+ } else {
585
+ effect2._depsLength++;
586
+ }
587
+ {
588
+ (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
589
+ }
590
+ }
591
+ }
592
+ const queueEffectSchedulers = [];
593
+ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
594
+ var _a;
595
+ pauseScheduling();
596
+ for (const effect2 of dep.keys()) {
597
+ if (!effect2.allowRecurse && effect2._runnings) {
598
+ continue;
599
+ }
600
+ if (effect2._dirtyLevel < dirtyLevel && (!effect2._runnings || dirtyLevel !== 2)) {
601
+ const lastDirtyLevel = effect2._dirtyLevel;
602
+ effect2._dirtyLevel = dirtyLevel;
603
+ if (lastDirtyLevel === 0 && (!effect2._queryings || dirtyLevel !== 2)) {
604
+ {
605
+ (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
606
+ }
607
+ effect2.trigger();
608
+ if (effect2.scheduler) {
609
+ queueEffectSchedulers.push(effect2.scheduler);
610
+ }
611
+ }
612
+ }
613
+ }
614
+ resetScheduling();
615
+ }
616
+
617
+ const createDep = (cleanup, computed) => {
618
+ const dep = /* @__PURE__ */ new Map();
619
+ dep.cleanup = cleanup;
620
+ dep.computed = computed;
621
+ return dep;
622
+ };
623
+
624
+ const targetMap = /* @__PURE__ */ new WeakMap();
625
+ const ITERATE_KEY = Symbol("iterate" );
626
+ const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
561
627
  function track(target, type, key) {
562
628
  if (shouldTrack && activeEffect) {
563
629
  let depsMap = targetMap.get(target);
@@ -566,35 +632,17 @@ var Vue = (function () {
566
632
  }
567
633
  let dep = depsMap.get(key);
568
634
  if (!dep) {
569
- depsMap.set(key, dep = createDep());
570
- }
571
- const eventInfo = { effect: activeEffect, target, type, key } ;
572
- trackEffects(dep, eventInfo);
573
- }
574
- }
575
- function trackEffects(dep, debuggerEventExtraInfo) {
576
- let shouldTrack2 = false;
577
- if (effectTrackDepth <= maxMarkerBits) {
578
- if (!newTracked(dep)) {
579
- dep.n |= trackOpBit;
580
- shouldTrack2 = !wasTracked(dep);
581
- }
582
- } else {
583
- shouldTrack2 = !dep.has(activeEffect);
584
- }
585
- if (shouldTrack2) {
586
- dep.add(activeEffect);
587
- activeEffect.deps.push(dep);
588
- if (activeEffect.onTrack) {
589
- activeEffect.onTrack(
590
- extend(
591
- {
592
- effect: activeEffect
593
- },
594
- debuggerEventExtraInfo
595
- )
596
- );
635
+ depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
597
636
  }
637
+ trackEffect(
638
+ activeEffect,
639
+ dep,
640
+ {
641
+ target,
642
+ type,
643
+ key
644
+ }
645
+ );
598
646
  }
599
647
  }
600
648
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
@@ -608,7 +656,7 @@ var Vue = (function () {
608
656
  } else if (key === "length" && isArray(target)) {
609
657
  const newLength = Number(newValue);
610
658
  depsMap.forEach((dep, key2) => {
611
- if (key2 === "length" || key2 >= newLength) {
659
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
612
660
  deps.push(dep);
613
661
  }
614
662
  });
@@ -642,49 +690,24 @@ var Vue = (function () {
642
690
  break;
643
691
  }
644
692
  }
645
- const eventInfo = { target, type, key, newValue, oldValue, oldTarget } ;
646
- if (deps.length === 1) {
647
- if (deps[0]) {
648
- {
649
- triggerEffects(deps[0], eventInfo);
650
- }
651
- }
652
- } else {
653
- const effects = [];
654
- for (const dep of deps) {
655
- if (dep) {
656
- effects.push(...dep);
657
- }
658
- }
659
- {
660
- triggerEffects(createDep(effects), eventInfo);
661
- }
662
- }
663
- }
664
- function triggerEffects(dep, debuggerEventExtraInfo) {
665
- const effects = isArray(dep) ? dep : [...dep];
666
- for (const effect2 of effects) {
667
- if (effect2.computed) {
668
- triggerEffect(effect2, debuggerEventExtraInfo);
669
- }
670
- }
671
- for (const effect2 of effects) {
672
- if (!effect2.computed) {
673
- triggerEffect(effect2, debuggerEventExtraInfo);
674
- }
675
- }
676
- }
677
- function triggerEffect(effect2, debuggerEventExtraInfo) {
678
- if (effect2 !== activeEffect || effect2.allowRecurse) {
679
- if (effect2.onTrigger) {
680
- effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
681
- }
682
- if (effect2.scheduler) {
683
- effect2.scheduler();
684
- } else {
685
- effect2.run();
693
+ pauseScheduling();
694
+ for (const dep of deps) {
695
+ if (dep) {
696
+ triggerEffects(
697
+ dep,
698
+ 3,
699
+ {
700
+ target,
701
+ type,
702
+ key,
703
+ newValue,
704
+ oldValue,
705
+ oldTarget
706
+ }
707
+ );
686
708
  }
687
709
  }
710
+ resetScheduling();
688
711
  }
689
712
  function getDepFromReactive(object, key) {
690
713
  var _a;
@@ -715,7 +738,9 @@ var Vue = (function () {
715
738
  ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
716
739
  instrumentations[key] = function(...args) {
717
740
  pauseTracking();
741
+ pauseScheduling();
718
742
  const res = toRaw(this)[key].apply(this, args);
743
+ resetScheduling();
719
744
  resetTracking();
720
745
  return res;
721
746
  };
@@ -1254,30 +1279,93 @@ var Vue = (function () {
1254
1279
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1255
1280
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1256
1281
 
1282
+ class ComputedRefImpl {
1283
+ constructor(getter, _setter, isReadonly, isSSR) {
1284
+ this._setter = _setter;
1285
+ this.dep = void 0;
1286
+ this.__v_isRef = true;
1287
+ this["__v_isReadonly"] = false;
1288
+ this.effect = new ReactiveEffect(getter, () => {
1289
+ triggerRefValue(this, 1);
1290
+ });
1291
+ this.effect.computed = this;
1292
+ this.effect.active = this._cacheable = !isSSR;
1293
+ this["__v_isReadonly"] = isReadonly;
1294
+ }
1295
+ get value() {
1296
+ const self = toRaw(this);
1297
+ trackRefValue(self);
1298
+ if (!self._cacheable || self.effect.dirty) {
1299
+ if (hasChanged(self._value, self._value = self.effect.run())) {
1300
+ triggerRefValue(self, 2);
1301
+ }
1302
+ }
1303
+ return self._value;
1304
+ }
1305
+ set value(newValue) {
1306
+ this._setter(newValue);
1307
+ }
1308
+ // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1309
+ get _dirty() {
1310
+ return this.effect.dirty;
1311
+ }
1312
+ set _dirty(v) {
1313
+ this.effect.dirty = v;
1314
+ }
1315
+ // #endregion
1316
+ }
1317
+ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1318
+ let getter;
1319
+ let setter;
1320
+ const onlyGetter = isFunction(getterOrOptions);
1321
+ if (onlyGetter) {
1322
+ getter = getterOrOptions;
1323
+ setter = () => {
1324
+ console.warn("Write operation failed: computed value is readonly");
1325
+ } ;
1326
+ } else {
1327
+ getter = getterOrOptions.get;
1328
+ setter = getterOrOptions.set;
1329
+ }
1330
+ const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1331
+ if (debugOptions && !isSSR) {
1332
+ cRef.effect.onTrack = debugOptions.onTrack;
1333
+ cRef.effect.onTrigger = debugOptions.onTrigger;
1334
+ }
1335
+ return cRef;
1336
+ }
1337
+
1257
1338
  function trackRefValue(ref2) {
1258
1339
  if (shouldTrack && activeEffect) {
1259
1340
  ref2 = toRaw(ref2);
1260
- {
1261
- trackEffects(ref2.dep || (ref2.dep = createDep()), {
1341
+ trackEffect(
1342
+ activeEffect,
1343
+ ref2.dep || (ref2.dep = createDep(
1344
+ () => ref2.dep = void 0,
1345
+ ref2 instanceof ComputedRefImpl ? ref2 : void 0
1346
+ )),
1347
+ {
1262
1348
  target: ref2,
1263
1349
  type: "get",
1264
1350
  key: "value"
1265
- });
1266
- }
1351
+ }
1352
+ );
1267
1353
  }
1268
1354
  }
1269
- function triggerRefValue(ref2, newVal) {
1355
+ function triggerRefValue(ref2, dirtyLevel = 3, newVal) {
1270
1356
  ref2 = toRaw(ref2);
1271
1357
  const dep = ref2.dep;
1272
1358
  if (dep) {
1273
- {
1274
- triggerEffects(dep, {
1359
+ triggerEffects(
1360
+ dep,
1361
+ dirtyLevel,
1362
+ {
1275
1363
  target: ref2,
1276
1364
  type: "set",
1277
1365
  key: "value",
1278
1366
  newValue: newVal
1279
- });
1280
- }
1367
+ }
1368
+ );
1281
1369
  }
1282
1370
  }
1283
1371
  function isRef(r) {
@@ -1313,12 +1401,12 @@ var Vue = (function () {
1313
1401
  if (hasChanged(newVal, this._rawValue)) {
1314
1402
  this._rawValue = newVal;
1315
1403
  this._value = useDirectValue ? newVal : toReactive(newVal);
1316
- triggerRefValue(this, newVal);
1404
+ triggerRefValue(this, 3, newVal);
1317
1405
  }
1318
1406
  }
1319
1407
  }
1320
1408
  function triggerRef(ref2) {
1321
- triggerRefValue(ref2, ref2.value );
1409
+ triggerRefValue(ref2, 3, ref2.value );
1322
1410
  }
1323
1411
  function unref(ref2) {
1324
1412
  return isRef(ref2) ? ref2.value : ref2;
@@ -1416,57 +1504,6 @@ var Vue = (function () {
1416
1504
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1417
1505
  }
1418
1506
 
1419
- class ComputedRefImpl {
1420
- constructor(getter, _setter, isReadonly, isSSR) {
1421
- this._setter = _setter;
1422
- this.dep = void 0;
1423
- this.__v_isRef = true;
1424
- this["__v_isReadonly"] = false;
1425
- this._dirty = true;
1426
- this.effect = new ReactiveEffect(getter, () => {
1427
- if (!this._dirty) {
1428
- this._dirty = true;
1429
- triggerRefValue(this);
1430
- }
1431
- });
1432
- this.effect.computed = this;
1433
- this.effect.active = this._cacheable = !isSSR;
1434
- this["__v_isReadonly"] = isReadonly;
1435
- }
1436
- get value() {
1437
- const self = toRaw(this);
1438
- trackRefValue(self);
1439
- if (self._dirty || !self._cacheable) {
1440
- self._dirty = false;
1441
- self._value = self.effect.run();
1442
- }
1443
- return self._value;
1444
- }
1445
- set value(newValue) {
1446
- this._setter(newValue);
1447
- }
1448
- }
1449
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1450
- let getter;
1451
- let setter;
1452
- const onlyGetter = isFunction(getterOrOptions);
1453
- if (onlyGetter) {
1454
- getter = getterOrOptions;
1455
- setter = () => {
1456
- console.warn("Write operation failed: computed value is readonly");
1457
- } ;
1458
- } else {
1459
- getter = getterOrOptions.get;
1460
- setter = getterOrOptions.set;
1461
- }
1462
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1463
- if (debugOptions && !isSSR) {
1464
- cRef.effect.onTrack = debugOptions.onTrack;
1465
- cRef.effect.onTrigger = debugOptions.onTrigger;
1466
- }
1467
- return cRef;
1468
- }
1469
-
1470
1507
  const stack = [];
1471
1508
  function pushWarningContext(vnode) {
1472
1509
  stack.push(vnode);
@@ -1581,7 +1618,7 @@ var Vue = (function () {
1581
1618
  }
1582
1619
  }
1583
1620
 
1584
- const ErrorTypeStrings = {
1621
+ const ErrorTypeStrings$1 = {
1585
1622
  ["sp"]: "serverPrefetch hook",
1586
1623
  ["bc"]: "beforeCreate hook",
1587
1624
  ["c"]: "created hook",
@@ -1642,7 +1679,7 @@ var Vue = (function () {
1642
1679
  if (instance) {
1643
1680
  let cur = instance.parent;
1644
1681
  const exposedInstance = instance.proxy;
1645
- const errorInfo = ErrorTypeStrings[type] ;
1682
+ const errorInfo = ErrorTypeStrings$1[type] ;
1646
1683
  while (cur) {
1647
1684
  const errorCapturedHooks = cur.ec;
1648
1685
  if (errorCapturedHooks) {
@@ -1669,7 +1706,7 @@ var Vue = (function () {
1669
1706
  }
1670
1707
  function logError(err, type, contextVNode, throwInDev = true) {
1671
1708
  {
1672
- const info = ErrorTypeStrings[type];
1709
+ const info = ErrorTypeStrings$1[type];
1673
1710
  if (contextVNode) {
1674
1711
  pushWarningContext(contextVNode);
1675
1712
  }
@@ -1704,8 +1741,13 @@ var Vue = (function () {
1704
1741
  let end = queue.length;
1705
1742
  while (start < end) {
1706
1743
  const middle = start + end >>> 1;
1707
- const middleJobId = getId(queue[middle]);
1708
- middleJobId < id ? start = middle + 1 : end = middle;
1744
+ const middleJob = queue[middle];
1745
+ const middleJobId = getId(middleJob);
1746
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1747
+ start = middle + 1;
1748
+ } else {
1749
+ end = middle;
1750
+ }
1709
1751
  }
1710
1752
  return start;
1711
1753
  }
@@ -1892,6 +1934,7 @@ var Vue = (function () {
1892
1934
  }
1893
1935
  instance.renderCache = [];
1894
1936
  isHmrUpdating = true;
1937
+ instance.effect.dirty = true;
1895
1938
  instance.update();
1896
1939
  isHmrUpdating = false;
1897
1940
  });
@@ -1919,6 +1962,7 @@ var Vue = (function () {
1919
1962
  instance.ceReload(newComp.styles);
1920
1963
  hmrDirtyComponents.delete(oldComp);
1921
1964
  } else if (instance.parent) {
1965
+ instance.parent.effect.dirty = true;
1922
1966
  queueJob(instance.parent.update);
1923
1967
  } else if (instance.appContext.reload) {
1924
1968
  instance.appContext.reload();
@@ -3293,14 +3337,16 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3293
3337
  parentComponent: parentComponent2,
3294
3338
  container: container2
3295
3339
  } = suspense;
3340
+ let delayEnter = false;
3296
3341
  if (suspense.isHydrating) {
3297
3342
  suspense.isHydrating = false;
3298
3343
  } else if (!resume) {
3299
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3344
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3300
3345
  if (delayEnter) {
3301
3346
  activeBranch.transition.afterLeave = () => {
3302
3347
  if (pendingId === suspense.pendingId) {
3303
3348
  move(pendingBranch, container2, anchor2, 0);
3349
+ queuePostFlushCb(effects);
3304
3350
  }
3305
3351
  };
3306
3352
  }
@@ -3326,7 +3372,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3326
3372
  }
3327
3373
  parent = parent.parent;
3328
3374
  }
3329
- if (!hasUnresolvedAncestor) {
3375
+ if (!hasUnresolvedAncestor && !delayEnter) {
3330
3376
  queuePostFlushCb(effects);
3331
3377
  }
3332
3378
  suspense.effects = [];
@@ -3612,8 +3658,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3612
3658
  }
3613
3659
  return doWatch(source, cb, options);
3614
3660
  }
3615
- function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
3661
+ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
3616
3662
  var _a;
3663
+ if (cb && once) {
3664
+ const _cb = cb;
3665
+ cb = (...args) => {
3666
+ _cb(...args);
3667
+ unwatch();
3668
+ };
3669
+ }
3617
3670
  if (!cb) {
3618
3671
  if (immediate !== void 0) {
3619
3672
  warn(
@@ -3625,6 +3678,11 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3625
3678
  `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
3626
3679
  );
3627
3680
  }
3681
+ if (once !== void 0) {
3682
+ warn(
3683
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
3684
+ );
3685
+ }
3628
3686
  }
3629
3687
  const warnInvalidSource = (s) => {
3630
3688
  warn(
@@ -3702,7 +3760,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3702
3760
  };
3703
3761
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
3704
3762
  const job = () => {
3705
- if (!effect.active) {
3763
+ if (!effect.active || !effect.dirty) {
3706
3764
  return;
3707
3765
  }
3708
3766
  if (cb) {
@@ -3735,7 +3793,13 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3735
3793
  job.id = instance.uid;
3736
3794
  scheduler = () => queueJob(job);
3737
3795
  }
3738
- const effect = new ReactiveEffect(getter, scheduler);
3796
+ const effect = new ReactiveEffect(getter, NOOP, scheduler);
3797
+ const unwatch = () => {
3798
+ effect.stop();
3799
+ if (instance && instance.scope) {
3800
+ remove(instance.scope.effects, effect);
3801
+ }
3802
+ };
3739
3803
  {
3740
3804
  effect.onTrack = onTrack;
3741
3805
  effect.onTrigger = onTrigger;
@@ -3754,12 +3818,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3754
3818
  } else {
3755
3819
  effect.run();
3756
3820
  }
3757
- const unwatch = () => {
3758
- effect.stop();
3759
- if (instance && instance.scope) {
3760
- remove(instance.scope.effects, effect);
3761
- }
3762
- };
3763
3821
  return unwatch;
3764
3822
  }
3765
3823
  function instanceWatch(source, value, options) {
@@ -3992,6 +4050,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3992
4050
  leavingHooks.afterLeave = () => {
3993
4051
  state.isLeaving = false;
3994
4052
  if (instance.update.active !== false) {
4053
+ instance.effect.dirty = true;
3995
4054
  instance.update();
3996
4055
  }
3997
4056
  };
@@ -4330,6 +4389,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4330
4389
  load().then(() => {
4331
4390
  loaded.value = true;
4332
4391
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4392
+ instance.parent.effect.dirty = true;
4333
4393
  queueJob(instance.parent.update);
4334
4394
  }
4335
4395
  }).catch((err) => {
@@ -4627,7 +4687,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4627
4687
  }
4628
4688
  return wrappedHook;
4629
4689
  } else {
4630
- const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
4690
+ const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
4631
4691
  warn(
4632
4692
  `${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.` )
4633
4693
  );
@@ -5349,7 +5409,10 @@ If this is a native custom element, make sure to exclude it from component resol
5349
5409
  $root: (i) => getPublicInstance(i.root),
5350
5410
  $emit: (i) => i.emit,
5351
5411
  $options: (i) => resolveMergedOptions(i) ,
5352
- $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
5412
+ $forceUpdate: (i) => i.f || (i.f = () => {
5413
+ i.effect.dirty = true;
5414
+ queueJob(i.update);
5415
+ }),
5353
5416
  $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
5354
5417
  $watch: (i) => instanceWatch.bind(i)
5355
5418
  })
@@ -6250,7 +6313,7 @@ If this is a native custom element, make sure to exclude it from component resol
6250
6313
  return vm;
6251
6314
  }
6252
6315
  }
6253
- Vue.version = `2.6.14-compat:${"3.3.6"}`;
6316
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
6254
6317
  Vue.config = singletonApp.config;
6255
6318
  Vue.use = (p, ...options) => {
6256
6319
  if (p && isFunction(p.install)) {
@@ -7580,7 +7643,14 @@ If you want to remount the same app, move your app creation logic into a factory
7580
7643
  break;
7581
7644
  case Comment:
7582
7645
  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7583
- nextNode = onMismatch();
7646
+ if (node.tagName.toLowerCase() === "template") {
7647
+ const content = vnode.el.content.firstChild;
7648
+ replaceNode(content, node, parentComponent);
7649
+ vnode.el = node = content;
7650
+ nextNode = nextSibling(node);
7651
+ } else {
7652
+ nextNode = onMismatch();
7653
+ }
7584
7654
  } else {
7585
7655
  nextNode = nextSibling(node);
7586
7656
  }
@@ -7622,7 +7692,7 @@ If you want to remount the same app, move your app creation logic into a factory
7622
7692
  break;
7623
7693
  default:
7624
7694
  if (shapeFlag & 1) {
7625
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
7695
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
7626
7696
  nextNode = onMismatch();
7627
7697
  } else {
7628
7698
  nextNode = hydrateElement(
@@ -7637,6 +7707,13 @@ If you want to remount the same app, move your app creation logic into a factory
7637
7707
  } else if (shapeFlag & 6) {
7638
7708
  vnode.slotScopeIds = slotScopeIds;
7639
7709
  const container = parentNode(node);
7710
+ if (isFragmentStart) {
7711
+ nextNode = locateClosingAnchor(node);
7712
+ } else if (isComment(node) && node.data === "teleport start") {
7713
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
7714
+ } else {
7715
+ nextNode = nextSibling(node);
7716
+ }
7640
7717
  mountComponent(
7641
7718
  vnode,
7642
7719
  container,
@@ -7646,10 +7723,6 @@ If you want to remount the same app, move your app creation logic into a factory
7646
7723
  isSVGContainer(container),
7647
7724
  optimized
7648
7725
  );
7649
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
7650
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
7651
- nextNode = nextSibling(nextNode);
7652
- }
7653
7726
  if (isAsyncWrapper(vnode)) {
7654
7727
  let subTree;
7655
7728
  if (isFragmentStart) {
@@ -7699,7 +7772,7 @@ If you want to remount the same app, move your app creation logic into a factory
7699
7772
  };
7700
7773
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7701
7774
  optimized = optimized || !!vnode.dynamicChildren;
7702
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
7775
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7703
7776
  const forcePatchValue = type === "input" && dirs || type === "option";
7704
7777
  {
7705
7778
  if (dirs) {
@@ -7736,12 +7809,23 @@ If you want to remount the same app, move your app creation logic into a factory
7736
7809
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7737
7810
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7738
7811
  }
7812
+ let needCallTransitionHooks = false;
7813
+ if (isTemplateNode(el)) {
7814
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7815
+ const content = el.content.firstChild;
7816
+ if (needCallTransitionHooks) {
7817
+ transition.beforeEnter(content);
7818
+ }
7819
+ replaceNode(content, el, parentComponent);
7820
+ vnode.el = el = content;
7821
+ }
7739
7822
  if (dirs) {
7740
7823
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7741
7824
  }
7742
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
7825
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
7743
7826
  queueEffectWithSuspense(() => {
7744
7827
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7828
+ needCallTransitionHooks && transition.enter(el);
7745
7829
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7746
7830
  }, parentSuspense);
7747
7831
  }
@@ -7859,7 +7943,7 @@ If you want to remount the same app, move your app creation logic into a factory
7859
7943
  );
7860
7944
  vnode.el = null;
7861
7945
  if (isFragment) {
7862
- const end = locateClosingAsyncAnchor(node);
7946
+ const end = locateClosingAnchor(node);
7863
7947
  while (true) {
7864
7948
  const next2 = nextSibling(node);
7865
7949
  if (next2 && next2 !== end) {
@@ -7884,14 +7968,14 @@ If you want to remount the same app, move your app creation logic into a factory
7884
7968
  );
7885
7969
  return next;
7886
7970
  };
7887
- const locateClosingAsyncAnchor = (node) => {
7971
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
7888
7972
  let match = 0;
7889
7973
  while (node) {
7890
7974
  node = nextSibling(node);
7891
7975
  if (node && isComment(node)) {
7892
- if (node.data === "[")
7976
+ if (node.data === open)
7893
7977
  match++;
7894
- if (node.data === "]") {
7978
+ if (node.data === close) {
7895
7979
  if (match === 0) {
7896
7980
  return nextSibling(node);
7897
7981
  } else {
@@ -7902,6 +7986,23 @@ If you want to remount the same app, move your app creation logic into a factory
7902
7986
  }
7903
7987
  return node;
7904
7988
  };
7989
+ const replaceNode = (newNode, oldNode, parentComponent) => {
7990
+ const parentNode2 = oldNode.parentNode;
7991
+ if (parentNode2) {
7992
+ parentNode2.replaceChild(newNode, oldNode);
7993
+ }
7994
+ let parent = parentComponent;
7995
+ while (parent) {
7996
+ if (parent.vnode.el === oldNode) {
7997
+ parent.vnode.el = newNode;
7998
+ parent.subTree.el = newNode;
7999
+ }
8000
+ parent = parent.parent;
8001
+ }
8002
+ };
8003
+ const isTemplateNode = (node) => {
8004
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
8005
+ };
7905
8006
  return [hydrate, hydrateNode];
7906
8007
  }
7907
8008
 
@@ -8229,7 +8330,7 @@ If you want to remount the same app, move your app creation logic into a factory
8229
8330
  if (dirs) {
8230
8331
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8231
8332
  }
8232
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8333
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
8233
8334
  if (needCallTransitionHooks) {
8234
8335
  transition.beforeEnter(el);
8235
8336
  }
@@ -8618,6 +8719,7 @@ If you want to remount the same app, move your app creation logic into a factory
8618
8719
  } else {
8619
8720
  instance.next = n2;
8620
8721
  invalidateJob(instance.update);
8722
+ instance.effect.dirty = true;
8621
8723
  instance.update();
8622
8724
  }
8623
8725
  } else {
@@ -8811,11 +8913,16 @@ If you want to remount the same app, move your app creation logic into a factory
8811
8913
  };
8812
8914
  const effect = instance.effect = new ReactiveEffect(
8813
8915
  componentUpdateFn,
8916
+ NOOP,
8814
8917
  () => queueJob(update),
8815
8918
  instance.scope
8816
8919
  // track it in component's effect scope
8817
8920
  );
8818
- const update = instance.update = () => effect.run();
8921
+ const update = instance.update = () => {
8922
+ if (effect.dirty) {
8923
+ effect.run();
8924
+ }
8925
+ };
8819
8926
  update.id = instance.uid;
8820
8927
  toggleRecurse(instance, true);
8821
8928
  {
@@ -9146,8 +9253,8 @@ If you want to remount the same app, move your app creation logic into a factory
9146
9253
  moveStaticNode(vnode, container, anchor);
9147
9254
  return;
9148
9255
  }
9149
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
9150
- if (needTransition) {
9256
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9257
+ if (needTransition2) {
9151
9258
  if (moveType === 0) {
9152
9259
  transition.beforeEnter(el);
9153
9260
  hostInsert(el, container, anchor);
@@ -9376,6 +9483,9 @@ If you want to remount the same app, move your app creation logic into a factory
9376
9483
  function toggleRecurse({ effect, update }, allowed) {
9377
9484
  effect.allowRecurse = update.allowRecurse = allowed;
9378
9485
  }
9486
+ function needTransition(parentSuspense, transition) {
9487
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
9488
+ }
9379
9489
  function traverseStaticChildren(n1, n2, shallow = false) {
9380
9490
  const ch1 = n1.children;
9381
9491
  const ch2 = n2.children;
@@ -10778,7 +10888,8 @@ Component that was made reactive: `,
10778
10888
  return true;
10779
10889
  }
10780
10890
 
10781
- const version = "3.3.6";
10891
+ const version = "3.4.0-alpha.1";
10892
+ const ErrorTypeStrings = ErrorTypeStrings$1 ;
10782
10893
  const ssrUtils = null;
10783
10894
  const resolveFilter = resolveFilter$1 ;
10784
10895
  const _compatUtils = {
@@ -12402,6 +12513,7 @@ Component that was made reactive: `,
12402
12513
  BaseTransitionPropsValidators: BaseTransitionPropsValidators,
12403
12514
  Comment: Comment,
12404
12515
  EffectScope: EffectScope,
12516
+ ErrorTypeStrings: ErrorTypeStrings,
12405
12517
  Fragment: Fragment,
12406
12518
  KeepAlive: KeepAlive,
12407
12519
  ReactiveEffect: ReactiveEffect,
@@ -14068,9 +14180,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14068
14180
  context.transformHoist(children, context, node);
14069
14181
  }
14070
14182
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14071
- node.codegenNode.children = context.hoist(
14183
+ const hoisted = context.hoist(
14072
14184
  createArrayExpression(node.codegenNode.children)
14073
14185
  );
14186
+ if (context.hmr) {
14187
+ hoisted.content = `[...${hoisted.content}]`;
14188
+ }
14189
+ node.codegenNode.children = hoisted;
14074
14190
  }
14075
14191
  }
14076
14192
  function getConstantType(node, context) {
@@ -14243,6 +14359,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14243
14359
  filename = "",
14244
14360
  prefixIdentifiers = false,
14245
14361
  hoistStatic: hoistStatic2 = false,
14362
+ hmr = false,
14246
14363
  cacheHandlers = false,
14247
14364
  nodeTransforms = [],
14248
14365
  directiveTransforms = {},
@@ -14268,6 +14385,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14268
14385
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
14269
14386
  prefixIdentifiers,
14270
14387
  hoistStatic: hoistStatic2,
14388
+ hmr,
14271
14389
  cacheHandlers,
14272
14390
  nodeTransforms,
14273
14391
  directiveTransforms,
@@ -15651,7 +15769,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15651
15769
  }
15652
15770
  }
15653
15771
  };
15654
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
15772
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
15655
15773
  props,
15656
15774
  children,
15657
15775
  false,
@@ -15673,7 +15791,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15673
15791
  slotsProperties.push(
15674
15792
  createObjectProperty(
15675
15793
  arg || createSimpleExpression("default", true),
15676
- buildSlotFn(exp, children, loc)
15794
+ buildSlotFn(exp, void 0, children, loc)
15677
15795
  )
15678
15796
  );
15679
15797
  }
@@ -15710,10 +15828,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15710
15828
  } else {
15711
15829
  hasDynamicSlots = true;
15712
15830
  }
15713
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
15831
+ const vFor = findDir(slotElement, "for");
15832
+ const slotFunction = buildSlotFn(
15833
+ slotProps,
15834
+ vFor == null ? void 0 : vFor.exp,
15835
+ slotChildren,
15836
+ slotLoc
15837
+ );
15714
15838
  let vIf;
15715
15839
  let vElse;
15716
- let vFor;
15717
15840
  if (vIf = findDir(slotElement, "if")) {
15718
15841
  hasDynamicSlots = true;
15719
15842
  dynamicSlots.push(
@@ -15758,7 +15881,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15758
15881
  createCompilerError(30, vElse.loc)
15759
15882
  );
15760
15883
  }
15761
- } else if (vFor = findDir(slotElement, "for")) {
15884
+ } else if (vFor) {
15762
15885
  hasDynamicSlots = true;
15763
15886
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
15764
15887
  if (parseResult) {
@@ -15799,7 +15922,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15799
15922
  }
15800
15923
  if (!onComponentSlot) {
15801
15924
  const buildDefaultSlotProperty = (props, children2) => {
15802
- const fn = buildSlotFn(props, children2, loc);
15925
+ const fn = buildSlotFn(props, void 0, children2, loc);
15803
15926
  if (context.compatConfig) {
15804
15927
  fn.isNonScopedSlot = true;
15805
15928
  }