@vue/compat 3.6.0-beta.10 → 3.6.0-beta.12

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.6.0-beta.10
2
+ * @vue/compat v3.6.0-beta.12
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -521,6 +521,13 @@ function warn$2(msg, ...args) {
521
521
  const notifyBuffer = [];
522
522
  let batchDepth = 0;
523
523
  let activeSub = void 0;
524
+ let runDepth = 0;
525
+ function incRunDepth() {
526
+ ++runDepth;
527
+ }
528
+ function decRunDepth() {
529
+ --runDepth;
530
+ }
524
531
  let globalVersion = 0;
525
532
  let notifyIndex = 0;
526
533
  let notifyBufferLength = 0;
@@ -594,8 +601,10 @@ function propagate(link) {
594
601
  const sub = link.sub;
595
602
  let flags = sub.flags;
596
603
  if (flags & 3) {
597
- if (!(flags & 60)) sub.flags = flags | 32;
598
- else if (!(flags & 12)) flags = 0;
604
+ if (!(flags & 60)) {
605
+ sub.flags = flags | 32;
606
+ if (runDepth) sub.flags |= 8;
607
+ } else if (!(flags & 12)) flags = 0;
599
608
  else if (!(flags & 4)) sub.flags = flags & -9 | 32;
600
609
  else if (!(flags & 48) && isValidLink(link, sub)) {
601
610
  sub.flags = flags | 40;
@@ -664,13 +673,13 @@ function checkDirty(link, sub) {
664
673
  let dirty = false;
665
674
  if (sub.flags & 16) dirty = true;
666
675
  else if ((depFlags & 17) === 17) {
676
+ const subs = dep.subs;
667
677
  if (dep.update()) {
668
- const subs = dep.subs;
669
678
  if (subs.nextSub !== void 0) shallowPropagate(subs);
670
679
  dirty = true;
671
680
  }
672
681
  } else if ((depFlags & 33) === 33) {
673
- if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
682
+ stack = {
674
683
  value: link,
675
684
  prev: stack
676
685
  };
@@ -685,15 +694,12 @@ function checkDirty(link, sub) {
685
694
  }
686
695
  while (checkDepth) {
687
696
  --checkDepth;
688
- const firstSub = sub.subs;
689
- const hasMultipleSubs = firstSub.nextSub !== void 0;
690
- if (hasMultipleSubs) {
691
- link = stack.value;
692
- stack = stack.prev;
693
- } else link = firstSub;
697
+ link = stack.value;
698
+ stack = stack.prev;
694
699
  if (dirty) {
700
+ const subs = sub.subs;
695
701
  if (sub.update()) {
696
- if (hasMultipleSubs) shallowPropagate(firstSub);
702
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
697
703
  sub = link.sub;
698
704
  continue;
699
705
  }
@@ -705,7 +711,7 @@ function checkDirty(link, sub) {
705
711
  }
706
712
  dirty = false;
707
713
  }
708
- return dirty;
714
+ return dirty && !!sub.flags;
709
715
  } while (true);
710
716
  }
711
717
  function shallowPropagate(link) {
@@ -1857,9 +1863,11 @@ var ReactiveEffect = class {
1857
1863
  if (!this.active) return this.fn();
1858
1864
  cleanup(this);
1859
1865
  const prevSub = startTracking(this);
1866
+ incRunDepth();
1860
1867
  try {
1861
1868
  return this.fn();
1862
1869
  } finally {
1870
+ decRunDepth();
1863
1871
  endTracking(this, prevSub);
1864
1872
  const flags = this.flags;
1865
1873
  if ((flags & 136) === 136) {
@@ -3506,7 +3514,7 @@ const TeleportImpl = {
3506
3514
  name: "Teleport",
3507
3515
  __isTeleport: true,
3508
3516
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3509
- const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
3517
+ const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
3510
3518
  const disabled = isTeleportDisabled(n2.props);
3511
3519
  let { dynamicChildren } = n2;
3512
3520
  if (isHmrUpdating) {
@@ -3535,7 +3543,7 @@ const TeleportImpl = {
3535
3543
  if (pendingMounts.get(vnode) !== mountJob) return;
3536
3544
  pendingMounts.delete(vnode);
3537
3545
  if (isTeleportDisabled(vnode.props)) {
3538
- mount(vnode, container, vnode.anchor);
3546
+ mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
3539
3547
  updateCssVars(vnode, true);
3540
3548
  }
3541
3549
  mountToTarget(vnode);
@@ -3615,7 +3623,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3615
3623
  const { el, anchor, shapeFlag, children, props } = vnode;
3616
3624
  const isReorder = moveType === 2;
3617
3625
  if (isReorder) insert(el, container, parentAnchor);
3618
- if (!isReorder || isTeleportDisabled(props)) {
3626
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
3619
3627
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
3620
3628
  }
3621
3629
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -3740,8 +3748,8 @@ const BaseTransitionImpl = {
3740
3748
  const state = useTransitionState();
3741
3749
  return () => {
3742
3750
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
3743
- if (!children || !children.length) return;
3744
- const child = findNonCommentChild(children);
3751
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3752
+ if (!child) return;
3745
3753
  const rawProps = /* @__PURE__ */ toRaw(props);
3746
3754
  const { mode } = rawProps;
3747
3755
  checkTransitionMode(mode);
@@ -5311,6 +5319,7 @@ function createSlots(slots, dynamicSlots) {
5311
5319
  */
5312
5320
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5313
5321
  let slot = slots[name];
5322
+ if (fallback) fallback.__vdom = true;
5314
5323
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
5315
5324
  if (vaporSlot) {
5316
5325
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -5349,9 +5358,7 @@ function ensureValidVNode(vnodes) {
5349
5358
  }
5350
5359
  function ensureVaporSlotFallback(vnodes, fallback) {
5351
5360
  let vaporSlot;
5352
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
5353
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
5354
- }
5361
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
5355
5362
  }
5356
5363
  //#endregion
5357
5364
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -5912,9 +5919,14 @@ function withAsyncContext(getAwaitable) {
5912
5919
  setCurrentInstance(null, void 0);
5913
5920
  if (inSSRSetup) setInSSRSetupState(false);
5914
5921
  const restore = () => {
5922
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
5915
5923
  setCurrentInstance(ctx);
5916
5924
  if (inSSRSetup) setInSSRSetupState(true);
5917
- return restoreAsyncContext && restoreAsyncContext();
5925
+ const reset = restoreAsyncContext && restoreAsyncContext();
5926
+ return () => {
5927
+ if (reset) reset();
5928
+ if (resetStoppedScope) resetStoppedScope.reset();
5929
+ };
5918
5930
  };
5919
5931
  const cleanup = () => {
5920
5932
  setCurrentInstance(null, void 0);
@@ -6251,7 +6263,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6251
6263
  if (options.el) return vm.$mount(options.el);
6252
6264
  else return vm;
6253
6265
  }
6254
- Vue.version = `2.6.14-compat:3.6.0-beta.10`;
6266
+ Vue.version = `2.6.14-compat:3.6.0-beta.12`;
6255
6267
  Vue.config = singletonApp.config;
6256
6268
  Vue.use = (plugin, ...options) => {
6257
6269
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -7387,7 +7399,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7387
7399
  const receivedType = toRawType(value);
7388
7400
  const expectedValue = styleValue(value, expectedType);
7389
7401
  const receivedValue = styleValue(value, receivedType);
7390
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
7402
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
7391
7403
  message += `, got ${receivedType} `;
7392
7404
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
7393
7405
  return message;
@@ -7396,7 +7408,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7396
7408
  * dev only
7397
7409
  */
7398
7410
  function styleValue(value, type) {
7399
- if (type === "String") return `"${value}"`;
7411
+ if (isSymbol(value)) return value.toString();
7412
+ else if (type === "String") return `"${value}"`;
7400
7413
  else if (type === "Number") return `${Number(value)}`;
7401
7414
  else return `${value}`;
7402
7415
  }
@@ -7413,8 +7426,11 @@ function isExplicable(type) {
7413
7426
  /**
7414
7427
  * dev only
7415
7428
  */
7416
- function isBoolean(...args) {
7417
- return args.some((elem) => elem.toLowerCase() === "boolean");
7429
+ function isCoercible(...args) {
7430
+ return args.every((elem) => {
7431
+ const value = elem.toLowerCase();
7432
+ return value !== "boolean" && value !== "symbol";
7433
+ });
7418
7434
  }
7419
7435
  //#endregion
7420
7436
  //#region packages/runtime-core/src/componentSlots.ts
@@ -8609,15 +8625,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8609
8625
  if (suspense.isHydrating) suspense.isHydrating = false;
8610
8626
  else if (!resume) {
8611
8627
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
8628
+ let hasUpdatedAnchor = false;
8612
8629
  if (delayEnter) activeBranch.transition.afterLeave = () => {
8613
8630
  if (pendingId === suspense.pendingId) {
8614
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
8631
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
8615
8632
  queuePostFlushCb(effects);
8616
8633
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
8617
8634
  }
8618
8635
  };
8619
8636
  if (activeBranch && !suspense.isFallbackMountPending) {
8620
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
8637
+ if (parentNode(activeBranch.el) === container) {
8638
+ anchor = next(activeBranch);
8639
+ hasUpdatedAnchor = true;
8640
+ }
8621
8641
  unmount(activeBranch, parentComponent, suspense, true);
8622
8642
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
8623
8643
  }
@@ -9014,12 +9034,30 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9014
9034
  el: vnode.el,
9015
9035
  anchor: vnode.anchor,
9016
9036
  ctx: vnode.ctx,
9017
- ce: vnode.ce
9037
+ ce: vnode.ce,
9038
+ vi: vnode.vi,
9039
+ vs: cloneVaporSlotMeta(vnode),
9040
+ vb: vnode.vb
9018
9041
  };
9019
9042
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
9020
9043
  defineLegacyVNodeProperties(cloned);
9021
9044
  return cloned;
9022
9045
  }
9046
+ function cloneVaporSlotMeta(vnode) {
9047
+ const vaporSlot = vnode.vs;
9048
+ if (!vaporSlot) return vaporSlot;
9049
+ const cloned = {
9050
+ slot: vaporSlot.slot,
9051
+ fallback: vaporSlot.fallback,
9052
+ outletFallback: vaporSlot.outletFallback
9053
+ };
9054
+ if (vnode.el) {
9055
+ cloned.state = vaporSlot.state;
9056
+ cloned.ref = vaporSlot.ref;
9057
+ cloned.scope = vaporSlot.scope;
9058
+ }
9059
+ return cloned;
9060
+ }
9023
9061
  /**
9024
9062
  * Dev only, for HMR of hoisted vnodes reused in v-for
9025
9063
  * https://github.com/vitejs/vite/issues/2022
@@ -9679,7 +9717,7 @@ function isMemoSame(cached, memo) {
9679
9717
  }
9680
9718
  //#endregion
9681
9719
  //#region packages/runtime-core/src/index.ts
9682
- const version = "3.6.0-beta.10";
9720
+ const version = "3.6.0-beta.12";
9683
9721
  const warn = warn$1;
9684
9722
  /**
9685
9723
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10167,7 +10205,10 @@ function patchStyle(el, prev, next) {
10167
10205
  }
10168
10206
  for (const key in next) {
10169
10207
  if (key === "display") hasControlledDisplay = true;
10170
- setStyle(style, key, next[key]);
10208
+ const value = next[key];
10209
+ if (value != null) {
10210
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
10211
+ } else setStyle(style, key, "");
10171
10212
  }
10172
10213
  } else if (isCssString) {
10173
10214
  if (prev !== next) {
@@ -10215,6 +10256,14 @@ function autoPrefix(style, rawName) {
10215
10256
  }
10216
10257
  return rawName;
10217
10258
  }
10259
+ /**
10260
+ * Browsers update textarea width/height directly during native resize.
10261
+ * Only special-case this common textarea path for now; other resize scenarios
10262
+ * still follow normal vnode style patching.
10263
+ */
10264
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
10265
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
10266
+ }
10218
10267
  //#endregion
10219
10268
  //#region packages/runtime-dom/src/modules/attrs.ts
10220
10269
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -10674,7 +10723,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
10674
10723
  replacementNodes.push(child);
10675
10724
  }
10676
10725
  parent.removeChild(o);
10677
- slotReplacements.set(o, replacementNodes);
10726
+ slotReplacements.set(o, {
10727
+ nodes: replacementNodes,
10728
+ usedFallback: !content
10729
+ });
10678
10730
  }
10679
10731
  this._updateSlotNodes(slotReplacements);
10680
10732
  }
@@ -13612,6 +13664,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
13612
13664
  constantCache: /* @__PURE__ */ new WeakMap(),
13613
13665
  temps: 0,
13614
13666
  identifiers: Object.create(null),
13667
+ identifierScopes: Object.create(null),
13615
13668
  scopes: {
13616
13669
  vFor: 0,
13617
13670
  vSlot: 0,
@@ -13662,8 +13715,12 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
13662
13715
  context.parent.children.splice(removalIndex, 1);
13663
13716
  },
13664
13717
  onNodeRemoved: NOOP,
13665
- addIdentifiers(exp) {},
13718
+ addIdentifiers(exp, type = "local") {},
13666
13719
  removeIdentifiers(exp) {},
13720
+ isSlotScopeIdentifier(name) {
13721
+ const scopes = context.identifierScopes[name];
13722
+ return scopes ? scopes[scopes.length - 1] === "slot" : false;
13723
+ },
13667
13724
  hoist(exp) {
13668
13725
  if (isString(exp)) exp = createSimpleExpression(exp);
13669
13726
  context.hoists.push(exp);