@vue/server-renderer 3.6.0-rc.11 → 3.6.0-rc.13

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/server-renderer v3.6.0-rc.11
2
+ * @vue/server-renderer v3.6.0-rc.13
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -210,9 +210,10 @@ const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
210
210
  * - ismap -> isMap
211
211
  * - nomodule -> noModule
212
212
  * - novalidate -> noValidate
213
+ * - playsinline -> playsInline
213
214
  * - readonly -> readOnly
214
215
  */
215
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
216
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
216
217
  const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
217
218
  /**
218
219
  * The full list is needed during SSR to produce the correct initial markup.
@@ -941,17 +942,33 @@ const arrayInstrumentations = {
941
942
  };
942
943
  function iterator(self, method, wrapValue) {
943
944
  const arr = shallowReadArray(self);
944
- const iter = arr[method]();
945
+ const methodFn = arr[method];
946
+ const iter = methodFn.call(arr);
945
947
  if (arr !== self && !/* @__PURE__ */ isShallow(self)) {
948
+ if (iter[Symbol.toStringTag] === "Array Iterator") {
949
+ const wrapped = Object.create(Object.getPrototypeOf(iter));
950
+ wrapped.next = () => wrapResult(iter.next(), wrapValue);
951
+ if (methodFn !== arrayProto[method]) Object.defineProperties(wrapped, {
952
+ return: { get() {
953
+ const fn = iter.return;
954
+ return typeof fn === "function" ? fn.bind(iter) : fn;
955
+ } },
956
+ throw: { get() {
957
+ const fn = iter.throw;
958
+ return typeof fn === "function" ? fn.bind(iter) : fn;
959
+ } }
960
+ });
961
+ return wrapped;
962
+ }
946
963
  iter._next = iter.next;
947
- iter.next = () => {
948
- const result = iter._next();
949
- if (!result.done) result.value = wrapValue(result.value);
950
- return result;
951
- };
964
+ iter.next = () => wrapResult(iter._next(), wrapValue);
952
965
  }
953
966
  return iter;
954
967
  }
968
+ function wrapResult(result, wrapValue) {
969
+ if (!result.done) result.value = wrapValue(result.value);
970
+ return result;
971
+ }
955
972
  const arrayProto = Array.prototype;
956
973
  function apply(self, method, fn, thisArg, wrappedRetFn, args) {
957
974
  const arr = shallowReadArray(self);
@@ -1269,6 +1286,7 @@ function createInstrumentationGetter(isReadonly, shallow) {
1269
1286
  return (target, key, receiver) => {
1270
1287
  if (key === "__v_isReactive") return !isReadonly;
1271
1288
  else if (key === "__v_isReadonly") return isReadonly;
1289
+ else if (key === "__v_isShallow") return shallow;
1272
1290
  else if (key === "__v_raw") return target;
1273
1291
  return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
1274
1292
  };
@@ -1861,8 +1879,9 @@ let activeWatcher = void 0;
1861
1879
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1862
1880
  if (owner) {
1863
1881
  const { call } = owner.options;
1864
- if (call) owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1865
- else owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1882
+ const cleanup = call ? () => call(cleanupFn, 4) : cleanupFn;
1883
+ if (owner.cb) (owner.cbCleanups || (owner.cbCleanups = [])).push(cleanup);
1884
+ else owner.cleanups[owner.cleanupsLength++] = cleanup;
1866
1885
  } else if (!failSilently) warn$2("onWatcherCleanup() was called when there was no active watcher to associate with.");
1867
1886
  }
1868
1887
  var WatcherEffect = class extends ReactiveEffect {
@@ -1923,9 +1942,11 @@ var WatcherEffect = class extends ReactiveEffect {
1923
1942
  if (once && cb) {
1924
1943
  const _cb = cb;
1925
1944
  cb = (...args) => {
1926
- const res = _cb(...args);
1927
- this.stop();
1928
- return res;
1945
+ try {
1946
+ return _cb(...args);
1947
+ } finally {
1948
+ this.stop();
1949
+ }
1929
1950
  };
1930
1951
  }
1931
1952
  this.cb = cb;
@@ -1933,6 +1954,19 @@ var WatcherEffect = class extends ReactiveEffect {
1933
1954
  this.onTrack = options.onTrack;
1934
1955
  this.onTrigger = options.onTrigger;
1935
1956
  }
1957
+ cleanupCallback() {
1958
+ const cleanups = this.cbCleanups;
1959
+ if (cleanups) {
1960
+ this.cbCleanups = void 0;
1961
+ for (let i = 0, l = cleanups.length; i < l; i++) cleanups[i]();
1962
+ }
1963
+ }
1964
+ stop() {
1965
+ if (this.active) {
1966
+ super.stop();
1967
+ this.cleanupCallback();
1968
+ }
1969
+ }
1936
1970
  run(initialRun = false) {
1937
1971
  const oldValue = this.oldValue;
1938
1972
  const newValue = this.oldValue = super.run();
@@ -1940,10 +1974,11 @@ var WatcherEffect = class extends ReactiveEffect {
1940
1974
  const { immediate, deep, call } = this.options;
1941
1975
  if (initialRun && !immediate) return;
1942
1976
  if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1943
- cleanup(this);
1944
1977
  const currentWatcher = activeWatcher;
1945
- activeWatcher = this;
1978
+ const prevSub = setActiveSub();
1946
1979
  try {
1980
+ this.cleanupCallback();
1981
+ activeWatcher = this;
1947
1982
  const args = [
1948
1983
  newValue,
1949
1984
  oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
@@ -1952,6 +1987,7 @@ var WatcherEffect = class extends ReactiveEffect {
1952
1987
  call ? call(this.cb, 3, args) : this.cb(...args);
1953
1988
  } finally {
1954
1989
  activeWatcher = currentWatcher;
1990
+ setActiveSub(prevSub);
1955
1991
  }
1956
1992
  }
1957
1993
  }
@@ -2244,15 +2280,15 @@ function queuePostFlushCb(jobs, id = Infinity) {
2244
2280
  } else for (let i = 0; i < jobs.length; i++) queueJobWorker(jobs[i], id, postJobs, postJobs.length, 0);
2245
2281
  queueFlush();
2246
2282
  }
2247
- function flushPreFlushCbs(instance, seen) {
2283
+ function flushPreFlushCbs(instance, minUid, seen) {
2248
2284
  seen = seen || /* @__PURE__ */ new Map();
2249
2285
  for (let i = flushIndex; i < jobsLength; i++) {
2250
2286
  const cb = jobs[i];
2251
2287
  if (cb.order & 1 || cb.order === Infinity) continue;
2252
- if (instance && cb.order !== instance.uid * 2) continue;
2288
+ if (instance && cb.order !== instance.uid * 2 || minUid !== void 0 && !(cb.order >= minUid * 2)) continue;
2253
2289
  if (checkRecursiveUpdates(seen, cb)) continue;
2254
2290
  jobs.splice(i, 1);
2255
- i--;
2291
+ i = instance ? i - 1 : flushIndex - 1;
2256
2292
  jobsLength--;
2257
2293
  if (cb.flags & 2) cb.flags &= -2;
2258
2294
  try {
@@ -2262,15 +2298,24 @@ function flushPreFlushCbs(instance, seen) {
2262
2298
  }
2263
2299
  }
2264
2300
  }
2265
- function flushPostFlushCbs(seen) {
2301
+ function flushPostFlushCbs(seen, skip, minUid = 0) {
2266
2302
  if (postJobs.length) {
2303
+ let cbs = postJobs;
2304
+ if (skip) {
2305
+ cbs = [];
2306
+ let kept = 0;
2307
+ for (let i = 0; i < postJobs.length; i++) {
2308
+ const cb = postJobs[i];
2309
+ if (cb.i !== void 0 ? !cb.i || cb.i.uid < minUid : skip.has(cb)) postJobs[kept++] = cb;
2310
+ else cbs.push(cb);
2311
+ }
2312
+ postJobs.length = kept;
2313
+ } else postJobs = [];
2267
2314
  if (activePostJobs) {
2268
- for (let i = 0; i < postJobs.length; i++) activePostJobs.push(postJobs[i]);
2269
- postJobs.length = 0;
2315
+ for (let i = 0; i < cbs.length; i++) activePostJobs.push(cbs[i]);
2270
2316
  return;
2271
2317
  }
2272
- activePostJobs = postJobs;
2273
- postJobs = [];
2318
+ activePostJobs = cbs;
2274
2319
  seen = seen || /* @__PURE__ */ new Map();
2275
2320
  try {
2276
2321
  while (postFlushIndex < activePostJobs.length) {
@@ -2292,17 +2337,28 @@ function flushPostFlushCbs(seen) {
2292
2337
  }
2293
2338
  let isFlushing = false;
2294
2339
  /**
2340
+ * Run a root render, then flush the jobs it is responsible for. A mount or
2341
+ * unmount (`minUid` given) only flushes the jobs of the components it created
2342
+ * and the post cbs it queued, so pre watchers triggered in setup run before
2343
+ * mounted (#5721) while the jobs of other components stay in the queue and
2344
+ * keep their order (#6728). A root update keeps flushing all pending pre jobs
2345
+ * and post cbs, as the jobs of the components it re-renders may predate it.
2346
+ *
2295
2347
  * @internal
2296
2348
  */
2297
- function flushOnAppMount(instance) {
2298
- if (!isFlushing) {
2299
- isFlushing = true;
2300
- try {
2301
- flushPreFlushCbs(instance);
2302
- flushPostFlushCbs();
2303
- } finally {
2304
- isFlushing = false;
2305
- }
2349
+ function flushOnAppMount(fn, minUid) {
2350
+ if (isFlushing) {
2351
+ fn();
2352
+ return;
2353
+ }
2354
+ const queued = minUid === void 0 ? void 0 : new Set(postJobs);
2355
+ fn();
2356
+ isFlushing = true;
2357
+ try {
2358
+ flushPreFlushCbs(void 0, minUid);
2359
+ flushPostFlushCbs(void 0, queued, minUid);
2360
+ } finally {
2361
+ isFlushing = false;
2306
2362
  }
2307
2363
  }
2308
2364
  function flushJobs(seen) {
@@ -2703,7 +2759,7 @@ var RenderWatcherEffect = class extends WatcherEffect {
2703
2759
  this.flags |= 128;
2704
2760
  job.flags |= 2;
2705
2761
  }
2706
- if (instance) job.i = instance;
2762
+ job.i = instance;
2707
2763
  this.job = job;
2708
2764
  }
2709
2765
  notify() {
@@ -2778,6 +2834,16 @@ function createPathGetter(ctx, path) {
2778
2834
  };
2779
2835
  }
2780
2836
  //#endregion
2837
+ //#region packages/runtime-core/src/vaporInteropState.ts
2838
+ /**
2839
+ * Set by `vaporInteropPlugin`. Stays false in apps that never import the
2840
+ * plugin, so bundlers drop the vapor-in-vdom branches of the renderer.
2841
+ */
2842
+ let isVaporInteropEnabled = false;
2843
+ function setVaporInteropEnabled() {
2844
+ isVaporInteropEnabled = true;
2845
+ }
2846
+ //#endregion
2781
2847
  //#region packages/runtime-core/src/components/Teleport.ts
2782
2848
  const TeleportEndKey = Symbol("_vte");
2783
2849
  const isTeleport = (type) => type.__isTeleport;
@@ -2814,7 +2880,7 @@ function getInnerChild(vnode) {
2814
2880
  function setTransitionHooks(vnode, hooks) {
2815
2881
  if (vnode.shapeFlag & 6 && vnode.component) {
2816
2882
  vnode.transition = hooks;
2817
- if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
2883
+ if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
2818
2884
  else {
2819
2885
  const subTree = vnode.component.subTree;
2820
2886
  return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild(subTree) || subTree : subTree, hooks);
@@ -2823,9 +2889,23 @@ function setTransitionHooks(vnode, hooks) {
2823
2889
  const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2824
2890
  const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2825
2891
  return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
2826
- } else vnode.transition = hooks;
2892
+ } else {
2893
+ vnode.transition = hooks;
2894
+ if (vnode.type === Fragment && isArray(vnode.children)) {
2895
+ const child = filterSingleRoot(vnode.children, false);
2896
+ if (child) setTransitionHooks(child, hooks);
2897
+ }
2898
+ }
2827
2899
  return hooks;
2828
2900
  }
2901
+ function getTransitionRoot(vnode) {
2902
+ if (vnode.component && (!isVaporInteropEnabled || !isVaporComponent(vnode.type))) return getTransitionRoot(vnode.component.subTree);
2903
+ if (vnode.type === Fragment) {
2904
+ const child = isArray(vnode.children) && filterSingleRoot(vnode.children, false);
2905
+ return child ? getTransitionRoot(child) : void 0;
2906
+ }
2907
+ if (vnode.type !== Comment) return vnode;
2908
+ }
2829
2909
  //#endregion
2830
2910
  //#region packages/runtime-core/src/helpers/useId.ts
2831
2911
  /**
@@ -3055,16 +3135,22 @@ function invokeSlotFallback$1(fallback, owner) {
3055
3135
  function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
3056
3136
  if (props == null) props = {};
3057
3137
  let slot = slots[name];
3058
- const vaporSlot = slot && slot[rawVaporSlotKey$2];
3138
+ const vaporSlot = isVaporInteropEnabled && slot && slot[rawVaporSlotKey$2];
3059
3139
  if (vaporSlot) {
3060
3140
  const ret = (openBlock(), createBlock(VaporSlot$1, props));
3061
3141
  ret.vs = {
3062
3142
  slot: vaporSlot,
3143
+ name,
3063
3144
  outlets: fallback ? [{
3064
3145
  fallback,
3065
3146
  owner: currentRenderingInstance
3066
3147
  }] : void 0
3067
3148
  };
3149
+ if (branchKey != null && props.key == null) {
3150
+ ret.vs.props = ret.props;
3151
+ ret.props = extend({}, ret.props, { key: branchKey });
3152
+ ret.key = branchKey;
3153
+ }
3068
3154
  if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
3069
3155
  return ret;
3070
3156
  }
@@ -3085,7 +3171,7 @@ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
3085
3171
  try {
3086
3172
  const validSlotContent = slot && ensureValidVNode$1(slot(props));
3087
3173
  let attached = false;
3088
- if (fallback && validSlotContent && currentRenderingInstance) {
3174
+ if (isVaporInteropEnabled && fallback && validSlotContent && currentRenderingInstance) {
3089
3175
  const interop = currentRenderingInstance.appContext.vapor;
3090
3176
  if (interop) attached = interop.attachSlotOutlet(validSlotContent, fallback, currentRenderingInstance);
3091
3177
  }
@@ -3965,7 +4051,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
3965
4051
  if (nextKeys.length !== Object.keys(prevProps).length) return true;
3966
4052
  for (let i = 0; i < nextKeys.length; i++) {
3967
4053
  const key = nextKeys[i];
3968
- if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) return true;
4054
+ if (!hasOwn(prevProps, key) || hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) return true;
3969
4055
  }
3970
4056
  return false;
3971
4057
  }
@@ -4467,7 +4553,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4467
4553
  processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
4468
4554
  break;
4469
4555
  case VaporSlot$1:
4470
- getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor, parentComponent, parentSuspense, slotScopeIds);
4556
+ if (isVaporInteropEnabled) getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor, parentComponent, parentSuspense, slotScopeIds);
4471
4557
  break;
4472
4558
  default: if (shapeFlag & 1) processElement(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
4473
4559
  else if (shapeFlag & 6) processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
@@ -4601,7 +4687,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4601
4687
  let vnodeHook;
4602
4688
  parentComponent && toggleRecurse(parentComponent, false);
4603
4689
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4604
- if (n2.ibu) n2.ibu();
4690
+ if (isVaporInteropEnabled && n2.ibu) n2.ibu();
4605
4691
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4606
4692
  parentComponent && toggleRecurse(parentComponent, true);
4607
4693
  if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
@@ -4635,9 +4721,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4635
4721
  if (n1.children !== n2.children) hostSetElementText(el, n2.children);
4636
4722
  }
4637
4723
  } else if (!optimized && dynamicChildren == null) patchProps(el, oldProps, newProps, parentComponent, namespace);
4638
- if ((vnodeHook = newProps.onVnodeUpdated) || dirs || n2.iu) queuePostRenderEffect(() => {
4724
+ if ((vnodeHook = newProps.onVnodeUpdated) || dirs || isVaporInteropEnabled && n2.iu) queuePostRenderEffect(() => {
4639
4725
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4640
- n2.iu && n2.iu();
4726
+ isVaporInteropEnabled && n2.iu && n2.iu();
4641
4727
  dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4642
4728
  }, void 0, parentSuspense);
4643
4729
  };
@@ -4645,7 +4731,8 @@ function baseCreateRenderer(options, createHydrationFns) {
4645
4731
  for (let i = 0; i < newChildren.length; i++) {
4646
4732
  const oldVNode = oldChildren[i];
4647
4733
  const newVNode = newChildren[i];
4648
- const container = oldVNode.el && (oldVNode.type === Fragment || !isSameVNodeType(oldVNode, newVNode) || oldVNode.shapeFlag & 198) ? hostParentNode(oldVNode.el) : fallbackContainer;
4734
+ const oldEl = oldVNode.el || resolveAsyncComponentPlaceholder(oldVNode);
4735
+ const container = oldEl && (oldVNode.type === Fragment || !isSameVNodeType(oldVNode, newVNode) || oldVNode.shapeFlag & 198) ? hostParentNode(oldEl) : fallbackContainer;
4649
4736
  patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, namespace, slotScopeIds, true);
4650
4737
  }
4651
4738
  };
@@ -4737,6 +4824,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4737
4824
  if (instance.asyncDep && !instance.asyncResolved) {
4738
4825
  pushWarningContext$1(n2);
4739
4826
  n2.el = n1.el;
4827
+ n2.placeholder = n1.placeholder;
4740
4828
  updateComponentPreRender(instance, n2, optimized);
4741
4829
  popWarningContext$1();
4742
4830
  return;
@@ -4746,6 +4834,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4746
4834
  }
4747
4835
  } else {
4748
4836
  n2.el = n1.el;
4837
+ n2.placeholder = n1.placeholder;
4749
4838
  instance.vnode = n2;
4750
4839
  }
4751
4840
  };
@@ -4842,7 +4931,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4842
4931
  } else next = vnode;
4843
4932
  if (bu) invokeArrayFns(bu);
4844
4933
  if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parent, next, vnode);
4845
- if (next.ibu) next.ibu();
4934
+ if (isVaporInteropEnabled && next.ibu) next.ibu();
4846
4935
  toggleRecurse(instance, true);
4847
4936
  startMeasure(instance, `render`);
4848
4937
  const nextTree = renderComponentRoot$1(instance);
@@ -4855,9 +4944,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4855
4944
  next.el = nextTree.el;
4856
4945
  if (originNext === null) updateHOCHostEl(instance, nextTree.el);
4857
4946
  if (u) queuePostRenderEffect(u, void 0, parentSuspense);
4858
- if ((vnodeHook = next.props && next.props.onVnodeUpdated) || next.iu) queuePostRenderEffect(() => {
4947
+ if ((vnodeHook = next.props && next.props.onVnodeUpdated) || isVaporInteropEnabled && next.iu) queuePostRenderEffect(() => {
4859
4948
  vnodeHook && invokeVNodeHook(vnodeHook, parent, next, vnode);
4860
- next.iu && next.iu();
4949
+ isVaporInteropEnabled && next.iu && next.iu();
4861
4950
  }, void 0, parentSuspense);
4862
4951
  devtoolsComponentUpdated(instance);
4863
4952
  popWarningContext$1();
@@ -5009,7 +5098,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5009
5098
  };
5010
5099
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
5011
5100
  const { el, type, transition, children, shapeFlag } = vnode;
5012
- if (isVaporComponent(type) || type === VaporSlot$1) {
5101
+ if (isVaporInteropEnabled && (isVaporComponent(type) || type === VaporSlot$1)) {
5013
5102
  getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
5014
5103
  return;
5015
5104
  }
@@ -5053,11 +5142,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5053
5142
  }
5054
5143
  if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) parentComponent.renderCache[cacheIndex] = void 0;
5055
5144
  if (shapeFlag & 256) {
5056
- if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
5145
+ if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
5057
5146
  else parentComponent.ctx.deactivate(vnode);
5058
5147
  return;
5059
5148
  }
5060
- if (shapeFlag & 6 && isVaporComponent(type)) {
5149
+ if (isVaporInteropEnabled && shapeFlag & 6 && isVaporComponent(type)) {
5061
5150
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
5062
5151
  return;
5063
5152
  }
@@ -5075,7 +5164,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5075
5164
  if (shapeFlag & 64) vnode.type.remove(vnode, parentComponent, parentSuspense, internals, doRemove);
5076
5165
  else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
5077
5166
  else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
5078
- if (type === VaporSlot$1) {
5167
+ if (isVaporInteropEnabled && type === VaporSlot$1) {
5079
5168
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
5080
5169
  return;
5081
5170
  }
@@ -5090,12 +5179,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5090
5179
  };
5091
5180
  const remove = (vnode) => {
5092
5181
  const { type, el, anchor, transition } = vnode;
5093
- if (type === Fragment) {
5094
- if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) vnode.children.forEach((child) => {
5095
- if (child.type === Comment) hostRemove(child.el);
5096
- else remove(child);
5097
- });
5098
- else removeFragment(el, anchor);
5182
+ const isFragment = type === Fragment;
5183
+ if (isFragment && !transition) {
5184
+ removeFragment(el, anchor);
5099
5185
  return;
5100
5186
  }
5101
5187
  if (type === Static) {
@@ -5103,8 +5189,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5103
5189
  if (transition && !transition.persisted && transition.afterLeave) transition.afterLeave();
5104
5190
  return;
5105
5191
  }
5106
- if (transition) performTransitionLeave(el, transition, () => hostRemove(el), !!(vnode.shapeFlag & 1));
5107
- else hostRemove(el);
5192
+ const leavingNode = isFragment ? getTransitionRoot(vnode) : vnode;
5193
+ const performRemove = () => {
5194
+ if (isFragment) {
5195
+ if (hostParentNode(el)) removeFragment(el, anchor);
5196
+ } else hostRemove(el);
5197
+ };
5198
+ if (transition) {
5199
+ let leavingEl = leavingNode && leavingNode.el;
5200
+ let isElement = !!(leavingNode && leavingNode.shapeFlag & 1);
5201
+ if (isVaporInteropEnabled && isFragment && leavingNode && isVaporComponent(leavingNode.type)) {
5202
+ leavingEl = getVaporInterface(leavingNode.component, leavingNode).getTransitionElement(leavingNode);
5203
+ isElement = !!leavingEl;
5204
+ }
5205
+ performTransitionLeave(leavingEl || el, transition, performRemove, isElement);
5206
+ } else performRemove();
5108
5207
  };
5109
5208
  const removeFragment = (cur, end) => {
5110
5209
  let next;
@@ -5138,7 +5237,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5138
5237
  };
5139
5238
  const getNextHostNode = (vnode) => {
5140
5239
  if (vnode.shapeFlag & 6) {
5141
- if (isVaporComponent(vnode.type)) return hostNextSibling(vnode.anchor);
5240
+ if (isVaporInteropEnabled && isVaporComponent(vnode.type)) return hostNextSibling(vnode.anchor);
5142
5241
  return getNextHostNode(vnode.component.subTree);
5143
5242
  }
5144
5243
  if (vnode.shapeFlag & 128) return vnode.suspense.next();
@@ -5147,15 +5246,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5147
5246
  return teleportEnd ? hostNextSibling(teleportEnd) : el;
5148
5247
  };
5149
5248
  const render = (vnode, container, namespace) => {
5150
- let instance;
5151
- if (vnode == null) {
5152
- if (container._vnode) {
5153
- unmount(container._vnode, null, null, true);
5154
- instance = container._vnode.component;
5155
- }
5156
- } else patch(container._vnode || null, vnode, container, null, null, null, namespace);
5157
- container._vnode = vnode;
5158
- flushOnAppMount(instance);
5249
+ flushOnAppMount(() => {
5250
+ if (vnode == null) {
5251
+ if (container._vnode) unmount(container._vnode, null, null, true);
5252
+ } else patch(container._vnode || null, vnode, container, null, null, null, namespace);
5253
+ container._vnode = vnode;
5254
+ }, vnode && container._vnode ? void 0 : vnode && vnode.component ? vnode.component.uid : getNextUid());
5159
5255
  };
5160
5256
  const internals = {
5161
5257
  p: patch,
@@ -5202,7 +5298,7 @@ function resolveChildrenNamespace({ type, props }, currentNamespace) {
5202
5298
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5203
5299
  }
5204
5300
  function toggleRecurse({ effect, job, vapor }, allowed) {
5205
- if (!vapor) {
5301
+ if (!isVaporInteropEnabled || !vapor) {
5206
5302
  if (allowed) {
5207
5303
  effect.flags |= 128;
5208
5304
  job.flags |= 2;
@@ -5314,7 +5410,7 @@ function getInheritedScopeIds(vnode, parentComponent, includeVaporRootIds = true
5314
5410
  currentParent = currentParent.parent;
5315
5411
  } else break;
5316
5412
  }
5317
- const vaporScopeIds = includeVaporRootIds && currentVNode.vaporScopeIds;
5413
+ const vaporScopeIds = isVaporInteropEnabled && includeVaporRootIds && currentVNode.vaporScopeIds;
5318
5414
  if (vaporScopeIds) inheritedScopeIds.push(...vaporScopeIds);
5319
5415
  return inheritedScopeIds;
5320
5416
  }
@@ -5553,7 +5649,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
5553
5649
  ctx: vnode.ctx,
5554
5650
  ce: vnode.ce,
5555
5651
  vi: vnode.vi,
5556
- vs: cloneVaporSlotMeta(vnode),
5652
+ vs: cloneVaporSlotMeta(vnode, extraProps),
5557
5653
  vb: vnode.vb,
5558
5654
  ibu: vnode.ibu,
5559
5655
  iu: vnode.iu,
@@ -5562,13 +5658,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
5562
5658
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
5563
5659
  return cloned;
5564
5660
  }
5565
- function cloneVaporSlotMeta(vnode) {
5661
+ function cloneVaporSlotMeta(vnode, extraProps) {
5566
5662
  const vaporSlot = vnode.vs;
5567
5663
  if (!vaporSlot) return vaporSlot;
5568
5664
  const cloned = {
5569
5665
  slot: vaporSlot.slot,
5570
- outlets: vaporSlot.outlets
5666
+ name: vaporSlot.name,
5667
+ outlets: vaporSlot.outlets,
5668
+ props: vaporSlot.props,
5669
+ attrs: vaporSlot.attrs && vaporSlot.attrs === EMPTY_OBJ ? {} : vaporSlot.attrs,
5670
+ group: vaporSlot.group
5571
5671
  };
5672
+ const attrs = cloned.attrs;
5673
+ if (extraProps && vaporSlot.props) {
5674
+ let extraSlotProps;
5675
+ for (const key in extraProps) if (attrs ? !isReservedProp(key) : key !== "key") {
5676
+ if (!extraSlotProps) extraSlotProps = {};
5677
+ extraSlotProps[key] = extraProps[key];
5678
+ }
5679
+ if (extraSlotProps) {
5680
+ if (attrs) cloned.attrs = mergeProps(attrs, extraSlotProps);
5681
+ else cloned.props = mergeProps(vaporSlot.props, extraSlotProps);
5682
+ }
5683
+ }
5572
5684
  if (vnode.el) {
5573
5685
  cloned.state = vaporSlot.state;
5574
5686
  cloned.ref = vaporSlot.ref;
@@ -5717,6 +5829,9 @@ const restoreCurrentInstance = (prev) => {
5717
5829
  //#region packages/runtime-core/src/component.ts
5718
5830
  const emptyAppContext = /*@__PURE__*/ createAppContext();
5719
5831
  let uid = 0;
5832
+ function getNextUid() {
5833
+ return uid;
5834
+ }
5720
5835
  function createComponentInstance$1(vnode, parent, suspense) {
5721
5836
  const type = vnode.type;
5722
5837
  const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
@@ -5803,7 +5918,7 @@ function setupComponent$1(instance, isSSR = false, optimized = false) {
5803
5918
  isSSR && setInSSRSetupState(isSSR);
5804
5919
  const { props, children, vi } = instance.vnode;
5805
5920
  const isStateful = isStatefulComponent(instance);
5806
- if (vi) vi(instance);
5921
+ if (isVaporInteropEnabled && vi) vi(instance);
5807
5922
  else {
5808
5923
  initProps(instance, props, isStateful, isSSR);
5809
5924
  initSlots(instance, children, optimized || isSSR);
@@ -5993,7 +6108,7 @@ const computed = (getterOrOptions, debugOptions) => {
5993
6108
  };
5994
6109
  //#endregion
5995
6110
  //#region packages/runtime-core/src/index.ts
5996
- const version = "3.6.0-rc.11";
6111
+ const version = "3.6.0-rc.13";
5997
6112
  const warn = warn$1;
5998
6113
  /**
5999
6114
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
@@ -6164,7 +6279,7 @@ function patchStyle(el, prev, next) {
6164
6279
  else el.removeAttribute("style");
6165
6280
  }
6166
6281
  if (vShowOriginalDisplay in el) {
6167
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
6282
+ if (!isCssString || prev !== next) el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
6168
6283
  if (el[vShowHidden]) style.display = "none";
6169
6284
  }
6170
6285
  }
@@ -6408,7 +6523,7 @@ const vModelTextInit = (el, trim, number, lazy, set) => {
6408
6523
  if (e.target.composing) return;
6409
6524
  (set || el[assignKey])(castValue(el.value, trim, number || el.type === "number"));
6410
6525
  });
6411
- if (trim || number) addEventListener(el, "change", () => {
6526
+ if (trim || number || el.type === "number") addEventListener(el, "change", () => {
6412
6527
  el.value = castValue(el.value, trim, number || el.type === "number");
6413
6528
  });
6414
6529
  if (!lazy) {
@@ -7038,7 +7153,10 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
7038
7153
  slots[name] = wrapped;
7039
7154
  }
7040
7155
  }
7041
- if (!ctx.appContext.vapor) ctx.appContext.vapor = vaporInterface;
7156
+ if (!ctx.appContext.vapor) {
7157
+ ctx.appContext.vapor = vaporInterface;
7158
+ setVaporInteropEnabled();
7159
+ }
7042
7160
  }
7043
7161
  const instance = vnode.component = createComponentInstance(vnode, parentComponent, null);
7044
7162
  const context = instance.appContext.provides[ssrContextKey];
@@ -7048,15 +7166,20 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
7048
7166
  popWarningContext();
7049
7167
  const hasAsyncSetup = isPromise(res);
7050
7168
  let prefetches = instance.sp;
7051
- if (hasAsyncSetup || prefetches) return Promise.resolve(res).then(() => {
7169
+ let p;
7170
+ if (hasAsyncSetup || prefetches) p = Promise.resolve(res).then(() => {
7052
7171
  if (hasAsyncSetup) prefetches = instance.sp;
7053
- if (prefetches) return Promise.all(prefetches.map((prefetch) => prefetch.call(instance.proxy)));
7054
- }).catch(NOOP).then(() => renderComponentSubTree(instance, slotScopeId));
7172
+ if (prefetches) try {
7173
+ return Promise.all(prefetches.map((prefetch) => prefetch.call(instance.proxy))).catch(NOOP);
7174
+ } catch {}
7175
+ }).then(() => renderComponentSubTree(instance, slotScopeId));
7055
7176
  else try {
7056
7177
  return renderComponentSubTree(instance, slotScopeId);
7057
7178
  } catch (err) {
7058
- return Promise.reject(err);
7179
+ p = Promise.reject(err);
7059
7180
  }
7181
+ p.catch(NOOP);
7182
+ return p;
7060
7183
  }
7061
7184
  function renderComponentSubTree(instance, slotScopeId) {
7062
7185
  pushWarningContext(instance.vnode);
@@ -7139,8 +7262,8 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
7139
7262
  }
7140
7263
  case VaporSlot: {
7141
7264
  if (vnode.slotScopeIds) slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
7142
- const { slot, outlets } = vnode.vs;
7143
- renderVaporOutlet(push, slot, vnode.props, outlets && outlets[0], parentComponent, slotScopeId);
7265
+ const { slot, outlets, props } = vnode.vs;
7266
+ renderVaporOutlet(push, slot, props || vnode.props, outlets && outlets[0], parentComponent, slotScopeId);
7144
7267
  break;
7145
7268
  }
7146
7269
  default: if (shapeFlag & 1) renderElementVNode(push, vnode, parentComponent, slotScopeId);
@@ -7158,7 +7281,13 @@ function renderVaporOutlet(push, slot, props, outlet, parentComponent, slotScope
7158
7281
  function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
7159
7282
  for (let i = 0; i < children.length; i++) renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
7160
7283
  }
7161
- function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
7284
+ function renderDynamicComponent(push, type, props, slots, parentComponent, slotScopeId) {
7285
+ if (isString(type) && type) {
7286
+ const slot = slots && slots.default;
7287
+ renderElementVNode(push, createVNode(type, props), parentComponent, slotScopeId, slot && (() => slot(void 0, push, parentComponent, slotScopeId || "")));
7288
+ } else renderVNode(push, createVNode(type, props, slots), parentComponent, slotScopeId);
7289
+ }
7290
+ function renderElementVNode(push, vnode, parentComponent, slotScopeId, renderChildren) {
7162
7291
  const tag = vnode.type;
7163
7292
  let { props, children, shapeFlag, scopeId } = vnode;
7164
7293
  let openTag = `<${tag}`;
@@ -7186,19 +7315,20 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
7186
7315
  if (!isVoidTag(tag)) {
7187
7316
  let hasChildrenOverride = false;
7188
7317
  if (props) {
7189
- if (props.innerHTML) {
7318
+ if (props.innerHTML != null) {
7190
7319
  hasChildrenOverride = true;
7191
- push(props.innerHTML);
7192
- } else if (props.textContent) {
7320
+ push(String(props.innerHTML));
7321
+ } else if (props.textContent != null) {
7193
7322
  hasChildrenOverride = true;
7194
7323
  push(escapeHtml(props.textContent));
7195
- } else if (tag === "textarea" && props.value) {
7324
+ } else if (tag === "textarea" && props.value != null) {
7196
7325
  hasChildrenOverride = true;
7197
7326
  push(escapeHtml(props.value));
7198
7327
  }
7199
7328
  }
7200
7329
  if (!hasChildrenOverride) {
7201
- if (shapeFlag & 8) push(escapeHtml(children));
7330
+ if (renderChildren) renderChildren();
7331
+ else if (shapeFlag & 8) push(escapeHtml(children));
7202
7332
  else if (shapeFlag & 16) renderVNodeChildren(push, children, parentComponent, slotScopeId);
7203
7333
  }
7204
7334
  push(`</${tag}>`);
@@ -7273,13 +7403,41 @@ async function renderToString(input, context = {}) {
7273
7403
  const vnode = createVNode(input._component, input._props);
7274
7404
  vnode.appContext = input._context;
7275
7405
  input.provide(ssrContextKey, context);
7406
+ let buffer;
7407
+ let result;
7276
7408
  try {
7277
- const result = await unrollBuffer$1(await renderComponentVNode(vnode));
7409
+ buffer = await renderComponentVNode(vnode);
7410
+ result = await unrollBuffer$1(buffer);
7278
7411
  await resolveTeleports(context);
7279
- return result;
7280
- } finally {
7281
- cleanupContext(context);
7412
+ } catch (err) {
7413
+ cleanupFailedRender(buffer, context);
7414
+ throw err;
7282
7415
  }
7416
+ cleanupContext(context);
7417
+ return result;
7418
+ }
7419
+ /**
7420
+ * Stops watchers without masking the render error. Components after the
7421
+ * failure point are still in flight and can register watchers once the render
7422
+ * has settled, so those are stopped when they finish.
7423
+ * Cleanup errors here have already been reported by the watcher.
7424
+ */
7425
+ function cleanupFailedRender(buffer, context) {
7426
+ try {
7427
+ cleanupContext(context);
7428
+ } catch {}
7429
+ (async () => {
7430
+ if (buffer) await settleBuffer(buffer);
7431
+ for (const key in context.__teleportBuffers) await settleBuffer(context.__teleportBuffers[key]);
7432
+ cleanupContext(context);
7433
+ })().catch(NOOP);
7434
+ }
7435
+ async function settleBuffer(buffer) {
7436
+ if (!buffer.hasAsync) return;
7437
+ for (let item of buffer) try {
7438
+ if (isPromise(item)) item = await item;
7439
+ if (!isString(item)) await settleBuffer(item);
7440
+ } catch {}
7283
7441
  }
7284
7442
  async function resolveTeleports(context) {
7285
7443
  if (context.__teleportBuffers) {
@@ -7311,19 +7469,12 @@ function renderToSimpleStream(input, context, stream) {
7311
7469
  const vnode = createVNode(input._component, input._props);
7312
7470
  vnode.appContext = input._context;
7313
7471
  input.provide(ssrContextKey, context);
7314
- let cleaned = false;
7315
- const finalize = () => {
7316
- if (cleaned) return;
7317
- cleaned = true;
7472
+ let buffer;
7473
+ Promise.resolve().then(() => renderComponentVNode(vnode)).then((b) => unrollBuffer(buffer = b, stream)).then(() => resolveTeleports(context)).then(() => {
7318
7474
  cleanupContext(context);
7319
- };
7320
- Promise.resolve().then(() => renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
7321
- finalize();
7322
7475
  return stream.push(null);
7323
7476
  }).catch((error) => {
7324
- try {
7325
- finalize();
7326
- } catch {}
7477
+ cleanupFailedRender(buffer, context);
7327
7478
  stream.destroy(error);
7328
7479
  });
7329
7480
  return stream;
@@ -7394,4 +7545,4 @@ function pipeToWebWritable(input, context = {}, writable) {
7394
7545
  //#region packages/server-renderer/src/index.ts
7395
7546
  initDirectivesForSSR();
7396
7547
  //#endregion
7397
- export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, includeBooleanAttr as ssrIncludeBooleanAttr, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
7548
+ export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, includeBooleanAttr as ssrIncludeBooleanAttr, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, renderDynamicComponent as ssrRenderDynamicComponent, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };