@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.
@@ -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
  **/
@@ -366,6 +366,10 @@ class EffectScope {
366
366
  * @internal
367
367
  */
368
368
  this._active = true;
369
+ /**
370
+ * @internal track `on` calls, allow `on` call multiple times
371
+ */
372
+ this._on = 0;
369
373
  /**
370
374
  * @internal
371
375
  */
@@ -434,14 +438,20 @@ class EffectScope {
434
438
  * @internal
435
439
  */
436
440
  on() {
437
- activeEffectScope = this;
441
+ if (++this._on === 1) {
442
+ this.prevScope = activeEffectScope;
443
+ activeEffectScope = this;
444
+ }
438
445
  }
439
446
  /**
440
447
  * This should only be called on non-detached scopes
441
448
  * @internal
442
449
  */
443
450
  off() {
444
- activeEffectScope = this.parent;
451
+ if (this._on > 0 && --this._on === 0) {
452
+ activeEffectScope = this.prevScope;
453
+ this.prevScope = void 0;
454
+ }
445
455
  }
446
456
  stop(fromParent) {
447
457
  if (this._active) {
@@ -519,7 +529,7 @@ class ReactiveEffect {
519
529
  }
520
530
  resume() {
521
531
  if (this.flags & 64) {
522
- this.flags &= ~64;
532
+ this.flags &= -65;
523
533
  if (pausedQueueEffects.has(this)) {
524
534
  pausedQueueEffects.delete(this);
525
535
  this.trigger();
@@ -554,7 +564,7 @@ class ReactiveEffect {
554
564
  cleanupDeps(this);
555
565
  activeSub = prevEffect;
556
566
  shouldTrack = prevShouldTrack;
557
- this.flags &= ~2;
567
+ this.flags &= -3;
558
568
  }
559
569
  }
560
570
  stop() {
@@ -565,7 +575,7 @@ class ReactiveEffect {
565
575
  this.deps = this.depsTail = void 0;
566
576
  cleanupEffect(this);
567
577
  this.onStop && this.onStop();
568
- this.flags &= ~1;
578
+ this.flags &= -2;
569
579
  }
570
580
  }
571
581
  trigger() {
@@ -615,7 +625,7 @@ function endBatch() {
615
625
  while (e) {
616
626
  const next = e.next;
617
627
  e.next = void 0;
618
- e.flags &= ~8;
628
+ e.flags &= -9;
619
629
  e = next;
620
630
  }
621
631
  }
@@ -626,7 +636,7 @@ function endBatch() {
626
636
  while (e) {
627
637
  const next = e.next;
628
638
  e.next = void 0;
629
- e.flags &= ~8;
639
+ e.flags &= -9;
630
640
  if (e.flags & 1) {
631
641
  try {
632
642
  ;
@@ -682,17 +692,16 @@ function refreshComputed(computed) {
682
692
  if (computed.flags & 4 && !(computed.flags & 16)) {
683
693
  return;
684
694
  }
685
- computed.flags &= ~16;
695
+ computed.flags &= -17;
686
696
  if (computed.globalVersion === globalVersion) {
687
697
  return;
688
698
  }
689
699
  computed.globalVersion = globalVersion;
690
- const dep = computed.dep;
691
- computed.flags |= 2;
692
- if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
693
- computed.flags &= ~2;
700
+ if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
694
701
  return;
695
702
  }
703
+ computed.flags |= 2;
704
+ const dep = computed.dep;
696
705
  const prevSub = activeSub;
697
706
  const prevShouldTrack = shouldTrack;
698
707
  activeSub = computed;
@@ -701,6 +710,7 @@ function refreshComputed(computed) {
701
710
  prepareDeps(computed);
702
711
  const value = computed.fn(computed._value);
703
712
  if (dep.version === 0 || hasChanged(value, computed._value)) {
713
+ computed.flags |= 128;
704
714
  computed._value = value;
705
715
  dep.version++;
706
716
  }
@@ -711,7 +721,7 @@ function refreshComputed(computed) {
711
721
  activeSub = prevSub;
712
722
  shouldTrack = prevShouldTrack;
713
723
  cleanupDeps(computed);
714
- computed.flags &= ~2;
724
+ computed.flags &= -3;
715
725
  }
716
726
  }
717
727
  function removeSub(link, soft = false) {
@@ -727,7 +737,7 @@ function removeSub(link, soft = false) {
727
737
  if (dep.subs === link) {
728
738
  dep.subs = prevSub;
729
739
  if (!prevSub && dep.computed) {
730
- dep.computed.flags &= ~4;
740
+ dep.computed.flags &= -5;
731
741
  for (let l = dep.computed.deps; l; l = l.nextDep) {
732
742
  removeSub(l, true);
733
743
  }
@@ -1578,14 +1588,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1578
1588
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1579
1589
  return target;
1580
1590
  }
1581
- const existingProxy = proxyMap.get(target);
1582
- if (existingProxy) {
1583
- return existingProxy;
1584
- }
1585
1591
  const targetType = getTargetType(target);
1586
1592
  if (targetType === 0 /* INVALID */) {
1587
1593
  return target;
1588
1594
  }
1595
+ const existingProxy = proxyMap.get(target);
1596
+ if (existingProxy) {
1597
+ return existingProxy;
1598
+ }
1589
1599
  const proxy = new Proxy(
1590
1600
  target,
1591
1601
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2248,11 +2258,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2248
2258
  queue.splice(i, 1);
2249
2259
  i--;
2250
2260
  if (cb.flags & 4) {
2251
- cb.flags &= ~1;
2261
+ cb.flags &= -2;
2252
2262
  }
2253
2263
  cb();
2254
2264
  if (!(cb.flags & 4)) {
2255
- cb.flags &= ~1;
2265
+ cb.flags &= -2;
2256
2266
  }
2257
2267
  }
2258
2268
  }
@@ -2271,10 +2281,10 @@ function flushPostFlushCbs(seen) {
2271
2281
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2272
2282
  const cb = activePostFlushCbs[postFlushIndex];
2273
2283
  if (cb.flags & 4) {
2274
- cb.flags &= ~1;
2284
+ cb.flags &= -2;
2275
2285
  }
2276
2286
  if (!(cb.flags & 8)) cb();
2277
- cb.flags &= ~1;
2287
+ cb.flags &= -2;
2278
2288
  }
2279
2289
  activePostFlushCbs = null;
2280
2290
  postFlushIndex = 0;
@@ -2304,7 +2314,7 @@ function flushJobs(seen) {
2304
2314
  for (; flushIndex < queue.length; flushIndex++) {
2305
2315
  const job = queue[flushIndex];
2306
2316
  if (job) {
2307
- job.flags &= ~1;
2317
+ job.flags &= -2;
2308
2318
  }
2309
2319
  }
2310
2320
  flushIndex = -1;
@@ -3294,6 +3304,9 @@ function getInnerChild$1(vnode) {
3294
3304
  }
3295
3305
  return vnode;
3296
3306
  }
3307
+ if (vnode.component) {
3308
+ return vnode.component.subTree;
3309
+ }
3297
3310
  const { shapeFlag, children } = vnode;
3298
3311
  if (children) {
3299
3312
  if (shapeFlag & 16) {
@@ -4324,7 +4337,7 @@ const KeepAliveImpl = {
4324
4337
  );
4325
4338
  const { include, exclude, max } = props;
4326
4339
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4327
- vnode.shapeFlag &= ~256;
4340
+ vnode.shapeFlag &= -257;
4328
4341
  current = vnode;
4329
4342
  return rawVNode;
4330
4343
  }
@@ -4415,8 +4428,8 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4415
4428
  }, target);
4416
4429
  }
4417
4430
  function resetShapeFlag(vnode) {
4418
- vnode.shapeFlag &= ~256;
4419
- vnode.shapeFlag &= ~512;
4431
+ vnode.shapeFlag &= -257;
4432
+ vnode.shapeFlag &= -513;
4420
4433
  }
4421
4434
  function getInnerChild(vnode) {
4422
4435
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@@ -4804,14 +4817,16 @@ function renderList(source, renderItem, cache, index) {
4804
4817
  if (sourceIsArray || isString(source)) {
4805
4818
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
4806
4819
  let needsWrap = false;
4820
+ let isReadonlySource = false;
4807
4821
  if (sourceIsReactiveArray) {
4808
4822
  needsWrap = !isShallow(source);
4823
+ isReadonlySource = isReadonly(source);
4809
4824
  source = shallowReadArray(source);
4810
4825
  }
4811
4826
  ret = new Array(source.length);
4812
4827
  for (let i = 0, l = source.length; i < l; i++) {
4813
4828
  ret[i] = renderItem(
4814
- needsWrap ? toReactive(source[i]) : source[i],
4829
+ needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
4815
4830
  i,
4816
4831
  void 0,
4817
4832
  cached && cached[i]
@@ -5801,7 +5816,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5801
5816
  return vm;
5802
5817
  }
5803
5818
  }
5804
- Vue.version = `2.6.14-compat:${"3.5.13"}`;
5819
+ Vue.version = `2.6.14-compat:${"3.5.14"}`;
5805
5820
  Vue.config = singletonApp.config;
5806
5821
  Vue.use = (plugin, ...options) => {
5807
5822
  if (plugin && isFunction(plugin.install)) {
@@ -6672,7 +6687,7 @@ const normalizeVNodeSlots = (instance, children) => {
6672
6687
  };
6673
6688
  const assignSlots = (slots, children, optimized) => {
6674
6689
  for (const key in children) {
6675
- if (optimized || key !== "_") {
6690
+ if (optimized || !isInternalKey(key)) {
6676
6691
  slots[key] = children[key];
6677
6692
  }
6678
6693
  }
@@ -7783,7 +7798,13 @@ function baseCreateRenderer(options, createHydrationFns) {
7783
7798
  queuePostRenderEffect(() => transition.enter(el), parentSuspense);
7784
7799
  } else {
7785
7800
  const { leave, delayLeave, afterLeave } = transition;
7786
- const remove2 = () => hostInsert(el, container, anchor);
7801
+ const remove2 = () => {
7802
+ if (vnode.ctx.isUnmounted) {
7803
+ hostRemove(el);
7804
+ } else {
7805
+ hostInsert(el, container, anchor);
7806
+ }
7807
+ };
7787
7808
  const performLeave = () => {
7788
7809
  leave(el, () => {
7789
7810
  remove2();
@@ -7816,7 +7837,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7816
7837
  optimized = false;
7817
7838
  }
7818
7839
  if (ref != null) {
7840
+ pauseTracking();
7819
7841
  setRef(ref, null, parentSuspense, vnode, true);
7842
+ resetTracking();
7820
7843
  }
7821
7844
  if (cacheIndex != null) {
7822
7845
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -7917,12 +7940,27 @@ function baseCreateRenderer(options, createHydrationFns) {
7917
7940
  hostRemove(end);
7918
7941
  };
7919
7942
  const unmountComponent = (instance, parentSuspense, doRemove) => {
7920
- const { bum, scope, job, subTree, um, m, a } = instance;
7943
+ const {
7944
+ bum,
7945
+ scope,
7946
+ job,
7947
+ subTree,
7948
+ um,
7949
+ m,
7950
+ a,
7951
+ parent,
7952
+ slots: { __: slotCacheKeys }
7953
+ } = instance;
7921
7954
  invalidateMount(m);
7922
7955
  invalidateMount(a);
7923
7956
  if (bum) {
7924
7957
  invokeArrayFns(bum);
7925
7958
  }
7959
+ if (parent && isArray(slotCacheKeys)) {
7960
+ slotCacheKeys.forEach((v) => {
7961
+ parent.renderCache[v] = void 0;
7962
+ });
7963
+ }
7926
7964
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7927
7965
  instance.emit("hook:beforeDestroy");
7928
7966
  }
@@ -8024,8 +8062,8 @@ function toggleRecurse({ effect, job }, allowed) {
8024
8062
  effect.flags |= 32;
8025
8063
  job.flags |= 4;
8026
8064
  } else {
8027
- effect.flags &= ~32;
8028
- job.flags &= ~4;
8065
+ effect.flags &= -33;
8066
+ job.flags &= -5;
8029
8067
  }
8030
8068
  }
8031
8069
  function needTransition(parentSuspense, transition) {
@@ -8049,6 +8087,9 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8049
8087
  if (c2.type === Text) {
8050
8088
  c2.el = c1.el;
8051
8089
  }
8090
+ if (c2.type === Comment && !c2.el) {
8091
+ c2.el = c1.el;
8092
+ }
8052
8093
  }
8053
8094
  }
8054
8095
  }
@@ -9712,7 +9753,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
9712
9753
  const { props, children } = instance.vnode;
9713
9754
  const isStateful = isStatefulComponent(instance);
9714
9755
  initProps(instance, props, isStateful, isSSR);
9715
- initSlots(instance, children, optimized);
9756
+ initSlots(instance, children, optimized || isSSR);
9716
9757
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
9717
9758
  isSSR && setInSSRSetupState(false);
9718
9759
  return setupResult;
@@ -9930,7 +9971,7 @@ function isMemoSame(cached, memo) {
9930
9971
  return true;
9931
9972
  }
9932
9973
 
9933
- const version = "3.5.13";
9974
+ const version = "3.5.14";
9934
9975
  const warn$1 = NOOP;
9935
9976
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9936
9977
  const devtools = void 0;
@@ -10733,7 +10774,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
10733
10774
  }
10734
10775
  return false;
10735
10776
  }
10736
- if (key === "spellcheck" || key === "draggable" || key === "translate") {
10777
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
10737
10778
  return false;
10738
10779
  }
10739
10780
  if (key === "form") {
@@ -11163,6 +11204,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11163
11204
  instance.vnode.el,
11164
11205
  moveClass
11165
11206
  )) {
11207
+ prevChildren = [];
11166
11208
  return;
11167
11209
  }
11168
11210
  prevChildren.forEach(callPendingCbs);
@@ -11186,6 +11228,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11186
11228
  };
11187
11229
  el.addEventListener("transitionend", cb);
11188
11230
  });
11231
+ prevChildren = [];
11189
11232
  });
11190
11233
  return () => {
11191
11234
  const rawProps = toRaw(props);
@@ -13365,7 +13408,7 @@ function isReferenced(node, parent, grandparent) {
13365
13408
  if (parent.key === node) {
13366
13409
  return !!parent.computed;
13367
13410
  }
13368
- return !grandparent;
13411
+ return true;
13369
13412
  // no: class { NODE = value; }
13370
13413
  // yes: class { [NODE] = value; }
13371
13414
  // yes: class { key = NODE; }
@@ -13984,7 +14027,7 @@ const tokenizer = new Tokenizer(stack, {
13984
14027
  "COMPILER_V_BIND_SYNC",
13985
14028
  currentOptions,
13986
14029
  currentProp.loc,
13987
- currentProp.rawName
14030
+ currentProp.arg.loc.source
13988
14031
  )) {
13989
14032
  currentProp.name = "model";
13990
14033
  currentProp.modifiers.splice(syncIndex, 1);
@@ -14539,6 +14582,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14539
14582
  }
14540
14583
  }
14541
14584
  let cachedAsArray = false;
14585
+ const slotCacheKeys = [];
14542
14586
  if (toCache.length === children.length && node.type === 1) {
14543
14587
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14544
14588
  node.codegenNode.children = getCacheExpression(
@@ -14548,6 +14592,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14548
14592
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14549
14593
  const slot = getSlotNode(node.codegenNode, "default");
14550
14594
  if (slot) {
14595
+ slotCacheKeys.push(context.cached.length);
14551
14596
  slot.returns = getCacheExpression(
14552
14597
  createArrayExpression(slot.returns)
14553
14598
  );
@@ -14557,6 +14602,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14557
14602
  const slotName = findDir(node, "slot", true);
14558
14603
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
14559
14604
  if (slot) {
14605
+ slotCacheKeys.push(context.cached.length);
14560
14606
  slot.returns = getCacheExpression(
14561
14607
  createArrayExpression(slot.returns)
14562
14608
  );
@@ -14566,9 +14612,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14566
14612
  }
14567
14613
  if (!cachedAsArray) {
14568
14614
  for (const child of toCache) {
14615
+ slotCacheKeys.push(context.cached.length);
14569
14616
  child.codegenNode = context.cache(child.codegenNode);
14570
14617
  }
14571
14618
  }
14619
+ 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) {
14620
+ node.codegenNode.children.properties.push(
14621
+ createObjectProperty(
14622
+ `__`,
14623
+ createSimpleExpression(JSON.stringify(slotCacheKeys), false)
14624
+ )
14625
+ );
14626
+ }
14572
14627
  function getCacheExpression(value) {
14573
14628
  const exp = context.cache(value);
14574
14629
  if (inFor && context.hmr) {