vue 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.
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
  - For use with bundlers like `webpack`, `rollup` and `parcel`.
26
26
  - Leaves prod/dev branches with `process.env.NODE_ENV` guards (must be replaced by bundler)
27
27
  - Does not ship minified builds (to be done together with the rest of the code after bundling)
28
- - Imports dependencies (e.g. `@vue/runtime-core`, `@vue/runtime-compiler`)
28
+ - Imports dependencies (e.g. `@vue/runtime-core`, `@vue/compiler-core`)
29
29
  - Imported dependencies are also `esm-bundler` builds and will in turn import their dependencies (e.g. `@vue/runtime-core` imports `@vue/reactivity`)
30
30
  - This means you **can** install/import these deps individually without ending up with different instances of these dependencies, but you must make sure they all resolve to the same version.
31
31
  - In-browser template compilation:
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.12
2
+ * vue v3.5.13
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.12
2
+ * vue v3.5.13
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.12
2
+ * vue 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
  };
@@ -3060,11 +3063,32 @@ const TeleportImpl = {
3060
3063
  updateCssVars(n2, true);
3061
3064
  }
3062
3065
  if (isTeleportDeferred(n2.props)) {
3063
- queuePostRenderEffect(mountToTarget, parentSuspense);
3066
+ queuePostRenderEffect(() => {
3067
+ mountToTarget();
3068
+ n2.el.__isMounted = true;
3069
+ }, parentSuspense);
3064
3070
  } else {
3065
3071
  mountToTarget();
3066
3072
  }
3067
3073
  } else {
3074
+ if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
3075
+ queuePostRenderEffect(() => {
3076
+ TeleportImpl.process(
3077
+ n1,
3078
+ n2,
3079
+ container,
3080
+ anchor,
3081
+ parentComponent,
3082
+ parentSuspense,
3083
+ namespace,
3084
+ slotScopeIds,
3085
+ optimized,
3086
+ internals
3087
+ );
3088
+ delete n1.el.__isMounted;
3089
+ }, parentSuspense);
3090
+ return;
3091
+ }
3068
3092
  n2.el = n1.el;
3069
3093
  n2.targetStart = n1.targetStart;
3070
3094
  const mainAnchor = n2.anchor = n1.anchor;
@@ -3370,10 +3394,9 @@ const BaseTransitionImpl = {
3370
3394
  if (innerChild.type !== Comment) {
3371
3395
  setTransitionHooks(innerChild, enterHooks);
3372
3396
  }
3373
- const oldChild = instance.subTree;
3374
- const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3397
+ let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3375
3398
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3376
- const leavingHooks = resolveTransitionHooks(
3399
+ let leavingHooks = resolveTransitionHooks(
3377
3400
  oldInnerChild,
3378
3401
  rawProps,
3379
3402
  state,
@@ -3388,6 +3411,7 @@ const BaseTransitionImpl = {
3388
3411
  instance.update();
3389
3412
  }
3390
3413
  delete leavingHooks.afterLeave;
3414
+ oldInnerChild = void 0;
3391
3415
  };
3392
3416
  return emptyPlaceholder(child);
3393
3417
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3401,10 +3425,19 @@ const BaseTransitionImpl = {
3401
3425
  earlyRemove();
3402
3426
  el[leaveCbKey] = void 0;
3403
3427
  delete enterHooks.delayedLeave;
3428
+ oldInnerChild = void 0;
3429
+ };
3430
+ enterHooks.delayedLeave = () => {
3431
+ delayedLeave();
3432
+ delete enterHooks.delayedLeave;
3433
+ oldInnerChild = void 0;
3404
3434
  };
3405
- enterHooks.delayedLeave = delayedLeave;
3406
3435
  };
3436
+ } else {
3437
+ oldInnerChild = void 0;
3407
3438
  }
3439
+ } else if (oldInnerChild) {
3440
+ oldInnerChild = void 0;
3408
3441
  }
3409
3442
  return child;
3410
3443
  };
@@ -3709,6 +3742,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3709
3742
  return;
3710
3743
  }
3711
3744
  if (isAsyncWrapper(vnode) && !isUnmount) {
3745
+ if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
3746
+ setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
3747
+ }
3712
3748
  return;
3713
3749
  }
3714
3750
  const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
@@ -3973,7 +4009,7 @@ function createHydrationFunctions(rendererInternals) {
3973
4009
  getContainerType(container),
3974
4010
  optimized
3975
4011
  );
3976
- if (isAsyncWrapper(vnode)) {
4012
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
3977
4013
  let subTree;
3978
4014
  if (isFragmentStart) {
3979
4015
  subTree = createVNode(Fragment);
@@ -4242,6 +4278,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4242
4278
  getContainerType(container),
4243
4279
  slotScopeIds
4244
4280
  );
4281
+ if (parentComponent) {
4282
+ parentComponent.vnode.el = vnode.el;
4283
+ updateHOCHostEl(parentComponent, vnode.el);
4284
+ }
4245
4285
  return next;
4246
4286
  };
4247
4287
  const locateClosingAnchor = (node, open = "[", close = "]") => {
@@ -8681,7 +8721,7 @@ function renderComponentRoot(instance) {
8681
8721
  }
8682
8722
  if (extraAttrs.length) {
8683
8723
  warn$1(
8684
- `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
8724
+ `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.`
8685
8725
  );
8686
8726
  }
8687
8727
  if (eventAttrs.length) {
@@ -9464,9 +9504,9 @@ function closeBlock() {
9464
9504
  currentBlock = blockStack[blockStack.length - 1] || null;
9465
9505
  }
9466
9506
  let isBlockTreeEnabled = 1;
9467
- function setBlockTracking(value) {
9507
+ function setBlockTracking(value, inVOnce = false) {
9468
9508
  isBlockTreeEnabled += value;
9469
- if (value < 0 && currentBlock) {
9509
+ if (value < 0 && currentBlock && inVOnce) {
9470
9510
  currentBlock.hasOnce = true;
9471
9511
  }
9472
9512
  }
@@ -10490,7 +10530,7 @@ function isMemoSame(cached, memo) {
10490
10530
  return true;
10491
10531
  }
10492
10532
 
10493
- const version = "3.5.12";
10533
+ const version = "3.5.13";
10494
10534
  const warn = warn$1 ;
10495
10535
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10496
10536
  const devtools = devtools$1 ;
@@ -10674,7 +10714,8 @@ function resolveTransitionProps(rawProps) {
10674
10714
  onAppear = onEnter,
10675
10715
  onAppearCancelled = onEnterCancelled
10676
10716
  } = baseProps;
10677
- const finishEnter = (el, isAppear, done) => {
10717
+ const finishEnter = (el, isAppear, done, isCancelled) => {
10718
+ el._enterCancelled = isCancelled;
10678
10719
  removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
10679
10720
  removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
10680
10721
  done && done();
@@ -10717,8 +10758,13 @@ function resolveTransitionProps(rawProps) {
10717
10758
  el._isLeaving = true;
10718
10759
  const resolve = () => finishLeave(el, done);
10719
10760
  addTransitionClass(el, leaveFromClass);
10720
- addTransitionClass(el, leaveActiveClass);
10721
- forceReflow();
10761
+ if (!el._enterCancelled) {
10762
+ forceReflow();
10763
+ addTransitionClass(el, leaveActiveClass);
10764
+ } else {
10765
+ addTransitionClass(el, leaveActiveClass);
10766
+ forceReflow();
10767
+ }
10722
10768
  nextFrame(() => {
10723
10769
  if (!el._isLeaving) {
10724
10770
  return;
@@ -10732,11 +10778,11 @@ function resolveTransitionProps(rawProps) {
10732
10778
  callHook(onLeave, [el, resolve]);
10733
10779
  },
10734
10780
  onEnterCancelled(el) {
10735
- finishEnter(el, false);
10781
+ finishEnter(el, false, void 0, true);
10736
10782
  callHook(onEnterCancelled, [el]);
10737
10783
  },
10738
10784
  onAppearCancelled(el) {
10739
- finishEnter(el, true);
10785
+ finishEnter(el, true, void 0, true);
10740
10786
  callHook(onAppearCancelled, [el]);
10741
10787
  },
10742
10788
  onLeaveCancelled(el) {
@@ -10956,10 +11002,11 @@ function useCssVars(getter) {
10956
11002
  }
10957
11003
  updateTeleports(vars);
10958
11004
  };
10959
- onBeforeMount(() => {
10960
- watchPostEffect(setVars);
11005
+ onBeforeUpdate(() => {
11006
+ queuePostFlushCb(setVars);
10961
11007
  });
10962
11008
  onMounted(() => {
11009
+ watch(setVars, NOOP, { flush: "post" });
10963
11010
  const ob = new MutationObserver(setVars);
10964
11011
  ob.observe(instance.subTree.el.parentNode, { childList: true });
10965
11012
  onUnmounted(() => ob.disconnect());
@@ -11566,6 +11613,8 @@ class VueElement extends BaseClass {
11566
11613
  this._update();
11567
11614
  }
11568
11615
  if (shouldReflect) {
11616
+ const ob = this._ob;
11617
+ ob && ob.disconnect();
11569
11618
  if (val === true) {
11570
11619
  this.setAttribute(hyphenate(key), "");
11571
11620
  } else if (typeof val === "string" || typeof val === "number") {
@@ -11573,6 +11622,7 @@ class VueElement extends BaseClass {
11573
11622
  } else if (!val) {
11574
11623
  this.removeAttribute(hyphenate(key));
11575
11624
  }
11625
+ ob && ob.observe(this, { attributes: true });
11576
11626
  }
11577
11627
  }
11578
11628
  }
@@ -12771,12 +12821,13 @@ function createConditionalExpression(test, consequent, alternate, newline = true
12771
12821
  loc: locStub
12772
12822
  };
12773
12823
  }
12774
- function createCacheExpression(index, value, needPauseTracking = false) {
12824
+ function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
12775
12825
  return {
12776
12826
  type: 20,
12777
12827
  index,
12778
12828
  value,
12779
12829
  needPauseTracking,
12830
+ inVOnce,
12780
12831
  needArraySpread: false,
12781
12832
  loc: locStub
12782
12833
  };
@@ -15010,11 +15061,12 @@ function createTransformContext(root, {
15010
15061
  identifier.hoisted = exp;
15011
15062
  return identifier;
15012
15063
  },
15013
- cache(exp, isVNode = false) {
15064
+ cache(exp, isVNode = false, inVOnce = false) {
15014
15065
  const cacheExp = createCacheExpression(
15015
15066
  context.cached.length,
15016
15067
  exp,
15017
- isVNode
15068
+ isVNode,
15069
+ inVOnce
15018
15070
  );
15019
15071
  context.cached.push(cacheExp);
15020
15072
  return cacheExp;
@@ -15713,7 +15765,9 @@ function genCacheExpression(node, context) {
15713
15765
  push(`_cache[${node.index}] || (`);
15714
15766
  if (needPauseTracking) {
15715
15767
  indent();
15716
- push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
15768
+ push(`${helper(SET_BLOCK_TRACKING)}(-1`);
15769
+ if (node.inVOnce) push(`, true`);
15770
+ push(`),`);
15717
15771
  newline();
15718
15772
  push(`(`);
15719
15773
  }
@@ -15770,12 +15824,14 @@ const transformExpression = (node, context) => {
15770
15824
  context
15771
15825
  );
15772
15826
  } else if (node.type === 1) {
15827
+ const memo = findDir(node, "memo");
15773
15828
  for (let i = 0; i < node.props.length; i++) {
15774
15829
  const dir = node.props[i];
15775
15830
  if (dir.type === 7 && dir.name !== "for") {
15776
15831
  const exp = dir.exp;
15777
15832
  const arg = dir.arg;
15778
- if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
15833
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
15834
+ !(memo && arg && arg.type === 4 && arg.content === "key")) {
15779
15835
  dir.exp = processExpression(
15780
15836
  exp,
15781
15837
  context,
@@ -16103,10 +16159,11 @@ const transformFor = createStructuralDirectiveTransform(
16103
16159
  const isTemplate = isTemplateNode(node);
16104
16160
  const memo = findDir(node, "memo");
16105
16161
  const keyProp = findProp(node, `key`, false, true);
16106
- if (keyProp && keyProp.type === 7 && !keyProp.exp) {
16162
+ const isDirKey = keyProp && keyProp.type === 7;
16163
+ if (isDirKey && !keyProp.exp) {
16107
16164
  transformBindShorthand(keyProp);
16108
16165
  }
16109
- const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16166
+ let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16110
16167
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
16111
16168
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
16112
16169
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
@@ -17303,8 +17360,8 @@ const transformOnce = (node, context) => {
17303
17360
  if (cur.codegenNode) {
17304
17361
  cur.codegenNode = context.cache(
17305
17362
  cur.codegenNode,
17363
+ true,
17306
17364
  true
17307
- /* isVNode */
17308
17365
  );
17309
17366
  }
17310
17367
  };