@vue/server-renderer 3.6.0-alpha.2 → 3.6.0-alpha.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.
@@ -1,9 +1,8 @@
1
1
  /**
2
- * @vue/server-renderer v3.6.0-alpha.2
2
+ * @vue/server-renderer v3.6.0-alpha.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- /*! #__NO_SIDE_EFFECTS__ */
7
6
  // @__NO_SIDE_EFFECTS__
8
7
  function makeMap(str) {
9
8
  const map = /* @__PURE__ */ Object.create(null);
@@ -58,10 +57,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
58
57
  );
59
58
  const cacheStringFunction = (fn) => {
60
59
  const cache = /* @__PURE__ */ Object.create(null);
61
- return (str) => {
60
+ return ((str) => {
62
61
  const hit = cache[str];
63
62
  return hit || (cache[str] = fn(str));
64
- };
63
+ });
65
64
  };
66
65
  const camelizeRE = /-(\w)/g;
67
66
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
@@ -81,6 +80,9 @@ const toHandlerKey = cacheStringFunction(
81
80
  return s;
82
81
  }
83
82
  );
83
+ const getModifierPropName = (name) => {
84
+ return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
85
+ };
84
86
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
85
87
  const invokeArrayFns = (fns, ...arg) => {
86
88
  for (let i = 0; i < fns.length; i++) {
@@ -230,6 +232,9 @@ function shouldSetAsAttr(tagName, key) {
230
232
  if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
231
233
  return true;
232
234
  }
235
+ if (key === "sandbox" && tagName === "IFRAME") {
236
+ return true;
237
+ }
233
238
  return false;
234
239
  }
235
240
 
@@ -455,6 +460,7 @@ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
455
460
  const notifyBuffer = [];
456
461
  let batchDepth = 0;
457
462
  let activeSub = void 0;
463
+ let globalVersion = 0;
458
464
  let notifyIndex = 0;
459
465
  let notifyBufferLength = 0;
460
466
  function setActiveSub(sub) {
@@ -477,17 +483,18 @@ function link(dep, sub) {
477
483
  if (prevDep !== void 0 && prevDep.dep === dep) {
478
484
  return;
479
485
  }
480
- let nextDep = void 0;
481
- const recursedCheck = sub.flags & 4 /* RecursedCheck */;
482
- if (recursedCheck) {
483
- nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
484
- if (nextDep !== void 0 && nextDep.dep === dep) {
485
- sub.depsTail = nextDep;
486
- return;
487
- }
486
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
487
+ if (nextDep !== void 0 && nextDep.dep === dep) {
488
+ nextDep.version = globalVersion;
489
+ sub.depsTail = nextDep;
490
+ return;
488
491
  }
489
492
  const prevSub = dep.subsTail;
493
+ if (prevSub !== void 0 && prevSub.version === globalVersion && prevSub.sub === sub) {
494
+ return;
495
+ }
490
496
  const newLink = sub.depsTail = dep.subsTail = {
497
+ version: globalVersion,
491
498
  dep,
492
499
  sub,
493
500
  prevDep,
@@ -593,6 +600,7 @@ function propagate(link2) {
593
600
  } while (true);
594
601
  }
595
602
  function startTracking(sub) {
603
+ ++globalVersion;
596
604
  sub.depsTail = void 0;
597
605
  sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
598
606
  return setActiveSub(sub);
@@ -693,18 +701,12 @@ function shallowPropagate(link2) {
693
701
  } while (link2 !== void 0);
694
702
  }
695
703
  function isValidLink(checkLink, sub) {
696
- const depsTail = sub.depsTail;
697
- if (depsTail !== void 0) {
698
- let link2 = sub.deps;
699
- do {
700
- if (link2 === checkLink) {
701
- return true;
702
- }
703
- if (link2 === depsTail) {
704
- break;
705
- }
706
- link2 = link2.nextDep;
707
- } while (link2 !== void 0);
704
+ let link2 = sub.depsTail;
705
+ while (link2 !== void 0) {
706
+ if (link2 === checkLink) {
707
+ return true;
708
+ }
709
+ link2 = link2.prevDep;
708
710
  }
709
711
  return false;
710
712
  }
@@ -940,7 +942,7 @@ const arrayInstrumentations = {
940
942
  join(separator) {
941
943
  return reactiveReadArray(this).join(separator);
942
944
  },
943
- // keys() iterator only reads `length`, no optimisation required
945
+ // keys() iterator only reads `length`, no optimization required
944
946
  lastIndexOf(...args) {
945
947
  return searchProxy(this, "lastIndexOf", args);
946
948
  },
@@ -992,7 +994,7 @@ function iterator(self, method, wrapValue) {
992
994
  iter._next = iter.next;
993
995
  iter.next = () => {
994
996
  const result = iter._next();
995
- if (result.value) {
997
+ if (!result.done) {
996
998
  result.value = wrapValue(result.value);
997
999
  }
998
1000
  return result;
@@ -1123,7 +1125,8 @@ class BaseReactiveHandler {
1123
1125
  return res;
1124
1126
  }
1125
1127
  if (isRef(res)) {
1126
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1128
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1129
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1127
1130
  }
1128
1131
  if (isObject(res)) {
1129
1132
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -1145,7 +1148,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1145
1148
  }
1146
1149
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1147
1150
  if (isOldValueReadonly) {
1148
- return false;
1151
+ {
1152
+ warn$2(
1153
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1154
+ target[key]
1155
+ );
1156
+ }
1157
+ return true;
1149
1158
  } else {
1150
1159
  oldValue.value = value;
1151
1160
  return true;
@@ -1290,7 +1299,7 @@ function createInstrumentations(readonly, shallow) {
1290
1299
  get size() {
1291
1300
  const target = this["__v_raw"];
1292
1301
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1293
- return Reflect.get(target, "size", target);
1302
+ return target.size;
1294
1303
  },
1295
1304
  has(key) {
1296
1305
  const target = this["__v_raw"];
@@ -2038,11 +2047,11 @@ function traverse(value, depth = Infinity, seen) {
2038
2047
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2039
2048
  return value;
2040
2049
  }
2041
- seen = seen || /* @__PURE__ */ new Set();
2042
- if (seen.has(value)) {
2050
+ seen = seen || /* @__PURE__ */ new Map();
2051
+ if ((seen.get(value) || 0) >= depth) {
2043
2052
  return value;
2044
2053
  }
2045
- seen.add(value);
2054
+ seen.set(value, depth);
2046
2055
  depth--;
2047
2056
  if (isRef(value)) {
2048
2057
  traverse(value.value, depth, seen);
@@ -2549,8 +2558,10 @@ function rerender(id, newRender) {
2549
2558
  instance.hmrRerender();
2550
2559
  } else {
2551
2560
  const i = instance;
2552
- i.renderCache = [];
2553
- i.effect.run();
2561
+ if (!(i.effect.flags & 1024)) {
2562
+ i.renderCache = [];
2563
+ i.effect.run();
2564
+ }
2554
2565
  }
2555
2566
  nextTick(() => {
2556
2567
  isHmrUpdating = false;
@@ -2563,7 +2574,12 @@ function reload(id, newComp) {
2563
2574
  newComp = normalizeClassComponent(newComp);
2564
2575
  updateComponentDef(record.initialDef, newComp);
2565
2576
  const instances = [...record.instances];
2566
- if (newComp.__vapor) {
2577
+ if (newComp.__vapor && !instances.some((i) => i.ceReload)) {
2578
+ for (const instance of instances) {
2579
+ if (instance.root && instance.root.ce && instance !== instance.root) {
2580
+ instance.root.ce._removeChildStyle(instance.type);
2581
+ }
2582
+ }
2567
2583
  for (const instance of instances) {
2568
2584
  instance.hmrReload(newComp);
2569
2585
  }
@@ -2592,7 +2608,10 @@ function reload(id, newComp) {
2592
2608
  if (parent.vapor) {
2593
2609
  parent.hmrRerender();
2594
2610
  } else {
2595
- parent.effect.run();
2611
+ if (!(parent.effect.flags & 1024)) {
2612
+ parent.renderCache = [];
2613
+ parent.effect.run();
2614
+ }
2596
2615
  }
2597
2616
  nextTick(() => {
2598
2617
  isHmrUpdating = false;
@@ -2702,7 +2721,6 @@ const devtoolsComponentRemoved = (component) => {
2702
2721
  _devtoolsComponentRemoved(component);
2703
2722
  }
2704
2723
  };
2705
- /*! #__NO_SIDE_EFFECTS__ */
2706
2724
  // @__NO_SIDE_EFFECTS__
2707
2725
  function createDevtoolsComponentHook(hook) {
2708
2726
  return (component) => {
@@ -2800,10 +2818,18 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2800
2818
  const TeleportEndKey = Symbol("_vte");
2801
2819
  const isTeleport = (type) => type.__isTeleport;
2802
2820
 
2821
+ const leaveCbKey = Symbol("_leaveCb");
2803
2822
  function setTransitionHooks(vnode, hooks) {
2804
2823
  if (vnode.shapeFlag & 6 && vnode.component) {
2805
- vnode.transition = hooks;
2806
- setTransitionHooks(vnode.component.subTree, hooks);
2824
+ if (vnode.type.__vapor) {
2825
+ getVaporInterface(vnode.component, vnode).setTransitionHooks(
2826
+ vnode.component,
2827
+ hooks
2828
+ );
2829
+ } else {
2830
+ vnode.transition = hooks;
2831
+ setTransitionHooks(vnode.component.subTree, hooks);
2832
+ }
2807
2833
  } else if (vnode.shapeFlag & 128) {
2808
2834
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2809
2835
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -2818,6 +2844,7 @@ function markAsyncBoundary(instance) {
2818
2844
 
2819
2845
  const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
2820
2846
 
2847
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
2821
2848
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2822
2849
  if (isArray(rawRef)) {
2823
2850
  rawRef.forEach(
@@ -2849,28 +2876,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2849
2876
  const oldRef = oldRawRef && oldRawRef.r;
2850
2877
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
2851
2878
  const setupState = owner.setupState;
2852
- const rawSetupState = toRaw(setupState);
2853
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
2854
- {
2855
- if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
2856
- warn$1(
2857
- `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
2858
- );
2859
- }
2860
- if (knownTemplateRefs.has(rawSetupState[key])) {
2861
- return false;
2862
- }
2863
- }
2864
- return hasOwn(rawSetupState, key);
2879
+ const canSetSetupRef = createCanSetSetupRefChecker(setupState);
2880
+ const canSetRef = (ref2) => {
2881
+ return !knownTemplateRefs.has(ref2);
2865
2882
  };
2866
2883
  if (oldRef != null && oldRef !== ref) {
2884
+ invalidatePendingSetRef(oldRawRef);
2867
2885
  if (isString(oldRef)) {
2868
2886
  refs[oldRef] = null;
2869
2887
  if (canSetSetupRef(oldRef)) {
2870
2888
  setupState[oldRef] = null;
2871
2889
  }
2872
2890
  } else if (isRef(oldRef)) {
2873
- oldRef.value = null;
2891
+ if (canSetRef(oldRef)) {
2892
+ oldRef.value = null;
2893
+ }
2894
+ const oldRawRefAtom = oldRawRef;
2895
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
2874
2896
  }
2875
2897
  }
2876
2898
  if (isFunction(ref)) {
@@ -2881,7 +2903,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2881
2903
  if (_isString || _isRef) {
2882
2904
  const doSet = () => {
2883
2905
  if (rawRef.f) {
2884
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
2906
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
2885
2907
  if (isUnmount) {
2886
2908
  isArray(existing) && remove(existing, refValue);
2887
2909
  } else {
@@ -2892,8 +2914,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2892
2914
  setupState[ref] = refs[ref];
2893
2915
  }
2894
2916
  } else {
2895
- ref.value = [refValue];
2896
- if (rawRef.k) refs[rawRef.k] = ref.value;
2917
+ const newVal = [refValue];
2918
+ if (canSetRef(ref)) {
2919
+ ref.value = newVal;
2920
+ }
2921
+ if (rawRef.k) refs[rawRef.k] = newVal;
2897
2922
  }
2898
2923
  } else if (!existing.includes(refValue)) {
2899
2924
  existing.push(refValue);
@@ -2905,15 +2930,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2905
2930
  setupState[ref] = value;
2906
2931
  }
2907
2932
  } else if (_isRef) {
2908
- ref.value = value;
2933
+ if (canSetRef(ref)) {
2934
+ ref.value = value;
2935
+ }
2909
2936
  if (rawRef.k) refs[rawRef.k] = value;
2910
2937
  } else {
2911
2938
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
2912
2939
  }
2913
2940
  };
2914
2941
  if (value) {
2915
- queuePostRenderEffect(doSet, -1, parentSuspense);
2942
+ const job = () => {
2943
+ doSet();
2944
+ pendingSetRefMap.delete(rawRef);
2945
+ };
2946
+ pendingSetRefMap.set(rawRef, job);
2947
+ queuePostRenderEffect(job, -1, parentSuspense);
2916
2948
  } else {
2949
+ invalidatePendingSetRef(rawRef);
2917
2950
  doSet();
2918
2951
  }
2919
2952
  } else {
@@ -2921,6 +2954,29 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2921
2954
  }
2922
2955
  }
2923
2956
  }
2957
+ function createCanSetSetupRefChecker(setupState) {
2958
+ const rawSetupState = toRaw(setupState);
2959
+ return setupState === void 0 || setupState === EMPTY_OBJ ? NO : (key) => {
2960
+ {
2961
+ if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
2962
+ warn$1(
2963
+ `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
2964
+ );
2965
+ }
2966
+ if (knownTemplateRefs.has(rawSetupState[key])) {
2967
+ return false;
2968
+ }
2969
+ }
2970
+ return hasOwn(rawSetupState, key);
2971
+ };
2972
+ }
2973
+ function invalidatePendingSetRef(rawRef) {
2974
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
2975
+ if (pendingSetRef) {
2976
+ pendingSetRef.flags |= 4;
2977
+ pendingSetRefMap.delete(rawRef);
2978
+ }
2979
+ }
2924
2980
 
2925
2981
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2926
2982
 
@@ -2931,7 +2987,7 @@ function onActivated(hook, target) {
2931
2987
  function onDeactivated(hook, target) {
2932
2988
  registerKeepAliveHook(hook, "da", target);
2933
2989
  }
2934
- function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2990
+ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance()) {
2935
2991
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2936
2992
  let current = target;
2937
2993
  while (current) {
@@ -2945,8 +3001,9 @@ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2945
3001
  injectHook(type, wrappedHook, target);
2946
3002
  if (target) {
2947
3003
  let current = target.parent;
2948
- while (current && current.parent && current.parent.vnode) {
2949
- if (isKeepAlive(current.parent.vnode)) {
3004
+ while (current && current.parent) {
3005
+ let parent = current.parent;
3006
+ if (isKeepAlive(parent.vapor ? parent : parent.vnode)) {
2950
3007
  injectToKeepAliveRoot(wrappedHook, type, target, current);
2951
3008
  }
2952
3009
  current = current.parent;
@@ -3177,10 +3234,10 @@ const PublicInstanceProxyHandlers = {
3177
3234
  return true;
3178
3235
  },
3179
3236
  has({
3180
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
3237
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
3181
3238
  }, key) {
3182
- let normalizedProps;
3183
- return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
3239
+ let normalizedProps, cssModules;
3240
+ return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
3184
3241
  },
3185
3242
  defineProperty(target, key, descriptor) {
3186
3243
  if (descriptor.get != null) {
@@ -3447,7 +3504,8 @@ function applyOptions(instance) {
3447
3504
  expose.forEach((key) => {
3448
3505
  Object.defineProperty(exposed, key, {
3449
3506
  get: () => publicThis[key],
3450
- set: (val) => publicThis[key] = val
3507
+ set: (val) => publicThis[key] = val,
3508
+ enumerable: true
3451
3509
  });
3452
3510
  });
3453
3511
  } else if (!instance.exposed) {
@@ -4317,7 +4375,7 @@ function isBoolean(...args) {
4317
4375
  return args.some((elem) => elem.toLowerCase() === "boolean");
4318
4376
  }
4319
4377
 
4320
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
4378
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
4321
4379
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode$1) : [normalizeVNode$1(value)];
4322
4380
  const normalizeSlot = (key, rawSlot, ctx) => {
4323
4381
  if (rawSlot._n) {
@@ -4371,8 +4429,6 @@ const assignSlots = (slots, children, optimized) => {
4371
4429
  const initSlots = (instance, children, optimized) => {
4372
4430
  const slots = instance.slots = createInternalObject();
4373
4431
  if (instance.vnode.shapeFlag & 32) {
4374
- const cacheIndexes = children.__;
4375
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
4376
4432
  const type = children._;
4377
4433
  if (type) {
4378
4434
  assignSlots(slots, children, optimized);
@@ -4436,12 +4492,10 @@ function endMeasure(instance, type) {
4436
4492
  if (instance.appContext.config.performance && isSupported()) {
4437
4493
  const startTag = `vue-${type}-${instance.uid}`;
4438
4494
  const endTag = startTag + `:end`;
4495
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
4439
4496
  perf.mark(endTag);
4440
- perf.measure(
4441
- `<${formatComponentName(instance, instance.type)}> ${type}`,
4442
- startTag,
4443
- endTag
4444
- );
4497
+ perf.measure(measureName, startTag, endTag);
4498
+ perf.clearMeasures(measureName);
4445
4499
  perf.clearMarks(startTag);
4446
4500
  perf.clearMarks(endTag);
4447
4501
  }
@@ -4677,15 +4731,25 @@ function baseCreateRenderer(options, createHydrationFns) {
4677
4731
  optimized
4678
4732
  );
4679
4733
  } else {
4680
- patchElement(
4681
- n1,
4682
- n2,
4683
- parentComponent,
4684
- parentSuspense,
4685
- namespace,
4686
- slotScopeIds,
4687
- optimized
4688
- );
4734
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
4735
+ try {
4736
+ if (customElement) {
4737
+ customElement._beginPatch();
4738
+ }
4739
+ patchElement(
4740
+ n1,
4741
+ n2,
4742
+ parentComponent,
4743
+ parentSuspense,
4744
+ namespace,
4745
+ slotScopeIds,
4746
+ optimized
4747
+ );
4748
+ } finally {
4749
+ if (customElement) {
4750
+ customElement._endPatch();
4751
+ }
4752
+ }
4689
4753
  }
4690
4754
  };
4691
4755
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -4736,16 +4800,20 @@ function baseCreateRenderer(options, createHydrationFns) {
4736
4800
  if (dirs) {
4737
4801
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4738
4802
  }
4739
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
4740
- if (needCallTransitionHooks) {
4741
- transition.beforeEnter(el);
4803
+ if (transition) {
4804
+ performTransitionEnter(
4805
+ el,
4806
+ transition,
4807
+ () => hostInsert(el, container, anchor),
4808
+ parentSuspense
4809
+ );
4810
+ } else {
4811
+ hostInsert(el, container, anchor);
4742
4812
  }
4743
- hostInsert(el, container, anchor);
4744
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
4813
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
4745
4814
  queuePostRenderEffect(
4746
4815
  () => {
4747
4816
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4748
- needCallTransitionHooks && transition.enter(el);
4749
4817
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4750
4818
  },
4751
4819
  void 0,
@@ -4762,21 +4830,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4762
4830
  hostSetScopeId(el, slotScopeIds[i]);
4763
4831
  }
4764
4832
  }
4765
- let subTree = parentComponent && parentComponent.subTree;
4766
- if (subTree) {
4767
- if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
4768
- subTree = filterSingleRoot(subTree.children) || subTree;
4769
- }
4770
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
4771
- const parentVNode = parentComponent.vnode;
4772
- setScopeId(
4773
- el,
4774
- parentVNode,
4775
- parentVNode.scopeId,
4776
- parentVNode.slotScopeIds,
4777
- parentComponent.parent
4778
- );
4779
- }
4833
+ const inheritedScopeIds = getInheritedScopeIds(vnode, parentComponent);
4834
+ for (let i = 0; i < inheritedScopeIds.length; i++) {
4835
+ hostSetScopeId(el, inheritedScopeIds[i]);
4780
4836
  }
4781
4837
  };
4782
4838
  const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
@@ -5017,12 +5073,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5017
5073
  n2.slotScopeIds = slotScopeIds;
5018
5074
  if (n2.type.__vapor) {
5019
5075
  if (n1 == null) {
5020
- getVaporInterface(parentComponent, n2).mount(
5021
- n2,
5022
- container,
5023
- anchor,
5024
- parentComponent
5025
- );
5076
+ if (n2.shapeFlag & 512) {
5077
+ getVaporInterface(parentComponent, n2).activate(
5078
+ n2,
5079
+ container,
5080
+ anchor,
5081
+ parentComponent
5082
+ );
5083
+ } else {
5084
+ getVaporInterface(parentComponent, n2).mount(
5085
+ n2,
5086
+ container,
5087
+ anchor,
5088
+ parentComponent
5089
+ );
5090
+ }
5026
5091
  } else {
5027
5092
  getVaporInterface(parentComponent, n2).update(
5028
5093
  n1,
@@ -5085,6 +5150,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5085
5150
  if (!initialVNode.el) {
5086
5151
  const placeholder = instance.subTree = createVNode(Comment);
5087
5152
  processCommentNode(null, placeholder, container, anchor);
5153
+ initialVNode.placeholder = placeholder.el;
5088
5154
  }
5089
5155
  } else {
5090
5156
  setupRenderEffect(
@@ -5593,7 +5659,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5593
5659
  for (i = toBePatched - 1; i >= 0; i--) {
5594
5660
  const nextIndex = s2 + i;
5595
5661
  const nextChild = c2[nextIndex];
5596
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
5662
+ const anchorVNode = c2[nextIndex + 1];
5663
+ const anchor = nextIndex + 1 < l2 ? (
5664
+ // #13559, fallback to el placeholder for unresolved async component
5665
+ anchorVNode.el || anchorVNode.placeholder
5666
+ ) : parentAnchor;
5597
5667
  if (newIndexToOldIndexMap[i] === 0) {
5598
5668
  patch(
5599
5669
  null,
@@ -5673,12 +5743,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5673
5743
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
5674
5744
  if (needTransition2) {
5675
5745
  if (moveType === 0) {
5676
- transition.beforeEnter(el);
5677
- hostInsert(el, container, anchor);
5678
- queuePostRenderEffect(
5679
- () => transition.enter(el),
5680
- void 0,
5681
- parentSuspense
5746
+ performTransitionEnter(
5747
+ el,
5748
+ transition,
5749
+ () => hostInsert(el, container, anchor),
5750
+ parentSuspense,
5751
+ true
5682
5752
  );
5683
5753
  } else {
5684
5754
  const { leave, delayLeave, afterLeave } = transition;
@@ -5690,6 +5760,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5690
5760
  }
5691
5761
  };
5692
5762
  const performLeave = () => {
5763
+ if (el._isLeaving) {
5764
+ el[leaveCbKey](
5765
+ true
5766
+ /* cancelled */
5767
+ );
5768
+ }
5693
5769
  leave(el, () => {
5694
5770
  remove2();
5695
5771
  afterLeave && afterLeave();
@@ -5729,7 +5805,14 @@ function baseCreateRenderer(options, createHydrationFns) {
5729
5805
  parentComponent.renderCache[cacheIndex] = void 0;
5730
5806
  }
5731
5807
  if (shapeFlag & 256) {
5732
- parentComponent.ctx.deactivate(vnode);
5808
+ if (vnode.type.__vapor) {
5809
+ getVaporInterface(parentComponent, vnode).deactivate(
5810
+ vnode,
5811
+ parentComponent.ctx.getStorageContainer()
5812
+ );
5813
+ } else {
5814
+ parentComponent.ctx.deactivate(vnode);
5815
+ }
5733
5816
  return;
5734
5817
  }
5735
5818
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
@@ -5817,22 +5900,15 @@ function baseCreateRenderer(options, createHydrationFns) {
5817
5900
  removeStaticNode(vnode);
5818
5901
  return;
5819
5902
  }
5820
- const performRemove = () => {
5821
- hostRemove(el);
5822
- if (transition && !transition.persisted && transition.afterLeave) {
5823
- transition.afterLeave();
5824
- }
5825
- };
5826
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
5827
- const { leave, delayLeave } = transition;
5828
- const performLeave = () => leave(el, performRemove);
5829
- if (delayLeave) {
5830
- delayLeave(vnode.el, performRemove, performLeave);
5831
- } else {
5832
- performLeave();
5833
- }
5903
+ if (transition) {
5904
+ performTransitionLeave(
5905
+ el,
5906
+ transition,
5907
+ () => hostRemove(el),
5908
+ !!(vnode.shapeFlag & 1)
5909
+ );
5834
5910
  } else {
5835
- performRemove();
5911
+ hostRemove(el);
5836
5912
  }
5837
5913
  };
5838
5914
  const removeFragment = (cur, end) => {
@@ -5848,27 +5924,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5848
5924
  if (instance.type.__hmrId) {
5849
5925
  unregisterHMR(instance);
5850
5926
  }
5851
- const {
5852
- bum,
5853
- scope,
5854
- effect,
5855
- subTree,
5856
- um,
5857
- m,
5858
- a,
5859
- parent,
5860
- slots: { __: slotCacheKeys }
5861
- } = instance;
5927
+ const { bum, scope, effect, subTree, um, m, a } = instance;
5862
5928
  invalidateMount(m);
5863
5929
  invalidateMount(a);
5864
5930
  if (bum) {
5865
5931
  invokeArrayFns(bum);
5866
5932
  }
5867
- if (parent && isArray(slotCacheKeys)) {
5868
- slotCacheKeys.forEach((v) => {
5869
- parent.renderCache[v] = void 0;
5870
- });
5871
- }
5872
5933
  scope.stop();
5873
5934
  if (effect) {
5874
5935
  effect.stop();
@@ -5882,12 +5943,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5882
5943
  void 0,
5883
5944
  parentSuspense
5884
5945
  );
5885
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
5886
- parentSuspense.deps--;
5887
- if (parentSuspense.deps === 0) {
5888
- parentSuspense.resolve();
5889
- }
5890
- }
5891
5946
  {
5892
5947
  devtoolsComponentRemoved(instance);
5893
5948
  }
@@ -5900,7 +5955,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5900
5955
  const getNextHostNode = (vnode) => {
5901
5956
  if (vnode.shapeFlag & 6) {
5902
5957
  if (vnode.type.__vapor) {
5903
- return hostNextSibling(vnode.component.block);
5958
+ return hostNextSibling(vnode.anchor);
5904
5959
  }
5905
5960
  return getNextHostNode(vnode.component.subTree);
5906
5961
  }
@@ -5944,6 +5999,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5944
5999
  o: options
5945
6000
  };
5946
6001
  let hydrate;
6002
+ let hydrateNode;
5947
6003
  const mountApp = (app, container, isHydrate, namespace) => {
5948
6004
  const vnode = app._ceVNode || createVNode(app._component, app._props);
5949
6005
  vnode.appContext = app._context;
@@ -5970,6 +6026,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5970
6026
  return {
5971
6027
  render,
5972
6028
  hydrate,
6029
+ hydrateNode,
5973
6030
  internals,
5974
6031
  createApp: createAppAPI(
5975
6032
  mountApp,
@@ -6009,7 +6066,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6009
6066
  if (!shallow && c2.patchFlag !== -2)
6010
6067
  traverseStaticChildren(c1, c2);
6011
6068
  }
6012
- if (c2.type === Text) {
6069
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
6070
+ c2.patchFlag !== -1) {
6013
6071
  c2.el = c1.el;
6014
6072
  }
6015
6073
  if (c2.type === Comment && !c2.el) {
@@ -6022,7 +6080,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6022
6080
  }
6023
6081
  }
6024
6082
  function locateNonHydratedAsyncRoot(instance) {
6025
- const subComponent = instance.vapor ? null : instance.subTree.component;
6083
+ const subComponent = instance.subTree && instance.subTree.component;
6026
6084
  if (subComponent) {
6027
6085
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
6028
6086
  return subComponent;
@@ -6037,6 +6095,34 @@ function invalidateMount(hooks) {
6037
6095
  hooks[i].flags |= 4;
6038
6096
  }
6039
6097
  }
6098
+ function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
6099
+ if (force || needTransition(parentSuspense, transition)) {
6100
+ transition.beforeEnter(el);
6101
+ insert();
6102
+ queuePostRenderEffect(() => transition.enter(el), void 0, parentSuspense);
6103
+ } else {
6104
+ insert();
6105
+ }
6106
+ }
6107
+ function performTransitionLeave(el, transition, remove, isElement = true) {
6108
+ const performRemove = () => {
6109
+ remove();
6110
+ if (transition && !transition.persisted && transition.afterLeave) {
6111
+ transition.afterLeave();
6112
+ }
6113
+ };
6114
+ if (isElement && transition && !transition.persisted) {
6115
+ const { leave, delayLeave } = transition;
6116
+ const performLeave = () => leave(el, performRemove);
6117
+ if (delayLeave) {
6118
+ delayLeave(el, performRemove, performLeave);
6119
+ } else {
6120
+ performLeave();
6121
+ }
6122
+ } else {
6123
+ performRemove();
6124
+ }
6125
+ }
6040
6126
  function getVaporInterface(instance, vnode) {
6041
6127
  const ctx = instance ? instance.appContext : vnode.appContext;
6042
6128
  const res = ctx && ctx.vapor;
@@ -6051,6 +6137,32 @@ app.use(vaporInteropPlugin)
6051
6137
  }
6052
6138
  return res;
6053
6139
  }
6140
+ function getInheritedScopeIds(vnode, parentComponent) {
6141
+ const inheritedScopeIds = [];
6142
+ let currentParent = parentComponent;
6143
+ let currentVNode = vnode;
6144
+ while (currentParent) {
6145
+ let subTree = currentParent.subTree;
6146
+ if (!subTree) break;
6147
+ if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
6148
+ subTree = filterSingleRoot(subTree.children) || subTree;
6149
+ }
6150
+ if (currentVNode === subTree || isSuspense(subTree.type) && (subTree.ssContent === currentVNode || subTree.ssFallback === currentVNode)) {
6151
+ const parentVNode = currentParent.vnode;
6152
+ if (parentVNode.scopeId) {
6153
+ inheritedScopeIds.push(parentVNode.scopeId);
6154
+ }
6155
+ if (parentVNode.slotScopeIds) {
6156
+ inheritedScopeIds.push(...parentVNode.slotScopeIds);
6157
+ }
6158
+ currentVNode = parentVNode;
6159
+ currentParent = currentParent.parent;
6160
+ } else {
6161
+ break;
6162
+ }
6163
+ }
6164
+ return inheritedScopeIds;
6165
+ }
6054
6166
 
6055
6167
  const ssrContextKey = Symbol.for("v-scx");
6056
6168
  const useSSRContext = () => {
@@ -6198,7 +6310,7 @@ function createPathGetter(ctx, path) {
6198
6310
  }
6199
6311
 
6200
6312
  const getModelModifiers = (props, modelName, getter) => {
6201
- return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
6313
+ return getter(props, getModifierPropName(modelName)) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
6202
6314
  };
6203
6315
 
6204
6316
  function emit(instance, event, ...rawArgs) {
@@ -6294,8 +6406,9 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
6294
6406
  function defaultPropGetter(props, key) {
6295
6407
  return props[key];
6296
6408
  }
6409
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
6297
6410
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
6298
- const cache = appContext.emitsCache;
6411
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
6299
6412
  const cached = cache.get(comp);
6300
6413
  if (cached !== void 0) {
6301
6414
  return cached;
@@ -6680,15 +6793,11 @@ const createVNodeWithArgsTransform = (...args) => {
6680
6793
  );
6681
6794
  };
6682
6795
  const normalizeKey = ({ key }) => key != null ? key : null;
6683
- const normalizeRef = ({
6684
- ref,
6685
- ref_key,
6686
- ref_for
6687
- }) => {
6796
+ const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
6688
6797
  if (typeof ref === "number") {
6689
6798
  ref = "" + ref;
6690
6799
  }
6691
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
6800
+ return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i, r: ref, k: ref_key, f: !!ref_for } : ref : null;
6692
6801
  };
6693
6802
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
6694
6803
  const vnode = {
@@ -6854,6 +6963,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
6854
6963
  suspense: vnode.suspense,
6855
6964
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
6856
6965
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
6966
+ placeholder: vnode.placeholder,
6857
6967
  el: vnode.el,
6858
6968
  anchor: vnode.anchor,
6859
6969
  ctx: vnode.ctx,
@@ -6974,7 +7084,6 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
6974
7084
 
6975
7085
  let currentInstance = null;
6976
7086
  const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
6977
- const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
6978
7087
  let isInSSRComponentSetup = false;
6979
7088
  let setInSSRSetupState;
6980
7089
  let simpleSetCurrentInstance;
@@ -7335,7 +7444,7 @@ function getComponentPublicInstance(instance) {
7335
7444
  return instance.proxy;
7336
7445
  }
7337
7446
  }
7338
- const classifyRE = /(?:^|[-_])(\w)/g;
7447
+ const classifyRE = /(?:^|[-_])\w/g;
7339
7448
  const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
7340
7449
  function getComponentName(Component, includeInferred = true) {
7341
7450
  return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
@@ -7370,7 +7479,7 @@ const computed = (getterOrOptions, debugOptions) => {
7370
7479
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
7371
7480
  };
7372
7481
 
7373
- const version = "3.6.0-alpha.2";
7482
+ const version = "3.6.0-alpha.4";
7374
7483
  const warn = warn$1 ;
7375
7484
  const _ssrUtils = {
7376
7485
  createComponentInstance: createComponentInstance$1,
@@ -7488,7 +7597,7 @@ const vShowHidden = Symbol("_vsh");
7488
7597
 
7489
7598
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
7490
7599
 
7491
- const displayRE = /(^|;)\s*display\s*:/;
7600
+ const displayRE = /(?:^|;)\s*display\s*:/;
7492
7601
  function patchStyle(el, prev, next) {
7493
7602
  const style = el.style;
7494
7603
  const isCssString = isString(next);
@@ -7825,7 +7934,7 @@ let renderer;
7825
7934
  function ensureRenderer() {
7826
7935
  return renderer || (renderer = createRenderer(rendererOptions));
7827
7936
  }
7828
- const createApp = (...args) => {
7937
+ const createApp = ((...args) => {
7829
7938
  const app = ensureRenderer().createApp(...args);
7830
7939
  {
7831
7940
  injectNativeTagCheck(app);
@@ -7850,7 +7959,7 @@ const createApp = (...args) => {
7850
7959
  return proxy;
7851
7960
  };
7852
7961
  return app;
7853
- };
7962
+ });
7854
7963
  function resolveRootNamespace(container) {
7855
7964
  if (container instanceof SVGElement) {
7856
7965
  return "svg";
@@ -8037,6 +8146,8 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
8037
8146
  );
8038
8147
  } else if (fallbackRenderFn) {
8039
8148
  fallbackRenderFn();
8149
+ } else if (transition) {
8150
+ push(`<!---->`);
8040
8151
  }
8041
8152
  } else {
8042
8153
  let isEmptySlot = true;
@@ -8061,13 +8172,19 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
8061
8172
  start++;
8062
8173
  end--;
8063
8174
  }
8064
- for (let i = start; i < end; i++) {
8065
- push(slotBuffer[i]);
8175
+ if (start < end) {
8176
+ for (let i = start; i < end; i++) {
8177
+ push(slotBuffer[i]);
8178
+ }
8179
+ } else if (transition) {
8180
+ push(`<!---->`);
8066
8181
  }
8067
8182
  }
8068
8183
  }
8069
8184
  } else if (fallbackRenderFn) {
8070
8185
  fallbackRenderFn();
8186
+ } else if (transition) {
8187
+ push(`<!---->`);
8071
8188
  }
8072
8189
  }
8073
8190
  const commentTestRE = /^<!--[\s\S]*-->$/;