@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
  }
@@ -1268,6 +1270,7 @@ class BaseReactiveHandler {
1268
1270
  this._isShallow = _isShallow;
1269
1271
  }
1270
1272
  get(target, key, receiver) {
1273
+ if (key === "__v_skip") return target["__v_skip"];
1271
1274
  const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
1272
1275
  if (key === "__v_isReactive") {
1273
1276
  return !isReadonly2;
@@ -2110,7 +2113,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2110
2113
  const scope = getCurrentScope();
2111
2114
  const watchHandle = () => {
2112
2115
  effect.stop();
2113
- if (scope) {
2116
+ if (scope && scope.active) {
2114
2117
  remove(scope.effects, effect);
2115
2118
  }
2116
2119
  };
@@ -3606,11 +3609,32 @@ const TeleportImpl = {
3606
3609
  updateCssVars(n2, true);
3607
3610
  }
3608
3611
  if (isTeleportDeferred(n2.props)) {
3609
- queuePostRenderEffect(mountToTarget, parentSuspense);
3612
+ queuePostRenderEffect(() => {
3613
+ mountToTarget();
3614
+ n2.el.__isMounted = true;
3615
+ }, parentSuspense);
3610
3616
  } else {
3611
3617
  mountToTarget();
3612
3618
  }
3613
3619
  } else {
3620
+ if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
3621
+ queuePostRenderEffect(() => {
3622
+ TeleportImpl.process(
3623
+ n1,
3624
+ n2,
3625
+ container,
3626
+ anchor,
3627
+ parentComponent,
3628
+ parentSuspense,
3629
+ namespace,
3630
+ slotScopeIds,
3631
+ optimized,
3632
+ internals
3633
+ );
3634
+ delete n1.el.__isMounted;
3635
+ }, parentSuspense);
3636
+ return;
3637
+ }
3614
3638
  n2.el = n1.el;
3615
3639
  n2.targetStart = n1.targetStart;
3616
3640
  const mainAnchor = n2.anchor = n1.anchor;
@@ -3916,10 +3940,9 @@ const BaseTransitionImpl = {
3916
3940
  if (innerChild.type !== Comment) {
3917
3941
  setTransitionHooks(innerChild, enterHooks);
3918
3942
  }
3919
- const oldChild = instance.subTree;
3920
- const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3943
+ let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3921
3944
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3922
- const leavingHooks = resolveTransitionHooks(
3945
+ let leavingHooks = resolveTransitionHooks(
3923
3946
  oldInnerChild,
3924
3947
  rawProps,
3925
3948
  state,
@@ -3934,6 +3957,7 @@ const BaseTransitionImpl = {
3934
3957
  instance.update();
3935
3958
  }
3936
3959
  delete leavingHooks.afterLeave;
3960
+ oldInnerChild = void 0;
3937
3961
  };
3938
3962
  return emptyPlaceholder(child);
3939
3963
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3947,10 +3971,19 @@ const BaseTransitionImpl = {
3947
3971
  earlyRemove();
3948
3972
  el[leaveCbKey] = void 0;
3949
3973
  delete enterHooks.delayedLeave;
3974
+ oldInnerChild = void 0;
3975
+ };
3976
+ enterHooks.delayedLeave = () => {
3977
+ delayedLeave();
3978
+ delete enterHooks.delayedLeave;
3979
+ oldInnerChild = void 0;
3950
3980
  };
3951
- enterHooks.delayedLeave = delayedLeave;
3952
3981
  };
3982
+ } else {
3983
+ oldInnerChild = void 0;
3953
3984
  }
3985
+ } else if (oldInnerChild) {
3986
+ oldInnerChild = void 0;
3954
3987
  }
3955
3988
  return child;
3956
3989
  };
@@ -4259,6 +4292,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4259
4292
  return;
4260
4293
  }
4261
4294
  if (isAsyncWrapper(vnode) && !isUnmount) {
4295
+ if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
4296
+ setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
4297
+ }
4262
4298
  return;
4263
4299
  }
4264
4300
  const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
@@ -4523,7 +4559,7 @@ function createHydrationFunctions(rendererInternals) {
4523
4559
  getContainerType(container),
4524
4560
  optimized
4525
4561
  );
4526
- if (isAsyncWrapper(vnode)) {
4562
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4527
4563
  let subTree;
4528
4564
  if (isFragmentStart) {
4529
4565
  subTree = createVNode(Fragment);
@@ -4803,6 +4839,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4803
4839
  getContainerType(container),
4804
4840
  slotScopeIds
4805
4841
  );
4842
+ if (parentComponent) {
4843
+ parentComponent.vnode.el = vnode.el;
4844
+ updateHOCHostEl(parentComponent, vnode.el);
4845
+ }
4806
4846
  return next;
4807
4847
  };
4808
4848
  const locateClosingAnchor = (node, open = "[", close = "]") => {
@@ -7160,7 +7200,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7160
7200
  return vm;
7161
7201
  }
7162
7202
  }
7163
- Vue.version = `2.6.14-compat:${"3.5.12"}`;
7203
+ Vue.version = `2.6.14-compat:${"3.5.13"}`;
7164
7204
  Vue.config = singletonApp.config;
7165
7205
  Vue.use = (plugin, ...options) => {
7166
7206
  if (plugin && isFunction(plugin.install)) {
@@ -10415,7 +10455,7 @@ function renderComponentRoot(instance) {
10415
10455
  }
10416
10456
  if (extraAttrs.length) {
10417
10457
  warn$1(
10418
- `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
10458
+ `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.`
10419
10459
  );
10420
10460
  }
10421
10461
  if (eventAttrs.length) {
@@ -11276,9 +11316,9 @@ function closeBlock() {
11276
11316
  currentBlock = blockStack[blockStack.length - 1] || null;
11277
11317
  }
11278
11318
  let isBlockTreeEnabled = 1;
11279
- function setBlockTracking(value) {
11319
+ function setBlockTracking(value, inVOnce = false) {
11280
11320
  isBlockTreeEnabled += value;
11281
- if (value < 0 && currentBlock) {
11321
+ if (value < 0 && currentBlock && inVOnce) {
11282
11322
  currentBlock.hasOnce = true;
11283
11323
  }
11284
11324
  }
@@ -11923,7 +11963,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
11923
11963
  }
11924
11964
  if (!instance.render) {
11925
11965
  if (!isSSR && compile$1 && !Component.render) {
11926
- const template = instance.vnode.props && instance.vnode.props["inline-template"] || Component.template || resolveMergedOptions(instance).template;
11966
+ const template = instance.vnode.props && instance.vnode.props["inline-template"] || Component.template || __VUE_OPTIONS_API__ && resolveMergedOptions(instance).template;
11927
11967
  if (template) {
11928
11968
  if (!!(process.env.NODE_ENV !== "production")) {
11929
11969
  startMeasure(instance, `compile`);
@@ -12338,7 +12378,7 @@ function isMemoSame(cached, memo) {
12338
12378
  return true;
12339
12379
  }
12340
12380
 
12341
- const version = "3.5.12";
12381
+ const version = "3.5.13";
12342
12382
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12343
12383
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12344
12384
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12548,7 +12588,8 @@ function resolveTransitionProps(rawProps) {
12548
12588
  onAppear = onEnter,
12549
12589
  onAppearCancelled = onEnterCancelled
12550
12590
  } = baseProps;
12551
- const finishEnter = (el, isAppear, done) => {
12591
+ const finishEnter = (el, isAppear, done, isCancelled) => {
12592
+ el._enterCancelled = isCancelled;
12552
12593
  removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
12553
12594
  removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
12554
12595
  done && done();
@@ -12606,8 +12647,13 @@ function resolveTransitionProps(rawProps) {
12606
12647
  if (legacyClassEnabled && legacyLeaveFromClass) {
12607
12648
  addTransitionClass(el, legacyLeaveFromClass);
12608
12649
  }
12609
- addTransitionClass(el, leaveActiveClass);
12610
- forceReflow();
12650
+ if (!el._enterCancelled) {
12651
+ forceReflow();
12652
+ addTransitionClass(el, leaveActiveClass);
12653
+ } else {
12654
+ addTransitionClass(el, leaveActiveClass);
12655
+ forceReflow();
12656
+ }
12611
12657
  nextFrame(() => {
12612
12658
  if (!el._isLeaving) {
12613
12659
  return;
@@ -12624,11 +12670,11 @@ function resolveTransitionProps(rawProps) {
12624
12670
  callHook(onLeave, [el, resolve]);
12625
12671
  },
12626
12672
  onEnterCancelled(el) {
12627
- finishEnter(el, false);
12673
+ finishEnter(el, false, void 0, true);
12628
12674
  callHook(onEnterCancelled, [el]);
12629
12675
  },
12630
12676
  onAppearCancelled(el) {
12631
- finishEnter(el, true);
12677
+ finishEnter(el, true, void 0, true);
12632
12678
  callHook(onAppearCancelled, [el]);
12633
12679
  },
12634
12680
  onLeaveCancelled(el) {
@@ -12848,10 +12894,11 @@ function useCssVars(getter) {
12848
12894
  }
12849
12895
  updateTeleports(vars);
12850
12896
  };
12851
- onBeforeMount(() => {
12852
- watchPostEffect(setVars);
12897
+ onBeforeUpdate(() => {
12898
+ queuePostFlushCb(setVars);
12853
12899
  });
12854
12900
  onMounted(() => {
12901
+ watch(setVars, NOOP, { flush: "post" });
12855
12902
  const ob = new MutationObserver(setVars);
12856
12903
  ob.observe(instance.subTree.el.parentNode, { childList: true });
12857
12904
  onUnmounted(() => ob.disconnect());
@@ -13502,6 +13549,8 @@ class VueElement extends BaseClass {
13502
13549
  this._update();
13503
13550
  }
13504
13551
  if (shouldReflect) {
13552
+ const ob = this._ob;
13553
+ ob && ob.disconnect();
13505
13554
  if (val === true) {
13506
13555
  this.setAttribute(hyphenate(key), "");
13507
13556
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13509,6 +13558,7 @@ class VueElement extends BaseClass {
13509
13558
  } else if (!val) {
13510
13559
  this.removeAttribute(hyphenate(key));
13511
13560
  }
13561
+ ob && ob.observe(this, { attributes: true });
13512
13562
  }
13513
13563
  }
13514
13564
  }
@@ -14778,12 +14828,13 @@ function createConditionalExpression(test, consequent, alternate, newline = true
14778
14828
  loc: locStub
14779
14829
  };
14780
14830
  }
14781
- function createCacheExpression(index, value, needPauseTracking = false) {
14831
+ function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
14782
14832
  return {
14783
14833
  type: 20,
14784
14834
  index,
14785
14835
  value,
14786
14836
  needPauseTracking,
14837
+ inVOnce,
14787
14838
  needArraySpread: false,
14788
14839
  loc: locStub
14789
14840
  };
@@ -17168,11 +17219,12 @@ function createTransformContext(root, {
17168
17219
  identifier.hoisted = exp;
17169
17220
  return identifier;
17170
17221
  },
17171
- cache(exp, isVNode = false) {
17222
+ cache(exp, isVNode = false, inVOnce = false) {
17172
17223
  const cacheExp = createCacheExpression(
17173
17224
  context.cached.length,
17174
17225
  exp,
17175
- isVNode
17226
+ isVNode,
17227
+ inVOnce
17176
17228
  );
17177
17229
  context.cached.push(cacheExp);
17178
17230
  return cacheExp;
@@ -17887,7 +17939,9 @@ function genCacheExpression(node, context) {
17887
17939
  push(`_cache[${node.index}] || (`);
17888
17940
  if (needPauseTracking) {
17889
17941
  indent();
17890
- push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
17942
+ push(`${helper(SET_BLOCK_TRACKING)}(-1`);
17943
+ if (node.inVOnce) push(`, true`);
17944
+ push(`),`);
17891
17945
  newline();
17892
17946
  push(`(`);
17893
17947
  }
@@ -17944,12 +17998,14 @@ const transformExpression = (node, context) => {
17944
17998
  context
17945
17999
  );
17946
18000
  } else if (node.type === 1) {
18001
+ const memo = findDir(node, "memo");
17947
18002
  for (let i = 0; i < node.props.length; i++) {
17948
18003
  const dir = node.props[i];
17949
18004
  if (dir.type === 7 && dir.name !== "for") {
17950
18005
  const exp = dir.exp;
17951
18006
  const arg = dir.arg;
17952
- if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
18007
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
18008
+ !(memo && arg && arg.type === 4 && arg.content === "key")) {
17953
18009
  dir.exp = processExpression(
17954
18010
  exp,
17955
18011
  context,
@@ -18277,10 +18333,11 @@ const transformFor = createStructuralDirectiveTransform(
18277
18333
  const isTemplate = isTemplateNode(node);
18278
18334
  const memo = findDir(node, "memo");
18279
18335
  const keyProp = findProp(node, `key`, false, true);
18280
- if (keyProp && keyProp.type === 7 && !keyProp.exp) {
18336
+ const isDirKey = keyProp && keyProp.type === 7;
18337
+ if (isDirKey && !keyProp.exp) {
18281
18338
  transformBindShorthand(keyProp);
18282
18339
  }
18283
- const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18340
+ let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18284
18341
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18285
18342
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
18286
18343
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
@@ -19519,8 +19576,8 @@ const transformOnce = (node, context) => {
19519
19576
  if (cur.codegenNode) {
19520
19577
  cur.codegenNode = context.cache(
19521
19578
  cur.codegenNode,
19579
+ true,
19522
19580
  true
19523
- /* isVNode */
19524
19581
  );
19525
19582
  }
19526
19583
  };