@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -325,7 +325,7 @@ const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
325
325
  /**
326
326
  * The full list is needed during SSR to produce the correct initial markup.
327
327
  */
328
- const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
328
+ const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
329
329
  /**
330
330
  * Boolean attributes should be included if the value is truthy or ''.
331
331
  * e.g. `<select multiple>` compiles to `{ multiple: '' }`
@@ -2645,7 +2645,7 @@ function queueFlush() {
2645
2645
  function queuePostFlushCb(jobs, id = Infinity) {
2646
2646
  if (!isArray(jobs)) if (activePostJobs && id === -1) activePostJobs.splice(postFlushIndex, 0, jobs);
2647
2647
  else queueJobWorker(jobs, id, postJobs, postJobs.length, 0);
2648
- else for (const job of jobs) queueJobWorker(job, id, postJobs, postJobs.length, 0);
2648
+ else for (let i = 0; i < jobs.length; i++) queueJobWorker(jobs[i], id, postJobs, postJobs.length, 0);
2649
2649
  queueFlush();
2650
2650
  }
2651
2651
  function flushPreFlushCbs(instance, seen) {
@@ -2666,7 +2666,7 @@ function flushPreFlushCbs(instance, seen) {
2666
2666
  function flushPostFlushCbs(seen) {
2667
2667
  if (postJobs.length) {
2668
2668
  if (activePostJobs) {
2669
- activePostJobs.push(...postJobs);
2669
+ for (let i = 0; i < postJobs.length; i++) activePostJobs.push(postJobs[i]);
2670
2670
  postJobs.length = 0;
2671
2671
  return;
2672
2672
  }
@@ -3575,7 +3575,7 @@ function instanceWatch(source, value, options) {
3575
3575
  }
3576
3576
  const prev = setCurrentInstance(this);
3577
3577
  const res = doWatch(getter, cb.bind(publicThis), options);
3578
- setCurrentInstance(...prev);
3578
+ restoreCurrentInstance(prev);
3579
3579
  return res;
3580
3580
  }
3581
3581
  function createPathGetter(ctx, path) {
@@ -3848,49 +3848,16 @@ const BaseTransitionImpl = {
3848
3848
  setup(props, { slots }) {
3849
3849
  const instance = getCurrentInstance();
3850
3850
  const state = useTransitionState();
3851
+ let resumeAfterLeave;
3851
3852
  return () => {
3852
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
3853
- const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3853
+ const child = resolveTransitionChild(slots.default && slots.default(), !!instance.subTree);
3854
3854
  if (!child) return;
3855
3855
  const rawProps = /* @__PURE__ */ toRaw(props);
3856
3856
  const { mode } = rawProps;
3857
3857
  checkTransitionMode(mode);
3858
- if (state.isLeaving) return emptyPlaceholder(child);
3859
- const innerChild = getInnerChild$1(child);
3860
- if (!innerChild) return emptyPlaceholder(child);
3861
- let enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance, (hooks) => enterHooks = hooks);
3862
- if (innerChild.type !== Comment) setTransitionHooks(innerChild, enterHooks);
3863
- let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3864
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
3865
- let leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
3866
- setTransitionHooks(oldInnerChild, leavingHooks);
3867
- if (mode === "out-in" && innerChild.type !== Comment) {
3868
- state.isLeaving = true;
3869
- leavingHooks.afterLeave = () => {
3870
- state.isLeaving = false;
3871
- if (!(instance.job.flags & 4)) instance.update();
3872
- delete leavingHooks.afterLeave;
3873
- oldInnerChild = void 0;
3874
- };
3875
- return emptyPlaceholder(child);
3876
- } else if (mode === "in-out" && innerChild.type !== Comment) leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3877
- const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
3878
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3879
- el[leaveCbKey] = () => {
3880
- earlyRemove();
3881
- el[leaveCbKey] = void 0;
3882
- delete enterHooks.delayedLeave;
3883
- oldInnerChild = void 0;
3884
- };
3885
- enterHooks.delayedLeave = () => {
3886
- delayedLeave();
3887
- delete enterHooks.delayedLeave;
3888
- oldInnerChild = void 0;
3889
- };
3890
- };
3891
- else oldInnerChild = void 0;
3892
- } else if (oldInnerChild) oldInnerChild = void 0;
3893
- return child;
3858
+ return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
3859
+ if (!(instance.job.flags & 4)) instance.update();
3860
+ }) : NOOP);
3894
3861
  };
3895
3862
  }
3896
3863
  };
@@ -4033,16 +4000,91 @@ function getInnerChild$1(vnode) {
4033
4000
  if (shapeFlag & 32 && isFunction(children.default)) return children.default();
4034
4001
  }
4035
4002
  }
4003
+ function resolveTransitionChild(children, renderEmpty = false) {
4004
+ const branches = children && getTransitionRawChildren(children, true);
4005
+ return branches && branches.length ? findNonCommentChild(branches) : renderEmpty ? createCommentVNode() : void 0;
4006
+ }
4007
+ /**
4008
+ * @internal
4009
+ */
4010
+ function prepareTransitionSwitch(previous, next, props, state, instance, resumeAfterLeave, delayedLeaveSource) {
4011
+ if (state.isLeaving) return emptyPlaceholder(next);
4012
+ const nextInner = getInnerChild$1(next);
4013
+ if (!nextInner) return emptyPlaceholder(next);
4014
+ let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
4015
+ if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
4016
+ enterHooks = hooks;
4017
+ });
4018
+ if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
4019
+ if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
4020
+ const mode = props.mode;
4021
+ const previousInner = previous && getInnerChild$1(previous);
4022
+ if (previous && previousInner && previousInner.type !== Comment && !isSameVNodeType(previousInner, nextInner) && (!previous.component || recursiveGetSubtree(previous.component).type !== Comment)) {
4023
+ const leavingHooks = prepareLeavingTransitionHooks(previousInner, props, state, instance);
4024
+ 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);
4025
+ }
4026
+ return next;
4027
+ }
4028
+ function forwardDelayedLeave(hooks, source) {
4029
+ const delayedLeave = source && source.delayedLeave;
4030
+ if (!delayedLeave) return;
4031
+ hooks.delayedLeave = () => {
4032
+ if (source.delayedLeave === delayedLeave) delayedLeave();
4033
+ delete hooks.delayedLeave;
4034
+ };
4035
+ }
4036
+ function prepareLeavingTransitionHooks(previousInner, props, state, instance) {
4037
+ return setTransitionHooks(previousInner, resolveTransitionHooks(previousInner, props, state, instance));
4038
+ }
4039
+ function applyTransitionModeSwitch(leavingVNode, leavingHooks, getEnterHooks, props, state, resumeAfterLeave) {
4040
+ if (props.mode === "out-in") {
4041
+ state.isLeaving = true;
4042
+ leavingHooks.afterLeave = () => {
4043
+ state.isLeaving = false;
4044
+ resumeAfterLeave();
4045
+ delete leavingHooks.afterLeave;
4046
+ };
4047
+ return true;
4048
+ } else if (props.mode === "in-out" && getEnterHooks) {
4049
+ let delayedLeavingVNode = leavingVNode;
4050
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
4051
+ const enterHooks = getEnterHooks();
4052
+ if (!enterHooks) {
4053
+ delayedLeave();
4054
+ return;
4055
+ }
4056
+ const vnode = delayedLeavingVNode;
4057
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
4058
+ leavingVNodesCache[String(vnode.key)] = vnode;
4059
+ el[leaveCbKey] = () => {
4060
+ earlyRemove();
4061
+ el[leaveCbKey] = void 0;
4062
+ delete enterHooks.delayedLeave;
4063
+ delayedLeavingVNode = void 0;
4064
+ };
4065
+ enterHooks.delayedLeave = () => {
4066
+ delayedLeave();
4067
+ delete enterHooks.delayedLeave;
4068
+ delayedLeavingVNode = void 0;
4069
+ };
4070
+ };
4071
+ }
4072
+ return false;
4073
+ }
4036
4074
  function setTransitionHooks(vnode, hooks) {
4037
- if (vnode.shapeFlag & 6 && vnode.component) if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
4038
- else {
4075
+ if (vnode.shapeFlag & 6 && vnode.component) {
4039
4076
  vnode.transition = hooks;
4040
- setTransitionHooks(vnode.component.subTree, hooks);
4041
- }
4042
- else if (vnode.shapeFlag & 128) {
4043
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4044
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
4077
+ if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
4078
+ else {
4079
+ const subTree = vnode.component.subTree;
4080
+ return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
4081
+ }
4082
+ } else if (vnode.shapeFlag & 128) {
4083
+ const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4084
+ const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
4085
+ return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
4045
4086
  } else vnode.transition = hooks;
4087
+ return hooks;
4046
4088
  }
4047
4089
  function getTransitionRawChildren(children, keepComment = false, parentKey) {
4048
4090
  let ret = [];
@@ -4394,7 +4436,10 @@ function createHydrationFunctions(rendererInternals) {
4394
4436
  const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4395
4437
  for (const key in props) {
4396
4438
  if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
4397
- 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);
4439
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4440
+ if (isUnchangedResourceProp(el, key, props[key])) continue;
4441
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4442
+ }
4398
4443
  }
4399
4444
  }
4400
4445
  let vnodeHooks;
@@ -4503,6 +4548,16 @@ const isTemplateNode$1 = (node) => {
4503
4548
  /**
4504
4549
  * Dev only
4505
4550
  */
4551
+ const resourceProps = /* @__PURE__ */ new Set([
4552
+ "src",
4553
+ "srcset",
4554
+ "href",
4555
+ "poster"
4556
+ ]);
4557
+ function isUnchangedResourceProp(el, key, clientValue) {
4558
+ if (!resourceProps.has(key)) return false;
4559
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4560
+ }
4506
4561
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4507
4562
  let mismatchType;
4508
4563
  let mismatchKey;
@@ -4543,7 +4598,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4543
4598
  function getAttributeMismatch(el, key, clientValue) {
4544
4599
  let actual;
4545
4600
  let expected;
4546
- if (isBooleanAttr(key)) {
4601
+ if (key === "hidden") {
4602
+ actual = normalizeHiddenValue(el.getAttribute(key));
4603
+ expected = normalizeHiddenValue(clientValue);
4604
+ } else if (isBooleanAttr(key)) {
4547
4605
  actual = el.hasAttribute(key);
4548
4606
  expected = includeBooleanAttr(clientValue);
4549
4607
  } else if (clientValue == null) {
@@ -4571,6 +4629,11 @@ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
4571
4629
  }
4572
4630
  return false;
4573
4631
  }
4632
+ function normalizeHiddenValue(value) {
4633
+ if (!isRenderableAttrValue(value)) return false;
4634
+ if (isString(value)) return value.toLowerCase() === "until-found" ? "until-found" : "";
4635
+ return includeBooleanAttr(value) ? "" : false;
4636
+ }
4574
4637
  function toClassSet(str) {
4575
4638
  return new Set(str.trim().split(/\s+/));
4576
4639
  }
@@ -5111,7 +5174,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
5111
5174
  try {
5112
5175
  return callWithAsyncErrorHandling(hook, target, type, args);
5113
5176
  } finally {
5114
- setCurrentInstance(...prev);
5177
+ restoreCurrentInstance(prev);
5115
5178
  setActiveSub(prevSub);
5116
5179
  }
5117
5180
  });
@@ -5450,7 +5513,8 @@ function createSlots(slots, dynamicSlots) {
5450
5513
  * Compiler runtime helper for rendering `<slot/>`
5451
5514
  * @private
5452
5515
  */
5453
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5516
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5517
+ if (props == null) props = {};
5454
5518
  let slot = slots[name];
5455
5519
  if (fallback) fallback.__vdom = true;
5456
5520
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
@@ -6407,7 +6471,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6407
6471
  if (options.el) return vm.$mount(options.el);
6408
6472
  else return vm;
6409
6473
  }
6410
- Vue.version = `2.6.14-compat:3.6.0-rc.1`;
6474
+ Vue.version = `2.6.14-compat:3.6.0-rc.3`;
6411
6475
  Vue.config = singletonApp.config;
6412
6476
  Vue.use = (plugin, ...options) => {
6413
6477
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -7105,8 +7169,9 @@ function renderComponentRoot(instance) {
7105
7169
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7106
7170
  }
7107
7171
  if (vnode.transition) {
7108
- if (!isElementRoot(root)) warn$1("Component inside <Transition> renders non-element root node that cannot be animated.");
7109
- setTransitionHooks(root, vnode.transition);
7172
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
7173
+ if (!isElementRoot(child)) warn$1("Component inside <Transition> renders non-element root node that cannot be animated.");
7174
+ setTransitionHooks(child, vnode.transition);
7110
7175
  }
7111
7176
  if (setRoot) setRoot(root);
7112
7177
  else result = root;
@@ -7166,9 +7231,10 @@ function filterSingleRoot(children, recurse = true) {
7166
7231
  }
7167
7232
  return singleRoot;
7168
7233
  }
7234
+ const isFunctionalFallthroughKey = (key) => key === "class" || key === "style" || isOn(key);
7169
7235
  const getFunctionalFallthrough = (attrs) => {
7170
7236
  let res;
7171
- for (const key in attrs) if (key === "class" || key === "style" || isOn(key)) (res || (res = {}))[key] = attrs[key];
7237
+ for (const key in attrs) if (isFunctionalFallthroughKey(key)) (res || (res = {}))[key] = attrs[key];
7172
7238
  return res;
7173
7239
  };
7174
7240
  const filterModelListeners = (attrs, props) => {
@@ -7400,7 +7466,7 @@ function baseResolveDefault(factory, instance, key) {
7400
7466
  const prev = setCurrentInstance(instance);
7401
7467
  const props = /* @__PURE__ */ toRaw(instance.props);
7402
7468
  value = factory.call(isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null, props);
7403
- setCurrentInstance(...prev);
7469
+ restoreCurrentInstance(prev);
7404
7470
  return value;
7405
7471
  }
7406
7472
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
@@ -7961,7 +8027,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7961
8027
  };
7962
8028
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7963
8029
  n2.slotScopeIds = slotScopeIds;
7964
- if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
8030
+ if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
7965
8031
  else {
7966
8032
  const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
7967
8033
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
@@ -8314,7 +8380,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8314
8380
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
8315
8381
  const { el, type, transition, children, shapeFlag } = vnode;
8316
8382
  if (isVaporComponent(type) || type === VaporSlot) {
8317
- getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
8383
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
8318
8384
  return;
8319
8385
  }
8320
8386
  if (shapeFlag & 6) {
@@ -8370,7 +8436,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8370
8436
  }
8371
8437
  if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
8372
8438
  if (shapeFlag & 256) {
8373
- if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
8439
+ if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
8374
8440
  else parentComponent.ctx.deactivate(vnode);
8375
8441
  return;
8376
8442
  }
@@ -8380,7 +8446,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8380
8446
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
8381
8447
  if (shapeFlag & 6) if (isVaporComponent(type)) {
8382
8448
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
8383
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8449
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
8384
8450
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
8385
8451
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8386
8452
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -8397,7 +8463,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8397
8463
  else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
8398
8464
  else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
8399
8465
  if (type === VaporSlot) {
8400
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8466
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
8401
8467
  return;
8402
8468
  }
8403
8469
  if (doRemove) remove(vnode);
@@ -8698,6 +8764,10 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
8698
8764
  suspense.activeBranch = pendingBranch;
8699
8765
  } else unmount(pendingBranch, parentComponent, suspense);
8700
8766
  suspense.deps = 0;
8767
+ for (let i = 0; i < suspense.effects.length; i++) {
8768
+ const effect = suspense.effects[i];
8769
+ if (effect.flags & 8) queuePostFlushCb(effect);
8770
+ }
8701
8771
  suspense.effects.length = 0;
8702
8772
  suspense.hiddenContainer = createElement("div");
8703
8773
  if (isInFallback) {
@@ -8805,7 +8875,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8805
8875
  let hasUnresolvedAncestor = false;
8806
8876
  while (parent) {
8807
8877
  if (parent.pendingBranch) {
8808
- parent.effects.push(...effects);
8878
+ for (let i = 0; i < effects.length; i++) parent.effects.push(effects[i]);
8809
8879
  hasUnresolvedAncestor = true;
8810
8880
  break;
8811
8881
  }
@@ -9115,11 +9185,26 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
9115
9185
  if (shapeFlag & 128) type.normalize(vnode);
9116
9186
  } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
9117
9187
  if (vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
9188
+ if (props && vnode.shapeFlag & 1) {
9189
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
9190
+ 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.`);
9191
+ }
9118
9192
  if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
9119
9193
  convertLegacyVModelProps(vnode);
9120
9194
  defineLegacyVNodeProperties(vnode);
9121
9195
  return vnode;
9122
9196
  }
9197
+ /**
9198
+ * dev only
9199
+ * Whether children would actually render something. Empty text and empty
9200
+ * arrays are ignored, mirroring the compiler's `node.children.length` check
9201
+ * for `v-html` / `v-text`.
9202
+ */
9203
+ function hasContentChildren(children) {
9204
+ if (isString(children)) return children !== "";
9205
+ if (isArray(children)) return children.length > 0;
9206
+ return false;
9207
+ }
9123
9208
  const createVNode = createVNodeWithArgsTransform;
9124
9209
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
9125
9210
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -9350,6 +9435,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
9350
9435
  simpleSetCurrentInstance(instance);
9351
9436
  }
9352
9437
  };
9438
+ /**
9439
+ * Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
9440
+ * `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
9441
+ * verbatim instead of re-triggering the `instance.scope` default.
9442
+ * @internal
9443
+ */
9444
+ const restoreCurrentInstance = (prev) => {
9445
+ setCurrentScope(prev[1]);
9446
+ simpleSetCurrentInstance(prev[0]);
9447
+ };
9353
9448
  const internalOptions = [
9354
9449
  "ce",
9355
9450
  "type",
@@ -9501,7 +9596,7 @@ function setupStatefulComponent(instance, isSSR) {
9501
9596
  const setupResult = callWithErrorHandling(setup, instance, 0, [/* @__PURE__ */ shallowReadonly(instance.props), setupContext]);
9502
9597
  const isAsyncSetup = isPromise(setupResult);
9503
9598
  setActiveSub(prevSub);
9504
- setCurrentInstance(...prev);
9599
+ restoreCurrentInstance(prev);
9505
9600
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
9506
9601
  if (isAsyncSetup) {
9507
9602
  const unsetCurrentInstance = () => {
@@ -9509,7 +9604,12 @@ function setupStatefulComponent(instance, isSSR) {
9509
9604
  };
9510
9605
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9511
9606
  if (isSSR) return setupResult.then((resolvedResult) => {
9512
- handleSetupResult(instance, resolvedResult, isSSR);
9607
+ setInSSRSetupState(true);
9608
+ try {
9609
+ handleSetupResult(instance, resolvedResult, isSSR);
9610
+ } finally {
9611
+ setInSSRSetupState(false);
9612
+ }
9513
9613
  }).catch((e) => {
9514
9614
  handleError(e, instance, 0);
9515
9615
  });
@@ -9575,7 +9675,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9575
9675
  applyOptions(instance);
9576
9676
  } finally {
9577
9677
  setActiveSub(prevSub);
9578
- setCurrentInstance(...prevInstance);
9678
+ restoreCurrentInstance(prevInstance);
9579
9679
  }
9580
9680
  }
9581
9681
  if (!Component.render && instance.render === NOOP && !isSSR) if (!compile$1 && Component.template)
@@ -9885,7 +9985,7 @@ function isMemoSame(cached, memo) {
9885
9985
  }
9886
9986
  //#endregion
9887
9987
  //#region packages/runtime-core/src/index.ts
9888
- const version = "3.6.0-rc.1";
9988
+ const version = "3.6.0-rc.3";
9889
9989
  const warn = warn$1;
9890
9990
  /**
9891
9991
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10596,7 +10696,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10596
10696
  if (!this._instance) if (this._resolved) this._mountComponent(this._def);
10597
10697
  else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
10598
10698
  this._pendingResolve = void 0;
10599
- this._resolveDef();
10699
+ if (this.isConnected) return this._resolveDef();
10600
10700
  });
10601
10701
  else this._resolveDef();
10602
10702
  }
@@ -10632,7 +10732,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10632
10732
  * resolve inner component definition (handle possible async component)
10633
10733
  */
10634
10734
  _resolveDef() {
10635
- if (this._pendingResolve) return;
10735
+ if (this._pendingResolve) return this._pendingResolve;
10636
10736
  for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
10637
10737
  this._ob = new MutationObserver(this._processMutations.bind(this));
10638
10738
  this._ob.observe(this, { attributes: true });
@@ -10662,6 +10762,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10662
10762
  this._def = def;
10663
10763
  resolve(def);
10664
10764
  });
10765
+ return this._pendingResolve;
10665
10766
  } else resolve(this._def);
10666
10767
  }
10667
10768
  _mountComponent(def) {
@@ -10700,14 +10801,17 @@ var VueElementBase = class VueElementBase extends BaseClass {
10700
10801
  const { props } = def;
10701
10802
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
10702
10803
  for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
10703
- for (const key of declaredPropKeys.map(camelize)) Object.defineProperty(this, key, {
10704
- get() {
10705
- return this._getProp(key);
10706
- },
10707
- set(val) {
10708
- this._setProp(key, val, true, !this._patching);
10709
- }
10710
- });
10804
+ for (const key of declaredPropKeys.map(camelize)) {
10805
+ if (key in Object.getPrototypeOf(this)) warn(`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`);
10806
+ Object.defineProperty(this, key, {
10807
+ get() {
10808
+ return this._getProp(key);
10809
+ },
10810
+ set(val) {
10811
+ this._setProp(key, val, true, !this._patching);
10812
+ }
10813
+ });
10814
+ }
10711
10815
  }
10712
10816
  _setAttr(key) {
10713
10817
  if (key.startsWith("data-v-")) return;
@@ -11125,13 +11229,22 @@ function onCompositionEnd(e) {
11125
11229
  }
11126
11230
  }
11127
11231
  const assignKey = Symbol("_assign");
11232
+ const initialValueKey = Symbol("_initialValue");
11128
11233
  const vModelText = {
11129
11234
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11235
+ if (el.parentNode) {
11236
+ if (el.type === "text") el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
11237
+ else if (el.type === "textarea") el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
11238
+ }
11130
11239
  el[assignKey] = getModelAssigner(vnode);
11131
11240
  vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
11132
11241
  },
11133
- mounted(el, { value }) {
11134
- el.value = value == null ? "" : value;
11242
+ mounted(el, { value, modifiers: { trim, number } }) {
11243
+ const newValue = value == null ? "" : value;
11244
+ const initialValue = el[initialValueKey];
11245
+ delete el[initialValueKey];
11246
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) el[assignKey](castValue(el.value, trim, number));
11247
+ else el.value = newValue;
11135
11248
  },
11136
11249
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11137
11250
  el[assignKey] = getModelAssigner(vnode);
@@ -14521,7 +14634,7 @@ function getSelfName(filename) {
14521
14634
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
14522
14635
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
14523
14636
  }
14524
- 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 }) {
14637
+ 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 }) {
14525
14638
  const context = {
14526
14639
  filename,
14527
14640
  selfName: getSelfName(filename),
@@ -14543,7 +14656,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
14543
14656
  bindingMetadata,
14544
14657
  inline,
14545
14658
  isTS,
14546
- eventDelegation,
14547
14659
  onError,
14548
14660
  onWarn,
14549
14661
  compatConfig,
@@ -15614,15 +15726,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
15614
15726
  else {
15615
15727
  childBlock = children[0].codegenNode;
15616
15728
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
15617
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
15729
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
15730
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
15618
15731
  removeHelper(OPEN_BLOCK);
15619
15732
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
15620
15733
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
15621
- childBlock.isBlock = !isStableFragment;
15734
+ childBlock.isBlock = shouldUseBlock;
15622
15735
  if (childBlock.isBlock) {
15623
15736
  helper(OPEN_BLOCK);
15624
15737
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
15625
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
15738
+ } else {
15739
+ helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
15740
+ if (childBlock.needsPatch) {
15741
+ var _childBlock$patchFlag;
15742
+ childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
15743
+ }
15744
+ }
15626
15745
  }
15627
15746
  if (memo) {
15628
15747
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -15880,12 +15999,16 @@ const transformElement = (node, context) => {
15880
15999
  let vnodeDynamicProps;
15881
16000
  let dynamicPropNames;
15882
16001
  let vnodeDirectives;
16002
+ let needsPatch = false;
16003
+ let isBlockRequired = false;
15883
16004
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
15884
16005
  if (props.length > 0) {
15885
16006
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
15886
16007
  vnodeProps = propsBuildResult.props;
15887
16008
  patchFlag = propsBuildResult.patchFlag;
15888
16009
  dynamicPropNames = propsBuildResult.dynamicPropNames;
16010
+ needsPatch = propsBuildResult.needsPatch;
16011
+ isBlockRequired = propsBuildResult.isBlockRequired;
15889
16012
  const directives = propsBuildResult.directives;
15890
16013
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
15891
16014
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -15914,7 +16037,10 @@ const transformElement = (node, context) => {
15914
16037
  } else vnodeChildren = node.children;
15915
16038
  }
15916
16039
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
15917
- node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
16040
+ const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
16041
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
16042
+ if (needsPatch) vnodeCall.needsPatch = true;
16043
+ if (isBlockRequired) vnodeCall.isBlockRequired = true;
15918
16044
  };
15919
16045
  };
15920
16046
  function resolveComponentType(node, context, ssr = false) {
@@ -15999,6 +16125,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
15999
16125
  const runtimeDirectives = [];
16000
16126
  const hasChildren = children.length > 0;
16001
16127
  let shouldUseBlock = false;
16128
+ let isBlockRequired = false;
16002
16129
  let patchFlag = 0;
16003
16130
  let hasRef = false;
16004
16131
  let hasClassBinding = false;
@@ -16023,12 +16150,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16023
16150
  const isEventHandler = isOn(name);
16024
16151
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
16025
16152
  if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
16153
+ if (name === "ref") hasRef = true;
16026
16154
  if (isEventHandler && value.type === 14) value = value.arguments[0];
16027
16155
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
16028
- if (name === "ref") hasRef = true;
16029
- else if (name === "class") hasClassBinding = true;
16156
+ if (name === "class") hasClassBinding = true;
16030
16157
  else if (name === "style") hasStyleBinding = true;
16031
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
16158
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
16032
16159
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
16033
16160
  } else hasDynamicKeys = true;
16034
16161
  };
@@ -16061,7 +16188,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16061
16188
  if (name === "once" || name === "memo") continue;
16062
16189
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
16063
16190
  if (isVOn && ssr) continue;
16064
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
16191
+ if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
16192
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
16193
+ shouldUseBlock = true;
16194
+ isBlockRequired = true;
16195
+ }
16065
16196
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
16066
16197
  if (!arg && (isVBind || isVOn)) {
16067
16198
  hasDynamicKeys = true;
@@ -16103,7 +16234,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16103
16234
  }
16104
16235
  } else if (!isBuiltInDirective(name)) {
16105
16236
  runtimeDirectives.push(prop);
16106
- if (hasChildren) shouldUseBlock = true;
16237
+ if (hasChildren) {
16238
+ shouldUseBlock = true;
16239
+ isBlockRequired = true;
16240
+ }
16107
16241
  }
16108
16242
  }
16109
16243
  }
@@ -16120,7 +16254,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16120
16254
  if (dynamicPropNames.length) patchFlag |= 8;
16121
16255
  if (hasHydrationEventBinding) patchFlag |= 32;
16122
16256
  }
16123
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
16257
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
16258
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
16124
16259
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
16125
16260
  case 15:
16126
16261
  let classKeyIndex = -1;
@@ -16150,7 +16285,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16150
16285
  directives: runtimeDirectives,
16151
16286
  patchFlag,
16152
16287
  dynamicPropNames,
16153
- shouldUseBlock
16288
+ shouldUseBlock,
16289
+ needsPatch,
16290
+ isBlockRequired
16154
16291
  };
16155
16292
  }
16156
16293
  function dedupeProperties(properties) {
@@ -16848,6 +16985,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
16848
16985
  const eventOptionModifiers = [];
16849
16986
  for (let i = 0; i < modifiers.length; i++) {
16850
16987
  const modifier = modifiers[i].content;
16988
+ if (modifier === "delegate") {
16989
+ if (context) {
16990
+ const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
16991
+ error.loc = modifiers[i].loc;
16992
+ context.onWarn(error);
16993
+ }
16994
+ continue;
16995
+ }
16851
16996
  if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
16852
16997
  else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
16853
16998
  else {
@@ -17099,10 +17244,11 @@ function stringifyElement(node, context) {
17099
17244
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
17100
17245
  continue;
17101
17246
  }
17102
- if (isBooleanAttr(p.arg.content) && exp.content === "false") continue;
17247
+ if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
17103
17248
  let evaluated = evaluateConstant(exp);
17104
17249
  if (evaluated != null) {
17105
17250
  const arg = p.arg && p.arg.content;
17251
+ if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) continue;
17106
17252
  if (arg === "class") evaluated = normalizeClass(evaluated);
17107
17253
  else if (arg === "style") evaluated = stringifyStyle(normalizeStyle(evaluated));
17108
17254
  res += ` ${p.arg.content}="${escapeHtml(evaluated)}"`;