@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.
@@ -419,117 +419,120 @@ function onScopeDispose(fn) {
419
419
  }
420
420
  }
421
421
 
422
- const createDep = (effects) => {
423
- const dep = new Set(effects);
424
- dep.w = 0;
425
- dep.n = 0;
426
- return dep;
427
- };
428
- const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
429
- const newTracked = (dep) => (dep.n & trackOpBit) > 0;
430
- const initDepMarkers = ({ deps }) => {
431
- if (deps.length) {
432
- for (let i = 0; i < deps.length; i++) {
433
- deps[i].w |= trackOpBit;
434
- }
435
- }
436
- };
437
- const finalizeDepMarkers = (effect) => {
438
- const { deps } = effect;
439
- if (deps.length) {
440
- let ptr = 0;
441
- for (let i = 0; i < deps.length; i++) {
442
- const dep = deps[i];
443
- if (wasTracked(dep) && !newTracked(dep)) {
444
- dep.delete(effect);
445
- } else {
446
- deps[ptr++] = dep;
447
- }
448
- dep.w &= ~trackOpBit;
449
- dep.n &= ~trackOpBit;
450
- }
451
- deps.length = ptr;
452
- }
453
- };
454
-
455
- const targetMap = /* @__PURE__ */ new WeakMap();
456
- let effectTrackDepth = 0;
457
- let trackOpBit = 1;
458
- const maxMarkerBits = 30;
459
422
  let activeEffect;
460
- const ITERATE_KEY = Symbol("");
461
- const MAP_KEY_ITERATE_KEY = Symbol("");
462
423
  class ReactiveEffect {
463
- constructor(fn, scheduler = null, scope) {
424
+ constructor(fn, trigger, scheduler, scope) {
464
425
  this.fn = fn;
426
+ this.trigger = trigger;
465
427
  this.scheduler = scheduler;
466
428
  this.active = true;
467
429
  this.deps = [];
468
- this.parent = void 0;
430
+ /**
431
+ * @internal
432
+ */
433
+ this._dirtyLevel = 3;
434
+ /**
435
+ * @internal
436
+ */
437
+ this._trackId = 0;
438
+ /**
439
+ * @internal
440
+ */
441
+ this._runnings = 0;
442
+ /**
443
+ * @internal
444
+ */
445
+ this._queryings = 0;
446
+ /**
447
+ * @internal
448
+ */
449
+ this._depsLength = 0;
469
450
  recordEffectScope(this, scope);
470
451
  }
452
+ get dirty() {
453
+ if (this._dirtyLevel === 1) {
454
+ this._dirtyLevel = 0;
455
+ this._queryings++;
456
+ pauseTracking();
457
+ for (const dep of this.deps) {
458
+ if (dep.computed) {
459
+ triggerComputed(dep.computed);
460
+ if (this._dirtyLevel >= 2) {
461
+ break;
462
+ }
463
+ }
464
+ }
465
+ resetTracking();
466
+ this._queryings--;
467
+ }
468
+ return this._dirtyLevel >= 2;
469
+ }
470
+ set dirty(v) {
471
+ this._dirtyLevel = v ? 3 : 0;
472
+ }
471
473
  run() {
474
+ this._dirtyLevel = 0;
472
475
  if (!this.active) {
473
476
  return this.fn();
474
477
  }
475
- let parent = activeEffect;
476
478
  let lastShouldTrack = shouldTrack;
477
- while (parent) {
478
- if (parent === this) {
479
- return;
480
- }
481
- parent = parent.parent;
482
- }
479
+ let lastEffect = activeEffect;
483
480
  try {
484
- this.parent = activeEffect;
485
- activeEffect = this;
486
481
  shouldTrack = true;
487
- trackOpBit = 1 << ++effectTrackDepth;
488
- if (effectTrackDepth <= maxMarkerBits) {
489
- initDepMarkers(this);
490
- } else {
491
- cleanupEffect(this);
492
- }
482
+ activeEffect = this;
483
+ this._runnings++;
484
+ preCleanupEffect(this);
493
485
  return this.fn();
494
486
  } finally {
495
- if (effectTrackDepth <= maxMarkerBits) {
496
- finalizeDepMarkers(this);
497
- }
498
- trackOpBit = 1 << --effectTrackDepth;
499
- activeEffect = this.parent;
487
+ postCleanupEffect(this);
488
+ this._runnings--;
489
+ activeEffect = lastEffect;
500
490
  shouldTrack = lastShouldTrack;
501
- this.parent = void 0;
502
- if (this.deferStop) {
503
- this.stop();
504
- }
505
491
  }
506
492
  }
507
493
  stop() {
508
- if (activeEffect === this) {
509
- this.deferStop = true;
510
- } else if (this.active) {
511
- cleanupEffect(this);
512
- if (this.onStop) {
513
- this.onStop();
514
- }
494
+ var _a;
495
+ if (this.active) {
496
+ preCleanupEffect(this);
497
+ postCleanupEffect(this);
498
+ (_a = this.onStop) == null ? void 0 : _a.call(this);
515
499
  this.active = false;
516
500
  }
517
501
  }
518
502
  }
519
- function cleanupEffect(effect2) {
520
- const { deps } = effect2;
521
- if (deps.length) {
522
- for (let i = 0; i < deps.length; i++) {
523
- deps[i].delete(effect2);
503
+ function triggerComputed(computed) {
504
+ return computed.value;
505
+ }
506
+ function preCleanupEffect(effect2) {
507
+ effect2._trackId++;
508
+ effect2._depsLength = 0;
509
+ }
510
+ function postCleanupEffect(effect2) {
511
+ if (effect2.deps && effect2.deps.length > effect2._depsLength) {
512
+ for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
513
+ cleanupDepEffect(effect2.deps[i], effect2);
514
+ }
515
+ effect2.deps.length = effect2._depsLength;
516
+ }
517
+ }
518
+ function cleanupDepEffect(dep, effect2) {
519
+ const trackId = dep.get(effect2);
520
+ if (trackId !== void 0 && effect2._trackId !== trackId) {
521
+ dep.delete(effect2);
522
+ if (dep.size === 0) {
523
+ dep.cleanup();
524
524
  }
525
- deps.length = 0;
526
525
  }
527
526
  }
528
527
  function effect(fn, options) {
529
528
  if (fn.effect instanceof ReactiveEffect) {
530
529
  fn = fn.effect.fn;
531
530
  }
532
- const _effect = new ReactiveEffect(fn);
531
+ const _effect = new ReactiveEffect(fn, NOOP, () => {
532
+ if (_effect.dirty) {
533
+ _effect.run();
534
+ }
535
+ });
533
536
  if (options) {
534
537
  extend(_effect, options);
535
538
  if (options.scope)
@@ -546,6 +549,7 @@ function stop(runner) {
546
549
  runner.effect.stop();
547
550
  }
548
551
  let shouldTrack = true;
552
+ let pauseScheduleStack = 0;
549
553
  const trackStack = [];
550
554
  function pauseTracking() {
551
555
  trackStack.push(shouldTrack);
@@ -555,6 +559,60 @@ function resetTracking() {
555
559
  const last = trackStack.pop();
556
560
  shouldTrack = last === void 0 ? true : last;
557
561
  }
562
+ function pauseScheduling() {
563
+ pauseScheduleStack++;
564
+ }
565
+ function resetScheduling() {
566
+ pauseScheduleStack--;
567
+ while (!pauseScheduleStack && queueEffectSchedulers.length) {
568
+ queueEffectSchedulers.shift()();
569
+ }
570
+ }
571
+ function trackEffect(effect2, dep, debuggerEventExtraInfo) {
572
+ if (dep.get(effect2) !== effect2._trackId) {
573
+ dep.set(effect2, effect2._trackId);
574
+ const oldDep = effect2.deps[effect2._depsLength];
575
+ if (oldDep !== dep) {
576
+ if (oldDep) {
577
+ cleanupDepEffect(oldDep, effect2);
578
+ }
579
+ effect2.deps[effect2._depsLength++] = dep;
580
+ } else {
581
+ effect2._depsLength++;
582
+ }
583
+ }
584
+ }
585
+ const queueEffectSchedulers = [];
586
+ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
587
+ pauseScheduling();
588
+ for (const effect2 of dep.keys()) {
589
+ if (!effect2.allowRecurse && effect2._runnings) {
590
+ continue;
591
+ }
592
+ if (effect2._dirtyLevel < dirtyLevel && (!effect2._runnings || dirtyLevel !== 2)) {
593
+ const lastDirtyLevel = effect2._dirtyLevel;
594
+ effect2._dirtyLevel = dirtyLevel;
595
+ if (lastDirtyLevel === 0 && (!effect2._queryings || dirtyLevel !== 2)) {
596
+ effect2.trigger();
597
+ if (effect2.scheduler) {
598
+ queueEffectSchedulers.push(effect2.scheduler);
599
+ }
600
+ }
601
+ }
602
+ }
603
+ resetScheduling();
604
+ }
605
+
606
+ const createDep = (cleanup, computed) => {
607
+ const dep = /* @__PURE__ */ new Map();
608
+ dep.cleanup = cleanup;
609
+ dep.computed = computed;
610
+ return dep;
611
+ };
612
+
613
+ const targetMap = /* @__PURE__ */ new WeakMap();
614
+ const ITERATE_KEY = Symbol("");
615
+ const MAP_KEY_ITERATE_KEY = Symbol("");
558
616
  function track(target, type, key) {
559
617
  if (shouldTrack && activeEffect) {
560
618
  let depsMap = targetMap.get(target);
@@ -563,24 +621,11 @@ function track(target, type, key) {
563
621
  }
564
622
  let dep = depsMap.get(key);
565
623
  if (!dep) {
566
- depsMap.set(key, dep = createDep());
624
+ depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
567
625
  }
568
- trackEffects(dep);
569
- }
570
- }
571
- function trackEffects(dep, debuggerEventExtraInfo) {
572
- let shouldTrack2 = false;
573
- if (effectTrackDepth <= maxMarkerBits) {
574
- if (!newTracked(dep)) {
575
- dep.n |= trackOpBit;
576
- shouldTrack2 = !wasTracked(dep);
577
- }
578
- } else {
579
- shouldTrack2 = !dep.has(activeEffect);
580
- }
581
- if (shouldTrack2) {
582
- dep.add(activeEffect);
583
- activeEffect.deps.push(dep);
626
+ trackEffect(
627
+ activeEffect,
628
+ dep);
584
629
  }
585
630
  }
586
631
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
@@ -594,7 +639,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
594
639
  } else if (key === "length" && isArray(target)) {
595
640
  const newLength = Number(newValue);
596
641
  depsMap.forEach((dep, key2) => {
597
- if (key2 === "length" || key2 >= newLength) {
642
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
598
643
  deps.push(dep);
599
644
  }
600
645
  });
@@ -628,45 +673,15 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
628
673
  break;
629
674
  }
630
675
  }
631
- if (deps.length === 1) {
632
- if (deps[0]) {
633
- {
634
- triggerEffects(deps[0]);
635
- }
636
- }
637
- } else {
638
- const effects = [];
639
- for (const dep of deps) {
640
- if (dep) {
641
- effects.push(...dep);
642
- }
643
- }
644
- {
645
- triggerEffects(createDep(effects));
646
- }
647
- }
648
- }
649
- function triggerEffects(dep, debuggerEventExtraInfo) {
650
- const effects = isArray(dep) ? dep : [...dep];
651
- for (const effect2 of effects) {
652
- if (effect2.computed) {
653
- triggerEffect(effect2);
654
- }
655
- }
656
- for (const effect2 of effects) {
657
- if (!effect2.computed) {
658
- triggerEffect(effect2);
659
- }
660
- }
661
- }
662
- function triggerEffect(effect2, debuggerEventExtraInfo) {
663
- if (effect2 !== activeEffect || effect2.allowRecurse) {
664
- if (effect2.scheduler) {
665
- effect2.scheduler();
666
- } else {
667
- effect2.run();
676
+ pauseScheduling();
677
+ for (const dep of deps) {
678
+ if (dep) {
679
+ triggerEffects(
680
+ dep,
681
+ 3);
668
682
  }
669
683
  }
684
+ resetScheduling();
670
685
  }
671
686
  function getDepFromReactive(object, key) {
672
687
  var _a;
@@ -697,7 +712,9 @@ function createArrayInstrumentations() {
697
712
  ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
698
713
  instrumentations[key] = function(...args) {
699
714
  pauseTracking();
715
+ pauseScheduling();
700
716
  const res = toRaw(this)[key].apply(this, args);
717
+ resetScheduling();
701
718
  resetTracking();
702
719
  return res;
703
720
  };
@@ -1200,21 +1217,74 @@ function markRaw(value) {
1200
1217
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1201
1218
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1202
1219
 
1220
+ class ComputedRefImpl {
1221
+ constructor(getter, _setter, isReadonly, isSSR) {
1222
+ this._setter = _setter;
1223
+ this.dep = void 0;
1224
+ this.__v_isRef = true;
1225
+ this["__v_isReadonly"] = false;
1226
+ this.effect = new ReactiveEffect(getter, () => {
1227
+ triggerRefValue(this, 1);
1228
+ });
1229
+ this.effect.computed = this;
1230
+ this.effect.active = this._cacheable = !isSSR;
1231
+ this["__v_isReadonly"] = isReadonly;
1232
+ }
1233
+ get value() {
1234
+ const self = toRaw(this);
1235
+ trackRefValue(self);
1236
+ if (!self._cacheable || self.effect.dirty) {
1237
+ if (hasChanged(self._value, self._value = self.effect.run())) {
1238
+ triggerRefValue(self, 2);
1239
+ }
1240
+ }
1241
+ return self._value;
1242
+ }
1243
+ set value(newValue) {
1244
+ this._setter(newValue);
1245
+ }
1246
+ // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1247
+ get _dirty() {
1248
+ return this.effect.dirty;
1249
+ }
1250
+ set _dirty(v) {
1251
+ this.effect.dirty = v;
1252
+ }
1253
+ // #endregion
1254
+ }
1255
+ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1256
+ let getter;
1257
+ let setter;
1258
+ const onlyGetter = isFunction(getterOrOptions);
1259
+ if (onlyGetter) {
1260
+ getter = getterOrOptions;
1261
+ setter = NOOP;
1262
+ } else {
1263
+ getter = getterOrOptions.get;
1264
+ setter = getterOrOptions.set;
1265
+ }
1266
+ const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1267
+ return cRef;
1268
+ }
1269
+
1203
1270
  function trackRefValue(ref2) {
1204
1271
  if (shouldTrack && activeEffect) {
1205
1272
  ref2 = toRaw(ref2);
1206
- {
1207
- trackEffects(ref2.dep || (ref2.dep = createDep()));
1208
- }
1273
+ trackEffect(
1274
+ activeEffect,
1275
+ ref2.dep || (ref2.dep = createDep(
1276
+ () => ref2.dep = void 0,
1277
+ ref2 instanceof ComputedRefImpl ? ref2 : void 0
1278
+ )));
1209
1279
  }
1210
1280
  }
1211
- function triggerRefValue(ref2, newVal) {
1281
+ function triggerRefValue(ref2, dirtyLevel = 3, newVal) {
1212
1282
  ref2 = toRaw(ref2);
1213
1283
  const dep = ref2.dep;
1214
1284
  if (dep) {
1215
- {
1216
- triggerEffects(dep);
1217
- }
1285
+ triggerEffects(
1286
+ dep,
1287
+ dirtyLevel);
1218
1288
  }
1219
1289
  }
1220
1290
  function isRef(r) {
@@ -1250,12 +1320,12 @@ class RefImpl {
1250
1320
  if (hasChanged(newVal, this._rawValue)) {
1251
1321
  this._rawValue = newVal;
1252
1322
  this._value = useDirectValue ? newVal : toReactive(newVal);
1253
- triggerRefValue(this);
1323
+ triggerRefValue(this, 3);
1254
1324
  }
1255
1325
  }
1256
1326
  }
1257
1327
  function triggerRef(ref2) {
1258
- triggerRefValue(ref2);
1328
+ triggerRefValue(ref2, 3);
1259
1329
  }
1260
1330
  function unref(ref2) {
1261
1331
  return isRef(ref2) ? ref2.value : ref2;
@@ -1350,51 +1420,6 @@ function propertyToRef(source, key, defaultValue) {
1350
1420
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1351
1421
  }
1352
1422
 
1353
- class ComputedRefImpl {
1354
- constructor(getter, _setter, isReadonly, isSSR) {
1355
- this._setter = _setter;
1356
- this.dep = void 0;
1357
- this.__v_isRef = true;
1358
- this["__v_isReadonly"] = false;
1359
- this._dirty = true;
1360
- this.effect = new ReactiveEffect(getter, () => {
1361
- if (!this._dirty) {
1362
- this._dirty = true;
1363
- triggerRefValue(this);
1364
- }
1365
- });
1366
- this.effect.computed = this;
1367
- this.effect.active = this._cacheable = !isSSR;
1368
- this["__v_isReadonly"] = isReadonly;
1369
- }
1370
- get value() {
1371
- const self = toRaw(this);
1372
- trackRefValue(self);
1373
- if (self._dirty || !self._cacheable) {
1374
- self._dirty = false;
1375
- self._value = self.effect.run();
1376
- }
1377
- return self._value;
1378
- }
1379
- set value(newValue) {
1380
- this._setter(newValue);
1381
- }
1382
- }
1383
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1384
- let getter;
1385
- let setter;
1386
- const onlyGetter = isFunction(getterOrOptions);
1387
- if (onlyGetter) {
1388
- getter = getterOrOptions;
1389
- setter = NOOP;
1390
- } else {
1391
- getter = getterOrOptions.get;
1392
- setter = getterOrOptions.set;
1393
- }
1394
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1395
- return cRef;
1396
- }
1397
-
1398
1423
  function warn$1(msg, ...args) {
1399
1424
  return;
1400
1425
  }
@@ -1481,8 +1506,13 @@ function findInsertionIndex(id) {
1481
1506
  let end = queue.length;
1482
1507
  while (start < end) {
1483
1508
  const middle = start + end >>> 1;
1484
- const middleJobId = getId(queue[middle]);
1485
- middleJobId < id ? start = middle + 1 : end = middle;
1509
+ const middleJob = queue[middle];
1510
+ const middleJobId = getId(middleJob);
1511
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1512
+ start = middle + 1;
1513
+ } else {
1514
+ end = middle;
1515
+ }
1486
1516
  }
1487
1517
  return start;
1488
1518
  }
@@ -2435,14 +2465,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2435
2465
  parentComponent: parentComponent2,
2436
2466
  container: container2
2437
2467
  } = suspense;
2468
+ let delayEnter = false;
2438
2469
  if (suspense.isHydrating) {
2439
2470
  suspense.isHydrating = false;
2440
2471
  } else if (!resume) {
2441
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2472
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2442
2473
  if (delayEnter) {
2443
2474
  activeBranch.transition.afterLeave = () => {
2444
2475
  if (pendingId === suspense.pendingId) {
2445
2476
  move(pendingBranch, container2, anchor2, 0);
2477
+ queuePostFlushCb(effects);
2446
2478
  }
2447
2479
  };
2448
2480
  }
@@ -2468,7 +2500,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2468
2500
  }
2469
2501
  parent = parent.parent;
2470
2502
  }
2471
- if (!hasUnresolvedAncestor) {
2503
+ if (!hasUnresolvedAncestor && !delayEnter) {
2472
2504
  queuePostFlushCb(effects);
2473
2505
  }
2474
2506
  suspense.effects = [];
@@ -2740,8 +2772,15 @@ const INITIAL_WATCHER_VALUE = {};
2740
2772
  function watch(source, cb, options) {
2741
2773
  return doWatch(source, cb, options);
2742
2774
  }
2743
- function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
2775
+ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
2744
2776
  var _a;
2777
+ if (cb && once) {
2778
+ const _cb = cb;
2779
+ cb = (...args) => {
2780
+ _cb(...args);
2781
+ unwatch();
2782
+ };
2783
+ }
2745
2784
  const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
2746
2785
  let getter;
2747
2786
  let forceTrigger = false;
@@ -2827,7 +2866,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
2827
2866
  }
2828
2867
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2829
2868
  const job = () => {
2830
- if (!effect.active) {
2869
+ if (!effect.active || !effect.dirty) {
2831
2870
  return;
2832
2871
  }
2833
2872
  if (cb) {
@@ -2860,7 +2899,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
2860
2899
  job.id = instance.uid;
2861
2900
  scheduler = () => queueJob(job);
2862
2901
  }
2863
- const effect = new ReactiveEffect(getter, scheduler);
2902
+ const effect = new ReactiveEffect(getter, NOOP, scheduler);
2903
+ const unwatch = () => {
2904
+ effect.stop();
2905
+ if (instance && instance.scope) {
2906
+ remove(instance.scope.effects, effect);
2907
+ }
2908
+ };
2864
2909
  if (cb) {
2865
2910
  if (immediate) {
2866
2911
  job();
@@ -2875,12 +2920,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
2875
2920
  } else {
2876
2921
  effect.run();
2877
2922
  }
2878
- const unwatch = () => {
2879
- effect.stop();
2880
- if (instance && instance.scope) {
2881
- remove(instance.scope.effects, effect);
2882
- }
2883
- };
2884
2923
  if (ssrCleanup)
2885
2924
  ssrCleanup.push(unwatch);
2886
2925
  return unwatch;
@@ -3099,6 +3138,7 @@ const BaseTransitionImpl = {
3099
3138
  leavingHooks.afterLeave = () => {
3100
3139
  state.isLeaving = false;
3101
3140
  if (instance.update.active !== false) {
3141
+ instance.effect.dirty = true;
3102
3142
  instance.update();
3103
3143
  }
3104
3144
  };
@@ -3429,6 +3469,7 @@ function defineAsyncComponent(source) {
3429
3469
  load().then(() => {
3430
3470
  loaded.value = true;
3431
3471
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
3472
+ instance.parent.effect.dirty = true;
3432
3473
  queueJob(instance.parent.update);
3433
3474
  }
3434
3475
  }).catch((err) => {
@@ -4415,7 +4456,10 @@ const publicPropertiesMap = (
4415
4456
  $root: (i) => getPublicInstance(i.root),
4416
4457
  $emit: (i) => i.emit,
4417
4458
  $options: (i) => resolveMergedOptions(i) ,
4418
- $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
4459
+ $forceUpdate: (i) => i.f || (i.f = () => {
4460
+ i.effect.dirty = true;
4461
+ queueJob(i.update);
4462
+ }),
4419
4463
  $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
4420
4464
  $watch: (i) => instanceWatch.bind(i)
4421
4465
  })
@@ -5065,7 +5109,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5065
5109
  return vm;
5066
5110
  }
5067
5111
  }
5068
- Vue.version = `2.6.14-compat:${"3.3.6"}`;
5112
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
5069
5113
  Vue.config = singletonApp.config;
5070
5114
  Vue.use = (p, ...options) => {
5071
5115
  if (p && isFunction(p.install)) {
@@ -6118,7 +6162,14 @@ function createHydrationFunctions(rendererInternals) {
6118
6162
  break;
6119
6163
  case Comment:
6120
6164
  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6121
- nextNode = onMismatch();
6165
+ if (node.tagName.toLowerCase() === "template") {
6166
+ const content = vnode.el.content.firstChild;
6167
+ replaceNode(content, node, parentComponent);
6168
+ vnode.el = node = content;
6169
+ nextNode = nextSibling(node);
6170
+ } else {
6171
+ nextNode = onMismatch();
6172
+ }
6122
6173
  } else {
6123
6174
  nextNode = nextSibling(node);
6124
6175
  }
@@ -6160,7 +6211,7 @@ function createHydrationFunctions(rendererInternals) {
6160
6211
  break;
6161
6212
  default:
6162
6213
  if (shapeFlag & 1) {
6163
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
6214
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
6164
6215
  nextNode = onMismatch();
6165
6216
  } else {
6166
6217
  nextNode = hydrateElement(
@@ -6175,6 +6226,13 @@ function createHydrationFunctions(rendererInternals) {
6175
6226
  } else if (shapeFlag & 6) {
6176
6227
  vnode.slotScopeIds = slotScopeIds;
6177
6228
  const container = parentNode(node);
6229
+ if (isFragmentStart) {
6230
+ nextNode = locateClosingAnchor(node);
6231
+ } else if (isComment(node) && node.data === "teleport start") {
6232
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
6233
+ } else {
6234
+ nextNode = nextSibling(node);
6235
+ }
6178
6236
  mountComponent(
6179
6237
  vnode,
6180
6238
  container,
@@ -6184,10 +6242,6 @@ function createHydrationFunctions(rendererInternals) {
6184
6242
  isSVGContainer(container),
6185
6243
  optimized
6186
6244
  );
6187
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
6188
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
6189
- nextNode = nextSibling(nextNode);
6190
- }
6191
6245
  if (isAsyncWrapper(vnode)) {
6192
6246
  let subTree;
6193
6247
  if (isFragmentStart) {
@@ -6235,7 +6289,7 @@ function createHydrationFunctions(rendererInternals) {
6235
6289
  };
6236
6290
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6237
6291
  optimized = optimized || !!vnode.dynamicChildren;
6238
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
6292
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6239
6293
  const forcePatchValue = type === "input" && dirs || type === "option";
6240
6294
  if (forcePatchValue || patchFlag !== -1) {
6241
6295
  if (dirs) {
@@ -6272,12 +6326,23 @@ function createHydrationFunctions(rendererInternals) {
6272
6326
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6273
6327
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6274
6328
  }
6329
+ let needCallTransitionHooks = false;
6330
+ if (isTemplateNode(el)) {
6331
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6332
+ const content = el.content.firstChild;
6333
+ if (needCallTransitionHooks) {
6334
+ transition.beforeEnter(content);
6335
+ }
6336
+ replaceNode(content, el, parentComponent);
6337
+ vnode.el = el = content;
6338
+ }
6275
6339
  if (dirs) {
6276
6340
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6277
6341
  }
6278
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
6342
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
6279
6343
  queueEffectWithSuspense(() => {
6280
6344
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6345
+ needCallTransitionHooks && transition.enter(el);
6281
6346
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6282
6347
  }, parentSuspense);
6283
6348
  }
@@ -6367,7 +6432,7 @@ function createHydrationFunctions(rendererInternals) {
6367
6432
  hasMismatch = true;
6368
6433
  vnode.el = null;
6369
6434
  if (isFragment) {
6370
- const end = locateClosingAsyncAnchor(node);
6435
+ const end = locateClosingAnchor(node);
6371
6436
  while (true) {
6372
6437
  const next2 = nextSibling(node);
6373
6438
  if (next2 && next2 !== end) {
@@ -6392,14 +6457,14 @@ function createHydrationFunctions(rendererInternals) {
6392
6457
  );
6393
6458
  return next;
6394
6459
  };
6395
- const locateClosingAsyncAnchor = (node) => {
6460
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
6396
6461
  let match = 0;
6397
6462
  while (node) {
6398
6463
  node = nextSibling(node);
6399
6464
  if (node && isComment(node)) {
6400
- if (node.data === "[")
6465
+ if (node.data === open)
6401
6466
  match++;
6402
- if (node.data === "]") {
6467
+ if (node.data === close) {
6403
6468
  if (match === 0) {
6404
6469
  return nextSibling(node);
6405
6470
  } else {
@@ -6410,6 +6475,23 @@ function createHydrationFunctions(rendererInternals) {
6410
6475
  }
6411
6476
  return node;
6412
6477
  };
6478
+ const replaceNode = (newNode, oldNode, parentComponent) => {
6479
+ const parentNode2 = oldNode.parentNode;
6480
+ if (parentNode2) {
6481
+ parentNode2.replaceChild(newNode, oldNode);
6482
+ }
6483
+ let parent = parentComponent;
6484
+ while (parent) {
6485
+ if (parent.vnode.el === oldNode) {
6486
+ parent.vnode.el = newNode;
6487
+ parent.subTree.el = newNode;
6488
+ }
6489
+ parent = parent.parent;
6490
+ }
6491
+ };
6492
+ const isTemplateNode = (node) => {
6493
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
6494
+ };
6413
6495
  return [hydrate, hydrateNode];
6414
6496
  }
6415
6497
 
@@ -6665,7 +6747,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6665
6747
  if (dirs) {
6666
6748
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6667
6749
  }
6668
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6750
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
6669
6751
  if (needCallTransitionHooks) {
6670
6752
  transition.beforeEnter(el);
6671
6753
  }
@@ -7023,6 +7105,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7023
7105
  } else {
7024
7106
  instance.next = n2;
7025
7107
  invalidateJob(instance.update);
7108
+ instance.effect.dirty = true;
7026
7109
  instance.update();
7027
7110
  }
7028
7111
  } else {
@@ -7168,11 +7251,16 @@ function baseCreateRenderer(options, createHydrationFns) {
7168
7251
  };
7169
7252
  const effect = instance.effect = new ReactiveEffect(
7170
7253
  componentUpdateFn,
7254
+ NOOP,
7171
7255
  () => queueJob(update),
7172
7256
  instance.scope
7173
7257
  // track it in component's effect scope
7174
7258
  );
7175
- const update = instance.update = () => effect.run();
7259
+ const update = instance.update = () => {
7260
+ if (effect.dirty) {
7261
+ effect.run();
7262
+ }
7263
+ };
7176
7264
  update.id = instance.uid;
7177
7265
  toggleRecurse(instance, true);
7178
7266
  update();
@@ -7491,8 +7579,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7491
7579
  moveStaticNode(vnode, container, anchor);
7492
7580
  return;
7493
7581
  }
7494
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
7495
- if (needTransition) {
7582
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7583
+ if (needTransition2) {
7496
7584
  if (moveType === 0) {
7497
7585
  transition.beforeEnter(el);
7498
7586
  hostInsert(el, container, anchor);
@@ -7707,6 +7795,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7707
7795
  function toggleRecurse({ effect, update }, allowed) {
7708
7796
  effect.allowRecurse = update.allowRecurse = allowed;
7709
7797
  }
7798
+ function needTransition(parentSuspense, transition) {
7799
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
7800
+ }
7710
7801
  function traverseStaticChildren(n1, n2, shallow = false) {
7711
7802
  const ch1 = n1.children;
7712
7803
  const ch2 = n2.children;
@@ -8752,7 +8843,8 @@ function isMemoSame(cached, memo) {
8752
8843
  return true;
8753
8844
  }
8754
8845
 
8755
- const version = "3.3.6";
8846
+ const version = "3.4.0-alpha.1";
8847
+ const ErrorTypeStrings = null;
8756
8848
  const _ssrUtils = {
8757
8849
  createComponentInstance,
8758
8850
  setupComponent,
@@ -10269,6 +10361,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10269
10361
  BaseTransitionPropsValidators: BaseTransitionPropsValidators,
10270
10362
  Comment: Comment,
10271
10363
  EffectScope: EffectScope,
10364
+ ErrorTypeStrings: ErrorTypeStrings,
10272
10365
  Fragment: Fragment,
10273
10366
  KeepAlive: KeepAlive,
10274
10367
  ReactiveEffect: ReactiveEffect,
@@ -11811,9 +11904,13 @@ function walk(node, context, doNotHoistNode = false) {
11811
11904
  context.transformHoist(children, context, node);
11812
11905
  }
11813
11906
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
11814
- node.codegenNode.children = context.hoist(
11907
+ const hoisted = context.hoist(
11815
11908
  createArrayExpression(node.codegenNode.children)
11816
11909
  );
11910
+ if (context.hmr) {
11911
+ hoisted.content = `[...${hoisted.content}]`;
11912
+ }
11913
+ node.codegenNode.children = hoisted;
11817
11914
  }
11818
11915
  }
11819
11916
  function getConstantType(node, context) {
@@ -11986,6 +12083,7 @@ function createTransformContext(root, {
11986
12083
  filename = "",
11987
12084
  prefixIdentifiers = false,
11988
12085
  hoistStatic: hoistStatic2 = false,
12086
+ hmr = false,
11989
12087
  cacheHandlers = false,
11990
12088
  nodeTransforms = [],
11991
12089
  directiveTransforms = {},
@@ -12011,6 +12109,7 @@ function createTransformContext(root, {
12011
12109
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
12012
12110
  prefixIdentifiers,
12013
12111
  hoistStatic: hoistStatic2,
12112
+ hmr,
12014
12113
  cacheHandlers,
12015
12114
  nodeTransforms,
12016
12115
  directiveTransforms,
@@ -14013,7 +14112,7 @@ const trackVForSlotScopes = (node, context) => {
14013
14112
  }
14014
14113
  }
14015
14114
  };
14016
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
14115
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
14017
14116
  props,
14018
14117
  children,
14019
14118
  false,
@@ -14038,7 +14137,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14038
14137
  slotsProperties.push(
14039
14138
  createObjectProperty(
14040
14139
  arg || createSimpleExpression("default", true),
14041
- buildSlotFn(exp, children, loc)
14140
+ buildSlotFn(exp, void 0, children, loc)
14042
14141
  )
14043
14142
  );
14044
14143
  }
@@ -14075,10 +14174,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14075
14174
  } else {
14076
14175
  hasDynamicSlots = true;
14077
14176
  }
14078
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
14177
+ const vFor = findDir(slotElement, "for");
14178
+ const slotFunction = buildSlotFn(
14179
+ slotProps,
14180
+ vFor == null ? void 0 : vFor.exp,
14181
+ slotChildren,
14182
+ slotLoc
14183
+ );
14079
14184
  let vIf;
14080
14185
  let vElse;
14081
- let vFor;
14082
14186
  if (vIf = findDir(slotElement, "if")) {
14083
14187
  hasDynamicSlots = true;
14084
14188
  dynamicSlots.push(
@@ -14123,7 +14227,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14123
14227
  createCompilerError(30, vElse.loc)
14124
14228
  );
14125
14229
  }
14126
- } else if (vFor = findDir(slotElement, "for")) {
14230
+ } else if (vFor) {
14127
14231
  hasDynamicSlots = true;
14128
14232
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
14129
14233
  if (parseResult) {
@@ -14164,7 +14268,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14164
14268
  }
14165
14269
  if (!onComponentSlot) {
14166
14270
  const buildDefaultSlotProperty = (props, children2) => {
14167
- const fn = buildSlotFn(props, children2, loc);
14271
+ const fn = buildSlotFn(props, void 0, children2, loc);
14168
14272
  if (context.compatConfig) {
14169
14273
  fn.isNonScopedSlot = true;
14170
14274
  }