@vue/compat 3.5.12 → 3.5.13

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.12
2
+ * @vue/compat v3.5.13
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -212,10 +212,9 @@ function parseStringStyle(cssText) {
212
212
  return ret;
213
213
  }
214
214
  function stringifyStyle(styles) {
215
+ if (!styles) return "";
216
+ if (isString(styles)) return styles;
215
217
  let ret = "";
216
- if (!styles || isString(styles)) {
217
- return ret;
218
- }
219
218
  for (const key in styles) {
220
219
  const value = styles[key];
221
220
  if (isString(value) || typeof value === "number") {
@@ -478,17 +477,21 @@ class EffectScope {
478
477
  }
479
478
  stop(fromParent) {
480
479
  if (this._active) {
480
+ this._active = false;
481
481
  let i, l;
482
482
  for (i = 0, l = this.effects.length; i < l; i++) {
483
483
  this.effects[i].stop();
484
484
  }
485
+ this.effects.length = 0;
485
486
  for (i = 0, l = this.cleanups.length; i < l; i++) {
486
487
  this.cleanups[i]();
487
488
  }
489
+ this.cleanups.length = 0;
488
490
  if (this.scopes) {
489
491
  for (i = 0, l = this.scopes.length; i < l; i++) {
490
492
  this.scopes[i].stop(true);
491
493
  }
494
+ this.scopes.length = 0;
492
495
  }
493
496
  if (!this.detached && this.parent && !fromParent) {
494
497
  const last = this.parent.scopes.pop();
@@ -498,7 +501,6 @@ class EffectScope {
498
501
  }
499
502
  }
500
503
  this.parent = void 0;
501
- this._active = false;
502
504
  }
503
505
  }
504
506
  }
@@ -1264,6 +1266,7 @@ class BaseReactiveHandler {
1264
1266
  this._isShallow = _isShallow;
1265
1267
  }
1266
1268
  get(target, key, receiver) {
1269
+ if (key === "__v_skip") return target["__v_skip"];
1267
1270
  const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
1268
1271
  if (key === "__v_isReactive") {
1269
1272
  return !isReadonly2;
@@ -2100,7 +2103,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2100
2103
  const scope = getCurrentScope();
2101
2104
  const watchHandle = () => {
2102
2105
  effect.stop();
2103
- if (scope) {
2106
+ if (scope && scope.active) {
2104
2107
  remove(scope.effects, effect);
2105
2108
  }
2106
2109
  };
@@ -3588,11 +3591,32 @@ const TeleportImpl = {
3588
3591
  updateCssVars(n2, true);
3589
3592
  }
3590
3593
  if (isTeleportDeferred(n2.props)) {
3591
- queuePostRenderEffect(mountToTarget, parentSuspense);
3594
+ queuePostRenderEffect(() => {
3595
+ mountToTarget();
3596
+ n2.el.__isMounted = true;
3597
+ }, parentSuspense);
3592
3598
  } else {
3593
3599
  mountToTarget();
3594
3600
  }
3595
3601
  } else {
3602
+ if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
3603
+ queuePostRenderEffect(() => {
3604
+ TeleportImpl.process(
3605
+ n1,
3606
+ n2,
3607
+ container,
3608
+ anchor,
3609
+ parentComponent,
3610
+ parentSuspense,
3611
+ namespace,
3612
+ slotScopeIds,
3613
+ optimized,
3614
+ internals
3615
+ );
3616
+ delete n1.el.__isMounted;
3617
+ }, parentSuspense);
3618
+ return;
3619
+ }
3596
3620
  n2.el = n1.el;
3597
3621
  n2.targetStart = n1.targetStart;
3598
3622
  const mainAnchor = n2.anchor = n1.anchor;
@@ -3898,10 +3922,9 @@ const BaseTransitionImpl = {
3898
3922
  if (innerChild.type !== Comment) {
3899
3923
  setTransitionHooks(innerChild, enterHooks);
3900
3924
  }
3901
- const oldChild = instance.subTree;
3902
- const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3925
+ let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3903
3926
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3904
- const leavingHooks = resolveTransitionHooks(
3927
+ let leavingHooks = resolveTransitionHooks(
3905
3928
  oldInnerChild,
3906
3929
  rawProps,
3907
3930
  state,
@@ -3916,6 +3939,7 @@ const BaseTransitionImpl = {
3916
3939
  instance.update();
3917
3940
  }
3918
3941
  delete leavingHooks.afterLeave;
3942
+ oldInnerChild = void 0;
3919
3943
  };
3920
3944
  return emptyPlaceholder(child);
3921
3945
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3929,10 +3953,19 @@ const BaseTransitionImpl = {
3929
3953
  earlyRemove();
3930
3954
  el[leaveCbKey] = void 0;
3931
3955
  delete enterHooks.delayedLeave;
3956
+ oldInnerChild = void 0;
3957
+ };
3958
+ enterHooks.delayedLeave = () => {
3959
+ delayedLeave();
3960
+ delete enterHooks.delayedLeave;
3961
+ oldInnerChild = void 0;
3932
3962
  };
3933
- enterHooks.delayedLeave = delayedLeave;
3934
3963
  };
3964
+ } else {
3965
+ oldInnerChild = void 0;
3935
3966
  }
3967
+ } else if (oldInnerChild) {
3968
+ oldInnerChild = void 0;
3936
3969
  }
3937
3970
  return child;
3938
3971
  };
@@ -4240,6 +4273,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4240
4273
  return;
4241
4274
  }
4242
4275
  if (isAsyncWrapper(vnode) && !isUnmount) {
4276
+ if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
4277
+ setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
4278
+ }
4243
4279
  return;
4244
4280
  }
4245
4281
  const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
@@ -4504,7 +4540,7 @@ function createHydrationFunctions(rendererInternals) {
4504
4540
  getContainerType(container),
4505
4541
  optimized
4506
4542
  );
4507
- if (isAsyncWrapper(vnode)) {
4543
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4508
4544
  let subTree;
4509
4545
  if (isFragmentStart) {
4510
4546
  subTree = createVNode(Fragment);
@@ -4773,6 +4809,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4773
4809
  getContainerType(container),
4774
4810
  slotScopeIds
4775
4811
  );
4812
+ if (parentComponent) {
4813
+ parentComponent.vnode.el = vnode.el;
4814
+ updateHOCHostEl(parentComponent, vnode.el);
4815
+ }
4776
4816
  return next;
4777
4817
  };
4778
4818
  const locateClosingAnchor = (node, open = "[", close = "]") => {
@@ -7128,7 +7168,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7128
7168
  return vm;
7129
7169
  }
7130
7170
  }
7131
- Vue.version = `2.6.14-compat:${"3.5.12"}`;
7171
+ Vue.version = `2.6.14-compat:${"3.5.13"}`;
7132
7172
  Vue.config = singletonApp.config;
7133
7173
  Vue.use = (plugin, ...options) => {
7134
7174
  if (plugin && isFunction(plugin.install)) {
@@ -10343,7 +10383,7 @@ function renderComponentRoot(instance) {
10343
10383
  }
10344
10384
  if (extraAttrs.length) {
10345
10385
  warn$1(
10346
- `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
10386
+ `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
10347
10387
  );
10348
10388
  }
10349
10389
  if (eventAttrs.length) {
@@ -11204,9 +11244,9 @@ function closeBlock() {
11204
11244
  currentBlock = blockStack[blockStack.length - 1] || null;
11205
11245
  }
11206
11246
  let isBlockTreeEnabled = 1;
11207
- function setBlockTracking(value) {
11247
+ function setBlockTracking(value, inVOnce = false) {
11208
11248
  isBlockTreeEnabled += value;
11209
- if (value < 0 && currentBlock) {
11249
+ if (value < 0 && currentBlock && inVOnce) {
11210
11250
  currentBlock.hasOnce = true;
11211
11251
  }
11212
11252
  }
@@ -12252,7 +12292,7 @@ function isMemoSame(cached, memo) {
12252
12292
  return true;
12253
12293
  }
12254
12294
 
12255
- const version = "3.5.12";
12295
+ const version = "3.5.13";
12256
12296
  const warn = warn$1 ;
12257
12297
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12258
12298
  const devtools = devtools$1 ;
@@ -12462,7 +12502,8 @@ function resolveTransitionProps(rawProps) {
12462
12502
  onAppear = onEnter,
12463
12503
  onAppearCancelled = onEnterCancelled
12464
12504
  } = baseProps;
12465
- const finishEnter = (el, isAppear, done) => {
12505
+ const finishEnter = (el, isAppear, done, isCancelled) => {
12506
+ el._enterCancelled = isCancelled;
12466
12507
  removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
12467
12508
  removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
12468
12509
  done && done();
@@ -12520,8 +12561,13 @@ function resolveTransitionProps(rawProps) {
12520
12561
  if (legacyClassEnabled && legacyLeaveFromClass) {
12521
12562
  addTransitionClass(el, legacyLeaveFromClass);
12522
12563
  }
12523
- addTransitionClass(el, leaveActiveClass);
12524
- forceReflow();
12564
+ if (!el._enterCancelled) {
12565
+ forceReflow();
12566
+ addTransitionClass(el, leaveActiveClass);
12567
+ } else {
12568
+ addTransitionClass(el, leaveActiveClass);
12569
+ forceReflow();
12570
+ }
12525
12571
  nextFrame(() => {
12526
12572
  if (!el._isLeaving) {
12527
12573
  return;
@@ -12538,11 +12584,11 @@ function resolveTransitionProps(rawProps) {
12538
12584
  callHook(onLeave, [el, resolve]);
12539
12585
  },
12540
12586
  onEnterCancelled(el) {
12541
- finishEnter(el, false);
12587
+ finishEnter(el, false, void 0, true);
12542
12588
  callHook(onEnterCancelled, [el]);
12543
12589
  },
12544
12590
  onAppearCancelled(el) {
12545
- finishEnter(el, true);
12591
+ finishEnter(el, true, void 0, true);
12546
12592
  callHook(onAppearCancelled, [el]);
12547
12593
  },
12548
12594
  onLeaveCancelled(el) {
@@ -12762,10 +12808,11 @@ function useCssVars(getter) {
12762
12808
  }
12763
12809
  updateTeleports(vars);
12764
12810
  };
12765
- onBeforeMount(() => {
12766
- watchPostEffect(setVars);
12811
+ onBeforeUpdate(() => {
12812
+ queuePostFlushCb(setVars);
12767
12813
  });
12768
12814
  onMounted(() => {
12815
+ watch(setVars, NOOP, { flush: "post" });
12769
12816
  const ob = new MutationObserver(setVars);
12770
12817
  ob.observe(instance.subTree.el.parentNode, { childList: true });
12771
12818
  onUnmounted(() => ob.disconnect());
@@ -13416,6 +13463,8 @@ class VueElement extends BaseClass {
13416
13463
  this._update();
13417
13464
  }
13418
13465
  if (shouldReflect) {
13466
+ const ob = this._ob;
13467
+ ob && ob.disconnect();
13419
13468
  if (val === true) {
13420
13469
  this.setAttribute(hyphenate(key), "");
13421
13470
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13423,6 +13472,7 @@ class VueElement extends BaseClass {
13423
13472
  } else if (!val) {
13424
13473
  this.removeAttribute(hyphenate(key));
13425
13474
  }
13475
+ ob && ob.observe(this, { attributes: true });
13426
13476
  }
13427
13477
  }
13428
13478
  }
@@ -14698,12 +14748,13 @@ function createConditionalExpression(test, consequent, alternate, newline = true
14698
14748
  loc: locStub
14699
14749
  };
14700
14750
  }
14701
- function createCacheExpression(index, value, needPauseTracking = false) {
14751
+ function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
14702
14752
  return {
14703
14753
  type: 20,
14704
14754
  index,
14705
14755
  value,
14706
14756
  needPauseTracking,
14757
+ inVOnce,
14707
14758
  needArraySpread: false,
14708
14759
  loc: locStub
14709
14760
  };
@@ -17087,11 +17138,12 @@ function createTransformContext(root, {
17087
17138
  identifier.hoisted = exp;
17088
17139
  return identifier;
17089
17140
  },
17090
- cache(exp, isVNode = false) {
17141
+ cache(exp, isVNode = false, inVOnce = false) {
17091
17142
  const cacheExp = createCacheExpression(
17092
17143
  context.cached.length,
17093
17144
  exp,
17094
- isVNode
17145
+ isVNode,
17146
+ inVOnce
17095
17147
  );
17096
17148
  context.cached.push(cacheExp);
17097
17149
  return cacheExp;
@@ -17804,7 +17856,9 @@ function genCacheExpression(node, context) {
17804
17856
  push(`_cache[${node.index}] || (`);
17805
17857
  if (needPauseTracking) {
17806
17858
  indent();
17807
- push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
17859
+ push(`${helper(SET_BLOCK_TRACKING)}(-1`);
17860
+ if (node.inVOnce) push(`, true`);
17861
+ push(`),`);
17808
17862
  newline();
17809
17863
  push(`(`);
17810
17864
  }
@@ -17861,12 +17915,14 @@ const transformExpression = (node, context) => {
17861
17915
  context
17862
17916
  );
17863
17917
  } else if (node.type === 1) {
17918
+ const memo = findDir(node, "memo");
17864
17919
  for (let i = 0; i < node.props.length; i++) {
17865
17920
  const dir = node.props[i];
17866
17921
  if (dir.type === 7 && dir.name !== "for") {
17867
17922
  const exp = dir.exp;
17868
17923
  const arg = dir.arg;
17869
- if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
17924
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
17925
+ !(memo && arg && arg.type === 4 && arg.content === "key")) {
17870
17926
  dir.exp = processExpression(
17871
17927
  exp,
17872
17928
  context,
@@ -18194,10 +18250,11 @@ const transformFor = createStructuralDirectiveTransform(
18194
18250
  const isTemplate = isTemplateNode(node);
18195
18251
  const memo = findDir(node, "memo");
18196
18252
  const keyProp = findProp(node, `key`, false, true);
18197
- if (keyProp && keyProp.type === 7 && !keyProp.exp) {
18253
+ const isDirKey = keyProp && keyProp.type === 7;
18254
+ if (isDirKey && !keyProp.exp) {
18198
18255
  transformBindShorthand(keyProp);
18199
18256
  }
18200
- const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18257
+ let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18201
18258
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18202
18259
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
18203
18260
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
@@ -19436,8 +19493,8 @@ const transformOnce = (node, context) => {
19436
19493
  if (cur.codegenNode) {
19437
19494
  cur.codegenNode = context.cache(
19438
19495
  cur.codegenNode,
19496
+ true,
19439
19497
  true
19440
- /* isVNode */
19441
19498
  );
19442
19499
  }
19443
19500
  };