@vue/compat 3.5.13 → 3.5.14

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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.13
2
+ * @vue/compat v3.5.14
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -449,6 +449,10 @@ class EffectScope {
449
449
  * @internal
450
450
  */
451
451
  this._active = true;
452
+ /**
453
+ * @internal track `on` calls, allow `on` call multiple times
454
+ */
455
+ this._on = 0;
452
456
  /**
453
457
  * @internal
454
458
  */
@@ -519,14 +523,20 @@ class EffectScope {
519
523
  * @internal
520
524
  */
521
525
  on() {
522
- activeEffectScope = this;
526
+ if (++this._on === 1) {
527
+ this.prevScope = activeEffectScope;
528
+ activeEffectScope = this;
529
+ }
523
530
  }
524
531
  /**
525
532
  * This should only be called on non-detached scopes
526
533
  * @internal
527
534
  */
528
535
  off() {
529
- activeEffectScope = this.parent;
536
+ if (this._on > 0 && --this._on === 0) {
537
+ activeEffectScope = this.prevScope;
538
+ this.prevScope = void 0;
539
+ }
530
540
  }
531
541
  stop(fromParent) {
532
542
  if (this._active) {
@@ -608,7 +618,7 @@ class ReactiveEffect {
608
618
  }
609
619
  resume() {
610
620
  if (this.flags & 64) {
611
- this.flags &= ~64;
621
+ this.flags &= -65;
612
622
  if (pausedQueueEffects.has(this)) {
613
623
  pausedQueueEffects.delete(this);
614
624
  this.trigger();
@@ -648,7 +658,7 @@ class ReactiveEffect {
648
658
  cleanupDeps(this);
649
659
  activeSub = prevEffect;
650
660
  shouldTrack = prevShouldTrack;
651
- this.flags &= ~2;
661
+ this.flags &= -3;
652
662
  }
653
663
  }
654
664
  stop() {
@@ -659,7 +669,7 @@ class ReactiveEffect {
659
669
  this.deps = this.depsTail = void 0;
660
670
  cleanupEffect(this);
661
671
  this.onStop && this.onStop();
662
- this.flags &= ~1;
672
+ this.flags &= -2;
663
673
  }
664
674
  }
665
675
  trigger() {
@@ -709,7 +719,7 @@ function endBatch() {
709
719
  while (e) {
710
720
  const next = e.next;
711
721
  e.next = void 0;
712
- e.flags &= ~8;
722
+ e.flags &= -9;
713
723
  e = next;
714
724
  }
715
725
  }
@@ -720,7 +730,7 @@ function endBatch() {
720
730
  while (e) {
721
731
  const next = e.next;
722
732
  e.next = void 0;
723
- e.flags &= ~8;
733
+ e.flags &= -9;
724
734
  if (e.flags & 1) {
725
735
  try {
726
736
  ;
@@ -776,17 +786,16 @@ function refreshComputed(computed) {
776
786
  if (computed.flags & 4 && !(computed.flags & 16)) {
777
787
  return;
778
788
  }
779
- computed.flags &= ~16;
789
+ computed.flags &= -17;
780
790
  if (computed.globalVersion === globalVersion) {
781
791
  return;
782
792
  }
783
793
  computed.globalVersion = globalVersion;
784
- const dep = computed.dep;
785
- computed.flags |= 2;
786
- if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
787
- computed.flags &= ~2;
794
+ if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
788
795
  return;
789
796
  }
797
+ computed.flags |= 2;
798
+ const dep = computed.dep;
790
799
  const prevSub = activeSub;
791
800
  const prevShouldTrack = shouldTrack;
792
801
  activeSub = computed;
@@ -795,6 +804,7 @@ function refreshComputed(computed) {
795
804
  prepareDeps(computed);
796
805
  const value = computed.fn(computed._value);
797
806
  if (dep.version === 0 || hasChanged(value, computed._value)) {
807
+ computed.flags |= 128;
798
808
  computed._value = value;
799
809
  dep.version++;
800
810
  }
@@ -805,7 +815,7 @@ function refreshComputed(computed) {
805
815
  activeSub = prevSub;
806
816
  shouldTrack = prevShouldTrack;
807
817
  cleanupDeps(computed);
808
- computed.flags &= ~2;
818
+ computed.flags &= -3;
809
819
  }
810
820
  }
811
821
  function removeSub(link, soft = false) {
@@ -824,7 +834,7 @@ function removeSub(link, soft = false) {
824
834
  if (dep.subs === link) {
825
835
  dep.subs = prevSub;
826
836
  if (!prevSub && dep.computed) {
827
- dep.computed.flags &= ~4;
837
+ dep.computed.flags &= -5;
828
838
  for (let l = dep.computed.deps; l; l = l.nextDep) {
829
839
  removeSub(l, true);
830
840
  }
@@ -1757,14 +1767,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1757
1767
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1758
1768
  return target;
1759
1769
  }
1760
- const existingProxy = proxyMap.get(target);
1761
- if (existingProxy) {
1762
- return existingProxy;
1763
- }
1764
1770
  const targetType = getTargetType(target);
1765
1771
  if (targetType === 0 /* INVALID */) {
1766
1772
  return target;
1767
1773
  }
1774
+ const existingProxy = proxyMap.get(target);
1775
+ if (existingProxy) {
1776
+ return existingProxy;
1777
+ }
1768
1778
  const proxy = new Proxy(
1769
1779
  target,
1770
1780
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2608,11 +2618,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2608
2618
  queue.splice(i, 1);
2609
2619
  i--;
2610
2620
  if (cb.flags & 4) {
2611
- cb.flags &= ~1;
2621
+ cb.flags &= -2;
2612
2622
  }
2613
2623
  cb();
2614
2624
  if (!(cb.flags & 4)) {
2615
- cb.flags &= ~1;
2625
+ cb.flags &= -2;
2616
2626
  }
2617
2627
  }
2618
2628
  }
@@ -2637,10 +2647,10 @@ function flushPostFlushCbs(seen) {
2637
2647
  continue;
2638
2648
  }
2639
2649
  if (cb.flags & 4) {
2640
- cb.flags &= ~1;
2650
+ cb.flags &= -2;
2641
2651
  }
2642
2652
  if (!(cb.flags & 8)) cb();
2643
- cb.flags &= ~1;
2653
+ cb.flags &= -2;
2644
2654
  }
2645
2655
  activePostFlushCbs = null;
2646
2656
  postFlushIndex = 0;
@@ -2676,7 +2686,7 @@ function flushJobs(seen) {
2676
2686
  for (; flushIndex < queue.length; flushIndex++) {
2677
2687
  const job = queue[flushIndex];
2678
2688
  if (job) {
2679
- job.flags &= ~1;
2689
+ job.flags &= -2;
2680
2690
  }
2681
2691
  }
2682
2692
  flushIndex = -1;
@@ -3693,7 +3703,7 @@ const TeleportImpl = {
3693
3703
  namespace,
3694
3704
  slotScopeIds
3695
3705
  );
3696
- traverseStaticChildren(n1, n2, true);
3706
+ traverseStaticChildren(n1, n2, false);
3697
3707
  } else if (!optimized) {
3698
3708
  patchChildren(
3699
3709
  n1,
@@ -5468,7 +5478,7 @@ const KeepAliveImpl = {
5468
5478
  );
5469
5479
  const { include, exclude, max } = props;
5470
5480
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5471
- vnode.shapeFlag &= ~256;
5481
+ vnode.shapeFlag &= -257;
5472
5482
  current = vnode;
5473
5483
  return rawVNode;
5474
5484
  }
@@ -5559,8 +5569,8 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
5559
5569
  }, target);
5560
5570
  }
5561
5571
  function resetShapeFlag(vnode) {
5562
- vnode.shapeFlag &= ~256;
5563
- vnode.shapeFlag &= ~512;
5572
+ vnode.shapeFlag &= -257;
5573
+ vnode.shapeFlag &= -513;
5564
5574
  }
5565
5575
  function getInnerChild(vnode) {
5566
5576
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@@ -5962,14 +5972,16 @@ function renderList(source, renderItem, cache, index) {
5962
5972
  if (sourceIsArray || isString(source)) {
5963
5973
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5964
5974
  let needsWrap = false;
5975
+ let isReadonlySource = false;
5965
5976
  if (sourceIsReactiveArray) {
5966
5977
  needsWrap = !isShallow(source);
5978
+ isReadonlySource = isReadonly(source);
5967
5979
  source = shallowReadArray(source);
5968
5980
  }
5969
5981
  ret = new Array(source.length);
5970
5982
  for (let i = 0, l = source.length; i < l; i++) {
5971
5983
  ret[i] = renderItem(
5972
- needsWrap ? toReactive(source[i]) : source[i],
5984
+ needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
5973
5985
  i,
5974
5986
  void 0,
5975
5987
  cached && cached[i]
@@ -7221,7 +7233,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7221
7233
  return vm;
7222
7234
  }
7223
7235
  }
7224
- Vue.version = `2.6.14-compat:${"3.5.13"}`;
7236
+ Vue.version = `2.6.14-compat:${"3.5.14"}`;
7225
7237
  Vue.config = singletonApp.config;
7226
7238
  Vue.use = (plugin, ...options) => {
7227
7239
  if (plugin && isFunction(plugin.install)) {
@@ -7715,11 +7727,9 @@ function createAppAPI(render, hydrate) {
7715
7727
  }
7716
7728
  {
7717
7729
  context.reload = () => {
7718
- render(
7719
- cloneVNode(vnode),
7720
- rootContainer,
7721
- namespace
7722
- );
7730
+ const cloned = cloneVNode(vnode);
7731
+ cloned.el = null;
7732
+ render(cloned, rootContainer, namespace);
7723
7733
  };
7724
7734
  }
7725
7735
  if (isHydrate && hydrate) {
@@ -8317,7 +8327,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
8317
8327
  return rawSlot;
8318
8328
  }
8319
8329
  const normalized = withCtx((...args) => {
8320
- if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
8330
+ if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
8321
8331
  warn$1(
8322
8332
  `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
8323
8333
  );
@@ -8356,7 +8366,7 @@ const normalizeVNodeSlots = (instance, children) => {
8356
8366
  };
8357
8367
  const assignSlots = (slots, children, optimized) => {
8358
8368
  for (const key in children) {
8359
- if (optimized || key !== "_") {
8369
+ if (optimized || !isInternalKey(key)) {
8360
8370
  slots[key] = children[key];
8361
8371
  }
8362
8372
  }
@@ -9043,8 +9053,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9043
9053
  endMeasure(instance, `init`);
9044
9054
  }
9045
9055
  }
9056
+ if (isHmrUpdating) initialVNode.el = null;
9046
9057
  if (instance.asyncDep) {
9047
- if (isHmrUpdating) initialVNode.el = null;
9048
9058
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
9049
9059
  if (!initialVNode.el) {
9050
9060
  const placeholder = instance.subTree = createVNode(Comment);
@@ -9630,7 +9640,13 @@ function baseCreateRenderer(options, createHydrationFns) {
9630
9640
  queuePostRenderEffect(() => transition.enter(el), parentSuspense);
9631
9641
  } else {
9632
9642
  const { leave, delayLeave, afterLeave } = transition;
9633
- const remove2 = () => hostInsert(el, container, anchor);
9643
+ const remove2 = () => {
9644
+ if (vnode.ctx.isUnmounted) {
9645
+ hostRemove(el);
9646
+ } else {
9647
+ hostInsert(el, container, anchor);
9648
+ }
9649
+ };
9634
9650
  const performLeave = () => {
9635
9651
  leave(el, () => {
9636
9652
  remove2();
@@ -9663,7 +9679,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9663
9679
  optimized = false;
9664
9680
  }
9665
9681
  if (ref != null) {
9682
+ pauseTracking();
9666
9683
  setRef(ref, null, parentSuspense, vnode, true);
9684
+ resetTracking();
9667
9685
  }
9668
9686
  if (cacheIndex != null) {
9669
9687
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -9775,12 +9793,27 @@ function baseCreateRenderer(options, createHydrationFns) {
9775
9793
  if (instance.type.__hmrId) {
9776
9794
  unregisterHMR(instance);
9777
9795
  }
9778
- const { bum, scope, job, subTree, um, m, a } = instance;
9796
+ const {
9797
+ bum,
9798
+ scope,
9799
+ job,
9800
+ subTree,
9801
+ um,
9802
+ m,
9803
+ a,
9804
+ parent,
9805
+ slots: { __: slotCacheKeys }
9806
+ } = instance;
9779
9807
  invalidateMount(m);
9780
9808
  invalidateMount(a);
9781
9809
  if (bum) {
9782
9810
  invokeArrayFns(bum);
9783
9811
  }
9812
+ if (parent && isArray(slotCacheKeys)) {
9813
+ slotCacheKeys.forEach((v) => {
9814
+ parent.renderCache[v] = void 0;
9815
+ });
9816
+ }
9784
9817
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
9785
9818
  instance.emit("hook:beforeDestroy");
9786
9819
  }
@@ -9885,8 +9918,8 @@ function toggleRecurse({ effect, job }, allowed) {
9885
9918
  effect.flags |= 32;
9886
9919
  job.flags |= 4;
9887
9920
  } else {
9888
- effect.flags &= ~32;
9889
- job.flags &= ~4;
9921
+ effect.flags &= -33;
9922
+ job.flags &= -5;
9890
9923
  }
9891
9924
  }
9892
9925
  function needTransition(parentSuspense, transition) {
@@ -9913,6 +9946,9 @@ function traverseStaticChildren(n1, n2, shallow = false) {
9913
9946
  if (c2.type === Comment && !c2.el) {
9914
9947
  c2.el = c1.el;
9915
9948
  }
9949
+ {
9950
+ c2.el && (c2.el.__vnode = c2);
9951
+ }
9916
9952
  }
9917
9953
  }
9918
9954
  }
@@ -11343,8 +11379,8 @@ function isSameVNodeType(n1, n2) {
11343
11379
  if (n2.shapeFlag & 6 && n1.component) {
11344
11380
  const dirtyInstances = hmrDirtyComponents.get(n2.type);
11345
11381
  if (dirtyInstances && dirtyInstances.has(n1.component)) {
11346
- n1.shapeFlag &= ~256;
11347
- n2.shapeFlag &= ~512;
11382
+ n1.shapeFlag &= -257;
11383
+ n2.shapeFlag &= -513;
11348
11384
  return false;
11349
11385
  }
11350
11386
  }
@@ -11815,7 +11851,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
11815
11851
  const { props, children } = instance.vnode;
11816
11852
  const isStateful = isStatefulComponent(instance);
11817
11853
  initProps(instance, props, isStateful, isSSR);
11818
- initSlots(instance, children, optimized);
11854
+ initSlots(instance, children, optimized || isSSR);
11819
11855
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
11820
11856
  isSSR && setInSSRSetupState(false);
11821
11857
  return setupResult;
@@ -12158,13 +12194,15 @@ function initCustomFormatter() {
12158
12194
  if (obj.__isVue) {
12159
12195
  return ["div", vueStyle, `VueInstance`];
12160
12196
  } else if (isRef(obj)) {
12197
+ pauseTracking();
12198
+ const value = obj.value;
12199
+ resetTracking();
12161
12200
  return [
12162
12201
  "div",
12163
12202
  {},
12164
12203
  ["span", vueStyle, genRefFlag(obj)],
12165
12204
  "<",
12166
- // avoid debugger accessing value affecting behavior
12167
- formatValue("_value" in obj ? obj._value : obj),
12205
+ formatValue(value),
12168
12206
  `>`
12169
12207
  ];
12170
12208
  } else if (isReactive(obj)) {
@@ -12345,7 +12383,7 @@ function isMemoSame(cached, memo) {
12345
12383
  return true;
12346
12384
  }
12347
12385
 
12348
- const version = "3.5.13";
12386
+ const version = "3.5.14";
12349
12387
  const warn = warn$1 ;
12350
12388
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12351
12389
  const devtools = devtools$1 ;
@@ -13184,7 +13222,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
13184
13222
  }
13185
13223
  return false;
13186
13224
  }
13187
- if (key === "spellcheck" || key === "draggable" || key === "translate") {
13225
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13188
13226
  return false;
13189
13227
  }
13190
13228
  if (key === "form") {
@@ -13676,6 +13714,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13676
13714
  instance.vnode.el,
13677
13715
  moveClass
13678
13716
  )) {
13717
+ prevChildren = [];
13679
13718
  return;
13680
13719
  }
13681
13720
  prevChildren.forEach(callPendingCbs);
@@ -13699,6 +13738,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13699
13738
  };
13700
13739
  el.addEventListener("transitionend", cb);
13701
13740
  });
13741
+ prevChildren = [];
13702
13742
  });
13703
13743
  return () => {
13704
13744
  const rawProps = toRaw(props);
@@ -16004,7 +16044,7 @@ function isReferenced(node, parent, grandparent) {
16004
16044
  if (parent.key === node) {
16005
16045
  return !!parent.computed;
16006
16046
  }
16007
- return !grandparent;
16047
+ return true;
16008
16048
  // no: class { NODE = value; }
16009
16049
  // yes: class { [NODE] = value; }
16010
16050
  // yes: class { key = NODE; }
@@ -16628,7 +16668,7 @@ const tokenizer = new Tokenizer(stack, {
16628
16668
  "COMPILER_V_BIND_SYNC",
16629
16669
  currentOptions,
16630
16670
  currentProp.loc,
16631
- currentProp.rawName
16671
+ currentProp.arg.loc.source
16632
16672
  )) {
16633
16673
  currentProp.name = "model";
16634
16674
  currentProp.modifiers.splice(syncIndex, 1);
@@ -17220,6 +17260,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17220
17260
  }
17221
17261
  }
17222
17262
  let cachedAsArray = false;
17263
+ const slotCacheKeys = [];
17223
17264
  if (toCache.length === children.length && node.type === 1) {
17224
17265
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
17225
17266
  node.codegenNode.children = getCacheExpression(
@@ -17229,6 +17270,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17229
17270
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17230
17271
  const slot = getSlotNode(node.codegenNode, "default");
17231
17272
  if (slot) {
17273
+ slotCacheKeys.push(context.cached.length);
17232
17274
  slot.returns = getCacheExpression(
17233
17275
  createArrayExpression(slot.returns)
17234
17276
  );
@@ -17238,6 +17280,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17238
17280
  const slotName = findDir(node, "slot", true);
17239
17281
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
17240
17282
  if (slot) {
17283
+ slotCacheKeys.push(context.cached.length);
17241
17284
  slot.returns = getCacheExpression(
17242
17285
  createArrayExpression(slot.returns)
17243
17286
  );
@@ -17247,9 +17290,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17247
17290
  }
17248
17291
  if (!cachedAsArray) {
17249
17292
  for (const child of toCache) {
17293
+ slotCacheKeys.push(context.cached.length);
17250
17294
  child.codegenNode = context.cache(child.codegenNode);
17251
17295
  }
17252
17296
  }
17297
+ if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17298
+ node.codegenNode.children.properties.push(
17299
+ createObjectProperty(
17300
+ `__`,
17301
+ createSimpleExpression(JSON.stringify(slotCacheKeys), false)
17302
+ )
17303
+ );
17304
+ }
17253
17305
  function getCacheExpression(value) {
17254
17306
  const exp = context.cache(value);
17255
17307
  if (inFor && context.hmr) {