@vue/compat 3.6.0-rc.1 → 3.6.0-rc.3

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-rc.1
2
+ * @vue/compat v3.6.0-rc.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -318,7 +318,7 @@ const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
318
318
  /**
319
319
  * The full list is needed during SSR to produce the correct initial markup.
320
320
  */
321
- const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
321
+ const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
322
322
  /**
323
323
  * Boolean attributes should be included if the value is truthy or ''.
324
324
  * e.g. `<select multiple>` compiles to `{ multiple: '' }`
@@ -2600,7 +2600,7 @@ function queueFlush() {
2600
2600
  function queuePostFlushCb(jobs, id = Infinity) {
2601
2601
  if (!isArray(jobs)) if (activePostJobs && id === -1) activePostJobs.splice(postFlushIndex, 0, jobs);
2602
2602
  else queueJobWorker(jobs, id, postJobs, postJobs.length, 0);
2603
- else for (const job of jobs) queueJobWorker(job, id, postJobs, postJobs.length, 0);
2603
+ else for (let i = 0; i < jobs.length; i++) queueJobWorker(jobs[i], id, postJobs, postJobs.length, 0);
2604
2604
  queueFlush();
2605
2605
  }
2606
2606
  function flushPreFlushCbs(instance, seen) {
@@ -2621,7 +2621,7 @@ function flushPreFlushCbs(instance, seen) {
2621
2621
  function flushPostFlushCbs(seen) {
2622
2622
  if (postJobs.length) {
2623
2623
  if (activePostJobs) {
2624
- activePostJobs.push(...postJobs);
2624
+ for (let i = 0; i < postJobs.length; i++) activePostJobs.push(postJobs[i]);
2625
2625
  postJobs.length = 0;
2626
2626
  return;
2627
2627
  }
@@ -3512,7 +3512,7 @@ function instanceWatch(source, value, options) {
3512
3512
  }
3513
3513
  const prev = setCurrentInstance(this);
3514
3514
  const res = doWatch(getter, cb.bind(publicThis), options);
3515
- setCurrentInstance(...prev);
3515
+ restoreCurrentInstance(prev);
3516
3516
  return res;
3517
3517
  }
3518
3518
  function createPathGetter(ctx, path) {
@@ -3785,49 +3785,16 @@ const BaseTransitionImpl = {
3785
3785
  setup(props, { slots }) {
3786
3786
  const instance = getCurrentInstance();
3787
3787
  const state = useTransitionState();
3788
+ let resumeAfterLeave;
3788
3789
  return () => {
3789
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
3790
- const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3790
+ const child = resolveTransitionChild(slots.default && slots.default(), !!instance.subTree);
3791
3791
  if (!child) return;
3792
3792
  const rawProps = /* @__PURE__ */ toRaw(props);
3793
3793
  const { mode } = rawProps;
3794
3794
  checkTransitionMode(mode);
3795
- if (state.isLeaving) return emptyPlaceholder(child);
3796
- const innerChild = getInnerChild$1(child);
3797
- if (!innerChild) return emptyPlaceholder(child);
3798
- let enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance, (hooks) => enterHooks = hooks);
3799
- if (innerChild.type !== Comment) setTransitionHooks(innerChild, enterHooks);
3800
- let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3801
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
3802
- let leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
3803
- setTransitionHooks(oldInnerChild, leavingHooks);
3804
- if (mode === "out-in" && innerChild.type !== Comment) {
3805
- state.isLeaving = true;
3806
- leavingHooks.afterLeave = () => {
3807
- state.isLeaving = false;
3808
- if (!(instance.job.flags & 4)) instance.update();
3809
- delete leavingHooks.afterLeave;
3810
- oldInnerChild = void 0;
3811
- };
3812
- return emptyPlaceholder(child);
3813
- } else if (mode === "in-out" && innerChild.type !== Comment) leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3814
- const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
3815
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3816
- el[leaveCbKey] = () => {
3817
- earlyRemove();
3818
- el[leaveCbKey] = void 0;
3819
- delete enterHooks.delayedLeave;
3820
- oldInnerChild = void 0;
3821
- };
3822
- enterHooks.delayedLeave = () => {
3823
- delayedLeave();
3824
- delete enterHooks.delayedLeave;
3825
- oldInnerChild = void 0;
3826
- };
3827
- };
3828
- else oldInnerChild = void 0;
3829
- } else if (oldInnerChild) oldInnerChild = void 0;
3830
- return child;
3795
+ return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
3796
+ if (!(instance.job.flags & 4)) instance.update();
3797
+ }) : NOOP);
3831
3798
  };
3832
3799
  }
3833
3800
  };
@@ -3970,16 +3937,91 @@ function getInnerChild$1(vnode) {
3970
3937
  if (shapeFlag & 32 && isFunction(children.default)) return children.default();
3971
3938
  }
3972
3939
  }
3940
+ function resolveTransitionChild(children, renderEmpty = false) {
3941
+ const branches = children && getTransitionRawChildren(children, true);
3942
+ return branches && branches.length ? findNonCommentChild(branches) : renderEmpty ? createCommentVNode() : void 0;
3943
+ }
3944
+ /**
3945
+ * @internal
3946
+ */
3947
+ function prepareTransitionSwitch(previous, next, props, state, instance, resumeAfterLeave, delayedLeaveSource) {
3948
+ if (state.isLeaving) return emptyPlaceholder(next);
3949
+ const nextInner = getInnerChild$1(next);
3950
+ if (!nextInner) return emptyPlaceholder(next);
3951
+ let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
3952
+ if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
3953
+ enterHooks = hooks;
3954
+ });
3955
+ if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
3956
+ if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
3957
+ const mode = props.mode;
3958
+ const previousInner = previous && getInnerChild$1(previous);
3959
+ if (previous && previousInner && previousInner.type !== Comment && !isSameVNodeType(previousInner, nextInner) && (!previous.component || recursiveGetSubtree(previous.component).type !== Comment)) {
3960
+ const leavingHooks = prepareLeavingTransitionHooks(previousInner, props, state, instance);
3961
+ if (nextInner.type !== Comment && (mode === "out-in" || mode === "in-out") && applyTransitionModeSwitch(previousInner, leavingHooks, mode === "in-out" ? () => enterHooks : void 0, props, state, resumeAfterLeave)) return emptyPlaceholder(next);
3962
+ }
3963
+ return next;
3964
+ }
3965
+ function forwardDelayedLeave(hooks, source) {
3966
+ const delayedLeave = source && source.delayedLeave;
3967
+ if (!delayedLeave) return;
3968
+ hooks.delayedLeave = () => {
3969
+ if (source.delayedLeave === delayedLeave) delayedLeave();
3970
+ delete hooks.delayedLeave;
3971
+ };
3972
+ }
3973
+ function prepareLeavingTransitionHooks(previousInner, props, state, instance) {
3974
+ return setTransitionHooks(previousInner, resolveTransitionHooks(previousInner, props, state, instance));
3975
+ }
3976
+ function applyTransitionModeSwitch(leavingVNode, leavingHooks, getEnterHooks, props, state, resumeAfterLeave) {
3977
+ if (props.mode === "out-in") {
3978
+ state.isLeaving = true;
3979
+ leavingHooks.afterLeave = () => {
3980
+ state.isLeaving = false;
3981
+ resumeAfterLeave();
3982
+ delete leavingHooks.afterLeave;
3983
+ };
3984
+ return true;
3985
+ } else if (props.mode === "in-out" && getEnterHooks) {
3986
+ let delayedLeavingVNode = leavingVNode;
3987
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3988
+ const enterHooks = getEnterHooks();
3989
+ if (!enterHooks) {
3990
+ delayedLeave();
3991
+ return;
3992
+ }
3993
+ const vnode = delayedLeavingVNode;
3994
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3995
+ leavingVNodesCache[String(vnode.key)] = vnode;
3996
+ el[leaveCbKey] = () => {
3997
+ earlyRemove();
3998
+ el[leaveCbKey] = void 0;
3999
+ delete enterHooks.delayedLeave;
4000
+ delayedLeavingVNode = void 0;
4001
+ };
4002
+ enterHooks.delayedLeave = () => {
4003
+ delayedLeave();
4004
+ delete enterHooks.delayedLeave;
4005
+ delayedLeavingVNode = void 0;
4006
+ };
4007
+ };
4008
+ }
4009
+ return false;
4010
+ }
3973
4011
  function setTransitionHooks(vnode, hooks) {
3974
- if (vnode.shapeFlag & 6 && vnode.component) if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
3975
- else {
4012
+ if (vnode.shapeFlag & 6 && vnode.component) {
3976
4013
  vnode.transition = hooks;
3977
- setTransitionHooks(vnode.component.subTree, hooks);
3978
- }
3979
- else if (vnode.shapeFlag & 128) {
3980
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3981
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
4014
+ if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
4015
+ else {
4016
+ const subTree = vnode.component.subTree;
4017
+ return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
4018
+ }
4019
+ } else if (vnode.shapeFlag & 128) {
4020
+ const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4021
+ const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
4022
+ return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
3982
4023
  } else vnode.transition = hooks;
4024
+ return hooks;
3983
4025
  }
3984
4026
  function getTransitionRawChildren(children, keepComment = false, parentKey) {
3985
4027
  let ret = [];
@@ -4331,7 +4373,10 @@ function createHydrationFunctions(rendererInternals) {
4331
4373
  const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4332
4374
  for (const key in props) {
4333
4375
  if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
4334
- if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) patchProp(el, key, null, props[key], namespace, parentComponent);
4376
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4377
+ if (isUnchangedResourceProp(el, key, props[key])) continue;
4378
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4379
+ }
4335
4380
  }
4336
4381
  }
4337
4382
  let vnodeHooks;
@@ -4440,6 +4485,16 @@ const isTemplateNode$1 = (node) => {
4440
4485
  /**
4441
4486
  * Dev only
4442
4487
  */
4488
+ const resourceProps = /* @__PURE__ */ new Set([
4489
+ "src",
4490
+ "srcset",
4491
+ "href",
4492
+ "poster"
4493
+ ]);
4494
+ function isUnchangedResourceProp(el, key, clientValue) {
4495
+ if (!resourceProps.has(key)) return false;
4496
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4497
+ }
4443
4498
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4444
4499
  let mismatchType;
4445
4500
  let mismatchKey;
@@ -4480,7 +4535,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4480
4535
  function getAttributeMismatch(el, key, clientValue) {
4481
4536
  let actual;
4482
4537
  let expected;
4483
- if (isBooleanAttr(key)) {
4538
+ if (key === "hidden") {
4539
+ actual = normalizeHiddenValue(el.getAttribute(key));
4540
+ expected = normalizeHiddenValue(clientValue);
4541
+ } else if (isBooleanAttr(key)) {
4484
4542
  actual = el.hasAttribute(key);
4485
4543
  expected = includeBooleanAttr(clientValue);
4486
4544
  } else if (clientValue == null) {
@@ -4508,6 +4566,11 @@ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
4508
4566
  }
4509
4567
  return false;
4510
4568
  }
4569
+ function normalizeHiddenValue(value) {
4570
+ if (!isRenderableAttrValue(value)) return false;
4571
+ if (isString(value)) return value.toLowerCase() === "until-found" ? "until-found" : "";
4572
+ return includeBooleanAttr(value) ? "" : false;
4573
+ }
4511
4574
  function toClassSet(str) {
4512
4575
  return new Set(str.trim().split(/\s+/));
4513
4576
  }
@@ -5044,7 +5107,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
5044
5107
  try {
5045
5108
  return callWithAsyncErrorHandling(hook, target, type, args);
5046
5109
  } finally {
5047
- setCurrentInstance(...prev);
5110
+ restoreCurrentInstance(prev);
5048
5111
  setActiveSub(prevSub);
5049
5112
  }
5050
5113
  });
@@ -5383,7 +5446,8 @@ function createSlots(slots, dynamicSlots) {
5383
5446
  * Compiler runtime helper for rendering `<slot/>`
5384
5447
  * @private
5385
5448
  */
5386
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5449
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5450
+ if (props == null) props = {};
5387
5451
  let slot = slots[name];
5388
5452
  if (fallback) fallback.__vdom = true;
5389
5453
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
@@ -6339,7 +6403,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6339
6403
  if (options.el) return vm.$mount(options.el);
6340
6404
  else return vm;
6341
6405
  }
6342
- Vue.version = `2.6.14-compat:3.6.0-rc.1`;
6406
+ Vue.version = `2.6.14-compat:3.6.0-rc.3`;
6343
6407
  Vue.config = singletonApp.config;
6344
6408
  Vue.use = (plugin, ...options) => {
6345
6409
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -7037,8 +7101,9 @@ function renderComponentRoot(instance) {
7037
7101
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7038
7102
  }
7039
7103
  if (vnode.transition) {
7040
- if (!isElementRoot(root)) warn$1("Component inside <Transition> renders non-element root node that cannot be animated.");
7041
- setTransitionHooks(root, vnode.transition);
7104
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
7105
+ if (!isElementRoot(child)) warn$1("Component inside <Transition> renders non-element root node that cannot be animated.");
7106
+ setTransitionHooks(child, vnode.transition);
7042
7107
  }
7043
7108
  if (setRoot) setRoot(root);
7044
7109
  else result = root;
@@ -7098,9 +7163,10 @@ function filterSingleRoot(children, recurse = true) {
7098
7163
  }
7099
7164
  return singleRoot;
7100
7165
  }
7166
+ const isFunctionalFallthroughKey = (key) => key === "class" || key === "style" || isOn(key);
7101
7167
  const getFunctionalFallthrough = (attrs) => {
7102
7168
  let res;
7103
- for (const key in attrs) if (key === "class" || key === "style" || isOn(key)) (res || (res = {}))[key] = attrs[key];
7169
+ for (const key in attrs) if (isFunctionalFallthroughKey(key)) (res || (res = {}))[key] = attrs[key];
7104
7170
  return res;
7105
7171
  };
7106
7172
  const filterModelListeners = (attrs, props) => {
@@ -7332,7 +7398,7 @@ function baseResolveDefault(factory, instance, key) {
7332
7398
  const prev = setCurrentInstance(instance);
7333
7399
  const props = /* @__PURE__ */ toRaw(instance.props);
7334
7400
  value = factory.call(isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null, props);
7335
- setCurrentInstance(...prev);
7401
+ restoreCurrentInstance(prev);
7336
7402
  return value;
7337
7403
  }
7338
7404
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
@@ -7893,7 +7959,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7893
7959
  };
7894
7960
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7895
7961
  n2.slotScopeIds = slotScopeIds;
7896
- if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
7962
+ if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
7897
7963
  else {
7898
7964
  const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
7899
7965
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
@@ -8246,7 +8312,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8246
8312
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
8247
8313
  const { el, type, transition, children, shapeFlag } = vnode;
8248
8314
  if (isVaporComponent(type) || type === VaporSlot) {
8249
- getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
8315
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
8250
8316
  return;
8251
8317
  }
8252
8318
  if (shapeFlag & 6) {
@@ -8302,7 +8368,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8302
8368
  }
8303
8369
  if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
8304
8370
  if (shapeFlag & 256) {
8305
- if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
8371
+ if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
8306
8372
  else parentComponent.ctx.deactivate(vnode);
8307
8373
  return;
8308
8374
  }
@@ -8312,7 +8378,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8312
8378
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
8313
8379
  if (shapeFlag & 6) if (isVaporComponent(type)) {
8314
8380
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
8315
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8381
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
8316
8382
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
8317
8383
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8318
8384
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -8329,7 +8395,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8329
8395
  else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
8330
8396
  else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
8331
8397
  if (type === VaporSlot) {
8332
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8398
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
8333
8399
  return;
8334
8400
  }
8335
8401
  if (doRemove) remove(vnode);
@@ -8630,6 +8696,10 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
8630
8696
  suspense.activeBranch = pendingBranch;
8631
8697
  } else unmount(pendingBranch, parentComponent, suspense);
8632
8698
  suspense.deps = 0;
8699
+ for (let i = 0; i < suspense.effects.length; i++) {
8700
+ const effect = suspense.effects[i];
8701
+ if (effect.flags & 8) queuePostFlushCb(effect);
8702
+ }
8633
8703
  suspense.effects.length = 0;
8634
8704
  suspense.hiddenContainer = createElement("div");
8635
8705
  if (isInFallback) {
@@ -8737,7 +8807,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8737
8807
  let hasUnresolvedAncestor = false;
8738
8808
  while (parent) {
8739
8809
  if (parent.pendingBranch) {
8740
- parent.effects.push(...effects);
8810
+ for (let i = 0; i < effects.length; i++) parent.effects.push(effects[i]);
8741
8811
  hasUnresolvedAncestor = true;
8742
8812
  break;
8743
8813
  }
@@ -9047,11 +9117,26 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
9047
9117
  if (shapeFlag & 128) type.normalize(vnode);
9048
9118
  } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
9049
9119
  if (vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
9120
+ if (props && vnode.shapeFlag & 1) {
9121
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
9122
+ if (overwritingProp && hasContentChildren(vnode.children)) warn$1(`The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`);
9123
+ }
9050
9124
  if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
9051
9125
  convertLegacyVModelProps(vnode);
9052
9126
  defineLegacyVNodeProperties(vnode);
9053
9127
  return vnode;
9054
9128
  }
9129
+ /**
9130
+ * dev only
9131
+ * Whether children would actually render something. Empty text and empty
9132
+ * arrays are ignored, mirroring the compiler's `node.children.length` check
9133
+ * for `v-html` / `v-text`.
9134
+ */
9135
+ function hasContentChildren(children) {
9136
+ if (isString(children)) return children !== "";
9137
+ if (isArray(children)) return children.length > 0;
9138
+ return false;
9139
+ }
9055
9140
  const createVNode = createVNodeWithArgsTransform;
9056
9141
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
9057
9142
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -9273,6 +9358,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
9273
9358
  simpleSetCurrentInstance(instance);
9274
9359
  }
9275
9360
  };
9361
+ /**
9362
+ * Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
9363
+ * `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
9364
+ * verbatim instead of re-triggering the `instance.scope` default.
9365
+ * @internal
9366
+ */
9367
+ const restoreCurrentInstance = (prev) => {
9368
+ setCurrentScope(prev[1]);
9369
+ simpleSetCurrentInstance(prev[0]);
9370
+ };
9276
9371
  const internalOptions = [
9277
9372
  "ce",
9278
9373
  "type",
@@ -9424,7 +9519,7 @@ function setupStatefulComponent(instance, isSSR) {
9424
9519
  const setupResult = callWithErrorHandling(setup, instance, 0, [/* @__PURE__ */ shallowReadonly(instance.props), setupContext]);
9425
9520
  const isAsyncSetup = isPromise(setupResult);
9426
9521
  setActiveSub(prevSub);
9427
- setCurrentInstance(...prev);
9522
+ restoreCurrentInstance(prev);
9428
9523
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
9429
9524
  if (isAsyncSetup) {
9430
9525
  const unsetCurrentInstance = () => {
@@ -9432,7 +9527,12 @@ function setupStatefulComponent(instance, isSSR) {
9432
9527
  };
9433
9528
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9434
9529
  if (isSSR) return setupResult.then((resolvedResult) => {
9435
- handleSetupResult(instance, resolvedResult, isSSR);
9530
+ setInSSRSetupState(true);
9531
+ try {
9532
+ handleSetupResult(instance, resolvedResult, isSSR);
9533
+ } finally {
9534
+ setInSSRSetupState(false);
9535
+ }
9436
9536
  }).catch((e) => {
9437
9537
  handleError(e, instance, 0);
9438
9538
  });
@@ -9497,7 +9597,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9497
9597
  applyOptions(instance);
9498
9598
  } finally {
9499
9599
  setActiveSub(prevSub);
9500
- setCurrentInstance(...prevInstance);
9600
+ restoreCurrentInstance(prevInstance);
9501
9601
  }
9502
9602
  }
9503
9603
  if (!Component.render && instance.render === NOOP && !isSSR) if (!compile$1 && Component.template)
@@ -9807,7 +9907,7 @@ function isMemoSame(cached, memo) {
9807
9907
  }
9808
9908
  //#endregion
9809
9909
  //#region packages/runtime-core/src/index.ts
9810
- const version = "3.6.0-rc.1";
9910
+ const version = "3.6.0-rc.3";
9811
9911
  const warn = warn$1;
9812
9912
  /**
9813
9913
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10578,7 +10678,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10578
10678
  if (!this._instance) if (this._resolved) this._mountComponent(this._def);
10579
10679
  else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
10580
10680
  this._pendingResolve = void 0;
10581
- this._resolveDef();
10681
+ if (this.isConnected) return this._resolveDef();
10582
10682
  });
10583
10683
  else this._resolveDef();
10584
10684
  }
@@ -10614,7 +10714,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10614
10714
  * resolve inner component definition (handle possible async component)
10615
10715
  */
10616
10716
  _resolveDef() {
10617
- if (this._pendingResolve) return;
10717
+ if (this._pendingResolve) return this._pendingResolve;
10618
10718
  for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
10619
10719
  this._ob = new MutationObserver(this._processMutations.bind(this));
10620
10720
  this._ob.observe(this, { attributes: true });
@@ -10644,6 +10744,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10644
10744
  this._def = def;
10645
10745
  resolve(def);
10646
10746
  });
10747
+ return this._pendingResolve;
10647
10748
  } else resolve(this._def);
10648
10749
  }
10649
10750
  _mountComponent(def) {
@@ -10682,14 +10783,17 @@ var VueElementBase = class VueElementBase extends BaseClass {
10682
10783
  const { props } = def;
10683
10784
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
10684
10785
  for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
10685
- for (const key of declaredPropKeys.map(camelize)) Object.defineProperty(this, key, {
10686
- get() {
10687
- return this._getProp(key);
10688
- },
10689
- set(val) {
10690
- this._setProp(key, val, true, !this._patching);
10691
- }
10692
- });
10786
+ for (const key of declaredPropKeys.map(camelize)) {
10787
+ if (key in Object.getPrototypeOf(this)) warn(`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`);
10788
+ Object.defineProperty(this, key, {
10789
+ get() {
10790
+ return this._getProp(key);
10791
+ },
10792
+ set(val) {
10793
+ this._setProp(key, val, true, !this._patching);
10794
+ }
10795
+ });
10796
+ }
10693
10797
  }
10694
10798
  _setAttr(key) {
10695
10799
  if (key.startsWith("data-v-")) return;
@@ -11107,13 +11211,22 @@ function onCompositionEnd(e) {
11107
11211
  }
11108
11212
  }
11109
11213
  const assignKey = Symbol("_assign");
11214
+ const initialValueKey = Symbol("_initialValue");
11110
11215
  const vModelText = {
11111
11216
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11217
+ if (el.parentNode) {
11218
+ if (el.type === "text") el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
11219
+ else if (el.type === "textarea") el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
11220
+ }
11112
11221
  el[assignKey] = getModelAssigner(vnode);
11113
11222
  vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
11114
11223
  },
11115
- mounted(el, { value }) {
11116
- el.value = value == null ? "" : value;
11224
+ mounted(el, { value, modifiers: { trim, number } }) {
11225
+ const newValue = value == null ? "" : value;
11226
+ const initialValue = el[initialValueKey];
11227
+ delete el[initialValueKey];
11228
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) el[assignKey](castValue(el.value, trim, number));
11229
+ else el.value = newValue;
11117
11230
  },
11118
11231
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11119
11232
  el[assignKey] = getModelAssigner(vnode);
@@ -13739,7 +13852,7 @@ function getSelfName(filename) {
13739
13852
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
13740
13853
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
13741
13854
  }
13742
- function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
13855
+ function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
13743
13856
  const context = {
13744
13857
  filename,
13745
13858
  selfName: getSelfName(filename),
@@ -13761,7 +13874,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
13761
13874
  bindingMetadata,
13762
13875
  inline,
13763
13876
  isTS,
13764
- eventDelegation,
13765
13877
  onError,
13766
13878
  onWarn,
13767
13879
  compatConfig,
@@ -14572,15 +14684,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
14572
14684
  else {
14573
14685
  childBlock = children[0].codegenNode;
14574
14686
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
14575
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
14687
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
14688
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
14576
14689
  removeHelper(OPEN_BLOCK);
14577
14690
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
14578
14691
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
14579
- childBlock.isBlock = !isStableFragment;
14692
+ childBlock.isBlock = shouldUseBlock;
14580
14693
  if (childBlock.isBlock) {
14581
14694
  helper(OPEN_BLOCK);
14582
14695
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
14583
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
14696
+ } else {
14697
+ helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
14698
+ if (childBlock.needsPatch) {
14699
+ var _childBlock$patchFlag;
14700
+ childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
14701
+ }
14702
+ }
14584
14703
  }
14585
14704
  if (memo) {
14586
14705
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -14804,12 +14923,16 @@ const transformElement = (node, context) => {
14804
14923
  let vnodeDynamicProps;
14805
14924
  let dynamicPropNames;
14806
14925
  let vnodeDirectives;
14926
+ let needsPatch = false;
14927
+ let isBlockRequired = false;
14807
14928
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
14808
14929
  if (props.length > 0) {
14809
14930
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
14810
14931
  vnodeProps = propsBuildResult.props;
14811
14932
  patchFlag = propsBuildResult.patchFlag;
14812
14933
  dynamicPropNames = propsBuildResult.dynamicPropNames;
14934
+ needsPatch = propsBuildResult.needsPatch;
14935
+ isBlockRequired = propsBuildResult.isBlockRequired;
14813
14936
  const directives = propsBuildResult.directives;
14814
14937
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
14815
14938
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -14838,7 +14961,10 @@ const transformElement = (node, context) => {
14838
14961
  } else vnodeChildren = node.children;
14839
14962
  }
14840
14963
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
14841
- node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
14964
+ const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
14965
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
14966
+ if (needsPatch) vnodeCall.needsPatch = true;
14967
+ if (isBlockRequired) vnodeCall.isBlockRequired = true;
14842
14968
  };
14843
14969
  };
14844
14970
  function resolveComponentType(node, context, ssr = false) {
@@ -14872,6 +14998,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14872
14998
  const runtimeDirectives = [];
14873
14999
  const hasChildren = children.length > 0;
14874
15000
  let shouldUseBlock = false;
15001
+ let isBlockRequired = false;
14875
15002
  let patchFlag = 0;
14876
15003
  let hasRef = false;
14877
15004
  let hasClassBinding = false;
@@ -14896,12 +15023,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14896
15023
  const isEventHandler = isOn(name);
14897
15024
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
14898
15025
  if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
15026
+ if (name === "ref") hasRef = true;
14899
15027
  if (isEventHandler && value.type === 14) value = value.arguments[0];
14900
15028
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
14901
- if (name === "ref") hasRef = true;
14902
- else if (name === "class") hasClassBinding = true;
15029
+ if (name === "class") hasClassBinding = true;
14903
15030
  else if (name === "style") hasStyleBinding = true;
14904
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
15031
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
14905
15032
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
14906
15033
  } else hasDynamicKeys = true;
14907
15034
  };
@@ -14927,7 +15054,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14927
15054
  if (name === "once" || name === "memo") continue;
14928
15055
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
14929
15056
  if (isVOn && ssr) continue;
14930
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
15057
+ if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
15058
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
15059
+ shouldUseBlock = true;
15060
+ isBlockRequired = true;
15061
+ }
14931
15062
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
14932
15063
  if (!arg && (isVBind || isVOn)) {
14933
15064
  hasDynamicKeys = true;
@@ -14969,7 +15100,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14969
15100
  }
14970
15101
  } else if (!isBuiltInDirective(name)) {
14971
15102
  runtimeDirectives.push(prop);
14972
- if (hasChildren) shouldUseBlock = true;
15103
+ if (hasChildren) {
15104
+ shouldUseBlock = true;
15105
+ isBlockRequired = true;
15106
+ }
14973
15107
  }
14974
15108
  }
14975
15109
  }
@@ -14986,7 +15120,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14986
15120
  if (dynamicPropNames.length) patchFlag |= 8;
14987
15121
  if (hasHydrationEventBinding) patchFlag |= 32;
14988
15122
  }
14989
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
15123
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
15124
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
14990
15125
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
14991
15126
  case 15:
14992
15127
  let classKeyIndex = -1;
@@ -15016,7 +15151,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
15016
15151
  directives: runtimeDirectives,
15017
15152
  patchFlag,
15018
15153
  dynamicPropNames,
15019
- shouldUseBlock
15154
+ shouldUseBlock,
15155
+ needsPatch,
15156
+ isBlockRequired
15020
15157
  };
15021
15158
  }
15022
15159
  function dedupeProperties(properties) {
@@ -15683,6 +15820,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
15683
15820
  const eventOptionModifiers = [];
15684
15821
  for (let i = 0; i < modifiers.length; i++) {
15685
15822
  const modifier = modifiers[i].content;
15823
+ if (modifier === "delegate") {
15824
+ if (context) {
15825
+ const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
15826
+ error.loc = modifiers[i].loc;
15827
+ context.onWarn(error);
15828
+ }
15829
+ continue;
15830
+ }
15686
15831
  if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
15687
15832
  else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
15688
15833
  else {