@vue/compat 3.4.26 → 3.5.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.26
2
+ * @vue/compat v3.5.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -84,11 +84,10 @@ var Vue = (function () {
84
84
  fns[i](arg);
85
85
  }
86
86
  };
87
- const def = (obj, key, value, writable = false) => {
87
+ const def = (obj, key, value) => {
88
88
  Object.defineProperty(obj, key, {
89
89
  configurable: true,
90
90
  enumerable: false,
91
- writable,
92
91
  value
93
92
  });
94
93
  };
@@ -388,156 +387,280 @@ var Vue = (function () {
388
387
  function effectScope(detached) {
389
388
  return new EffectScope(detached);
390
389
  }
391
- function recordEffectScope(effect, scope = activeEffectScope) {
392
- if (scope && scope.active) {
393
- scope.effects.push(effect);
394
- }
395
- }
396
390
  function getCurrentScope() {
397
391
  return activeEffectScope;
398
392
  }
399
- function onScopeDispose(fn) {
393
+ function onScopeDispose(fn, failSilently = false) {
400
394
  if (activeEffectScope) {
401
395
  activeEffectScope.cleanups.push(fn);
402
- } else {
396
+ } else if (!failSilently) {
403
397
  warn$2(
404
398
  `onScopeDispose() is called when there is no active effect scope to be associated with.`
405
399
  );
406
400
  }
407
401
  }
408
402
 
409
- let activeEffect;
403
+ let activeSub;
410
404
  class ReactiveEffect {
411
- constructor(fn, trigger, scheduler, scope) {
405
+ constructor(fn) {
412
406
  this.fn = fn;
413
- this.trigger = trigger;
414
- this.scheduler = scheduler;
415
- this.active = true;
416
- this.deps = [];
417
407
  /**
418
408
  * @internal
419
409
  */
420
- this._dirtyLevel = 4;
410
+ this.deps = void 0;
421
411
  /**
422
412
  * @internal
423
413
  */
424
- this._trackId = 0;
414
+ this.depsTail = void 0;
425
415
  /**
426
416
  * @internal
427
417
  */
428
- this._runnings = 0;
418
+ this.flags = 1 | 4;
429
419
  /**
430
420
  * @internal
431
421
  */
432
- this._shouldSchedule = false;
422
+ this.nextEffect = void 0;
433
423
  /**
434
424
  * @internal
435
425
  */
436
- this._depsLength = 0;
437
- recordEffectScope(this, scope);
438
- }
439
- get dirty() {
440
- if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
441
- this._dirtyLevel = 1;
442
- pauseTracking();
443
- for (let i = 0; i < this._depsLength; i++) {
444
- const dep = this.deps[i];
445
- if (dep.computed) {
446
- triggerComputed(dep.computed);
447
- if (this._dirtyLevel >= 4) {
448
- break;
449
- }
450
- }
451
- }
452
- if (this._dirtyLevel === 1) {
453
- this._dirtyLevel = 0;
454
- }
455
- resetTracking();
426
+ this.cleanup = void 0;
427
+ this.scheduler = void 0;
428
+ if (activeEffectScope && activeEffectScope.active) {
429
+ activeEffectScope.effects.push(this);
456
430
  }
457
- return this._dirtyLevel >= 4;
458
431
  }
459
- set dirty(v) {
460
- this._dirtyLevel = v ? 4 : 0;
432
+ /**
433
+ * @internal
434
+ */
435
+ notify() {
436
+ if (this.flags & 2 && !(this.flags & 32)) {
437
+ return;
438
+ }
439
+ if (this.flags & 64) {
440
+ return this.trigger();
441
+ }
442
+ if (!(this.flags & 8)) {
443
+ this.flags |= 8;
444
+ this.nextEffect = batchedEffect;
445
+ batchedEffect = this;
446
+ }
461
447
  }
462
448
  run() {
463
- this._dirtyLevel = 0;
464
- if (!this.active) {
449
+ if (!(this.flags & 1)) {
465
450
  return this.fn();
466
451
  }
467
- let lastShouldTrack = shouldTrack;
468
- let lastEffect = activeEffect;
452
+ this.flags |= 2;
453
+ cleanupEffect(this);
454
+ prepareDeps(this);
455
+ const prevEffect = activeSub;
456
+ const prevShouldTrack = shouldTrack;
457
+ activeSub = this;
458
+ shouldTrack = true;
469
459
  try {
470
- shouldTrack = true;
471
- activeEffect = this;
472
- this._runnings++;
473
- preCleanupEffect(this);
474
460
  return this.fn();
475
461
  } finally {
476
- postCleanupEffect(this);
477
- this._runnings--;
478
- activeEffect = lastEffect;
479
- shouldTrack = lastShouldTrack;
462
+ if (activeSub !== this) {
463
+ warn$2(
464
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
465
+ );
466
+ }
467
+ cleanupDeps(this);
468
+ activeSub = prevEffect;
469
+ shouldTrack = prevShouldTrack;
470
+ this.flags &= ~2;
480
471
  }
481
472
  }
482
473
  stop() {
483
- if (this.active) {
484
- preCleanupEffect(this);
485
- postCleanupEffect(this);
474
+ if (this.flags & 1) {
475
+ for (let link = this.deps; link; link = link.nextDep) {
476
+ removeSub(link);
477
+ }
478
+ this.deps = this.depsTail = void 0;
479
+ cleanupEffect(this);
486
480
  this.onStop && this.onStop();
487
- this.active = false;
481
+ this.flags &= ~1;
482
+ }
483
+ }
484
+ trigger() {
485
+ if (this.scheduler) {
486
+ this.scheduler();
487
+ } else {
488
+ this.runIfDirty();
489
+ }
490
+ }
491
+ /**
492
+ * @internal
493
+ */
494
+ runIfDirty() {
495
+ if (isDirty(this)) {
496
+ this.run();
488
497
  }
489
498
  }
499
+ get dirty() {
500
+ return isDirty(this);
501
+ }
502
+ }
503
+ let batchDepth = 0;
504
+ let batchedEffect;
505
+ function startBatch() {
506
+ batchDepth++;
490
507
  }
491
- function triggerComputed(computed) {
492
- return computed.value;
508
+ function endBatch() {
509
+ if (batchDepth > 1) {
510
+ batchDepth--;
511
+ return;
512
+ }
513
+ let error;
514
+ while (batchedEffect) {
515
+ let e = batchedEffect;
516
+ batchedEffect = void 0;
517
+ while (e) {
518
+ const next = e.nextEffect;
519
+ e.nextEffect = void 0;
520
+ e.flags &= ~8;
521
+ if (e.flags & 1) {
522
+ try {
523
+ e.trigger();
524
+ } catch (err) {
525
+ if (!error)
526
+ error = err;
527
+ }
528
+ }
529
+ e = next;
530
+ }
531
+ }
532
+ batchDepth--;
533
+ if (error)
534
+ throw error;
493
535
  }
494
- function preCleanupEffect(effect2) {
495
- effect2._trackId++;
496
- effect2._depsLength = 0;
536
+ function prepareDeps(sub) {
537
+ for (let link = sub.deps; link; link = link.nextDep) {
538
+ link.version = -1;
539
+ link.prevActiveLink = link.dep.activeLink;
540
+ link.dep.activeLink = link;
541
+ }
497
542
  }
498
- function postCleanupEffect(effect2) {
499
- if (effect2.deps.length > effect2._depsLength) {
500
- for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
501
- cleanupDepEffect(effect2.deps[i], effect2);
543
+ function cleanupDeps(sub) {
544
+ let head;
545
+ let tail = sub.depsTail;
546
+ for (let link = tail; link; link = link.prevDep) {
547
+ if (link.version === -1) {
548
+ if (link === tail)
549
+ tail = link.prevDep;
550
+ removeSub(link);
551
+ removeDep(link);
552
+ } else {
553
+ head = link;
502
554
  }
503
- effect2.deps.length = effect2._depsLength;
555
+ link.dep.activeLink = link.prevActiveLink;
556
+ link.prevActiveLink = void 0;
504
557
  }
558
+ sub.deps = head;
559
+ sub.depsTail = tail;
505
560
  }
506
- function cleanupDepEffect(dep, effect2) {
507
- const trackId = dep.get(effect2);
508
- if (trackId !== void 0 && effect2._trackId !== trackId) {
509
- dep.delete(effect2);
510
- if (dep.size === 0) {
511
- dep.cleanup();
561
+ function isDirty(sub) {
562
+ for (let link = sub.deps; link; link = link.nextDep) {
563
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
564
+ return true;
512
565
  }
513
566
  }
567
+ if (sub._dirty) {
568
+ return true;
569
+ }
570
+ return false;
571
+ }
572
+ function refreshComputed(computed) {
573
+ if (computed.flags & 2) {
574
+ return false;
575
+ }
576
+ if (computed.flags & 4 && !(computed.flags & 16)) {
577
+ return;
578
+ }
579
+ computed.flags &= ~16;
580
+ if (computed.globalVersion === globalVersion) {
581
+ return;
582
+ }
583
+ computed.globalVersion = globalVersion;
584
+ const dep = computed.dep;
585
+ computed.flags |= 2;
586
+ if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
587
+ computed.flags &= ~2;
588
+ return;
589
+ }
590
+ const prevSub = activeSub;
591
+ const prevShouldTrack = shouldTrack;
592
+ activeSub = computed;
593
+ shouldTrack = true;
594
+ try {
595
+ prepareDeps(computed);
596
+ const value = computed.fn();
597
+ if (dep.version === 0 || hasChanged(value, computed._value)) {
598
+ computed._value = value;
599
+ dep.version++;
600
+ }
601
+ } catch (err) {
602
+ dep.version++;
603
+ throw err;
604
+ } finally {
605
+ activeSub = prevSub;
606
+ shouldTrack = prevShouldTrack;
607
+ cleanupDeps(computed);
608
+ computed.flags &= ~2;
609
+ }
610
+ }
611
+ function removeSub(link) {
612
+ const { dep, prevSub, nextSub } = link;
613
+ if (prevSub) {
614
+ prevSub.nextSub = nextSub;
615
+ link.prevSub = void 0;
616
+ }
617
+ if (nextSub) {
618
+ nextSub.prevSub = prevSub;
619
+ link.nextSub = void 0;
620
+ }
621
+ if (dep.subs === link) {
622
+ dep.subs = prevSub;
623
+ }
624
+ if (!dep.subs && dep.computed) {
625
+ dep.computed.flags &= ~4;
626
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
627
+ removeSub(l);
628
+ }
629
+ }
630
+ }
631
+ function removeDep(link) {
632
+ const { prevDep, nextDep } = link;
633
+ if (prevDep) {
634
+ prevDep.nextDep = nextDep;
635
+ link.prevDep = void 0;
636
+ }
637
+ if (nextDep) {
638
+ nextDep.prevDep = prevDep;
639
+ link.nextDep = void 0;
640
+ }
514
641
  }
515
642
  function effect(fn, options) {
516
643
  if (fn.effect instanceof ReactiveEffect) {
517
644
  fn = fn.effect.fn;
518
645
  }
519
- const _effect = new ReactiveEffect(fn, NOOP, () => {
520
- if (_effect.dirty) {
521
- _effect.run();
522
- }
523
- });
646
+ const e = new ReactiveEffect(fn);
524
647
  if (options) {
525
- extend(_effect, options);
526
- if (options.scope)
527
- recordEffectScope(_effect, options.scope);
648
+ extend(e, options);
528
649
  }
529
- if (!options || !options.lazy) {
530
- _effect.run();
650
+ try {
651
+ e.run();
652
+ } catch (err) {
653
+ e.stop();
654
+ throw err;
531
655
  }
532
- const runner = _effect.run.bind(_effect);
533
- runner.effect = _effect;
656
+ const runner = e.run.bind(e);
657
+ runner.effect = e;
534
658
  return runner;
535
659
  }
536
660
  function stop(runner) {
537
661
  runner.effect.stop();
538
662
  }
539
663
  let shouldTrack = true;
540
- let pauseScheduleStack = 0;
541
664
  const trackStack = [];
542
665
  function pauseTracking() {
543
666
  trackStack.push(shouldTrack);
@@ -547,192 +670,414 @@ var Vue = (function () {
547
670
  const last = trackStack.pop();
548
671
  shouldTrack = last === void 0 ? true : last;
549
672
  }
550
- function pauseScheduling() {
551
- pauseScheduleStack++;
552
- }
553
- function resetScheduling() {
554
- pauseScheduleStack--;
555
- while (!pauseScheduleStack && queueEffectSchedulers.length) {
556
- queueEffectSchedulers.shift()();
673
+ function cleanupEffect(e) {
674
+ const { cleanup } = e;
675
+ e.cleanup = void 0;
676
+ if (cleanup) {
677
+ const prevSub = activeSub;
678
+ activeSub = void 0;
679
+ try {
680
+ cleanup();
681
+ } finally {
682
+ activeSub = prevSub;
683
+ }
557
684
  }
558
685
  }
559
- function trackEffect(effect2, dep, debuggerEventExtraInfo) {
560
- var _a;
561
- if (dep.get(effect2) !== effect2._trackId) {
562
- dep.set(effect2, effect2._trackId);
563
- const oldDep = effect2.deps[effect2._depsLength];
564
- if (oldDep !== dep) {
565
- if (oldDep) {
566
- cleanupDepEffect(oldDep, effect2);
567
- }
568
- effect2.deps[effect2._depsLength++] = dep;
569
- } else {
570
- effect2._depsLength++;
571
- }
686
+
687
+ let globalVersion = 0;
688
+ class Dep {
689
+ constructor(computed) {
690
+ this.computed = computed;
691
+ this.version = 0;
692
+ /**
693
+ * Link between this dep and the current active effect
694
+ */
695
+ this.activeLink = void 0;
696
+ /**
697
+ * Doubly linked list representing the subscribing effects (tail)
698
+ */
699
+ this.subs = void 0;
572
700
  {
573
- (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
701
+ this.subsHead = void 0;
574
702
  }
575
703
  }
576
- }
577
- const queueEffectSchedulers = [];
578
- function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
579
- var _a;
580
- pauseScheduling();
581
- for (const effect2 of dep.keys()) {
582
- let tracking;
583
- if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
584
- effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
585
- effect2._dirtyLevel = dirtyLevel;
586
- }
587
- if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
588
- {
589
- (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
704
+ track(debugInfo) {
705
+ if (!activeSub || !shouldTrack) {
706
+ return;
707
+ }
708
+ let link = this.activeLink;
709
+ if (link === void 0 || link.sub !== activeSub) {
710
+ link = this.activeLink = {
711
+ dep: this,
712
+ sub: activeSub,
713
+ version: this.version,
714
+ nextDep: void 0,
715
+ prevDep: void 0,
716
+ nextSub: void 0,
717
+ prevSub: void 0,
718
+ prevActiveLink: void 0
719
+ };
720
+ if (!activeSub.deps) {
721
+ activeSub.deps = activeSub.depsTail = link;
722
+ } else {
723
+ link.prevDep = activeSub.depsTail;
724
+ activeSub.depsTail.nextDep = link;
725
+ activeSub.depsTail = link;
726
+ }
727
+ if (activeSub.flags & 4) {
728
+ addSub(link);
590
729
  }
591
- effect2.trigger();
592
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
593
- effect2._shouldSchedule = false;
594
- if (effect2.scheduler) {
595
- queueEffectSchedulers.push(effect2.scheduler);
730
+ } else if (link.version === -1) {
731
+ link.version = this.version;
732
+ if (link.nextDep) {
733
+ const next = link.nextDep;
734
+ next.prevDep = link.prevDep;
735
+ if (link.prevDep) {
736
+ link.prevDep.nextDep = next;
737
+ }
738
+ link.prevDep = activeSub.depsTail;
739
+ link.nextDep = void 0;
740
+ activeSub.depsTail.nextDep = link;
741
+ activeSub.depsTail = link;
742
+ if (activeSub.deps === link) {
743
+ activeSub.deps = next;
596
744
  }
597
745
  }
598
746
  }
747
+ if (activeSub.onTrack) {
748
+ activeSub.onTrack(
749
+ extend(
750
+ {
751
+ effect: activeSub
752
+ },
753
+ debugInfo
754
+ )
755
+ );
756
+ }
757
+ return link;
758
+ }
759
+ trigger(debugInfo) {
760
+ this.version++;
761
+ globalVersion++;
762
+ this.notify(debugInfo);
763
+ }
764
+ notify(debugInfo) {
765
+ startBatch();
766
+ try {
767
+ if (true) {
768
+ for (let head = this.subsHead; head; head = head.nextSub) {
769
+ if (head.sub.onTrigger && !(head.sub.flags & 8)) {
770
+ head.sub.onTrigger(
771
+ extend(
772
+ {
773
+ effect: head.sub
774
+ },
775
+ debugInfo
776
+ )
777
+ );
778
+ }
779
+ }
780
+ }
781
+ for (let link = this.subs; link; link = link.prevSub) {
782
+ link.sub.notify();
783
+ }
784
+ } finally {
785
+ endBatch();
786
+ }
599
787
  }
600
- resetScheduling();
601
788
  }
602
-
603
- const createDep = (cleanup, computed) => {
604
- const dep = /* @__PURE__ */ new Map();
605
- dep.cleanup = cleanup;
606
- dep.computed = computed;
607
- return dep;
608
- };
609
-
789
+ function addSub(link) {
790
+ const computed = link.dep.computed;
791
+ if (computed && !link.dep.subs) {
792
+ computed.flags |= 4 | 16;
793
+ for (let l = computed.deps; l; l = l.nextDep) {
794
+ addSub(l);
795
+ }
796
+ }
797
+ const currentTail = link.dep.subs;
798
+ if (currentTail !== link) {
799
+ link.prevSub = currentTail;
800
+ if (currentTail)
801
+ currentTail.nextSub = link;
802
+ }
803
+ if (link.dep.subsHead === void 0) {
804
+ link.dep.subsHead = link;
805
+ }
806
+ link.dep.subs = link;
807
+ }
610
808
  const targetMap = /* @__PURE__ */ new WeakMap();
611
- const ITERATE_KEY = Symbol("iterate" );
612
- const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
809
+ const ITERATE_KEY = Symbol("Object iterate" );
810
+ const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
811
+ const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
613
812
  function track(target, type, key) {
614
- if (shouldTrack && activeEffect) {
813
+ if (shouldTrack && activeSub) {
615
814
  let depsMap = targetMap.get(target);
616
815
  if (!depsMap) {
617
816
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
618
817
  }
619
818
  let dep = depsMap.get(key);
620
819
  if (!dep) {
621
- depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
820
+ depsMap.set(key, dep = new Dep());
622
821
  }
623
- trackEffect(
624
- activeEffect,
625
- dep,
626
- {
822
+ {
823
+ dep.track({
627
824
  target,
628
825
  type,
629
826
  key
630
- }
631
- );
827
+ });
828
+ }
632
829
  }
633
830
  }
634
831
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
635
832
  const depsMap = targetMap.get(target);
636
833
  if (!depsMap) {
834
+ globalVersion++;
637
835
  return;
638
836
  }
639
837
  let deps = [];
640
838
  if (type === "clear") {
641
839
  deps = [...depsMap.values()];
642
- } else if (key === "length" && isArray(target)) {
643
- const newLength = Number(newValue);
644
- depsMap.forEach((dep, key2) => {
645
- if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
646
- deps.push(dep);
647
- }
648
- });
649
840
  } else {
650
- if (key !== void 0) {
651
- deps.push(depsMap.get(key));
652
- }
653
- switch (type) {
654
- case "add":
655
- if (!isArray(target)) {
656
- deps.push(depsMap.get(ITERATE_KEY));
657
- if (isMap(target)) {
658
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
659
- }
660
- } else if (isIntegerKey(key)) {
661
- deps.push(depsMap.get("length"));
841
+ const targetIsArray = isArray(target);
842
+ const isArrayIndex = targetIsArray && isIntegerKey(key);
843
+ if (targetIsArray && key === "length") {
844
+ const newLength = Number(newValue);
845
+ depsMap.forEach((dep, key2) => {
846
+ if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
847
+ deps.push(dep);
662
848
  }
663
- break;
664
- case "delete":
665
- if (!isArray(target)) {
666
- deps.push(depsMap.get(ITERATE_KEY));
849
+ });
850
+ } else {
851
+ const push = (dep) => dep && deps.push(dep);
852
+ if (key !== void 0) {
853
+ push(depsMap.get(key));
854
+ }
855
+ if (isArrayIndex) {
856
+ push(depsMap.get(ARRAY_ITERATE_KEY));
857
+ }
858
+ switch (type) {
859
+ case "add":
860
+ if (!targetIsArray) {
861
+ push(depsMap.get(ITERATE_KEY));
862
+ if (isMap(target)) {
863
+ push(depsMap.get(MAP_KEY_ITERATE_KEY));
864
+ }
865
+ } else if (isArrayIndex) {
866
+ push(depsMap.get("length"));
867
+ }
868
+ break;
869
+ case "delete":
870
+ if (!targetIsArray) {
871
+ push(depsMap.get(ITERATE_KEY));
872
+ if (isMap(target)) {
873
+ push(depsMap.get(MAP_KEY_ITERATE_KEY));
874
+ }
875
+ }
876
+ break;
877
+ case "set":
667
878
  if (isMap(target)) {
668
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
879
+ push(depsMap.get(ITERATE_KEY));
669
880
  }
670
- }
671
- break;
672
- case "set":
673
- if (isMap(target)) {
674
- deps.push(depsMap.get(ITERATE_KEY));
675
- }
676
- break;
881
+ break;
882
+ }
677
883
  }
678
884
  }
679
- pauseScheduling();
885
+ startBatch();
680
886
  for (const dep of deps) {
681
- if (dep) {
682
- triggerEffects(
683
- dep,
684
- 4,
685
- {
686
- target,
687
- type,
688
- key,
689
- newValue,
690
- oldValue,
691
- oldTarget
692
- }
693
- );
887
+ {
888
+ dep.trigger({
889
+ target,
890
+ type,
891
+ key,
892
+ newValue,
893
+ oldValue,
894
+ oldTarget
895
+ });
694
896
  }
695
897
  }
696
- resetScheduling();
898
+ endBatch();
697
899
  }
698
900
  function getDepFromReactive(object, key) {
699
- const depsMap = targetMap.get(object);
700
- return depsMap && depsMap.get(key);
901
+ var _a;
902
+ return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
903
+ }
904
+
905
+ function reactiveReadArray(array) {
906
+ const raw = toRaw(array);
907
+ if (raw === array)
908
+ return raw;
909
+ track(raw, "iterate", ARRAY_ITERATE_KEY);
910
+ return isShallow(array) ? raw : raw.map(toReactive);
911
+ }
912
+ function shallowReadArray(arr) {
913
+ track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
914
+ return arr;
915
+ }
916
+ const arrayInstrumentations = {
917
+ __proto__: null,
918
+ [Symbol.iterator]() {
919
+ return iterator(this, Symbol.iterator, toReactive);
920
+ },
921
+ concat(...args) {
922
+ return reactiveReadArray(this).concat(
923
+ ...args.map((x) => reactiveReadArray(x))
924
+ );
925
+ },
926
+ entries() {
927
+ return iterator(this, "entries", (value) => {
928
+ value[1] = toReactive(value[1]);
929
+ return value;
930
+ });
931
+ },
932
+ every(fn, thisArg) {
933
+ return apply(this, "every", fn, thisArg);
934
+ },
935
+ filter(fn, thisArg) {
936
+ const result = apply(this, "filter", fn, thisArg);
937
+ return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
938
+ },
939
+ find(fn, thisArg) {
940
+ const result = apply(this, "find", fn, thisArg);
941
+ return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
942
+ },
943
+ findIndex(fn, thisArg) {
944
+ return apply(this, "findIndex", fn, thisArg);
945
+ },
946
+ findLast(fn, thisArg) {
947
+ const result = apply(this, "findLast", fn, thisArg);
948
+ return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
949
+ },
950
+ findLastIndex(fn, thisArg) {
951
+ return apply(this, "findLastIndex", fn, thisArg);
952
+ },
953
+ // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
954
+ forEach(fn, thisArg) {
955
+ return apply(this, "forEach", fn, thisArg);
956
+ },
957
+ includes(...args) {
958
+ return searchProxy(this, "includes", args);
959
+ },
960
+ indexOf(...args) {
961
+ return searchProxy(this, "indexOf", args);
962
+ },
963
+ join(separator) {
964
+ return reactiveReadArray(this).join(separator);
965
+ },
966
+ // keys() iterator only reads `length`, no optimisation required
967
+ lastIndexOf(...args) {
968
+ return searchProxy(this, "lastIndexOf", args);
969
+ },
970
+ map(fn, thisArg) {
971
+ return apply(this, "map", fn, thisArg);
972
+ },
973
+ pop() {
974
+ return noTracking(this, "pop");
975
+ },
976
+ push(...args) {
977
+ return noTracking(this, "push", args);
978
+ },
979
+ reduce(fn, ...args) {
980
+ return reduce(this, "reduce", fn, args);
981
+ },
982
+ reduceRight(fn, ...args) {
983
+ return reduce(this, "reduceRight", fn, args);
984
+ },
985
+ shift() {
986
+ return noTracking(this, "shift");
987
+ },
988
+ // slice could use ARRAY_ITERATE but also seems to beg for range tracking
989
+ some(fn, thisArg) {
990
+ return apply(this, "some", fn, thisArg);
991
+ },
992
+ splice(...args) {
993
+ return noTracking(this, "splice", args);
994
+ },
995
+ toReversed() {
996
+ return reactiveReadArray(this).toReversed();
997
+ },
998
+ toSorted(comparer) {
999
+ return reactiveReadArray(this).toSorted(comparer);
1000
+ },
1001
+ toSpliced(...args) {
1002
+ return reactiveReadArray(this).toSpliced(...args);
1003
+ },
1004
+ unshift(...args) {
1005
+ return noTracking(this, "unshift", args);
1006
+ },
1007
+ values() {
1008
+ return iterator(this, "values", toReactive);
1009
+ }
1010
+ };
1011
+ function iterator(self, method, wrapValue) {
1012
+ const arr = shallowReadArray(self);
1013
+ const iter = arr[method]();
1014
+ if (arr !== self && !isShallow(self)) {
1015
+ iter._next = iter.next;
1016
+ iter.next = () => {
1017
+ const result = iter._next();
1018
+ if (result.value) {
1019
+ result.value = wrapValue(result.value);
1020
+ }
1021
+ return result;
1022
+ };
1023
+ }
1024
+ return iter;
1025
+ }
1026
+ function apply(self, method, fn, thisArg) {
1027
+ const arr = shallowReadArray(self);
1028
+ let wrappedFn = fn;
1029
+ if (arr !== self) {
1030
+ if (!isShallow(self)) {
1031
+ wrappedFn = function(item, index) {
1032
+ return fn.call(this, toReactive(item), index, self);
1033
+ };
1034
+ } else if (fn.length > 2) {
1035
+ wrappedFn = function(item, index) {
1036
+ return fn.call(this, item, index, self);
1037
+ };
1038
+ }
1039
+ }
1040
+ return arr[method](wrappedFn, thisArg);
1041
+ }
1042
+ function reduce(self, method, fn, args) {
1043
+ const arr = shallowReadArray(self);
1044
+ let wrappedFn = fn;
1045
+ if (arr !== self) {
1046
+ if (!isShallow(self)) {
1047
+ wrappedFn = function(acc, item, index) {
1048
+ return fn.call(this, acc, toReactive(item), index, self);
1049
+ };
1050
+ } else if (fn.length > 3) {
1051
+ wrappedFn = function(acc, item, index) {
1052
+ return fn.call(this, acc, item, index, self);
1053
+ };
1054
+ }
1055
+ }
1056
+ return arr[method](wrappedFn, ...args);
1057
+ }
1058
+ function searchProxy(self, method, args) {
1059
+ const arr = toRaw(self);
1060
+ track(arr, "iterate", ARRAY_ITERATE_KEY);
1061
+ const res = arr[method](...args);
1062
+ if ((res === -1 || res === false) && isProxy(args[0])) {
1063
+ args[0] = toRaw(args[0]);
1064
+ return arr[method](...args);
1065
+ }
1066
+ return res;
1067
+ }
1068
+ function noTracking(self, method, args = []) {
1069
+ pauseTracking();
1070
+ startBatch();
1071
+ const res = toRaw(self)[method].apply(self, args);
1072
+ endBatch();
1073
+ resetTracking();
1074
+ return res;
701
1075
  }
702
1076
 
703
1077
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
704
1078
  const builtInSymbols = new Set(
705
1079
  /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
706
1080
  );
707
- const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
708
- function createArrayInstrumentations() {
709
- const instrumentations = {};
710
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
711
- instrumentations[key] = function(...args) {
712
- const arr = toRaw(this);
713
- for (let i = 0, l = this.length; i < l; i++) {
714
- track(arr, "get", i + "");
715
- }
716
- const res = arr[key](...args);
717
- if (res === -1 || res === false) {
718
- return arr[key](...args.map(toRaw));
719
- } else {
720
- return res;
721
- }
722
- };
723
- });
724
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
725
- instrumentations[key] = function(...args) {
726
- pauseTracking();
727
- pauseScheduling();
728
- const res = toRaw(this)[key].apply(this, args);
729
- resetScheduling();
730
- resetTracking();
731
- return res;
732
- };
733
- });
734
- return instrumentations;
735
- }
736
1081
  function hasOwnProperty(key) {
737
1082
  if (!isSymbol(key))
738
1083
  key = String(key);
@@ -763,14 +1108,22 @@ var Vue = (function () {
763
1108
  }
764
1109
  const targetIsArray = isArray(target);
765
1110
  if (!isReadonly2) {
766
- if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
767
- return Reflect.get(arrayInstrumentations, key, receiver);
1111
+ let fn;
1112
+ if (targetIsArray && (fn = arrayInstrumentations[key])) {
1113
+ return fn;
768
1114
  }
769
1115
  if (key === "hasOwnProperty") {
770
1116
  return hasOwnProperty;
771
1117
  }
772
1118
  }
773
- const res = Reflect.get(target, key, receiver);
1119
+ const res = Reflect.get(
1120
+ target,
1121
+ key,
1122
+ // if this is a proxy wrapping a ref, return methods using the raw ref
1123
+ // as receiver so that we don't have to call `toRaw` on the ref in all
1124
+ // its class methods
1125
+ isRef(target) ? target : receiver
1126
+ );
774
1127
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
775
1128
  return res;
776
1129
  }
@@ -1269,110 +1622,8 @@ var Vue = (function () {
1269
1622
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1270
1623
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1271
1624
 
1272
- const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
1273
- class ComputedRefImpl {
1274
- constructor(getter, _setter, isReadonly, isSSR) {
1275
- this.getter = getter;
1276
- this._setter = _setter;
1277
- this.dep = void 0;
1278
- this.__v_isRef = true;
1279
- this["__v_isReadonly"] = false;
1280
- this.effect = new ReactiveEffect(
1281
- () => getter(this._value),
1282
- () => triggerRefValue(
1283
- this,
1284
- this.effect._dirtyLevel === 2 ? 2 : 3
1285
- )
1286
- );
1287
- this.effect.computed = this;
1288
- this.effect.active = this._cacheable = !isSSR;
1289
- this["__v_isReadonly"] = isReadonly;
1290
- }
1291
- get value() {
1292
- const self = toRaw(this);
1293
- if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1294
- triggerRefValue(self, 4);
1295
- }
1296
- trackRefValue(self);
1297
- if (self.effect._dirtyLevel >= 2) {
1298
- if (this._warnRecursive) {
1299
- warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1300
-
1301
- getter: `, this.getter);
1302
- }
1303
- triggerRefValue(self, 2);
1304
- }
1305
- return self._value;
1306
- }
1307
- set value(newValue) {
1308
- this._setter(newValue);
1309
- }
1310
- // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1311
- get _dirty() {
1312
- return this.effect.dirty;
1313
- }
1314
- set _dirty(v) {
1315
- this.effect.dirty = v;
1316
- }
1317
- // #endregion
1318
- }
1319
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1320
- let getter;
1321
- let setter;
1322
- const onlyGetter = isFunction(getterOrOptions);
1323
- if (onlyGetter) {
1324
- getter = getterOrOptions;
1325
- setter = () => {
1326
- warn$2("Write operation failed: computed value is readonly");
1327
- } ;
1328
- } else {
1329
- getter = getterOrOptions.get;
1330
- setter = getterOrOptions.set;
1331
- }
1332
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1333
- if (debugOptions && !isSSR) {
1334
- cRef.effect.onTrack = debugOptions.onTrack;
1335
- cRef.effect.onTrigger = debugOptions.onTrigger;
1336
- }
1337
- return cRef;
1338
- }
1339
-
1340
- function trackRefValue(ref2) {
1341
- var _a;
1342
- if (shouldTrack && activeEffect) {
1343
- ref2 = toRaw(ref2);
1344
- trackEffect(
1345
- activeEffect,
1346
- (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1347
- () => ref2.dep = void 0,
1348
- ref2 instanceof ComputedRefImpl ? ref2 : void 0
1349
- ),
1350
- {
1351
- target: ref2,
1352
- type: "get",
1353
- key: "value"
1354
- }
1355
- );
1356
- }
1357
- }
1358
- function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1359
- ref2 = toRaw(ref2);
1360
- const dep = ref2.dep;
1361
- if (dep) {
1362
- triggerEffects(
1363
- dep,
1364
- dirtyLevel,
1365
- {
1366
- target: ref2,
1367
- type: "set",
1368
- key: "value",
1369
- newValue: newVal
1370
- }
1371
- );
1372
- }
1373
- }
1374
1625
  function isRef(r) {
1375
- return !!(r && r.__v_isRef === true);
1626
+ return r ? r.__v_isRef === true : false;
1376
1627
  }
1377
1628
  function ref(value) {
1378
1629
  return createRef(value, false);
@@ -1389,27 +1640,49 @@ getter: `, this.getter);
1389
1640
  class RefImpl {
1390
1641
  constructor(value, __v_isShallow) {
1391
1642
  this.__v_isShallow = __v_isShallow;
1392
- this.dep = void 0;
1643
+ this.dep = new Dep();
1393
1644
  this.__v_isRef = true;
1394
1645
  this._rawValue = __v_isShallow ? value : toRaw(value);
1395
1646
  this._value = __v_isShallow ? value : toReactive(value);
1396
1647
  }
1397
1648
  get value() {
1398
- trackRefValue(this);
1649
+ {
1650
+ this.dep.track({
1651
+ target: this,
1652
+ type: "get",
1653
+ key: "value"
1654
+ });
1655
+ }
1399
1656
  return this._value;
1400
1657
  }
1401
- set value(newVal) {
1402
- const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
1403
- newVal = useDirectValue ? newVal : toRaw(newVal);
1404
- if (hasChanged(newVal, this._rawValue)) {
1405
- this._rawValue = newVal;
1406
- this._value = useDirectValue ? newVal : toReactive(newVal);
1407
- triggerRefValue(this, 4, newVal);
1658
+ set value(newValue) {
1659
+ const oldValue = this._rawValue;
1660
+ const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
1661
+ newValue = useDirectValue ? newValue : toRaw(newValue);
1662
+ if (hasChanged(newValue, oldValue)) {
1663
+ this._rawValue = newValue;
1664
+ this._value = useDirectValue ? newValue : toReactive(newValue);
1665
+ {
1666
+ this.dep.trigger({
1667
+ target: this,
1668
+ type: "set",
1669
+ key: "value",
1670
+ newValue,
1671
+ oldValue
1672
+ });
1673
+ }
1408
1674
  }
1409
1675
  }
1410
1676
  }
1411
1677
  function triggerRef(ref2) {
1412
- triggerRefValue(ref2, 4, ref2.value );
1678
+ {
1679
+ ref2.dep.trigger({
1680
+ target: ref2,
1681
+ type: "set",
1682
+ key: "value",
1683
+ newValue: ref2._value
1684
+ });
1685
+ }
1413
1686
  }
1414
1687
  function unref(ref2) {
1415
1688
  return isRef(ref2) ? ref2.value : ref2;
@@ -1434,12 +1707,9 @@ getter: `, this.getter);
1434
1707
  }
1435
1708
  class CustomRefImpl {
1436
1709
  constructor(factory) {
1437
- this.dep = void 0;
1438
1710
  this.__v_isRef = true;
1439
- const { get, set } = factory(
1440
- () => trackRefValue(this),
1441
- () => triggerRefValue(this)
1442
- );
1711
+ const dep = this.dep = new Dep();
1712
+ const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1443
1713
  this._get = get;
1444
1714
  this._set = set;
1445
1715
  }
@@ -1507,6 +1777,90 @@ getter: `, this.getter);
1507
1777
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1508
1778
  }
1509
1779
 
1780
+ class ComputedRefImpl {
1781
+ constructor(fn, setter, isSSR) {
1782
+ this.fn = fn;
1783
+ this.setter = setter;
1784
+ /**
1785
+ * @internal
1786
+ */
1787
+ this._value = void 0;
1788
+ /**
1789
+ * @internal
1790
+ */
1791
+ this.dep = new Dep(this);
1792
+ /**
1793
+ * @internal
1794
+ */
1795
+ this.__v_isRef = true;
1796
+ // A computed is also a subscriber that tracks other deps
1797
+ /**
1798
+ * @internal
1799
+ */
1800
+ this.deps = void 0;
1801
+ /**
1802
+ * @internal
1803
+ */
1804
+ this.depsTail = void 0;
1805
+ /**
1806
+ * @internal
1807
+ */
1808
+ this.flags = 16;
1809
+ /**
1810
+ * @internal
1811
+ */
1812
+ this.globalVersion = globalVersion - 1;
1813
+ // for backwards compat
1814
+ this.effect = this;
1815
+ this.__v_isReadonly = !setter;
1816
+ this.isSSR = isSSR;
1817
+ }
1818
+ /**
1819
+ * @internal
1820
+ */
1821
+ notify() {
1822
+ if (activeSub !== this) {
1823
+ this.flags |= 16;
1824
+ this.dep.notify();
1825
+ }
1826
+ }
1827
+ get value() {
1828
+ const link = this.dep.track({
1829
+ target: this,
1830
+ type: "get",
1831
+ key: "value"
1832
+ }) ;
1833
+ refreshComputed(this);
1834
+ if (link) {
1835
+ link.version = this.dep.version;
1836
+ }
1837
+ return this._value;
1838
+ }
1839
+ set value(newValue) {
1840
+ if (this.setter) {
1841
+ this.setter(newValue);
1842
+ } else {
1843
+ warn$2("Write operation failed: computed value is readonly");
1844
+ }
1845
+ }
1846
+ }
1847
+ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1848
+ let getter;
1849
+ let setter;
1850
+ if (isFunction(getterOrOptions)) {
1851
+ getter = getterOrOptions;
1852
+ } else {
1853
+ getter = getterOrOptions.get;
1854
+ setter = getterOrOptions.set;
1855
+ }
1856
+ const cRef = new ComputedRefImpl(getter, setter, isSSR);
1857
+ if (debugOptions && !isSSR) {
1858
+ cRef.onTrack = debugOptions.onTrack;
1859
+ cRef.onTrigger = debugOptions.onTrigger;
1860
+ }
1861
+ return cRef;
1862
+ }
1863
+
1510
1864
  const TrackOpTypes = {
1511
1865
  "GET": "get",
1512
1866
  "HAS": "has",
@@ -1799,7 +2153,7 @@ getter: `, this.getter);
1799
2153
  const middle = start + end >>> 1;
1800
2154
  const middleJob = queue[middle];
1801
2155
  const middleJobId = getId(middleJob);
1802
- if (middleJobId < id || middleJobId === id && middleJob.pre) {
2156
+ if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
1803
2157
  start = middle + 1;
1804
2158
  } else {
1805
2159
  end = middle;
@@ -1808,15 +2162,21 @@ getter: `, this.getter);
1808
2162
  return start;
1809
2163
  }
1810
2164
  function queueJob(job) {
1811
- if (!queue.length || !queue.includes(
1812
- job,
1813
- isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
1814
- )) {
2165
+ var _a;
2166
+ if (!(job.flags & 1)) {
1815
2167
  if (job.id == null) {
1816
2168
  queue.push(job);
2169
+ } else if (
2170
+ // fast path when the job id is larger than the tail
2171
+ !(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
2172
+ ) {
2173
+ queue.push(job);
1817
2174
  } else {
1818
2175
  queue.splice(findInsertionIndex(job.id), 0, job);
1819
2176
  }
2177
+ if (!(job.flags & 4)) {
2178
+ job.flags |= 1;
2179
+ }
1820
2180
  queueFlush();
1821
2181
  }
1822
2182
  }
@@ -1834,11 +2194,11 @@ getter: `, this.getter);
1834
2194
  }
1835
2195
  function queuePostFlushCb(cb) {
1836
2196
  if (!isArray(cb)) {
1837
- if (!activePostFlushCbs || !activePostFlushCbs.includes(
1838
- cb,
1839
- cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
1840
- )) {
2197
+ if (!(cb.flags & 1)) {
1841
2198
  pendingPostFlushCbs.push(cb);
2199
+ if (!(cb.flags & 4)) {
2200
+ cb.flags |= 1;
2201
+ }
1842
2202
  }
1843
2203
  } else {
1844
2204
  pendingPostFlushCbs.push(...cb);
@@ -1851,7 +2211,7 @@ getter: `, this.getter);
1851
2211
  }
1852
2212
  for (; i < queue.length; i++) {
1853
2213
  const cb = queue[i];
1854
- if (cb && cb.pre) {
2214
+ if (cb && cb.flags & 2) {
1855
2215
  if (instance && cb.id !== instance.uid) {
1856
2216
  continue;
1857
2217
  }
@@ -1861,6 +2221,7 @@ getter: `, this.getter);
1861
2221
  queue.splice(i, 1);
1862
2222
  i--;
1863
2223
  cb();
2224
+ cb.flags &= ~1;
1864
2225
  }
1865
2226
  }
1866
2227
  }
@@ -1883,6 +2244,7 @@ getter: `, this.getter);
1883
2244
  continue;
1884
2245
  }
1885
2246
  activePostFlushCbs[postFlushIndex]();
2247
+ activePostFlushCbs[postFlushIndex].flags &= ~1;
1886
2248
  }
1887
2249
  activePostFlushCbs = null;
1888
2250
  postFlushIndex = 0;
@@ -1892,9 +2254,11 @@ getter: `, this.getter);
1892
2254
  const comparator = (a, b) => {
1893
2255
  const diff = getId(a) - getId(b);
1894
2256
  if (diff === 0) {
1895
- if (a.pre && !b.pre)
2257
+ const isAPre = a.flags & 2;
2258
+ const isBPre = b.flags & 2;
2259
+ if (isAPre && !isBPre)
1896
2260
  return -1;
1897
- if (b.pre && !a.pre)
2261
+ if (isBPre && !isAPre)
1898
2262
  return 1;
1899
2263
  }
1900
2264
  return diff;
@@ -1910,11 +2274,12 @@ getter: `, this.getter);
1910
2274
  try {
1911
2275
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1912
2276
  const job = queue[flushIndex];
1913
- if (job && job.active !== false) {
2277
+ if (job && !(job.flags & 8)) {
1914
2278
  if (check(job)) {
1915
2279
  continue;
1916
2280
  }
1917
2281
  callWithErrorHandling(job, null, 14);
2282
+ job.flags &= ~1;
1918
2283
  }
1919
2284
  }
1920
2285
  } finally {
@@ -1996,7 +2361,6 @@ getter: `, this.getter);
1996
2361
  }
1997
2362
  instance.renderCache = [];
1998
2363
  isHmrUpdating = true;
1999
- instance.effect.dirty = true;
2000
2364
  instance.update();
2001
2365
  isHmrUpdating = false;
2002
2366
  });
@@ -2024,7 +2388,6 @@ getter: `, this.getter);
2024
2388
  instance.ceReload(newComp.styles);
2025
2389
  hmrDirtyComponents.delete(oldComp);
2026
2390
  } else if (instance.parent) {
2027
- instance.parent.effect.dirty = true;
2028
2391
  queueJob(instance.parent.update);
2029
2392
  } else if (instance.appContext.reload) {
2030
2393
  instance.appContext.reload();
@@ -2909,7 +3272,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2909
3272
  true ? {
2910
3273
  get attrs() {
2911
3274
  markAttrsAccessed();
2912
- return shallowReadonly(attrs);
3275
+ return attrs;
2913
3276
  },
2914
3277
  slots,
2915
3278
  emit
@@ -2942,7 +3305,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2942
3305
  propsOptions
2943
3306
  );
2944
3307
  }
2945
- root = cloneVNode(root, fallthroughAttrs, false, true);
3308
+ root = cloneVNode(root, fallthroughAttrs);
2946
3309
  } else if (!accessedAttrs && root.type !== Comment) {
2947
3310
  const allAttrs = Object.keys(attrs);
2948
3311
  const eventAttrs = [];
@@ -2980,15 +3343,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2980
3343
  getComponentName(instance.type)
2981
3344
  );
2982
3345
  }
2983
- root = cloneVNode(
2984
- root,
2985
- {
2986
- class: cls,
2987
- style
2988
- },
2989
- false,
2990
- true
2991
- );
3346
+ root = cloneVNode(root, {
3347
+ class: cls,
3348
+ style
3349
+ });
2992
3350
  }
2993
3351
  }
2994
3352
  if (vnode.dirs) {
@@ -2997,7 +3355,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2997
3355
  `Runtime directive used on component with non-element root node. The directives will not function as intended.`
2998
3356
  );
2999
3357
  }
3000
- root = cloneVNode(root, null, false, true);
3358
+ root = cloneVNode(root);
3001
3359
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
3002
3360
  }
3003
3361
  if (vnode.transition) {
@@ -3492,7 +3850,7 @@ If this is a native custom element, make sure to exclude it from component resol
3492
3850
  let parentSuspenseId;
3493
3851
  const isSuspensible = isVNodeSuspensible(vnode);
3494
3852
  if (isSuspensible) {
3495
- if (parentSuspense && parentSuspense.pendingBranch) {
3853
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3496
3854
  parentSuspenseId = parentSuspense.pendingId;
3497
3855
  parentSuspense.deps++;
3498
3856
  }
@@ -3804,8 +4162,8 @@ If this is a native custom element, make sure to exclude it from component resol
3804
4162
  }
3805
4163
  }
3806
4164
  function isVNodeSuspensible(vnode) {
3807
- const suspensible = vnode.props && vnode.props.suspensible;
3808
- return suspensible != null && suspensible !== false;
4165
+ var _a;
4166
+ return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3809
4167
  }
3810
4168
 
3811
4169
  const legacyDirectiveHookMap = {
@@ -3993,8 +4351,8 @@ If this is a native custom element, make sure to exclude it from component resol
3993
4351
  };
3994
4352
  };
3995
4353
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
3996
- const job = () => {
3997
- if (!effect.active || !effect.dirty) {
4354
+ const job = (immediateFirstRun) => {
4355
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
3998
4356
  return;
3999
4357
  }
4000
4358
  if (cb) {
@@ -4015,19 +4373,22 @@ If this is a native custom element, make sure to exclude it from component resol
4015
4373
  effect.run();
4016
4374
  }
4017
4375
  };
4018
- job.allowRecurse = !!cb;
4376
+ if (cb)
4377
+ job.flags |= 4;
4378
+ const effect = new ReactiveEffect(getter);
4019
4379
  let scheduler;
4020
4380
  if (flush === "sync") {
4381
+ effect.flags |= 64;
4021
4382
  scheduler = job;
4022
4383
  } else if (flush === "post") {
4023
4384
  scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
4024
4385
  } else {
4025
- job.pre = true;
4386
+ job.flags |= 2;
4026
4387
  if (instance)
4027
4388
  job.id = instance.uid;
4028
4389
  scheduler = () => queueJob(job);
4029
4390
  }
4030
- const effect = new ReactiveEffect(getter, NOOP, scheduler);
4391
+ effect.scheduler = scheduler;
4031
4392
  const scope = getCurrentScope();
4032
4393
  const unwatch = () => {
4033
4394
  effect.stop();
@@ -4041,7 +4402,7 @@ If this is a native custom element, make sure to exclude it from component resol
4041
4402
  }
4042
4403
  if (cb) {
4043
4404
  if (immediate) {
4044
- job();
4405
+ job(true);
4045
4406
  } else {
4046
4407
  oldValue = effect.run();
4047
4408
  }
@@ -4080,29 +4441,34 @@ If this is a native custom element, make sure to exclude it from component resol
4080
4441
  return cur;
4081
4442
  };
4082
4443
  }
4083
- function traverse(value, depth = Infinity, seen) {
4084
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
4444
+ function traverse(value, depth, currentDepth = 0, seen) {
4445
+ if (!isObject(value) || value["__v_skip"]) {
4085
4446
  return value;
4086
4447
  }
4448
+ if (depth && depth > 0) {
4449
+ if (currentDepth >= depth) {
4450
+ return value;
4451
+ }
4452
+ currentDepth++;
4453
+ }
4087
4454
  seen = seen || /* @__PURE__ */ new Set();
4088
4455
  if (seen.has(value)) {
4089
4456
  return value;
4090
4457
  }
4091
4458
  seen.add(value);
4092
- depth--;
4093
4459
  if (isRef(value)) {
4094
- traverse(value.value, depth, seen);
4460
+ traverse(value.value, depth, currentDepth, seen);
4095
4461
  } else if (isArray(value)) {
4096
4462
  for (let i = 0; i < value.length; i++) {
4097
- traverse(value[i], depth, seen);
4463
+ traverse(value[i], depth, currentDepth, seen);
4098
4464
  }
4099
4465
  } else if (isSet(value) || isMap(value)) {
4100
4466
  value.forEach((v) => {
4101
- traverse(v, depth, seen);
4467
+ traverse(v, depth, currentDepth, seen);
4102
4468
  });
4103
4469
  } else if (isPlainObject(value)) {
4104
4470
  for (const key in value) {
4105
- traverse(value[key], depth, seen);
4471
+ traverse(value[key], depth, currentDepth, seen);
4106
4472
  }
4107
4473
  }
4108
4474
  return value;
@@ -4218,22 +4584,7 @@ If this is a native custom element, make sure to exclude it from component resol
4218
4584
  if (!children || !children.length) {
4219
4585
  return;
4220
4586
  }
4221
- let child = children[0];
4222
- if (children.length > 1) {
4223
- let hasFound = false;
4224
- for (const c of children) {
4225
- if (c.type !== Comment) {
4226
- if (hasFound) {
4227
- warn$1(
4228
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
4229
- );
4230
- break;
4231
- }
4232
- child = c;
4233
- hasFound = true;
4234
- }
4235
- }
4236
- }
4587
+ const child = findNonCommentChild(children);
4237
4588
  const rawProps = toRaw(props);
4238
4589
  const { mode } = rawProps;
4239
4590
  if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
@@ -4242,7 +4593,7 @@ If this is a native custom element, make sure to exclude it from component resol
4242
4593
  if (state.isLeaving) {
4243
4594
  return emptyPlaceholder(child);
4244
4595
  }
4245
- const innerChild = getKeepAliveChild(child);
4596
+ const innerChild = getInnerChild$1(child);
4246
4597
  if (!innerChild) {
4247
4598
  return emptyPlaceholder(child);
4248
4599
  }
@@ -4254,7 +4605,7 @@ If this is a native custom element, make sure to exclude it from component resol
4254
4605
  );
4255
4606
  setTransitionHooks(innerChild, enterHooks);
4256
4607
  const oldChild = instance.subTree;
4257
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4608
+ const oldInnerChild = oldChild && getInnerChild$1(oldChild);
4258
4609
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4259
4610
  const leavingHooks = resolveTransitionHooks(
4260
4611
  oldInnerChild,
@@ -4263,12 +4614,11 @@ If this is a native custom element, make sure to exclude it from component resol
4263
4614
  instance
4264
4615
  );
4265
4616
  setTransitionHooks(oldInnerChild, leavingHooks);
4266
- if (mode === "out-in" && innerChild.type !== Comment) {
4617
+ if (mode === "out-in") {
4267
4618
  state.isLeaving = true;
4268
4619
  leavingHooks.afterLeave = () => {
4269
4620
  state.isLeaving = false;
4270
- if (instance.update.active !== false) {
4271
- instance.effect.dirty = true;
4621
+ if (!(instance.job.flags & 8)) {
4272
4622
  instance.update();
4273
4623
  }
4274
4624
  };
@@ -4296,6 +4646,25 @@ If this is a native custom element, make sure to exclude it from component resol
4296
4646
  {
4297
4647
  BaseTransitionImpl.__isBuiltIn = true;
4298
4648
  }
4649
+ function findNonCommentChild(children) {
4650
+ let child = children[0];
4651
+ if (children.length > 1) {
4652
+ let hasFound = false;
4653
+ for (const c of children) {
4654
+ if (c.type !== Comment) {
4655
+ if (hasFound) {
4656
+ warn$1(
4657
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
4658
+ );
4659
+ break;
4660
+ }
4661
+ child = c;
4662
+ hasFound = true;
4663
+ }
4664
+ }
4665
+ }
4666
+ return child;
4667
+ }
4299
4668
  const BaseTransition = BaseTransitionImpl;
4300
4669
  function getLeavingNodesForType(state, vnode) {
4301
4670
  const { leavingVNodes } = state;
@@ -4450,8 +4819,11 @@ If this is a native custom element, make sure to exclude it from component resol
4450
4819
  return vnode;
4451
4820
  }
4452
4821
  }
4453
- function getKeepAliveChild(vnode) {
4822
+ function getInnerChild$1(vnode) {
4454
4823
  if (!isKeepAlive(vnode)) {
4824
+ if (isTeleport(vnode.type) && vnode.children) {
4825
+ return findNonCommentChild(vnode.children);
4826
+ }
4455
4827
  return vnode;
4456
4828
  }
4457
4829
  if (vnode.component) {
@@ -4620,7 +4992,6 @@ If this is a native custom element, make sure to exclude it from component resol
4620
4992
  load().then(() => {
4621
4993
  loaded.value = true;
4622
4994
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4623
- instance.parent.effect.dirty = true;
4624
4995
  queueJob(instance.parent.update);
4625
4996
  }
4626
4997
  }).catch((err) => {
@@ -4781,7 +5152,7 @@ If this is a native custom element, make sure to exclude it from component resol
4781
5152
  return () => {
4782
5153
  pendingCacheKey = null;
4783
5154
  if (!slots.default) {
4784
- return null;
5155
+ return current = null;
4785
5156
  }
4786
5157
  const children = slots.default();
4787
5158
  const rawVNode = children[0];
@@ -5232,10 +5603,20 @@ If this is a native custom element, make sure to exclude it from component resol
5232
5603
  function renderList(source, renderItem, cache, index) {
5233
5604
  let ret;
5234
5605
  const cached = cache && cache[index];
5235
- if (isArray(source) || isString(source)) {
5606
+ const sourceIsArray = isArray(source);
5607
+ const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5608
+ if (sourceIsArray || isString(source)) {
5609
+ if (sourceIsReactiveArray) {
5610
+ source = shallowReadArray(source);
5611
+ }
5236
5612
  ret = new Array(source.length);
5237
5613
  for (let i = 0, l = source.length; i < l; i++) {
5238
- ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
5614
+ ret[i] = renderItem(
5615
+ sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5616
+ i,
5617
+ void 0,
5618
+ cached && cached[i]
5619
+ );
5239
5620
  }
5240
5621
  } else if (typeof source === "number") {
5241
5622
  if (!Number.isInteger(source)) {
@@ -5606,7 +5987,6 @@ If this is a native custom element, make sure to exclude it from component resol
5606
5987
  $emit: (i) => i.emit,
5607
5988
  $options: (i) => resolveMergedOptions(i) ,
5608
5989
  $forceUpdate: (i) => i.f || (i.f = () => {
5609
- i.effect.dirty = true;
5610
5990
  queueJob(i.update);
5611
5991
  }),
5612
5992
  $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
@@ -6477,13 +6857,13 @@ If this is a native custom element, make sure to exclude it from component resol
6477
6857
  return vm;
6478
6858
  }
6479
6859
  }
6480
- Vue.version = `2.6.14-compat:${"3.4.26"}`;
6860
+ Vue.version = `2.6.14-compat:${"3.5.0-alpha.1"}`;
6481
6861
  Vue.config = singletonApp.config;
6482
- Vue.use = (plugin, ...options) => {
6483
- if (plugin && isFunction(plugin.install)) {
6484
- plugin.install(Vue, ...options);
6485
- } else if (isFunction(plugin)) {
6486
- plugin(Vue, ...options);
6862
+ Vue.use = (p, ...options) => {
6863
+ if (p && isFunction(p.install)) {
6864
+ p.install(Vue, ...options);
6865
+ } else if (isFunction(p)) {
6866
+ p(Vue, ...options);
6487
6867
  }
6488
6868
  return Vue;
6489
6869
  };
@@ -7495,7 +7875,9 @@ If you want to remount the same app, move your app creation logic into a factory
7495
7875
  function assertType(value, type) {
7496
7876
  let valid;
7497
7877
  const expectedType = getType(type);
7498
- if (isSimpleType(expectedType)) {
7878
+ if (expectedType === "null") {
7879
+ valid = value === null;
7880
+ } else if (isSimpleType(expectedType)) {
7499
7881
  const t = typeof value;
7500
7882
  valid = t === expectedType.toLowerCase();
7501
7883
  if (!valid && t === "object") {
@@ -7505,8 +7887,6 @@ If you want to remount the same app, move your app creation logic into a factory
7505
7887
  valid = isObject(value);
7506
7888
  } else if (expectedType === "Array") {
7507
7889
  valid = isArray(value);
7508
- } else if (expectedType === "null") {
7509
- valid = value === null;
7510
7890
  } else {
7511
7891
  valid = value instanceof type;
7512
7892
  }
@@ -7601,7 +7981,7 @@ If you want to remount the same app, move your app creation logic into a factory
7601
7981
  const type = children._;
7602
7982
  if (type) {
7603
7983
  extend(slots, children);
7604
- def(slots, "_", type, true);
7984
+ def(slots, "_", type);
7605
7985
  } else {
7606
7986
  normalizeObjectSlots(children, slots, instance);
7607
7987
  }
@@ -9031,7 +9411,6 @@ Server rendered element contains fewer child nodes than client vdom.`
9031
9411
  } else {
9032
9412
  instance.next = n2;
9033
9413
  invalidateJob(instance.update);
9034
- instance.effect.dirty = true;
9035
9414
  instance.update();
9036
9415
  }
9037
9416
  } else {
@@ -9238,24 +9617,18 @@ Server rendered element contains fewer child nodes than client vdom.`
9238
9617
  }
9239
9618
  }
9240
9619
  };
9241
- const effect = instance.effect = new ReactiveEffect(
9242
- componentUpdateFn,
9243
- NOOP,
9244
- () => queueJob(update),
9245
- instance.scope
9246
- // track it in component's effect scope
9247
- );
9248
- const update = instance.update = () => {
9249
- if (effect.dirty) {
9250
- effect.run();
9251
- }
9252
- };
9253
- update.id = instance.uid;
9620
+ instance.scope.on();
9621
+ const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
9622
+ instance.scope.off();
9623
+ const update = instance.update = effect.run.bind(effect);
9624
+ const job = instance.job = effect.runIfDirty.bind(effect);
9625
+ job.id = instance.uid;
9626
+ effect.scheduler = () => queueJob(job);
9254
9627
  toggleRecurse(instance, true);
9255
9628
  {
9256
9629
  effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
9257
9630
  effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
9258
- update.ownerInstance = instance;
9631
+ job.ownerInstance = instance;
9259
9632
  }
9260
9633
  update();
9261
9634
  };
@@ -9722,7 +10095,7 @@ Server rendered element contains fewer child nodes than client vdom.`
9722
10095
  if (instance.type.__hmrId) {
9723
10096
  unregisterHMR(instance);
9724
10097
  }
9725
- const { bum, scope, update, subTree, um } = instance;
10098
+ const { bum, scope, job, subTree, um } = instance;
9726
10099
  if (bum) {
9727
10100
  invokeArrayFns(bum);
9728
10101
  }
@@ -9730,8 +10103,8 @@ Server rendered element contains fewer child nodes than client vdom.`
9730
10103
  instance.emit("hook:beforeDestroy");
9731
10104
  }
9732
10105
  scope.stop();
9733
- if (update) {
9734
- update.active = false;
10106
+ if (job) {
10107
+ job.flags |= 8;
9735
10108
  unmount(subTree, instance, parentSuspense, doRemove);
9736
10109
  }
9737
10110
  if (um) {
@@ -9823,8 +10196,14 @@ Server rendered element contains fewer child nodes than client vdom.`
9823
10196
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
9824
10197
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
9825
10198
  }
9826
- function toggleRecurse({ effect, update }, allowed) {
9827
- effect.allowRecurse = update.allowRecurse = allowed;
10199
+ function toggleRecurse({ effect, job }, allowed) {
10200
+ if (allowed) {
10201
+ effect.flags |= 32;
10202
+ job.flags |= 4;
10203
+ } else {
10204
+ effect.flags &= ~32;
10205
+ job.flags &= ~4;
10206
+ }
9828
10207
  }
9829
10208
  function needTransition(parentSuspense, transition) {
9830
10209
  return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
@@ -10440,8 +10819,8 @@ Component that was made reactive: `,
10440
10819
  return null;
10441
10820
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
10442
10821
  }
10443
- function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
10444
- const { props, ref, patchFlag, children, transition } = vnode;
10822
+ function cloneVNode(vnode, extraProps, mergeRef = false) {
10823
+ const { props, ref, patchFlag, children } = vnode;
10445
10824
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
10446
10825
  const cloned = {
10447
10826
  __v_isVNode: true,
@@ -10471,7 +10850,7 @@ Component that was made reactive: `,
10471
10850
  dynamicChildren: vnode.dynamicChildren,
10472
10851
  appContext: vnode.appContext,
10473
10852
  dirs: vnode.dirs,
10474
- transition,
10853
+ transition: vnode.transition,
10475
10854
  // These should technically only be non-null on mounted VNodes. However,
10476
10855
  // they *should* be copied for kept-alive vnodes. So we just always copy
10477
10856
  // them since them being non-null during a mount doesn't affect the logic as
@@ -10485,9 +10864,6 @@ Component that was made reactive: `,
10485
10864
  ctx: vnode.ctx,
10486
10865
  ce: vnode.ce
10487
10866
  };
10488
- if (transition && cloneTransition) {
10489
- cloned.transition = transition.clone(cloned);
10490
- }
10491
10867
  {
10492
10868
  defineLegacyVNodeProperties(cloned);
10493
10869
  }
@@ -10625,6 +11001,7 @@ Component that was made reactive: `,
10625
11001
  effect: null,
10626
11002
  update: null,
10627
11003
  // will be set synchronously right after creation
11004
+ job: null,
10628
11005
  scope: new EffectScope(
10629
11006
  true
10630
11007
  /* detached */
@@ -11130,7 +11507,8 @@ Component that was made reactive: `,
11130
11507
  {},
11131
11508
  ["span", vueStyle, genRefFlag(obj)],
11132
11509
  "<",
11133
- formatValue(obj.value),
11510
+ // avoid debugger accessing value affecting behavior
11511
+ formatValue("_value" in obj ? obj._value : obj),
11134
11512
  `>`
11135
11513
  ];
11136
11514
  } else if (isReactive(obj)) {
@@ -11310,7 +11688,7 @@ Component that was made reactive: `,
11310
11688
  return true;
11311
11689
  }
11312
11690
 
11313
- const version = "3.4.26";
11691
+ const version = "3.5.0-alpha.1";
11314
11692
  const warn = warn$1 ;
11315
11693
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11316
11694
  const devtools = devtools$1 ;
@@ -12865,7 +13243,9 @@ Expected function or array of functions, received type ${typeof value}.`
12865
13243
  return;
12866
13244
  }
12867
13245
  const eventKey = hyphenate(event.key);
12868
- if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
13246
+ if (modifiers.some(
13247
+ (k) => k === eventKey || keyNames[k] === eventKey
13248
+ )) {
12869
13249
  return fn(event);
12870
13250
  }
12871
13251
  {