@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.
@@ -1279,6 +1279,8 @@ interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraPro
1279
1279
  vs?: {
1280
1280
  slot: (props: any) => any;
1281
1281
  fallback: (() => VNodeArrayChildren) | undefined;
1282
+ outletFallback?: (() => VNodeArrayChildren) | undefined;
1283
+ state?: unknown;
1282
1284
  ref?: ShallowRef<any>;
1283
1285
  scope?: EffectScope;
1284
1286
  };
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -566,6 +566,13 @@ function warn$2(msg, ...args) {
566
566
  const notifyBuffer = [];
567
567
  let batchDepth = 0;
568
568
  let activeSub = void 0;
569
+ let runDepth = 0;
570
+ function incRunDepth() {
571
+ ++runDepth;
572
+ }
573
+ function decRunDepth() {
574
+ --runDepth;
575
+ }
569
576
  let globalVersion = 0;
570
577
  let notifyIndex = 0;
571
578
  let notifyBufferLength = 0;
@@ -639,8 +646,10 @@ function propagate(link) {
639
646
  const sub = link.sub;
640
647
  let flags = sub.flags;
641
648
  if (flags & 3) {
642
- if (!(flags & 60)) sub.flags = flags | 32;
643
- else if (!(flags & 12)) flags = 0;
649
+ if (!(flags & 60)) {
650
+ sub.flags = flags | 32;
651
+ if (runDepth) sub.flags |= 8;
652
+ } else if (!(flags & 12)) flags = 0;
644
653
  else if (!(flags & 4)) sub.flags = flags & -9 | 32;
645
654
  else if (!(flags & 48) && isValidLink(link, sub)) {
646
655
  sub.flags = flags | 40;
@@ -709,13 +718,13 @@ function checkDirty(link, sub) {
709
718
  let dirty = false;
710
719
  if (sub.flags & 16) dirty = true;
711
720
  else if ((depFlags & 17) === 17) {
721
+ const subs = dep.subs;
712
722
  if (dep.update()) {
713
- const subs = dep.subs;
714
723
  if (subs.nextSub !== void 0) shallowPropagate(subs);
715
724
  dirty = true;
716
725
  }
717
726
  } else if ((depFlags & 33) === 33) {
718
- if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
727
+ stack = {
719
728
  value: link,
720
729
  prev: stack
721
730
  };
@@ -730,15 +739,12 @@ function checkDirty(link, sub) {
730
739
  }
731
740
  while (checkDepth) {
732
741
  --checkDepth;
733
- const firstSub = sub.subs;
734
- const hasMultipleSubs = firstSub.nextSub !== void 0;
735
- if (hasMultipleSubs) {
736
- link = stack.value;
737
- stack = stack.prev;
738
- } else link = firstSub;
742
+ link = stack.value;
743
+ stack = stack.prev;
739
744
  if (dirty) {
745
+ const subs = sub.subs;
740
746
  if (sub.update()) {
741
- if (hasMultipleSubs) shallowPropagate(firstSub);
747
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
742
748
  sub = link.sub;
743
749
  continue;
744
750
  }
@@ -750,7 +756,7 @@ function checkDirty(link, sub) {
750
756
  }
751
757
  dirty = false;
752
758
  }
753
- return dirty;
759
+ return dirty && !!sub.flags;
754
760
  } while (true);
755
761
  }
756
762
  function shallowPropagate(link) {
@@ -1902,9 +1908,11 @@ var ReactiveEffect = class {
1902
1908
  if (!this.active) return this.fn();
1903
1909
  cleanup(this);
1904
1910
  const prevSub = startTracking(this);
1911
+ incRunDepth();
1905
1912
  try {
1906
1913
  return this.fn();
1907
1914
  } finally {
1915
+ decRunDepth();
1908
1916
  endTracking(this, prevSub);
1909
1917
  const flags = this.flags;
1910
1918
  if ((flags & 136) === 136) {
@@ -3569,7 +3577,7 @@ const TeleportImpl = {
3569
3577
  name: "Teleport",
3570
3578
  __isTeleport: true,
3571
3579
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3572
- const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
3580
+ const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
3573
3581
  const disabled = isTeleportDisabled(n2.props);
3574
3582
  let { dynamicChildren } = n2;
3575
3583
  if (isHmrUpdating) {
@@ -3598,7 +3606,7 @@ const TeleportImpl = {
3598
3606
  if (pendingMounts.get(vnode) !== mountJob) return;
3599
3607
  pendingMounts.delete(vnode);
3600
3608
  if (isTeleportDisabled(vnode.props)) {
3601
- mount(vnode, container, vnode.anchor);
3609
+ mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
3602
3610
  updateCssVars(vnode, true);
3603
3611
  }
3604
3612
  mountToTarget(vnode);
@@ -3678,7 +3686,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3678
3686
  const { el, anchor, shapeFlag, children, props } = vnode;
3679
3687
  const isReorder = moveType === 2;
3680
3688
  if (isReorder) insert(el, container, parentAnchor);
3681
- if (!isReorder || isTeleportDisabled(props)) {
3689
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
3682
3690
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
3683
3691
  }
3684
3692
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -3803,8 +3811,8 @@ const BaseTransitionImpl = {
3803
3811
  const state = useTransitionState();
3804
3812
  return () => {
3805
3813
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
3806
- if (!children || !children.length) return;
3807
- const child = findNonCommentChild(children);
3814
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3815
+ if (!child) return;
3808
3816
  const rawProps = /* @__PURE__ */ toRaw(props);
3809
3817
  const { mode } = rawProps;
3810
3818
  checkTransitionMode(mode);
@@ -5378,6 +5386,7 @@ function createSlots(slots, dynamicSlots) {
5378
5386
  */
5379
5387
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5380
5388
  let slot = slots[name];
5389
+ if (fallback) fallback.__vdom = true;
5381
5390
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
5382
5391
  if (vaporSlot) {
5383
5392
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -5416,9 +5425,7 @@ function ensureValidVNode(vnodes) {
5416
5425
  }
5417
5426
  function ensureVaporSlotFallback(vnodes, fallback) {
5418
5427
  let vaporSlot;
5419
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
5420
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
5421
- }
5428
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
5422
5429
  }
5423
5430
  //#endregion
5424
5431
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -5979,9 +5986,14 @@ function withAsyncContext(getAwaitable) {
5979
5986
  setCurrentInstance(null, void 0);
5980
5987
  if (inSSRSetup) setInSSRSetupState(false);
5981
5988
  const restore = () => {
5989
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
5982
5990
  setCurrentInstance(ctx);
5983
5991
  if (inSSRSetup) setInSSRSetupState(true);
5984
- return restoreAsyncContext && restoreAsyncContext();
5992
+ const reset = restoreAsyncContext && restoreAsyncContext();
5993
+ return () => {
5994
+ if (reset) reset();
5995
+ if (resetStoppedScope) resetStoppedScope.reset();
5996
+ };
5985
5997
  };
5986
5998
  const cleanup = () => {
5987
5999
  setCurrentInstance(null, void 0);
@@ -6319,7 +6331,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6319
6331
  if (options.el) return vm.$mount(options.el);
6320
6332
  else return vm;
6321
6333
  }
6322
- Vue.version = `2.6.14-compat:3.6.0-beta.10`;
6334
+ Vue.version = `2.6.14-compat:3.6.0-beta.12`;
6323
6335
  Vue.config = singletonApp.config;
6324
6336
  Vue.use = (plugin, ...options) => {
6325
6337
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -7455,7 +7467,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7455
7467
  const receivedType = toRawType(value);
7456
7468
  const expectedValue = styleValue(value, expectedType);
7457
7469
  const receivedValue = styleValue(value, receivedType);
7458
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
7470
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
7459
7471
  message += `, got ${receivedType} `;
7460
7472
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
7461
7473
  return message;
@@ -7464,7 +7476,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7464
7476
  * dev only
7465
7477
  */
7466
7478
  function styleValue(value, type) {
7467
- if (type === "String") return `"${value}"`;
7479
+ if (isSymbol(value)) return value.toString();
7480
+ else if (type === "String") return `"${value}"`;
7468
7481
  else if (type === "Number") return `${Number(value)}`;
7469
7482
  else return `${value}`;
7470
7483
  }
@@ -7481,8 +7494,11 @@ function isExplicable(type) {
7481
7494
  /**
7482
7495
  * dev only
7483
7496
  */
7484
- function isBoolean(...args) {
7485
- return args.some((elem) => elem.toLowerCase() === "boolean");
7497
+ function isCoercible(...args) {
7498
+ return args.every((elem) => {
7499
+ const value = elem.toLowerCase();
7500
+ return value !== "boolean" && value !== "symbol";
7501
+ });
7486
7502
  }
7487
7503
  //#endregion
7488
7504
  //#region packages/runtime-core/src/componentSlots.ts
@@ -8677,15 +8693,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8677
8693
  if (suspense.isHydrating) suspense.isHydrating = false;
8678
8694
  else if (!resume) {
8679
8695
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
8696
+ let hasUpdatedAnchor = false;
8680
8697
  if (delayEnter) activeBranch.transition.afterLeave = () => {
8681
8698
  if (pendingId === suspense.pendingId) {
8682
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
8699
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
8683
8700
  queuePostFlushCb(effects);
8684
8701
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
8685
8702
  }
8686
8703
  };
8687
8704
  if (activeBranch && !suspense.isFallbackMountPending) {
8688
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
8705
+ if (parentNode(activeBranch.el) === container) {
8706
+ anchor = next(activeBranch);
8707
+ hasUpdatedAnchor = true;
8708
+ }
8689
8709
  unmount(activeBranch, parentComponent, suspense, true);
8690
8710
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
8691
8711
  }
@@ -9082,12 +9102,30 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9082
9102
  el: vnode.el,
9083
9103
  anchor: vnode.anchor,
9084
9104
  ctx: vnode.ctx,
9085
- ce: vnode.ce
9105
+ ce: vnode.ce,
9106
+ vi: vnode.vi,
9107
+ vs: cloneVaporSlotMeta(vnode),
9108
+ vb: vnode.vb
9086
9109
  };
9087
9110
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
9088
9111
  defineLegacyVNodeProperties(cloned);
9089
9112
  return cloned;
9090
9113
  }
9114
+ function cloneVaporSlotMeta(vnode) {
9115
+ const vaporSlot = vnode.vs;
9116
+ if (!vaporSlot) return vaporSlot;
9117
+ const cloned = {
9118
+ slot: vaporSlot.slot,
9119
+ fallback: vaporSlot.fallback,
9120
+ outletFallback: vaporSlot.outletFallback
9121
+ };
9122
+ if (vnode.el) {
9123
+ cloned.state = vaporSlot.state;
9124
+ cloned.ref = vaporSlot.ref;
9125
+ cloned.scope = vaporSlot.scope;
9126
+ }
9127
+ return cloned;
9128
+ }
9091
9129
  /**
9092
9130
  * Dev only, for HMR of hoisted vnodes reused in v-for
9093
9131
  * https://github.com/vitejs/vite/issues/2022
@@ -9757,7 +9795,7 @@ function isMemoSame(cached, memo) {
9757
9795
  }
9758
9796
  //#endregion
9759
9797
  //#region packages/runtime-core/src/index.ts
9760
- const version = "3.6.0-beta.10";
9798
+ const version = "3.6.0-beta.12";
9761
9799
  const warn = warn$1;
9762
9800
  /**
9763
9801
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10185,7 +10223,10 @@ function patchStyle(el, prev, next) {
10185
10223
  }
10186
10224
  for (const key in next) {
10187
10225
  if (key === "display") hasControlledDisplay = true;
10188
- setStyle(style, key, next[key]);
10226
+ const value = next[key];
10227
+ if (value != null) {
10228
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
10229
+ } else setStyle(style, key, "");
10189
10230
  }
10190
10231
  } else if (isCssString) {
10191
10232
  if (prev !== next) {
@@ -10233,6 +10274,14 @@ function autoPrefix(style, rawName) {
10233
10274
  }
10234
10275
  return rawName;
10235
10276
  }
10277
+ /**
10278
+ * Browsers update textarea width/height directly during native resize.
10279
+ * Only special-case this common textarea path for now; other resize scenarios
10280
+ * still follow normal vnode style patching.
10281
+ */
10282
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
10283
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
10284
+ }
10236
10285
  //#endregion
10237
10286
  //#region packages/runtime-dom/src/modules/attrs.ts
10238
10287
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -10692,7 +10741,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
10692
10741
  replacementNodes.push(child);
10693
10742
  }
10694
10743
  parent.removeChild(o);
10695
- slotReplacements.set(o, replacementNodes);
10744
+ slotReplacements.set(o, {
10745
+ nodes: replacementNodes,
10746
+ usedFallback: !content
10747
+ });
10696
10748
  }
10697
10749
  this._updateSlotNodes(slotReplacements);
10698
10750
  }
@@ -14394,6 +14446,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
14394
14446
  constantCache: /* @__PURE__ */ new WeakMap(),
14395
14447
  temps: 0,
14396
14448
  identifiers: Object.create(null),
14449
+ identifierScopes: Object.create(null),
14397
14450
  scopes: {
14398
14451
  vFor: 0,
14399
14452
  vSlot: 0,
@@ -14444,16 +14497,20 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
14444
14497
  context.parent.children.splice(removalIndex, 1);
14445
14498
  },
14446
14499
  onNodeRemoved: NOOP,
14447
- addIdentifiers(exp) {
14448
- if (isString(exp)) addId(exp);
14449
- else if (exp.identifiers) exp.identifiers.forEach(addId);
14450
- else if (exp.type === 4) addId(exp.content);
14500
+ addIdentifiers(exp, type = "local") {
14501
+ if (isString(exp)) addId(exp, type);
14502
+ else if (exp.identifiers) exp.identifiers.forEach((id) => addId(id, type));
14503
+ else if (exp.type === 4) addId(exp.content, type);
14451
14504
  },
14452
14505
  removeIdentifiers(exp) {
14453
14506
  if (isString(exp)) removeId(exp);
14454
14507
  else if (exp.identifiers) exp.identifiers.forEach(removeId);
14455
14508
  else if (exp.type === 4) removeId(exp.content);
14456
14509
  },
14510
+ isSlotScopeIdentifier(name) {
14511
+ const scopes = context.identifierScopes[name];
14512
+ return scopes ? scopes[scopes.length - 1] === "slot" : false;
14513
+ },
14457
14514
  hoist(exp) {
14458
14515
  if (isString(exp)) exp = createSimpleExpression(exp);
14459
14516
  context.hoists.push(exp);
@@ -14468,13 +14525,16 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
14468
14525
  }
14469
14526
  };
14470
14527
  context.filters = /* @__PURE__ */ new Set();
14471
- function addId(id) {
14472
- const { identifiers } = context;
14528
+ function addId(id, type) {
14529
+ const { identifiers, identifierScopes } = context;
14473
14530
  if (identifiers[id] === void 0) identifiers[id] = 0;
14474
14531
  identifiers[id]++;
14532
+ (identifierScopes[id] || (identifierScopes[id] = [])).push(type);
14475
14533
  }
14476
14534
  function removeId(id) {
14477
14535
  context.identifiers[id]--;
14536
+ const scopes = context.identifierScopes[id];
14537
+ if (scopes) scopes.pop();
14478
14538
  }
14479
14539
  return context;
14480
14540
  }
@@ -15547,7 +15607,7 @@ const trackSlotScopes = (node, context) => {
15547
15607
  const vSlot = findDir(node, "slot");
15548
15608
  if (vSlot) {
15549
15609
  const slotProps = vSlot.exp;
15550
- if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps);
15610
+ if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps, "slot");
15551
15611
  context.scopes.vSlot++;
15552
15612
  return () => {
15553
15613
  if (context.prefixIdentifiers) slotProps && context.removeIdentifiers(slotProps);
@@ -15768,6 +15828,15 @@ function resolveComponentType(node, context, ssr = false) {
15768
15828
  if (!ssr) context.helper(builtIn);
15769
15829
  return builtIn;
15770
15830
  }
15831
+ {
15832
+ const fromScope = resolveSlotScopeReference(tag, context);
15833
+ if (fromScope) return fromScope;
15834
+ const dotIndex = tag.indexOf(".");
15835
+ if (dotIndex > 0) {
15836
+ const ns = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
15837
+ if (ns) return ns + tag.slice(dotIndex);
15838
+ }
15839
+ }
15771
15840
  {
15772
15841
  const fromSetup = resolveSetupReference(tag, context);
15773
15842
  if (fromSetup) return fromSetup;
@@ -15786,6 +15855,14 @@ function resolveComponentType(node, context, ssr = false) {
15786
15855
  context.components.add(tag);
15787
15856
  return toValidAssetId(tag, `component`);
15788
15857
  }
15858
+ function resolveSlotScopeReference(name, context) {
15859
+ const camelName = camelize(name);
15860
+ const PascalName = capitalize(camelName);
15861
+ const isInSlotScope = (reference) => context.isSlotScopeIdentifier(reference);
15862
+ if (isInSlotScope(name)) return name;
15863
+ if (isInSlotScope(camelName)) return camelName;
15864
+ if (isInSlotScope(PascalName)) return PascalName;
15865
+ }
15789
15866
  function resolveSetupReference(name, context) {
15790
15867
  const bindings = context.bindingMetadata;
15791
15868
  if (!bindings || bindings.__isScriptSetup === false) return;