@vue/compat 3.6.0-rc.2 → 3.6.0-rc.4

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.
@@ -327,7 +327,12 @@ declare enum SchedulerJobFlags {
327
327
  * stabilizes (#1727).
328
328
  */
329
329
  ALLOW_RECURSE = 2,
330
- DISPOSED = 4
330
+ DISPOSED = 4,
331
+ /**
332
+ * Requeue a Suspense effect if its pending branch is discarded.
333
+ * @internal
334
+ */
335
+ REQUEUE_ON_SUSPENSE_DISCARD = 8
331
336
  }
332
337
  interface SchedulerJob extends Function {
333
338
  order?: number;
@@ -785,7 +790,23 @@ declare function configureCompat(config: CompatConfig): void;
785
790
  * ```
786
791
  */
787
792
  interface ComponentCustomOptions {}
788
- type RenderFunction = () => VNodeChild;
793
+ /**
794
+ * Registry for additional render result types.
795
+ *
796
+ * @example
797
+ * ```ts
798
+ * import type { VaporRenderResult } from 'vue'
799
+ *
800
+ * declare module 'vue' {
801
+ * interface RenderResultExtensions {
802
+ * vapor: VaporRenderResult
803
+ * }
804
+ * }
805
+ * ```
806
+ */
807
+ interface RenderResultExtensions {}
808
+ type RenderResult = VNodeChild | RenderResultExtensions[keyof RenderResultExtensions] | RenderResult[];
809
+ type RenderFunction = () => RenderResult;
789
810
  interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II, Provide>, ComponentInternalOptions, AsyncComponentInternalOptions, ComponentCustomOptions {
790
811
  setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, "P">>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
791
812
  name?: string;
@@ -1014,7 +1035,7 @@ interface AppConfig extends GenericAppConfig {
1014
1035
  /**
1015
1036
  * The vapor in vdom implementation is in runtime-vapor/src/vdomInterop.ts
1016
1037
  */
1017
- interface VaporInteropInterface {
1038
+ interface VaporInVdomInterface {
1018
1039
  mount(vnode: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, onBeforeMount?: () => void, onVnodeBeforeMount?: () => void): GenericComponentInstance;
1019
1040
  update(n1: VNode, n2: VNode, shouldUpdate: boolean, onBeforeUpdate?: () => void, onVnodeBeforeUpdate?: () => void): void;
1020
1041
  unmount(vnode: VNode, doRemove: boolean | undefined, parentSuspense: SuspenseBoundary | null): void;
@@ -1025,10 +1046,14 @@ interface VaporInteropInterface {
1025
1046
  activate(vnode: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance, parentSuspense: SuspenseBoundary | null): void;
1026
1047
  deactivate(vnode: VNode, container: any, parentSuspense: SuspenseBoundary | null): void;
1027
1048
  setTransitionHooks(component: ComponentInternalInstance, transition: TransitionHooks): void;
1028
- vdomMount: (component: ConcreteComponent, parentComponent: any, props?: any, slots?: any, once?: boolean) => any;
1029
- vdomUnmount: UnmountComponentFn;
1030
- vdomSlot: (slots: any, name: string | (() => string), props: Record<string, any>, parentComponent: any, fallback?: any, once?: boolean, slotRoot?: boolean) => any;
1031
- vdomMountVNode: (vnode: VNode, parentComponent: any) => any;
1049
+ }
1050
+ /**
1051
+ * The vdom in vapor implementation is in runtime-vapor/src/vdomInterop.ts
1052
+ */
1053
+ interface VdomInVaporInterface {
1054
+ mount: (component: ConcreteComponent, parentComponent: any, props?: any, slots?: any, once?: boolean) => any;
1055
+ slot: (slots: any, name: string | (() => string), props: Record<string, any>, parentComponent: any, fallback?: any, once?: boolean, slotRoot?: boolean, sharedFallback?: boolean, inheritFallback?: boolean, adoptAnchor?: Node) => any;
1056
+ mountVNode: (vnode: VNode, parentComponent: any) => any;
1032
1057
  }
1033
1058
  /**
1034
1059
  * Minimal app context shared between vdom and vapor
@@ -1047,7 +1072,11 @@ interface GenericAppContext {
1047
1072
  /**
1048
1073
  * @internal vapor interop only
1049
1074
  */
1050
- vapor?: VaporInteropInterface;
1075
+ vapor?: VaporInVdomInterface;
1076
+ /**
1077
+ * @internal vdom interop only
1078
+ */
1079
+ vdom?: VdomInVaporInterface;
1051
1080
  }
1052
1081
  interface AppContext extends GenericAppContext {
1053
1082
  config: AppConfig;
@@ -2001,8 +2030,10 @@ type VOnDirective = Directive<any, any, VOnModifiers>;
2001
2030
  //#region packages/runtime-dom/src/directives/vModel.d.ts
2002
2031
  type AssignerFn = (value: any) => void;
2003
2032
  declare const assignKey: unique symbol;
2033
+ declare const initialValueKey: unique symbol;
2004
2034
  type ModelDirective<T, Modifiers extends string = string> = ObjectDirective<T & {
2005
2035
  [assignKey]: AssignerFn;
2036
+ [initialValueKey]?: string;
2006
2037
  _assigning?: boolean;
2007
2038
  }, any, Modifiers>;
2008
2039
  declare const vModelText: ModelDirective<HTMLInputElement | HTMLTextAreaElement, "trim" | "number" | "lazy">;
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-rc.2
2
+ * @vue/compat v3.6.0-rc.4
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
  }
@@ -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,15 +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
4075
  if (vnode.shapeFlag & 6 && vnode.component) {
4038
4076
  vnode.transition = hooks;
4039
4077
  if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
4040
- else setTransitionHooks(vnode.component.subTree, hooks);
4078
+ else {
4079
+ const subTree = vnode.component.subTree;
4080
+ return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
4081
+ }
4041
4082
  } else if (vnode.shapeFlag & 128) {
4042
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4043
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
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;
4044
4086
  } else vnode.transition = hooks;
4087
+ return hooks;
4045
4088
  }
4046
4089
  function getTransitionRawChildren(children, keepComment = false, parentKey) {
4047
4090
  let ret = [];
@@ -4393,7 +4436,10 @@ function createHydrationFunctions(rendererInternals) {
4393
4436
  const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4394
4437
  for (const key in props) {
4395
4438
  if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
4396
- 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
+ }
4397
4443
  }
4398
4444
  }
4399
4445
  let vnodeHooks;
@@ -4502,6 +4548,16 @@ const isTemplateNode$1 = (node) => {
4502
4548
  /**
4503
4549
  * Dev only
4504
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
+ }
4505
4561
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4506
4562
  let mismatchType;
4507
4563
  let mismatchKey;
@@ -4542,7 +4598,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4542
4598
  function getAttributeMismatch(el, key, clientValue) {
4543
4599
  let actual;
4544
4600
  let expected;
4545
- if (isBooleanAttr(key)) {
4601
+ if (key === "hidden") {
4602
+ actual = normalizeHiddenValue(el.getAttribute(key));
4603
+ expected = normalizeHiddenValue(clientValue);
4604
+ } else if (isBooleanAttr(key)) {
4546
4605
  actual = el.hasAttribute(key);
4547
4606
  expected = includeBooleanAttr(clientValue);
4548
4607
  } else if (clientValue == null) {
@@ -4570,6 +4629,11 @@ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
4570
4629
  }
4571
4630
  return false;
4572
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
+ }
4573
4637
  function toClassSet(str) {
4574
4638
  return new Set(str.trim().split(/\s+/));
4575
4639
  }
@@ -5449,7 +5513,8 @@ function createSlots(slots, dynamicSlots) {
5449
5513
  * Compiler runtime helper for rendering `<slot/>`
5450
5514
  * @private
5451
5515
  */
5452
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5516
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5517
+ if (props == null) props = {};
5453
5518
  let slot = slots[name];
5454
5519
  if (fallback) fallback.__vdom = true;
5455
5520
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
@@ -6406,7 +6471,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6406
6471
  if (options.el) return vm.$mount(options.el);
6407
6472
  else return vm;
6408
6473
  }
6409
- Vue.version = `2.6.14-compat:3.6.0-rc.2`;
6474
+ Vue.version = `2.6.14-compat:3.6.0-rc.4`;
6410
6475
  Vue.config = singletonApp.config;
6411
6476
  Vue.use = (plugin, ...options) => {
6412
6477
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -7104,8 +7169,9 @@ function renderComponentRoot(instance) {
7104
7169
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7105
7170
  }
7106
7171
  if (vnode.transition) {
7107
- if (!isElementRoot(root)) warn$1("Component inside <Transition> renders non-element root node that cannot be animated.");
7108
- 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);
7109
7175
  }
7110
7176
  if (setRoot) setRoot(root);
7111
7177
  else result = root;
@@ -7165,9 +7231,10 @@ function filterSingleRoot(children, recurse = true) {
7165
7231
  }
7166
7232
  return singleRoot;
7167
7233
  }
7234
+ const isFunctionalFallthroughKey = (key) => key === "class" || key === "style" || isOn(key);
7168
7235
  const getFunctionalFallthrough = (attrs) => {
7169
7236
  let res;
7170
- 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];
7171
7238
  return res;
7172
7239
  };
7173
7240
  const filterModelListeners = (attrs, props) => {
@@ -8697,6 +8764,10 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
8697
8764
  suspense.activeBranch = pendingBranch;
8698
8765
  } else unmount(pendingBranch, parentComponent, suspense);
8699
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
+ }
8700
8771
  suspense.effects.length = 0;
8701
8772
  suspense.hiddenContainer = createElement("div");
8702
8773
  if (isInFallback) {
@@ -8804,7 +8875,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8804
8875
  let hasUnresolvedAncestor = false;
8805
8876
  while (parent) {
8806
8877
  if (parent.pendingBranch) {
8807
- parent.effects.push(...effects);
8878
+ for (let i = 0; i < effects.length; i++) parent.effects.push(effects[i]);
8808
8879
  hasUnresolvedAncestor = true;
8809
8880
  break;
8810
8881
  }
@@ -9114,11 +9185,26 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
9114
9185
  if (shapeFlag & 128) type.normalize(vnode);
9115
9186
  } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
9116
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
+ }
9117
9192
  if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
9118
9193
  convertLegacyVModelProps(vnode);
9119
9194
  defineLegacyVNodeProperties(vnode);
9120
9195
  return vnode;
9121
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
+ }
9122
9208
  const createVNode = createVNodeWithArgsTransform;
9123
9209
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
9124
9210
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -9518,7 +9604,12 @@ function setupStatefulComponent(instance, isSSR) {
9518
9604
  };
9519
9605
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9520
9606
  if (isSSR) return setupResult.then((resolvedResult) => {
9521
- handleSetupResult(instance, resolvedResult, isSSR);
9607
+ setInSSRSetupState(true);
9608
+ try {
9609
+ handleSetupResult(instance, resolvedResult, isSSR);
9610
+ } finally {
9611
+ setInSSRSetupState(false);
9612
+ }
9522
9613
  }).catch((e) => {
9523
9614
  handleError(e, instance, 0);
9524
9615
  });
@@ -9894,7 +9985,7 @@ function isMemoSame(cached, memo) {
9894
9985
  }
9895
9986
  //#endregion
9896
9987
  //#region packages/runtime-core/src/index.ts
9897
- const version = "3.6.0-rc.2";
9988
+ const version = "3.6.0-rc.4";
9898
9989
  const warn = warn$1;
9899
9990
  /**
9900
9991
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10605,7 +10696,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10605
10696
  if (!this._instance) if (this._resolved) this._mountComponent(this._def);
10606
10697
  else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
10607
10698
  this._pendingResolve = void 0;
10608
- this._resolveDef();
10699
+ if (this.isConnected) return this._resolveDef();
10609
10700
  });
10610
10701
  else this._resolveDef();
10611
10702
  }
@@ -10641,7 +10732,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10641
10732
  * resolve inner component definition (handle possible async component)
10642
10733
  */
10643
10734
  _resolveDef() {
10644
- if (this._pendingResolve) return;
10735
+ if (this._pendingResolve) return this._pendingResolve;
10645
10736
  for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
10646
10737
  this._ob = new MutationObserver(this._processMutations.bind(this));
10647
10738
  this._ob.observe(this, { attributes: true });
@@ -10671,6 +10762,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10671
10762
  this._def = def;
10672
10763
  resolve(def);
10673
10764
  });
10765
+ return this._pendingResolve;
10674
10766
  } else resolve(this._def);
10675
10767
  }
10676
10768
  _mountComponent(def) {
@@ -10709,14 +10801,17 @@ var VueElementBase = class VueElementBase extends BaseClass {
10709
10801
  const { props } = def;
10710
10802
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
10711
10803
  for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
10712
- for (const key of declaredPropKeys.map(camelize)) Object.defineProperty(this, key, {
10713
- get() {
10714
- return this._getProp(key);
10715
- },
10716
- set(val) {
10717
- this._setProp(key, val, true, !this._patching);
10718
- }
10719
- });
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
+ }
10720
10815
  }
10721
10816
  _setAttr(key) {
10722
10817
  if (key.startsWith("data-v-")) return;
@@ -11134,13 +11229,22 @@ function onCompositionEnd(e) {
11134
11229
  }
11135
11230
  }
11136
11231
  const assignKey = Symbol("_assign");
11232
+ const initialValueKey = Symbol("_initialValue");
11137
11233
  const vModelText = {
11138
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
+ }
11139
11239
  el[assignKey] = getModelAssigner(vnode);
11140
11240
  vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
11141
11241
  },
11142
- mounted(el, { value }) {
11143
- 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;
11144
11248
  },
11145
11249
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11146
11250
  el[assignKey] = getModelAssigner(vnode);
@@ -15622,15 +15726,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
15622
15726
  else {
15623
15727
  childBlock = children[0].codegenNode;
15624
15728
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
15625
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
15729
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
15730
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
15626
15731
  removeHelper(OPEN_BLOCK);
15627
15732
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
15628
15733
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
15629
- childBlock.isBlock = !isStableFragment;
15734
+ childBlock.isBlock = shouldUseBlock;
15630
15735
  if (childBlock.isBlock) {
15631
15736
  helper(OPEN_BLOCK);
15632
15737
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
15633
- } 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
+ }
15634
15745
  }
15635
15746
  if (memo) {
15636
15747
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -15888,12 +15999,16 @@ const transformElement = (node, context) => {
15888
15999
  let vnodeDynamicProps;
15889
16000
  let dynamicPropNames;
15890
16001
  let vnodeDirectives;
16002
+ let needsPatch = false;
16003
+ let isBlockRequired = false;
15891
16004
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
15892
16005
  if (props.length > 0) {
15893
16006
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
15894
16007
  vnodeProps = propsBuildResult.props;
15895
16008
  patchFlag = propsBuildResult.patchFlag;
15896
16009
  dynamicPropNames = propsBuildResult.dynamicPropNames;
16010
+ needsPatch = propsBuildResult.needsPatch;
16011
+ isBlockRequired = propsBuildResult.isBlockRequired;
15897
16012
  const directives = propsBuildResult.directives;
15898
16013
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
15899
16014
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -15922,7 +16037,10 @@ const transformElement = (node, context) => {
15922
16037
  } else vnodeChildren = node.children;
15923
16038
  }
15924
16039
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
15925
- 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;
15926
16044
  };
15927
16045
  };
15928
16046
  function resolveComponentType(node, context, ssr = false) {
@@ -16007,6 +16125,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16007
16125
  const runtimeDirectives = [];
16008
16126
  const hasChildren = children.length > 0;
16009
16127
  let shouldUseBlock = false;
16128
+ let isBlockRequired = false;
16010
16129
  let patchFlag = 0;
16011
16130
  let hasRef = false;
16012
16131
  let hasClassBinding = false;
@@ -16031,12 +16150,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16031
16150
  const isEventHandler = isOn(name);
16032
16151
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
16033
16152
  if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
16153
+ if (name === "ref") hasRef = true;
16034
16154
  if (isEventHandler && value.type === 14) value = value.arguments[0];
16035
16155
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
16036
- if (name === "ref") hasRef = true;
16037
- else if (name === "class") hasClassBinding = true;
16156
+ if (name === "class") hasClassBinding = true;
16038
16157
  else if (name === "style") hasStyleBinding = true;
16039
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
16158
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
16040
16159
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
16041
16160
  } else hasDynamicKeys = true;
16042
16161
  };
@@ -16069,7 +16188,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16069
16188
  if (name === "once" || name === "memo") continue;
16070
16189
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
16071
16190
  if (isVOn && ssr) continue;
16072
- 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
+ }
16073
16196
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
16074
16197
  if (!arg && (isVBind || isVOn)) {
16075
16198
  hasDynamicKeys = true;
@@ -16111,7 +16234,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16111
16234
  }
16112
16235
  } else if (!isBuiltInDirective(name)) {
16113
16236
  runtimeDirectives.push(prop);
16114
- if (hasChildren) shouldUseBlock = true;
16237
+ if (hasChildren) {
16238
+ shouldUseBlock = true;
16239
+ isBlockRequired = true;
16240
+ }
16115
16241
  }
16116
16242
  }
16117
16243
  }
@@ -16128,7 +16254,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16128
16254
  if (dynamicPropNames.length) patchFlag |= 8;
16129
16255
  if (hasHydrationEventBinding) patchFlag |= 32;
16130
16256
  }
16131
- 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;
16132
16259
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
16133
16260
  case 15:
16134
16261
  let classKeyIndex = -1;
@@ -16158,7 +16285,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16158
16285
  directives: runtimeDirectives,
16159
16286
  patchFlag,
16160
16287
  dynamicPropNames,
16161
- shouldUseBlock
16288
+ shouldUseBlock,
16289
+ needsPatch,
16290
+ isBlockRequired
16162
16291
  };
16163
16292
  }
16164
16293
  function dedupeProperties(properties) {
@@ -17115,10 +17244,11 @@ function stringifyElement(node, context) {
17115
17244
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
17116
17245
  continue;
17117
17246
  }
17118
- if (isBooleanAttr(p.arg.content) && exp.content === "false") continue;
17247
+ if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
17119
17248
  let evaluated = evaluateConstant(exp);
17120
17249
  if (evaluated != null) {
17121
17250
  const arg = p.arg && p.arg.content;
17251
+ if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) continue;
17122
17252
  if (arg === "class") evaluated = normalizeClass(evaluated);
17123
17253
  else if (arg === "style") evaluated = stringifyStyle(normalizeStyle(evaluated));
17124
17254
  res += ` ${p.arg.content}="${escapeHtml(evaluated)}"`;